blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
352
e5ddae91eda254e76d40e97ed10cb3586c378361
ca83f813322a3276367c8b2c13b771e4a953b438
/ManagingSoftware/src/application/AddComment.java
edc4ce3ea213d744bfdceaa58a3baa1c201ae4a4
[]
no_license
Mahamudrahat/ManagingSoftware
691f6bcf677e1a9bc6251cd754319cde2a2f6993
442571fefe09dbcb419a75ce8f6a68cd4acd47af
refs/heads/master
2021-08-22T07:34:00.240763
2017-11-29T16:39:33
2017-11-29T16:39:33
112,496,786
0
0
null
null
null
null
UTF-8
Java
false
false
3,604
java
package application; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import application.UpdateTask.UpdateTask1; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; public class AddComment { int i=1,j=1; Text text=new Text("Add Comment"); Label l1=new Label("Select Project"); Label l2=new Label("Select task"); Label l3=new Label("Comment"); Label l4=new Label("Comment by"); ComboBox<String> cb1=new ComboBox(); ComboBox<String> cb2=new ComboBox(); TextField t1=new TextField(); TextField t2=new TextField(); Button b1=new Button("Save"); Pane pane=new Pane(); Stage stage=new Stage(); String JDBC_DRIVER="com.mysql.jdbc.Driver"; String DB_URL="jdbc:mysql://localhost/managingsoft"; Connection conn=null; Statement stmt=null; public void Comment(){ text.setFont(Font.font("o",FontWeight.NORMAL,30)); text.setFill(Color.BLACK); text.relocate(100, 50); l1.relocate(20,150 ); l1.setPrefSize(200, 30); l1.setFont(Font.font("o",FontWeight.NORMAL,20)); cb1.relocate(170, 150); cb1.setPrefSize(200, 30); l2.relocate(20,200 ); l2.setPrefSize(200, 30); l2.setFont(Font.font("o",FontWeight.NORMAL,20)); cb2.relocate(170, 200); cb2.setPrefSize(200, 30); l3.relocate(20,250 ); l3.setPrefSize(150, 30); l3.setFont(Font.font("o",FontWeight.NORMAL,20)); t1.relocate(170, 250); t1.setPrefSize(200, 100); l4.relocate(20,350 ); l4.setPrefSize(200, 100); l4.setFont(Font.font("o",FontWeight.NORMAL,20)); t2.relocate(170, 380); t2.setPrefSize(200, 30); b1.relocate(250, 500); b1.setPrefSize(100, 30); pane.getChildren().addAll(l1,l2,l3,l4,cb1,cb2,text,b1,t1,t2); try{ Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,"root",""); System.out.println("Successfully connected"); stmt=conn.createStatement(); String query="select Name from updateproject "; ResultSet rset = stmt.executeQuery(query); while(rset.next()){ String s=rset.getString(i); cb1.getItems().addAll(s); }i++; }catch (Exception ex){ ex.printStackTrace(); } try{ Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,"root",""); System.out.println("Successfully connected"); stmt=conn.createStatement(); String query="select Select_task from updateproject "; ResultSet rset = stmt.executeQuery(query); while(rset.next()){ String s=rset.getString(j); cb2.getItems().addAll(s); }j++; }catch (Exception ex){ ex.printStackTrace(); } b1.setOnAction(e1->{ AddComment1 a=new AddComment1(); a.Comment1(); }); pane.setPrefSize(650, 650); Scene scene=new Scene(pane); stage.setScene(scene); stage.show(); } public class AddComment1 extends Button{ public void Comment1(){ try{ Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,"root",""); System.out.println("Successfully connected"); stmt=conn.createStatement(); String query="insert into addcomment values('"+cb1.getValue()+"','"+cb2.getValue()+"','"+t1.getText()+"','"+t2.getText()+"')"; stmt.executeUpdate(query); System.out.println("Successfully connected"); }catch (Exception ex){ ex.printStackTrace(); } } } }
dbff05832ab5c2a8f7d6c12b2870df68de8ead0f
9cd7569e22faac1aab44f93478879f1e3f8ad2b0
/gogo-start/src/main/java/com/lhj/gogo/start/SampleWebFreeMarkerApplication.java
1c907caa57f0767903e62c6ee3ef4625ba997d7c
[]
no_license
heartlhj/spring-boot-mybatis
1c4c76fda4314c038020b3825682f13f0634ca20
c87f1d8560ff4f258a82590d994261aa8c52cc1c
refs/heads/master
2018-08-29T11:57:22.404427
2018-06-03T14:38:49
2018-06-03T14:43:01
117,174,821
0
0
null
null
null
null
UTF-8
Java
false
false
1,943
java
/* * Copyright 2012-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.lhj.gogo.start; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.PropertySource; @Configuration @ServletComponentScan @SpringBootApplication @ImportResource("classpath:dubbo.xml") @MapperScan("com.lhj.gogo.**.dao") @PropertySource(value = { "classpath:env.properties","classpath:httpclient.properties" }) @ComponentScan(basePackages = "com.lhj.gogo") public class SampleWebFreeMarkerApplication extends SpringBootServletInitializer{ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(SampleWebFreeMarkerApplication.class); } public static void main(String[] args) throws Exception { SpringApplication.run(SampleWebFreeMarkerApplication.class, args); } }
[ "75449@LAPTOP-UQITVP5U" ]
75449@LAPTOP-UQITVP5U
14db238c531a578e07432fe1896db63e82b42a03
7eb9582ba37787a3d9a41b58da728ae8f1a5570e
/src/main/java/com/v2maestros/spark/bda/common/SparkConnection.java
76d237d0a442be29391e5fddc1c5ad576f110ec1
[]
no_license
manojbhosale/sparkDemo
78caabca2cfba6130f36640801409b87fcf04d99
2c0748b981ac2607814a96bfa1c83ef387012c69
refs/heads/master
2020-03-19T01:11:55.713074
2018-05-31T03:55:52
2018-05-31T03:55:52
135,529,119
1
0
null
null
null
null
UTF-8
Java
false
false
1,916
java
/** File provided by V2 Maestros for its students for education purposes only * Copyright @2016 All rights reserved. */ package com.v2maestros.spark.bda.common; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.sql.SparkSession ; import java.util.List; import org.apache.spark.SparkConf; public class SparkConnection { //A name for the spark instance. Can be any string private static String appName = "V2 Maestros"; //Pointer / URL to the Spark instance - embedded private static String sparkMaster = "local[2]"; private static JavaSparkContext spContext = null; private static SparkSession sparkSession = null; private static String tempDir = "file:///C:/Manoj/Progamming/MachineLearning/Udemy/Spark_Java/spark-warehouse"; private static void getConnection() { if ( spContext == null) { //Setup Spark configuration SparkConf conf = new SparkConf() .setAppName(appName) .setMaster(sparkMaster); //Make sure you download the winutils binaries into this directory //from https://github.com/srccodes/hadoop-common-2.2.0-bin/archive/master.zip System.setProperty("hadoop.home.dir", "C:\\Manoj\\Progamming\\MachineLearning\\Udemy\\Spark_Java\\winUtils\\hadoop-common-2.2.0-bin-master"); //Create Spark Context from configuration spContext = new JavaSparkContext(conf); sparkSession = SparkSession .builder() .appName(appName) .master(sparkMaster) .config("spark.sql.warehouse.dir", tempDir) .getOrCreate(); } } public static JavaSparkContext getContext() { if ( spContext == null ) { getConnection(); } return spContext; } public static SparkSession getSession() { if ( sparkSession == null) { getConnection(); } return sparkSession; } }
0d284cad7eb10d14505f54666663996d360929af
5ec06dab1409d790496ce082dacb321392b32fe9
/clients/java-msf4j/generated/src/gen/java/org/openapitools/model/ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties.java
4a308d8883d80c70573d5aaa4c8421f5d39918f0
[ "Apache-2.0" ]
permissive
shinesolutions/swagger-aem-osgi
e9d2385f44bee70e5bbdc0d577e99a9f2525266f
c2f6e076971d2592c1cbd3f70695c679e807396b
refs/heads/master
2022-10-29T13:07:40.422092
2021-04-09T07:46:03
2021-04-09T07:46:03
190,217,155
3
3
Apache-2.0
2022-10-05T03:26:20
2019-06-04T14:23:28
null
UTF-8
Java
false
false
2,337
java
package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.ConfigNodePropertyArray; /** * ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaMSF4JServerCodegen", date = "2019-08-05T00:54:29.762Z[GMT]") public class ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties { @JsonProperty("hc.tags") private ConfigNodePropertyArray hcTags = null; public ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties hcTags(ConfigNodePropertyArray hcTags) { this.hcTags = hcTags; return this; } /** * Get hcTags * @return hcTags **/ @ApiModelProperty(value = "") public ConfigNodePropertyArray getHcTags() { return hcTags; } public void setHcTags(ConfigNodePropertyArray hcTags) { this.hcTags = hcTags; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties comAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties = (ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties) o; return Objects.equals(this.hcTags, comAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties.hcTags); } @Override public int hashCode() { return Objects.hash(hcTags); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ComAdobeGraniteRepositoryHcImplDefaultAccessUserProfileHealthCheProperties {\n"); sb.append(" hcTags: ").append(toIndentedString(hcTags)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
f9e2a3a74208a14693990ae4ee3416ecc22c58f3
77623d6dd90f2d1a401ee720adb41c3c0c264715
/DiffTGen-result/output/Chart_11_1_capgen/patch/instru1/ShapeUtilities.java
cd2f024b49587210a1d5e7f0815acc328abba144
[]
no_license
wuhongjun15/overfitting-study
40be0f062bbd6716d8de6b06454b8c73bae3438d
5093979e861cda6575242d92ca12355a26ca55e0
refs/heads/master
2021-04-17T05:37:48.393527
2020-04-11T01:53:53
2020-04-11T01:53:53
249,413,962
0
0
null
null
null
null
UTF-8
Java
false
false
23,465
java
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2008, 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.] * * ------------------- * ShapeUtilities.java * ------------------- * (C)opyright 2003-2008, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * * Changes * ------- * 13-Aug-2003 : Version 1 (DG); * 16-Mar-2004 : Moved rotateShape() from RefineryUtilities.java to here (DG); * 13-May-2004 : Added new shape creation methods (DG); * 30-Sep-2004 : Added createLineRegion() method (DG); * Moved drawRotatedShape() method from RefineryUtilities class * to this class (DG); * 04-Oct-2004 : Renamed ShapeUtils --> ShapeUtilities (DG); * 26-Oct-2004 : Added a method to test the equality of two Line2D * instances (DG); * 10-Nov-2004 : Added new translateShape() and equal(Ellipse2D, Ellipse2D) * methods (DG); * 11-Nov-2004 : Renamed translateShape() --> createTranslatedShape() (DG); * 07-Jan-2005 : Minor Javadoc fix (DG); * 11-Jan-2005 : Removed deprecated code in preparation for 1.0.0 release (DG); * 21-Jan-2005 : Modified return type of RectangleAnchor.coordinates() * method (DG); * 22-Feb-2005 : Added equality tests for Arc2D and GeneralPath (DG); * 16-Mar-2005 : Fixed bug where equal(Shape, Shape) fails for two Polygon * instances (DG); * 20-Jun-2007 : Copied from JCommon (DG); * 02-Jun-2008 : Fixed bug in equal(GeneralPath, GeneralPath) (DG); * */ package org.jfree.chart.util; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Arc2D; import java.awt.geom.Ellipse2D; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.PathIterator; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.util.Arrays; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import myprinter.FieldPrinter; /** * Utility methods for {@link Shape} objects. */ public class ShapeUtilities { public static int eid_ShapeUtilities_7au3e = 0; public static int eid_clone_Shape_7au3e = 0; public static int eid_equal_Shape_Shape_7au3e = 0; public static int eid_equal_Line2D_Line2D_7au3e = 0; public static int eid_equal_Ellipse2D_Ellipse2D_7au3e = 0; public static int eid_equal_Arc2D_Arc2D_7au3e = 0; public static int eid_equal_Polygon_Polygon_7au3e = 0; public static int eid_equal_GeneralPath_GeneralPath_7au3e = 0; public static int eid_createTranslatedShape_Shape_double_double_7au3e = 0; public static int eid_createTranslatedShape_Shape_RectangleAnchor_double_double_7au3e = 0; public static int eid_rotateShape_Shape_double_float_float_7au3e = 0; public static int eid_drawRotatedShape_Graphics2D_Shape_double_float_float_7au3e = 0; public static int eid_createDiagonalCross_float_float_7au3e = 0; public static int eid_createRegularCross_float_float_7au3e = 0; public static int eid_createDiamond_float_7au3e = 0; public static int eid_createUpTriangle_float_7au3e = 0; public static int eid_createDownTriangle_float_7au3e = 0; public static int eid_createLineRegion_Line2D_float_7au3e = 0; public static int eid_getPointInRectangle_double_double_Rectangle2D_7au3e = 0; public static int eid_contains_Rectangle2D_Rectangle2D_7au3e = 0; public static int eid_intersects_Rectangle2D_Rectangle2D_7au3e = 0; public static Map oref_map = new HashMap(); public static void addToORefMap(String msig, Object obj) { List l = (List) oref_map.get(msig); if (l == null) { l = new ArrayList(); oref_map.put(msig, l); } l.add(obj); } public static void clearORefMap() { oref_map.clear(); eid_ShapeUtilities_7au3e = 0; eid_clone_Shape_7au3e = 0; eid_equal_Shape_Shape_7au3e = 0; eid_equal_Line2D_Line2D_7au3e = 0; eid_equal_Ellipse2D_Ellipse2D_7au3e = 0; eid_equal_Arc2D_Arc2D_7au3e = 0; eid_equal_Polygon_Polygon_7au3e = 0; eid_equal_GeneralPath_GeneralPath_7au3e = 0; eid_createTranslatedShape_Shape_double_double_7au3e = 0; eid_createTranslatedShape_Shape_RectangleAnchor_double_double_7au3e = 0; eid_rotateShape_Shape_double_float_float_7au3e = 0; eid_drawRotatedShape_Graphics2D_Shape_double_float_float_7au3e = 0; eid_createDiagonalCross_float_float_7au3e = 0; eid_createRegularCross_float_float_7au3e = 0; eid_createDiamond_float_7au3e = 0; eid_createUpTriangle_float_7au3e = 0; eid_createDownTriangle_float_7au3e = 0; eid_createLineRegion_Line2D_float_7au3e = 0; eid_getPointInRectangle_double_double_Rectangle2D_7au3e = 0; eid_contains_Rectangle2D_Rectangle2D_7au3e = 0; eid_intersects_Rectangle2D_Rectangle2D_7au3e = 0; } /** * Prevents instantiation. */ private ShapeUtilities() { } /** * Returns a clone of the specified shape, or <code>null</code>. At the * current time, this method supports cloning for instances of * <code>Line2D</code>, <code>RectangularShape</code>, <code>Area</code> * and <code>GeneralPath</code>. * <p> * <code>RectangularShape</code> includes <code>Arc2D</code>, * <code>Ellipse2D</code>, <code>Rectangle2D</code>, * <code>RoundRectangle2D</code>. * * @param shape the shape to clone (<code>null</code> permitted, * returns <code>null</code>). * * @return A clone or <code>null</code>. */ public static Shape clone(Shape shape) { if (shape instanceof Cloneable) { try { return (Shape) ObjectUtilities.clone(shape); } catch (CloneNotSupportedException cnse) { } } Shape result = null; return result; } /** * Tests two shapes for equality. If both shapes are <code>null</code>, * this method will return <code>true</code>. * <p> * In the current implementation, the following shapes are supported: * <code>Ellipse2D</code>, <code>Line2D</code> and <code>Rectangle2D</code> * (implicit). * * @param s1 the first shape (<code>null</code> permitted). * @param s2 the second shape (<code>null</code> permitted). * * @return A boolean. */ public static boolean equal(Shape s1, Shape s2) { if (s1 instanceof Line2D && s2 instanceof Line2D) { return equal((Line2D) s1, (Line2D) s2); } else if (s1 instanceof Ellipse2D && s2 instanceof Ellipse2D) { return equal((Ellipse2D) s1, (Ellipse2D) s2); } else if (s1 instanceof Arc2D && s2 instanceof Arc2D) { return equal((Arc2D) s1, (Arc2D) s2); } else if (s1 instanceof Polygon && s2 instanceof Polygon) { return equal((Polygon) s1, (Polygon) s2); } else if (s1 instanceof GeneralPath && s2 instanceof GeneralPath) { return equal((GeneralPath) s1, (GeneralPath) s2); } else { // this will handle Rectangle2D... return ObjectUtilities.equal(s1, s2); } } /** * Compares two lines are returns <code>true</code> if they are equal or * both <code>null</code>. * * @param l1 the first line (<code>null</code> permitted). * @param l2 the second line (<code>null</code> permitted). * * @return A boolean. */ public static boolean equal(Line2D l1, Line2D l2) { if (l1 == null) { return (l2 == null); } if (l2 == null) { return false; } if (!l1.getP1().equals(l2.getP1())) { return false; } if (!l1.getP2().equals(l2.getP2())) { return false; } return true; } /** * Compares two ellipses and returns <code>true</code> if they are equal or * both <code>null</code>. * * @param e1 the first ellipse (<code>null</code> permitted). * @param e2 the second ellipse (<code>null</code> permitted). * * @return A boolean. */ public static boolean equal(Ellipse2D e1, Ellipse2D e2) { if (e1 == null) { return (e2 == null); } if (e2 == null) { return false; } if (!e1.getFrame().equals(e2.getFrame())) { return false; } return true; } /** * Compares two arcs and returns <code>true</code> if they are equal or * both <code>null</code>. * * @param a1 the first arc (<code>null</code> permitted). * @param a2 the second arc (<code>null</code> permitted). * * @return A boolean. */ public static boolean equal(Arc2D a1, Arc2D a2) { if (a1 == null) { return (a2 == null); } if (a2 == null) { return false; } if (!a1.getFrame().equals(a2.getFrame())) { return false; } if (a1.getAngleStart() != a2.getAngleStart()) { return false; } if (a1.getAngleExtent() != a2.getAngleExtent()) { return false; } if (a1.getArcType() != a2.getArcType()) { return false; } return true; } /** * Tests two polygons for equality. If both are <code>null</code> this * method returns <code>true</code>. * * @param p1 polygon 1 (<code>null</code> permitted). * @param p2 polygon 2 (<code>null</code> permitted). * * @return A boolean. */ public static boolean equal(Polygon p1, Polygon p2) { if (p1 == null) { return (p2 == null); } if (p2 == null) { return false; } if (p1.npoints != p2.npoints) { return false; } if (!Arrays.equals(p1.xpoints, p2.xpoints)) { return false; } if (!Arrays.equals(p1.ypoints, p2.ypoints)) { return false; } return true; } /** * Tests two polygons for equality. If both are <code>null</code> this * method returns <code>true</code>. * * @param p1 path 1 (<code>null</code> permitted). * @param p2 path 2 (<code>null</code> permitted). * * @return A boolean. */ public static boolean equal_7au3e(GeneralPath p1, GeneralPath p2) { if (p1 == null) { return (p2 == null); } if (p2 == null) { return false; } if (p1.getWindingRule() != p2.getWindingRule()) { return false; } PathIterator iterator1 = p2.getPathIterator(null); PathIterator iterator2 = p1.getPathIterator(null); double[] d1 = new double[6]; double[] d2 = new double[6]; boolean done = iterator1.isDone() && iterator2.isDone(); while (!done) { if (iterator1.isDone() != iterator2.isDone()) { return false; } int seg1 = iterator1.currentSegment(d1); int seg2 = iterator2.currentSegment(d2); if (seg1 != seg2) { return false; } if (!Arrays.equals(d1, d2)) { return false; } iterator1.next(); iterator2.next(); done = iterator1.isDone() && iterator2.isDone(); } return true; } /** * Creates and returns a translated shape. * * @param shape the shape (<code>null</code> not permitted). * @param transX the x translation (in Java2D space). * @param transY the y translation (in Java2D space). * * @return The translated shape. */ public static Shape createTranslatedShape(Shape shape, double transX, double transY) { if (shape == null) { throw new IllegalArgumentException("Null 'shape' argument."); } AffineTransform transform = AffineTransform.getTranslateInstance( transX, transY); return transform.createTransformedShape(shape); } /** * Translates a shape to a new location such that the anchor point * (relative to the rectangular bounds of the shape) aligns with the * specified (x, y) coordinate in Java2D space. * * @param shape the shape (<code>null</code> not permitted). * @param anchor the anchor (<code>null</code> not permitted). * @param locationX the x-coordinate (in Java2D space). * @param locationY the y-coordinate (in Java2D space). * * @return A new and translated shape. */ public static Shape createTranslatedShape(Shape shape, RectangleAnchor anchor, double locationX, double locationY) { if (shape == null) { throw new IllegalArgumentException("Null 'shape' argument."); } if (anchor == null) { throw new IllegalArgumentException("Null 'anchor' argument."); } Point2D anchorPoint = RectangleAnchor.coordinates(shape.getBounds2D(), anchor); AffineTransform transform = AffineTransform.getTranslateInstance( locationX - anchorPoint.getX(), locationY - anchorPoint.getY()); return transform.createTransformedShape(shape); } /** * Rotates a shape about the specified coordinates. * * @param base the shape (<code>null</code> permitted, returns * <code>null</code>). * @param angle the angle (in radians). * @param x the x coordinate for the rotation point (in Java2D space). * @param y the y coordinate for the rotation point (in Java2D space). * * @return the rotated shape. */ public static Shape rotateShape(Shape base, double angle, float x, float y) { if (base == null) { return null; } AffineTransform rotate = AffineTransform.getRotateInstance(angle, x, y); Shape result = rotate.createTransformedShape(base); return result; } /** * Draws a shape with the specified rotation about <code>(x, y)</code>. * * @param g2 the graphics device (<code>null</code> not permitted). * @param shape the shape (<code>null</code> not permitted). * @param angle the angle (in radians). * @param x the x coordinate for the rotation point. * @param y the y coordinate for the rotation point. */ public static void drawRotatedShape(Graphics2D g2, Shape shape, double angle, float x, float y) { AffineTransform saved = g2.getTransform(); AffineTransform rotate = AffineTransform.getRotateInstance(angle, x, y); g2.transform(rotate); g2.draw(shape); g2.setTransform(saved); } /** A useful constant used internally. */ private static final float SQRT2 = (float) Math.pow(2.0, 0.5); /** * Creates a diagonal cross shape. * * @param l the length of each 'arm'. * @param t the thickness. * * @return A diagonal cross shape. */ public static Shape createDiagonalCross(float l, float t) { GeneralPath p0 = new GeneralPath(); p0.moveTo(-l - t, -l + t); p0.lineTo(-l + t, -l - t); p0.lineTo(0.0f, -t * SQRT2); p0.lineTo(l - t, -l - t); p0.lineTo(l + t, -l + t); p0.lineTo(t * SQRT2, 0.0f); p0.lineTo(l + t, l - t); p0.lineTo(l - t, l + t); p0.lineTo(0.0f, t * SQRT2); p0.lineTo(-l + t, l + t); p0.lineTo(-l - t, l - t); p0.lineTo(-t * SQRT2, 0.0f); p0.closePath(); return p0; } /** * Creates a diagonal cross shape. * * @param l the length of each 'arm'. * @param t the thickness. * * @return A diagonal cross shape. */ public static Shape createRegularCross(float l, float t) { GeneralPath p0 = new GeneralPath(); p0.moveTo(-l, t); p0.lineTo(-t, t); p0.lineTo(-t, l); p0.lineTo(t, l); p0.lineTo(t, t); p0.lineTo(l, t); p0.lineTo(l, -t); p0.lineTo(t, -t); p0.lineTo(t, -l); p0.lineTo(-t, -l); p0.lineTo(-t, -t); p0.lineTo(-l, -t); p0.closePath(); return p0; } /** * Creates a diamond shape. * * @param s the size factor (equal to half the height of the diamond). * * @return A diamond shape. */ public static Shape createDiamond(float s) { GeneralPath p0 = new GeneralPath(); p0.moveTo(0.0f, -s); p0.lineTo(s, 0.0f); p0.lineTo(0.0f, s); p0.lineTo(-s, 0.0f); p0.closePath(); return p0; } /** * Creates a triangle shape that points upwards. * * @param s the size factor (equal to half the height of the triangle). * * @return A triangle shape. */ public static Shape createUpTriangle(float s) { GeneralPath p0 = new GeneralPath(); p0.moveTo(0.0f, -s); p0.lineTo(s, s); p0.lineTo(-s, s); p0.closePath(); return p0; } /** * Creates a triangle shape that points downwards. * * @param s the size factor (equal to half the height of the triangle). * * @return A triangle shape. */ public static Shape createDownTriangle(float s) { GeneralPath p0 = new GeneralPath(); p0.moveTo(0.0f, s); p0.lineTo(s, -s); p0.lineTo(-s, -s); p0.closePath(); return p0; } /** * Creates a region surrounding a line segment by 'widening' the line * segment. A typical use for this method is the creation of a * 'clickable' region for a line that is displayed on-screen. * * @param line the line (<code>null</code> not permitted). * @param width the width of the region. * * @return A region that surrounds the line. */ public static Shape createLineRegion(Line2D line, float width) { GeneralPath result = new GeneralPath(); float x1 = (float) line.getX1(); float x2 = (float) line.getX2(); float y1 = (float) line.getY1(); float y2 = (float) line.getY2(); if ((x2 - x1) != 0.0) { double theta = Math.atan((y2 - y1) / (x2 - x1)); float dx = (float) Math.sin(theta) * width; float dy = (float) Math.cos(theta) * width; result.moveTo(x1 - dx, y1 + dy); result.lineTo(x1 + dx, y1 - dy); result.lineTo(x2 + dx, y2 - dy); result.lineTo(x2 - dx, y2 + dy); result.closePath(); } else { // special case, vertical line result.moveTo(x1 - width / 2.0f, y1); result.lineTo(x1 + width / 2.0f, y1); result.lineTo(x2 + width / 2.0f, y2); result.lineTo(x2 - width / 2.0f, y2); result.closePath(); } return result; } /** * Returns a point based on (x, y) but constrained to be within the bounds * of a given rectangle. * * @param x the x-coordinate. * @param y the y-coordinate. * @param area the constraining rectangle (<code>null</code> not * permitted). * * @return A point within the rectangle. * * @throws NullPointerException if <code>area</code> is <code>null</code>. */ public static Point2D getPointInRectangle(double x, double y, Rectangle2D area) { x = Math.max(area.getMinX(), Math.min(x, area.getMaxX())); y = Math.max(area.getMinY(), Math.min(y, area.getMaxY())); return new Point2D.Double(x, y); } /** * Checks, whether the given rectangle1 fully contains rectangle 2 * (even if rectangle 2 has a height or width of zero!). * * @param rect1 the first rectangle. * @param rect2 the second rectangle. * * @return A boolean. */ public static boolean contains(Rectangle2D rect1, Rectangle2D rect2) { double x0 = rect1.getX(); double y0 = rect1.getY(); double x = rect2.getX(); double y = rect2.getY(); double w = rect2.getWidth(); double h = rect2.getHeight(); return ((x >= x0) && (y >= y0) && ((x + w) <= (x0 + rect1.getWidth())) && ((y + h) <= (y0 + rect1.getHeight()))); } /** * Checks, whether the given rectangle1 fully contains rectangle 2 * (even if rectangle 2 has a height or width of zero!). * * @param rect1 the first rectangle. * @param rect2 the second rectangle. * * @return A boolean. */ public static boolean intersects(Rectangle2D rect1, Rectangle2D rect2) { double x0 = rect1.getX(); double y0 = rect1.getY(); double x = rect2.getX(); double width = rect2.getWidth(); double y = rect2.getY(); double height = rect2.getHeight(); return (x + width >= x0 && y + height >= y0 && x <= x0 + rect1.getWidth() && y <= y0 + rect1.getHeight()); } /** * Tests two polygons for equality. If both are <code>null</code> this method returns <code>true</code>. * @param p1 path 1 (<code>null</code> permitted). * @param p2 path 2 (<code>null</code> permitted). * @return A boolean. */ public static boolean equal(GeneralPath p1, GeneralPath p2) { Object o_7au3e = null; String c_7au3e = "org.jfree.chart.util.ShapeUtilities"; String msig_7au3e = "equal(GeneralPath$GeneralPath)" + eid_equal_GeneralPath_GeneralPath_7au3e; try { o_7au3e = equal_7au3e(p1, p2); addToORefMap(msig_7au3e, o_7au3e); addToORefMap(msig_7au3e, null); addToORefMap(msig_7au3e, p1); addToORefMap(msig_7au3e, p2); } catch (Throwable t7au3e) { addToORefMap(msig_7au3e, t7au3e); throw t7au3e; } finally { eid_equal_GeneralPath_GeneralPath_7au3e++; } return (boolean) o_7au3e; } }
56d07c37c8159f73a723129c9135962c81116d88
11c4237370e98f6acb97965b1ada63acd1a021a9
/Genetik-Springboot/src/main/java/sopra/formation/repository/IParametresGenetiquesRepository.java
692039820871195569ebfdd0b42e415b8ade49a3
[]
no_license
Granscythe/Genetik-Final
a8bc08446e437a15aeb87cfd0864080a2b347151
368927b0e521cd1c411bfd19e617d452ac04d226
refs/heads/main
2023-07-17T08:19:20.475118
2021-08-19T15:16:31
2021-08-19T15:16:31
397,878,628
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package sopra.formation.repository; import org.springframework.data.jpa.repository.JpaRepository; import sopra.formation.model.ParametresGenetiques; public interface IParametresGenetiquesRepository extends JpaRepository<ParametresGenetiques, Long>{ }
d7ae66e8b68f8751b9fcda8d390c7e9c6cc793fa
25dd102dc1816f3009a17a54f61277947018dce4
/src/main/java/com/ritesh/movierental/Movie.java
d71564c8fb9d73a4b47e2bad436b6428950301cf
[]
no_license
ritesh705/clean-code
10963159ae815963a707a1697842fb9200500d37
4004c62d1d6cdb796aa8403639e59c91b57624fb
refs/heads/master
2020-05-24T17:29:13.044369
2019-07-28T09:42:08
2019-07-28T09:42:08
187,387,068
0
0
null
null
null
null
UTF-8
Java
false
false
1,575
java
package com.ritesh.movierental; public class Movie { public static final int CHILDRENS = 2; public static final int REGULAR = 0; public static final int NEW_RELEASE = 1; public static final int REGULAR_MOVIE_RATE = 2; public static final int REGULAR_MOVIE_THRESHOLD_DAYS = 2; private String title; private int priceCode; public Movie(String title, int priceCode) { this.title = title; this.priceCode = priceCode; } public int getPriceCode() { return priceCode; } public void setPriceCode(int arg) { priceCode = arg; } public String getTitle() { return title; } boolean isNewRelease() { return this.getPriceCode() == NEW_RELEASE; } double amount(int daysRented) { double currentRentalAmount = 0; switch (this.getPriceCode()) { case REGULAR: currentRentalAmount = new RegularMovieCalculator().amount(daysRented, currentRentalAmount); break; case NEW_RELEASE: currentRentalAmount = new NewMovieCalculator().amount(daysRented, currentRentalAmount); break; case CHILDRENS: currentRentalAmount = new ChildrenMovieCalculator().amount(daysRented, currentRentalAmount); break; } return currentRentalAmount; } boolean isBonusApplicable(int daysRented) { return isNewRelease() && daysRented > 1; } public int frequentRenterPoints(int daysRented) { int frequentRenterPoints = 1; if (isBonusApplicable(daysRented)) frequentRenterPoints++; return frequentRenterPoints; } }
4c79f647128171b8f8d9952765eb34738211d672
f4b9031798dd84fdc4c3b5d74914db43f951fd9a
/Zettelkasten/app/src/main/java/space/lopstory/zettelkasten/Helper.java
d2f9d4795ef959fe2cf4f45f634a2652892b47f3
[]
no_license
NikitaVladimirov2003/Samsung
4fb7dd773b17c8423e7041386a357add6290d96c
bb54a4986b76b81d205ac0efb7e4ebd8e409601f
refs/heads/main
2023-05-07T06:01:09.165134
2021-05-28T18:14:31
2021-05-28T18:14:31
295,140,060
0
0
null
null
null
null
UTF-8
Java
false
false
3,827
java
package space.lopstory.zettelkasten; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.provider.Settings; import android.telephony.CellSignalStrength; import android.util.Log; import android.widget.Toast; import androidx.annotation.NonNull; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ThrowOnExtraProperties; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.EventListener; import space.lopstory.zettelkasten.NoteData.Note; public class Helper { public static Context context; public static void flush( String strHead, String strContent){ String[] params = new String[] { strHead,strContent}; MyAsyncTask myAsyncTask = new MyAsyncTask(); myAsyncTask.execute( params ); } private static class MyAsyncTask extends AsyncTask<String, Void, Void>{ private static DatabaseReference myDataBase = FirebaseDatabase.getInstance().getReference().child(constant.User).child(constant.Email); private Integer GlobalNoteID; private static ArrayList<String> convert_tags(String strContent){ ArrayList<String> tags = new ArrayList<>(); String words[] = strContent.replace( '\n', ' ' ).split( " " ); for(String s : words){ if(s.charAt( 0 ) == '#'){ s = s.replace( '.',' ' ); s = s.replace( "#", "" ); s = s.toLowerCase(); tags.add( s ); } } return tags; } @Override //TODO protected Void doInBackground(String... strings) { myDataBase.child( constant.GlobalNoteID ).get().addOnCompleteListener( new OnCompleteListener<DataSnapshot>() { @Override public void onComplete(@NonNull Task<DataSnapshot> task) { if(task.isSuccessful() && task.getResult().getValue(Integer.class) != null) GlobalNoteID = task.getResult().getValue(Integer.class).intValue(); else { myDataBase.child( constant.GlobalNoteID ).setValue( 1 ); GlobalNoteID = 1; } //Todo String strHead = strings[0], strContent = strings[1]; ArrayList<String> tags = convert_tags( strContent ); Note newNote = new Note(GlobalNoteID, strHead,strContent ); myDataBase.child( constant.notes ).push().setValue( newNote ); for(String tag : tags) { if (tag.equals( "" )) { myDataBase.child( constant.tags ).child( "EmptyTag" ).child( constant.id ).push().setValue(GlobalNoteID ); } else { myDataBase.child( constant.tags ).child( tag.trim() ).push().setValue(GlobalNoteID ); } } GlobalNoteID++; myDataBase.child( constant.GlobalNoteID ).setValue( GlobalNoteID ); } } ); return null; } @Override protected void onPreExecute() { Toast.makeText( context,"Saving" , Toast.LENGTH_SHORT).show(); } @Override protected void onPostExecute(Void aVoid) { } } }
05f81c473dc1df261194c5c504e74e5d249851ad
024432535e7e7a1c0699e2d70f70450d7c5428a2
/rx_test/src/main/java/com/sky/test/net/Urls.java
d85292a65bc8942265bf9b2a403b249e983324b4
[]
no_license
paperscz/LazyCat
a5b400dcde66ae6df5d96bd80ba5b3889a1ed0cf
70d877a740e1d929137e44f31cd9ee3252bf92fd
refs/heads/master
2020-04-13T03:33:03.614360
2018-12-21T03:07:08
2018-12-21T03:07:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package com.sky.test.net; /** * 类名称: * 类功能: * 类作者:Administrator * 类日期:2018/12/11 0011. **/ public class Urls { // 干货集中营base public static final String GANK_API_BASE = "http://gank.io/api/"; }
b1c18dbd156bd61ba7947d15e3925311c5ce2e45
a704b82eed7ecc267ee598550faf74083bd86adb
/j21/collaborate/src/main/java/com/collaborate/service/UsersServiceImpl.java
df8782cb150e1ab172d875be6310f3361fcc8d3e
[]
no_license
aganguly04/dt2016p2
61c4934c0edd4ad1ea7dd8c895470f545a537f12
1ab9f701eac1cc2c51ecbef5f72593b003bad6e5
refs/heads/master
2021-01-15T08:14:54.885268
2016-09-09T12:11:32
2016-09-09T12:11:32
61,863,947
0
0
null
null
null
null
UTF-8
Java
false
false
1,021
java
package com.collaborate.service; import java.util.List; import javax.persistence.PersistenceContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.collaborate.dao.UsersDao; import com.collaborate.model.Users; @Service("usersService") @Transactional @PersistenceContext public class UsersServiceImpl implements UsersService { @Autowired UsersDao usersDao; @Transactional public void addUsers(Users users) { // TODO Auto-generated method stub usersDao.addUsers(users); } public Users getUsersById(int userId) { // TODO Auto-generated method stub return usersDao.getUsersById(userId); } public List<Users> getAllUsers() { // TODO Auto-generated method stub return usersDao.getAllUsers(); } public Users getUsersByUsername(String userName) { // TODO Auto-generated method stub return usersDao.getUsersByUsername(userName); } }
eb582229a76e564af40f773500710435cd78ac2f
e39ccbd083c289f1a9d23dab2beeca79ea1b1ff3
/src/animals/Heart.java
ed80bb879626d395e75df4c298317fd4b9b5e910
[]
no_license
juanalbarracinprados/java_martin
18c97c0c95a7035cc9294527948a58e6b3a42003
bb009548d9dca871104e980144fd529863e68ce4
refs/heads/master
2023-06-03T03:08:52.959346
2021-06-15T17:18:21
2021-06-15T17:18:21
377,228,627
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package animals; final class Heart { public int bpm; Heart(int bpm) { this.bpm = bpm; } void beat() { this.bpm++; } }
d38e23a9847568bffb690c7844e69088d00d3c39
2294d375c2d28c74447cdfeb5f452d74ec6f9a28
/dungeoncrawler/src/main/java/whatexe/dungeoncrawler/entities/behavior/overlap/ItemCaseOverlapBehavior.java
3d1b242326c65ae09f9865015c4a00f36478e2ab
[]
no_license
Russell-Newton/NotMalware-Game
f035f1341b45e514a5b50db92e12d478d5d52321
5e30eecfeaacb7546df5bb8b10acdc7d65906dcc
refs/heads/master
2023-07-18T07:41:39.489150
2021-04-27T02:36:21
2021-04-27T02:36:21
399,507,704
1
0
null
null
null
null
UTF-8
Java
false
false
1,187
java
package whatexe.dungeoncrawler.entities.behavior.overlap; import whatexe.dungeoncrawler.entities.Entity; import whatexe.dungeoncrawler.entities.items.Item; import whatexe.dungeoncrawler.entities.player.Player; import java.util.List; public class ItemCaseOverlapBehavior extends OverlapBehavior<Item> { public ItemCaseOverlapBehavior(Item owningEntity) { super(owningEntity); } @Override public void handleOverlap(Entity otherEntity) { Player other = (Player) otherEntity; if (!other.isInventoryFull()) { if (other.getMoney() >= owningEntity.getPrice()) { owningEntity.getOwningRoom().removeEntity(owningEntity); owningEntity.setEntityPosition(0, 0); other.addItem(owningEntity); other.adjustMoney(-owningEntity.getPrice()); } } } @Override public List<? extends Entity> getPossibleOverlapTargets() { if (owningEntity.getOwningRoom().getPlayer() != null && owningEntity.getNoPickupTimer() == 0) { return List.of(owningEntity.getOwningRoom().getPlayer()); } return List.of(); } }
7e9965907b6ef20c6f30549cbbdc5e4477b68311
b7762f1540d79a82ec41aac083ce48d15689bc21
/blades-dal/src/main/java/com/iusofts/blades/sys/dao/UserOrgMapper.java
7c29661f6083af00845fd24e11d16f7483d70a78
[]
no_license
iusofts/blades-dev
be12f86a7fbe65ea99f51a9fae5b0a877254cd40
adb54df55f1d6b7f078077dc8891ac8496e03db1
refs/heads/master
2021-06-17T01:05:35.707018
2017-05-16T06:18:19
2017-05-16T06:18:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,574
java
package com.iusofts.blades.sys.dao; import com.iusofts.blades.sys.model.UserOrgExample; import com.iusofts.blades.sys.model.UserOrg; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; public interface UserOrgMapper { int countByExample(UserOrgExample example); int deleteByExample(UserOrgExample example); int deleteByPrimaryKey(String id); int insert(UserOrg record); int insertSelective(UserOrg record); List<UserOrg> selectByExample(UserOrgExample example); UserOrg selectByPrimaryKey(String id); int updateByExampleSelective(@Param("record") UserOrg record, @Param("example") UserOrgExample example); int updateByExample(@Param("record") UserOrg record, @Param("example") UserOrgExample example); int updateByPrimaryKeySelective(UserOrg record); int updateByPrimaryKey(UserOrg record); /** * 根据用户ID获取用户岗位信息 * * @param uid * @return * @author:Ivan * @date:2016年3月7日 下午5:30:19 */ List<Map<String, String>> selectByUid(String uid); /** * * 描述:根据用户id批量删除 * * @param userIds * @return * @author Asker_lve * @date 2016年3月10日 下午2:40:59 */ int deleteByUserIds(@Param("userIds")List<String> userIds); /** * * 描述: 根据用户id删除 * @param userId * @return * @author Asker_lve * @date 2016年3月10日 下午2:58:22 */ int deleteByUserId(@Param("userId") String userId); }
987e93038c0c429d05d6073d5aea00b50a0aa190
94c838307292a417a27d0fd9a9c3fa1f1100bf89
/src/main/java/com/haotian/controller/UserspaceController.java
e4e62d0895e1c8425de4f6b4068ec7acb847f850
[]
no_license
haotianya/spring-boot-blog
e99a60df0a9c8c72358144fe21c8b47b77dcd66f
0621096facb1e57ce011f685f41ca2f642aa4e17
refs/heads/master
2020-04-17T17:23:26.249992
2019-01-21T08:53:12
2019-01-21T08:53:12
166,780,460
1
0
null
null
null
null
UTF-8
Java
false
false
737
java
package com.haotian.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.haotian.service.UserService; @RestController @RequestMapping("/u") public class UserspaceController { @Autowired private UserService userService; @GetMapping("/{username}") public ModelAndView toBlog(@PathVariable("username")String username){ return new ModelAndView("userspace/blog.html"); } }
47b18591ec349afa7db46b845bdf3b2564d00614
69a13dd83a4cced3e334fe0dac5675f06c49f654
/test_modul_9/src/test_modul_9/Shape.java
e7d832ea383a1ee1d6e4b62cb83d15960cebe13a
[]
no_license
NoobEjby/Programerings_Opgaver_1.semester
88fdffcc645005b61c4e536761397fcc0b819752
3a4c92bf872b427faadf176875e15a7358cfa8f4
refs/heads/master
2020-03-28T20:43:31.127238
2018-11-05T12:57:46
2018-11-05T12:57:46
149,096,389
0
0
null
2018-10-01T12:18:30
2018-09-17T08:53:09
Java
UTF-8
Java
false
false
619
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 test_modul_9; import java.awt.Color; /** * * @author Noob */ public class Shape { private Color c; double area; public void redraw() { System.out.println("Can´t draw shape"); } public void setC(Color c) { this.c = c; } public Color getC() { return c; } @Override public String toString() { return this.c.toString() + " " + this.area; } }
ca038d6cbf9b90908e8a89a7ac357f01b7734daa
c9f808b3316a96a4d0a1555a36d6ec47ccb8fd9b
/src/com/javahis/ui/sys/SysFeeExaSheetQuote.java
6b840877ccce9139bb2bdeb2dde305ee7de22864
[]
no_license
levonyang/proper-his
f4c19b4ce46b213bf637be8e18bffa3758c64ecd
2fdcb956b0c61e8be35e056d52a97d4890cbea3f
refs/heads/master
2022-01-05T09:17:14.716629
2018-04-08T01:04:21
2018-04-08T01:04:21
null
0
0
null
null
null
null
GB18030
Java
false
false
4,366
java
package com.javahis.ui.sys; import jdo.sys.SYSRuleTool; import com.dongyang.control.TControl; import com.dongyang.data.TParm; import com.dongyang.jdo.TJDODBTool; import com.dongyang.ui.TTable; import com.dongyang.util.RunClass; import com.dongyang.util.TypeTool; /** * * <p>Title: 引用表单控制类</p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2008</p> * * <p>Company: JavaHis</p> * * @author ehui 2009.05.11 * @version 1.0 */ public class SysFeeExaSheetQuote extends TControl { TTable table; Object main; /** * 初始化 */ public void onInit() { super.onInit(); getInitParameter(); initTable(); } /** * 初始化TABLE */ public void initTable(){ TParm t0=SYSRuleTool.getExaRoot(); String tCode=t0.getValue("CATEGORY_CODE",0); TParm t1=SYSRuleTool.getExaMid(tCode); table=(TTable)this.getComponent("MENU"); table.setParmValue(t1); int count=t1.getCount(); String[] names=t1.getNames(); TParm t2=new TParm(); for(int i=0;i<count;i++){ TParm temp=SYSRuleTool.getExaDetail(t1.getValue("CATEGORY_CODE",i)); int countTemp=temp.getCount(); for(int k=0;k<countTemp;k++){ for(int j=0;j<names.length;j++){ t2.addData(names[j], temp.getValue(names[j],k)); } } } table.setParmValue(t2); } /** * 行点击事件 */ public void onClick(){ int row=table.getSelectedRow(); TParm tableParm=table.getParmValue(); String code="'"+tableParm.getValue("CATEGORY_CODE",row)+"%'"; TParm sysFee=this.queryExa(code); int count=sysFee.getCount(); TParm parm1=new TParm(); TParm parm2=new TParm(); String[] names=sysFee.getNames(); for(int i=0;i<count;i+=2){ if(i>=count) break; for(int j=0;j<names.length;j++){ parm1.addData(names[j], sysFee.getValue(names[j],i)); } } for(int i=1;i<count;i+=2){ if(i>=count) break; for(int j=0;j<names.length;j++){ parm2.addData(names[j], sysFee.getValue(names[j],i)); } } //System.out.println("parm1========"+parm1); //System.out.println("parm2========"+parm2); TTable table1=(TTable)this.getComponent("TABLE1"); TTable table2=(TTable)this.getComponent("TABLE2"); table1.setParmValue(parm1); table2.setParmValue(parm2); } /** * * @param code String * @return 查询sys_fee */ public TParm queryExa(String code){ String sql= "SELECT 'N' AS EXEC ,ORDER_CODE,ORDER_DESC,PY1,PY2," + " SEQ,DESCRIPTION,TRADE_ENG_DESC,GOODS_DESC,GOODS_PYCODE," + " ALIAS_DESC,ALIAS_PYCODE,SPECIFICATION,NHI_FEE_DESC,HABITAT_TYPE," + " MAN_CODE,HYGIENE_TRADE_CODE,ORDER_CAT1_CODE,CHARGE_HOSP_CODE,OWN_PRICE,NHI_PRICE," + " GOV_PRICE,UNIT_CODE,LET_KEYIN_FLG,DISCOUNT_FLG,EXPENSIVE_FLG," + " OPD_FIT_FLG,EMG_FIT_FLG,IPD_FIT_FLG,HRM_FIT_FLG,DR_ORDER_FLG," + " INTV_ORDER_FLG,LCS_CLASS_CODE,TRANS_OUT_FLG,TRANS_HOSP_CODE,USEDEPT_CODE," + " EXEC_ORDER_FLG,EXEC_DEPT_CODE,INSPAY_TYPE,ADDPAY_RATE,ADDPAY_AMT," + " NHI_CODE_O,NHI_CODE_E,NHI_CODE_I,CTRL_FLG,CLPGROUP_CODE," + " ORDERSET_FLG,INDV_FLG,SUB_SYSTEM_CODE,RPTTYPE_CODE,DEV_CODE," + " OPTITEM_CODE,MR_CODE,DEGREE_CODE,CIS_FLG,OPT_USER," + " OPT_DATE,OPT_TERM,CAT1_TYPE " + " FROM SYS_FEE " + " WHERE ORDER_CODE LIKE " +code; //System.out.println("SQL=============="+sql); TParm result = new TParm(TJDODBTool.getInstance().select(sql)); //System.out.println("RESULT==============="+result); return result; } /** * 回传事件 */ public void onFetchBack(String tableName){ TTable table=(TTable)this.getComponent(tableName); int row=table.getSelectedRow(); int column=table.getSelectedColumn(); if("ORDER_DESC".equalsIgnoreCase(table.getParmMap(column))){ return; } table.setValueAt("Y", row, column); TParm parm=table.getParmValue().getRow(row); String code=TypeTool.getString(parm.getValue("ORDER_CODE")); boolean result=TypeTool.getBoolean(RunClass.runMethod(main, "onQuoteSheet", new Object[]{parm})); if(result){ table.setValueAt("N", row, column); } } /** * 初始化参数 */ public void getInitParameter(){ main=this.getParameter(); } /** * 关闭 */ public boolean onClosing(){ this.setReturnValue("Y"); return true; } }
34f436daa675d66ad357998e4298a8043bb2be3a
be7255eeb02b1a4426d9526180269d87d949664e
/app/src/main/java/com/uranus/economy/base/BaseFragment.java
73994408b09eb6f71e81a83a650517bc200c5cdc
[]
no_license
uranusTian/economy
65776dc30a252ea4669b9ce0434be3915c169cf3
a7abf642053abe48aac0a50e7fbba82d20749805
refs/heads/master
2023-03-12T00:17:50.687110
2020-11-04T13:20:23
2020-11-04T13:20:23
249,207,246
0
0
null
null
null
null
UTF-8
Java
false
false
4,999
java
package com.uranus.economy.base; import android.annotation.SuppressLint; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import com.uranus.economy.util.EventBusUtils; import java.io.Serializable; import butterknife.ButterKnife; import butterknife.Unbinder; public abstract class BaseFragment extends Fragment { protected Context mContext; protected View mRoot; protected Bundle mBundle; protected Router router; protected LayoutInflater mInflater; private Unbinder bind; @Override public void onAttach(Context context) { super.onAttach(context); mContext = context; } @Override public void onDetach() { super.onDetach(); mContext = null; } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mBundle = getArguments(); initBundle(mBundle); if (router == null) { router = new Router((AppCompatActivity) getActivity()); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (mRoot != null) { ViewGroup parent = (ViewGroup) mRoot.getParent(); if (parent != null) parent.removeView(mRoot); } else { mRoot = inflater.inflate(getLayoutId(), container, false); mInflater = inflater; // Do something onBindViewBefore(mRoot); // Bind view bind = ButterKnife.bind(this, mRoot); // Get savedInstanceState if (savedInstanceState != null) onRestartInstance(savedInstanceState); // Init initWidget(mRoot); initData(); } return mRoot; } protected void onBindViewBefore(View root) { // ... } @Override public void onDestroy() { super.onDestroy(); if (bind != null) { bind.unbind(); bind = null; } EventBusUtils.unregister(this); mBundle = null; } protected abstract int getLayoutId(); protected void initBundle(Bundle bundle) { } protected void initWidget(View root) { } protected void initData() { } protected <T extends View> T findView(int viewId) { return (T) mRoot.findViewById(viewId); } protected <T extends Serializable> T getBundleSerializable(String key) { if (mBundle == null) { return null; } return (T) mBundle.getSerializable(key); } protected void setText(int viewId, String text) { TextView textView = findView(viewId); if (TextUtils.isEmpty(text)) { return; } textView.setText(text); } protected void setText(int viewId, String text, String emptyTip) { TextView textView = findView(viewId); if (TextUtils.isEmpty(text)) { textView.setText(emptyTip); return; } textView.setText(text); } protected void setTextEmptyGone(int viewId, String text) { TextView textView = findView(viewId); if (TextUtils.isEmpty(text)) { textView.setVisibility(View.GONE); return; } textView.setText(text); } protected <T extends View> T setGone(int id) { T view = findView(id); view.setVisibility(View.GONE); return view; } protected <T extends View> T setVisibility(int id) { T view = findView(id); view.setVisibility(View.VISIBLE); return view; } protected void setInVisibility(int id) { findView(id).setVisibility(View.INVISIBLE); } protected void onRestartInstance(Bundle bundle) { } protected void setStatusBarPadding() { mRoot.setPadding(0, getStatusHeight(mContext), 0, 0); } @SuppressLint("ObsoleteSdkInt,PrivateApi") private static int getStatusHeight(Context context) { int statusHeight = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { try { Class<?> clazz = Class.forName("com.android.internal.R$dimen"); Object object = clazz.newInstance(); int height = Integer.parseInt(clazz.getField("status_bar_height") .get(object).toString()); statusHeight = context.getResources().getDimensionPixelSize(height); } catch (Exception e) { e.printStackTrace(); } } return statusHeight; } }
a07e91a5e827d02e1f8df656521e26bfcb812a0e
d6894765c7e4bca52ccbf85aa50b3121941a1fcb
/src/main/java/org/jeecgframework/web/superquery/entity/SuperQueryHistoryEntity.java
1e9f195a42eb506572f0d248f4e8180adebbdba0
[]
no_license
289222346/dianshang
46b6b0173546112cccee9cca6202eac4d0da14f8
60e929615c6e59d48851e81ae5ff54d2c0b26af6
refs/heads/master
2022-12-28T08:28:08.585073
2020-01-16T13:20:03
2020-01-16T13:21:03
233,261,806
0
0
null
2022-12-16T04:24:56
2020-01-11T16:30:44
JavaScript
UTF-8
Java
false
false
6,284
java
package org.jeecgframework.web.superquery.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; import org.jeecgframework.poi.excel.annotation.Excel; /** * @Title: Entity * @Description: 高级查询历史记录 * @author onlineGenerator * @date * @version V1.0 * */ @Entity @Table(name = "super_query_history", schema = "") @SuppressWarnings("serial") public class SuperQueryHistoryEntity implements java.io.Serializable { /**主键*/ private String id; /**创建人名称*/ private String createName; /**创建人登录名称*/ private String createBy; /**创建日期*/ private java.util.Date createDate; /**更新人名称*/ private String updateName; /**更新人登录名称*/ private String updateBy; /**更新日期*/ private java.util.Date updateDate; /**所属部门*/ private String sysOrgCode; /**所属公司*/ private String sysCompanyCode; /**用户id*/ @Excel(name="用户id",width=15) private String userId; /**查询规则编码*/ @Excel(name="查询规则编码",width=15) private String queryCode; /**查询类型*/ @Excel(name="查询类型",width=15,dicCode="sel_type") private String queryType; /**说明*/ @Excel(name="记录",width=15) private String record; @Excel(name="名称",width=15) private String historyName; /** *方法: 取得java.lang.String *@return: java.lang.String 主键 */ @Id @GeneratedValue(generator = "paymentableGenerator") @GenericGenerator(name = "paymentableGenerator", strategy = "uuid") @Column(name ="ID",nullable=false,length=36) public String getId(){ return this.id; } /** *方法: 设置java.lang.String *@param: java.lang.String 主键 */ public void setId(String id){ this.id = id; } /** *方法: 取得java.lang.String *@return: java.lang.String 创建人名称 */ @Column(name ="CREATE_NAME",nullable=true,length=50) public String getCreateName(){ return this.createName; } /** *方法: 设置java.lang.String *@param: java.lang.String 创建人名称 */ public void setCreateName(String createName){ this.createName = createName; } /** *方法: 取得java.lang.String *@return: java.lang.String 创建人登录名称 */ @Column(name ="CREATE_BY",nullable=true,length=50) public String getCreateBy(){ return this.createBy; } /** *方法: 设置java.lang.String *@param: java.lang.String 创建人登录名称 */ public void setCreateBy(String createBy){ this.createBy = createBy; } /** *方法: 取得java.util.Date *@return: java.util.Date 创建日期 */ @Column(name ="CREATE_DATE",nullable=true,length=20) public java.util.Date getCreateDate(){ return this.createDate; } /** *方法: 设置java.util.Date *@param: java.util.Date 创建日期 */ public void setCreateDate(java.util.Date createDate){ this.createDate = createDate; } /** *方法: 取得java.lang.String *@return: java.lang.String 更新人名称 */ @Column(name ="UPDATE_NAME",nullable=true,length=50) public String getUpdateName(){ return this.updateName; } /** *方法: 设置java.lang.String *@param: java.lang.String 更新人名称 */ public void setUpdateName(String updateName){ this.updateName = updateName; } /** *方法: 取得java.lang.String *@return: java.lang.String 更新人登录名称 */ @Column(name ="UPDATE_BY",nullable=true,length=50) public String getUpdateBy(){ return this.updateBy; } /** *方法: 设置java.lang.String *@param: java.lang.String 更新人登录名称 */ public void setUpdateBy(String updateBy){ this.updateBy = updateBy; } /** *方法: 取得java.util.Date *@return: java.util.Date 更新日期 */ @Column(name ="UPDATE_DATE",nullable=true,length=50) public java.util.Date getUpdateDate(){ return this.updateDate; } /** *方法: 设置java.util.Date *@param: java.util.Date 更新日期 */ public void setUpdateDate(java.util.Date updateDate){ this.updateDate = updateDate; } /** *方法: 取得java.lang.String *@return: java.lang.String 所属部门 */ @Column(name ="SYS_ORG_CODE",nullable=true,length=50) public String getSysOrgCode(){ return this.sysOrgCode; } /** *方法: 设置java.lang.String *@param: java.lang.String 所属部门 */ public void setSysOrgCode(String sysOrgCode){ this.sysOrgCode = sysOrgCode; } /** *方法: 取得java.lang.String *@return: java.lang.String 所属公司 */ @Column(name ="SYS_COMPANY_CODE",nullable=true,length=50) public String getSysCompanyCode(){ return this.sysCompanyCode; } /** *方法: 设置java.lang.String *@param: java.lang.String 所属公司 */ public void setSysCompanyCode(String sysCompanyCode){ this.sysCompanyCode = sysCompanyCode; } /** *方法: 取得java.lang.String *@return: java.lang.String 查询规则编码 */ @Column(name ="QUERY_CODE",nullable=true,length=50) public String getQueryCode(){ return this.queryCode; } /** *方法: 设置java.lang.String *@param: java.lang.String 查询规则编码 */ public void setQueryCode(String queryCode){ this.queryCode = queryCode; } /** *方法: 取得java.lang.String *@return: java.lang.String 查询类型 */ @Column(name ="QUERY_TYPE",nullable=true,length=50) public String getQueryType(){ return this.queryType; } /** *方法: 设置java.lang.String *@param: java.lang.String 查询类型 */ public void setQueryType(String queryType){ this.queryType = queryType; } @Column(name ="user_id",nullable=true,length=50) public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } @Column(name ="record",nullable=true,length=255) public String getRecord() { return record; } public void setRecord(String record) { this.record = record; } @Column(name ="history_name",nullable=true,length=255) public String getHistoryName() { return historyName; } public void setHistoryName(String historyName) { this.historyName = historyName; } }
9b0cba1e32fd9b858b3c2f521487ffa7f796ab3c
94b22a34c3fcf908fa549931c4aa8bf01f346eb5
/Task_Manager/src/java/controller/Admin_ReadAllTasksServlet.java
213e3ca71445795b21c22a7000def80a59fb21ab
[]
no_license
kate-anderson/TaskManager
cee3de9d1d65aa7d33f3edefa2557c1aa71f8a98
fe4f6fea81da6225c4a8204b5c3c1db5d4fc513e
refs/heads/master
2021-04-27T11:14:20.740714
2018-02-23T01:36:30
2018-02-23T01:36:30
122,557,790
0
0
null
null
null
null
UTF-8
Java
false
false
3,716
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 controller; import dbHelper.Admin_ReadAllTasksQuery; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author colbert */ @WebServlet(name = "ReadServlet", urlPatterns = {"/admin/readAllTasks"}) public class Admin_ReadAllTasksServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet ReadServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet ReadServlet at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Pass execution on to doPost doPost(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Create a ReadQuery helper object Admin_ReadAllTasksQuery rq = new Admin_ReadAllTasksQuery(); //Get the HTML table from the ReadQuery object rq.doRead(); String table = rq.makeHtmlTable(); //Pass execution control to read.jsp along with the table. request.setAttribute("table", table); String url = "./adminRead.jsp"; RequestDispatcher dispatcher = request.getRequestDispatcher(url); dispatcher.forward(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
8c606a8e9842aded2053e80b69b449f9edfc8db2
7791b07a11d714345a3c847e3387d3e4fb012ec0
/PDOnlineConfig/app/src/main/java/com/pd/config/pdonlineconfig/net/UDPSender.java
3e230ad6502548deb530bcd56a6eeb78a947ef0a
[]
no_license
SheStealsMyPenta/test
6262dfef527259f6b2020ec88dbd645b0713623f
286c1621cbe9d716b743ce5e87ab4fd5188cd7f5
refs/heads/master
2020-06-13T19:22:44.762210
2019-07-02T01:35:53
2019-07-02T01:35:53
194,764,936
1
0
null
null
null
null
UTF-8
Java
false
false
2,546
java
package com.pd.config.pdonlineconfig.net; import android.os.Message; import com.pd.config.pdonlineconfig.constants.Command; import com.pd.config.pdonlineconfig.interfaces.InternetManager; import com.pd.config.pdonlineconfig.pojo.LightParams; import com.pd.config.pdonlineconfig.pojo.PdParamsAA; import com.pd.config.pdonlineconfig.pojo.PdParamsUHF; import com.pd.config.pdonlineconfig.pojo.TestParams; public class UDPSender implements UDPSenderInterface { private String typeOfCommand; private ControlUnitMessager messager; private InternetManager manager; private int notifyNumber; private NetHandler netHandler; public UDPSender setNetHandler(NetHandler netHandler) { this.netHandler = netHandler; return this; } public UDPSender setMessager(ControlUnitMessager messager) { this.messager = messager; return this; } public UDPSender setManager(InternetManager manager) { this.manager = manager; messager.setManager(manager); return this; } public UDPSender setNotifyNumber(int notifyNumber) { this.notifyNumber = notifyNumber; return this; } public UDPSender setCommandType(String type) { messager.setTypeOfCommand(type); return this; } @Override public void send() { if (checkNull()) { messager.start(); startNotifyThread(); } } private void startNotifyThread() { new Thread(() -> { try { Thread.sleep(Command.OVERTIME); Message msg = Message.obtain(); msg.what = notifyNumber; netHandler.sendMessage(msg); } catch (InterruptedException e) { e.printStackTrace(); } }).start(); } private boolean checkNull() { if (messager == null) return false; return manager != null; } public UDPSender setUHFParams(PdParamsUHF pdUHf) { messager.setPdParamsUHF(pdUHf); return this; } public UDPSender setAAParams(PdParamsAA paramsAA) { messager.setPdParamsAA(paramsAA); return this; } public UDPSender setRunTimeConfig(TestParams values) { messager.setParams(values); return this; } public UDPSender setDeviceSn(String s) { messager.setDeviceSN(s); return this; } public UDPSender setLightParams(LightParams data) { messager.setLightParams(data); return this; } }
4aa8ec21de76712c4cdc3cf8ee95ae7124463328
0369b14ce460ef76f9e53f00de09e8c26b7bc4cc
/transaction/src/main/java/org/wildfly/httpclient/transaction/XidProvider.java
32baec1ce010cf4d0a014fc807c0cea9d17480d2
[ "Apache-2.0" ]
permissive
fl4via/wildfly-http-client
b4da9fcbb076358bbeb737270834934251393714
af5843c906a886954fbb7b6ad7f6c19994d065de
refs/heads/master
2023-08-10T23:35:47.361032
2022-08-15T09:24:35
2022-08-15T09:24:35
180,651,077
1
0
Apache-2.0
2019-04-10T19:35:06
2019-04-10T19:35:06
null
UTF-8
Java
false
false
932
java
/* * JBoss, Home of Professional Open Source. * Copyright 2017 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wildfly.httpclient.transaction; import javax.transaction.xa.Xid; /** * Gets the Xid of the associated transaction handle * * @author Stuart Douglas */ public interface XidProvider { Xid getXid(); }
df9efec052714b39da0d84157330b3b184273f5f
22c97755cb7c69352064957e69a0d5c0ea52f60f
/src/main/java/com/oskarro/soccerbank/entity/clubData/ClubDataBaseUpdate.java
b452a8eca6d7467766145792f48f25d5279c272b
[]
no_license
Oskarovsky/SoccerBank
edd0b72dfa629ef2b1975db684a32c9c3b4f4cb4
7582eba1e37f39c8fc1bcad959b6aa9c27e9153b
refs/heads/master
2023-09-01T12:20:56.646180
2021-10-10T19:25:30
2021-10-10T19:25:30
415,057,751
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package com.oskarro.soccerbank.entity.clubData; import lombok.Getter; import lombok.Setter; @Getter @Setter public class ClubDataBaseUpdate extends ClubDataUpdate { private final String name; private final int yearOfFoundation; public ClubDataBaseUpdate(long clubId, String name, int yearOfFoundation) { super(clubId); this.name = name; this.yearOfFoundation = yearOfFoundation; } }
98ce601565bb937aa326e602497450f79ec4463b
3d242b5e81e75fb82edb27fecd64f0222f50c3f3
/templates/griffon-pivot-java-templates/templates/subtmpl-artifact/View.java
507f626ba8c9ae6e379dbd5ff8119eec57cc706a
[ "Apache-2.0" ]
permissive
pgremo/griffon
d7105330ad5c3969bfa56d84d632a9d5bbcb9f59
4c19a3cc2af3dbb8e489e64f82bde99ff7e773e8
refs/heads/master
2022-12-07T02:42:49.102745
2018-11-06T13:12:10
2018-11-06T13:12:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,315
java
package ${project_package}; import griffon.core.artifact.GriffonView; import griffon.inject.MVCMember; import griffon.metadata.ArtifactProviderFor; import griffon.pivot.support.PivotAction; import org.apache.pivot.serialization.SerializationException; import org.codehaus.griffon.runtime.pivot.artifact.AbstractPivotGriffonView; import org.apache.pivot.wtk.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Collections; import javax.annotation.Nonnull; import static java.util.Arrays.asList; @ArtifactProviderFor(GriffonView.class) public class ${project_class_name}View extends AbstractPivotGriffonView { private ${project_class_name}Model model; private ${project_class_name}Controller controller; @MVCMember public void setModel(@Nonnull ${project_class_name}Model model) { this.model = model; } @MVCMember public void setController(@Nonnull ${project_class_name}Controller controller) { this.controller = controller; } @Override public void initUI() { Window window = (Window) getApplication() .createApplicationContainer(Collections.<String, Object>emptyMap()); window.setTitle(getApplication().getConfiguration().getAsString("application.title")); window.setMaximized(true); getApplication().getWindowManager().attach("${name}", window); BoxPane vbox = new BoxPane(Orientation.VERTICAL); try { vbox.setStyles("{horizontalAlignment:'center', verticalAlignment:'center'}"); } catch (SerializationException e) { // ignore } final Label clickLabel = new Label(String.valueOf(model.getClickCount())); vbox.add(clickLabel); PivotAction clickAction = toolkitActionFor(controller, "click"); final Button button = new PushButton(clickAction.getName()); button.setName("clickButton"); button.setAction(clickAction); vbox.add(button); model.addPropertyChangeListener("clickCount", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { clickLabel.setText(String.valueOf(evt.getNewValue())); } }); window.setContent(vbox); } }
8e2edc82dd45ad0acc0da9f9f0d5595dd4339d98
c2117e863c8159af4a0506ac90425bf6ccf24933
/src/main/java/com/ajman/utils/AjaxFilter.java
930b73c59af04e48e668410d738834ce4ed23a65
[]
no_license
GoodAjman/ajmanShop
b79b7e4b2662da8a476eadd506c3e31dbf8853b5
3e58af0223a6c719d4ab469f001f6131fd1d8d1f
refs/heads/master
2022-12-30T21:44:28.760085
2020-09-06T02:43:27
2020-09-06T02:43:27
245,779,166
0
0
null
2022-12-16T06:23:54
2020-03-08T08:36:40
Java
UTF-8
Java
false
false
1,245
java
package com.ajman.utils; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class AjaxFilter implements Filter { @Override public void destroy() { } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; //禁止首页访问 String url = request.getRequestURI(); if("/".equals(url)){ return; } // 指定允许其他域名访问 response.setHeader("Access-Control-Allow-Origin", "*"); // 响应类型 response.setHeader("Access-Control-Allow-Methods", "POST, GET, DELETE, OPTIONS, DELETE"); // 响应头设置 response.setHeader("Access-Control-Allow-Headers", "Content-Type, x-requested-with, X-Custom-Header, HaiYi-Access-Token"); chain.doFilter(req, res); } @Override public void init(FilterConfig arg0) throws ServletException { } }
563f993f273bddef7f0708b230de88b9e7c64d8b
5d4c220927a9c429e078fb5ef43e15ce666d49d8
/ch04-mvc-code-authentication-chain-ajax/src/main/java/config/MvcConfig.java
e625e6a71d400d7ed83fe0a7244d1f1880574849
[]
no_license
wang-chunlin/springsecurity-teaching-parent
cba5e37b56bbe8440489c65a2dce10554bd9a796
c9c9be37cc9565d863770f1853caba316b1f9f48
refs/heads/master
2022-12-21T23:39:29.613990
2020-01-04T03:22:32
2020-01-04T03:22:32
231,701,929
0
0
null
2022-12-15T23:25:38
2020-01-04T03:17:58
Java
UTF-8
Java
false
false
964
java
package config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; import org.springframework.format.datetime.DateFormatter; import org.springframework.web.servlet.config.annotation.*; /** * @author cj * @date 2019/11/25 */ @Configuration @EnableWebMvc @ComponentScan({"com.controller"}) public class MvcConfig implements WebMvcConfigurer { @Override public void configureViewResolvers(ViewResolverRegistry registry) { registry.jsp("/WEB-INF/views/", ".jsp"); } @Override public void addFormatters(FormatterRegistry registry) { registry.addFormatter(new DateFormatter("yyyy-MM-dd")); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**") .addResourceLocations("classpath:/static/"); } }
968e6e01cb0f02b30b817fba0699abc9bfe7ff35
68f8e95c8e3b8bbd6b5458e3adcde0bb8a4e15bc
/VOPServer.java
a9d5034871b53b159b4a4e038f38d3bd1abd37f5
[]
no_license
ronidee/ViewOnPhone
50d95aae7737ab59932cf85ef177f5817d08ea29
c51b75ec514568dc8a0aafb406ec11bc6fb700f7
refs/heads/master
2021-07-17T15:25:52.359676
2017-10-25T00:55:15
2017-10-25T00:55:15
108,201,279
0
0
null
null
null
null
UTF-8
Java
false
false
4,664
java
package ronidea.viewonphone; import android.app.KeyguardManager; import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.Bitmap; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.os.IBinder; import android.os.StrictMode; import android.util.Log; import java.io.File; import java.io.FileOutputStream; import java.util.Random; /** * TCP server that accepts links and openes them */ public class VOPServer extends Service { final static String REQUEST_DISCONNECT = "RQ_DC"; TCPServer server; private static boolean isRunning = false; Thread serverThread; PhoneUnlockedReceiver unlockListener; @Override public void onCreate() { Log.d("VOPServer", "onCreate()"); unlockListener = new PhoneUnlockedReceiver(this); serverThread = new Thread(r_server); } @Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Log.d("VOPServer", "onStartCommand()"); new Prefs(this); // the server could maybe started twice accidentally. So make sure // the thread is only launched once. if (isRunning) { stopSelf(); return START_STICKY; } serverThread.start(); isRunning = true; registerReceiver(unlockListener, new IntentFilter("android.intent.action.USER_PRESENT")); VOPUtils.disableNougatFileRestrictions(); return START_STICKY; } private Runnable r_server = new Runnable() { @Override public void run() { String input; server = new TCPServer(); while (isRunning) { try { /* RECEIVING INPUT */ server.waitForClient(); // wait for a client to connect if (serverThread.isInterrupted()) break; // if thread is interrupted exit loop input = server.getInputLine(); // get the input from that client input = VOPUtils.decrypt(input); // decrypt the input /* HANDLING THE INPUT */ // shortest possible input: $PW$1234€PW€$URL$www.x.x€URL€ (29 chars) // so this acts as an early filter if (input != null && input.length() >= 29) { processInput(input); } } catch (Exception e) { e.printStackTrace(); } } } }; private void processInput(String input) { // create dropping object Dropping dropping; // generate dropping object from server input dropping = VOPUtils.unwrapDelivery(input); Log.d("VOPServer r_server", "dropped: " + dropping.getURL()); // validate password if (dropping.getPw().equals(Prefs.getPassword())) { // save the clients IPAddress for both-side communication Prefs.saveString(Prefs.KEY_IP_ADR, server.getConnectedIPAddress()); switch (dropping.getType()) { // TYPE_NULL = input from computer wasn't valid case Dropping.TYPE_NULL: Log.d("VOPServer", "input invalid: " + input); break; // TYPE_URL = an URL was sent to be opened on the phone case Dropping.TYPE_URL: VOPUtils.openUrl(dropping.getURL(), this); break; // TYPE_IMG = an IMG was sent to be opened on the phone case Dropping.TYPE_IMG: String filepath = VOPUtils.saveImage(dropping.getImage()); VOPUtils.openImg(filepath, this); break; } } } // get the status of this service static boolean isRunning() { return isRunning; } @Override public IBinder onBind(Intent intent) { //We don't want to bind return null; } @Override public void onDestroy() { Log.d("VOPServer", "closed"); unregisterReceiver(unlockListener); // unregister the unlockListener serverThread.interrupt(); // stopping the server manually (just in case ...) server.close(); // close the server isRunning = false; // updating the service's status } }
8383480b76256dd1e103e62c03b86a161277a139
8a7f88f1c77e81e383afa152669ede2ef80f0540
/src/main/java/com/tw/study/springboot/config/JerseyConfig.java
d39d78f26481f55850ec2d898e2f1a5b27c5b342
[]
no_license
yourwafer/spring-boot-study
64bfe7ae7f7c035ca2544a39b83ceb9af5172f73
6619bfe47660624d47e0da56e5927c33bdaf78d9
refs/heads/master
2020-12-24T06:13:13.451195
2016-11-16T15:38:03
2016-11-16T15:38:03
73,166,209
0
0
null
null
null
null
UTF-8
Java
false
false
1,068
java
package com.tw.study.springboot.config; import jersey.repackaged.com.google.common.base.Joiner; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.message.filtering.EntityFilteringFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.internal.process.Endpoint; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import javax.ws.rs.ApplicationPath; @Configuration @ApplicationPath("api") public class JerseyConfig extends ResourceConfig { private static final String[] MODULE_PACKAGES = new String[]{ "com.tw.study.sprintboot.endpoint", }; public JerseyConfig() { // common packages this.packages( "com.tw.study.springboot.endpoint.handlerr" ); // module packages this.packages( MODULE_PACKAGES ); this.registerClasses( EntityFilteringFeature.class, JacksonFeature.class ); } }
108915d135e2f15addf14779935852ab0701fde3
4d25f18fec1e353143fb43224e20d10252587866
/src/main/java/com/molinari/utility/io/URLUTF8Encoder.java
51d200daac1cf3d141e5678dabb55ce7ffcbee16
[]
no_license
marcouio/utility
755857d691bb6132867f2331dfc93783d0cc9b77
ff8f143007d0f0a37400558b9f58cc95eb362db5
refs/heads/master
2023-06-01T08:18:07.688972
2023-05-24T08:22:51
2023-05-24T08:22:51
50,748,378
0
0
null
2023-05-24T08:22:52
2016-01-30T22:40:37
Java
UTF-8
Java
false
false
6,993
java
package com.molinari.utility.io; /** * Provides a method to encode any string into a URL-safe * form. * Non-ASCII characters are first encoded as sequences of * two or three bytes, using the UTF-8 algorithm, before being * encoded as %HH escapes. * * Created: 17 April 1997 * Author: Bert Bos <[email protected]> * * URLUTF8Encoder: http://www.w3.org/International/URLUTF8Encoder.java * * Copyright © 1997 World Wide Web Consortium, (Massachusetts * Institute of Technology, European Research Consortium for * Informatics and Mathematics, Keio University). All Rights Reserved. * This work is distributed under the W3C® Software License [1] 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. * * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 */ public class URLUTF8Encoder { final static String[] hex = { "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f", "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f", "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", "%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f", "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37", "%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f", "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47", "%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f", "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57", "%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f", "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67", "%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f", "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77", "%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f", "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87", "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f", "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", "%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f", "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7", "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af", "%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7", "%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf", "%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7", "%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf", "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", "%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df", "%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7", "%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef", "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff" }; /** * Encode a string to the "x-www-form-urlencoded" form, enhanced * with the UTF-8-in-URL proposal. This is what happens: * * <ul> * <li><p>The ASCII characters 'a' through 'z', 'A' through 'Z', * and '0' through '9' remain the same. * * <li><p>The unreserved characters - _ . ! ~ * ' ( ) remain the same. * * <li><p>The space character ' ' is converted into a plus sign '+'. * * <li><p>All other ASCII characters are converted into the * 3-character string "%xy", where xy is * the two-digit hexadecimal representation of the character * code * * <li><p>All non-ASCII characters are encoded in two steps: first * to a sequence of 2 or 3 bytes, using the UTF-8 algorithm; * secondly each of these bytes is encoded as "%xx". * </ul> * * @param s The string to be encoded * @return The encoded string */ public static String encode(String s) { StringBuffer sbuf = new StringBuffer(); int len = s.length(); for (int i = 0; i < len; i++) { int ch = s.charAt(i); if ('A' <= ch && ch <= 'Z') { // 'A'..'Z' sbuf.append((char)ch); } else if ('a' <= ch && ch <= 'z') { // 'a'..'z' sbuf.append((char)ch); } else if ('0' <= ch && ch <= '9') { // '0'..'9' sbuf.append((char)ch); } else if (ch == ' ') { // space sbuf.append('+'); } else if (ch == '-' || ch == '_' // unreserved || ch == '.' || ch == '!' || ch == '~' || ch == '*' || ch == '\'' || ch == '(' || ch == ')') { sbuf.append((char)ch); } else if (ch <= 0x007f) { // other ASCII sbuf.append(hex[ch]); } else if (ch <= 0x07FF) { // non-ASCII <= 0x7FF sbuf.append(hex[0xc0 | (ch >> 6)]); sbuf.append(hex[0x80 | (ch & 0x3F)]); } else { // 0x7FF < ch <= 0xFFFF sbuf.append(hex[0xe0 | (ch >> 12)]); sbuf.append(hex[0x80 | ((ch >> 6) & 0x3F)]); sbuf.append(hex[0x80 | (ch & 0x3F)]); } } return sbuf.toString(); } public static String unescape(String s) { StringBuilder sbuf = new StringBuilder() ; int l = s.length() ; int ch = -1 ; int b, sumb = 0; for (int i = 0, more = -1 ; i < l ; i++) { /* Get next byte b from URL segment s */ switch (ch = s.charAt(i)) { case '%': ch = s.charAt (++i) ; int hb = (Character.isDigit ((char) ch) ? ch - '0' : 10+Character.toLowerCase((char) ch) - 'a') & 0xF ; ch = s.charAt (++i) ; int lb = (Character.isDigit ((char) ch) ? ch - '0' : 10+Character.toLowerCase((char) ch) - 'a') & 0xF ; b = (hb << 4) | lb ; break ; case '+': b = ' ' ; break ; default: b = ch ; } /* Decode byte b as UTF-8, sumb collects incomplete chars */ if ((b & 0xc0) == 0x80) { // 10xxxxxx (continuation byte) sumb = (sumb << 6) | (b & 0x3f) ; // Add 6 bits to sumb if (--more == 0) sbuf.append((char) sumb) ; // Add char to sbuf } else if ((b & 0x80) == 0x00) { // 0xxxxxxx (yields 7 bits) sbuf.append((char) b) ; // Store in sbuf } else if ((b & 0xe0) == 0xc0) { // 110xxxxx (yields 5 bits) sumb = b & 0x1f; more = 1; // Expect 1 more byte } else if ((b & 0xf0) == 0xe0) { // 1110xxxx (yields 4 bits) sumb = b & 0x0f; more = 2; // Expect 2 more bytes } else if ((b & 0xf8) == 0xf0) { // 11110xxx (yields 3 bits) sumb = b & 0x07; more = 3; // Expect 3 more bytes } else if ((b & 0xfc) == 0xf8) { // 111110xx (yields 2 bits) sumb = b & 0x03; more = 4; // Expect 4 more bytes } else /*if ((b & 0xfe) == 0xfc)*/ { // 1111110x (yields 1 bit) sumb = b & 0x01; more = 5; // Expect 5 more bytes } /* No need to test if the UTF-8 encoding is well-formed */ } return sbuf.toString() ; } }
0d1ec3b22fa1afab827caac7bb4da5d942bc2eec
e3cd6fb337bdf9ae8775e543ebf9ce7c9d82a274
/Bioinformatica_Lab01/src/java/com/biolab01/entities/ClusterObj.java
aa844c408bdc4b8338a7038ac44a30fc41858893
[]
no_license
aledev/bioinformatica_lab01
0f005487ce9dc000e6c4a1e4b88864f3da3a4945
57a2759c9dc18e39f120540ca0ad7b56c292710e
refs/heads/master
2021-01-12T11:37:06.259441
2016-12-20T11:43:01
2016-12-20T11:43:01
72,232,798
0
0
null
null
null
null
UTF-8
Java
false
false
2,950
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 com.biolab01.entities; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * * @author aialiagam */ public class ClusterObj implements Serializable{ //<editor-fold defaultstate="collapsed" desc="propiedades privadas"> private int nroSolucion; private int nroCluster; private ArrayList<String> listaGenes; private ArrayList<GenDictionary> diccionarioGenes; //</editor-fold> //<editor-fold defaultstate="collapsed" desc="constructores"> public ClusterObj(){ } public ClusterObj(int nroSolucion, int nroCluster, ArrayList<String> listaGenes, ArrayList<GenDictionary> diccionarioGenes){ this.nroSolucion = nroSolucion; this.nroCluster = nroCluster; this.listaGenes = listaGenes; this.diccionarioGenes = diccionarioGenes; } //</editor-fold> //<editor-fold defaultstate="collapsed" desc="metodos accesores"> public int getNroSolucion(){ return this.nroSolucion; } public int getNroCluster(){ return this.nroCluster; } /** * @return the diccionarioGenes */ public ArrayList<GenDictionary> getDiccionarioGenes() { return this.diccionarioGenes; } public ArrayList<String> getListaGenes(){ return this.listaGenes; } //</editor-fold> //<editor-fold defaultstate="collapsed" desc="metodos mutadores"> public void setNroSolucion(int nroSolucion){ this.nroSolucion = nroSolucion; } public void setNroCluster(int nroCluster){ this.nroCluster = nroCluster; } public void setListaGenes(ArrayList<String> listaGenes){ this.listaGenes = listaGenes; } public void addGenLista(String gen){ if(this.listaGenes == null){ this.listaGenes = new ArrayList(); this.listaGenes.add(gen); } else{ if(!this.listaGenes.contains(gen)){ this.listaGenes.add(gen); } } } /** * @param diccionarioGenes the diccionarioGenes to set */ public void setDiccionarioGenes(ArrayList<GenDictionary> diccionarioGenes) { this.diccionarioGenes = diccionarioGenes; } public void addDiccionarioGenLista(GenDictionary gen){ if(this.diccionarioGenes == null){ this.diccionarioGenes = new ArrayList(); this.diccionarioGenes.add(gen); } else{ if(!this.diccionarioGenes.contains(gen)){ this.diccionarioGenes.add(gen); } } } //</editor-fold> }
2a4342ab2006a7e0977051f8f0601ab7a1c8ed99
7f364689fc4d0eff8bf32a2805f70e4eee98425e
/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java
8a29d08f11728da1d18d19444e7296162624f19a
[ "Apache-2.0" ]
permissive
mukulashokjoshi/apache-isis
3c0fc7d4366a7f9fb8151c3229b9a0c18dfcc59e
f5ed969c82c0f334b5c4a67ca3b57846ab13b56c
refs/heads/master
2021-01-17T11:09:18.879033
2012-09-26T16:38:32
2012-09-26T16:38:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,620
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.isis.viewer.dnd.table; import org.apache.log4j.Logger; import org.apache.isis.applib.annotation.Where; import org.apache.isis.core.commons.ensure.Assert; import org.apache.isis.core.commons.exceptions.UnexpectedCallException; import org.apache.isis.core.commons.exceptions.UnknownTypeException; import org.apache.isis.core.metamodel.adapter.ObjectAdapter; import org.apache.isis.core.metamodel.spec.ObjectSpecification; import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation; import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation; import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation; import org.apache.isis.core.progmodel.facets.value.booleans.BooleanValueFacet; import org.apache.isis.core.progmodel.facets.value.image.ImageValueFacet; import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext; import org.apache.isis.viewer.dnd.field.CheckboxField; import org.apache.isis.viewer.dnd.view.Axes; import org.apache.isis.viewer.dnd.view.Content; import org.apache.isis.viewer.dnd.view.GlobalViewFactory; import org.apache.isis.viewer.dnd.view.ObjectContent; import org.apache.isis.viewer.dnd.view.Toolkit; import org.apache.isis.viewer.dnd.view.View; import org.apache.isis.viewer.dnd.view.ViewRequirement; import org.apache.isis.viewer.dnd.view.ViewSpecification; import org.apache.isis.viewer.dnd.view.base.BlankView; import org.apache.isis.viewer.dnd.view.base.FieldErrorView; import org.apache.isis.viewer.dnd.view.composite.AbstractViewBuilder; import org.apache.isis.viewer.dnd.view.content.TextParseableContent; import org.apache.isis.viewer.dnd.view.field.OneToOneFieldImpl; import org.apache.isis.viewer.dnd.view.field.TextParseableFieldImpl; import org.apache.isis.viewer.dnd.viewer.basic.UnlinedTextFieldSpecification; class TableCellBuilder extends AbstractViewBuilder { private static final Logger LOG = Logger.getLogger(TableCellBuilder.class); // REVIEW: should provide this rendering context, rather than hardcoding. // the net effect currently is that class members annotated with // @Hidden(where=Where.ALL_TABLES) will indeed be hidden from all tables // but will be shown (perhaps incorrectly) if annotated with Where.PARENTED_TABLE // or Where.STANDALONE_TABLE private final Where where = Where.ALL_TABLES; private void addField(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field) { final ObjectAdapter value = field.get(object); View fieldView; fieldView = createFieldView(view, axes, object, field, value); if (fieldView != null) { view.addView(decorateSubview(axes, fieldView)); } else { view.addView(new FieldErrorView("No field for " + value)); } } @Override public void build(final View view, final Axes axes) { Assert.assertEquals("ensure the view is complete decorated view", view.getView(), view); final Content content = view.getContent(); final ObjectAdapter object = ((ObjectContent) content).getObject(); if (view.getSubviews().length == 0) { initialBuild(object, view, axes); } else { updateBuild(object, view, axes); } } private void updateBuild(final ObjectAdapter object, final View view, final Axes axes) { final TableAxis viewAxis = axes.getAxis(TableAxis.class); LOG.debug("update view " + view + " for " + object); final View[] subviews = view.getSubviews(); final ObjectSpecification spec = object.getSpecification(); for (int i = 0; i < subviews.length; i++) { final ObjectAssociation field = fieldFromActualSpec(spec, viewAxis.getFieldForColumn(i)); final View subview = subviews[i]; final ObjectAdapter value = field.get(object); // if the field is parseable then it may have been modified; we need // to replace what was // typed in with the actual title. if (field.getSpecification().isParseable()) { final boolean visiblityChange = !field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() ^ (subview instanceof BlankView); final ObjectAdapter adapter = subview.getContent().getAdapter(); final boolean valueChange = value != null && value.getObject() != null && !value.getObject().equals(adapter.getObject()); if (visiblityChange || valueChange) { final View fieldView = createFieldView(view, axes, object, field, value); view.replaceView(subview, decorateSubview(axes, fieldView)); } subview.refresh(); } else if (field.isOneToOneAssociation()) { final ObjectAdapter existing = ((ObjectContent) subviews[i].getContent()).getObject(); final boolean changedValue = value != existing; if (changedValue) { View fieldView; fieldView = createFieldView(view, axes, object, field, value); if (fieldView != null) { view.replaceView(subview, decorateSubview(axes, fieldView)); } else { view.addView(new FieldErrorView("No field for " + value)); } } } } } private ObjectAssociation fieldFromActualSpec(final ObjectSpecification spec, final ObjectAssociation field) { final String fieldName = field.getId(); return spec.getAssociation(fieldName); } private void initialBuild(final ObjectAdapter object, final View view, final Axes axes) { final TableAxis viewAxis = axes.getAxis(TableAxis.class); LOG.debug("build view " + view + " for " + object); final int len = viewAxis.getColumnCount(); final ObjectSpecification spec = object.getSpecification(); for (int f = 0; f < len; f++) { if (f > 3) { continue; } final ObjectAssociation field = fieldFromActualSpec(spec, viewAxis.getFieldForColumn(f)); addField(view, axes, object, field); } } private View createFieldView(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field, final ObjectAdapter value) { if (field == null) { throw new NullPointerException(); } final GlobalViewFactory factory = Toolkit.getViewFactory(); ViewSpecification cellSpec; Content content; if (field instanceof OneToManyAssociation) { throw new UnexpectedCallException("no collections allowed"); } else if (field instanceof OneToOneAssociation) { final ObjectSpecification fieldSpecification = field.getSpecification(); if (fieldSpecification.isParseable()) { content = new TextParseableFieldImpl(object, value, (OneToOneAssociation) field); // REVIEW how do we deal with IMAGES? if (content.getAdapter() instanceof ImageValueFacet) { return new BlankView(content); } if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) { return new BlankView(content); } if (((TextParseableContent) content).getNoLines() > 0) { /* * TODO remove this after introducing constraints into view * specs that allow the parent view to specify what kind of * subviews it can deal */ if (fieldSpecification.containsFacet(BooleanValueFacet.class)) { cellSpec = new CheckboxField.Specification(); } else { cellSpec = new UnlinedTextFieldSpecification(); } } else { return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED)); } } else { content = new OneToOneFieldImpl(object, value, (OneToOneAssociation) field); if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) { return new BlankView(content); } return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED | ViewRequirement.SUBVIEW)); } } else { throw new UnknownTypeException(field); } return cellSpec.createView(content, axes, -1); } }
[ "danhaywood@13f79535-47bb-0310-9956-ffa450edef68" ]
danhaywood@13f79535-47bb-0310-9956-ffa450edef68
e60ab1c2f2b165f6e2be2a64dd515a0300bc60b6
674c5de646ba135a55837c43090dd6686fb67717
/Login/src/com/nectarinfotel/prashant/SecondServlet.java
e453513d5b5dab9fe4f507e31de53eeb747410b1
[]
no_license
PrashantAnand1/spring
f6e33bef280d7d9fb74a0b864d69bf0c0d59fffd
a87c379b1be7c0e79a58b5b0227c3cde5fe79806
refs/heads/main
2023-02-25T07:10:09.106450
2021-02-02T11:39:31
2021-02-02T11:39:31
331,869,362
0
0
null
null
null
null
UTF-8
Java
false
false
784
java
package com.nectarinfotel.prashant; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings("serial") public class SecondServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String n=request.getParameter("EMAIL"); @SuppressWarnings("unused") String p=request.getParameter("PASS"); out.print("Welcome "+n); out.close(); } }
9e99078c6b7dbe782de455702e37bc8e95dd72bb
8864c896a31c44e7e14f5fe5b074eedcccee182e
/app/src/main/java/com/fang/hay/base/BasePresenter.java
892f850cafb35a4b2537cc46be4cfc28db4c4b39
[]
no_license
haolinfang/hay
511e41532fabe0bb2dd31e5006ad0454264f3077
b1797bec38dd6a7f750fb2e2c93df9a6e8a66cbd
refs/heads/master
2020-03-30T05:50:09.314770
2018-09-29T03:49:06
2018-09-29T03:49:06
150,822,440
0
0
null
null
null
null
UTF-8
Java
false
false
155
java
package com.fang.hay.base; /** * @author fanglh * @date 2018/9/13 */ public interface BasePresenter { void subscribe(); void unSubscribe(); }
960291936db72c3d4a17c5612c10bc14519de6eb
84accba0a7d9c2115b10dde52aa077c42b1d4c87
/qrphase/src/main/java/com/cn/guojinhu/MainActivity.java
a35d44c1d711632e2521c4e926e67702cb643815
[]
no_license
Vo7ice/CountDown
46a80c1449f36ddc36fad6cc82dd7be011eafd79
936ca7ec89553ce0984f6c28d312b56aaada5027
refs/heads/master
2020-05-21T20:00:06.355217
2016-12-13T01:46:22
2016-12-13T01:46:22
60,959,924
0
0
null
2016-09-06T10:50:22
2016-06-12T09:54:48
Java
UTF-8
Java
false
false
2,121
java
package com.cn.guojinhu; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Window; import android.widget.Button; import abe.no.seimei.qrphase.R; public class MainActivity extends AppCompatActivity { private Button mButtonNormal; private Button mButtonURL; private Button mButtonContact; private static final String code_contact = "BEGIN:VCARD\n" + "VERSION:3.0\n" + "N:Tort\n" + "TEL;TYPE=home:222\n" + "TEL;TYPE=home:2525\n" + "END:VCARD"; private static final String code_url_right = "http://weibo.cn/qr/userinfo?uid=1665356464"; private static final String code_url_error = "this is a test string"; @Override protected void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_main); setSupportActionBar(toolbar); mButtonNormal = (Button) findViewById(R.id.button_normal); mButtonURL = (Button) findViewById(R.id.button_url); mButtonContact = (Button) findViewById(R.id.button_contact); mButtonNormal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Utils.startActionPhase(MainActivity.this, code_url_error); } }); mButtonURL.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Utils.startActionPhase(MainActivity.this, code_url_right); } }); mButtonContact.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Utils.startActionPhase(MainActivity.this, code_contact); } }); } }
cd8c991b2790dc6037ba333bf4123cdb6d70e6a9
ff884f6be46b7f550a725ed56748b914e27bf85d
/jdbc/src/test/java/com/becomejavasenior/dao/jdbc/impl/TagDaoImplTest.java
81cf91127d244bd89831928ee1c4be9f8a6ed46a
[]
no_license
borntowinn/CRM
79f5f3e69e81dcca44fd79690447c9f416ff277c
ddc1493c1aa9b8cea309cde60def328508defda2
refs/heads/master
2021-01-10T14:17:46.140070
2016-03-28T12:13:22
2016-03-28T12:13:22
53,863,709
0
0
null
null
null
null
UTF-8
Java
false
false
1,531
java
package com.becomejavasenior.dao.jdbc.impl; import com.becomejavasenior.Tag; import com.becomejavasenior.dao.TagDao; import com.becomejavasenior.dao.exception.PersistException; import com.becomejavasenior.dao.jdbc.factory.DaoFactory; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import java.util.List; public class TagDaoImplTest { private static Tag tag; private List<Tag> tags; private static TagDao<Tag> tagDao; @BeforeClass public static void setupAndConnection() { tagDao = DaoFactory.getTagDao(); tag = new Tag(); tag.setTag("one"); } @Test public void createDbEntry_Phase_PhaseFromDb() { Assert.assertEquals(tag.getTag(), tagDao.create(tag).getTag()); } @Test public void getRecordByPK() { //when Integer id = tagDao.create(tag).getId(); //then Assert.assertEquals(tag.getTag(), tagDao.getByPK(id).getTag()); tagDao.delete(id); } @Test public void getAllRecordsTest() { //when tags = tagDao.getAll(); //then Assert.assertNotNull(tags); Assert.assertTrue(tags.size() > 0); } @Test(expected=PersistException.class) public void deleteRecord() { //when Integer id = tagDao.create(tag).getId(); tagDao.delete(id); //then -> exception must be thrown == the record was successfully deleted and can't be accessed anymore tagDao.getByPK(id); } }
aa1aceb62bf23092fd46fd93a0989907ae0734d2
b664bae5e4d2d752aeee2c275590dabfa659b786
/AppTemplate/src/main/java/rs/android/util/Type.java
701bcf5f39ba0cc4a9cae382eb622fe44d5a4141
[]
no_license
netssrmrz/coralracer
60bb0804bac6565b57d70f8d3dd88bbed8fe53fe
bf81baaedbadfc90c72c1375ef8dd370c421f05e
refs/heads/master
2021-07-04T15:23:27.511120
2020-09-04T04:32:27
2020-09-04T04:32:27
169,189,821
0
0
null
null
null
null
UTF-8
Java
false
false
11,759
java
package rs.android.util; public class Type { public static Class<?> Class_For_Name(String name) { Class<?> res=null; try {res=Class.forName(name);} catch (java.lang.ClassNotFoundException e) {res=null;} return res; } public static Object GetObjFieldValue(Object obj, String field_name) { Object res=null; java.lang.reflect.Method method; java.lang.reflect.Field field; Class<? extends Object> class_type; if (obj!=null && rs.android.Util.NotEmpty(field_name)) { class_type=obj.getClass(); field=FindClassField(class_type, field_name); if (rs.android.Util.NotEmpty(field)) { try { res=field.get(obj); } catch (java.lang.Exception e) { res=null; e.printStackTrace(); } } else { method=FindClassMethod(class_type, "get"+field_name); if (rs.android.Util.NotEmpty(method)) { try { res=method.invoke(obj, (Object[])null); } catch (java.lang.Exception e) { res=null; e.printStackTrace(); } } } } return res; } public static boolean SetObjFieldValue(Object obj, String field_name, Object val) { java.lang.reflect.Method method; java.lang.reflect.Field field; Class<? extends Object> class_type; Object[] params; boolean res=false; if (obj!=null && rs.android.Util.NotEmpty(field_name)) { class_type=obj.getClass(); field=FindClassField(class_type, field_name); if (rs.android.Util.NotEmpty(field)) { try {field.set(obj, val); res=true;} catch (Exception e) { res=false; } } else { method=FindClassMethod(class_type, "set"+field_name); if (rs.android.Util.NotEmpty(method)) { params=new Object[1]; params[0]=val; try {method.invoke(obj, params); res=true;} catch (Exception e) {res=false;} } } } return res; } public static java.lang.reflect.Method FindClassMethod(Class<? extends Object> obj_class, String name) { java.lang.reflect.Method res=null; java.lang.reflect.Method[] methods=null; int c; if (rs.android.Util.NotEmpty(obj_class) && rs.android.Util.NotEmpty(name)) { name=name.toLowerCase(); methods=obj_class.getMethods(); if (rs.android.Util.NotEmpty(methods)) { for (c=0; c<methods.length; c++) { if (methods[c].getName().toLowerCase().equals(name)) { res=methods[c]; break; } } } } return res; } public static java.lang.reflect.Field FindClassField(Class<? extends Object> obj_class, String name) { java.lang.reflect.Field res=null; java.lang.reflect.Field[] fields=null; int c; if (rs.android.Util.NotEmpty(obj_class) && rs.android.Util.NotEmpty(name)) { name=name.toLowerCase(); fields=obj_class.getFields(); if (rs.android.Util.NotEmpty(fields)) { for (c=0; c<fields.length; c++) { if (fields[c].getName().toLowerCase().equals(name)) { res=fields[c]; break; } } } } return res; } public static java.lang.String To_String(Object obj) { return To_String(obj, "", null); } public static java.lang.String To_String(Object obj, String def) { return To_String(obj, def, null); } public static java.lang.String To_String(Object obj, java.lang.String def, String format) { String res=null, fields_str, true_str, false_str; java.text.SimpleDateFormat date_format; java.text.DecimalFormat num_format; Object field_val; String[] format_vals; res=def; if (obj!=null) { if (obj instanceof String && rs.android.Util.NotEmpty(obj)) res=obj.toString().trim(); else if (obj instanceof java.sql.Timestamp) { if (!rs.android.Util.NotEmpty(format)) format="dd/MM/yyyy HH:mm:ss"; date_format=new java.text.SimpleDateFormat(format); res=date_format.format(obj); } else if (obj instanceof java.sql.Date) { if (!rs.android.Util.NotEmpty(format)) format="dd/MM/yyyy HH:mm:ss"; date_format=new java.text.SimpleDateFormat(format); res=date_format.format(obj); } else if (obj instanceof java.lang.Double) { if (!rs.android.Util.NotEmpty(format)) format="#,##0.##"; num_format=new java.text.DecimalFormat(format); res=num_format.format(obj); } else if (obj instanceof Float) { if (!rs.android.Util.NotEmpty(format)) format="#,##0.##"; num_format=new java.text.DecimalFormat(format); res=num_format.format(obj); } else if (obj instanceof java.lang.Long) res=obj.toString(); else if (obj instanceof byte[]) res=new String((byte[])obj); else if (obj instanceof java.math.BigDecimal) res=obj.toString(); else if (obj instanceof java.util.Collection<?>) { for (Object list_obj: (java.util.Collection<?>)obj) { res=rs.android.Util.AppendStr(res, rs.android.util.Type.To_String(list_obj), ", "); } } else if (obj instanceof java.lang.Boolean) { true_str="true"; false_str="false"; if (rs.android.Util.NotEmpty(format)) { format_vals=format.split(","); if (format_vals.length>0 && rs.android.Util.NotEmpty(format_vals[0])) true_str=rs.android.Util.Trim(format_vals[0]); if (format_vals.length>1 && rs.android.Util.NotEmpty(format_vals[1])) false_str=rs.android.Util.Trim(format_vals[1]); } if (((java.lang.Boolean)obj).booleanValue()) res=true_str; else res=false_str; } else res=obj.toString(); } return res; } public static float[] To_Float_Array(java.util.List l) { float[] res; int i; res=new float[l.size()]; for (i=0; i<res.length; i++) { res[i]=To_Float(l.get(i)); } return res; } public static java.lang.Float To_Float(Object obj) { java.lang.Float res=null; String str; if (obj!=null) { try { if (obj instanceof java.lang.String) { str=rs.android.Util.Remove_Other_Chars("1234567890.", (String)obj); res=java.lang.Float.parseFloat(str); } else if (obj instanceof java.lang.Long) res=((java.lang.Long)obj).floatValue(); else if (obj instanceof java.lang.Integer) res=((java.lang.Integer)obj).floatValue(); else if (obj instanceof java.lang.Double) res=((java.lang.Double)obj).floatValue(); else if (obj instanceof java.lang.Float) res=(float)obj; //else if (obj instanceof java.sql.Timestamp) //res=((java.sql.Timestamp)obj).getTime(); //else if (obj instanceof java.util.Date) //res=(java.lang.Integer)obj; else if (obj instanceof java.sql.Date) res=new Float(((java.sql.Date)obj).getTime()); else { str=rs.android.Util.Remove_Other_Chars("1234567890.-", To_String(obj)); res=java.lang.Float.parseFloat(str); } } catch (NumberFormatException e) { res=null; } } return res; } public static boolean IsGenericList(java.lang.reflect.Field field, Class<? extends Object> list_class) { boolean res=false; java.lang.reflect.ParameterizedType gen_type; java.lang.reflect.Type list_type; if (field!=null) { if (field.getGenericType() instanceof java.lang.reflect.ParameterizedType) { gen_type = (java.lang.reflect.ParameterizedType)field.getGenericType(); if (list_class!=null) { list_type=gen_type.getActualTypeArguments()[0]; if (list_type.equals(list_class)) res=true; } else res=true; } } return res; } public static java.util.ArrayList<Object> NewGenericList(Class<? extends Object> list_class) { java.util.ArrayList<Object> res=null; res=new java.util.ArrayList<Object>(); return res; } public static java.lang.Double ToDouble(Object obj) { java.lang.Double res=null; String str; if (obj!=null) { try { if (obj instanceof java.lang.String) { str=rs.android.Util.Remove_Other_Chars("1234567890.-", (String)obj); res=java.lang.Double.parseDouble(str); } else if (obj instanceof java.lang.Integer) res=((java.lang.Integer)obj).doubleValue(); else if (obj instanceof java.lang.Double) res=(java.lang.Double)obj; //else if (obj instanceof java.sql.Timestamp) //res=((java.sql.Timestamp)obj).getTime(); //else if (obj instanceof java.util.Date) //res=(java.lang.Integer)obj; else { str=rs.android.Util.Remove_Other_Chars("1234567890.", To_String(obj)); res=java.lang.Double.parseDouble(str); } } catch (NumberFormatException e) { res=null; } } return res; } public static java.lang.Integer To_Int(Object obj) { java.lang.Integer res=null; if (obj!=null) { if (obj instanceof java.lang.String) { res=java.lang.Integer.parseInt((String)obj); } else if (obj instanceof java.lang.Integer) res=(java.lang.Integer)obj; else if (obj instanceof java.lang.Double) res=((java.lang.Double)obj).intValue(); //else if (obj instanceof java.sql.Timestamp) //res=((java.sql.Timestamp)obj).getTime(); //else if (obj instanceof java.util.Date) //res=(java.lang.Integer)obj; else res=java.lang.Integer.parseInt(To_String(obj)); } return res; } public static java.lang.Long To_Long(Object obj) { java.lang.Long res=null; if (obj!=null) { if (obj instanceof java.lang.String) { res=java.lang.Long.parseLong((String)obj); } else if (obj instanceof java.lang.Long) res=(java.lang.Long)obj; else if (obj instanceof java.lang.Integer) res=((java.lang.Integer)obj).longValue(); else if (obj instanceof java.lang.Double) res=((java.lang.Double)obj).longValue(); //else if (obj instanceof java.sql.Timestamp) //res=((java.sql.Timestamp)obj).getTime(); //else if (obj instanceof java.util.Date) //res=(java.lang.Integer)obj; else res=java.lang.Long.parseLong(To_String(obj)); } return res; } public static String Obj_To_String(Object obj) { String res=null; Object field_val; if (obj!=null) { for (java.lang.reflect.Field field: rs.android.Db.Get_Fields(obj.getClass())) { try {field_val=field.get(obj);} catch (java.lang.Exception e) {field_val=null;} res=rs.android.Util.AppendStr(res, field.getName()+": "+ rs.android.util.Type.To_String(field_val, "null"), ", ", null); } } return res; } public static String Objs_To_String(Object obj) { String res=null; int c; Object[] objs; if (obj instanceof java.util.Collection<?>) { objs=((java.util.Collection<?>)obj).toArray(); for (c=0; c<objs.length; c++) { res=Obj_To_String(objs[c]); } } else { res=Obj_To_String(obj); } return res; } }
2ec40b87d5f5192f2eb5153953765c9baf4e1025
26ea9290e902d27eda5348a807c988afa80b3711
/src/main/java/com/sfuentes/Voting.java
8fa9838b9a677d3e0b07716c47bd2ecab8f338ef
[]
no_license
x1928/BeginnerExercises
abe96421f0029c26b79e850de68ad1bce3808eda
a88bb11409f2212fdb54b43bbd0433858a047a2a
refs/heads/master
2023-06-23T17:53:43.775221
2021-07-30T03:59:49
2021-07-30T03:59:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,175
java
package com.sfuentes; import lombok.RequiredArgsConstructor; import java.util.HashMap; import java.util.List; import java.util.Map; @RequiredArgsConstructor public class Voting { private final List<String> votes; public Map<String, Integer> getNumberOfVotesPerSection() { int northCount = 0; int southCount = 0; int centerCount = 0; Map<String, Integer> sections = new HashMap<>(); for (String vote : votes) { switch (vote.toLowerCase()) { case "north" -> northCount++; case "south" -> southCount++; case "center" -> centerCount++; } } sections.put("North: ", northCount); sections.put("South: ", southCount); sections.put("Center: ", centerCount); return sections; } public Map<String, Integer> getMax() { Map<String, Integer> total = new HashMap<>(); int maxValue = 0; String maxKey = ""; for (Map.Entry<String, Integer> section : getNumberOfVotesPerSection().entrySet()) { if (section.getValue() > maxValue) { maxValue = section.getValue(); maxKey = section.getKey(); } } total.put(maxKey, maxValue); return total; } }
87c6d4b94ade306a668a793f312565c92dd7649b
0eb5f3612b968d47f9da72a7d02e8b9905780fb3
/src/main/java/com/bjpowernode/activemq/receive/QueueListenerReceiver.java
d212e0d80be8b472e970ba3929869fce9d8a6720
[]
no_license
liuguanjia456/sadasdasdsda
313f51413355ee390f0b08b3416b0ee2825d85bd
25e80ba2d87c09d30b90c9fba62c8140256e3007
refs/heads/master
2020-04-26T18:07:35.177363
2019-03-08T04:02:06
2019-03-08T04:02:06
173,734,970
0
0
null
null
null
null
UTF-8
Java
false
false
3,872
java
package com.bjpowernode.activemq.receive; import com.bjpowernode.activemq.model.User; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; import java.util.ArrayList; import java.util.List; /** * ClassName:QueueReceiver * Package:com.bjpowernode.activemq.receive * Description: * * @date:2019/3/4 16:04 * @author:Felix */ //使用监听器异步接收接收点对点消息 public class QueueListenerReceiver { private static String BROKER_URL = "tcp://192.168.144.128:61616"; private static String DESTINATION = "myQueue"; public static final String USER_NAME = "system"; public static final String PASSWORD = "123456"; public static void main(String[] args) { receiveMessage(); } public static void receiveMessage() { Connection connection = null; Session session = null; MessageConsumer messageConsumer = null; try { //1.创建连接工厂 ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(USER_NAME,PASSWORD,BROKER_URL); List<String> trustedPackages = new ArrayList<String>(); trustedPackages.add("com.bjpowernode.activemq.model"); //设置受信任的包 connectionFactory.setTrustedPackages(trustedPackages); //2.创建连接 connection = connectionFactory.createConnection(); //消息的消费者,必须显示调用start方法之后,才会对消息进行消费 connection.start(); //3.创建session session = connection.createSession(Boolean.FALSE,Session.AUTO_ACKNOWLEDGE); //4.创建目的地对象 Destination destination = session.createQueue(DESTINATION); //5.创建消息的接收者 /*String selector = "author='felix' and version = 1"; messageConsumer = session.createConsumer(destination,selector);*/ messageConsumer = session.createConsumer(destination); //6.消费消息 messageConsumer.setMessageListener(new MessageListener() { public void onMessage(Message message){ try { //7.判断接收到的消息类型 if(message instanceof TextMessage){ String text = ((TextMessage) message).getText(); System.out.println("接收到的消息为:" + text); }else if(message instanceof ObjectMessage){ User user = (User) ((ObjectMessage) message).getObject(); System.out.println("接收到的用户名字为:" + user.getName() +",年龄:" + user.getAge()); }else if(message instanceof MapMessage){ System.out.println("学校" + ((MapMessage) message).getString("school") +",年龄:" + ((MapMessage) message).getInt("age")); }else if(message instanceof BytesMessage){ boolean flag = ((BytesMessage) message).readBoolean(); String text = ((BytesMessage) message).readUTF(); System.out.println(text + "::::" + flag); }else if(message instanceof StreamMessage){ Long lo = ((StreamMessage) message).readLong(); String s = ((StreamMessage) message).readString(); System.out.println(s + "::::" + lo); } } catch (JMSException e) { e.printStackTrace(); } } }); } catch (JMSException e) { e.printStackTrace(); } } }
740fe099ccaaeb485f1736581d7e57e16ded0c2c
fe2e63df37c3b8da81ea4758bcbc73a83752bd01
/vlethyme/src/in/kmbs/vlethyme/security/VlethymeUserService.java
33de08db406d67420075ed0b46d67d86022a7a6a
[]
no_license
roxolan/vlethyme
119abae451e592a439019ed8cc492b7f9c78c8a1
e32d05b01dd886022bd3cd526ec55d7e4a833714
refs/heads/master
2021-01-18T05:21:15.872933
2014-03-25T18:13:18
2014-03-25T18:13:18
17,607,338
0
0
null
null
null
null
UTF-8
Java
false
false
2,150
java
package in.kmbs.vlethyme.security; import in.kmbs.vlethyme.converter.EntityToVOConverter; import in.kmbs.vlethyme.model.User; import in.kmbs.vlethyme.service.UserService; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.transaction.annotation.Transactional; public class VlethymeUserService implements UserDetailsService { @Autowired UserService userService; @Transactional public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { // Declare a null Spring UserLogin in.kmbs.vlethyme.security.User userDetails = null; try { // Search database for a user that matches the specified username // get the user view object User ldapUser = userService.getLdapUser(username); User loginUser = EntityToVOConverter.convert(userService.findUserByUsername(username)); loginUser.setPassword(ldapUser.getPassword()); userDetails = new in.kmbs.vlethyme.security.User(loginUser, true, true, true, true, getAuthorities(loginUser)); } catch (Exception e) { e.printStackTrace(); throw new UsernameNotFoundException("Error in retrieving user", e); } // Return user to Spring for processing. the actual authentication is // done by spring return userDetails; } private Collection<GrantedAuthority> getAuthorities(User user) { // Create a list of grants for this user List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>(); if (user.getRole() != null) { authList.add(new SimpleGrantedAuthority(user.getRole().getName())); } else { authList.add(new SimpleGrantedAuthority("guest")); } return authList; } }
ea03801ddc7e2d3dee32e039436ff2ae70ee6a1b
8dd25a266d7dafbec3acd0c4d326d4a228551b19
/app/src/androidTest/java/com/nougat/learnjava/ExampleInstrumentedTest.java
8bca02174435e646417e390d57daa5936422de41
[]
no_license
Hardikganatra01/LearnJava
9907a1d9e6402c8288a673a3f80d87fc57933ea4
3f9d6c2a821aadecb857abe012d417960a05b15d
refs/heads/master
2021-01-11T16:32:29.899107
2017-01-26T10:52:56
2017-01-26T10:52:56
80,105,898
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package com.nougat.learnjava; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.nougat.learnjava", appContext.getPackageName()); } }
116324acc8e6271aa88e40453c91021d746fca1d
0c2a32da501e4d0fd10e8573515ba053412ac670
/src/main/java/example/pattern/abstractfactory/Article.java
70d675ad0131c2904606e28da16c9e39e69f361c
[]
no_license
rainzhao/datastruct
73bd6e94729edcd2997c08ae1ecfa0584240ea98
124092b447f40214dbeb3d5a2df187a9803d501f
refs/heads/master
2022-12-21T10:17:40.850144
2019-12-02T17:05:27
2019-12-02T17:05:27
195,538,837
0
0
null
2022-12-10T05:27:27
2019-07-06T12:48:40
Java
UTF-8
Java
false
false
158
java
package example.pattern.abstractfactory; /** * @author zhaoyu * @date 2019-02-20 */ public abstract class Article { public abstract void produce(); }
f17a122a2ef1754cc3af4bb784e1f99aadee4883
106405b2067acf09d78e48137e8656af09afe659
/retailPos/src/main/java/LoginPage.java
39a4e73aa34e8c8d2f62dd0dbc9ea3042afb5967
[]
no_license
gaoyawei520/mygit
5ee37433ae138bca6c6fd1e9f2e3efc50de5ab18
a828e51239d0e2ce35d2c58c321109649f98c073
refs/heads/master
2023-01-18T19:14:38.787839
2021-05-21T09:52:26
2021-05-21T09:52:26
215,287,441
0
1
null
2023-01-02T22:12:41
2019-10-15T11:58:49
Java
UTF-8
Java
false
false
1,613
java
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import org.openqa.selenium.support.PageFactory; import java.time.Duration; import java.util.concurrent.TimeUnit; public class LoginPage { public AndroidDriver driver; public static final String USERNAME = "18888886667"; public static final String PASSWORD = "886667"; //初始化页面元素 public LoginPage(AndroidDriver driver) { this.driver = driver; //driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS); Duration duration = Duration.ofSeconds(5); PageFactory.initElements(new AppiumFieldDecorator(driver, duration), this); //PageFactory.initElements(new AppiumFieldDecorator(driver,5,TimeUnit.SECONDS),this); } //用户名 @AndroidFindBy(id = Environment.PackageName +"id/userNameET") AndroidElement username; //密码 @AndroidFindBy(id = Environment.PackageName +":id/userPwdET") AndroidElement password; //登陆按钮 @AndroidFindBy(uiAutomator = "text(\"登录\")") AndroidElement submit; @AndroidFindBy(uiAutomator = "text(\"Allow\")") AndroidElement callAllow; public AndroidElement inputUserName(){ return username; } public AndroidElement inputPassword(){ return password; } public AndroidElement submit(){ return submit; } public AndroidElement callAllow(){ return callAllow; } }
332968ced02bc0ad6291c17232ebbba298d3a7ba
9f9851590d9d48c5f81368f34e1b1137db49ce6e
/android/app/src/main/java/com/nativetest/NotePlayer.java
95fb0391a6174e2b0988e505081c926d2ae54537
[]
no_license
eugenserbanescu/metronome
3f83b8a589e2a8839321ac49150d46cf6f4b14b2
73769fa982d3c36e52baec450779dd54daf0ac3b
refs/heads/master
2021-05-15T12:07:54.469037
2018-01-17T06:23:14
2018-01-17T06:23:14
108,401,154
4
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
package com.nativetest; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import android.media.AudioTrack; import android.media.AudioFormat; import android.media.AudioManager; import java.lang.annotation.Target; public class NotePlayer extends ReactContextBaseJavaModule { public NotePlayer(ReactApplicationContext reactContext) { super(reactContext); } @ReactMethod public void playNote(double frequency) { // AudioTrack definition int mBufferSize = AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_8BIT); AudioTrack mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, mBufferSize, AudioTrack.MODE_STREAM); // Sine wave double[] mSound = new double[4410]; short[] mBuffer = new short[22050]; for (int i = 0; i < mSound.length; i++) { mSound[i] = Math.sin((2.0*Math.PI * i/(44100/frequency))); mBuffer[i] = (short) (mSound[i]*Short.MAX_VALUE); } // mAudioTrack.setStereoVolume(AudioTrack.getMaxVolume(), AudioTrack.getMaxVolume()); mAudioTrack.setVolume((float) 0.9); mAudioTrack.play(); mAudioTrack.write(mBuffer, 0, mSound.length); mAudioTrack.stop(); mAudioTrack.release(); } @ReactMethod public void stopNote() {} @Override public String getName() { return "NotePlayer"; } }
379b8e68ea8b09c212b5f69d9deefc4408bae5fa
2f7ed85390e6d07fbceb52c3097c14f5c65d52a4
/src/by/it/dziomin/jd01_02/Test_jd01_02.java
e1a5dd4f00225eff12ae1ea9acb7cb7e75f2bf22
[]
no_license
migeniya/JD2018-12-10
4def3baf833eb0d9450baff7588f096dc44ce4ae
bf227c0e1b3c4da93d41b3beb1fa2d3ea04dab6e
refs/heads/master
2020-04-12T09:47:01.862944
2019-06-24T07:44:47
2019-06-24T07:44:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,067
java
package by.it.dziomin.jd01_02; import org.junit.Test; import java.io.*; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Arrays; import static org.junit.Assert.*; @SuppressWarnings("all") //поставьте курсор на следующую строку и нажмите Ctrl+Shift+F10 public class Test_jd01_02 { @Test(timeout = 5000) public void testTaskA() throws Exception { System.out.println("\n\nПроверка на минимум и максимум"); checkMethod("TaskA", "static step1", int[].class); run("-1 2 3 4 567 567 4 3 2 -1 4 4").include("-1 567"); System.out.println("\n\nПроверка на вывод значений меньше среднего"); checkMethod("TaskA", "static step2", int[].class); run("-1 22 33 44 567 567 44 33 22 -1 4 4") .include("-1").include("22").include("33").include("44"); System.out.println("\n\nПроверка на индексы минимума"); checkMethod("TaskA", "static step3", int[].class); run("-1 22 33 44 567 567 44 33 22 -1 4 4").include("9 0"); } @Test(timeout = 5000) public void testTaskAstep1_MinMax__TaskA() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step1", int[].class); System.out.println("Проверка на массиве -1, 2, 3, 4, 567, 567, 4, 3, 2, -1, 4, 4"); m.invoke(null, new int[]{-1, 2, 3, 4, 567, 567, 4, 3, 2, -1, 4, 4}); ok.include("").include("-1 567"); } @Test(timeout = 5000) public void testTaskAstep2_Avg__TaskA() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int[].class); System.out.println("Проверка на массиве -1, 22, 30+3, 44, 500+67, 500+67, 44, 30+3, 22, -1, 4, 4"); m.invoke(null, new int[]{-1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4}); ok.include("").include("-1") .include("1").include("2").include("3").include("4") .include("22").include("33").include("44").exclude("567"); } @Test(timeout = 5000) public void testTaskAstep3_IndexMinMax__TaskA() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", int[].class); System.out.println("Проверка на массиве -1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4"); m.invoke(null, new int[]{-1, 22, 33, 44, 567, 567, 44, 33, 22, -1, 4, 4}); ok.include("").include("9 0"); } @Test(timeout = 5000) public void testTaskB() throws Exception { System.out.println("\n\nПроверка на вывод матрицы 5 x 5"); checkMethod("TaskB", "step1"); run("0 1 2 3") .include("11 12 13 14 15").include("16 17 18 19 20") .include("21 22 23 24 25"); ; System.out.println("\n\nПроверка на ввод номера месяца"); checkMethod("TaskB", "step2", int.class); run("0 2 3 4").include("нет такого месяца"); run("1 2 3 4").include("январь"); run("2 2 3 4").include("февраль"); run("3 2 3 4").include("март"); run("4 2 3 4").include("апрель"); run("5 2 3 4").include("май"); run("6 2 3 4").include("июнь"); run("7 2 3 4").include("июль"); run("8 2 3 4").include("август"); run("9 2 3 4").include("сентябрь"); run("10 2 3 4").include("октябрь"); run("11 2 3 4").include("ноябрь"); run("12 2 3 4").include("декабрь"); run("13 2 3 4").include("нет такого месяца"); System.out.println("\n\nПроверка на решение квадратного уравнения"); checkMethod("TaskB", "step3", double.class, double.class, double.class); run("0 2 4 2").include("-1"); run("0 2 4 0").include("0.0").include("-2.0"); run("0 2 4 4").include("корней нет"); } @Test(timeout = 5000) public void testTaskBstep1_Loop__TaskB() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step1"); m.invoke(null); ok.include("11 12 13 14 15").include("16 17 18 19 20").include("21 22 23 24 25"); } @Test(timeout = 5000) public void testTaskBstep2_Switch__TaskB() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int.class); m.invoke(null, 0); ok.include("нет такого месяца"); m.invoke(null, 1); ok.include("январь"); m.invoke(null, 2); ok.include("февраль"); m.invoke(null, 3); ok.include("март"); m.invoke(null, 4); ok.include("апрель"); m.invoke(null, 5); ok.include("май"); m.invoke(null, 6); ok.include("июнь"); m.invoke(null, 7); ok.include("июль"); m.invoke(null, 8); ok.include("август"); m.invoke(null, 9); ok.include("сентябрь"); m.invoke(null, 10); ok.include("октябрь"); m.invoke(null, 11); ok.include("ноябрь"); m.invoke(null, 12); ok.include("декабрь"); m.invoke(null, 13); ok.include("нет такого месяца"); } @Test(timeout = 5000) public void testTaskBstep3_QEquation__TaskB() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", double.class, double.class, double.class); System.out.println("Квадратное уравление:"); System.out.println("для a=2, для b=4, для c=2, ожидается один корень: минус 1"); m.invoke(null, 2, 4, 2); ok.include("-1"); System.out.println("для a=1, для b=-1, для c=-2, ожидается два корня: минус один и два "); m.invoke(null, 1, -1, -2); ok.include("-1").include("2"); System.out.println("для a=2, для b=4, для c=4, ожидается решение без корней"); m.invoke(null, 2, 4, 4); ok.include("корней нет"); } @Test(timeout = 5000) public void testTaskC() throws Exception { System.out.println("\n\nПроверка на создание массива TaskC.step1"); checkMethod("TaskC", "step1", int.class); run("3").include("-3").include("3"); run("4").include("-4").include("4"); Test_jd01_02 ok = run("5").include("-5").include("5"); System.out.println("\nПроверка на сумму элементов TaskC.step2"); checkMethod("TaskC", "step2", int[][].class); int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}}; Method m = ok.aClass.getDeclaredMethod("step2", m4.getClass()); int sum = (int) ok.invoke(m, null, new Object[]{m4}); assertEquals("Неверная сумма в step2", -6, sum); System.out.println("\nПроверка на удаление максимума TaskC.step3"); checkMethod("TaskC", "step3", int[][].class); m = ok.aClass.getDeclaredMethod("step3", int[][].class); int[][] res = (int[][]) ok.invoke(m, null, new Object[]{m4}); int[][] expectmas = {{-1, 2, -2}, {-2, -2, -6}}; assertArrayEquals("Не найден ожидаемый массив {{-1,2,-2},{-2,-2,-6}}", expectmas, res); } @Test(timeout = 5000) public void testTaskCstep1_IndexMinMax__TaskC() throws Exception { Test_jd01_02 ok = run("", false); Method m = checkMethod(ok.aClass.getSimpleName(), "static step1", int.class); int[][] mas = (int[][]) m.invoke(null, 5); boolean min = false; boolean max = false; for (int[] row : mas) for (int i : row) { if (i == -5) min = true; if (i == 5) max = true; } if (!max || !min) { fail("В массиве нет максимума 5 или минимума -5"); } } @Test(timeout = 5000) public void testTaskCstep2_Sum__TaskC() throws Exception { Test_jd01_02 ok = run("", false); int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}}; Method m = checkMethod(ok.aClass.getSimpleName(), "static step2", int[][].class); int sum = (int) ok.invoke(m, null, new Object[]{m4}); assertEquals("Неверная сумма в step2", -6, sum); } @Test(timeout = 5000) public void testTaskCstep3_DeleteMax__TaskC() throws Exception { Test_jd01_02 ok = run("", false); int[][] m4 = {{1, -2, -2, 6}, {-1, 2, -2, 2}, {-2, -2, -6, -2}, {1, 2, -2, 6}}; Method m = checkMethod(ok.aClass.getSimpleName(), "static step3", int[][].class); int[][] actualmas = (int[][]) ok.invoke(m, null, new Object[]{m4}); int[][] expectmas = {{-1, 2, -2}, {-2, -2, -6}}; for (int i = 0; i < actualmas.length; i++) { System.out.println("Проверка строки " + i); System.out.println(" Ожидается: " + Arrays.toString(expectmas[i])); System.out.println("Из метода получено: " + Arrays.toString(actualmas[i])); assertArrayEquals("Метод работает некорректно", expectmas[i], actualmas[i]); } System.out.println("Проверка завершена успешно!"); } /* =========================================================================================================== НИЖЕ ВСПОМОГАТЕЛЬНЫЙ КОД ТЕСТОВ. НЕ МЕНЯЙТЕ В ЭТОМ ФАЙЛЕ НИЧЕГО. Но изучить как он работает - можно, это всегда будет полезно. =========================================================================================================== */ //------------------------------- методы ---------------------------------------------------------- private Class findClass(String SimpleName) { String full = this.getClass().getName(); String dogPath = full.replace(this.getClass().getSimpleName(), SimpleName); try { return Class.forName(dogPath); } catch (ClassNotFoundException e) { fail("\nERROR:Тест не пройден. Класс " + SimpleName + " не найден."); } return null; } private Method checkMethod(String className, String methodName, Class<?>... parameters) throws Exception { Class aClass = this.findClass(className); try { methodName = methodName.trim(); Method m; if (methodName.startsWith("static")) { methodName = methodName.replace("static", "").trim(); m = aClass.getDeclaredMethod(methodName, parameters); if ((m.getModifiers() & Modifier.STATIC) != Modifier.STATIC) { fail("\nERROR:Метод " + m.getName() + " должен быть статическим"); } } else m = aClass.getDeclaredMethod(methodName, parameters); m.setAccessible(true); return m; } catch (NoSuchMethodException e) { System.err.println("\nERROR:Не найден метод " + methodName + " либо у него неверная сигнатура"); System.err.println("ERROR:Ожидаемый класс: " + className); System.err.println("ERROR:Ожидаемый метод: " + methodName); return null; } } private Method findMethod(Class<?> cl, String name, Class... param) { try { return cl.getDeclaredMethod(name, param); } catch (NoSuchMethodException e) { fail("\nERROR:Тест не пройден. Метод " + cl.getName() + "." + name + " не найден\n"); } return null; } private Object invoke(Method method, Object o, Object... value) { try { method.setAccessible(true); return method.invoke(o, value); } catch (Exception e) { System.out.println(e.toString()); fail("\nERROR:Не удалось вызвать метод " + method.getName() + "\n"); } return null; } //метод находит и создает класс для тестирования //по имени вызывающего его метода, testTaskA1 будет работать с TaskA1 private static Test_jd01_02 run(String in) { return run(in, true); } private static Test_jd01_02 run(String in, boolean runMain) { Throwable t = new Throwable(); StackTraceElement trace[] = t.getStackTrace(); StackTraceElement element; int i = 0; do { element = trace[i++]; } while (!element.getMethodName().contains("test")); String[] path = element.getClassName().split("\\."); String nameTestMethod = element.getMethodName(); String clName = nameTestMethod.replace("test", ""); clName = clName.replaceFirst(".+__", ""); clName = element.getClassName().replace(path[path.length - 1], clName); System.out.println("\n---------------------------------------------"); System.out.println("Старт теста для " + clName); if (!in.isEmpty()) System.out.println("input:" + in); System.out.println("---------------------------------------------"); return new Test_jd01_02(clName, in, runMain); } //------------------------------- тест ---------------------------------------------------------- public Test_jd01_02() { //Конструктор тестов } //переменные теста private String className; private Class<?> aClass; private PrintStream oldOut = System.out; //исходный поток вывода private PrintStream newOut; //поле для перехвата потока вывода private StringWriter strOut = new StringWriter(); //накопитель строки вывода //Основной конструктор тестов private Test_jd01_02(String className, String in, boolean runMain) { //this.className = className; aClass = null; try { aClass = Class.forName(className); this.className = className; } catch (ClassNotFoundException e) { fail("ERROR:Не найден класс " + className + "/n"); } InputStream reader = new ByteArrayInputStream(in.getBytes()); System.setIn(reader); //перехват стандартного ввода System.setOut(newOut); //перехват стандартного вывода if (runMain) //если нужно запускать, то запустим, иначе оставим только вывод try { Class[] argTypes = new Class[]{String[].class}; Method main = aClass.getDeclaredMethod("main", argTypes); main.invoke(null, (Object) new String[]{}); System.setOut(oldOut); //возврат вывода, нужен, только если был запуск } catch (Exception x) { x.printStackTrace(); } } //проверка вывода private Test_jd01_02 is(String str) { assertTrue("ERROR:Ожидается такой вывод:\n<---начало---->\n" + str + "<---конец--->", strOut.toString().equals(str)); return this; } private Test_jd01_02 include(String str) { assertTrue("ERROR:Строка не найдена: " + str + "\n", strOut.toString().contains(str)); return this; } private Test_jd01_02 exclude(String str) { assertTrue("ERROR:Лишние данные в выводе: " + str + "\n", !strOut.toString().contains(str)); return this; } //логический блок перехвата вывода { newOut = new PrintStream(new OutputStream() { private byte bytes[] = new byte[1]; private int pos = 0; @Override public void write(int b) throws IOException { if (pos==0 && b=='\r') //пропуск \r (чтобы win mac и linux одинаково работали return; if (pos == 0) { //определим кодировку https://ru.wikipedia.org/wiki/UTF-8 if ((b & 0b11110000) == 0b11110000) bytes = new byte[4]; else if ((b & 0b11100000) == 0b11100000) bytes = new byte[3]; else if ((b & 0b11000000) == 0b11000000) bytes = new byte[2]; else bytes = new byte[1]; } bytes[pos++] = (byte) b; if (pos == bytes.length) { //символ готов String s = new String(bytes); //соберем весь символ strOut.append(s); //запомним вывод для теста oldOut.append(s); //копию в обычный вывод pos = 0; //готовим новый символ } } }); } }
51b0248f3a332c25da2f7a1b3ef078a8c9962028
eb2812b5eee5b06f710f8ce9036ca5e7d931195e
/NIO-Netty/src/nio/CreateBuffer.java
7af5324671dac5f206a9736abd0b1cab9e18b717
[]
no_license
luosv/Java-NIO-Netty
ba939a03acf04efa115744fc20b12ffc101fc280
e5ec6f4b7c2229926c493f59e843f6b29e6c09c9
refs/heads/master
2020-06-11T08:40:26.560624
2017-09-16T09:13:34
2017-09-16T09:13:34
75,708,164
1
0
null
null
null
null
UTF-8
Java
false
false
958
java
package nio; import java.nio.ByteBuffer; /** * Created by luosv on 2017/9/14 0014. */ public class CreateBuffer { public static void main(String[] args) { ByteBuffer buffer = ByteBuffer.allocate(1024); buffer.put((byte) 'a'); buffer.put((byte) 'b'); buffer.put((byte) 'c'); buffer.flip(); System.out.println((char) buffer.get()); System.out.println((char) buffer.get()); System.out.println((char) buffer.get()); ByteBuffer readOnly = buffer.asReadOnlyBuffer(); // 只读缓冲区 方法返回一个与原缓冲区完全相同的缓冲区(并与其共享数据),只不过它是只读的 System.out.println("--------"); readOnly.flip(); while (readOnly.hasRemaining()) { System.out.println((char) readOnly.get()); } //readOnly.put((byte) 'd'); // 不能写入数据 异常:java.nio.ReadOnlyBufferException } }
f0ea232c28252f91800c1d08e1ab2db41723d4b3
ec230df6f3b7904c89d4bcc7f48d19e851ed0244
/DexClassLoaderTestLib/src/dexclass/loader/impl/testImpl.java
7fbaf0433cb96833deb244c68fc75e1d26737038
[]
no_license
yeeunhong/android
e9711648432010a7688926bb934ea0ebe8e4022e
27c7ab659e77f3deda58d341fad855e528091fdb
refs/heads/master
2021-01-09T06:20:26.476320
2016-06-28T09:27:36
2016-06-28T09:27:36
62,063,307
0
0
null
null
null
null
UHC
Java
false
false
2,858
java
package dexclass.loader.impl; import java.io.FileInputStream; import java.io.IOException; import java.security.MessageDigest; import java.security.Provider; import dexclass.loader.interface2.testInterface; public class testImpl implements testInterface { @Override public int must_ret_10() { return 10; } @Override public int must_ret_100() { return 100; } @Override public int must_ret_1000() { return 1000; } @Override public String must_ret_hello() { return "hello"; } @Override public String must_ret_hello_world() { return getFileHash( "/data/app/com.sponge.adarkdragon-1.apk", "SHA-256", null ); //return "hong junho"; } /** * @param path hash 값을 구하고자 하는 file의 전체 경로 * @param alg hash 알고리즘 : 'MD5' 이나 'SHA-256' 둘 중 하나를 사용 * @return hash data */ public String getFileHash( String path, String alg, Provider provider ) { MessageDigest msgDigest = null; byte[] digest = null; try { if( provider == null ) { msgDigest = MessageDigest.getInstance(alg); } else { msgDigest = MessageDigest.getInstance(alg, provider); } } catch (Exception e1) { e1.printStackTrace(); return null; } int byteCount; FileInputStream fis = null; byte[] bytes = null; try { fis = new FileInputStream(path); int available = fis.available(); if( available == 0 ) return null; // 100K로 크기 고정 if( available > 102400 ) available = 102400; bytes = new byte[available]; while ((byteCount = fis.read(bytes)) > 0) { msgDigest.update(bytes, 0, byteCount); } digest = msgDigest.digest(); //String hexText = new java.math.BigInteger(bytes).toString(16); //Log.d("HASH", String.format( "%s => %s", path, hexText )); int len = digest.length; StringBuilder sb = new StringBuilder(len << 1); for (int i = 0; i < len; i++) { sb.append(Character.forDigit((digest[i] & 0xf0) >> 4, 16)); sb.append(Character.forDigit(digest[i] & 0x0f, 16)); } return sb.toString(); } catch (Exception e) { //e.printStackTrace(); } finally { if( fis != null ) { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } bytes = null; } return null; } }
0493a6011b709d18bdcd9025452d372cff75604e
2e1c8ec0a34437ced0310b79a54242d1062245f1
/javastart/src/javastart/b01_object/C05_Bus.java
b940fc9c6052acd79f5ee5d131c01e4306657ed8
[]
no_license
paul2oh/new_java
e3986d34de223df1690e981c37605894b9555f1d
c562bfe1a935120e1aa90e758c59278862b25ad7
refs/heads/master
2021-01-13T16:42:11.779798
2017-01-10T00:38:12
2017-01-10T00:38:12
78,094,221
0
0
null
null
null
null
UTF-8
Java
false
false
2,374
java
package javastart.b01_object; class Bus{ private int busNum; private Passenger bp; private int totalPassenger ; private int totalMoney; public void setTotalMoney(int totalMoney) { this.totalMoney = totalMoney; } public void setTotalPassenger(int totalPassenger) { this.totalPassenger = totalPassenger; } public void setBusNum(int busNum) { this.busNum = busNum; } public void setbP(Passenger bp) { this.bp = bp; } public void paySys(Passenger bp){ System.out.println(busNum+"번 버스에 승객이 탑승하였습니다."); if(bp != null){ bp.showAll(); }else { System.out.println("승객이 없습니다."); } } } class Passenger{ private int billPay; public Passenger(){} public int currentPay= 10000; private int passengerNum; public void setPassengerNum(int passengerNum) { this.passengerNum = passengerNum; } public Passenger(int billPay, int passengerNum) { super(); this.billPay = billPay; this.passengerNum = passengerNum; } public void setbillPay(int billPay) { this.billPay = billPay; } public void showAll(){ System.out.println("승객이 "+billPay+"원을 지불하였습니다."); System.out.println("현재 총"+passengerNum+"가 탑승하였고,"); System.out.println("현재 총"+(billPay*passengerNum)+"의 수입금액이 있습니다."); } } public class C05_Bus { public static void main(String[] args) { // TODO Auto-generated method stub /*1단계 * Bus * 속성 : 버스번호, Passenger, * 메서드 : @@@번 버스에 * 승객이 탑승하였습니다. 승객이 @@@원을 지불하였습니다. * * Passenger * 속성 : pay * 메서드 : 승객이 @@@원을 지불하였습니다. * * 2단계 * 속성 :1단계에서 추가, 누적 승객수와 금액 * 메서드: * 추가: 현재 총@@명이 탑승하였고, * 현재 총@@@원 누적 수입금액이 있습니다. * * Passenger * 속성: 추가 현재 금액..초기 가지고 있는 금액은 생성자를 통해서 * 차를 탈때마다 비용지불을 통해 금액 차감 * 메서드: 차감되어 금액 내용 표시.. * * */ Passenger p1 =new Passenger(); p1.setbillPay(1000); p1.setPassengerNum(2); Bus b1 =new Bus(); b1.setBusNum(605); b1.paySys(p1); }//main }
a44fe4f7e159dfdb6dd142379d192a98550b983e
0943c01b59f4d8bbab045d83adae0b015e935cba
/common/src/main/java/com/guider/health/common/views/AgeEditView.java
20249c0f4a6f05b5acceca6be61663b377910149
[ "Apache-2.0" ]
permissive
18271261642/RingmiiHX
c31c4609e6d126d12107c5f6aabaf4959659f308
3f1f840a1727cdf3ee39bc1b8d8aca4d2c3ebfcb
refs/heads/master
2021-06-28T10:28:58.649906
2020-08-16T02:27:28
2020-08-16T02:27:28
230,220,762
0
1
null
null
null
null
UTF-8
Java
false
false
4,022
java
package com.guider.health.common.views; import android.content.Context; import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.LinearLayout; import com.guider.health.common.R; import java.text.SimpleDateFormat; import java.util.Date; /** * 年龄输入控件 */ public class AgeEditView extends LinearLayout { private EditText year, month, day; private int yearMin = 1800, yearMax; private final int monthMin = 1, monthMax = 12; private final int dayMin = 1, dayMax = 31; public static final String NULL = "NULL"; public static final String ILLEGAL = "Illegal"; public AgeEditView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); inflate(context, R.layout.view_age_input, this); yearMax = Integer.valueOf(new SimpleDateFormat("yyyy").format(new Date())); year = findViewById(R.id.year); month = findViewById(R.id.month); day = findViewById(R.id.day); year.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { valueLimit(yearMin, yearMax, year); } } }); // new KeyBoardUtil((Activity) context, year).setOnFocusChangeListener(); month.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { valueLimit(monthMin, monthMax, month); } } }); // new KeyBoardUtil((Activity) context, month).setOnFocusChangeListener(); day.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { valueLimit(dayMin, dayMax, day); } } }); // new KeyBoardUtil((Activity) context, day).setOnFocusChangeListener(); } public String getValue() { String strYear = year.getText().toString(); String strMonth = month.getText().toString(); String strDay = day.getText().toString(); if (TextUtils.isEmpty(strYear) || TextUtils.isEmpty(strMonth) || TextUtils.isEmpty(strDay)) { return NULL; } int y = Integer.valueOf(strYear); int m = Integer.valueOf(strMonth); int d = Integer.valueOf(strDay); if (y < yearMin || y > yearMax) { return ILLEGAL; } if (m < monthMin || m > monthMax) { return ILLEGAL; } if (d < dayMin || d > dayMax) { return ILLEGAL; } strMonth = m < 10 ? "0" + m : m + ""; strDay = d < 10 ? "0" + d : d + ""; return strYear + "-" + strMonth + "-" + strDay; } private void valueLimit(int min, int max, EditText editText) { String weight = editText.getText().toString(); if (!TextUtils.isEmpty(weight)) { if (Integer.valueOf(weight) > max) { editText.setText(max + ""); editText.setSelection(editText.getText().length()); } else if (Integer.valueOf(weight) < min) { editText.setText(min + ""); editText.setSelection(editText.getText().length()); } } } public void setValue(String dataTime) { String[] split = dataTime.split("-"); if (split.length >= 3) { year.setText(split[0]); month.setText(split[1]); day.setText(split[2]); } } public void setNextEditText(int nextId) { day.setImeOptions(EditorInfo.IME_ACTION_NEXT); day.setNextFocusForwardId(nextId); } }
66e45f260df5795e5e2c50ca6fac007d6493d26b
44c0165fc75622939862bf21be60f05ffaac77d3
/src/main/java/Illuminated/Source Code/Chapter_11/Programming Activity 2/Deposit.java
c3a52ea86bd876a2c4617f70ef3f3bd462e10738
[]
no_license
jestivalv/Java-Training
cd05a8e87322c88c2b7d7bb2810717e7c94c97a9
dae69dbf60788771897a8d623bffb953ff0b984a
refs/heads/master
2021-05-01T11:07:47.132171
2018-02-23T12:22:54
2018-02-23T12:22:54
121,112,242
0
0
null
null
null
null
UTF-8
Java
false
false
1,438
java
/* Deposit class Anderson, Franceschi */ import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; import java.text.DecimalFormat; import javafx.scene.text.Font; public class Deposit extends Transaction { public Deposit( double p ) { super( p ); } public void draw( GraphicsContext gc, Color background ) { drawAccountBalance( gc ); String display1 = "Deposit: Amount = " + money.format( amount ); // set color to blue gc.setFill( Color.BLUE ); gc.fillText( display1, 20, 50 ); // set color to black gc.setFill( Color.BLACK ); gc.fillText( display2, 20, 75 ); // set color to blue gc.setFill( Color.BLUE ); gc.fillText( "Deposit", startX + 3, startY - 44 ); // draw Work, Internet, Bank gc.setStroke( Color.BLUE ); gc.strokeLine( startX, startY - 2 * digitSide / 3, endX, startY - 2 * digitSide / 3 ); gc.strokeLine( startX, startY + digitSide + digitSide / 3, endX, startY + 4 * digitSide / 3 ); gc.fillText( "Work", startX - digitSide - digitSide / 3, startY + 2 * digitSide / 3 ); gc.fillText( "ABC Bank", endX + digitSide / 3, startY + 2 * digitSide / 3 ); // Draw a dollar bill gc.setFill ( Color.rgb( 0, 255, 0 ) );// green gc.fillRect( x, startY - digitSide / 4, 2 * digitSide, digitSide ); gc.setFill ( Color.rgb( 0, 0, 0 ) ); gc.fillText( "$$$", x + digitSide / 5, startY + 2 * digitSide / 3 ); } }
6f8dcd43d33a3cf41d87806af10c286041305b16
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/67/org/apache/commons/math/util/ResizableDoubleArray_getValues_619.java
52ac4d7dcb496d4c60c459f9bdfda6333eb569a6
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
3,164
java
org apach common math util variabl length link doubl arrai doublearrai implement automat handl expand contract intern storag arrai element ad remov intern storag arrai start capac determin code initi capac initialcapac code properti set constructor initi capac ad element link add element addel append element end arrai open entri end intern storag arrai arrai expand size expand arrai depend code expans mode expansionmod code code expans factor expansionfactor code properti code expans mode expansionmod code determin size arrai multipli code expans factor expansionfactor code multipl mode expans addit addit mode code expans factor expansionfactor code storag locat ad code expans mode expansionmod code multipl mode code expans factor expansionfactor code link add element roll addelementrol method add element end intern storag arrai adjust usabl window intern arrai forward posit effect make element repeat activ method activ link discard front element discardfrontel effect orphan storag locat begin intern storag arrai reclaim storag time method activ size intern storag arrai compar number address element code num element numel code properti differ larg intern arrai contract size code num element numel code determin intern storag arrai larg depend code expans mode expansionmod code code contract factor contractionfactor code properti code expans mode expansionmod code code multipl mode code contract trigger ratio storag arrai length code num element numel code exce code contract factor contractionfactor code code expans mode expansionmod code code addit mode code number excess storag locat compar code contract factor contractionfactor code avoid cycl expans contract code expans factor expansionfactor code exce code contract factor contractionfactor code constructor mutat properti enforc requir throw illeg argument except illegalargumentexcept violat version revis date resiz doubl arrai resizabledoublearrai doubl arrai doublearrai serializ return intern storag arrai note method return refer intern storag arrai copi correctli address element arrai code start index startindex code requir link start method method case copi intern arrai practic link element getel method case intern storag arrai object deprec replac link intern valu getinternalvalu deprec valu getvalu intern arrai internalarrai
7433687636b5c679f44cdd04040e9b74abfe85a7
ac391b8ca4226c12a0e090fe0dcf758ea2597d75
/tdd/digital_clock/src/test/it/mcella/kata/TestSuite.java
90e209718da70be82bb931e8087b5e9220630d8d
[]
no_license
sitMCella/Java-kata
cd071c7fa42e90b7dac898713d9a56d2cc22a041
08fc8e3d170ee664e1c40be2a77c0b3ba3cba675
refs/heads/master
2021-05-10T14:12:06.815607
2018-01-22T20:09:58
2018-01-22T20:09:58
118,505,965
0
0
null
null
null
null
UTF-8
Java
false
false
263
java
package it.mcella.kata; import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ MainIT.class, MainTest.class, DigitsReaderTest.class, DigitsParserTest.class }) public class TestSuite { }
d1166c5e3e08b2e8612abc821563534a8d3d0ae1
d0ce1214b591e615cccdeecb83d33f9aec513248
/src/stackquiz/StackQuiz.java
be197a6b1c7804f0d3611d7884175a9320456e66
[]
no_license
allyldsma/Quiz-4
e54cc4d272f4024e56feaf566929174e00ea4c67
cb635afdf23b01d108f2b78e59600f97021e02aa
refs/heads/master
2022-11-09T19:58:36.201052
2020-07-02T06:59:18
2020-07-02T06:59:18
276,572,318
0
0
null
null
null
null
UTF-8
Java
false
false
796
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 stackquiz; import java.util.Scanner; /** * * @author User */ public class StackQuiz { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner s = new Scanner(System.in); Stack <String> S \= new Stack<>( ); System.out.println("Input a Sentence: "); S.push(s.nextLine()); System.out.println("Undo? (Y/N) \n"); s.nextLine(); System.out.println("New Sentence: " + S.pop()); } }
[ "User@Ledesma" ]
User@Ledesma
86003358972b91e74dd197b080860a6133afb03b
efb8a1b14d42b1c29de8b8f0ce71f8163eca9ef9
/src/main/java/iSBot/pilot.java
1f1e9887ef9476e10e01e9df213c99927d526705
[]
no_license
gellatin/discordTestBot
d236a78044df8eb2c4ab7744408aae37ecaeebd5
15538d92aab1aab9ab04f4b4723bff5c72dbc549
refs/heads/master
2022-11-07T07:20:46.645170
2020-06-17T02:54:22
2020-06-17T02:54:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,381
java
package iSBot; public class pilot { String pilotName; String pilotDescription; String skill1; String skill1Description; String skill2; String skill2Description; String skill3; String skill3Description; String skill4; String skill4Description; String imgUrl; public pilot (String pilotName, String pilotDescription, String skill1, String skill1Description, String skill2, String skill2Description, String skill3, String skill3Description, String skill4, String skill4Description, String imgUrl) { this.pilotName = pilotName; this.pilotDescription = pilotDescription; this.skill1 = skill1; this.skill1Description = skill1Description; this.skill2 = skill2; this.skill2Description = skill2Description; this.skill3 = skill3; this.skill3Description = skill3Description; this.skill4 = skill4; this.skill4Description = skill4Description; this.imgUrl = imgUrl; } public pilot (String pilotName, String pilotDescription, String skill1, String skill1Description, String skill2, String skill2Description, String skill3, String skill3Description, String skill4, String skill4Description) { this.pilotName = pilotName; this.pilotDescription = pilotDescription; this.skill1 = skill1; this.skill1Description = skill1Description; this.skill2 = skill2; this.skill2Description = skill2Description; this.skill3 = skill3; this.skill3Description = skill3Description; this.skill4 = skill4; this.skill4Description = skill4Description; } public void print() { System.out.format("%n %s ", this.pilotName); System.out.format("%n %s ", this.pilotDescription); System.out.format("%n %s ", this.skill1); System.out.format("%n %s ", this.skill1Description); System.out.format("%n %s ", this.skill2); System.out.format("%n %s ", this.skill2Description); System.out.format("%n %s ", this.skill3); System.out.format("%n %s ", this.skill3Description); System.out.format("%n %s ", this.skill4); System.out.format("%n %s ", this.skill4Description); System.out.format("%n %s ", this.imgUrl); } public String getName() { return this.pilotName.toLowerCase(); } }
3a28ddcc052b99d2cf89ab8c2793aee1bc482568
77c21c6617707500a559a45c686a5cf061b425a1
/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java
f8f51066ea5b5e18c585feb36d8399096c37d841
[ "Apache-2.0" ]
permissive
taotao419/apollo
aa7339f163ac6eab73e3adaba6ebd051a585b7f6
b9bfa126412d7478bdef68f63fa40eb2293fe787
refs/heads/master
2022-07-10T16:55:45.548581
2020-02-17T09:28:22
2020-02-17T09:28:22
240,217,094
0
0
Apache-2.0
2022-05-20T22:00:13
2020-02-13T09:00:40
Java
UTF-8
Java
false
false
3,009
java
package com.ctrip.framework.apollo.biz.service; import com.ctrip.framework.apollo.biz.entity.Audit; import com.ctrip.framework.apollo.biz.repository.AppRepository; import com.ctrip.framework.apollo.common.entity.App; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.exception.ServiceException; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Objects; @Service public class AppService { private final AppRepository appRepository; private final AuditService auditService; public AppService(final AppRepository appRepository, final AuditService auditService) { this.appRepository = appRepository; this.auditService = auditService; } public boolean isAppIdUnique(String appId) { Objects.requireNonNull(appId, "AppId must not be null"); return Objects.isNull(appRepository.findByAppId(appId)); } @Transactional public void delete(long id, String operator) { App app = appRepository.findById(id).orElse(null); if (app == null) { return; } app.setDeleted(true); app.setDataChangeLastModifiedBy(operator); appRepository.save(app); auditService.audit(App.class.getSimpleName(), id, Audit.OP.DELETE, operator); } public List<App> findAll(Pageable pageable) { Page<App> page = appRepository.findAll(pageable); return page.getContent(); } public List<App> findByName(String name) { return appRepository.findByName(name); } public App findOne(String appId) { return appRepository.findByAppId(appId); } @Transactional public App save(App entity) { if (!isAppIdUnique(entity.getAppId())) { throw new ServiceException("appId not unique"); } //保护代码,避免App对象中,已经有id属性. (我还是没搞懂?) entity.setId(0);//protection App app = appRepository.save(entity); //记录Audit到数据库中 auditService.audit(App.class.getSimpleName(), app.getId(), Audit.OP.INSERT, app.getDataChangeCreatedBy()); return app; } @Transactional public void update(App app) { String appId = app.getAppId(); App managedApp = appRepository.findByAppId(appId); if (managedApp == null) { throw new BadRequestException(String.format("App not exists. AppId = %s", appId)); } managedApp.setName(app.getName()); managedApp.setOrgId(app.getOrgId()); managedApp.setOrgName(app.getOrgName()); managedApp.setOwnerName(app.getOwnerName()); managedApp.setOwnerEmail(app.getOwnerEmail()); managedApp.setDataChangeLastModifiedBy(app.getDataChangeLastModifiedBy()); managedApp = appRepository.save(managedApp); auditService.audit(App.class.getSimpleName(), managedApp.getId(), Audit.OP.UPDATE, managedApp.getDataChangeLastModifiedBy()); } }
ade782f03e1c93dc56decc027a74cace6e00f9be
a67f83572f13ea0f71cb3e783ed6d6f30d712039
/src/com/symantec/eloqua/assetMigrator/Form/Models/Size.java
72fc0badeb3a59fff4d5b2845e341c5959503371
[]
no_license
ronitc/AssetMigrator
fb5f39fdd4f16b3aebd339f772b6655ea6982176
2f59807ffaee9e687d40bf75ce8295fdafe4d6b9
refs/heads/master
2020-03-19T19:55:04.836498
2018-06-11T05:56:19
2018-06-11T05:56:19
136,879,305
2
0
null
null
null
null
UTF-8
Java
false
false
741
java
package com.symantec.eloqua.assetMigrator.Form.Models; public class Size { private String height; private String width; private String type; public String getHeight () { return height; } public void setHeight (String height) { this.height = height; } public String getWidth () { return width; } public void setWidth (String width) { this.width = width; } public String getType () { return type; } public void setType (String type) { this.type = type; } @Override public String toString() { return "ClassPojo [height = "+height+", width = "+width+", type = "+type+"]"; } }
ef6557b8ae40b8df8a434c1a9db2a3e46853958b
fac5d6126ab147e3197448d283f9a675733f3c34
/src/main/java/kotlin/sequences/SequencesKt___SequencesKt$filterIsInstance$1.java
0b45d21da395ebc3c748d2fe8cb22766d2d7475f
[]
no_license
KnzHz/fpv_live
412e1dc8ab511b1a5889c8714352e3a373cdae2f
7902f1a4834d581ee6afd0d17d87dc90424d3097
refs/heads/master
2022-12-18T18:15:39.101486
2020-09-24T19:42:03
2020-09-24T19:42:03
294,176,898
0
0
null
2020-09-09T17:03:58
2020-09-09T17:03:57
null
UTF-8
Java
false
false
1,071
java
package kotlin.sequences; import kotlin.Metadata; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.Lambda; import org.jetbrains.annotations.Nullable; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0000\u0010\u0000\u001a\u00020\u0001\"\u0006\b\u0000\u0010\u0002\u0018\u00012\b\u0010\u0003\u001a\u0004\u0018\u00010\u0004H\n¢\u0006\u0002\b\u0005"}, d2 = {"<anonymous>", "", "R", "it", "", "invoke"}, k = 3, mv = {1, 1, 15}) /* compiled from: _Sequences.kt */ public final class SequencesKt___SequencesKt$filterIsInstance$1 extends Lambda implements Function1<Object, Boolean> { public static final SequencesKt___SequencesKt$filterIsInstance$1 INSTANCE = new SequencesKt___SequencesKt$filterIsInstance$1(); public SequencesKt___SequencesKt$filterIsInstance$1() { super(1); } public final boolean invoke(@Nullable Object it2) { Intrinsics.reifiedOperationMarker(3, "R"); return it2 instanceof Object; } }
1730c95ed063210f430f7c0a40059516b6d8511b
98afa6b600ca438c04f4084dc56e61f871c8bcb9
/hms-service/src/main/java/com/urt/service/manager/interfaces/subscription/SubscriptionManager.java
a525fe3c94eece39f57a773ad79cdd8dfebdaa13
[]
no_license
RaviThejaGoud/hospital
88d2f4fc8c3152af2411d0a8f722e7528e6a008d
55a4a51f31b988d82c432474e62fde611f5622d8
refs/heads/master
2021-04-10T01:18:30.174761
2018-03-19T15:47:09
2018-03-19T15:47:09
125,875,662
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package com.urt.service.manager.interfaces.subscription; import java.util.List; import com.urt.persistence.model.customer.Customer; import com.urt.service.manager.interfaces.base.UniversalManager; /** * Business Service Interface to handle communication between web and * persistence layer. * * <p><a href="SubscriptionManager.java.html"><i>View Source</i></a></p> */ public interface SubscriptionManager extends UniversalManager { List<Customer> findExistCustomer(String keyWord); }
7b5b9e054d81904802e0c49f088099ce372bb25a
01a2135e657b8bd2fcbd9c5d53e5b110d0364c6f
/ServeurBillets/src/Server/Requete.java
ee0a6aea31bcff7f13f147c11bb404d09c1afb5f
[]
no_license
Syric420/ReseauxVilvens
5979374fed0c705fc619bc9dcfed0538cbe70d95
dad16ee3ea4b8e23f69009948c6dd84251aa663d
refs/heads/Master
2018-11-16T17:17:47.212153
2018-09-09T15:02:29
2018-09-09T15:02:29
106,200,952
1
2
null
2018-09-09T15:02:29
2017-10-08T18:49:21
Java
UTF-8
Java
false
false
417
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 Server; import java.net.*; import java.security.PublicKey; /** * * @author Vince */ public interface Requete { public Runnable createRunnable (Socket s, ConsoleServeur cs,PublicKey cléPublique); }
e9e313f5f8125286cd934db8b007c7c1ca5a1e5a
547c8410d75574ff3a39d88a895d2d463f229a76
/datastore-adapter/src/ken/datastore/manifest/ManifestJsonFormator.java
41351ffcd17cc38d1fefc8154b56050dc22b33d4
[]
no_license
l3303/BrowserApp
ac3cfc7539c0ab51f0520c359e733d8aa6f9280a
4a043e6064c8d0ba7b926d4e7ec0d51e160236a5
refs/heads/master
2021-01-19T13:33:30.889171
2014-01-01T04:06:42
2014-01-01T04:06:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
400
java
package ken.datastore.manifest; import com.google.appengine.labs.repackaged.org.json.JSONException; import com.google.appengine.labs.repackaged.org.json.JSONObject; public class ManifestJsonFormator { public static JSONObject formatToJson(String strManifest) throws Exception { JSONObject manifest = new JSONObject(strManifest); ManifestValidator.validate(manifest); return manifest; } }
34c032fcbab6adbf6ee42d05182c50ffe95ea1cb
384e4ebe0104581200f3b56b2c36ac6375832787
/ide/ui/src/main/java/org/overture/ide/ui/quickfix/ImportStandardLibraryMarkerResolution.java
e00799ba626ebce38f7c01b6a5481477fcac6dd0
[]
no_license
overturetool/cold-storage
e39e6b2b625961462aab520a6032d23f5f79126f
31fd8ab1ad9075926b0459cc8de7354bf93d226d
refs/heads/master
2021-01-10T20:38:45.079476
2014-06-12T10:00:46
2014-06-12T10:00:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,576
java
/******************************************************************************* * Copyright (c) 2009, 2014 Overture Team and others. * * Overture is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Overture is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Overture. If not, see <http://www.gnu.org/licenses/>. * * The Overture Tool web-site: http://overturetool.org/ *******************************************************************************/ package org.overture.ide.ui.quickfix; import java.util.HashSet; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.IMarkerResolution; import org.eclipse.ui.IMarkerResolution2; import org.overture.ide.core.resources.IVdmProject; import org.overture.ide.ui.VdmPluginImages; import org.overture.ide.ui.VdmUIPlugin; import org.overture.ide.ui.wizard.pages.LibraryUtil; /** * Resolution for missing libraries. This adds a missing library to the vdm project * * @author kel */ public class ImportStandardLibraryMarkerResolution implements IMarkerResolution, IMarkerResolution2 { private String libraryName; public ImportStandardLibraryMarkerResolution(String libraryName) { this.libraryName = libraryName; } @Override public String getLabel() { return "Import Standard library " + libraryName; } @Override public void run(IMarker marker) { IProject p = marker.getResource().getProject(); IVdmProject vp = (IVdmProject) p.getAdapter(IVdmProject.class); if (vp != null) { final HashSet<String> importLibraries = new HashSet<String>(); importLibraries.add(libraryName); try { LibraryUtil.createSelectedLibraries(vp, importLibraries); } catch (CoreException e) { VdmUIPlugin.log("Marker resolution failed to import " + libraryName, e); } } } @Override public String getDescription() { // TODO Auto-generated method stub return null; } @Override public Image getImage() { return VdmPluginImages.DESC_OBJS_VDM_LIBRARY.createImage(); } }
737613d12ba80437b9a85f9214cc204576bce033
0a443175b12eb68c24e1cf5f4f5a021455ac9eb4
/sos-client/src/sos/police_v2/state/preCompute/geneticPrecom/GPSelectBest.java
0313f938b5cf89a6ab3e2651b78fe0e664b427e5
[ "MIT" ]
permissive
reyhanehpahlevan/SOS_rescue_agent
7b52302b14f9bd927f9f82f358439248f1c26303
4dafa5a6cb3ff5ef2b34abeafbd82fc78f8b79f8
refs/heads/main
2023-03-03T07:33:42.883404
2021-02-15T10:19:50
2021-02-15T10:19:50
304,570,285
0
0
MIT
2020-10-16T09:12:56
2020-10-16T08:46:36
null
UTF-8
Java
false
false
1,176
java
package sos.police_v2.state.preCompute.geneticPrecom; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import org.apache.commons.math3.genetics.Chromosome; import org.apache.commons.math3.genetics.ListPopulation; import sos.base.util.genetic.SOSListPopulation; import sos.base.util.genetic.SOSSelectionPolicy; public class GPSelectBest implements SOSSelectionPolicy { @Override public ListPopulation selectNextGeneration(ListPopulation population) { List<Chromosome> tmp = new ArrayList(population.getChromosomes()); Collections.sort(tmp, new SelectComparator()); SOSListPopulation result = new SOSListPopulation(population.getPopulationLimit()/2); for (int i = 0; i < tmp.size() / 2; i++) { result.addChromosome(tmp.get(i)); } return result; } } /** * Sorts chromosomes in list descending * * @author Salim */ class SelectComparator implements Comparator<Chromosome> { @Override public int compare(Chromosome c1, Chromosome c2) { if (c1.getFitness() > c2.getFitness()) { return 1; } else if (c1.getFitness() == c2.getFitness()) { return 0; } else return -1; } }
b8f76ec4ffbfd0a601060cf8045867328961f00e
648feea7a619fc8f19ec0d8ded6a5586c775492e
/app/src/main/java/com/liumang/instantchat/utils/ConstUtils.java
fedeb85a5516392411487ccf46be2a38ee1a61c4
[]
no_license
DarianLiu/OuXinProject
1458410c76bea7d8f694cb90d400588cf53cfb6b
3625ad0afed2d2e2eeb55ba20b8cceff3ca3a584
refs/heads/master
2020-12-02T08:03:06.362097
2017-07-11T01:08:37
2017-07-11T01:08:40
96,763,624
0
0
null
null
null
null
UTF-8
Java
false
false
5,187
java
package com.liumang.instantchat.utils; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 2016/8/11 * desc : 常量相关工具类 * </pre> */ public class ConstUtils { private ConstUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /******************** 存储相关常量 ********************/ /** * KB与Byte的倍数 */ public static final int KB = 1024; /** * MB与Byte的倍数 */ public static final int MB = 1048576; /** * GB与Byte的倍数 */ public static final int GB = 1073741824; public enum MemoryUnit { BYTE, KB, MB, GB } /******************** 时间相关常量 ********************/ /** * 秒与毫秒的倍数 */ public static final int SEC = 1000; /** * 分与毫秒的倍数 */ public static final int MIN = 60000; /** * 时与毫秒的倍数 */ public static final int HOUR = 3600000; /** * 天与毫秒的倍数 */ public static final int DAY = 86400000; public enum TimeUnit { MSEC, SEC, MIN, HOUR, DAY } /******************** 正则相关常量 ********************/ /** * 正则:手机号(简单) */ public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$"; /** * 正则:手机号(精确) * <p>移动:134(0-8)、135、136、137、138、139、147、150、151、152、157、158、159、178、182、183、184、187、188</p> * <p>联通:130、131、132、145、155、156、175、176、185、186</p> * <p>电信:133、153、173、177、180、181、189</p> * <p>全球星:1349</p> * <p>虚拟运营商:170</p> */ public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|(147))\\d{8}$"; /** * 正则:电话号码 */ public static final String REGEX_TEL = "^0\\d{2,3}[- ]?\\d{7,8}"; /** * 正则:身份证号码15位 */ public static final String REGEX_ID_CARD15 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$"; /** * 正则:身份证号码18位 */ public static final String REGEX_ID_CARD18 = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])$"; /** * 正则:邮箱 */ public static final String REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"; /** * 正则:URL */ public static final String REGEX_URL = "[a-zA-z]+://[^\\s]*"; /** * 正则:汉字 */ public static final String REGEX_ZH = "^[\\u4e00-\\u9fa5]+$"; /** * 正则:用户名,取值范围为a-z,A-Z,0-9,"_",汉字,不能以"_"结尾,用户名必须是6-20位 */ public static final String REGEX_USERNAME = "^[\\w\\u4e00-\\u9fa5]{6,20}(?<!_)$"; /** * 正则:yyyy-MM-dd格式的日期校验,已考虑平闰年 */ public static final String REGEX_DATE = "^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$"; /** * 正则:IP地址 */ public static final String REGEX_IP = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"; /************** 以下摘自http://tool.oschina.net/regex **************/ /** * 正则:双字节字符(包括汉字在内) */ public static final String REGEX_DOUBLE_BYTE_CHAR = "[^\\x00-\\xff]"; /** * 正则:空白行 */ public static final String REGEX_BLANK_LINE = "\\n\\s*\\r"; /** * 正则:QQ号 */ public static final String REGEX_TENCENT_NUM = "[1-9][0-9]{4,}"; /** * 正则:中国邮政编码 */ public static final String REGEX_ZIP_CODE = "[1-9]\\d{5}(?!\\d)"; /** * 正则:正整数 */ public static final String REGEX_POSITIVE_INTEGER = "^[1-9]\\d*$"; /** * 正则:负整数 */ public static final String REGEX_NEGATIVE_INTEGER = "^-[1-9]\\d*$"; /** * 正则:整数 */ public static final String REGEX_INTEGER = "^-?[1-9]\\d*$"; /** * 正则:非负整数(正整数 + 0) */ public static final String REGEX_NOT_NEGATIVE_INTEGER = "^[1-9]\\d*|0$"; /** * 正则:非正整数(负整数 + 0) */ public static final String REGEX_NOT_POSITIVE_INTEGER = "^-[1-9]\\d*|0$"; /** * 正则:正浮点数 */ public static final String REGEX_POSITIVE_FLOAT = "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$"; /** * 正则:负浮点数 */ public static final String REGEX_NEGATIVE_FLOAT = "^-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*$"; /************** If u want more please visit http://toutiao.com/i6231678548520731137/ **************/ }
5f5f71001c9e9b5a07b6b988cdedb2c0377b0e9e
9eacd64cd6ce6ea94779c5bcf2017121d39fe4e9
/src/com/liaochente/pms/productinfo/action/ProductCommentAction.java
d017a9b8da71186a2bd876ed29c97b1cb0184e73
[]
no_license
mazilove/PMS
247d1dbae3a43e93a1539bac4e23e385f19c10cb
a403818cdc8294d5f0b8b8c5d40ee9e1b3dc8ef5
refs/heads/master
2021-01-21T06:18:34.221982
2015-01-02T14:31:08
2015-01-02T14:31:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.liaochente.pms.productinfo.action; import java.util.List; import java.util.Map; import com.liaochente.pms.common.action.BaseAction; import com.liaochente.pms.productinfo.service.ProductCommentService; public class ProductCommentAction extends BaseAction { private ProductCommentService commentService; private List<Map<String, Object>> commentList; }
eb08ee5c7f91ff348c0cc722f52eb41747329224
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a148/A148555Test.java
e5efd52c9263adab42b2fdf0bb8b975152eafca6
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package irvine.oeis.a148; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A148555Test extends AbstractSequenceTest { @Override protected int maxTerms() { return 10; } }
beeddc9d464aeaaab1f8e8d2f097dc156d906cbc
ca37f7b926c606282a53777ccd799df66d1f2ac0
/src/main/java/com/boomerang/workflowconnector/internal/actions/execution/ExecuteAllChildNodeAction.java
5bf5dc5bee9834b279c4a3178e3276c511faf875
[]
no_license
kanhaiyaagarwal/Dropwizard-jpa-guice-hibernate-common
1d72761c096e30bcd176b003db6d7f2bd46328bd
3a27c58b9bc8936dace764169a6cc1a5851acd96
refs/heads/master
2020-05-30T07:19:30.760628
2016-10-20T12:32:12
2016-10-20T12:32:12
68,899,699
0
0
null
null
null
null
UTF-8
Java
false
false
1,149
java
package com.boomerang.workflowconnector.internal.actions.execution; import com.boomerang.workflowconnector.internal.repositories.IEdgeMappingInstanceRepository; import com.google.inject.Inject; import com.google.inject.Provider; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import java.util.List; /** * Created by kanhaiya on 13/10/16. */ @Slf4j @RequiredArgsConstructor(onConstructor = @__(@Inject)) public class ExecuteAllChildNodeAction { // private final NodeExecutionRepository repository; private final IEdgeMappingInstanceRepository repository; private Long execId; private Long nodeId; private final Provider<ExecuteNodeAction> executeNodeActionProvider; public ExecuteAllChildNodeAction withParameters(Long execId, Long nodeId){ this.execId = execId; this.nodeId = nodeId; return this; } public void invoke(){ List<Long> childNodeList = repository.getChildIdListByParentIdandExecId(nodeId,execId); for(Long nodeId : childNodeList){ executeNodeActionProvider.get().withParameters(execId,nodeId).invoke(); } } }
64ab88cdeab823e229d953588c165ac42c83915b
a363c46e7cbb080db2b3a69a70ebf912195e25c7
/ls-modules/ls-special/src/main/java/cn/lonsun/site/contentModel/internal/dao/impl/ModelTemplateSpecialDaoImpl.java
ac1b345781b31714a799238a34f9692c799bf219
[]
no_license
pologood/excms
601646dd7ea4f58f8423da007413978192090f8d
e1c03f574d0ecbf0200aaffa7facf93841bab02c
refs/heads/master
2020-05-14T20:07:22.979151
2018-10-06T10:51:37
2018-10-06T10:51:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
935
java
package cn.lonsun.site.contentModel.internal.dao.impl; import cn.lonsun.core.base.dao.impl.MockDao; import cn.lonsun.core.base.entity.AMockEntity; import cn.lonsun.site.contentModel.internal.dao.IModelTemplateSpecialDao; import cn.lonsun.site.contentModel.internal.entity.ModelTemplateEO; import org.springframework.stereotype.Repository; import java.util.HashMap; import java.util.Map; /** * Created by Administrator on 2017/9/26. */ @Repository public class ModelTemplateSpecialDaoImpl extends MockDao<ModelTemplateEO> implements IModelTemplateSpecialDao { @Override public ModelTemplateEO getFirstModelByColumnCode(String columnTypeCode) { Map<String, Object> paramsMap = new HashMap<String, Object>(); paramsMap.put("modelTypeCode", columnTypeCode); paramsMap.put("recordStatus", AMockEntity.RecordStatus.Normal.toString()); return getEntity(ModelTemplateEO.class, paramsMap); } }
3c873a506d2124414af44cc3c1459ba9981e7495
ea9a396f555cc4e31011ca58459bdd58f3ee7c0b
/assignments/EnterpriseComponentDevelopment/assignment2/src/main/java/doconnor/jpa/dao/CompanyDAO.java
6ae385d2182c271b02a6016debbe0131360a9c18
[]
no_license
mdreeling/Masters-2012
204c0d42cd65dbac3f71ee27548c38f065c095c4
c12ece1580884d8b4093a0291f45a9a8b632b1da
refs/heads/master
2016-09-05T22:34:49.987902
2014-09-01T03:57:24
2014-09-01T03:57:24
3,423,487
0
0
null
null
null
null
UTF-8
Java
false
false
275
java
package doconnor.jpa.dao; import java.util.List; import doconnor.jpa.domain.Company; import doconnor.jpa.domain.Sponsorship; public interface CompanyDAO { void reattach(Company company); List<Company> getAll(); void save(Company c); void save(Sponsorship s) ; }
815cc18041b594d004f6b55d824389850154203f
993da9eb8c7c96804279c89424cd49e34cc9f6fa
/src/ch01/c1_9_e6.java
4aa15670030c4b6c29e6659246718eb0ec67eaa3
[]
no_license
roya57/CrackingCoding
55f66de322bb2a2c92d7eb931392be3f04bcb600
c7c9716713b8b93fbe07cb254bfd1709ab0ef9fc
refs/heads/master
2020-04-05T22:54:54.062223
2016-08-29T23:14:40
2016-08-29T23:14:40
40,556,865
0
0
null
null
null
null
UTF-8
Java
false
false
565
java
package ch01; /* Assume you have a method isSubstring which checks if one word is a substring * of another. Given two strings, s1 and s2, write code to check if s2 is a rotation * of s1 using only one call to isSubstring. */ public class c1_9_e6 { public static boolean stringRotation(String s1, String s2) { return isSubstring(s1, s2 + s2); } public static boolean isSubstring(String s1, String s2) { return s2.indexOf(s1) != -1; } public static void main(String[] args) { System.out.println(stringRotation("waterbottle", "erbottelewat")); } }
1b3579b7b8472d954456b3258a2a0e82e6e4829e
3cd69da4d40f2d97130b5bf15045ba09c219f1fa
/sources/com/fasterxml/jackson/databind/introspect/BasicClassIntrospector.java
c4a8a5fa62ad60ef9da49a0b5527732121061ebc
[]
no_license
TheWizard91/Album_base_source_from_JADX
946ea3a407b4815ac855ce4313b97bd42e8cab41
e1d228fc2ee550ac19eeac700254af8b0f96080a
refs/heads/master
2023-01-09T08:37:22.062350
2020-11-11T09:52:40
2020-11-11T09:52:40
311,927,971
0
0
null
null
null
null
UTF-8
Java
false
false
6,839
java
package com.fasterxml.jackson.databind.introspect; import com.fasterxml.jackson.databind.AnnotationIntrospector; import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.SerializationConfig; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.introspect.ClassIntrospector; import com.fasterxml.jackson.databind.type.SimpleType; import java.io.Serializable; public class BasicClassIntrospector extends ClassIntrospector implements Serializable { protected static final BasicBeanDescription BOOLEAN_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(Boolean.TYPE), AnnotatedClass.constructWithoutSuperTypes(Boolean.TYPE, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null)); protected static final BasicBeanDescription INT_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(Integer.TYPE), AnnotatedClass.constructWithoutSuperTypes(Integer.TYPE, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null)); protected static final BasicBeanDescription LONG_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(Long.TYPE), AnnotatedClass.constructWithoutSuperTypes(Long.TYPE, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null)); protected static final BasicBeanDescription STRING_DESC = BasicBeanDescription.forOtherUse((MapperConfig<?>) null, SimpleType.constructUnsafe(String.class), AnnotatedClass.constructWithoutSuperTypes(String.class, (AnnotationIntrospector) null, (ClassIntrospector.MixInResolver) null)); public static final BasicClassIntrospector instance = new BasicClassIntrospector(); private static final long serialVersionUID = 1; public BasicBeanDescription forSerialization(SerializationConfig serializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) { BasicBeanDescription _findCachedDesc = _findCachedDesc(javaType); if (_findCachedDesc == null) { return BasicBeanDescription.forSerialization(collectProperties(serializationConfig, javaType, mixInResolver, true, "set")); } return _findCachedDesc; } public BasicBeanDescription forDeserialization(DeserializationConfig deserializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) { BasicBeanDescription _findCachedDesc = _findCachedDesc(javaType); if (_findCachedDesc == null) { return BasicBeanDescription.forDeserialization(collectProperties(deserializationConfig, javaType, mixInResolver, false, "set")); } return _findCachedDesc; } public BasicBeanDescription forDeserializationWithBuilder(DeserializationConfig deserializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) { return BasicBeanDescription.forDeserialization(collectPropertiesWithBuilder(deserializationConfig, javaType, mixInResolver, false)); } public BasicBeanDescription forCreation(DeserializationConfig deserializationConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) { BasicBeanDescription _findCachedDesc = _findCachedDesc(javaType); if (_findCachedDesc == null) { return BasicBeanDescription.forDeserialization(collectProperties(deserializationConfig, javaType, mixInResolver, false, "set")); } return _findCachedDesc; } public BasicBeanDescription forClassAnnotations(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) { return BasicBeanDescription.forOtherUse(mapperConfig, javaType, AnnotatedClass.construct(javaType.getRawClass(), mapperConfig.isAnnotationProcessingEnabled() ? mapperConfig.getAnnotationIntrospector() : null, mixInResolver)); } public BasicBeanDescription forDirectClassAnnotations(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver) { boolean isAnnotationProcessingEnabled = mapperConfig.isAnnotationProcessingEnabled(); AnnotationIntrospector annotationIntrospector = mapperConfig.getAnnotationIntrospector(); Class<?> rawClass = javaType.getRawClass(); if (!isAnnotationProcessingEnabled) { annotationIntrospector = null; } return BasicBeanDescription.forOtherUse(mapperConfig, javaType, AnnotatedClass.constructWithoutSuperTypes(rawClass, annotationIntrospector, mixInResolver)); } /* access modifiers changed from: protected */ public POJOPropertiesCollector collectProperties(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver, boolean z, String str) { return constructPropertyCollector(mapperConfig, AnnotatedClass.construct(javaType.getRawClass(), mapperConfig.isAnnotationProcessingEnabled() ? mapperConfig.getAnnotationIntrospector() : null, mixInResolver), javaType, z, str).collect(); } /* access modifiers changed from: protected */ public POJOPropertiesCollector collectPropertiesWithBuilder(MapperConfig<?> mapperConfig, JavaType javaType, ClassIntrospector.MixInResolver mixInResolver, boolean z) { JsonPOJOBuilder.Value value = null; AnnotationIntrospector annotationIntrospector = mapperConfig.isAnnotationProcessingEnabled() ? mapperConfig.getAnnotationIntrospector() : null; AnnotatedClass construct = AnnotatedClass.construct(javaType.getRawClass(), annotationIntrospector, mixInResolver); if (annotationIntrospector != null) { value = annotationIntrospector.findPOJOBuilderConfig(construct); } return constructPropertyCollector(mapperConfig, construct, javaType, z, value == null ? "with" : value.withPrefix).collect(); } /* access modifiers changed from: protected */ public POJOPropertiesCollector constructPropertyCollector(MapperConfig<?> mapperConfig, AnnotatedClass annotatedClass, JavaType javaType, boolean z, String str) { return new POJOPropertiesCollector(mapperConfig, z, javaType, annotatedClass, str); } /* access modifiers changed from: protected */ public BasicBeanDescription _findCachedDesc(JavaType javaType) { Class<?> rawClass = javaType.getRawClass(); if (rawClass == String.class) { return STRING_DESC; } if (rawClass == Boolean.TYPE) { return BOOLEAN_DESC; } if (rawClass == Integer.TYPE) { return INT_DESC; } if (rawClass == Long.TYPE) { return LONG_DESC; } return null; } }
187b2b30667bfb278acc18c1e3912a743e2e5a35
c086540f9732ddd5ad05bbc2042141482a862eda
/gulimall-user-service/src/main/java/com/ztk/gulimall/user/GulimallUserServiceApplication.java
af6d91bf732a2251080394dbc5d8037a4a672895
[]
no_license
ztkyaojiayou/gulimail1209
ee89c01f874fe49ff88343d93234b26fa44397f0
3bd3a75252deb42933d0ed8503a65e4814667c92
refs/heads/master
2022-10-07T14:43:25.414610
2022-03-02T04:48:58
2022-03-02T04:48:58
226,866,371
0
0
null
2022-09-01T23:49:33
2019-12-09T12:30:08
Java
UTF-8
Java
false
false
460
java
package com.ztk.gulimall.user; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @MapperScan(basePackages = "com.ztk.gulimall.user.mapper") public class GulimallUserServiceApplication { public static void main(String[] args) { SpringApplication.run(GulimallUserServiceApplication.class, args); } }
153af6d4441fe84bbafb61faaa28d8104a0ba6f0
2e9b871872bfd0af6dc60e552c0169334459334f
/src/Entrada_ejemplo2.java
7a32e88ea9390be14c63f40fbd7daeb1292a05f3
[]
no_license
ftrabucco/java-primeros-pasos
b72540e1da42b0062386982aa572176f32835b50
7b7e5f852a9cdbc3cf343c9580ef1d005ff3b32b
refs/heads/master
2023-08-13T04:53:42.291476
2021-09-28T20:28:12
2021-09-28T20:28:12
385,384,058
0
0
null
null
null
null
ISO-8859-1
Java
false
false
507
java
import javax.swing.JOptionPane; public class Entrada_ejemplo2 { public static void main(String[] args) { // TODO Auto-generated method stub String nombre_usuario = JOptionPane.showInputDialog("Introduce tu nombre, por favor"); String edad = JOptionPane.showInputDialog("Introduce la edad, por favor"); int edad_usuario=Integer.parseInt(edad); edad_usuario++; System.out.println("Hola "+ nombre_usuario + ". El año que viene tendrás " + edad_usuario + " años"); } }
6b9b74e929c682722053f526f74efd95deadfe83
337b4678b39f92f75b4e87e20bbebec969788bef
/app/src/main/java/com/example/javanotebook/MainActivity.java
9e9468f984369376fdae9f37fd9b3781e0195c0e
[]
no_license
dev2033/Java_notebook
61188a395113c27ecf669317d705b59dbce0242b
16a291a0bc13452be0db0c1dde20b3a296d0a45f
refs/heads/master
2023-03-08T01:40:35.562585
2021-02-23T14:43:03
2021-02-23T14:43:03
340,898,250
0
0
null
null
null
null
UTF-8
Java
false
false
4,312
java
package com.example.javanotebook; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.SearchView; import android.widget.TextView; import com.example.javanotebook.adapter.MainAdapter; import com.example.javanotebook.db.MyDbManager; public class MainActivity extends AppCompatActivity { private MyDbManager myDbManager; private EditText edTitle, edDesc; private RecyclerView rcView; private MainAdapter mainAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } @Override public boolean onCreateOptionsMenu(Menu menu) { /*Редактироване меню, добален поиск по элементам списка*/ getMenuInflater().inflate(R.menu.main_menu, menu); MenuItem item = menu.findItem(R.id.id_search); SearchView sv = (SearchView) item.getActionView(); // setOnQueryTextListener - слушатель нажатий sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() { // данная функция делает поиск только по нажатию на клавишу поиск на клавиатуре @Override public boolean onQueryTextSubmit(String s) { return false; } // данная функция делает поиск сразу по введенным данным в строку поиска @Override public boolean onQueryTextChange(String newText) { mainAdapter.updateAdapter(myDbManager.getFromDb(newText)); return false; } }); return super.onCreateOptionsMenu(menu); } private void init() { /*Инициализирует компоненты*/ myDbManager = new MyDbManager(this); edTitle = findViewById(R.id.edTitle); edDesc = findViewById(R.id.edDesc); rcView = findViewById(R.id.rcView); mainAdapter = new MainAdapter(this); rcView.setLayoutManager(new LinearLayoutManager(this)); getItemTouchHelper().attachToRecyclerView(rcView); rcView.setAdapter(mainAdapter); } @Override protected void onResume() { super.onResume(); myDbManager.openDb(); // запрос идет по всем словам, а функции onQueryTextChange(), по буквам mainAdapter.updateAdapter(myDbManager.getFromDb("")); } public void onClickAdd(View view) { Intent intent = new Intent(MainActivity.this, EditActivity.class); startActivity(intent); } @Override protected void onDestroy() { super.onDestroy(); myDbManager.closeDb(); } private ItemTouchHelper getItemTouchHelper() { /* * Свайп по элементу (RecyclerView) списка с записями (ЛЕВО и ПРАВО) * */ return new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { @Override public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) { /* * Удаление элементов по свайпу * */ // передаем сюда функцию адаптера и сам менеджер // через viewHolder мы передается id элемента mainAdapter.removeItem(viewHolder.getAdapterPosition(), myDbManager); } }); } }
55795c83dde7a2155f6fa736b2a0fddd6071c798
2a80b4010ce81967b7e491575feb172f28026da6
/src/main/java/org/lineageos/eleven/ui/activities/SlidingPanelActivity.java
c68197459ccec2503bd1c14a4db4f769d6661f84
[ "Apache-2.0" ]
permissive
Forsakenrox/Eleven
c71d19456c0e47390d97a428a0241a8c89ac5448
caaa205054e9e510856244d80eb4f4bbf9b36a4c
refs/heads/master
2020-04-13T03:12:46.332070
2019-01-08T19:46:12
2019-01-08T19:46:12
162,925,078
0
0
null
null
null
null
UTF-8
Java
false
false
10,684
java
/* * Copyright (C) 2012 Andrew Neal * Copyright (C) 2014 The CyanogenMod Project * Licensed under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law * or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package org.lineageos.eleven.ui.activities; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.view.View; import android.widget.LinearLayout; import org.lineageos.eleven.R; import org.lineageos.eleven.slidinguppanel.SlidingUpPanelLayout; import org.lineageos.eleven.slidinguppanel.SlidingUpPanelLayout.SimplePanelSlideListener; import org.lineageos.eleven.ui.HeaderBar; import org.lineageos.eleven.ui.fragments.AudioPlayerFragment; import org.lineageos.eleven.ui.fragments.QueueFragment; import org.lineageos.eleven.utils.ElevenUtils; import org.lineageos.eleven.utils.MusicUtils; import org.lineageos.eleven.widgets.BlurScrimImage; /** * This class is used to display the {@link ViewPager} used to swipe between the * main {@link Fragment}s used to browse the user's music. * * @author Andrew Neal ([email protected]) */ public abstract class SlidingPanelActivity extends BaseActivity { public enum Panel { Browse, MusicPlayer, Queue, None, } private static final String STATE_KEY_CURRENT_PANEL = "CurrentPanel"; private SlidingUpPanelLayout mFirstPanel; private SlidingUpPanelLayout mSecondPanel; protected Panel mTargetNavigatePanel; private final ShowPanelClickListener mShowBrowse = new ShowPanelClickListener(Panel.Browse); private final ShowPanelClickListener mShowMusicPlayer = new ShowPanelClickListener(Panel.MusicPlayer); // this is the blurred image that goes behind the now playing and queue fragments private BlurScrimImage mBlurScrimImage; /** * Opens the now playing screen */ private final View.OnClickListener mOpenNowPlaying = new View.OnClickListener() { /** * {@inheritDoc} */ @Override public void onClick(final View v) { if (MusicUtils.getCurrentAudioId() != -1) { openAudioPlayer(); } else { MusicUtils.shuffleAll(SlidingPanelActivity.this); } } }; @Override protected void initBottomActionBar() { super.initBottomActionBar(); // Bottom action bar final LinearLayout bottomActionBar = (LinearLayout)findViewById(R.id.bottom_action_bar); // Display the now playing screen or shuffle if this isn't anything // playing bottomActionBar.setOnClickListener(mOpenNowPlaying); } /** * {@inheritDoc} */ @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTargetNavigatePanel = Panel.None; setupFirstPanel(); setupSecondPanel(); // get the blur scrim image mBlurScrimImage = (BlurScrimImage)findViewById(R.id.blurScrimImage); if (savedInstanceState != null) { int panelIndex = savedInstanceState.getInt(STATE_KEY_CURRENT_PANEL, Panel.Browse.ordinal()); Panel targetPanel = Panel.values()[panelIndex]; showPanel(targetPanel); mTargetNavigatePanel = Panel.None; if (targetPanel == Panel.Queue) { mFirstPanel.setSlidingEnabled(false); } } } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(STATE_KEY_CURRENT_PANEL, getCurrentPanel().ordinal()); } private void setupFirstPanel() { mFirstPanel = (SlidingUpPanelLayout)findViewById(R.id.sliding_layout); mFirstPanel.setPanelSlideListener(new SimplePanelSlideListener() { @Override public void onPanelSlide(View panel, float slideOffset) { onSlide(slideOffset); } @Override public void onPanelExpanded(View panel) { checkTargetNavigation(); } @Override public void onPanelCollapsed(View panel) { checkTargetNavigation(); } }); } private void setupSecondPanel() { mSecondPanel = (SlidingUpPanelLayout)findViewById(R.id.sliding_layout2); mSecondPanel.setPanelSlideListener(new SimplePanelSlideListener() { @Override public void onPanelSlide(View panel, float slideOffset) { // if we are not going to a specific panel, then disable sliding to prevent // the two sliding panels from fighting for touch input if (mTargetNavigatePanel == Panel.None) { mFirstPanel.setSlidingEnabled(false); } onSlide(slideOffset); } @Override public void onPanelExpanded(View panel) { checkTargetNavigation(); } @Override public void onPanelCollapsed(View panel) { // re-enable sliding when the second panel is collapsed mFirstPanel.setSlidingEnabled(true); checkTargetNavigation(); } }); // setup the header bar setupHeaderBar(R.id.secondHeaderBar, R.string.page_play_queue, mShowMusicPlayer); // set the drag view offset to allow the panel to go past the top of the viewport // since the previous view's is hiding the slide offset, we need to subtract that // from action bat height int slideOffset = getResources().getDimensionPixelOffset(R.dimen.sliding_panel_indicator_height); slideOffset -= ElevenUtils.getActionBarHeight(this); mSecondPanel.setSlidePanelOffset(slideOffset); } @Override protected void onPause() { super.onPause(); } /** * {@inheritDoc} */ @Override public int setContentView() { return R.layout.activity_base; } @Override public void onBackPressed() { Panel panel = getCurrentPanel(); switch (panel) { case Browse: super.onBackPressed(); break; default: case MusicPlayer: showPanel(Panel.Browse); break; case Queue: showPanel(Panel.MusicPlayer); break; } } public void openAudioPlayer() { showPanel(Panel.MusicPlayer); } public void showPanel(Panel panel) { // if we are already at our target panel, then don't do anything if (panel == getCurrentPanel()) { return; } // TODO: Add ability to do this instantaneously as opposed to animate switch (panel) { case Browse: // if we are two panels over, we need special logic to jump twice mTargetNavigatePanel = panel; mSecondPanel.collapsePanel(); // re-enable sliding on first panel so we can collapse it mFirstPanel.setSlidingEnabled(true); mFirstPanel.collapsePanel(); break; case MusicPlayer: mSecondPanel.collapsePanel(); mFirstPanel.expandPanel(); break; case Queue: // if we are two panels over, we need special logic to jump twice mTargetNavigatePanel = panel; mSecondPanel.expandPanel(); mFirstPanel.expandPanel(); break; case None: break; default: break; } } protected void onSlide(float slideOffset) { } /** * This checks if we are at our target panel and resets our flag if we are there */ protected void checkTargetNavigation() { if (mTargetNavigatePanel == getCurrentPanel()) { mTargetNavigatePanel = Panel.None; } getAudioPlayerFragment().setVisualizerVisible(getCurrentPanel() == Panel.MusicPlayer); } public Panel getCurrentPanel() { if (mSecondPanel.isPanelExpanded()) { return Panel.Queue; } else if (mFirstPanel.isPanelExpanded()) { return Panel.MusicPlayer; } else { return Panel.Browse; } } public void clearMetaInfo() { super.clearMetaInfo(); mBlurScrimImage.transitionToDefaultState(); } @Override public void onMetaChanged() { super.onMetaChanged(); // load the blurred image mBlurScrimImage.loadBlurImage(ElevenUtils.getImageFetcher(this)); } @Override public void onCacheUnpaused() { super.onCacheUnpaused(); // load the blurred image mBlurScrimImage.loadBlurImage(ElevenUtils.getImageFetcher(this)); } protected AudioPlayerFragment getAudioPlayerFragment() { return (AudioPlayerFragment)getSupportFragmentManager().findFragmentById(R.id.audioPlayerFragment); } protected QueueFragment getQueueFragment() { return (QueueFragment)getSupportFragmentManager().findFragmentById(R.id.queueFragment); } protected HeaderBar setupHeaderBar(final int containerId, final int textId, final View.OnClickListener headerClickListener) { final HeaderBar headerBar = (HeaderBar) findViewById(containerId); headerBar.setFragment(getQueueFragment()); headerBar.setTitleText(textId); headerBar.setBackgroundColor(Color.TRANSPARENT); headerBar.setBackListener(mShowBrowse); headerBar.setHeaderClickListener(headerClickListener); return headerBar; } private class ShowPanelClickListener implements View.OnClickListener { private Panel mTargetPanel; public ShowPanelClickListener(Panel targetPanel) { mTargetPanel = targetPanel; } @Override public void onClick(View v) { showPanel(mTargetPanel); } } }
c4e56be4ee2171eea0ab228d8e7b8b18a665de8b
f55e0f08bbbbde3bbf06b83c822a93d54819b1e8
/app/src/main/java/com/jqsoft/nursing/bean/grassroots_civil_administration/LngLatCount.java
04b528b7c6a3a70691162315e480470f92edbd87
[]
no_license
moshangqianye/nursing
27e58e30a51424502f1b636ae47b60b81a3b2ca0
20cd5aace59555ef9d708df0fb03639b2fc843d0
refs/heads/master
2020-09-08T13:39:55.939252
2020-03-20T09:55:34
2020-03-20T09:55:34
221,147,807
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package com.jqsoft.nursing.bean.grassroots_civil_administration; /** * Created by Administrator on 2018-02-02. */ public class LngLatCount { private String count;//该地图点的困难群众数量 private String lng;//经度 private String lat;//纬度 public LngLatCount() { super(); } public LngLatCount(String count, String lng, String lat) { this.count = count; this.lng = lng; this.lat = lat; } public String getCount() { return count; } public void setCount(String count) { this.count = count; } public String getLng() { return lng; } public void setLng(String lng) { this.lng = lng; } public String getLat() { return lat; } public void setLat(String lat) { this.lat = lat; } }
[ "123456" ]
123456
06946c8e4a2fb17ea583577366e0e78e0ece32f5
99500a71b03db3596b5b85afa201fdaf93eea9d5
/src/org/alansaudiotagger/tag/id3/framebody/FrameBodyTIPL.java
c4d479c1f42a48176b995df42986ec7552254609
[]
no_license
aljordan/JPlaylistEditor
fba172f3954cd9ee29d9329e4d0075dd42f5f121
68f82e630ce36155010f7ad31e91c9493929f611
refs/heads/master
2021-01-20T10:42:44.857483
2014-12-07T19:51:16
2014-12-07T19:51:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,387
java
/** * @author : Paul Taylor * @author : Eric Farng * * Version @version:$Id: FrameBodyTIPL.java,v 1.12 2008/07/21 10:45:44 paultaylor Exp $ * * MusicTag Copyright (C)2003,2004 * * 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, * you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Description: * People List * */ package org.alansaudiotagger.tag.id3.framebody; import org.alansaudiotagger.tag.InvalidTagException; import org.alansaudiotagger.tag.datatype.DataTypes; import org.alansaudiotagger.tag.datatype.PairedTextEncodedStringNullTerminated; import org.alansaudiotagger.tag.id3.ID3v24Frames; import java.nio.ByteBuffer; /** * The 'Involved people list' is intended as a mapping between functions like producer and names. Every odd field is a * function and every even is an name or a comma delimited list of names. * <p/> * TODO currently just reads the first String when directly from file, this will be fixed when we add support for * multiple Strings for all ID3v24Frames * <p/> * TODO currently just reads all the values when converted from the corresponding ID3v23 Frame IPLS as a single value * (the individual fields from the IPLS frame will be seperated by commas) */ public class FrameBodyTIPL extends AbstractFrameBodyTextInfo implements ID3v24FrameBody { /** * Creates a new FrameBodyTIPL datatype. */ public FrameBodyTIPL() { } public FrameBodyTIPL(FrameBodyTIPL body) { super(body); } /** * Convert from V3 to V4 Frame */ public FrameBodyTIPL(FrameBodyIPLS body) { setObjectValue(DataTypes.OBJ_TEXT_ENCODING, body.getTextEncoding()); PairedTextEncodedStringNullTerminated.ValuePairs value = (PairedTextEncodedStringNullTerminated.ValuePairs) body.getObjectValue(DataTypes.OBJ_TEXT); setObjectValue(DataTypes.OBJ_TEXT, value.toString()); } /** * Creates a new FrameBodyTIPL datatype. * * @param textEncoding * @param text */ public FrameBodyTIPL(byte textEncoding, String text) { super(textEncoding, text); } /** * Creates a new FrameBodyTIPL datatype. * * @throws InvalidTagException */ public FrameBodyTIPL(ByteBuffer byteBuffer, int frameSize) throws InvalidTagException { super(byteBuffer, frameSize); } /** * The ID3v2 frame identifier * * @return the ID3v2 frame identifier for this frame type */ public String getIdentifier() { return ID3v24Frames.FRAME_ID_INVOLVED_PEOPLE; } }
db018f890bf758e1c4206bb6de81fdfc557aea46
2744bc9ca30a0708d175e097b29e9f2ca0695300
/src/java/api/ApplicationConfig.java
042afaa34d08fdd9d2b5977ad4ea609250060931
[]
no_license
ruvazi/CA2
27e8bcd66650b6cb09824bcee256a662cd622958
143ef3fb5d56b4ad6edc93551ed8c70196ab6b5c
refs/heads/master
2021-01-10T04:34:02.933328
2015-10-07T10:37:07
2015-10-07T10:37:07
43,738,064
0
0
null
null
null
null
UTF-8
Java
false
false
1,038
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 api; import java.util.Set; import javax.ws.rs.core.Application; /** * * @author Emil */ @javax.ws.rs.ApplicationPath("webresources") public class ApplicationConfig extends Application { @Override public Set<Class<?>> getClasses() { Set<Class<?>> resources = new java.util.HashSet<>(); addRestResourceClasses(resources); return resources; } /** * Do not modify addRestResourceClasses() method. * It is automatically populated with * all resources defined in the project. * If required, comment out calling this method in getClasses(). */ private void addRestResourceClasses(Set<Class<?>> resources) { resources.add(api.PersonResource.class); resources.add(exceptions.InternalServerExceptionMapper.class); } }
b9a6b50b5db60bd0d964349a08f99107665bdf7d
4bbde3ca8a5af5af7916f8008efd1ee8b9e1341c
/src/main/java/com/hajder/travelagency/bean/LocaleBean.java
e8e1a25eef055eb6a2335a85dbb0808c4c68ee49
[]
no_license
phajder/TravelAgency
304831e546ac6e7752edb1c786b37f5e0fcb33cb
4cad45dcd06f07ca78914d88c7e5f4218c49097b
refs/heads/master
2021-06-11T07:55:08.736540
2017-01-17T02:27:00
2017-01-17T02:27:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,165
java
package com.hajder.travelagency.bean; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import java.util.LinkedHashMap; import java.util.Locale; import java.util.Map; /** * Created by Piotr on 20.12.2016. * @author Piotr Hajder */ @ManagedBean @SessionScoped public class LocaleBean { private static Map<String, Object> locales; private Locale locale; static { locales = new LinkedHashMap<>(); locales.put("Polski", new Locale("pl")); locales.put("English", Locale.ENGLISH); } @PostConstruct public void init() { locale = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale(); } public Map<String, Object> getLocalesInMap() { return locales; } public Locale getLocale() { return locale; } public String getLanguage() { return locale.getLanguage(); } public void setLanguage(String language) { locale = new Locale(language); FacesContext.getCurrentInstance().getViewRoot().setLocale(locale); } }
1f3046e5a659c50a8dee44ec5802b097987f9732
a158b0fe3aa5017af38608aacea9db6dcf07c0de
/Algorithm/src/atin84/dovelet/stairs3/ArithSeq.java
47b77420be307cea190c09e02239c75880609ddf
[]
no_license
atin84/starsign
3e3133e1f708774d2c070ce79f647e5a27b083de
3213a115876a364e78762db34b04adbb46ffdf1b
refs/heads/master
2016-08-07T02:01:21.340582
2014-09-17T04:48:27
2014-09-17T04:48:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
548
java
package atin84.dovelet.stairs3; import java.util.Scanner; /** * arith_seq * http://183.106.113.109/30stair/arith_seq/arith_seq.php?pname=arith_seq * @author atin84 * */ public class ArithSeq { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k1 = sc.nextInt(); int k2 = sc.nextInt(); int k3 = sc.nextInt(); if((k3 - k1)% k2 != 0) { System.out.println("X"); } else { int result = 1; result += (k3 - k1) / k2; System.out.println(result); } } }
2545bc493265308f782cfb8058bfe0bd7dc21f4c
c1ba21bf10eb6a56601ea132663096867c14a6eb
/services/ecommerceadmin/src/main/java/com/technokryon/ecommerce/admin/pojo/User.java
84861c958aa6bb5fb765d745b6ca9d7b921bc692
[]
no_license
alwintechnokryon/D-Commerce
fa302d82087938f3f3c0b98da8d106af942270a5
6fe445e287ba6488453b3dd56521f4554af24ebd
refs/heads/master
2020-09-16T20:02:53.038025
2020-03-10T13:24:00
2020-03-10T13:24:00
223,875,024
1
1
null
null
null
null
UTF-8
Java
false
false
522
java
package com.technokryon.ecommerce.admin.pojo; import java.math.BigInteger; import java.time.OffsetDateTime; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor public class User { String uId; String uName; String uRegType; String uMail; int uOtp; OffsetDateTime uOtpExp; String uHashKey; String uPassword; OffsetDateTime uCreatedDate; BigInteger uPhone; Integer uPhoneCode; String uOtpStatus; String uStatus; OffsetDateTime uModifideDate; String oldPassword; String apiKey; }
8a86119dcbdcdb530542720324c4c2dc4296d2c8
48407c6f112031e6b67401679fdadf4dd3200581
/app/src/main/java/com/glodon/bim/business/qualityManage/model/ModelModel.java
f714d3f2aae742b763516d648f4230868f0564a0
[]
no_license
heartsoul/estate-android
33a346738c3a9fbe9490a027818f499ea262c050
bb6a84551f7ac5c6593cbee570e6ad50bca11ce8
refs/heads/master
2020-03-12T00:04:56.522325
2018-04-16T07:49:10
2018-04-16T07:49:10
130,340,484
0
0
null
null
null
null
UTF-8
Java
false
false
2,830
java
package com.glodon.bim.business.qualityManage.model; import android.text.TextUtils; import com.glodon.bim.basic.log.LogUtil; import com.glodon.bim.basic.network.NetRequest; import com.glodon.bim.business.greendao.provider.DaoProvider; import com.glodon.bim.business.qualityManage.bean.ModelListBean; import com.glodon.bim.business.qualityManage.bean.ModelSingleListItem; import com.glodon.bim.business.qualityManage.bean.ModelSpecialListItem; import com.glodon.bim.business.qualityManage.bean.ProjectVersionBean; import com.glodon.bim.business.qualityManage.contract.ModelContract; import java.util.List; import rx.Observable; /** * 描述:选择模型 * 作者:zhourf on 2017/11/22 * 邮箱:[email protected] */ public class ModelModel implements ModelContract.Model { public String cookie; public ModelModel() { cookie = new DaoProvider().getCookie(); } /** * 查询单体列表 * * @param id 项目id */ @Override public Observable<List<ModelSingleListItem>> getSingleList(long id) { return NetRequest.getInstance().getCall( ModelApi.class).getSingleList(id, cookie); } /** * 查询专业列表 */ @Override public Observable<List<ModelSpecialListItem>> getSpecialList() { return NetRequest.getInstance().getCall( ModelApi.class).getSpecialList(false,cookie); } /** * 获取当前已发布的最新版本 */ @Override public Observable<ProjectVersionBean> getLatestVersion(long projectId) { return NetRequest.getInstance().getCall( ModelApi.class).getLatestVersion(projectId, cookie); } /** * 根据专业和单体查询模型列表 * * @param projectId 项目id * @param projectVersionId 最新版本 * @param buildingId 单体 * @param specialtyCode 专业 */ @Override public Observable<ModelListBean> getModelList(long projectId, String projectVersionId, long buildingId, String specialtyCode) { LogUtil.e("projectId="+projectId); LogUtil.e("projectVersionId="+projectVersionId); LogUtil.e("buildingId="+buildingId); LogUtil.e("specialtyCode="+specialtyCode); if (buildingId != 0 && !TextUtils.isEmpty(specialtyCode)) { return NetRequest.getInstance().getCall(ModelApi.class).getModelList(projectId, projectVersionId, buildingId, specialtyCode, cookie); } else if (buildingId != 0) { return NetRequest.getInstance().getCall( ModelApi.class).getModelList(projectId, projectVersionId, buildingId, cookie); } else if (!TextUtils.isEmpty(specialtyCode)) { return NetRequest.getInstance().getCall( ModelApi.class).getModelList(projectId, projectVersionId, specialtyCode, cookie); } return null; } }
b75f392ed821cef06fd18dbd9e03f893c699c0fb
da7d094ccdb2c0ece1e2e258d82942535bb69641
/app/src/main/java/com/example/cookbook/FoodModel.java
be3bb1ff8dc8fb117617b95d5ca79a15b3d238d0
[]
no_license
raksha-s/cookbook
e2fef5b4b1f3e42b4e94965a85c9ddae99a6a1de
b6c4f879800428a8140c8ebf9587bcf991eefd9d
refs/heads/main
2023-05-29T03:00:58.588642
2021-06-09T16:39:18
2021-06-09T16:39:18
374,894,809
0
0
null
null
null
null
UTF-8
Java
false
false
1,383
java
package com.example.cookbook; public class FoodModel { private Integer id; private String dish_name, dish_desc, image; public FoodModel(String dish_name, String dish_desc, String image) { this.dish_name = dish_name; this.dish_desc = dish_desc; this.image = image; } public FoodModel(Integer id, String dish_name, String dish_desc, String image) { this.id = id; this.dish_name = dish_name; this.dish_desc = dish_desc; this.image = image; } @Override public String toString() { return "FoodModel{" + "id=" + id + ", dish_name='" + dish_name + '\'' + ", dish_desc='" + dish_desc + '\'' + ", image='" + image + '\'' + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getDish_name() { return dish_name; } public void setDish_name(String dish_name) { this.dish_name = dish_name; } public String getDish_desc() { return dish_desc; } public void setDish_desc(String dish_desc) { this.dish_desc = dish_desc; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } }
408c0f909cecea1108bfd0587c3fe3832644bea6
8ea65bae451eb88c4b5f1b30972d9a239d463d55
/baselib/src/main/java/com/cat/zeus/utils/CrashHandler.java
19d6f0034ebad90d956cdb23af221abae628b3f7
[]
no_license
toberole/android_base_demo
7158bf485a64c86c391dff7ca2a9657ca65d5a61
6f7847af9c23b3f04e5c7df67311ce3859ddfb2f
refs/heads/master
2022-10-31T14:41:14.720225
2020-06-14T13:05:32
2020-06-14T13:05:32
257,482,210
0
0
null
null
null
null
UTF-8
Java
false
false
6,367
java
package com.cat.zeus.utils; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Build; import java.io.BufferedWriter; import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class CrashHandler implements Thread.UncaughtExceptionHandler { private Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); private ThreadPoolExecutor executor; private Context context; private CrashListener listener; private File logFileDir; public void init(Context context, File logFileDir, CrashListener listener) { this.context = context; this.logFileDir = logFileDir; this.listener = listener; this.executor = new ThreadPoolExecutor(3, 3, 30, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>()); this.executor.allowCoreThreadTimeOut(true); Thread.setDefaultUncaughtExceptionHandler(this); } @Override public void uncaughtException(final Thread thread, final Throwable ex) { executor.execute(new Runnable() { @Override public void run() { File logFile = new File(logFileDir, getFormatDate() + "_log.crash"); writeLog_(logFile, "CrashHandler", ex.getMessage(), ex); if (listener != null) { listener.onCrash(thread, ex, logFile.getAbsolutePath()); } else { defaultHandler.uncaughtException(thread, ex); } } }); } public void writeLog(File logFile, String tag, String message, Throwable ex) { FileWriter fileWriter = null; BufferedWriter bufdWriter = null; PrintWriter printWriter = null; try { fileWriter = new FileWriter(logFile, true); bufdWriter = new BufferedWriter(fileWriter); printWriter = new PrintWriter(fileWriter); bufdWriter.append(buildTitle(context)); bufdWriter.append(buildBody(context)); bufdWriter.append("\r\n" + getFormatDate()).append(" ").append("E").append('/').append(tag).append(" ") .append(message).append('\n'); bufdWriter.flush(); ex.printStackTrace(printWriter); printWriter.flush(); fileWriter.flush(); } catch (IOException e) { e.printStackTrace(); } finally { // IOUtil.closeQuietly(fileWriter, bufdWriter, printWriter); } } public void writeLog_(File logFile, String tag, String message, Throwable ex) { FileOutputStream fout = null; PrintStream printStream = null; try { fout = new FileOutputStream(logFile, true); fout.write(buildTitle(context).getBytes()); fout.flush(); fout.write(buildBody(context).getBytes()); fout.flush(); fout.write(("\r\n" + getFormatDate() + " " + "E" + '/' + tag + " " + message + '\n').getBytes()); fout.flush(); printStream = new PrintStream(fout); ex.printStackTrace(printStream); printStream.flush(); fout.flush(); } catch (IOException e) { e.printStackTrace(); } finally { // IOUtil.closeQuietly(fout, printStream); } } private String buildTitle(Context context) { return "Crash Log: " + context.getPackageManager().getApplicationLabel(context.getApplicationInfo()) + "\r\n"; } private String buildBody(Context context) { StringBuilder sb = new StringBuilder(); sb.append("APPLICATION INFORMATION").append('\n'); PackageManager pm = context.getPackageManager(); ApplicationInfo ai = context.getApplicationInfo(); sb.append("Application : ").append(pm.getApplicationLabel(ai)).append('\n'); try { PackageInfo pi = pm.getPackageInfo(ai.packageName, 0); sb.append("Version Code: ").append(pi.versionCode).append('\n'); sb.append("Version Name: ").append(pi.versionName).append('\n'); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } sb.append('\n').append("DEVICE INFORMATION").append('\n'); sb.append("Board: ").append(Build.BOARD).append('\n'); sb.append("BOOTLOADER: ").append(Build.BOOTLOADER).append('\n'); sb.append("BRAND: ").append(Build.BRAND).append('\n'); sb.append("CPU_ABI: ").append(Build.CPU_ABI).append('\n'); sb.append("CPU_ABI2: ").append(Build.CPU_ABI2).append('\n'); sb.append("DEVICE: ").append(Build.DEVICE).append('\n'); sb.append("DISPLAY: ").append(Build.DISPLAY).append('\n'); sb.append("FINGERPRINT: ").append(Build.FINGERPRINT).append('\n'); sb.append("HARDWARE: ").append(Build.HARDWARE).append('\n'); sb.append("HOST: ").append(Build.HOST).append('\n'); sb.append("ID: ").append(Build.ID).append('\n'); sb.append("MANUFACTURER: ").append(Build.MANUFACTURER).append('\n'); sb.append("PRODUCT: ").append(Build.PRODUCT).append('\n'); sb.append("TAGS: ").append(Build.TAGS).append('\n'); sb.append("TYPE: ").append(Build.TYPE).append('\n'); sb.append("USER: ").append(Build.USER).append("\r\n"); return sb.toString(); } private static String getFormatDate() { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); return simpleDateFormat.format(new Date()); } public static CrashHandler getInstance() { return CrashHandlerHolder.instance; } private static class CrashHandlerHolder { public static CrashHandler instance = new CrashHandler(); } public static interface CrashListener { void onCrash(Thread thread, Throwable ex, String savedLogFilePath); } }
fe1ed9200aa7d046090907d7774ffce354678e69
255cf6f012dd3e200b9e4e021cfb40b394e4f2f3
/src/main/java/com/trade_accounting/controllers/rest/SupplierAccountRestController.java
cdae7fcebf76c8f9bcb20fe3f8c875a8b0d68211
[]
no_license
ArtemZaikovsky/Back
28cbc4104e8f38d1a98175c7b06ecb2c009f8189
de512acb694d9bae6e5fa2e852e6b1881157516c
refs/heads/main
2023-07-17T11:46:43.612093
2021-08-20T13:53:09
2021-08-20T13:53:09
398,292,819
0
0
null
null
null
null
UTF-8
Java
false
false
9,069
java
package com.trade_accounting.controllers.rest; import com.trade_accounting.models.SupplierAccount; import com.trade_accounting.models.dto.SupplierAccountDto; import com.trade_accounting.services.interfaces.CheckEntityService; import com.trade_accounting.services.interfaces.SupplierAccountService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import net.kaczmarzyk.spring.data.jpa.domain.Equal; import net.kaczmarzyk.spring.data.jpa.domain.Like; import net.kaczmarzyk.spring.data.jpa.domain.LikeIgnoreCase; import net.kaczmarzyk.spring.data.jpa.web.annotation.And; import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec; import org.springframework.data.jpa.domain.Specification; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @Tag(name="SupplierAccount Rest Controller", description = "CRUD операции со счетами поставщиков") @Api(tags = "SupplierAccount Rest Controller") @RequestMapping("api/supplierAccount") public class SupplierAccountRestController { private final SupplierAccountService invoices; private final CheckEntityService checkEntityService; public SupplierAccountRestController(SupplierAccountService invoices, CheckEntityService checkEntityService) { this.invoices = invoices; this.checkEntityService = checkEntityService; } @GetMapping @ApiOperation(value = "getAll", notes = "Получение списка всех счетов поставщиков") @ApiResponses(value = { @ApiResponse(code = 200, message = "Успешное получение счетов поставщиков"), @ApiResponse(code = 404, message = "Данный контроллер не найден"), @ApiResponse(code = 403, message = "Операция запрещена"), @ApiResponse(code = 401, message = "Нет доступа к данной операции")} ) public ResponseEntity<List<SupplierAccountDto>> getAll() { List<SupplierAccountDto> getAll = invoices.getAll(); return ResponseEntity.ok(getAll); } @GetMapping("/search/{nameFilter}") @ApiOperation(value = "searchTerm", notes = "Получение списка некоторых счетов") @ApiResponses(value = { @ApiResponse(code = 200, message = "Успешное получение отф. списка контрагентов"), @ApiResponse(code = 404, message = "Данный контроллер не найден"), @ApiResponse(code = 403, message = "Операция запрещена"), @ApiResponse(code = 401, message = "Нет доступа к данной операции")} ) public ResponseEntity<List<SupplierAccountDto>> searchByNameFilter(@ApiParam(name ="nameFilter", value = "Переданный в URL searchTerm, по которому необходимо найти контрагента") @PathVariable(name = "nameFilter") String nameFilter) { List<SupplierAccountDto> listSupplier = invoices.searchByString(nameFilter); return ResponseEntity.ok(listSupplier); } @GetMapping("/{id}") @ApiOperation(value = "getById", notes = "Получение счета поставщика по id") @ApiResponses(value = { @ApiResponse(code = 200, message = "Счет поставщика найден"), @ApiResponse(code = 404, message = "Данный контроллер не найден"), @ApiResponse(code = 403, message = "Операция запрещена"), @ApiResponse(code = 401, message = "Нет доступа к данной операции")} ) public ResponseEntity<SupplierAccountDto> getById(@ApiParam(name = "id", type = "Long", value = "Переданный в URL id, по которому необходимо найти счет поставщика") @PathVariable(name = "id") Long id) { checkEntityService.checkExistsSupplierAccountById(id); return ResponseEntity.ok(invoices.getById(id)); } @PostMapping @ApiOperation(value = "create", notes = "Добавление нового счета поставщика") @ApiResponses(value = { @ApiResponse(code = 200, message = "Счет поставщика создан"), @ApiResponse(code = 201, message = "Запрос принят и счет поставщика добавлен"), @ApiResponse(code = 404, message = "Данный контроллер не найден"), @ApiResponse(code = 403, message = "Операция запрещена"), @ApiResponse(code = 401, message = "Нет доступа к данной операции")} ) public ResponseEntity<SupplierAccountDto> create(@ApiParam(name = "invoice", value = "DTO счета, который необходимо создать") @RequestBody SupplierAccountDto invoice) { return ResponseEntity.ok().body(invoices.create(invoice)); } @PutMapping @ApiOperation(value = "create", notes = "Изменение счета поставщика") @ApiResponses(value = { @ApiResponse(code = 200, message = "Информация о счете обновлена"), @ApiResponse(code = 201, message = "Запрос принят и счет поставщика обновлен"), @ApiResponse(code = 404, message = "Данный контроллер не найден"), @ApiResponse(code = 403, message = "Операция запрещена"), @ApiResponse(code = 401, message = "Нет доступа к данной операции")} ) public ResponseEntity<SupplierAccountDto> update(@ApiParam(name = "invoice", value = "DTO счета, который необходимо создать") @RequestBody SupplierAccountDto invoice) { return ResponseEntity.ok().body(invoices.update(invoice)); } @ApiOperation(value = "deleteById", notes = "Удаляет счет поставщика на основе переданного ID") @DeleteMapping("/{id}") @ApiResponses(value = { @ApiResponse(code = 200, message = "Счет поставщика успешно удален"), @ApiResponse(code = 204, message = "Запрос получен и обработан, данных для возврата нет"), @ApiResponse(code = 401, message = "Нет доступа к данной операции"), @ApiResponse(code = 403, message = "Операция запрещена"), @ApiResponse(code = 404, message = "Данный контроллер не найден") }) public ResponseEntity<SupplierAccountDto> deleteById(@ApiParam(name = "id", type = "Long", value = "Переданный в URL id по которому необходимо удалить счет поставщика") @PathVariable(name = "id") Long id) { invoices.deleteById(id); return ResponseEntity.ok().build(); } @GetMapping("/querySupplier") @ApiOperation(value = "searchByFilter", notes = "Получение списка счетов по заданным параметрам") public ResponseEntity<List<SupplierAccountDto>> getAllFilter( @And({ @Spec(path = "id", params = "id", spec = Equal.class), @Spec(path = "date", params = "date", spec = Equal.class), @Spec(path = "contractor.name", params = "contractorDto", spec = LikeIgnoreCase.class), @Spec(path = "company.name", params = "companyDto", spec = LikeIgnoreCase.class), @Spec(path = "warehouse.name", params = "warehouseDto", spec = LikeIgnoreCase.class), })Specification<SupplierAccount> supplier) { return ResponseEntity.ok(invoices.search(supplier)); } }
bc9abcc3ce7f9c80a2b43a1154ae11e5cef5f960
64db48c5830a6976de397e64017d44e817467d65
/app/src/main/java/com/example/lkbwei/freeOrder/DataBase/OrderTable.java
7c80425d4893b4410e805f211115e0c138f61c14
[]
no_license
lkbwei/FreeOrder
f4877ed4002306b109e6776994de21359a5fbd07
0ded88fafa6fcd14c78506d22cfad6516a5c9565
refs/heads/master
2021-01-19T04:58:38.427139
2017-04-07T13:49:32
2017-04-07T13:49:32
87,407,122
0
0
null
null
null
null
UTF-8
Java
false
false
1,964
java
package com.example.lkbwei.freeOrder.DataBase; import cn.bmob.v3.BmobObject; /** * Created by lkbwei on 2017/3/14. */ public class OrderTable extends BmobObject { private String Boss; private String Restaurant; private String Customer; private String FoodName; private Double Price; private String Comment; private String ImageUrl1; private String ImageUrl2; private String ImageUrl3; private Integer Status;//0表示未提交的订单,1表示以接单 public String getRestaurant() { return Restaurant; } public void setRestaurant(String restaurant) { Restaurant = restaurant; } public Integer getStatus() { return Status; } public void setStatus(Integer status) { Status = status; } public String getBoss() { return Boss; } public void setBoss(String boss) { Boss = boss; } public String getComment() { return Comment; } public void setComment(String comment) { Comment = comment; } public String getCustomer() { return Customer; } public void setCustomer(String customer) { Customer = customer; } public String getFoodName() { return FoodName; } public void setFoodName(String foodName) { FoodName = foodName; } public String getImageUrl1() { return ImageUrl1; } public void setImageUrl1(String imageUrl1) { ImageUrl1 = imageUrl1; } public String getImageUrl2() { return ImageUrl2; } public void setImageUrl2(String imageUrl2) { ImageUrl2 = imageUrl2; } public String getImageUrl3() { return ImageUrl3; } public void setImageUrl3(String imageUrl3) { ImageUrl3 = imageUrl3; } public Double getPrice() { return Price; } public void setPrice(Double price) { Price = price; } }
e0f5a42c51a39243f135df325867f53f78032065
df3a5821f78212082843954028f0b1043815e68a
/droolsPrototypeSources/src/test/java/de/bernhardunger/drools/RuleLogicalAndFireRuleImmediatlyAfterInsertTest.java
787214ac1f0beab36ccf4ddb839b38beb468c54e
[]
no_license
bernhardunger/DroolsRHQPrototype
c159a761151c2369ee3d78d5fd42c142d600bcc1
83db29f8ea463611358bddf8143caeb1c0f1ca4f
refs/heads/master
2021-01-10T19:55:23.900692
2012-12-16T10:50:48
2012-12-16T10:50:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,282
java
package de.bernhardunger.drools; import java.io.IOException; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.TimeUnit; import javax.management.MBeanServerConnection; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseConfiguration; import org.drools.KnowledgeBaseFactory; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderError; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.ResourceType; import org.drools.conf.EventProcessingOption; import org.drools.io.impl.ClassPathResource; import org.drools.logger.KnowledgeRuntimeLogger; import org.drools.runtime.KnowledgeSessionConfiguration; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.conf.ClockTypeOption; import org.drools.runtime.rule.FactHandle; import org.drools.time.SessionPseudoClock; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import de.bernhardunger.drools.model.EventComposite; import de.bernhardunger.drools.util.Statistic; import static de.bernhardunger.drools.util.EventFatory.*; /** * Rule mass test with many boolean and conjunction in the when clauses of the rules. * * @author Bernhard Unger * */ public class RuleLogicalAndFireRuleImmediatlyAfterInsertTest { Logger logger = LoggerFactory.getLogger(RuleLogicalAndFireRuleImmediatlyAfterInsertTest.class); private StatefulKnowledgeSession ksession; private KnowledgeRuntimeLogger knwlgLogger; private long startTime; private long endTime; private List<Statistic> statistics = new ArrayList<Statistic>(); int noOfEvents = 1000000; int totalEvents = 0; int eventId = 0; @Before public void prepare() throws IOException, InterruptedException { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("Jconsole -interval=1"); Thread.sleep(5000); } @Test public void start() { startTime = new Date().getTime(); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); // Load rules from file // Other rules might be added... kbuilder.add(new ClassPathResource("testRuleLogicalAnd200.drl", getClass()), ResourceType.DRL); if (kbuilder.hasErrors()) { if (kbuilder.getErrors().size() > 0) { for (KnowledgeBuilderError kerror : kbuilder.getErrors()) { System.err.println(kerror); } } } KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); // Drools Fusion needs STREAMING config.setOption(EventProcessingOption.STREAM); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); KnowledgeSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); // Control the clock for test instead of system time conf.setOption(ClockTypeOption.get("pseudo")); ksession = kbase.newStatefulKnowledgeSession(conf, null); // Logging is a performance issue, so disabling for exhaustive tests is // neccessary //knwlgLogger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "logs/myKnowledgeLogfile"); for (int i = 1; i <= noOfEvents; i++) { insertEvent("eventDetail", i); endTime = new Date().getTime(); saveStatisticEntry(i); ksession.fireAllRules(); if ( i % 100000 == 0 ) { System.out.println("Event: " + i); } } ksession.fireAllRules(); } /** * Will be executed when the last test has been finished */ @After public void release() { //knwlgLogger.close(); ksession.halt(); ksession.dispose(); printStatistics(); } /** * Insert the events facts into the knowledge session * */ private FactHandle insertEvent(String eventDetail, int stepId) { SessionPseudoClock clock = ksession.getSessionClock(); EventComposite event; long timestamp = clock.advanceTime(1, TimeUnit.MILLISECONDS); event = makeSimpleEvent(eventDetail+stepId, stepId, eventId, timestamp); FactHandle handle = ksession.insert(event); eventId++; totalEvents++; return handle; } /** * Save the statistic entry * * @param step */ private void saveStatisticEntry(int step) { long execTime = endTime - startTime; MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer(); OperatingSystemMXBean osMBean = null; try { osMBean = ManagementFactory.newPlatformMXBeanProxy(mbsc, ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, OperatingSystemMXBean.class); } catch (IOException e) { e.printStackTrace(); } double systemLoadAverage = osMBean.getSystemLoadAverage(); Statistic statistic = new Statistic(step, totalEvents, execTime, systemLoadAverage); statistics.add(statistic); } /** * Log statistics */ private void printStatistics() { logger.debug("Step;" + "Total Events;" + "Events/ms;" + "Execution Time;" + "Max CPU usage"); for (Statistic stat : statistics) { logger.debug(stat.getStep() + ";" + stat.getNoOfEvents() + ";" + (double) stat.getEventsPerSecond() + ";" + stat.getExecTime() + ";" + stat.getAverageCpuLoad()); } } }
f54d784edfb0085ed2024310b11a57ac5db0de91
3e5ef22fc983b7c0bb21a26a46c371879e37dbc0
/app/src/main/java/com/zspirytus/enjoymusic/receivers/MyHeadSetPlugOutReceiver.java
3ecb9eaad724857413f5700d5e619d9479bf1fa2
[ "MIT" ]
permissive
spirytusz/EnjoyMusic
a0f04f2dafffefb3d278c2722d9fc482c7a7a15a
ffa803b7a82cea29b14baad04e7314e0454484b7
refs/heads/master
2022-03-02T00:52:00.998755
2019-04-21T07:50:14
2019-04-21T07:50:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
758
java
package com.zspirytus.enjoymusic.receivers; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.media.AudioManager; import com.zspirytus.enjoymusic.engine.BackgroundMusicController; /** * 耳机拔出事件接收广播 * Created by ZSpirytus on 2018/8/11. */ public class MyHeadSetPlugOutReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(action)) { if (BackgroundMusicController.getInstance().isPlaying()) { BackgroundMusicController.getInstance().pause(); } } } }
5c57e3ebaab35a47d3fa73f4e1fc470f62d5a846
79f595dd6263834cf03781dd0d90adc9b86209d0
/JavaAssignment/src/ankitaS/Assignment2_Q6.java
0175ea47150444bb8500b686eec1161434b64400
[]
no_license
KrishnaKTechnocredits/JAVATechnoCreditsG3
c2eb4e07d6c31dd59c2ac2f83aac2f1cc7d9a951
7608c8f4e7ed9011c141a4fcbf03ea0af40a4fb2
refs/heads/master
2021-10-23T18:36:59.825664
2019-03-19T06:05:21
2019-03-19T06:05:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,039
java
//program to check equality of two array package ankitaS; public class Assignment2_Q6 { void CheckEqualityofArray(int array1[], int array2[]) { // method to check // equality of two // array boolean flag = true; if (array1.length == array2.length) { for (int array_index = 0; array_index < array1.length; array_index++) { if (array1[array_index] != array2[array_index]) { flag = false; } } if (flag == true) { System.out.println("Two array are equal"); } else { System.out.println("Two array are not equal"); } } else { System.out.println("Array length should be equal"); } } public static void main(String[] args) { // TODO Auto-generated method stub InputFromUser input = new InputFromUser(); Assignment2_Q6 assignment2_Q6 = new Assignment2_Q6(); System.out.println("Enter size and element of 2 array "); int array1[] = input.InputArray(); int array2[] = input.InputArray(); assignment2_Q6.CheckEqualityofArray(array1, array2); } }
29de393f36457b080342687f84f6443bc38149b9
a1d4927da81e352cf8a2c8d7c2cffc9afb22aec0
/src/main/java/service/LeaveRoleService.java
c22782f8531bc1bf2c3183c50e12cf0c0e92d6c5
[]
no_license
senthilgdr/lms-persistence
ed16ed3c6b935e002cbc166e104198eb5f892354
f68756c1d84a7d62ac807b0827859ec9c2849819
refs/heads/master
2021-01-12T01:02:24.859750
2017-02-25T13:28:42
2017-02-25T13:28:42
78,334,497
0
1
null
null
null
null
UTF-8
Java
false
false
340
java
package service; import java.util.List; import dao.LeaveRoleDAO; import model.LeaveRole; public class LeaveRoleService { private LeaveRoleDAO ldDao = new LeaveRoleDAO(); public List<LeaveRole> list() { return ldDao.list(); } public LeaveRole findByRoleId(long id) { return ldDao.findById(id); } }
e88fd02fe53fc41427bca2ca4a57fb68a581d7cd
e4795906751db63ef8534ae90ee6f0cb27822af9
/src/main/java/com/panasalbk/app/models/Address.java
9f59bb5bd6c08d29fd3bb2f6ffa84f1a2c513c93
[]
no_license
panasal/pana-sal-bk
6684f994df3297100c83dff1d4523d967608f90c
dc9990930fdc4f2e25d0a48d805acd504516ade5
refs/heads/master
2021-01-16T21:24:18.276198
2017-07-29T15:27:12
2017-07-29T15:27:12
98,783,666
0
0
null
null
null
null
UTF-8
Java
false
false
1,502
java
package com.panasalbk.app.models; /** * Latest edition date: 06/02/17 * Address Class * Dependency to Customer Class * @author AloniD * */ public class Address { /* * >> Attributes */ private String streetNumber; private String streetName; private String placeNumber; private String place; private String city; private String province; private String postalCode; /* * >> Properties */ public String getStreetNumber() { return streetNumber; } public void setStreetNumber(String streetNumber) { this.streetNumber = streetNumber; } public String getStreetName() { return streetName; } public void setStreetName(String streetName) { this.streetName = streetName; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } /* * >> Constructor */ public Address(String valStNum, String valStName, String valPlace, String valCity, String valProv, String valPC) { setStreetNumber(valStNum); setStreetName(valStName); setPlace(valPlace); setCity(valCity); setProvince(valProv); setPostalCode(valPC); } }
bb19cbfc96c44a88d3fbd2af37428cb2e85c75e2
f42d7da85f9633cfb84371ae67f6d3469f80fdcb
/com4j-20120426-2/visio/visiotool/VisGraphicItemTypes.java
e0c9b06e46ab68f4c50262d357c86ad21218be6c
[ "BSD-2-Clause" ]
permissive
LoongYou/Wanda
ca89ac03cc179cf761f1286172d36ead41f036b5
2c2c4d1d14e95e98c0a3af365495ec53775cc36b
refs/heads/master
2023-03-14T13:14:38.476457
2021-03-06T10:20:37
2021-03-06T10:20:37
231,610,760
1
0
null
null
null
null
UTF-8
Java
false
false
732
java
package visiotool ; import com4j.*; /** */ public enum VisGraphicItemTypes implements ComEnum { /** * <p> * The value of this constant is 2 * </p> */ visTypeIconSet(2), /** * <p> * The value of this constant is 3 * </p> */ visTypeTextCallout(3), /** * <p> * The value of this constant is 4 * </p> */ visTypeDataBar(4), /** * <p> * The value of this constant is 5 * </p> */ visTypeColorByValue(5), /** * <p> * The value of this constant is 6 * </p> */ visTypeHeading(6), ; private final int value; VisGraphicItemTypes(int value) { this.value=value; } public int comEnumValue() { return value; } }
140c763a632f7806c4be56667dc0d9b052cf85ee
56cd965b524bfb09aa0fac3614e3cbbcf56f4ab2
/microblog-scheduler/scheduler-quartz/src/main/java/com/cloud/frame/scheduler/quartz/config/QuartzConfig.java
caf0743f3485d0923b1c2825197e924867da7afb
[]
no_license
taoyonggang/micro-blog
26ffc929ba54347da2caa4ecc26c81f04f65604e
5b66bcc5108eb50e13dd5776f0e4eee0965ebd1d
refs/heads/master
2020-04-23T13:54:24.100461
2019-02-18T03:24:59
2019-02-18T03:24:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,787
java
package com.cloud.microblog.scheduler.quartz.config; import org.quartz.Scheduler; import org.quartz.spi.JobFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.PropertiesFactoryBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.scheduling.quartz.SchedulerFactoryBean; import java.io.IOException; import java.util.Properties; /** * @program: top-parent * @description: quartz 配置 * @author: Mr.lgj * @version: * @See: * @create: 2018-11-20 17:19 **/ @Configuration public class QuartzConfig { @Autowired JobFactory jobFactory; //获取工厂bean @Bean public SchedulerFactoryBean schedulerFactoryBean() { SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); try { schedulerFactoryBean.setQuartzProperties(quartzProperties()); schedulerFactoryBean.setJobFactory(jobFactory); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return schedulerFactoryBean; } //指定quartz.properties @Bean public Properties quartzProperties() throws IOException { PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); propertiesFactoryBean.setLocation(new ClassPathResource("/quartz.properties")); propertiesFactoryBean.afterPropertiesSet(); return propertiesFactoryBean.getObject(); } //创建schedule @Bean(name = "scheduler") public Scheduler scheduler() { return schedulerFactoryBean().getScheduler(); } }
3c49dec5df08d0bacc3e801cf758a4e25e49c2f0
3c160379ecaea26202f478b18cdc7042b9f504ee
/src/ConnectionListener.java
6d8453d124278bbc49fd97a3db7d6e171e7df5af
[]
no_license
hrghauri/SYSC3303_TFTP
de98d749baf8b64b196a5e040ccfc54239eda57f
ac920273fa10b0c387efa5fda3c03553d2d703e8
refs/heads/master
2020-03-23T01:19:19.023406
2016-06-09T21:56:00
2016-06-09T21:56:00
140,910,761
0
0
null
null
null
null
UTF-8
Java
false
false
1,729
java
import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.SocketException; import Common.Packet; public class ConnectionListener implements Runnable{ private DatagramSocket socket69; private DatagramPacket receivePacket; private int activeConnectionsCount; private Boolean quite[]; public ConnectionListener(Boolean quite[]){ try { socket69 = new DatagramSocket(69); } catch (SocketException se) { se.printStackTrace(); System.exit(1); } activeConnectionsCount = 0; this.quite = quite; } public void closeSocket69(){ socket69.close(); } @Override public void run() { while(true){ byte data[] = new byte[518]; receivePacket = new DatagramPacket(data, data.length); try { socket69.receive(receivePacket); } catch (IOException e) { // TODO Auto-generated catch block System.out.println("Server has stopped listening on user command or " + "is unable to listen anymore for any unexpected exeption. "); //e.printStackTrace(); } if (socket69.isClosed()) break; System.out.println("A request has been received while listening on port 69."); if(!quite[0]) Packet.displayReceivedPacket(receivePacket, "ConnectionListener"); String connectionId = "connectionManager No "+String.valueOf(activeConnectionsCount); Thread connectionManagerThread = new Thread(new ConnectionManager(receivePacket, quite),connectionId); activeConnectionsCount++; connectionManagerThread.start(); System.out.println("New connection manager has formed: "+connectionId); } } }
a8b4cceb66a6baac194cb76d3275c194a3c3b3d3
487c321221d953876aed88398d8ee19f8391d410
/app/src/main/java/com/yfy/app/info_submit/frament/EditTextFragment.java
695220c30c5dd91e98bf060d162f0b6797e1a6c1
[]
no_license
Zhaoxianxv/rebirth
e3bd0734344e955ac7adec99e1c08095db04463c
34452d363c4815266e033737b7be68e71495e2ea
refs/heads/master
2020-09-15T03:39:46.068726
2020-09-04T13:13:47
2020-09-04T13:13:47
223,339,537
0
0
null
null
null
null
UTF-8
Java
false
false
4,425
java
package com.yfy.app.info_submit.frament; import android.annotation.SuppressLint; import android.inputmethodservice.KeyboardView; import android.os.Bundle; import android.text.Editable; import android.text.Selection; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.EditText; import android.widget.RelativeLayout; import android.widget.TextView; import com.yfy.app.info_submit.activity.FormWriteItemActivity; import com.yfy.app.info_submit.constants.InfosConstant; import com.yfy.app.info_submit.infos.ItemType; import com.yfy.app.info_submit.infos.WriteItem; import com.yfy.app.info_submit.utils.KeyboardUtil; import com.yfy.app.info_submit.utils.LegalityJudger; import com.yfy.app.info_submit.utils.Util; import com.yfy.rebirth.R; public class EditTextFragment extends AbstractFragment implements OnClickListener, TextWatcher { private EditText item_edittext; private TextView postfix_tv; private RelativeLayout wu_rela; private TextView if_wu_tv; private KeyboardView keyboardview; private KeyboardUtil keyboardUtil; private View view; private WriteItem writeItem; private boolean isSfz; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_edittext, null); initView(); return view; } @SuppressLint("CutPasteId") private void initView() { int position1 = getArguments().getInt("position1"); int position2 = getArguments().getInt("position2"); writeItem = InfosConstant.totalList.get(position1).get(position2); String itemName = writeItem.getItemName(); String itemValue = writeItem.getItemValue(); if (itemValue.equals("无") || LegalityJudger.isEmpty(itemValue)) { itemValue = ""; ((FormWriteItemActivity) getActivity()).setOkClicked(false); } else { ((FormWriteItemActivity) getActivity()).setOkClicked(true); } item_edittext = (EditText) view.findViewById(R.id.item_edittext); postfix_tv = (TextView) view.findViewById(R.id.postfix_tv); wu_rela = (RelativeLayout) view.findViewById(R.id.wu_rela); if_wu_tv = (TextView) view.findViewById(R.id.if_wu_tv); keyboardview = (KeyboardView) view.findViewById(R.id.keyboard_view); if_wu_tv.setText("若暂无" + "“" + itemName + "”," + "请点击..."); item_edittext.setHint("请输入" + itemName); item_edittext.setText(itemValue); Editable etext = item_edittext.getText(); Selection.setSelection(etext, etext.length()); item_edittext.addTextChangedListener(this); ItemType itemType = writeItem.getItemType(); if (itemType.getPostfix() != null && !itemType.getPostfix().equals("")) { postfix_tv.setVisibility(View.VISIBLE); postfix_tv.setText(itemType.getPostfix()); } if (itemType.getSysmbol() == 1) { keyboardUtil = new KeyboardUtil(keyboardview, getActivity(), item_edittext, R.xml.symbols1); } else if (itemType.getSysmbol() == 2) { keyboardUtil = new KeyboardUtil(keyboardview, getActivity(), item_edittext, R.xml.symbols2); } if (keyboardUtil != null) { Util.hideSoftInputMethod(getActivity(), item_edittext); keyboardUtil.showKeyboard(); } if (itemType.isCanWu()) { wu_rela.setVisibility(View.VISIBLE); wu_rela.setOnClickListener(this); } if (writeItem.getItemKey().equals("sfz") && itemType.getSysmbol() == 1) { isSfz = true; } } @Override public String getData() { return item_edittext.getText().toString(); } public void setHint(String itemName) { item_edittext.setHint("请输入" + itemName); } @Override public void onClick(View v) { item_edittext.setText("无"); Editable ed = item_edittext.getText(); Selection.setSelection(ed, ed.length()); writeItem.setItemValue("无"); getActivity().finish(); } @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence c, int arg1, int arg2, int arg3) { } @Override public void onTextChanged(CharSequence c, int arg1, int arg2, int arg3) { String s = c.toString().trim(); if (c == null || s.equals("") || (isSfz && !LegalityJudger.ShenFenHaoMaTip(s))) { ((FormWriteItemActivity) getActivity()).setOkClicked(false); } else { ((FormWriteItemActivity) getActivity()).setOkClicked(true); } } }
625de4179af0a8b55bf170a9c6b6db4d15f9fe2d
c524f830b026b380b05010228e696de0558cfc0f
/Week_01/src/homework/L_26_Remove_Duplicates_From_Sort_Array.java
ddc9f74d0fc4d83a208dbc506d142e6c3409c17d
[]
no_license
miserydx/AlgorithmCHUNZHAO
f8cb62ca50affa7ea69886149f4941ffc769182f
ffdc4d57fdf935904902c53db818651a44438b35
refs/heads/main
2023-03-22T12:11:50.831474
2021-03-21T11:25:26
2021-03-21T11:25:26
332,264,355
0
0
null
2021-01-23T17:10:38
2021-01-23T17:10:38
null
UTF-8
Java
false
false
1,856
java
package homework; //给定一个排序数组,你需要在 原地 删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 // // 不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。 // // // // 示例 1: // // 给定数组 nums = [1,1,2], // //函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 // //你不需要考虑数组中超出新长度后面的元素。 // // 示例 2: // // 给定 nums = [0,0,1,1,1,2,2,3,3,4], // //函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。 // //你不需要考虑数组中超出新长度后面的元素。 // // // // // 说明: // // 为什么返回数值是整数,但输出的答案是数组呢? // // 请注意,输入数组是以「引用」方式传递的,这意味着在函数里修改输入数组对于调用者是可见的。 // // 你可以想象内部操作如下: // // // nums 是以“引用”方式传递的。也就是说,不对实参做任何拷贝 //int len = removeDuplicates(nums); // //// 在函数里修改输入数组对于调用者是可见的。 //// 根据你的函数返回的长度, 它会打印出数组中该长度范围内的所有元素。 //for (int i = 0; i < len; i++) { //    print(nums[i]); //} // // Related Topics 数组 双指针 public class L_26_Remove_Duplicates_From_Sort_Array { /** * 双指针 后指针向后推,前后指针值不等时,前指针++位置赋值 * 类似移动0 */ public int removeDuplicates(int[] nums) { int i = 0; for (int j = 0; j < nums.length; j++) { if (nums[i] != nums[j]) { nums[++i] = nums[j]; } } return i + 1; } }
be22ef7d5ec23d0fdcf00d265408e7136f18ca63
6acab3aee074d72b173fda7738c2b8b43fea3566
/Strategy/StrategyThree.java
fcd8c7e280db6a14c9dc8a68c6c6eee911847932
[]
no_license
androidwolf/designpattern--Stategy
5f98f40fc489dadf6b14b7081ba923045a008dac
ab0a0d8774166c928187aa92209116c6f6f677b1
refs/heads/master
2020-05-30T14:46:54.962063
2016-09-27T01:03:49
2016-09-27T01:03:49
69,305,731
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package Strategy; import java.util.Arrays; public class StrategyThree implements ComputableStrategy { @Override public double computableStrategy(double[] a) { if (a.length <= 2) return 0; double score = 0, sum = 0; Arrays.sort(a); for (int i = 1; i < a.length - 1; i++) { sum = sum + a[i]; } score = sum/(a.length-2); return score; } }
123ea2267b282a07005cd1b1c8dd8578c8b00c67
9a52eeaf13f9f7593dbe3de539469aca1c233757
/app/src/main/java/com/android/tv/TvApplication.java
be1bd2ecbaef6f29c18459b0155bf3b141a1dcfa
[]
no_license
johnjcool/TV
1942eb4c34bb753e8dbf16ebd99114cf0a3a26da
e1ed59a055c41dcdc72e49df7175c5fa469374ad
refs/heads/master
2020-03-31T22:30:02.802799
2018-10-11T17:19:30
2018-10-11T17:19:30
152,620,829
0
1
null
null
null
null
UTF-8
Java
false
false
21,039
java
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tv; import android.annotation.TargetApi; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.media.tv.TvContract; import android.media.tv.TvInputInfo; import android.media.tv.TvInputManager; import android.media.tv.TvInputManager.TvInputCallback; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import com.android.tv.common.BaseApplication; import com.android.tv.common.concurrent.NamedThreadFactory; import com.android.tv.common.feature.CommonFeatures; import com.android.tv.common.recording.RecordingStorageStatusManager; import com.android.tv.common.ui.setup.animation.SetupAnimationHelper; import com.android.tv.common.util.Clock; import com.android.tv.common.util.Debug; import com.android.tv.common.util.SharedPreferencesUtils; import com.android.tv.data.ChannelDataManager; import com.android.tv.data.PreviewDataManager; import com.android.tv.data.ProgramDataManager; import com.android.tv.data.epg.EpgFetcher; import com.android.tv.data.epg.EpgFetcherImpl; import com.android.tv.dvr.DvrDataManager; import com.android.tv.dvr.DvrDataManagerImpl; import com.android.tv.dvr.DvrManager; import com.android.tv.dvr.DvrScheduleManager; import com.android.tv.dvr.DvrStorageStatusManager; import com.android.tv.dvr.DvrWatchedPositionManager; import com.android.tv.dvr.recorder.RecordingScheduler; import com.android.tv.dvr.ui.browse.DvrBrowseActivity; import com.android.tv.recommendation.ChannelPreviewUpdater; import com.android.tv.recommendation.RecordedProgramPreviewUpdater; import com.android.tv.tuner.TunerInputController; import com.android.tv.tuner.util.TunerInputInfoUtils; import com.android.tv.util.SetupUtils; import com.android.tv.util.TvInputManagerHelper; import com.android.tv.util.Utils; import java.util.List; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * Live TV application. * * <p>This includes all the Google specific hooks. */ public abstract class TvApplication extends BaseApplication implements TvSingletons, Starter { private static final String TAG = "TvApplication"; private static final boolean DEBUG = false; /** Namespace for LiveChannels configs. LiveChannels configs are kept in piper. */ public static final String CONFIGNS_P4 = "configns:p4"; /** * Broadcast Action: The user has updated LC to a new version that supports tuner input. {@link * TunerInputController} will receive this intent to check the existence of tuner input when the * new version is first launched. */ public static final String ACTION_APPLICATION_FIRST_LAUNCHED = " com.android.tv.action.APPLICATION_FIRST_LAUNCHED"; private static final String PREFERENCE_IS_FIRST_LAUNCH = "is_first_launch"; private static final NamedThreadFactory THREAD_FACTORY = new NamedThreadFactory("tv-app-db"); private static final ExecutorService DB_EXECUTOR = Executors.newSingleThreadExecutor(THREAD_FACTORY); private String mVersionName = ""; private final MainActivityWrapper mMainActivityWrapper = new MainActivityWrapper(); private SelectInputActivity mSelectInputActivity; private ChannelDataManager mChannelDataManager; private volatile ProgramDataManager mProgramDataManager; private PreviewDataManager mPreviewDataManager; private DvrManager mDvrManager; private DvrScheduleManager mDvrScheduleManager; private DvrDataManager mDvrDataManager; private DvrWatchedPositionManager mDvrWatchedPositionManager; private RecordingScheduler mRecordingScheduler; private RecordingStorageStatusManager mDvrStorageStatusManager; @Nullable private InputSessionManager mInputSessionManager; // STOP-SHIP: Remove this variable when Tuner Process is split to another application. // When this variable is null, we don't know in which process TvApplication runs. private Boolean mRunningInMainProcess; private TvInputManagerHelper mTvInputManagerHelper; private boolean mStarted; private EpgFetcher mEpgFetcher; private TunerInputController mTunerInputController; @Override public void onCreate() { super.onCreate(); SharedPreferencesUtils.initialize( this, new Runnable() { @Override public void run() { if (mRunningInMainProcess != null && mRunningInMainProcess) { checkTunerServiceOnFirstLaunch(); } } }); try { PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); mVersionName = pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Unable to find package '" + getPackageName() + "'.", e); mVersionName = ""; } Log.i(TAG, "Starting Live TV " + getVersionName()); // In SetupFragment, transitions are set in the constructor. Because the fragment can be // created in Activity.onCreate() by the framework, SetupAnimationHelper should be // initialized here before Activity.onCreate() is called. mEpgFetcher = EpgFetcherImpl.create(this); SetupAnimationHelper.initialize(this); getTvInputManagerHelper(); Log.i(TAG, "Started Live TV " + mVersionName); Debug.getTimer(Debug.TAG_START_UP_TIMER).log("finish TvApplication.onCreate"); } /** Initializes application. It is a noop if called twice. */ @Override public void start() { if (mStarted) { return; } mStarted = true; mRunningInMainProcess = true; Debug.getTimer(Debug.TAG_START_UP_TIMER).log("start TvApplication.start"); if (mRunningInMainProcess) { getTvInputManagerHelper() .addCallback( new TvInputCallback() { @Override public void onInputAdded(String inputId) { if (TvFeatures.TUNER.isEnabled(TvApplication.this) && TextUtils.equals( inputId, getEmbeddedTunerInputId())) { TunerInputInfoUtils.updateTunerInputInfo( TvApplication.this); } handleInputCountChanged(); } @Override public void onInputRemoved(String inputId) { handleInputCountChanged(); } }); if (TvFeatures.TUNER.isEnabled(this)) { // If the tuner input service is added before the app is started, we need to // handle it here. TunerInputInfoUtils.updateTunerInputInfo(TvApplication.this); } if (CommonFeatures.DVR.isEnabled(this)) { mDvrScheduleManager = new DvrScheduleManager(this); mDvrManager = new DvrManager(this); mRecordingScheduler = RecordingScheduler.createScheduler(this); } mEpgFetcher.startRoutineService(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { ChannelPreviewUpdater.getInstance(this).startRoutineService(); RecordedProgramPreviewUpdater.getInstance(this) .updatePreviewDataForRecordedPrograms(); } } Debug.getTimer(Debug.TAG_START_UP_TIMER).log("finish TvApplication.start"); } private void checkTunerServiceOnFirstLaunch() { SharedPreferences sharedPreferences = this.getSharedPreferences( SharedPreferencesUtils.SHARED_PREF_FEATURES, Context.MODE_PRIVATE); boolean isFirstLaunch = sharedPreferences.getBoolean(PREFERENCE_IS_FIRST_LAUNCH, true); if (isFirstLaunch) { if (DEBUG) Log.d(TAG, "Congratulations, it's the first launch!"); getTunerInputController() .onCheckingUsbTunerStatus(this, ACTION_APPLICATION_FIRST_LAUNCHED); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(PREFERENCE_IS_FIRST_LAUNCH, false); editor.apply(); } } @Override public EpgFetcher getEpgFetcher() { return mEpgFetcher; } @Override public synchronized SetupUtils getSetupUtils() { return SetupUtils.createForTvSingletons(this); } /** Returns the {@link DvrManager}. */ @Override public DvrManager getDvrManager() { return mDvrManager; } /** Returns the {@link DvrScheduleManager}. */ @Override public DvrScheduleManager getDvrScheduleManager() { return mDvrScheduleManager; } /** Returns the {@link RecordingScheduler}. */ @Override @Nullable public RecordingScheduler getRecordingScheduler() { return mRecordingScheduler; } /** Returns the {@link DvrWatchedPositionManager}. */ @Override public DvrWatchedPositionManager getDvrWatchedPositionManager() { if (mDvrWatchedPositionManager == null) { mDvrWatchedPositionManager = new DvrWatchedPositionManager(this); } return mDvrWatchedPositionManager; } @Override @TargetApi(Build.VERSION_CODES.N) public InputSessionManager getInputSessionManager() { if (mInputSessionManager == null) { mInputSessionManager = new InputSessionManager(this); } return mInputSessionManager; } /** Returns {@link ChannelDataManager}. */ @Override public ChannelDataManager getChannelDataManager() { if (mChannelDataManager == null) { mChannelDataManager = new ChannelDataManager(this, getTvInputManagerHelper()); mChannelDataManager.start(); } return mChannelDataManager; } @Override public boolean isChannelDataManagerLoadFinished() { return mChannelDataManager != null && mChannelDataManager.isDbLoadFinished(); } /** Returns {@link ProgramDataManager}. */ @Override public ProgramDataManager getProgramDataManager() { if (mProgramDataManager != null) { return mProgramDataManager; } Utils.runInMainThreadAndWait( new Runnable() { @Override public void run() { if (mProgramDataManager == null) { mProgramDataManager = new ProgramDataManager(TvApplication.this); mProgramDataManager.start(); } } }); return mProgramDataManager; } @Override public boolean isProgramDataManagerCurrentProgramsLoadFinished() { return mProgramDataManager != null && mProgramDataManager.isCurrentProgramsLoadFinished(); } /** Returns {@link PreviewDataManager}. */ @TargetApi(Build.VERSION_CODES.O) @Override public PreviewDataManager getPreviewDataManager() { if (mPreviewDataManager == null) { mPreviewDataManager = new PreviewDataManager(this); mPreviewDataManager.start(); } return mPreviewDataManager; } /** Returns {@link DvrDataManager}. */ @TargetApi(Build.VERSION_CODES.N) @Override public DvrDataManager getDvrDataManager() { if (mDvrDataManager == null) { DvrDataManagerImpl dvrDataManager = new DvrDataManagerImpl(this, Clock.SYSTEM); mDvrDataManager = dvrDataManager; dvrDataManager.start(); } return mDvrDataManager; } @Override @TargetApi(Build.VERSION_CODES.N) public RecordingStorageStatusManager getRecordingStorageStatusManager() { if (mDvrStorageStatusManager == null) { mDvrStorageStatusManager = new DvrStorageStatusManager(this); } return mDvrStorageStatusManager; } /** Returns the main activity information. */ @Override public MainActivityWrapper getMainActivityWrapper() { return mMainActivityWrapper; } /** Returns {@link TvInputManagerHelper}. */ @Override public TvInputManagerHelper getTvInputManagerHelper() { if (mTvInputManagerHelper == null) { mTvInputManagerHelper = new TvInputManagerHelper(this); mTvInputManagerHelper.start(); } return mTvInputManagerHelper; } @Override public synchronized TunerInputController getTunerInputController() { if (mTunerInputController == null) { mTunerInputController = new TunerInputController( ComponentName.unflattenFromString(getEmbeddedTunerInputId())); } return mTunerInputController; } @Override public boolean isRunningInMainProcess() { return mRunningInMainProcess != null && mRunningInMainProcess; } /** * SelectInputActivity is set in {@link SelectInputActivity#onCreate} and cleared in {@link * SelectInputActivity#onDestroy}. */ public void setSelectInputActivity(SelectInputActivity activity) { mSelectInputActivity = activity; } public void handleGuideKey() { if (!mMainActivityWrapper.isResumed()) { startActivity(new Intent(Intent.ACTION_VIEW, TvContract.Programs.CONTENT_URI)); } else { mMainActivityWrapper.getMainActivity().getOverlayManager().toggleProgramGuide(); } } /** Handles the global key KEYCODE_TV. */ public void handleTvKey() { if (!mMainActivityWrapper.isResumed()) { startMainActivity(null); } } /** Handles the global key KEYCODE_DVR. */ public void handleDvrKey() { startActivity(new Intent(this, DvrBrowseActivity.class)); } /** Handles the global key KEYCODE_TV_INPUT. */ public void handleTvInputKey() { TvInputManager tvInputManager = (TvInputManager) getSystemService(Context.TV_INPUT_SERVICE); List<TvInputInfo> tvInputs = tvInputManager.getTvInputList(); int inputCount = 0; boolean hasTunerInput = false; for (TvInputInfo input : tvInputs) { if (input.isPassthroughInput()) { if (!input.isHidden(this)) { ++inputCount; } } else if (!hasTunerInput) { hasTunerInput = true; ++inputCount; } } if (inputCount < 2) { return; } Activity activityToHandle = mMainActivityWrapper.isResumed() ? mMainActivityWrapper.getMainActivity() : mSelectInputActivity; if (activityToHandle != null) { // If startActivity is called, MainActivity.onPause is unnecessarily called. To // prevent it, MainActivity.dispatchKeyEvent is directly called. activityToHandle.dispatchKeyEvent( new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_TV_INPUT)); activityToHandle.dispatchKeyEvent( new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_TV_INPUT)); } else if (mMainActivityWrapper.isStarted()) { Bundle extras = new Bundle(); extras.putString(Utils.EXTRA_KEY_ACTION, Utils.EXTRA_ACTION_SHOW_TV_INPUT); startMainActivity(extras); } else { startActivity( new Intent(this, SelectInputActivity.class) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } } private void startMainActivity(Bundle extras) { // The use of FLAG_ACTIVITY_NEW_TASK enables arbitrary applications to access the intent // sent to the root activity. Having said that, we should be fine here since such an intent // does not carry any important user data. Intent intent = new Intent(this, MainActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (extras != null) { intent.putExtras(extras); } startActivity(intent); } /** * Returns the version name of the live channels. * * @see PackageInfo#versionName */ public String getVersionName() { return mVersionName; } /** * Checks the input counts and enable/disable TvActivity. Also upda162 the input list in {@link * SetupUtils}. */ @Override public void handleInputCountChanged() { handleInputCountChanged(false, false, false); } /** * Checks the input counts and enable/disable TvActivity. Also updates the input list in {@link * SetupUtils}. * * @param calledByTunerServiceChanged true if it is called when BaseTunerTvInputService is * enabled or disabled. * @param tunerServiceEnabled it's available only when calledByTunerServiceChanged is true. * @param dontKillApp when TvActivity is enabled or disabled by this method, the app restarts by * default. But, if dontKillApp is true, the app won't restart. */ public void handleInputCountChanged( boolean calledByTunerServiceChanged, boolean tunerServiceEnabled, boolean dontKillApp) { TvInputManager inputManager = (TvInputManager) getSystemService(Context.TV_INPUT_SERVICE); boolean enable = (calledByTunerServiceChanged && tunerServiceEnabled) || TvFeatures.UNHIDE.isEnabled(TvApplication.this); if (!enable) { List<TvInputInfo> inputs = inputManager.getTvInputList(); boolean skipTunerInputCheck = false; // Enable the TvActivity only if there is at least one tuner type input. if (!skipTunerInputCheck) { for (TvInputInfo input : inputs) { if (calledByTunerServiceChanged && !tunerServiceEnabled && getEmbeddedTunerInputId().equals(input.getId())) { continue; } if (input.getType() == TvInputInfo.TYPE_TUNER) { enable = true; break; } } } if (DEBUG) Log.d(TAG, "Enable MainActivity: " + enable); } PackageManager packageManager = getPackageManager(); ComponentName name = new ComponentName(this, TvActivity.class); int newState = enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED; if (packageManager.getComponentEnabledSetting(name) != newState) { packageManager.setComponentEnabledSetting( name, newState, dontKillApp ? PackageManager.DONT_KILL_APP : 0); Log.i(TAG, (enable ? "Un-hide" : "Hide") + " Live TV."); } getSetupUtils().onInputListUpdated(inputManager); } @Override public Executor getDbExecutor() { return DB_EXECUTOR; } }
0c7fa0e22bd7c859e1b9756f6836b5229665c3bb
2fc236dcb4ebf52e7a447471efdbcd8761d5a6bd
/Assignment 2/UpdateBookDialog.java
49784e7bea6574971335e0d7c5bd020d98fa0c94
[]
no_license
ZenonZeni/Object-Oriented-Programming
802eea1ebe5e2acfff1d770656b481d1bf5ac980
4f9d37738e4b39b2c80cf71f8ca4f570cc9b7d07
refs/heads/main
2023-02-01T00:47:50.713405
2020-12-16T07:13:34
2020-12-16T07:13:34
308,821,405
0
0
null
null
null
null
UTF-8
Java
false
false
1,259
java
package A2; /** * The dialog for updating a book. * @edited by: Christopher Nguyen * A2 * @date: 11/14/2019 */ public class UpdateBookDialog extends BookPropertyDialog { /** * Constructor */ public UpdateBookDialog(BookListWindow owner) { super(owner, "Update Book"); titleTextField.setEnabled(false); saveButton.setText("UPDATE"); } /** * Initializes the text fields with the given book. * @param Book book */ public void showBook(Book book) { // TODO Add your code here... titleTextField.setText(book.getTitle()); authorsTextField.setText(book.getAuthors()); pagesTextField.setText(Integer.toString(book.getPages())); if (book.getCategory()==Book.BookCategory.Programming) { categoryComboBox.setSelectedIndex(0); } else if (book.getCategory()==Book.BookCategory.Database) { categoryComboBox.setSelectedIndex(1); } else{ categoryComboBox.setSelectedIndex(2); } this.setVisible(true); } @Override /** * @param Book book * note: calls a method to update the object with the give parama book */ protected void doSave(Book book) { bookCollection.update(book); } }
527b58d7fa5a951a71a133edc860852d5a6a31c8
b26f18c0b77daac5195d4283ca24273cbfb4b34e
/src/main/java/com/service/BookDocumentService.java
edc3eaeef5425de474b82fa685942686556b21f1
[]
no_license
ooliinyk/libraryNew
258092fe4f92fd831c80a8475345b6b8f2d985d9
fb58c764e61502cbf6ae158fcbbbd9e3a07a4863
refs/heads/master
2021-01-10T06:03:30.256430
2016-04-04T10:40:11
2016-04-04T10:40:11
54,590,922
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.service; import com.entity.BookDocument; import java.util.List; /** * Created by user on 19.03.2016. */ public interface BookDocumentService { BookDocument findById(int id); List<BookDocument> findAll(); List<BookDocument> findAllByUserId(int id); void saveDocument(BookDocument document); void deleteById(int id); }
e5aeb80d09992f9ad1e2c25d959c78869726a2a7
f9f7f0b8f8666dee50cba2158b1ce64abceb0535
/mini_compiler/src/main/java/com/jihan/mini_compiler/PayEntryVisitor.java
c629fdc5069104c375099dbca99799d81aa42cb0
[ "MIT" ]
permissive
Jihannn/LearningDemo
8c48811cf11645ad52216286b2c233e6f8c80a2f
f8003b849ef1752f0b3fbf3946151358fb1bd796
refs/heads/master
2020-07-02T02:37:57.141618
2019-08-31T05:37:07
2019-08-31T05:37:07
201,388,673
0
0
null
null
null
null
UTF-8
Java
false
false
1,499
java
package com.jihan.mini_compiler; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import java.io.IOException; import javax.annotation.processing.Filer; import javax.lang.model.element.Modifier; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleAnnotationValueVisitor7; final class PayEntryVisitor extends SimpleAnnotationValueVisitor7<Void, Void> { private final Filer FILER; private String mPackageName = null; PayEntryVisitor(Filer FILER) { this.FILER = FILER; } @Override public Void visitString(String s, Void p) { mPackageName = s; return p; } @Override public Void visitType(TypeMirror t, Void p) { generateJavaCode(t); return p; } private void generateJavaCode(TypeMirror typeMirror) { final TypeSpec targetActivity = TypeSpec.classBuilder("WXPayEntryActivity") .addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.FINAL) .superclass(TypeName.get(typeMirror)) .build(); final JavaFile javaFile = JavaFile.builder(mPackageName + ".wxapi", targetActivity) .addFileComment("微信支付入口文件") .build(); try { javaFile.writeTo(FILER); } catch (IOException e) { e.printStackTrace(); } } }
477ec3ac313fc2fab2c95fc12e06bd489167dbf2
f7082b3d5ec81f1e3341adb9d0d94bbdbb4c37dc
/1. Fundamental-Level/Java/OOP-Bacis-June-2016/[EX]/05. Inheritance/src/problem4_MordorsCrueltyPlan/Main.java
8cee5feb3457a01527b3f45a56e4a2727d14f4a7
[]
no_license
krisdx/SoftUni
0e5f368b83ca55ec25fce92e2aed86f59f8bff70
67eef32f60cd527e89dc05087a74a18ef93cf5c9
refs/heads/master
2021-01-24T10:32:23.173482
2017-03-08T07:26:32
2017-03-08T07:26:32
54,333,693
1
0
null
null
null
null
UTF-8
Java
false
false
1,396
java
package problem4_MordorsCrueltyPlan; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Map<String, Integer> foods = new HashMap<>(); int gandalfMoood = 0; initializeFoods(foods); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String[] foodInput = reader.readLine().toLowerCase().split("\\s+"); for (String food : foodInput) { if (foods.containsKey(food)){ gandalfMoood += foods.get(food); } else { gandalfMoood--; } } System.out.println(gandalfMoood); if (gandalfMoood < -5) { System.out.println("Angry"); } else if (gandalfMoood >= -5 && gandalfMoood < 0 ) { System.out.println("Sad"); } else if (gandalfMoood >= 0 && gandalfMoood < 15) { System.out.println("Happy"); } else { System.out.println("JavaScript"); } } private static void initializeFoods(Map<String, Integer> foods) { foods.put("cram", 2); foods.put("lembas", 3); foods.put("apple", 1); foods.put("melon", 1); foods.put("honeycake", 5); foods.put("mushrooms", -10); } }
f3d08f5a68f5182c3976f3251e8190b50ecee5e2
c64ab493f263f716787c81c5abaed8246e8e4dc8
/src/protect_oiler/Problem22.java
b073150c431ffae3f084bc074a0ea112560badfa
[]
no_license
rakshendra/Practice
13ad8b75671ea967e90393deccf533b19306f0aa
8d04f35e7f45f586bef4f3ecb2eaccc7c6c7365e
refs/heads/master
2020-04-13T02:05:36.248753
2020-02-27T17:23:16
2020-02-27T17:23:16
162,893,014
0
0
null
null
null
null
UTF-8
Java
false
false
238
java
package src.protect_oiler; import java.io.File; public class Problem22 { public static void main(String[] args){ File file = new File("C:\\Users\\raksh\\IdeaProjects\\Practice\\src\\protect_oiler\\p022_names.txt"); } }