blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
abac1939dbe69e8a0a6bb626c6001dcab38f268b
d04b0a47e4615917a772a46ab68f35d10d0503cf
/TomatoClock/src/com/zebin/utils/JdbcUtils.java
dfe3ca57a1a02a4380a17d79386f85073235f5ef
[]
no_license
CHANGEA-code/TomatoClock
190b355f51e47f1a0d492bd4f9a6b51099c29e8a
29d614d239a1cc09cd8fe402aedb5d711eca67ee
refs/heads/main
2023-07-14T20:06:33.994371
2021-08-17T07:57:18
2021-08-17T07:57:18
394,924,306
3
0
null
null
null
null
UTF-8
Java
false
false
3,289
java
package com.zebin.utils; import com.alibaba.druid.pool.DruidDataSourceFactory; import org.apache.commons.dbutils.DbUtils; import org.apache.commons.dbutils.QueryRunner; import javax.sql.DataSource; import java.io.InputStream; import java.sql.*; import java.util.Properties; /** * @author ZebinHong * @create 2021-07-24-15:53 */ public class JdbcUtils { /** * 开启数据库连接 * @return * @throws Exception */ QueryRunner qr = new QueryRunner(); // public static Connection getConnection() throws Exception { // // //1.获取四个参数信息 // InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("jdbc.properties"); // Properties pro = new Properties(); // pro.load(is); // // // String user = pro.getProperty("user"); // String password = pro.getProperty("password"); // String url = pro.getProperty("url"); // String driverClass = pro.getProperty("driverClass"); // //2.加载驱动 // Class.forName(driverClass); // //3.连接 // Connection con = DriverManager.getConnection(url, user, password); // System.out.println("数据库连接成功:"+con); // return con; // } /** * 使用Druid数据库连接池技术 */ private static DataSource source1; static{ try { Properties pros = new Properties(); InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("druid.properties"); pros.load(is); source1 = DruidDataSourceFactory.createDataSource(pros); } catch (Exception e) { e.printStackTrace(); } } public static Connection getConnection() throws SQLException{ Connection conn = source1.getConnection(); return conn; } /** * 关闭数据库连接 * @param conn * @param ps */ public static void resourceClose(Connection conn,PreparedStatement ps){ if(ps!=null) { try { ps.close(); } catch (SQLException throwables) { throwables.printStackTrace(); } } if(conn!=null) { try { conn.close(); } catch (SQLException throwables) { throwables.printStackTrace(); } } } /** * 关闭数据库连接 * @param conn * @param ps * @param rs */ public static void resourceClose(Connection conn, PreparedStatement ps, ResultSet rs){ /*if(ps!=null) { try { ps.close(); } catch (SQLException throwables) { throwables.printStackTrace(); } } if(con!=null) { try { con.close(); } catch (SQLException throwables) { throwables.printStackTrace(); } } if(rs!=null) { try { rs.close(); } catch (SQLException throwables) { throwables.printStackTrace(); } }*/ //调用工具类写法 DbUtils.closeQuietly(conn); DbUtils.closeQuietly(ps); DbUtils.closeQuietly(rs); } }
[ "303170690@qq.com" ]
303170690@qq.com
ca9ec6b85a84011313e4304de185f9212fdb7d4c
76852b1b29410436817bafa34c6dedaedd0786cd
/sources-2020-11-04-tempmail/sources/com/google/android/gms/internal/ads/zzdgh.java
670edbf74dfb3ed7264e1cf39c6de715930abd67
[]
no_license
zteeed/tempmail-apks
040e64e07beadd8f5e48cd7bea8b47233e99611c
19f8da1993c2f783b8847234afb52d94b9d1aa4c
refs/heads/master
2023-01-09T06:43:40.830942
2020-11-04T18:55:05
2020-11-04T18:55:05
310,075,224
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
package com.google.android.gms.internal.ads; /* compiled from: com.google.android.gms:play-services-ads@@19.2.0 */ public final class zzdgh implements zzela<Integer> { /* renamed from: a reason: collision with root package name */ private final zzdgd f8208a; public zzdgh(zzdgd zzdgd) { this.f8208a = zzdgd; } public final /* synthetic */ Object get() { return Integer.valueOf(this.f8208a.h()); } }
[ "zteeed@minet.net" ]
zteeed@minet.net
e2ff65fa8627852c6a34e6caf955867583a4bff3
3671f7a2768752f334ca34268a6e25118bc502a7
/app/src/main/java/com/example/lostandfound/Home.java
3ef44abd37a5b73b05db54e0c3d0402a9794012b
[]
no_license
NafuKrypto/Harano-Ongshak
5b1c39c15f3411af3a430cf64998d3a5b31bb8d0
42b08c6c1696ef61c16d3628eac11e38726b5b20
refs/heads/master
2023-06-16T05:39:20.126373
2021-07-09T14:24:04
2021-07-09T14:24:04
372,375,850
0
0
null
null
null
null
UTF-8
Java
false
false
1,426
java
package com.example.lostandfound; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; 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.ValueEventListener; public class Home extends AppCompatActivity { FirebaseAuth mAuth= FirebaseAuth.getInstance(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); //sendtoNext(); final String useruid_phone= getIntent().getStringExtra("phone"); final TextView textView=(findViewById(R.id.username)); FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); // final String userid = user.getUid(); // Toast.makeText(this,userid,Toast.LENGTH_LONG).show(); String s =user.getPhoneNumber(); Toast.makeText(this,s+"",Toast.LENGTH_LONG).show(); } private void sendtoNext() { /** * if the user is logged in or not */ } }
[ "37190335+NafuKrypto@users.noreply.github.com" ]
37190335+NafuKrypto@users.noreply.github.com
655d39907de3d0cd2050e820d9af21b590e34940
0ce27bcfbd5a766bd4ca7091b5c4a7aec1817918
/src/main/java/pl/javastart/sklep/Product.java
90e5ffab6a67b8635728957f0c2472e7c89c3a96
[]
no_license
wojga476/zadanie-19.1-pop-
427035c6b6e59f6fae8debf9028580a17e0f2c06
29cdec1f9744f5a4239fa34627cde6e2462a28e3
refs/heads/master
2020-03-25T23:49:22.354164
2018-07-24T13:49:06
2018-07-24T13:49:06
144,294,665
0
0
null
null
null
null
UTF-8
Java
false
false
699
java
package pl.javastart.sklep; public class Product { private String name; private String price; @Override public String toString() { return "Product{" + "name='" + name + '\'' + ", price='" + price + '\'' + '}'; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public Product(String name, String price) { this.name = name; this.price = price; } public Product() { } }
[ "wojga476@gmail.com" ]
wojga476@gmail.com
722893746db248a6b1b50428fa20570f64d6b461
c6963e5f989a3a120fd21014a2e75f1f561d669a
/src/DSA2/LinkedList/PinkedList.java
ab747febfc5a700d25a89bc4259c470a5f4339ad
[]
no_license
ayushman999/CN_DSA
6274540ad3e4ee0460997d935a755f2918fb5f5d
eb16e1e3c81880bd11723485e9add64531947faa
refs/heads/main
2023-07-21T03:45:24.514948
2021-09-08T13:20:07
2021-09-08T13:20:07
395,240,116
0
0
null
null
null
null
UTF-8
Java
false
false
860
java
package DSA2.LinkedList; import java.util.Scanner; public class PinkedList { public static Node<Integer> insert() { Scanner sc=new Scanner(System.in); Node<Integer> head=null; Node<Integer> tail=null; int data=sc.nextInt(); while (data!=-1) { Node<Integer> newNode=new Node<>(data); if(head==null) { head=newNode; tail=newNode; } else { tail.next=newNode; tail=newNode; } data=sc.nextInt(); } return head; } public static void print(Node<Integer> head) { while (head!=null) { System.out.print(head.data+" "); head=head.next; } System.out.println(); } }
[ "55322319+ayushman999@users.noreply.github.com" ]
55322319+ayushman999@users.noreply.github.com
c4783c0b81d5b1953106d64df364a0cce1f75d31
f8434073dc71fb3fc61813595d6e5437b483f567
/src/minecraft/net/minecraft/src/Packet9Respawn.java
7fd03e8f1c2a2238007d6d621fb67aaf6b84d724
[]
no_license
FrozenHF/LavaBukkit
9fe9d7fb93603f659ea08b53d9269502273d0ede
0ea93a62e840ef498cee988222e47cc09d20e08a
refs/heads/master
2021-01-16T23:01:38.903417
2011-10-31T17:14:25
2011-10-31T17:14:25
2,682,589
2
0
null
null
null
null
UTF-8
Java
false
false
1,665
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; import java.io.*; // Referenced classes of package net.minecraft.src: // Packet, NetHandler public class Packet9Respawn extends Packet { public Packet9Respawn() { } public Packet9Respawn(byte byte0, byte byte1, long l, int i, int j) { field_35244_b = byte0; field_35245_c = byte1; field_35246_a = l; field_35242_d = i; field_35243_e = j; } public void processPacket(NetHandler nethandler) { nethandler.handleRespawn(this); } public void readPacketData(DataInputStream datainputstream) throws IOException { field_35244_b = datainputstream.readByte(); field_35245_c = datainputstream.readByte(); field_35243_e = datainputstream.readByte(); field_35242_d = datainputstream.readShort(); field_35246_a = datainputstream.readLong(); } public void writePacketData(DataOutputStream dataoutputstream) throws IOException { dataoutputstream.writeByte(field_35244_b); dataoutputstream.writeByte(field_35245_c); dataoutputstream.writeByte(field_35243_e); dataoutputstream.writeShort(field_35242_d); dataoutputstream.writeLong(field_35246_a); } public int getPacketSize() { return 13; } public long field_35246_a; public int field_35244_b; public int field_35245_c; public int field_35242_d; public int field_35243_e; }
[ "camas@hotmail.co.uk" ]
camas@hotmail.co.uk
027cfa2643636a034725328a7dabf65a858f57d5
83c4f28abbd46ac72425e6c44a6a129cd6a02d75
/src/main/java/com/gmail/berndivader/mythicmobsext/volatilecode/v1_11_R1/pathfindergoals/PathfinderGoalBreakBlocks.java
4199c27391e5ea01eb1cbda29f95f3b693028e1c
[]
no_license
DragonsAscent/MythicMobsExtension
60eff8312171b350eb715f70183a5e0b9bbc8936
8190acbb3c9eb1af6d5ad101f1fe9471e629945b
refs/heads/master
2021-04-28T16:10:51.871148
2018-01-31T23:29:26
2018-01-31T23:29:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,022
java
package com.gmail.berndivader.mythicmobsext.volatilecode.v1_11_R1.pathfindergoals; import java.util.HashSet; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.LivingEntity; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import com.gmail.berndivader.mythicmobsext.Main; import net.minecraft.server.v1_11_R1.EntityInsentient; import net.minecraft.server.v1_11_R1.EntityLiving; import net.minecraft.server.v1_11_R1.MathHelper; import net.minecraft.server.v1_11_R1.PathEntity; import net.minecraft.server.v1_11_R1.PathPoint; import net.minecraft.server.v1_11_R1.PathfinderGoal; public class PathfinderGoalBreakBlocks extends PathfinderGoal { protected EntityInsentient entity; protected boolean isBreaking; protected int chance; protected HashSet<Material>materials; public PathfinderGoalBreakBlocks(EntityInsentient entity, String mL, int chance) { this.isBreaking=false; this.entity=entity; this.materials=new HashSet<>(); this.chance=chance>100?100:chance<0?0:chance; if (mL!=null) { String[]parse=mL.toUpperCase().split(","); for(int a=0;a<parse.length;a++) { try { this.materials.add(Material.valueOf(parse[a])); } catch (Exception ex) { continue; } } } } public boolean a() { return this.entity.isAlive(); } public boolean b() { if (this.entity.getGoalTarget()!=null && this.entity.getGoalTarget().isAlive()) { return true; } return false; } public void e() { if (!this.canContinue()) return; EntityLiving target=this.entity.getGoalTarget(); Block[] blocks=new Block[2]; blocks[0] = this.getBreakableTargetBlock(target); blocks[1] = blocks[0].getRelative(BlockFace.UP); for (int a=0;a<blocks.length;a++) { if (this.materials.isEmpty() || this.materials.contains(blocks[a].getType())) this.attemptBreakBlock(blocks[a]); } } private boolean canContinue() { EntityLiving target = this.entity.getGoalTarget(); if (target !=null && target.isAlive() && !this.isBreaking && !this.isReachable(target)) { return true; } return false; } private Block getBreakableTargetBlock(EntityLiving target) { Location direction = target.getBukkitEntity().getLocation().subtract(this.entity.getBukkitEntity().getLocation()); double dx=direction.getX(); double dz=direction.getY(); int bdx=0; int bdz=0; if (Math.abs(dx)>Math.abs(dz)) { bdx=(dx>0)?1:-1; } else { bdz=(dx>0)?1:-1; } return this.entity.world.getWorld().getBlockAt((int) Math.floor(this.entity.locX + bdx), (int) Math.floor(this.entity.locY), (int) Math.floor(this.entity.locZ + bdz)); } @SuppressWarnings("deprecation") private void attemptBreakBlock(Block block) { Material type = block.getType(); if (!this.isBreaking && type!=Material.AIR && type.isSolid()) { Location location = block.getLocation(); if (Main.random.nextInt(100) < 50) { this.entity.world.getWorld().playEffect(location, Effect.ZOMBIE_DESTROY_DOOR, 0); } else { this.isBreaking=true; PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 20, 4, false, false); ((LivingEntity)this.entity.getBukkitEntity()).addPotionEffect(effect); new BukkitRunnable() { @Override public void run() { EntityChangeBlockEvent event = new EntityChangeBlockEvent(PathfinderGoalBreakBlocks.this.entity.getBukkitEntity(), block, Material.AIR, (byte) 0); Main.getPlugin().getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { PathfinderGoalBreakBlocks.this.entity.world.getWorld().playSound(location, Sound.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, Math.min(Main.random.nextFloat() + 0.2f, 1.0f), 1.0f); block.breakNaturally(); PathfinderGoalBreakBlocks.this.isBreaking=false; } } }.runTaskLaterAsynchronously(Main.getPlugin(), 20L); } } } private boolean isReachable(EntityLiving target) { if (this.entity.getEntitySenses().a(target)) return true; PathEntity pe=this.entity.getNavigation().a(target); if (pe==null) { return false; } else { PathPoint pp=pe.c(); if (pp==null) { return false; } else { int i=pp.a-MathHelper.floor(target.locX); int j=pp.c-MathHelper.floor(target.locZ); return (double)(i*i+j*j)<=2.25D; } } } }
[ "kasermandel@gmail.com" ]
kasermandel@gmail.com
5a0a28403bdae8eaf1ae27229b9d23ecde83896e
8c085f12963e120be684f8a049175f07d0b8c4e5
/castor/tags/TAG_1_0_1/src/main/java/org/castor/jdo/engine/DatabaseRegistry.java
932a1b46b0f06c5354dcb7a3665a71ea26f6460c
[]
no_license
alam93mahboob/castor
9963d4110126b8f4ef81d82adfe62bab8c5f5bce
974f853be5680427a195a6b8ae3ce63a65a309b6
refs/heads/master
2020-05-17T08:03:26.321249
2014-01-01T20:48:45
2014-01-01T20:48:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,890
java
/* * Copyright 2005 Ralf Joachim * * 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.castor.jdo.engine; import java.util.Hashtable; import javax.sql.DataSource; import javax.transaction.TransactionManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.castor.jdo.conf.Database; import org.castor.jdo.conf.DatabaseChoice; import org.castor.jdo.conf.JdoConf; import org.castor.util.ConfigKeys; import org.castor.util.Configuration; import org.castor.util.Messages; import org.exolab.castor.mapping.Mapping; import org.exolab.castor.mapping.MappingException; import org.exolab.castor.util.DTDResolver; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.ValidationException; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; /** * @author <a href="arkin@intalio.com">Assaf Arkin</a> * @author <a href="mailto:ferret AT frii dot com">Bruce Snyder</a> * @author <a href="mailto:ralf DOT joachim AT syscon-world DOT de">Ralf Joachim</a> * @version $Revision$ $Date: 2006-04-10 16:39:24 -0600 (Mon, 10 Apr 2006) $ * @since 0.9.9 */ public final class DatabaseRegistry { //-------------------------------------------------------------------------- /** Temporary note to check for the changed jdo-conf syntax. */ private static final String NOTE_096 = "NOTE: JDO configuration syntax has changed with castor 0.9.6, " + "please see http://castor.codehaus.org/release-notes.html for details"; /** The <a href="http://jakarta.apache.org/commons/logging/">Jakarta * Commons Logging</a> instance used for all logging. */ private static final Log LOG = LogFactory.getLog(DatabaseRegistry.class); /** Map of all registered connection factories by name. */ private static final Hashtable FACTORIES = new Hashtable(); //-------------------------------------------------------------------------- /** * Instantiates a DataSourceConnectionFactory with given name, engine, datasource * and mapping. * * @param name The Name of the database configuration. * @param engine The Name of the persistence factory to use. * @param datasource The preconfigured datasource to use for creating connections. * @param mapping The previously loaded mapping. * @param txManager The transaction manager to use. * @throws MappingException If LockEngine could not be initialized. */ public static synchronized void loadDatabase( final String name, final String engine, final DataSource datasource, final Mapping mapping, final TransactionManager txManager) throws MappingException { AbstractConnectionFactory factory = new DataSourceConnectionFactory( name, engine, datasource, mapping, txManager); if (FACTORIES.put(name, factory) != null) { LOG.warn(Messages.format("jdo.configLoadedTwice", name)); } } /** * Instantiates a ConnectionFactory from an in-memory JDO configuration. * * @param jdoConf An in-memory jdo configuration. * @param resolver An entity resolver. * @param loader A class loader * @throws MappingException If the database cannot be instantiated/loadeed. */ public static synchronized void loadDatabase(final JdoConf jdoConf, final EntityResolver resolver, final ClassLoader loader) throws MappingException { loadDatabase(jdoConf, resolver, loader, null); } /** * Instantiates a ConnectionFactory from the JDO configuration file * * @param source {@link InputSource} pointing to the JDO configuration. * @param resolver An entity resolver. * @param loader A class loader * @throws MappingException If the database cannot be instantiated/loadeed. */ public static synchronized void loadDatabase(final InputSource source, final EntityResolver resolver, final ClassLoader loader) throws MappingException { // Load the JDO configuration file from the specified input source. JdoConf jdoConf = null; Unmarshaller unmarshaller = new Unmarshaller(JdoConf.class); try { unmarshaller.setEntityResolver(new DTDResolver(resolver)); jdoConf = (JdoConf) unmarshaller.unmarshal(source); } catch (MarshalException e) { LOG.info(NOTE_096); throw new MappingException(e); } catch (ValidationException e) { throw new MappingException(e); } LOG.debug("Loaded jdo conf successfully"); loadDatabase(jdoConf, resolver, loader, source.getSystemId()); } /** * Creates a entry for every database and associates them with their name in a * map. It then instantiates all databases if * 'org.exolab.castor.jdo.DatabaseInitializeAtLoad' key can not be found or is * set to <code>true</code> in castor.properties file. If above property is set * to <code>false</code> it will instantiate all databases only when they are * needed. * * @param jdoConf An in-memory jdo configuration. * @param resolver An entity resolver. * @param loader A class loader * @param baseURI The base URL for the mapping * @throws MappingException If the database cannot be instantiated/loadeed. */ private static synchronized void loadDatabase(final JdoConf jdoConf, final EntityResolver resolver, final ClassLoader loader, final String baseURI) throws MappingException { // Do we need to initialize database now or should we // wait until we want to use it. Configuration cfg = Configuration.getInstance(); boolean init = cfg.getProperty(ConfigKeys.INITIALIZE_AT_LOAD, true); // Load the JDO configuration file from the specified input source. // databases = JDOConfLoader.getDatabases(baseURI, resolver); Database[] databases = jdoConf.getDatabase(); AbstractConnectionFactory factory; for (int i = 0; i < databases.length; i++) { // Load the mapping file from the URL specified in the database // configuration file, relative to the configuration file. // Fail if cannot load the mapping for whatever reason. Mapping mapping = new Mapping(loader); if (resolver != null) { mapping.setEntityResolver(resolver); } if (baseURI != null) { mapping.setBaseURL(baseURI); } factory = DatabaseRegistry.createFactory(jdoConf, i, mapping); if (init) { factory.initialize(); } String name = databases[i].getName(); if (FACTORIES.put(name, factory) != null) { LOG.warn(Messages.format("jdo.configLoadedTwice", name)); } } } /** * Factory methode to create a ConnectionFactory for given database configuration * and given mapping. * * @param jdoConf An in-memory jdo configuration. * @param index Index of the database configuration inside the jdo configuration. * @param mapping The mapping to load. * @return The ConnectionFactory. * @throws MappingException If the database cannot be instantiated/loadeed. */ private static AbstractConnectionFactory createFactory( final JdoConf jdoConf, final int index, final Mapping mapping) throws MappingException { AbstractConnectionFactory factory; DatabaseChoice choice = jdoConf.getDatabase(index).getDatabaseChoice(); if (choice == null) { String name = jdoConf.getDatabase(index).getName(); String msg = Messages.format("jdo.missingDataSource", name); LOG.error(msg); throw new MappingException(msg); } if (choice.getDriver() != null) { // JDO configuration file specifies a driver, use the driver // properties to create a new registry object. factory = new DriverConnectionFactory(jdoConf, index, mapping); } else if (choice.getDataSource() != null) { // JDO configuration file specifies a DataSource object, use the // DataSource which was configured from the JDO configuration file // to create a new registry object. factory = new DataSourceConnectionFactory(jdoConf, index, mapping); } else if (choice.getJndi() != null) { // JDO configuration file specifies a DataSource lookup through JNDI, // locate the DataSource object frome the JNDI namespace and use it. factory = new JNDIConnectionFactory(jdoConf, index, mapping); } else { String name = jdoConf.getDatabase(index).getName(); String msg = Messages.format("jdo.missingDataSource", name); LOG.error(msg); throw new MappingException(msg); } return factory; } /** * Check if any database configuration has been loaded. * * @return <code>true</code> if a databases configuration has been loaded. */ public static boolean hasDatabaseRegistries() { return (!FACTORIES.isEmpty()); } /** * Check if database configuration with given name has been loaded. * * @param name Name of the database to check if loaded. * @return <code>true</code> if databases configuration has been loaded. */ public static boolean isDatabaseRegistred(final String name) { return FACTORIES.containsKey(name); } /** * Get the ConnectionFactory for the given database name. * * @param name Name of the database configuration. * @return The ConnectionFactory for the given database name. * @throws MappingException If database can not be instantiated. */ public static AbstractConnectionFactory getConnectionFactory(final String name) throws MappingException { if (LOG.isDebugEnabled()) { LOG.debug("Fetching ConnectionFactory: " + name); } AbstractConnectionFactory factory; factory = (AbstractConnectionFactory) FACTORIES.get(name); if (factory == null) { String msg = Messages.format("jdo.missingDataSource", name); LOG.error(msg); throw new MappingException(msg); } factory.initialize(); return factory; } /** * Reset all database configurations. */ public static void clear() { FACTORIES.clear(); } //-------------------------------------------------------------------------- /** * Hide constructor of utility class. */ private DatabaseRegistry() { } //-------------------------------------------------------------------------- }
[ "wguttmn@b24b0d9a-6811-0410-802a-946fa971d308" ]
wguttmn@b24b0d9a-6811-0410-802a-946fa971d308
68a7b3b7397e55c8e2edd7f27b45b595dc19e316
6439160f3b2d5a64156d4a3ef1c0baab2acee015
/src/main/java/com/publiccms/logic/service/cms/CmsContentService.java
59c37ed2f0ec3643d0a551bddac41afa4e762746
[]
no_license
puffershy/puffer-cms
c0c1c1bc4fc95cfedcca1b140146b48a6da6e252
69a0eeeab5fc8efa5dacb82cf73ef0de9d49b8b6
refs/heads/master
2020-04-05T18:01:40.022194
2018-11-11T15:05:23
2018-11-11T15:05:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,042
java
package com.publiccms.logic.service.cms; // Generated 2015-5-8 16:50:23 by com.sanluan.common.source.SourceMaker import static org.apache.commons.lang3.ArrayUtils.add; import static org.apache.commons.lang3.StringUtils.splitByWholeSeparator; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.concurrent.Future; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.publiccms.entities.cms.CmsCategory; import com.publiccms.entities.cms.CmsContent; import com.publiccms.logic.dao.cms.CmsCategoryDao; import com.publiccms.logic.dao.cms.CmsContentDao; import com.publiccms.views.pojo.CmsContentStatistics; import com.sanluan.common.base.BaseService; import com.sanluan.common.handler.FacetPageHandler; import com.sanluan.common.handler.PageHandler; @Service @Transactional public class CmsContentService extends BaseService<CmsContent> { public static final int STATUS_DRAFT = 0, STATUS_NORMAL = 1, STATUS_PEND = 2; @Transactional(readOnly = true) public PageHandler query(Integer siteId, String text, String tagId, Integer pageIndex, Integer pageSize) { return dao.query(siteId, text, tagId, pageIndex, pageSize); } @Transactional(readOnly = true) public FacetPageHandler facetQuery(Integer siteId, String categoryId, String modelId, String text, String tagId, Integer pageIndex, Integer pageSize) { return dao.facetQuery(siteId, categoryId, modelId, text, tagId, pageIndex, pageSize); } public void index(int siteId, Serializable[] ids) { dao.index(siteId, ids); } public Future<?> reCreateIndex() { return dao.reCreateIndex(); } @Transactional(readOnly = true) public PageHandler getPage(Integer siteId, Integer[] status, Integer categoryId, Boolean containChild, Boolean disabled, Integer[] modelId, Long parentId, Boolean emptyParent, Boolean onlyUrl, Boolean hasImages, Boolean hasFiles, String title, Long userId, Long checkUserId, Date startPublishDate, Date endPublishDate, String orderField, String orderType, Integer pageIndex, Integer pageSize) { return dao.getPage(siteId, status, categoryId, getCategoryIds(containChild, categoryId), disabled, modelId, parentId, emptyParent, onlyUrl, hasImages, hasFiles, title, userId, checkUserId, startPublishDate, endPublishDate, orderField, orderType, pageIndex, pageSize); } public void refresh(int siteId, Serializable[] ids) { Date now = getDate(); for (CmsContent entity : getEntitys(ids)) { if (notEmpty(entity) && STATUS_NORMAL == entity.getStatus() && siteId == entity.getSiteId()) { if (now.after(entity.getPublishDate())) { entity.setPublishDate(now); } } } } public List<CmsContent> check(int siteId, Long userId, Serializable[] ids) { List<CmsContent> entityList = new ArrayList<CmsContent>(); for (CmsContent entity : getEntitys(ids)) { if (notEmpty(entity) && siteId == entity.getSiteId() && STATUS_PEND == entity.getStatus()) { entity.setStatus(STATUS_NORMAL); entity.setCheckUserId(userId); entityList.add(entity); } } return entityList; } public CmsContent updateTagIds(Serializable id, String tagIds) { CmsContent entity = getEntity(id); if (notEmpty(entity)) { entity.setTagIds(tagIds); } return entity; } public void updateStatistics(Collection<CmsContentStatistics> entitys) { for (CmsContentStatistics entityStatistics : entitys) { CmsContent entity = getEntity(entityStatistics.getId()); if (notEmpty(entity)) { entity.setClicks(entity.getClicks() + entityStatistics.getClicks()); entity.setComments(entity.getComments() + entityStatistics.getComments()); entity.setScores(entity.getScores() + entityStatistics.getScores()); } } } public CmsContent updateCategoryId(int siteId, Serializable id, int categoryId) { CmsContent entity = getEntity(id); if (notEmpty(entity) && siteId == entity.getSiteId()) { entity.setCategoryId(categoryId); } return entity; } public CmsContent updateChilds(Serializable id, int num) { CmsContent entity = getEntity(id); if (notEmpty(entity)) { entity.setChilds(entity.getChilds() + num); } return entity; } public CmsContent updateUrl(Serializable id, String url, boolean hasStatic) { CmsContent entity = getEntity(id); if (notEmpty(entity)) { entity.setUrl(url); entity.setHasStatic(hasStatic); } return entity; } public int deleteByCategoryIds(int siteId, Integer[] categoryIds) { return dao.deleteByCategoryIds(siteId, categoryIds); } @SuppressWarnings("unchecked") public List<CmsContent> delete(int siteId, Serializable[] ids) { List<CmsContent> entityList = new ArrayList<CmsContent>(); for (CmsContent entity : getEntitys(ids)) { if (siteId == entity.getSiteId() && !entity.isDisabled()) { if (0 < entity.getChilds()) { for (CmsContent child : (List<CmsContent>) getPage(siteId, null, null, null, false, null, entity.getId(), null, null, null, null, null, null, null, null, null, null, null, null, null).getList()) { child.setDisabled(true); entityList.add(child); } } entity.setDisabled(true); entityList.add(entity); } } return entityList; } private Integer[] getCategoryIds(Boolean containChild, Integer categoryId) { Integer[] categoryIds = null; if (notEmpty(containChild) && containChild && notEmpty(categoryId)) { CmsCategory category = categoryDao.getEntity(categoryId); if (notEmpty(category) && notEmpty(category.getChildIds())) { String[] categoryStringIds = add(splitByWholeSeparator(category.getChildIds(), COMMA_DELIMITED), String.valueOf(categoryId)); categoryIds = new Integer[categoryStringIds.length + 1]; for (int i = 0; i < categoryStringIds.length; i++) { categoryIds[i] = Integer.parseInt(categoryStringIds[i]); } categoryIds[categoryStringIds.length] = categoryId; } } return categoryIds; } @Autowired private CmsContentDao dao; @Autowired private CmsCategoryDao categoryDao; }
[ "9440979@qq.com" ]
9440979@qq.com
1c5f80602fe7161315e628954842b55741ef0d16
4d5e297a1f8d52062b89b61220215361eeab7508
/LoginLogout_IntelliJ/GTW_Week02_Synchroon_LoginLogout/src/main/java/handlers/HomePageHandler.java
91d90c63d91061dce367d395b3e05ef161bc6490
[]
no_license
QuintenNouters/ucll-web4
84466e4097b851cbed5ab68629f53a3d64f670a4
b1c48bed28681a5bdb9433053d6452d85867fade
refs/heads/master
2021-09-21T19:31:07.024598
2018-08-30T19:14:17
2018-08-30T19:14:17
146,361,411
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
package handlers; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class HomePageHandler extends RequestHandler { @Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getRequestDispatcher("index.jsp").forward(request,response); } }
[ "36695424+QuintenNouters@users.noreply.github.com" ]
36695424+QuintenNouters@users.noreply.github.com
1555a2d569a733bde3ad5f56e2758e7c581a2866
b5e47070b981d8d1ec66c5f8ec14c84334285a4f
/src/com/dyf/test/FileInfo.java
367dd3f3056ccd09a79091ca5ca41b69b84007e2
[]
no_license
DongYF998/CountWord
e8e22f6d9e8b7d170aa25689c858a2a8877d507a
016f2efe10d04fe072921dd84642df4c3897e3c9
refs/heads/master
2021-09-23T13:06:03.409238
2018-09-23T06:31:06
2018-09-23T06:31:06
null
0
0
null
null
null
null
GB18030
Java
false
false
1,412
java
package com.dyf.test; /** * 该类的对象保存一个文本文件的所有我们需要的信息 * @author ASUS * */ public class FileInfo { private int wordsNum; private int linesNum; private int charsNum; private int codeLine; private int emptyLine; private int commtLine; public FileInfo(){ this.charsNum=0; this.codeLine =0; this.commtLine = 0; this.emptyLine = 0; this.linesNum = 0; this.wordsNum =0; } public int getWordsNum() { return wordsNum; } public void setWordsNum(int wordsNum) { this.wordsNum = wordsNum; } public int getLinesNum() { return linesNum; } public void setLinesNum(int linesNum) { this.linesNum = linesNum; } public int getCharsNum() { return charsNum; } public void setCharsNum(int charsNum) { this.charsNum = charsNum; } public int getCodeLine() { return codeLine; } public void setCodeLine(int codeLine) { this.codeLine = codeLine; } public int getEmptyLine() { return emptyLine; } public void setEmptyLine(int emptyLine) { this.emptyLine = emptyLine; } public int getCommtLine() { return commtLine; } public void setCommtLine(int commtLine) { this.commtLine = commtLine; } public String toString(){ return "charsNum:"+this.charsNum+'\n'+"wordsNum:"+this.wordsNum+'\n'+"linesNum:"+this.linesNum+'\n' +"codeLine:"+this.codeLine+'\n'+"commtLine:"+this.commtLine+'\n'+"emptyLine"+this.emptyLine; } }
[ "329640258@qq.com" ]
329640258@qq.com
52d97a00beb270f3b9998dfdf18e2397362faecf
d55e1dfef36b7d526b5613817f9b5be12c147d22
/src/main/java/pl/com/marcinkrol/cms/infrastructure/JPACinemaRepository.java
5e6f5acf89aa7b326298b3becfac63b3ff656217
[]
no_license
krolmarcin/cms
888cb682f2b87d6ad7b96db9789cfb4f0f877e47
95ee6667b6b6f9cef148b054389b395dc94f9937
refs/heads/master
2021-01-23T05:18:57.417660
2017-11-26T16:44:22
2017-11-26T16:44:22
92,965,224
0
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
package pl.com.marcinkrol.cms.infrastructure; import pl.com.marcinkrol.cms.domain.Cinema; import pl.com.marcinkrol.cms.domain.CinemaRepository; import pl.com.marcinkrol.cms.domain.EntityNotFoundException; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; public class JPACinemaRepository implements CinemaRepository { @PersistenceContext private EntityManager entityManager; @Override public void put(Cinema cinema) { entityManager.persist(cinema); } @Override public Cinema get(Long id) { Cinema cinema = entityManager.find(Cinema.class, id); if (cinema == null) throw new EntityNotFoundException("cinema", id); return cinema; } @Override public boolean exists(String name, String city) { String queryMessage = "FROM Cinema c WHERE c.name =:name AND c.city =:city"; Query query = entityManager.createQuery(queryMessage); query.setParameter("name", name); query.setParameter("city", city); return (!query.getResultList().isEmpty()); } }
[ "szeryfmk@gmail.com" ]
szeryfmk@gmail.com
f05f350c3c21bd0e1b9208fd2d8f2bf610ee8e2c
e033f42a03e98411f1b411978e1a9a57078ce15a
/src/main/java/Sammetestebot.java
3a709f4e140da68fd82a83dd2fdf82e2e898a814
[]
no_license
SammeJanderson/telegram-bot-tutorial
0ea9d67a78615f4017170dee979059960e10b855
6956f4a35f12038ca34f2b29a691e0f239b6b3f4
refs/heads/master
2023-01-23T20:03:33.112907
2020-12-01T21:16:13
2020-12-01T21:16:13
317,668,632
0
0
null
null
null
null
UTF-8
Java
false
false
1,772
java
import org.telegram.telegrambots.bots.TelegramLongPollingBot; import org.telegram.telegrambots.meta.api.methods.send.SendMessage; import org.telegram.telegrambots.meta.api.objects.Update; import org.telegram.telegrambots.meta.exceptions.TelegramApiException; public class Sammetestebot extends TelegramLongPollingBot { public String getBotUsername() { return ""; } public String getBotToken() { return ""; } public void onUpdateReceived(Update update) { // System.out.println(update.getMessage().getFrom().getFirstName()+" " + update.getMessage().getText()); String command = update.getMessage().getText(); SendMessage message = new SendMessage(); switch (command) { case "/myname": System.out.println(update.getMessage().getFrom().getFirstName()); message.setText(update.getMessage().getFrom().getFirstName()); break; case "/mylastname": System.out.println(update.getMessage().getFrom().getLastName()); message.setText(update.getMessage().getFrom().getLastName()); break; case "/myfullname": System.out.println(update.getMessage().getFrom().getFirstName() + " " + update.getMessage().getFrom().getLastName()); message.setText(update.getMessage().getFrom().getFirstName() + " " + update.getMessage().getFrom().getLastName()+""); break; } message.setChatId(String.valueOf(update.getMessage().getChatId())); try { execute(message); } catch (TelegramApiException e) { e.printStackTrace(); } } }
[ "samme.san@gmail.com" ]
samme.san@gmail.com
c5c3d44234e7bcf2da32dfc6584af9269a4dafc3
e19e3bdb2ff24f7856d8591c562e858872e53d79
/src/main/java/mx/edu/utez/model/user/DaoUser.java
483727b928283c17945ec406b37e073239c1a7e4
[]
no_license
Buongsito/appweb.deleteUser.Buongsito
7f04d985d3cc7623ee49fd579f3c14aa388e1aef
1cf8ad7282daefda820031c79decb920dd52196e
refs/heads/main
2023-06-20T17:14:56.678647
2021-07-26T13:26:52
2021-07-26T13:26:52
389,636,379
0
0
null
null
null
null
UTF-8
Java
false
false
6,963
java
package mx.edu.utez.model.user; import mx.edu.utez.model.person.BeanPerson; import mx.edu.utez.model.role.BeanRole; import mx.edu.utez.service.ConnectionMySQL; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.*; import java.util.ArrayList; import java.util.List; public class DaoUser { Connection con; CallableStatement cstm; ResultSet rs; Logger logger = LoggerFactory.getLogger(DaoUser.class); public List<BeanUser> findAll(){ List<BeanUser> listUsers = new ArrayList<>(); try { // SELECT * FROM users AS U INNER JOIN persons AS P ON U.idPerson = P.id INNER JOIN roles AS R ON U.idRole = R.id; con = ConnectionMySQL.getConnection(); cstm = con.prepareCall("{call sp_findAll}"); rs = cstm.executeQuery(); while(rs.next()){ BeanRole role = new BeanRole(); BeanPerson person = new BeanPerson(); BeanUser user = new BeanUser(); role.setId(rs.getInt("idRole")); role.setDescription(rs.getString("nameRole")); person.setId(rs.getLong("idPerson")); person.setName(rs.getString("name")); person.setLastname(rs.getString("lastname")); person.setEdad(rs.getInt("age")); user.setId(rs.getLong("idUser")); user.setEmail(rs.getString("email")); user.setPassword(rs.getString("password")); user.setStatus(rs.getInt("status")); user.setIdPerson(person); user.setIdRole(role); listUsers.add(user); } }catch (SQLException e){ logger.error("Ha ocurrido un error: " + e.getMessage()); } finally { ConnectionMySQL.closeConnections(con, cstm, rs); } return listUsers; } public BeanUser findById(long id){ BeanUser user = null; try { // SELECT * FROM users AS U INNER JOIN persons AS P ON U.idPerson = P.id INNER JOIN roles AS R ON U.idRole = R.id; con = ConnectionMySQL.getConnection(); cstm = con.prepareCall("SELECT * FROM user AS U INNER JOIN person AS P ON U.idPersons = P.idPerson INNER JOIN roles AS R ON U.idRoles = R.idRole WHERE U.idUser = ?"); cstm.setLong(1, id); rs = cstm.executeQuery(); if(rs.next()){ BeanRole role = new BeanRole(); BeanPerson person = new BeanPerson(); user = new BeanUser(); role.setId(rs.getInt("idRole")); role.setDescription(rs.getString("nameRole")); person.setId(rs.getLong("idPerson")); person.setName(rs.getString("name")); person.setLastname(rs.getString("lastname")); person.setEdad(rs.getInt("age")); user.setId(rs.getLong("idUser")); user.setEmail(rs.getString("email")); user.setPassword(rs.getString("password")); user.setStatus(rs.getInt("status")); user.setIdPerson(person); user.setIdRole(role); } }catch (SQLException e){ logger.error("Ha ocurrido un error: " + e.getMessage()); } finally { ConnectionMySQL.closeConnections(con, cstm, rs); } return user; } public boolean create(BeanUser user){ boolean flag = false; try{ con = ConnectionMySQL.getConnection(); cstm = con.prepareCall("{call sp_create(?,?,?,?,?,?)}"); cstm.setString(1, user.getIdPerson().getName()); cstm.setString(2, user.getIdPerson().getLastname()); cstm.setInt(3, user.getIdPerson().getEdad()); cstm.setString(4, user.getEmail()); cstm.setString(5, user.getPassword()); cstm.setInt(6, user.getIdRole().getId()); cstm.execute(); flag = true; }catch(SQLException e){ logger.error("Ha ocurrido un error: " + e.getMessage()); } finally { ConnectionMySQL.closeConnections(con, cstm); } return flag; } public boolean update(BeanUser user){ boolean flag = false; try{ con = ConnectionMySQL.getConnection(); cstm = con.prepareCall("{call sp_update(?,?,?,?,?,?,?)}"); cstm.setString(1, user.getIdPerson().getName()); cstm.setString(2, user.getIdPerson().getLastname()); cstm.setInt(3, user.getIdPerson().getEdad()); cstm.setString(4, user.getEmail()); cstm.setString(5, user.getPassword()); cstm.setInt(6, user.getIdRole().getId()); cstm.setLong(7, user.getId()); flag = cstm.execute(); }catch(SQLException e){ logger.error("Ha ocurrido un error: " + e.getMessage()); }finally{ ConnectionMySQL.closeConnections(con, cstm); } return flag; } public boolean delete(long idUser){ boolean flag = false; try{ con = ConnectionMySQL.getConnection(); cstm = con.prepareCall("{call sp_delete2(?)}"); cstm.setLong(1, idUser); flag = cstm.execute(); }catch(SQLException e){ logger.error("Ha ocurrido un error: " + e.getMessage()); }finally{ ConnectionMySQL.closeConnections(con, cstm); } return flag; } /* public static void main(String[] args) { BeanUser beanUser = new BeanUser(); BeanPerson beanPerson = new BeanPerson(); BeanRole beanRole = new BeanRole(); DaoUser daoUser = new DaoUser(); // Listando usuarios List<BeanUser> listUsers = new ArrayList<>(); listUsers = daoUser.findAll(); for (int i = 0; i < listUsers.size(); i++){ System.out.println(listUsers.get(i).getEmail()); } /* // Registrando usuarios boolean registed = false; beanRole.setId(1); beanPerson.setName("Paty"); beanPerson.setLastname("Morales"); beanPerson.setEdad(29); beanUser.setEmail("patymorales@utez.edu.mx"); beanUser.setPassword("admin1234"); beanUser.setIdPerson(beanPerson); beanUser.setIdRole(beanRole); registed = daoUser.create(beanUser); System.out.println("Se ha registrado correctamente"); */ // Eliminar de manera "baja lógica" /* boolean flag = false; flag = daoUser.delete(4); System.out.println("Se realizó correctamente"); }*/ }
[ "noreply@github.com" ]
noreply@github.com
1b23045fc58fc53279183475d820d13f24f3f95c
51b861e0236d56e03cdd0a4354b3a95d187a5152
/app/src/main/java/com/logzero/necommerce/menselection/fragment/JeansFragment.java
f12dadfa3930ec8229c5410f08e4cb3055f0a541
[]
no_license
devtadiyal/FashionDummyApp
421becaaf96be42acb3be72a706a0c5dbf1f59ee
4d2e443acfbe5f86119f1aec9aa3ebd9e5fc1bd9
refs/heads/master
2020-07-07T08:35:58.224378
2019-08-27T12:30:38
2019-08-27T12:30:38
203,305,361
1
0
null
null
null
null
UTF-8
Java
false
false
2,318
java
package com.logzero.necommerce.menselection.fragment; import android.content.Context; import android.net.Uri; import android.os.Bundle; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.logzero.necommerce.R; import com.logzero.necommerce.utility.Data; import com.logzero.necommerce.womenselection.fragment.DataAdapter; import com.logzero.necommerce.womenselection.fragment.ShoesModel; import java.util.ArrayList; public class JeansFragment extends Fragment { RecyclerView recyclerView; public JeansFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_jeans, container, false); recyclerView = view.findViewById(R.id.rv); initViews(); return view; } private void initViews() { recyclerView.setHasFixedSize(true); RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(), 1); recyclerView.setLayoutManager(layoutManager); ArrayList<ShoesModel> androidVersions = prepareData(); DataAdapter adapter = new DataAdapter(getContext(), androidVersions,"JeansFragment"); recyclerView.setAdapter(adapter); } private ArrayList<ShoesModel> prepareData() { ArrayList<ShoesModel> android_version = new ArrayList<>(); for (int i = 0; i < Data.jeans_image.length; i++) { ShoesModel androidVersion = new ShoesModel(); androidVersion.setName(Data.jeans_name[i]); androidVersion.setImage(Data.jeans_image[i]); androidVersion.setSubtitle(Data.jeans_subtitle[i]); androidVersion.setPrice(Data.jeans_price[i]); android_version.add(androidVersion); } return android_version; } }
[ "development.server@IRBINTERNAL.LOCAL" ]
development.server@IRBINTERNAL.LOCAL
543a144378d8b180f4d114ef4fb879061695bab7
83dc78b1f4c27c016207766ef91ac59b6f5f6023
/src/main/java/com/phicomm/smarthome/ssp/server/service/impl/ManagerUserIncomeServicImpl.java
0fdcbf3403a68b7c895f236a1a4d22b80a10603f
[]
no_license
landsharkd/withdraw
d4bea05cd72f927dbc97771e1c26130aa6239376
2aa54c47f248cb21981af149dab4e4fa8bb82117
refs/heads/master
2020-03-19T13:02:32.589307
2018-06-13T08:06:54
2018-06-13T08:06:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,684
java
package com.phicomm.smarthome.ssp.server.service.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.phicomm.smarthome.ssp.server.consts.Const; import com.phicomm.smarthome.ssp.server.consts.Const.ManagementBillVar; import com.phicomm.smarthome.ssp.server.dao.ManagerUserIncomeMapper; import com.phicomm.smarthome.ssp.server.model.SwRouterModel; import com.phicomm.smarthome.ssp.server.model.SwUserIncomeModel; import com.phicomm.smarthome.ssp.server.model.request.RequestIncomeRecordModel; import com.phicomm.smarthome.ssp.server.model.request.RequestSwUserModel; import com.phicomm.smarthome.ssp.server.model.response.ResponseIncomeRedordModel; import com.phicomm.smarthome.ssp.server.model.response.ResponseUserInfoListModel; import com.phicomm.smarthome.ssp.server.model.response.ResponseUserInfoModel; import com.phicomm.smarthome.ssp.server.service.ManagerUserIncomeService; import com.phicomm.smarthome.ssp.server.util.AccountDateUtil; import com.phicomm.smarthome.ssp.server.util.CommonUtils; import com.phicomm.smarthome.ssp.server.util.MyListUtils; import com.phicomm.smarthome.ssp.server.util.NumberUtils; import com.phicomm.smarthome.util.OptDateUtil; import com.phicomm.smarthome.util.StringUtil; /** * @author fujiang.mao * */ @Service public class ManagerUserIncomeServicImpl implements ManagerUserIncomeService { public static final Logger LOGGER = LogManager.getLogger(ManagerUserIncomeServicImpl.class); @Autowired private ManagerUserIncomeMapper managerUserIncomeMapper; @Override public ResponseUserInfoListModel getUserInfoList(RequestSwUserModel model) { ResponseUserInfoListModel rspModel = new ResponseUserInfoListModel(); try { // 设置时间戳 if (!StringUtil.isNullOrEmpty(model.getUseStartDate()) && !StringUtil.isNullOrEmpty(model.getUseEndDate())) { // 将日期xxxx/xx/xx转为xxxx-xx-xx格式 model.setUseStartDate(AccountDateUtil.reverseDateFormat(model.getUseStartDate())); model.setUseEndDate(AccountDateUtil.reverseDateFormat(model.getUseEndDate())); // 筛选时间戳范围 model.setStartTimeTs(OptDateUtil.getLTimeByStr(model.getUseStartDate() + " 00:00:00")); model.setEndTimeTs(OptDateUtil.getLTimeByStr(model.getUseEndDate() + " 23:59:59")); } // 分页查询用户信息 List<ResponseUserInfoModel> list = new ArrayList<>(); try { // 计算起始下标跟偏移量,进行分页查询 model.setStartIndex((model.getCurPage() - 1) * model.getPageSize()); model.setOffset(model.getPageSize()); list = managerUserIncomeMapper.getUserInfoList(model); int count = managerUserIncomeMapper.countUserInfoList(model); // 计算总页码数 rspModel.setTotalCount(count); if (MyListUtils.isEmpty(list)) { rspModel.setUserList(list); return rspModel; } } catch (Exception e) { LOGGER.error("ManagerUserIncomeServicImpl's getUserInfoList method error!"); LOGGER.error(e); rspModel.setUserList(list); rspModel.setRetCode(Const.ResponseStatus.STATUS_COMMON_QUERY_FAILED); rspModel.setRetMsg(Const.ResponseStatus.STATUS_COMMON_QUERY_FAILED_STR); } // 设置开启时间跟拼接uid StringBuilder stringBuilder = new StringBuilder(); for (ResponseUserInfoModel userInfo : list) { String activeTime = userInfo.getUseStartTime(); if (Integer.valueOf(activeTime) == 0) { userInfo.setUseStartTime(ManagementBillVar.USER_ACCOUNT_NOT_BIND_ANY_ROUTER_EXPIRE_TIME_DESC); } else { userInfo.setUseStartTime(CommonUtils.stampToDateTimeStr(Long.valueOf(userInfo.getUseStartTime()))); } stringBuilder.append(userInfo.getUid() + ","); } String uids = stringBuilder.toString(); // 查询用户总收益跟总余额 if (!StringUtil.isNullOrEmpty(uids)) { uids = uids.substring(0, uids.length() - 1); // 标记用户总收益 List<Map<String, Object>> incomeList = new ArrayList<>(); try { incomeList = managerUserIncomeMapper.getUserTotalIncomeByUids(uids); } catch (Exception e) { LOGGER.error("ManagerUserIncomeServicImpl's getUserInfoList method error!"); LOGGER.error(e); rspModel.setUserList(list); rspModel.setRetCode(Const.ResponseStatus.STATUS_COMMON_QUERY_FAILED); rspModel.setRetMsg(Const.ResponseStatus.STATUS_COMMON_QUERY_FAILED_STR); return rspModel; } Map<String, Object> incomeMap = new HashMap<String, Object>(); if (!MyListUtils.isEmpty(incomeList)) { for (Map<String, Object> map : incomeList) { incomeMap.put((String) map.get("uid"), map.get("total_income")); } } // 标记用户总余额 List<Map<String, Object>> balanceList = new ArrayList<>(); try { balanceList = managerUserIncomeMapper.getUserTotalBalanceByUids(uids); } catch (Exception e) { LOGGER.error("ManagerUserIncomeServicImpl's getUserInfoList method error!"); LOGGER.error(e); rspModel.setUserList(list); rspModel.setRetCode(Const.ResponseStatus.STATUS_COMMON_QUERY_FAILED); rspModel.setRetMsg(Const.ResponseStatus.STATUS_COMMON_QUERY_FAILED_STR); return rspModel; } Map<String, Object> balanceMap = new HashMap<String, Object>(); if (!MyListUtils.isEmpty(balanceList)) { for (Map<String, Object> map : balanceList) { balanceMap.put((String) map.get("uid"), map.get("total_balance")); } } // 设置用户总收益跟总余额的值 for (ResponseUserInfoModel userInfo : list) { userInfo.setTotalIncome(incomeMap.get(userInfo.getUid()) == null ? "0" : (String) incomeMap.get(userInfo.getUid())); userInfo.setCurrentBalance(balanceMap.get(userInfo.getUid()) == null ? "0" : (String) balanceMap.get(userInfo.getUid())); } incomeMap = null; balanceMap = null; } rspModel.setUserList(list); } catch (Exception e) { LOGGER.error("ManagerUserIncomeServicImpl's getUserInfoList method error!"); LOGGER.error(e); } return rspModel; } @Override public List<ResponseIncomeRedordModel> getIncomeRecordList(RequestIncomeRecordModel model) { try { List<ResponseIncomeRedordModel> incomeRedord = new ArrayList<ResponseIncomeRedordModel>(); if (!StringUtil.isNullOrEmpty(model.getRewardStartDate()) && !StringUtil.isNullOrEmpty(model.getRewardEndDate())) { // 将日期xxxx/xx/xx转为xxxx-xx-xx格式 model.setRewardStartDate(AccountDateUtil.reverseDateFormat(model.getRewardStartDate())); model.setRewardEndDate(AccountDateUtil.reverseDateFormat(model.getRewardEndDate())); // 筛选时间戳范围 model.setStartTimeTs(OptDateUtil.getLTimeByStr(model.getRewardStartDate() + " 00:00:00")); model.setEndTimeTs(OptDateUtil.getLTimeByStr(model.getRewardEndDate() + " 23:59:59")); } // 获取用户收益信息 List<SwUserIncomeModel> userIncomeList = managerUserIncomeMapper.getUserIncomeList(model); if (userIncomeList != null && userIncomeList.size() > 0) { Map<String, Object> uidMap = new HashMap<String, Object>(); Map<String, Object> iphoneMap = new HashMap<String, Object>(); Map<String, Object> incomeMap = new HashMap<String, Object>(); Map<String, Object> routerMap = new HashMap<String, Object>(); String orderIds = ""; String routerMacs = ""; for (SwUserIncomeModel income : userIncomeList) { orderIds += "'" + income.getOrderId() + "',"; uidMap.put(income.getOrderId(), income.getUid()); iphoneMap.put(income.getOrderId(), income.getIphone()); incomeMap.put(income.getOrderId(), income.getTodayIncome()); routerMacs += "'" + income.getRouterMac() + "',"; } if (!StringUtil.isNullOrEmpty(orderIds)) { orderIds = orderIds.substring(0, orderIds.length() - 1); } if (!StringUtil.isNullOrEmpty(routerMacs)) { routerMacs = routerMacs.substring(0, routerMacs.length() - 1); } if (!StringUtil.isNullOrEmpty(orderIds)) { // 获取订单信息 incomeRedord = managerUserIncomeMapper.getIncomeRedordInfoByOrderIds(orderIds); } if (incomeRedord != null && incomeRedord.size() > 0) { for (ResponseIncomeRedordModel record : incomeRedord) { record.setRewardTime(OptDateUtil.stampToDate(record.getBuyTime())); record.setUid(uidMap.get(record.getWxOrderId()) == null ? "" : (String) uidMap.get(record.getWxOrderId())); record.setIphone(iphoneMap.get(record.getWxOrderId()) == null ? "" : (String) iphoneMap.get(record.getWxOrderId())); record.setUserIncome(incomeMap.get(record.getWxOrderId()) == null ? "" : (String) incomeMap.get(record.getWxOrderId())); // 分转元 record.setRewardMoney(NumberUtils.changeF2YZero(record.getRewardMoney())); record.setCompanyIncome( NumberUtils.bigdecimalSubByStr(record.getRewardMoney(), record.getUserIncome())); record.setIpAddress(record.getIpAddress() == null ? "" : record.getIpAddress()); } } if (!StringUtil.isNullOrEmpty(routerMacs)) { List<SwRouterModel> routerInfos = managerUserIncomeMapper.getRouterInfoByMacs(routerMacs); if (routerInfos != null && routerInfos.size() > 0) { for (SwRouterModel swRouterModel : routerInfos) { routerMap.put(swRouterModel.getRouterMac(), swRouterModel.getRouterIp()); } } if (incomeRedord != null && incomeRedord.size() > 0) { for (ResponseIncomeRedordModel record : incomeRedord) { record.setIpAddress(routerMap.get(record.getMacAddress()) == null ? "" : (String) routerMap.get(record.getMacAddress())); } } } uidMap = null; iphoneMap = null; incomeMap = null; routerMap = null; } return incomeRedord; } catch (Exception e) { LOGGER.error("getIncomeRecordList error " + e.getMessage()); } return null; } @Override public int getIncomeRecordListCount(RequestIncomeRecordModel model) { try { return managerUserIncomeMapper.getUserIncomeListCount(model); } catch (Exception e) { LOGGER.error("getIncomeRecordListCount error " + e.getMessage()); } return 0; } }
[ "lei.du@phicomm.com" ]
lei.du@phicomm.com
051319ac11cdae0e22e981c35bb3ab4ffd11c37a
9f27b9da45d5f54feddeb3367c1d7944b7283733
/lang/java/avro/src/test/java/NoPackage.java
1d896144075b5691cf25b4c7cf84f74445614391
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
permissive
zolyfarkas/avro
a151b8d5cdd3e26e6cba2b34563e3a48f335a74e
dae9b44dc61a475f8c9d1164646bc3547fcb97ee
refs/heads/trunk
2023-01-04T01:57:17.409955
2022-12-22T12:48:14
2022-12-22T12:48:14
161,528,778
18
11
Apache-2.0
2019-05-22T09:34:34
2018-12-12T18:28:41
Java
UTF-8
Java
false
false
878
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. */ /** I am a class without a package. */ public interface NoPackage { }
[ "cutting@apache.org" ]
cutting@apache.org
65bbdcfa0df19059bd435f7dc3292da955771ecf
ac570cd802cf7f7dd37347c336fdb3ed22da55f9
/app/app/src/main/java/bean/CardKind.java
0af23c5fe06ffb1fd0f4a662f3438b591d018d0c
[]
no_license
echofzoe/final_desi
c766eb86bf78a2e0390f8439ff2571c91868a5bf
3acd1dd01b3d723c7bbacb7e26e5e381b1ea454b
refs/heads/master
2022-12-20T12:17:35.398994
2020-05-15T23:14:16
2020-05-15T23:14:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,869
java
package bean; /** * 会员卡种类 * Created by Thor on 2018/4/6. */ public class CardKind { private Integer id; private Integer pId; private String pName; private String cardKName; private Integer capacity; private Integer expend; private String picUrl; public String getPicUrl() { return picUrl; } public void setPicUrl(String picUrl) { this.picUrl = picUrl; } public CardKind() { super(); } public CardKind(Integer id, Integer pId, String pName, String cardKName, Integer capacity, Integer expend) { super(); this.id = id; this.pId = pId; this.pName = pName; this.cardKName = cardKName; this.capacity = capacity; this.expend = expend; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getpId() { return pId; } public void setpId(Integer pId) { this.pId = pId; } public String getpName() { return pName; } public void setpName(String pName) { this.pName = pName; } public String getCardKName() { return cardKName; } public void setCardKName(String cardKName) { this.cardKName = cardKName; } public Integer getCapacity() { return capacity; } public void setCapacity(Integer capacity) { this.capacity = capacity; } public Integer getExpend() { return expend; } public void setExpend(Integer expend) { this.expend = expend; } @Override public String toString() { return "CardKind [id=" + id + ", pId=" + pId + ", pName=" + pName + ", cardKName=" + cardKName + ", capacity=" + capacity + ", expend=" + expend + "]"; } }
[ "925865936@qq.com" ]
925865936@qq.com
18d4811c667ade8c2a0defd893c9ea8ddbbae97b
542c90bed5fce571f72b0f3405e3180848fd8db9
/UML Lab Shop Example/src/com/yattasolutions/umllab/examples/shop/Human.java
e6bcb69cf89a87b83b002fa065ad5890a5db2556
[]
no_license
FredericEbelshaeuser/de.yatta.test.umllab
d992f2f08e8d009e9da2b2a3d019083a7922f212
915d2e36c359a034a651387f86183efc1af9dde5
refs/heads/master
2022-12-16T01:09:16.024088
2020-08-28T18:02:16
2020-08-28T18:02:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package com.yattasolutions.umllab.examples.shop; import javax.persistence.Entity; @Entity public interface Human { public int getAge(); public String getGender(); public String getName(); public void setAge(int value); public void setGender(String value); public void setName(String value); }
[ "ebelshaeuser@yatta.de" ]
ebelshaeuser@yatta.de
c9163a502bdb7cee05b57aa56797ad937215b901
a5824e3f225c5f0ad1af386a65917ed2cfa857f8
/gim-java/src/main/java/com/gettyio/gim/message/MessagEmitter.java
05783e289f96358af3b8f909a4cdd9466c64473b
[ "Apache-2.0" ]
permissive
youbooks/gim
66a9a40868bc044bc001a786abd3b33dc877d615
c182646104c97db9fee238845d92d6cd7b52a953
refs/heads/master
2022-06-30T16:49:26.909046
2020-05-09T10:11:13
2020-05-09T10:11:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,393
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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.gettyio.gim.message; import com.gettyio.core.channel.SocketChannel; import com.gettyio.gim.comm.Const; import com.gettyio.gim.packet.MessageClass; import com.gettyio.gim.packet.MessageInfo; import com.gettyio.gim.server.GimContext; import com.google.protobuf.util.JsonFormat; import java.util.List; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; /** * MessagEmitter.java * * @description:消息发送类 * @author:gogym * @date:2020/4/10 * @copyright: Copyright by gettyio.com */ public class MessagEmitter { private GimContext gimContext; public MessagEmitter(GimContext gimContext) { this.gimContext = gimContext; } /** * 发送消息,会加入重写确认,离线 * * @param userId * @param msg * @see */ public void sendToUser(String userId, MessageClass.Message msg) throws Exception { String channelId = gimContext.userChannelMap.get(userId); if (channelId != null) { SocketChannel channel = gimContext.channels.find(channelId); if (channel == null) { throw new Exception("[channel is null error]"); } //放入重发队列中 MessageDelayPacket mdp = new MessageDelayPacket(msg, Const.MSG_DELAY); gimContext.delayMsgQueue.put(mdp); channel.writeAndFlush(msg); return; } else if (gimContext.gimConfig.isEnableCluster()) { String serverId = gimContext.clusterRoute.getUserRoute(userId); if (serverId != null) { MessageDelayPacket mdp = new MessageDelayPacket(msg, Const.MSG_DELAY); gimContext.delayMsgQueue.put(mdp); //查找服务路由 gimContext.clusterRoute.sendToCluster(msg, serverId); return; } } //如果找不到连接,则离线处理 if (gimContext.offlineMsgListener != null) { //离线消息 String msgJson = JsonFormat.printer().print(msg); gimContext.offlineMsgListener.onMsg(msgJson); } } /** * 发送但不加入重写队列 * * @param userId * @param msg * @return void */ public void sendToUserNoReWrite(String userId, MessageClass.Message msg) throws Exception { String channelId = gimContext.userChannelMap.get(userId); if (channelId != null) { SocketChannel channel = gimContext.channels.find(channelId); if (channel == null) { throw new Exception("[channel is null error]"); } channel.writeAndFlush(msg); return; } else if (gimContext.gimConfig.isEnableCluster()) { String serverId = gimContext.clusterRoute.getUserRoute(userId); if (serverId != null) { //查找服务路由 gimContext.clusterRoute.sendToCluster(msg, serverId); return; } } if (gimContext.offlineMsgListener != null) { //离线消息 String msgJson = JsonFormat.printer().print(msg); gimContext.offlineMsgListener.onMsg(msgJson); } } /** * 单纯发送给用户,不重写也不离线 * * @param userId * @param msg * @return void */ public void sendToUserOnly(String userId, MessageClass.Message msg) throws Exception { String channelId = gimContext.userChannelMap.get(userId); if (channelId != null) { SocketChannel channel = gimContext.channels.find(channelId); if (channel == null) { throw new Exception("[channel is null error]"); } channel.writeAndFlush(msg); } } /** * 发到一个群 * * @param groupId * @param msg * @throws Exception * @see */ public void sendToGroup(String groupId, MessageClass.Message msg) throws Exception { if (null != msg.getServerId() && !"".equals(msg.getServerId())) { //如果消息服务器ID不等于空,则这条消息是通过集群路由过来的。此时应直接在本机处理 sendToUser(msg.getReceiverId(), msg); } else { // 先判断是否开启集群 if (gimContext.gimConfig.isEnableCluster()) { Set<String> set = gimContext.clusterRoute.getGroupRoute(groupId); //群信息不转发给发送者,因此先将发送者移除 set.remove(msg.getSenderId()); if (set != null) { for (String string : set) { //发送时把群消息接收者ID设置进去,表示这条信息是给这个人的 MessageClass.Message.Builder builder = msg.toBuilder().setReceiverId(string); sendToUser(string, builder.build()); } } } else { CopyOnWriteArrayList<String> list = gimContext.groupUserMap.get(groupId); if (list != null) { for (String string : list) { if (msg.getSenderId().equals(string)) { //群信息不转发给发送者 continue; } //发送时把群消息接收者ID设置进去 MessageClass.Message.Builder builder = msg.toBuilder().setReceiverId(string); sendToUser(string, builder.build()); } } } } } //----------------------------------------------------------------------------------------------------------------------------- /** * 发送用户绑定消息成功结果 * * @return void * @params [userId] */ public void sendBindResp(String userId) throws Exception { MessageClass.Message msg = MessageGenerate.getInstance(gimContext.gimConfig.getServerId()).createBindResp(userId); sendToUserOnly(userId, msg); } /** * 发送用户解绑消息成功结果 * * @param userId * @throws Exception */ public void sendUnbindResp(String userId) throws Exception { MessageClass.Message msg = MessageGenerate.getInstance(gimContext.gimConfig.getServerId()).createUnbindResp(userId); sendToUserOnly(userId, msg); } /** * 发送单聊消息 * * @return void * @params [sendlerId, receiverId, text] */ public void sendSingleChatMsg(String sendlerId, String senderName, String senderHeadImgUrl, String receiverId, String receiverName, String receiverHeadImgUrl, Integer bodyType, String body, Integer bodyLength) throws Exception { MessageClass.Message msg = MessageGenerate.getInstance(gimContext.gimConfig.getServerId()).createSingleChatReq(sendlerId, senderName, senderHeadImgUrl, receiverId, receiverName, receiverHeadImgUrl, bodyType, body, bodyLength); sendToUser(receiverId, msg); } /** * 发送群聊消息 * * @return void * @params [sendlerId, receiverId, text] */ public void sendGroupChatMsg(String sendlerId, String senderName, String senderHeadImgUrl, String groupId, String groupName, String groupHeadImgUrl, Integer bodyType, String body, Integer bodyLength, List<String> atUserId) throws Exception { MessageClass.Message msg = MessageGenerate.getInstance(gimContext.gimConfig.getServerId()).createGroupChatReq(sendlerId, senderName, senderHeadImgUrl, groupId, groupName, groupHeadImgUrl, bodyType, body, bodyLength, atUserId); sendToGroup(groupId, msg); } /** * 发送自定消息 * * @param messageInfo * @throws Exception */ public void sendMessageToUser(MessageInfo messageInfo) throws Exception { if (null != messageInfo) { MessageClass.Message msg = MessageGenerate.getInstance(null).createMessage(messageInfo); sendToUser(messageInfo.getReceiverId(), msg); } } /** * 发送自定消息到群组 * * @param messageInfo * @throws Exception */ public void sendMessageToGroup(MessageInfo messageInfo) throws Exception { if (null != messageInfo) { MessageClass.Message msg = MessageGenerate.getInstance(null).createMessage(messageInfo); sendToUser(messageInfo.getGroupId(), msg); } } }
[ "34082822+gogym@users.noreply.github.com" ]
34082822+gogym@users.noreply.github.com
6bdfd4f48d6717cc05321d0e8cee8e6f690d1cd1
24bdba763e71cf4636bd76c0b4de72b02095fc23
/fuwesta-sample/src/test/java/de/ppi/samples/fuwesta/selophane/test/OptimisticLockPostIntegrationTest.java
7cb2b92cacebcfee9ff6d324df33917a79681cc6
[ "Apache-2.0" ]
permissive
opensource21/fuwesta
adbd94670405ac069ee27a59573038086a6ae9e1
904af3ef6ce4bd3747498c70b7062c498b0b36da
refs/heads/master
2021-05-02T07:36:53.242293
2017-02-16T10:53:56
2017-02-16T10:53:56
13,317,929
5
3
null
null
null
null
UTF-8
Java
false
false
5,007
java
package de.ppi.samples.fuwesta.selophane.test; import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.IDataSet; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import org.openqa.selenium.By; import org.selophane.elements.base.ByUniqueElementLocator; import org.selophane.elements.base.Element; import org.selophane.elements.widget.Link; import org.selophane.elements.widget.LinkImpl; import org.selophane.elements.widget.TextInput; import de.ppi.samples.fuwesta.dbunit.dataset.TestData; import de.ppi.samples.fuwesta.frontend.URL; import de.ppi.samples.fuwesta.selophane.module.AuthModule; import de.ppi.samples.fuwesta.selophane.module.PostModule; import de.ppi.samples.fuwesta.selophane.page.PartialPostFormPage; import de.ppi.samples.fuwesta.selophane.page.PostFormPage; import de.ppi.selenium.browser.SessionManager; import de.ppi.selenium.browser.WebBrowser; import de.ppi.selenium.junit.WebDriverRule.Browser; import de.ppi.selenium.logevent.api.EventActions; import de.ppi.selenium.logevent.api.Priority; /** * Test for the post-page. * */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class OptimisticLockPostIntegrationTest extends AbstractPostIntegrationTest { /** * An instance of the {@link SessionManager}. */ private static final SessionManager SESSION_MANAGER = SessionManager .getInstance(); /** * {@inheritDoc} */ @Override protected IDataSet getDataSet() throws DataSetException { return TestData.initWithSampleData(); } /** * Test edit in two sessions. * * @throws Exception when something goes wrong. */ @Test @Browser(forceRestart = true) public void testOptimisticLock() throws Exception { // Prepare first browser and goto the edit-page final WebBrowser firstBrowser = browser; final PostFormPage firstFormPage = new PostFormPage(firstBrowser); final PostModule firstPostModule = postModule; final String originalTitle = "Title 1"; firstPostModule.navigateToEdit(originalTitle); softly.assertThat(firstBrowser).hasRalativeUrlMatching( URL.filledURLWithNamedParams(URL.Post.EDIT, URL.Post.P_POSTID, "101")); // Prepare second browser and goto the edit-page final WebBrowser secondBrowser = SESSION_MANAGER.getNewSession(); final PartialPostFormPage secondForm = new PartialPostFormPage(secondBrowser); final PostModule secondPostModule = new PostModule(secondBrowser); final AuthModule secondAuthModule = new AuthModule(secondBrowser); SESSION_MANAGER.switchToSession(secondBrowser); secondBrowser.getRelativeUrl(URL.Post.LIST); secondAuthModule.login("post"); secondPostModule.navigateToEdit(originalTitle); softly.assertThat(browser).hasRalativeUrlMatching( URL.filledURLWithNamedParams(URL.Post.EDIT, URL.Post.P_POSTID, "101")); // Change the title and save. final String changedTitle = "OptimisticLock"; secondForm.getTitleInput().set(changedTitle); secondForm.getSave().click(); softly.assertThat(secondBrowser).hasRelativeUrl(URL.Post.LIST); // Back to the first browser SESSION_MANAGER.switchToSession(firstBrowser); final TextInput content = firstFormPage.getContentInput(); content.set(changedTitle); final String url = firstBrowser.getCurrentUrl(); firstFormPage.getSave().click(); firstFormPage.isReloaded(); EVENT_LOGGER .onDoku(OptimisticLockPostIntegrationTest.class.getName(), "testOptimisticLock") .withScreenshot(Priority.DOCUMENTATION, firstBrowser) .log(EventActions.TEST_SCREENSHOT, "Show optimistic lock-error"); final List<Element> messages = firstFormPage.getGlobalErrors().getMessages(); softly.assertThat(messages).hasSize(1); final Element error = messages.get(0); softly.assertThat(error).hasText( "The data was changed by another user. Reload."); final Link reloadlink = new LinkImpl(new ByUniqueElementLocator(secondBrowser, error, By.tagName("a"), "ErrorPage", "reloadLink")); assertThat(reloadlink.getAttribute("href")).isEqualTo(url); // reload and set the title back. reloadlink.click(); firstFormPage.isReloaded(); final TextInput titleInput = firstFormPage.getTitleInput(); softly.assertThat(titleInput.getText()).isEqualTo(changedTitle); titleInput.set(originalTitle); firstFormPage.getSave().click(); secondBrowser.quit(); checkResult(TestData.initWithSampleData()); } }
[ "opensource21@gmail.com" ]
opensource21@gmail.com
ad15f957a675c06594205e404a0342b751f09edd
2ac35db2c5c9be4cef57fbd54f0343614e1666d6
/0924-3_layout_params/src/test/java/com/example/a0924_3_layout_params/ExampleUnitTest.java
ed14f57811b435aa8cfa1433f12ea88986287010
[]
no_license
hw05122/Mobile-Programming
aa094ea80cc17ee0560105105722c1010c7fbce9
231179f7f4a13624f323cc4031b24891d04101eb
refs/heads/master
2020-07-28T23:38:15.971015
2020-01-02T01:07:44
2020-01-02T01:07:44
208,832,088
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package com.example.a0924_3_layout_params; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "hw05122@naver.com" ]
hw05122@naver.com
ec0caed66a16a38e0ace72616e05c7edb666f703
baf07c555f9438d5ab4e69f7ef0ac2a2f1e0c0a6
/动物养殖管理系统/代码/ts-base/src/main/java/com/ts/common/redis/shiro/RedisCache.java
299081966efe3cf7dc7c3900efd3044df85aa925
[]
no_license
qinsvn/animal
5507cf81fdb813c32c20ca9935e302678dda5f37
656fab206680fd84f356a101768ccba5945b60b3
refs/heads/master
2023-01-29T21:17:03.854542
2020-12-14T07:45:43
2020-12-14T07:45:43
321,271,492
0
0
null
null
null
null
UTF-8
Java
false
false
5,083
java
package com.ts.common.redis.shiro; /** * @author ts bobby@126.com * @version V1.0 */ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.shiro.cache.Cache; import org.apache.shiro.cache.CacheException; import org.apache.shiro.util.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RedisCache<K, V> implements Cache<K, V> { private Logger logger = LoggerFactory.getLogger(this.getClass()); /** * The wrapped Jedis instance. */ private RedisManager cache; /** * The Redis key prefix for the sessions */ private String keyPrefix = "shiro_redis_session:"; /** * Returns the Redis session keys * prefix. * @return The prefix */ public String getKeyPrefix() { return keyPrefix; } /** * Sets the Redis sessions key * prefix. * @param keyPrefix The prefix */ public void setKeyPrefix(String keyPrefix) { this.keyPrefix = keyPrefix; } /** * 通过一个JedisManager实例构造RedisCache */ public RedisCache(RedisManager cache){ if (cache == null) { throw new IllegalArgumentException("Cache argument cannot be null."); } this.cache = cache; } /** * Constructs a cache instance with the specified * Redis manager and using a custom key prefix. * @param cache The cache manager instance * @param prefix The Redis key prefix */ public RedisCache(RedisManager cache, String prefix){ this( cache ); // set the prefix this.keyPrefix = prefix; } /** * 获得byte[]型的key * @param key * @return */ private byte[] getByteKey(K key){ if(key instanceof String){ String preKey = this.keyPrefix + key; return preKey.getBytes(); }else{ return SerializeUtils.serialize(key); } } @Override public V get(K key) throws CacheException { logger.debug("根据key从Redis中获取对象 key [" + key + "]"); try { if (key == null) { return null; }else{ byte[] rawValue = cache.get(getByteKey(key)); @SuppressWarnings("unchecked") V value = (V)SerializeUtils.deserialize(rawValue); return value; } } catch (Throwable t) { throw new CacheException(t); } } @Override public V put(K key, V value) throws CacheException { logger.debug("根据key从存储 key [" + key + "]"); try { cache.set(getByteKey(key), SerializeUtils.serialize(value)); return value; } catch (Throwable t) { throw new CacheException(t); } } @Override public V remove(K key) throws CacheException { logger.debug("从redis中删除 key [" + key + "]"); try { V previous = get(key); cache.del(getByteKey(key)); return previous; } catch (Throwable t) { throw new CacheException(t); } } @Override public void clear() throws CacheException { logger.debug("从redis中删除所有元素"); try { cache.flushDB(); } catch (Throwable t) { throw new CacheException(t); } } @Override public int size() { try { Long longSize = new Long(cache.dbSize()); return longSize.intValue(); } catch (Throwable t) { throw new CacheException(t); } } @SuppressWarnings("unchecked") @Override public Set<K> keys() { try { Set<byte[]> keys = cache.keys(this.keyPrefix + "*"); if (CollectionUtils.isEmpty(keys)) { return Collections.emptySet(); }else{ Set<K> newKeys = new HashSet<K>(); for(byte[] key:keys){ newKeys.add((K)key); } return newKeys; } } catch (Throwable t) { throw new CacheException(t); } } @Override public Collection<V> values() { try { Set<byte[]> keys = cache.keys(this.keyPrefix + "*"); if (!CollectionUtils.isEmpty(keys)) { List<V> values = new ArrayList<V>(keys.size()); for (byte[] key : keys) { @SuppressWarnings("unchecked") V value = get((K)key); if (value != null) { values.add(value); } } return Collections.unmodifiableList(values); } else { return Collections.emptyList(); } } catch (Throwable t) { throw new CacheException(t); } } }
[ "gebishijie@126.com" ]
gebishijie@126.com
07b68546dde70ad76ead1563fadd990c5ef58521
220c1cc32de0b5acc19536fc916f13d90e6d3030
/src/main/java/com/xhu/utils/DBUtils.java
0fe0ada682eb1e4b7ab732084862efe23f3feac4
[]
no_license
SM2258XT/DataStruct
7ddfd04993c22307c66139fc9b97ba4c25a51cae
6119c4f32d2afdf30341f218566a25d9eadcc51a
refs/heads/main
2023-04-25T05:29:57.596100
2021-05-13T09:48:24
2021-05-13T09:48:24
363,650,944
0
0
null
null
null
null
UTF-8
Java
false
false
1,384
java
package com.xhu.utils; import java.sql.*; public class DBUtils { static { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("JDBC:驱动加载失败!"); } } private DBUtils(){} public static Connection getConnection(String database,String user,String pwd){ Connection con = null; try { con = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+database,user,pwd); } catch (SQLException throwables) { System.out.println("JDBC:获取连接失败!"); } return con; } public static void close(Connection con,Statement stat,ResultSet res){ if(res != null){ try { res.close(); } catch (SQLException throwables) { System.out.println("JDBC:ResultSet关闭异常!"); } } if(stat != null){ try { stat.close(); } catch (SQLException throwables) { System.out.println("JDBC:Statement关闭异常!"); } } if(con != null){ try { con.close(); } catch (SQLException throwables) { System.out.println("JDBC:Connection关闭异常!"); } } } }
[ "826094051@qq.com" ]
826094051@qq.com
53ba1b418499143a0c0a247b4aa090dbcfb54f7e
d5b5d292f7c1ea7b11ce41dbd2e01d1f658d03eb
/src/main/java/thedarkcolour/futuremc/block/BlockWall.java
79c0a95a891a03c747fe115a869ba59897bd59e9
[]
no_license
JairoQuispe/Future-MC
eed942b166af0f3277022f14d9ca6777061e8644
98c0addbc0d22d62494fbc25eac44f203512a84a
refs/heads/master
2020-08-27T13:09:35.888314
2019-10-19T06:43:27
2019-10-19T06:43:27
217,382,309
0
0
null
2019-10-24T19:43:22
2019-10-24T19:43:22
null
UTF-8
Java
false
false
7,232
java
package thedarkcolour.futuremc.block; import net.minecraft.block.Block; import net.minecraft.block.BlockFenceGate; import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import thedarkcolour.core.block.BlockBase; import thedarkcolour.futuremc.FutureMC; import thedarkcolour.futuremc.init.FutureConfig; import java.util.List; public class BlockWall extends BlockBase { private static final PropertyBool UP = PropertyBool.create("up"); private static final PropertyBool NORTH = PropertyBool.create("north"); private static final PropertyBool EAST = PropertyBool.create("east"); private static final PropertyBool SOUTH = PropertyBool.create("south"); private static final PropertyBool WEST = PropertyBool.create("west"); private static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] {new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; private static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] {AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D)}; public BlockWall(String variant) { super(variant + "_wall"); setSoundType(SoundType.STONE); setHardness(3.0F); setCreativeTab(FutureConfig.general.useVanillaTabs ? CreativeTabs.BUILDING_BLOCKS : FutureMC.TAB); } private static int getAABBIndex(IBlockState state) { int i = 0; if (state.getValue(NORTH)) { i |= 1 << EnumFacing.NORTH.getHorizontalIndex(); } if (state.getValue(EAST)) { i |= 1 << EnumFacing.EAST.getHorizontalIndex(); } if (state.getValue(SOUTH)) { i |= 1 << EnumFacing.SOUTH.getHorizontalIndex(); } if (state.getValue(WEST)) { i |= 1 << EnumFacing.WEST.getHorizontalIndex(); } return i; } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { state = this.getActualState(state, source, pos); return AABB_BY_INDEX[getAABBIndex(state)]; } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, UP, NORTH, EAST, WEST, SOUTH); } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side); } @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { if (!isActualState) { state = this.getActualState(state, worldIn, pos); } addCollisionBoxToList(pos, entityBox, collidingBoxes, CLIP_AABB_BY_INDEX[getAABBIndex(state)]); } @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { boolean flag = canWallConnectTo(worldIn, pos, EnumFacing.NORTH); boolean flag1 = canWallConnectTo(worldIn, pos, EnumFacing.EAST); boolean flag2 = canWallConnectTo(worldIn, pos, EnumFacing.SOUTH); boolean flag3 = canWallConnectTo(worldIn, pos, EnumFacing.WEST); boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3; return state.withProperty(UP, !flag4 || !worldIn.isAirBlock(pos.up())).withProperty(NORTH, flag).withProperty(EAST, flag1).withProperty(SOUTH, flag2).withProperty(WEST, flag3); } @Override public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing) { return canConnectTo(world, pos.offset(facing), facing.getOpposite()); } private boolean canWallConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing) { BlockPos other = pos.offset(facing); Block block = world.getBlockState(other).getBlock(); return block.canBeConnectedTo(world, other, facing.getOpposite()) || canConnectTo(world, other, facing.getOpposite()); } private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos, EnumFacing p_176253_3_) { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); BlockFaceShape blockfaceshape = iblockstate.getBlockFaceShape(worldIn, pos, p_176253_3_); boolean flag = blockfaceshape == BlockFaceShape.MIDDLE_POLE_THICK || blockfaceshape == BlockFaceShape.MIDDLE_POLE && block instanceof BlockFenceGate; return !isExceptBlockForAttachWithPiston(block) && blockfaceshape == BlockFaceShape.SOLID || flag; } protected static boolean isExceptBlockForAttachWithPiston(Block block) { return Block.isExceptBlockForAttachWithPiston(block) || block == Blocks.BARRIER || block == Blocks.MELON_BLOCK || block == Blocks.PUMPKIN || block == Blocks.LIT_PUMPKIN; } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState(); } @Override public int getMetaFromState(IBlockState state) { return 0; } }
[ "30441001+thedarkcolour@users.noreply.github.com" ]
30441001+thedarkcolour@users.noreply.github.com
c3c3a6ec03553a22ca9912c90b9ee309cd401b77
fe7a7efbf1d70ab21195d9d798040ae2bf2a6947
/src/com/Itemhouse/Aid/classinitialization.java
b716f9b3db46ec79b3ea1c064eabbe5a6fe6f996
[]
no_license
saltefishcong/ItemWarehouse
f340beb9182214a72af1f5ae2e6de7aedcc299d8
7a39244b10a8cf93d9d03d1740d4d8d7f8416c64
refs/heads/master
2020-03-14T12:04:08.221336
2018-04-30T14:37:48
2018-04-30T14:37:48
131,603,572
0
0
null
null
null
null
UTF-8
Java
false
false
4,615
java
package com.Itemhouse.Aid; import java.util.HashMap; import java.util.Map; /** * @author &nbsp;&nbsp;Lwc * @since &nbsp;&nbsp;1.6 * @version &nbsp;&nbsp;1.8<br> * <strong>类说明:</strong><br> * &nbsp;&nbsp;用于resolveXml解析后的类对象创建 */ public class classinitialization { /** 创建一个final的resolveXml对象,无法被修改 */ private static final resolveXml ts = new resolveXml(); /** 用来存放初始化对象后的容器 */ private static Map<String, Object> map = new HashMap<String, Object>(); public void startclassinitialization() { try { createObjects(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("初始化失败"); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("初始化失败"); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("初始化失败"); } } /** * <strong>方法说明:</strong> <br> * 创建指定路径的类实例,实例名字为传进去的Name * * @param objectName * 传进去的实例名字 * @param path * 指定的类路径 * @return Object 返回创建的对象 * @throws ClassNotFoundException * 找不到类 * @throws InstantiationException * 实例化异常 * @throws IllegalAccessException * 非法访问实例 */ public Object createObject(String objectName, String path) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Class zz = Class.forName(path); Object object = zz.newInstance(); return object; } /** * <strong>方法说明:</strong> <br> * 获取传进去的类是否是一个单例类 * * @param path * 类路径 * @return boolean true单例类,false不是单例类,默认值 */ public boolean getClassSingle(String path) { for (int i = 0; i < ts.classTypePaths.size(); i++) { Map<String, String> map = ts.classTypePaths.get(i); if (map.get("path").equals(path)) { return true; } } return false; } /** * <strong>方法说明:</strong> <br> * 获取单例类的第一个对象 * * @param path * 类路径 * @return java.lang.String 返回类对象的名字 */ public String getSingleObject(String path) { return ts.location.get(path); } /** * <strong>方法说明:</strong> <br> * 初始化所有类对象 * * @return java.util.Map&lt;java.lang.String, Object&gt; 返回创建好的对象集合Map * @throws ClassNotFoundException * 找不到类 * @throws InstantiationException * 实例化异常 * @throws IllegalAccessException * 非法访问实例 */ public Map<String, Object> createObjects() throws ClassNotFoundException, InstantiationException, IllegalAccessException { for (int i = 0; i < ts.objectNames.size(); i++) { String objectName = ts.objectNames.get(i); String path = ts.objectPaths.get(objectName); boolean flag = getClassSingle(path); if (flag == true) { if (map.get(objectName) == null) { Object object = createObject(objectName, path); map.put(objectName, object); System.out.println(objectName + " " + path + " " + object); continue; } else { continue; } } Object object = createObject(objectName, path); System.out.println(object); map.put(objectName, object); } return map; } /** * <strong>方法说明:</strong> <br> * 获取xml定义的对象,单例的获取设置的对象,多例获取不一样的对象 * * @param objectName * 获取的对象名字 * @param path * 获取对象的路径 * @return Object 返回的对象 */ public Object getObject(String objectName, String path) { boolean flag = getClassSingle(path); if (flag == true) { Object object = map.get(objectName); return object; } if (map.get(objectName) != null) { Object object2 = map.get(objectName); Object object = null; try { object = createObject(objectName, path); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } map.put(objectName, object); return object2; } return null; } }
[ "9733240203@qq.com" ]
9733240203@qq.com
60032933e99cd4631b51e0df849722dda602b37c
6d54c69641e421d7a737950f6f7301b1fb0b9b12
/2.JavaCore/src/com/javarush/task/task14/task1401/Solution.java
f64197bce4e2e1eb2ec1e421140ce148e27a1a6b
[]
no_license
MarvineGothic/JavaRushTasks
ab91358bbbce7934b2ed0d05bd62510be17747c9
ec77371bc91fe415ee06d949ed6ad9490d21b597
refs/heads/master
2021-08-05T20:51:23.112564
2021-07-27T18:24:19
2021-07-27T18:24:19
105,068,893
0
0
null
null
null
null
UTF-8
Java
false
false
1,223
java
package com.javarush.task.task14.task1401; /* Bingo! public class Solution { public static void main(String[] args) { Object animal = new Pet(); boolean isCat = animal instanceof Cat; boolean isTiger = animal instanceof Tiger; boolean isPet = animal instanceof Pet; printResults(isCat, isTiger, isPet); } private static void printResults(boolean cat, boolean tiger, boolean pet) { if (cat && tiger && pet) System.out.println("Bingo!"); } static class Pet { } static class Cat extends Pet { } static class Tiger extends Cat { } } */ public class Solution { // solved public static void main(String[] args) { Object animal = new Tiger(); boolean isCat = animal instanceof Cat; boolean isTiger = animal instanceof Tiger; boolean isPet = animal instanceof Pet; printResults(isCat, isTiger, isPet); } private static void printResults(boolean cat, boolean tiger, boolean pet) { if (cat && tiger && pet) System.out.println("Bingo!"); } static class Pet { } static class Cat extends Pet { } static class Tiger extends Cat { } }
[ "seis@itu.dk" ]
seis@itu.dk
65333e12aef4e60015a80484aa3d201712550126
39c92e8c47488f0952079545da214488b7936a12
/csw/jeasyx/src/DLSurfaceProperties.java
ef384677280cb79512666dde16525d9480c85eb2
[]
no_license
glennpinkerton/csw_master
30c6cfe57af470fcef3380fcf161fd1e2fcfab6c
d2de44e8b576d4023849a9ea2f9360c3ea3abe42
refs/heads/master
2018-12-15T13:13:44.865630
2018-10-16T12:55:47
2018-10-16T12:55:47
111,485,829
2
0
null
2018-10-16T12:55:48
2017-11-21T02:03:35
C++
UTF-8
Java
false
false
33,474
java
/* ************************************************ * * * Copyright (1997-2007) Glenn Pinkerton. * * All rights reserved. * * * ************************************************ */ package csw.jeasyx.src; import java.awt.Color; /*--------------------------------------------------------------------------*/ /** This class stores graphical properties used to draw contours or color filled contours on the {@link JDisplayList} object. All of the properties can be publically accessed via the appropriate set and get methods of the class. In addition, the classes in the csw.jeasyx.src package can directly access the properties. <p> When the addGrid or addTriMesh method is called, an instance of this class can be specified to instruct how the grid or trimesh is to be visualized. */ public class DLSurfaceProperties { /*--------------------------------------------------------------------------*/ /* * The instance variables have package scope so the JDisplayList can * access them directly. */ boolean showContours, showColorFills, showNodes, showNodeValues, showCellEdges, showFaultLines; boolean showOutline; boolean isThickness; double contourMinValue, contourMaxValue, contourInterval, dataLogBase, fillMinValue, fillMaxValue; int majorInterval; boolean labelMajor, labelMinor; int tickMajor, tickMinor; Color majorColor, minorColor, nodeColor, nodeValueColor, cellEdgeColor, faultLineColor; Color outlineColor; double minorThickness, majorThickness, cellEdgeThickness, faultThickness; int contourFont, nodeFont; double minorLabelSize, majorLabelSize, minorLabelSpacing, majorLabelSpacing, minorTickLength, majorTickLength, minorTickSpacing, majorTickSpacing; int nodeSymbol; double nodeSymbolSize, nodeValueSize; double hardMin, hardMax; int contourSmoothing; double zUnitsConversionFactor; /*--------------------------------------------------------------------------*/ /** Create a new object with default contour property values. */ public DLSurfaceProperties () { setToDefaults (); return; } /*--------------------------------------------------------------------------*/ /** Set all the contour properties to their default values. */ public void setToDefaults() { showContours = true; showColorFills = true; showNodes = false; showNodeValues = false; showCellEdges = false; showFaultLines = true; showOutline = false; contourMinValue = 1.e30; contourMaxValue = -1.e30; contourInterval = -1.0; dataLogBase = 0.0; fillMinValue = 1.e30; fillMaxValue = -1.e30; majorInterval = -1; labelMajor = true; labelMinor = false; tickMajor = 0; tickMinor = 0; majorColor = Color.black; minorColor = Color.black; nodeColor = Color.black; nodeValueColor = Color.black; cellEdgeColor = Color.black; faultLineColor = Color.black; outlineColor = Color.black; majorThickness = .015; minorThickness = .005; cellEdgeThickness = .005; faultThickness = .015; minorLabelSize = 0.07; majorLabelSize = 0.10; minorLabelSpacing = 5.0; majorLabelSpacing = 5.0; minorTickLength = 0.05; majorTickLength = 0.07; minorTickSpacing = 0.15; majorTickSpacing = 0.2; nodeSymbol = 7; nodeSymbolSize = 0.05; nodeValueSize = 0.07; hardMin = -1.e30; hardMax = 1.e30; contourSmoothing = 1; zUnitsConversionFactor = 1.0; } /*--------------------------------------------------------------------------*/ /** Enable or disable the drawing of contour lines. If the flag is set to true, contour lines will be drawn. If the flag is set to false, contour lines will not be drawn. By default, contour lines will be drawn. */ public void setShowContours (boolean flag) { showContours = flag; } /** Return if contour line drawing is currently enabled or disabled. If it is enabled, true is returned. If disabled, false is returned. */ public boolean getShowContours () { return showContours; } /*--------------------------------------------------------------------------*/ /** Enable or disable the drawing of contour color fills. If the flag is set to true, contour color fills will be drawn. If the flag is set to false, contour color fills will not be drawn. By default, contour color fills will be drawn. */ public void setShowColorFills (boolean flag) { showColorFills = flag; } /** Return if color fill drawing is currently enabled or disabled. If it is enabled, true is returned. If disabled, false is returned. */ public boolean getShowColorFills () { return showColorFills; } /*--------------------------------------------------------------------------*/ /** Enable or disable the drawing of node positions. If the flag is set to true, node positions will be drawn. If the flag is set to false, node positions will not be drawn. By default, node positions will be drawn. */ public void setShowNodes (boolean flag) { showNodes = flag; } /** Return if node position drawing is currently enabled or disabled. If it is enabled, true is returned. If disabled, false is returned. */ public boolean getShowNodes () { return showNodes; } /*--------------------------------------------------------------------------*/ /** Enable or disable the drawing of node values. If the flag is set to true, node values will be drawn. If the flag is set to false, node values will not be drawn. By default, node values will not be drawn. */ public void setShowNodeValues (boolean flag) { showNodeValues = flag; } /** Return if node value drawing is currently enabled or disabled. If it is enabled, true is returned. If disabled, false is returned. */ public boolean getShowNodeValues () { return showNodeValues; } /*--------------------------------------------------------------------------*/ /** Enable or disable the drawing of cell edges. If the flag is set to true, cell edges will be drawn. If the flag is set to false, cell edges will not be drawn. By default, cell edges will not be drawn. */ public void setShowCellEdges (boolean flag) { showCellEdges = flag; } /** Return if cell edge drawing is currently enabled or disabled. If it is enabled, true is returned. If disabled, false is returned. */ public boolean getShowCellEdges () { return showCellEdges; } /*--------------------------------------------------------------------------*/ /** Enable or disable the drawing of fault lines. If the flag is set to true, fault lines will be drawn. If the flag is set to false, fault lines will not be drawn. By default, fault lines will be drawn. */ public void setShowFaultLines (boolean flag) { showFaultLines = flag; } /** Return if fault line drawing is currently enabled or disabled. If it is enabled, true is returned. If disabled, false is returned. */ public boolean getShowFaultLines () { return showFaultLines; } /*--------------------------------------------------------------------------*/ /** Enable or disable the drawing of the surface outline. If the flag is set to true, the outline will be drawn. If the flag is set to false, the outline will not be drawn. By default, the outline is not drawn. */ public void setShowOutline (boolean flag) { showOutline = flag; } /** Return if outline drawing is currently enabled or disabled. If it is enabled, true is returned. If disabled, false is returned. */ public boolean getShowOutline () { return showOutline; } /*--------------------------------------------------------------------------*/ /** Set whether or not the contouring is for a thickness value. If the data are thickness, set the flag to true. If not thickness, set the flag to false. By default, this is false, and data are assumed to not be thickness. */ public void setIsThickness (boolean flag) { isThickness = flag; } /** Return whether or not the contouring is for a thickness value. If the data are thickness, true is returned. If not thickness, false is returned. By default, this is false, and data are assumed to not be thickness. */ public boolean getIsThickness () { return isThickness; } /*--------------------------------------------------------------------------*/ /** Set the contour smoothing level. Zero means no smoothing and 1, 2 and 3 mean light, medium and heavy smoothing respectively. The default is 1. */ public void setContourSmoothing (int ival) { contourSmoothing = ival; } /** Get the contour smoothing level. Zero means no smoothing and 1, 2 and 3 mean light, medium and heavy smoothing respectively. The default is 1. */ public int getContourSmoothing () { return contourSmoothing; } /*--------------------------------------------------------------------------*/ /** Set the z unit conversion factor. The trimesh node z values will be multiplied by this value prior to calculating any image or contour displays. Also, any node values posted will reflect this conversion factor. */ public void setZUnitsConversionFactor (double val) { if (val <= 0.0) { zUnitsConversionFactor = 1.0; } else { zUnitsConversionFactor = 1.0 / val; } } /** Set the z unit conversion factor. The trimesh node z values will be multiplied by this value prior to calculating any image or contour displays. Also, any node values posted will reflect this conversion factor. */ public double getZUnitsConversionFactor () { if (zUnitsConversionFactor <= 0.0) { return 1.0; } else { return 1.0 / zUnitsConversionFactor; } } /*--------------------------------------------------------------------------*/ /** Set the minimum visible contour value. If this is greater than the maximum contour value or if this is greater than 1.e20, then the min and max visible contours are automatically determined. The default is automatic determination. */ public void setContourMinValue (double value) { contourMinValue = value; } /** Get the minimum visible contour value. If this is greater than the contour max value or if this is greater than 1.e20, then the contour minimum will be automatically determined. */ public double getContourMinValue () { return contourMinValue; } /*--------------------------------------------------------------------------*/ /** Set the maximum visible contour value. If this is less than the minimum contour value or if this is greater than 1.e20, then the min and max visible contours are automatically determined. The default is automatic determination. */ public void setContourMaxValue (double value) { contourMaxValue = value; } /** Get the maximum visible contour value. If this is less than the contour min value or if this is greater than 1.e20, then the contour minimum will be automatically determined. */ public double getContourMaxValue () { return contourMaxValue; } /*--------------------------------------------------------------------------*/ /** Set the contour interval. If this is set to less than or equal to zero, a contour interval is automatically determined. The default is automatic determination. */ public void setContourInterval (double value) { contourInterval = value; } /** Get the contour interval. If this is less than or equal to zero, the contour interval will be determined automatically. */ public double getContourInterval () { return contourInterval; } /*--------------------------------------------------------------------------*/ /** Set the log base value for labeling. This is only used for labeling of contours and node values. If the grid or trimesh is logarithmic, then the numbers drawn on contours and nodes should be the actual numbers, not the log of the numbers. For example, if the data are log base 10, set the DataLogBase to 10. A contour at level 1 would then be labeled as 10. If the data are not logarithmic, set this to any value less than or equal to 1. By default, this is set to zero, and the data are assumed to not be logarithmic. */ public void setDataLogBase (double value) { dataLogBase = value; } /** Get the log base value for labeling contours and nodes. If this is less than or equal to 1, the data are assumed to be non logarithmic. */ public double getDataLogBase () { return dataLogBase; } /*--------------------------------------------------------------------------*/ /** Set the minimum value to be visible in the color fill. This is used to clip the color fill to a particular minimum value. */ public void setFillMinValue (double value) { fillMinValue = value; } /** Get the minimum value to be visible in the color fill. This is used to clip the color fill to a particular minimum value. */ public double getFillMinValue () { return fillMinValue; } /*--------------------------------------------------------------------------*/ /** Set the maximum value to be visible in the color fill. This is used to clip the color fill to a particular maximum value. */ public void setFillMaxValue (double value) { fillMaxValue = value; } /** Get the maximum value to be visible in the color fill. This is used to clip the color fill to a particular maximum value. */ public double getFillMaxValue () { return fillMaxValue; } /*--------------------------------------------------------------------------*/ /** Set the integer major contour interval. For example, if you want every fifth contour to be major, set this to 5. If you want the major interval to be determined automatically, set this to -1. By default, the major interval is determined automatically. */ public void setMajorInterval (int value) { majorInterval = value; } /** Get the integer major contour interval. If the value returned is -1, then the major interval is determined automatically. */ public int getMajorInterval () { return majorInterval; } /*--------------------------------------------------------------------------*/ /** Enable or disable major contour labels. Set to true to enable or set to false to disable. By default, major contours are labeled. */ public void setLabelMajor (boolean flag) { labelMajor = flag; } /** Get whether major contour labeling is enabled or disabled. Returns true if it is enabled or false if disabled. */ public boolean getLabelMajor () { return labelMajor; } /*--------------------------------------------------------------------------*/ /** Enable or disable minor contour labels. Set to true to enable or set to false to disable. By default, minor contours are not labeled. */ public void setLabelMinor (boolean flag) { labelMinor = flag; } /** Get whether minor contour labeling is enabled or disabled. Returns true if it is enabled or false if disabled. */ public boolean getLabelMinor () { return labelMinor; } /*--------------------------------------------------------------------------*/ /** Set the tick mark direction for major contours. For downhill tick marks, set this to 1. For uphill tickmarks, set to -1. For no tickmarks, set to zero. By default, this is zero and no tickmarks are drawn. If the value specified in not valid, no tickmarks will be drawn. */ public void setTickMajor (int value) { if (value < -1 || value > 1) { value = 0; } tickMajor = value; } /** Get the major contour tick mark direction. A return value of 1 means downhill tick marks. A return value of -1 means uphill tick marks. A return value of zero means no tick marks. */ public int getTickMajor () { return tickMajor; } /*--------------------------------------------------------------------------*/ /** Set the tick mark direction for minor contours. For downhill tick marks, set this to 1. For uphill tickmarks, set to -1. For no tickmarks, set to zero. By default, this is zero and no tickmarks are drawn. If the value specified in not valid, no tickmarks will be drawn. */ public void setTickMinor (int value) { if (value < -1 || value > 1) { value = 0; } tickMinor = value; } /** Get the major contour tick mark direction. A return value of 1 means downhill tick marks. A return value of -1 means uphill tick marks. A return value of zero means no tick marks. */ public int getTickMinor () { return tickMinor; } /*--------------------------------------------------------------------------*/ /** Set the color for major contour lines, labels and ticks. If this is set to null, black will be used. By default, black will be used. */ public void setMajorColor (Color color) { if (color == null) { color = Color.black; } majorColor = color; } /** Get the color for major contour lines, labels and ticks. */ public Color getMajorColor () { return majorColor; } /*--------------------------------------------------------------------------*/ /** Set the color for minor contour lines, labels and ticks. If this is set to null, black will be used. By default, black will be used. */ public void setMinorColor (Color color) { if (color == null) { color = Color.black; } minorColor = color; } /** Get the color for minor contour lines, labels and ticks. */ public Color getMinorColor () { return minorColor; } /*--------------------------------------------------------------------------*/ /** Set the color for node position symbols. If this is set to null, black will be used. By default, black will be used. */ public void setNodeColor (Color color) { if (color == null) { color = Color.black; } nodeColor = color; } /** Get the color for node position symbols. */ public Color getNodeColor () { return nodeColor; } /*--------------------------------------------------------------------------*/ /** Set the color for node value labels. If this is set to null, black will be used. By default, black will be used. */ public void setNodeValueColor (Color color) { if (color == null) { color = Color.black; } nodeValueColor = color; } /** Get the color for node value labels. */ public Color getNodeValueColor () { return nodeValueColor; } /*--------------------------------------------------------------------------*/ /** Set the color for cell edges. If this is set to null, black will be used. By default, black will be used. */ public void setCellEdgeColor (Color color) { if (color == null) { color = Color.black; } cellEdgeColor = color; } /** Get the color for cell edges. */ public Color getCellEdgeColor () { return cellEdgeColor; } /*--------------------------------------------------------------------------*/ /** Set the color for fault lines. If this is set to null, black will be used. By default, black will be used. */ public void setFaultLineColor (Color color) { if (color == null) { color = Color.black; } faultLineColor = color; } /** Get the color for fault lines. */ public Color getFaultLineColor () { return faultLineColor; } /*--------------------------------------------------------------------------*/ /** Set the color for the surface outline. If this is set to null, black will be used. By default, black will be used. */ public void setOutlineColor (Color color) { if (color == null) { color = Color.black; } outlineColor = color; } /** Get the color for the surface outline. */ public Color getOutlineColor () { return outlineColor; } /*--------------------------------------------------------------------------*/ /** Set the line thickness for major contour lines. The ticks will be about half as thick as the line. The valid thickness ranges from .001 to 1.0 inches. If the value specified is invalid, the line is .01 inches thick. By default, the line is .01 inches thick. */ public void setMajorThickness (double value) { if (value < 0.001 || value > 1.0) { value = .01; } majorThickness = value; } /** Get the current thickness of the major contour lines. */ public double getMajorThickness () { return majorThickness; } /*--------------------------------------------------------------------------*/ /** Set the line thickness for minor contour lines. The ticks will be about half as thick as the line. The valid thickness ranges from .001 to 1.0 inches. If the value specified is invalid, the line is .01 inches thick. By default, the line is .01 inches thick. */ public void setMinorThickness (double value) { if (value < 0.001 || value > 1.0) { value = .01; } minorThickness = value; } /** Get the current thickness of the major contour lines. */ public double getMinorThickness () { return minorThickness; } /*--------------------------------------------------------------------------*/ /** * Get the thickness in inches for cell edge lines. */ public double getCellEdgeThickness() { return cellEdgeThickness; } /*--------------------------------------------------------------------------*/ /** Get the thickness, in inches, for fault lines. */ public double getFaultThickness() { return faultThickness; } /*--------------------------------------------------------------------------*/ /** Get the size, in inches, for major contour labels. */ public double getMajorLabelSize() { return majorLabelSize; } /*--------------------------------------------------------------------------*/ /** Get the spacing, in inches along the line, for major contour labels. */ public double getMajorLabelSpacing() { return majorLabelSpacing; } /*--------------------------------------------------------------------------*/ /** Get the length, in inches, for major contour tick marks. */ public double getMajorTickLength() { return majorTickLength; } /*--------------------------------------------------------------------------*/ /** Get the spacing, in inches along the line, for major contour tick marks. */ public double getMajorTickSpacing() { return majorTickSpacing; } /*--------------------------------------------------------------------------*/ /** Get the size, in inches, for minor contour labels. */ public double getMinorLabelSize() { return minorLabelSize; } /*--------------------------------------------------------------------------*/ /** Get the spacing, in inches along the line, for minor contour labels. */ public double getMinorLabelSpacing() { return minorLabelSpacing; } /*--------------------------------------------------------------------------*/ /** Get the tick length, in inches, for minor contour tick marks. */ public double getMinorTickLength() { return minorTickLength; } /*--------------------------------------------------------------------------*/ /** Get the spacing, in inches along the line, for minor contour tick marks. */ public double getMinorTickSpacing() { return minorTickSpacing; } /*--------------------------------------------------------------------------*/ /** Get the symbol number for node positions. */ public int getNodeSymbol() { return nodeSymbol; } /*--------------------------------------------------------------------------*/ /** Get the size, in inches, for the node position symbols. */ public double getNodeSymbolSize() { return nodeSymbolSize; } /*--------------------------------------------------------------------------*/ /** Get the size, in inches, for the node value labels. */ public double getNodeValueSize() { return nodeValueSize; } /*--------------------------------------------------------------------------*/ /** Set the thickness for cell edge lines. The valid thickness values are .001 to 1.0 (inches). If the value is not valid, .005 inches is used. By default, .005 inches is used. */ public void setCellEdgeThickness(double d) { if (d < 0.001 || d > 1.0) { d = 0.005; } cellEdgeThickness = d; } /*--------------------------------------------------------------------------*/ /** Set the thickness for fault lines. The valid thickness values are .001 to 1.0 (inches). If the value is not valid, .005 inches is used. By default, .015 inches is used. */ public void setFaultThickness(double d) { if (d < 0.001 || d > 1.0) { d = 0.015; } faultThickness = d; } /*--------------------------------------------------------------------------*/ /** Set the size (in inches) for major contour labels. Valid sizes are .01 to 10.0 (inches). If an invalid value is specified, .1 inches is used. By default, .1 inches is used. */ public void setMajorLabelSize(double d) { if (d < .01 || d > 10.0) { d = .1; } majorLabelSize = d; } /*--------------------------------------------------------------------------*/ /** Set the spacing (in inches along the line) for major contour labels. This will not be exactly honored. It is a guide for label spacing only. Labels may be adjusted somewhat to be drawn in smooth areas of the contour. By default, 6 inches is used. */ public void setMajorLabelSpacing(double d) { majorLabelSpacing = d; } /*--------------------------------------------------------------------------*/ /** Set the tick mark length (in inches) for the major contours. By default, .07 inches is used. */ public void setMajorTickLength(double d) { majorTickLength = d; } /*--------------------------------------------------------------------------*/ /** Set the tick mark spacing (in inches along the line) for major contours. By default, .2 inches is used. */ public void setMajorTickSpacing(double d) { majorTickSpacing = d; } /*--------------------------------------------------------------------------*/ /** Set the size (in inches) for minor contour labels. Valid sizes are .01 to 10.0 (inches). If an invalid value is specified, .07 inches is used. By default, .07 inches is used. */ public void setMinorLabelSize(double d) { if (d < .01 || d > 10.0) { d = .1; } minorLabelSize = d; } /*--------------------------------------------------------------------------*/ /** Set the spacing (in inches along the line) for minor contour labels. This will not be exactly honored. It is a guide for label spacing only. Labels may be adjusted somewhat to be drawn in smooth areas of the contour. By default, 6 inches is used. */ public void setMinorLabelSpacing(double d) { minorLabelSpacing = d; } /*--------------------------------------------------------------------------*/ /** Set the tick mark length (in inches) for minor contour tick marks. By default, .05 inches is used. */ public void setMinorTickLength(double d) { minorTickLength = d; } /*--------------------------------------------------------------------------*/ /** Set the tick mark spacing (in inches along the line) for minor contours. By default, .15 inches is used. */ public void setMinorTickSpacing(double d) { minorTickSpacing = d; } /*--------------------------------------------------------------------------*/ /** Set the symbol number for node positions. Valid symbol numbers are 1 to 140. If an invalid symbol is specified, symbol 7 (a cross) is used. By default, symbol 7 is used. */ public void setNodeSymbol(int i) { nodeSymbol = i; } /*--------------------------------------------------------------------------*/ /** Set the size (in inches) for symbols used to draw node positions. Valid values are .01 to 10.0. If an invalid value is specified, .05 inches is used. By default, .05 inches is used. */ public void setNodeSymbolSize(double d) { nodeSymbolSize = d; } /*--------------------------------------------------------------------------*/ /** Set the size (in inches) for node value labels. Valid sizes are .01 to 10.0 (inches). If an invalid value is specified, .07 inches is used. By default, .07 inches is used. */ public void setNodeValueSize(double d) { nodeValueSize = d; } /*--------------------------------------------------------------------------*/ /** Return the font number for contour labels. */ public int getContourFont() { return contourFont; } /*--------------------------------------------------------------------------*/ /** Return the font number for node value drawing. */ public int getNodeFont() { return nodeFont; } /*--------------------------------------------------------------------------*/ /** Set the font for contour label drawing. Valid fonts numbers are 0-7 and 101-107. If an invalid font is specified, font 102 is used. By default, font 102 is used. */ public void setContourFont(int i) { if (i < 0 || i > 107) { i = 102; } else if (i > 7 && i < 101) { i = 102; } contourFont = i; } /*--------------------------------------------------------------------------*/ /** Set the font for node value drawing. Valid fonts numbers are 0-7 and 101-107. If an invalid font is specified, font 102 is used. By default, font 102 is used. */ public void setNodeFont(int i) { if (i < 0 || i > 107) { i = 102; } else if (i > 7 && i < 101) { i = 102; } nodeFont = i; } /*--------------------------------------------------------------------------*/ /** Return the absolute maximum value that the data can possibly have. */ public double getHardMax() { return hardMax; } /*--------------------------------------------------------------------------*/ /** Return the absolute minimum value that the data can possibly have. */ public double getHardMin() { return hardMin; } /*--------------------------------------------------------------------------*/ /** Set the absolute maximum value that the data can possibly have. */ public void setHardMax(double d) { hardMax = d; } /*--------------------------------------------------------------------------*/ /** Set the absolute minimum value that the data can possibly have. */ public void setHardMin(double d) { hardMin = d; } /*--------------------------------------------------------------------------*/ } // end of DLSurfaceProperties class.
[ "glennpinkerton@comcast.net" ]
glennpinkerton@comcast.net
d60edfe947b4512ccca279cf55a3747fba1f3af2
a81701fe588e591a2adad3e8ee585a530adcf945
/Online Course Registration/src/main/java/com/edu/mum/controller/courseController.java
48a0fea80d2b8c7f4e189da59ea64dbc30a46fe1
[]
no_license
chandilian29/REPO_Course_Registration
da880c51a674b9075231270bb2210fd65dfedbe0
26c28b1f758973c7c15dcf930ba1ebd98ab68d55
refs/heads/master
2016-08-11T17:50:00.374611
2016-02-05T03:13:14
2016-02-05T03:13:14
51,123,023
0
0
null
null
null
null
UTF-8
Java
false
false
11,841
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.edu.mum.controller; import com.edu.mum.service.IYogaCourseService; import com.mum.edu.domain.Course; import com.mum.edu.domain.Customer; import com.mum.edu.domain.Section; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * * @author Yonas */ @Controller public class courseController { @Autowired private IYogaCourseService yogaCourseService; private Course currentCourse; // private Customer currentCustomer = new Customer("Yonas", "Mulissa", "ymulissa", "1234", 28); private int currentCustomerId; // Customer cust = (Customer) request.getSession().getAttribute("customer"); public IYogaCourseService getYogaCourseService() { return yogaCourseService; } public void setYogaCourseService(IYogaCourseService yogaCourseService) { this.yogaCourseService = yogaCourseService; } public Course getCurrentCourse() { return currentCourse; } public void setCurrentCourse(Course currentCourse) { this.currentCourse = currentCourse; } @RequestMapping(value = "/courseList", method = RequestMethod.GET) public String viewProduct(org.springframework.ui.Model model) { model.addAttribute("courses", yogaCourseService.getAllCourse()); return "courseList"; } @RequestMapping(value = "/sectionListForRegistration", method = RequestMethod.GET) public String sectionList(org.springframework.ui.Model model) { model.addAttribute("sections", yogaCourseService.getAllSection()); return "sectionListForRegistration"; } // @RequestMapping(value = "/registeredSectionList", method = RequestMethod.GET) // public String registeredSectionList(org.springframework.ui.Model model) { // model.addAttribute("sections", yogaCourseService.getRegisteredSectionsByCusomerId(currentCustomer.getId())); // return "registeredSectionList"; // } @RequestMapping(value = "/showSections/{courseId}", method = RequestMethod.GET) public String showSections(@PathVariable String courseId, org.springframework.ui.Model model) { currentCourse = yogaCourseService.getCourseById(courseId); model.addAttribute("sections", yogaCourseService.getSectionsByCourseId(courseId)); return "sectionListForRegistration"; } @RequestMapping(value = "/dropSection/{sectionId}", method = RequestMethod.GET) public String dropSection(HttpServletRequest request, HttpServletResponse response, @PathVariable String sectionId, org.springframework.ui.Model model) { // currentCourse = yogaCourseService.getCourseById(sectionId); // model.addAttribute("sections", yogaCourseService.getSectionsByCourseId(sectionId)); Customer loggedCustomer = (Customer) request.getSession().getAttribute("loggedCustomer"); this.currentCustomerId = loggedCustomer.getId(); loggedCustomer = yogaCourseService.getCustomerById(currentCustomerId); Section section = yogaCourseService.getSectionById(sectionId); loggedCustomer.getSectionList().remove(section); section.getCustomerList().remove(loggedCustomer); loggedCustomer.getSectionList().remove(section); yogaCourseService.updateSection(section); yogaCourseService.updateCustomer(loggedCustomer); // yogaCourseService.dropSection(section.getId(), customer.getId()); return "dropSectionSuccess"; } @RequestMapping(value = "/dropSectionSuccess", method = RequestMethod.GET) public String dropSectionSuccess(org.springframework.ui.Model model) { return "dropSectionSuccess"; } @RequestMapping(value = "/listRegisteredSections", method = RequestMethod.GET) public String listRegisteredSections(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model) { //currentCourse = yogaCourseService.getCourseById(courseId); Customer loggedCustomer = (Customer) request.getSession().getAttribute("loggedCustomer"); this.currentCustomerId = loggedCustomer.getId(); loggedCustomer = yogaCourseService.getCustomerById(currentCustomerId); //model.addAttribute("sections", yogaCourseService.getSectionsByCustomerId(currentCustomerId)); model.addAttribute("sections", loggedCustomer.getSectionList()); return "listRegisteredSections"; } // @RequestMapping(value = "/temRequestWaiver", method = RequestMethod.GET) // public String requestWaiver(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model) { // Customer loggedCustomer = (Customer) request.getSession().getAttribute("loggedCustomer"); // loggedCustomer = yogaCourseService.getCustomerById(loggedCustomer.getId()); // // // model.addAttribute("waivers", loggedCustomer.getWaiverList()); // model.addAttribute("sections", yogaCourseService.getAllSection()); // model.addAttribute("customer", loggedCustomer); // return "requestWaiver"; // } @RequestMapping(value = "/showSections/registerForSection/{sectionId}", method = RequestMethod.GET) public String showSectionRegister(HttpServletRequest request, HttpServletResponse response, @PathVariable String sectionId, org.springframework.ui.Model model) { // model.addAttribute("sections", yogaCourseService.getSectionByCourseId(CourseId)); Section section = yogaCourseService.getSectionById(sectionId); Customer loggedCustomer = (Customer) request.getSession().getAttribute("loggedCustomer"); loggedCustomer = yogaCourseService.getCustomerById(loggedCustomer.getId()); this.currentCustomerId = loggedCustomer.getId(); for (Customer customer : section.getCustomerList()) { if (customer.getId() == currentCustomerId) { model.addAttribute("waivers", loggedCustomer.getWaiverList()); model.addAttribute("sections", yogaCourseService.getAllSection()); model.addAttribute("customer", loggedCustomer); return "youWereRegistered"; } } //if (yogaCourseService.getSectionById(sectionId).getCourse().getPrerequestic() == null) { if (this.fullFillPrerequisite(sectionId) == false) { return "temRequestWaiver"; } //} if (section.getCustomerList().size() >= section.getSectionSize()) { section.getWaitingList().add(yogaCourseService.getCustomerById(currentCustomerId)); return "placedInWaitingList"; } //yogaCourseService.getCustomerById(currentCustomerId).getSectionList().add(section); //loggedCustomer = yogaCourseService.getCustomerById(loggedCustomer.getId()); loggedCustomer.getSectionList().add(section); section.getCustomerList().add(loggedCustomer); // yogaCourseService.registerCustomer(section); yogaCourseService.updateSection(section); yogaCourseService.updateCustomer(loggedCustomer); // model.addAttribute("sections", yogaCourseService.getSectionsByCustomerId(currentCustomer.getId())); return "sectionRegistrationSucess"; } @RequestMapping(value = "/registerForSection/{sectionId}", method = RequestMethod.GET) public String registerForSection(HttpServletRequest request, HttpServletResponse response, @PathVariable String sectionId, org.springframework.ui.Model model) { // model.addAttribute("sections", yogaCourseService.getSectionByCourseId(CourseId)); Section section = yogaCourseService.getSectionById(sectionId); Customer loggedCustomer = (Customer) request.getSession().getAttribute("loggedCustomer"); this.currentCustomerId = loggedCustomer.getId(); for (Customer customer : section.getCustomerList()) { if (customer.getId() == currentCustomerId) { return "youWereRegistered"; } } // if (yogaCourseService.getSectionById(sectionId).getCourse().getPrerequestic() == null) { if (this.fullFillPrerequisite(sectionId) == false) { return "temRequestWaiver"; } // } if (section.getCustomerList().size() >= section.getSectionSize()) { section.getWaitingList().add(yogaCourseService.getCustomerById(currentCustomerId)); return "placedInWaitingList"; } //yogaCourseService.getCustomerById(currentCustomerId).getSectionList().add(section); loggedCustomer = yogaCourseService.getCustomerById(loggedCustomer.getId()); loggedCustomer.getSectionList().add(section); section.getCustomerList().add(loggedCustomer); // yogaCourseService.registerCustomer(section); yogaCourseService.updateSection(section); yogaCourseService.updateCustomer(loggedCustomer); // model.addAttribute("sections", yogaCourseService.getSectionsByCustomerId(currentCustomer.getId())); return "sectionRegistrationSucess"; } @RequestMapping(value = "/applyForWaiver", method = RequestMethod.GET) public String applyForWaiver(org.springframework.ui.Model model) { // model.addAttribute("sections", yogaCourseService.getAllSection()); return "applyForWaiver"; } @RequestMapping(value = "/temRequestWaiver", method = RequestMethod.GET) public String temRequestWaiver(org.springframework.ui.Model model) { // model.addAttribute("sections", yogaCourseService.getAllSection()); return "temRequestWaiver"; } @RequestMapping(value = "/youWereRegistered", method = RequestMethod.GET) public String youWereRegistered(org.springframework.ui.Model model) { // model.addAttribute("sections", yogaCourseService.getAllSection()); return "youWereRegistered"; } // @RequestMapping(value = "/dropSection/{sectionId}", method = RequestMethod.GET) // public String dropSection(@PathVariable String sectionId, org.springframework.ui.Model model) { // // model.addAttribute("sections", yogaCourseService.getSectionByCourseId(CourseId)); // Section section = yogaCourseService.getSectionById(sectionId); // section.getCustomerList().remove(currentCustomer); // yogaCourseService.registerCustomer(section); // return "registeredSectionList"; // } @RequestMapping(value = "/placedInWaitingList", method = RequestMethod.GET) public String placedInWaitingList(org.springframework.ui.Model model) { // model.addAttribute("sections", yogaCourseService.getAllSection()); return "placedInWaitingList"; } public boolean fullFillPrerequisite(String sectionId) { boolean hasPrerequsite = true; currentCourse = yogaCourseService.getSectionById(sectionId).getCourse(); Customer customer = yogaCourseService.getCustomerById(currentCustomerId); for (Course prerequisite : currentCourse.getPrerequestic()) { hasPrerequsite = false; for (Course completedCourse : customer.getCompletedCourses()) { if (prerequisite.getCourseName().equalsIgnoreCase(completedCourse.getCourseName())) { hasPrerequsite = true; } } if (hasPrerequsite == false) { return false; } } return hasPrerequsite; } }
[ "chandilian29@gmail.com" ]
chandilian29@gmail.com
bb43140f9ba28261f098a6ad31ac319d3c8b9a0f
e37b9d4b70ea9cc27a5a78650361892ced9a1eb5
/jira-querydsl4-schema/src/main/java/org/everit/jira/querydsl/schema/QOsCurrentstep.java
0552f691ffa6b22f87388b62009e3405279cf575
[]
no_license
adam-kicsak/jira-querydsl4
c74becc9ba4d3116c22f3783a94ff81921fe3a8b
95df09df812be4b6e7965295d7fee7ba84a4b63b
refs/heads/master
2021-01-10T14:50:48.054408
2015-12-02T10:17:52
2015-12-02T10:17:52
46,919,585
0
1
null
null
null
null
UTF-8
Java
false
false
4,100
java
/* * Copyright (C) 2011 EverIT Kft. (https://www.everit.biz) * * 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.everit.jira.querydsl.schema; import static com.querydsl.core.types.PathMetadataFactory.*; import com.querydsl.core.types.dsl.*; import com.querydsl.core.types.PathMetadata; import javax.annotation.Generated; import com.querydsl.core.types.Path; import com.querydsl.sql.ColumnMetadata; import java.sql.Types; /** * QOsCurrentstep is a Querydsl query type for QOsCurrentstep */ @Generated("com.querydsl.sql.codegen.MetaDataSerializer") public class QOsCurrentstep extends com.querydsl.sql.RelationalPathBase<QOsCurrentstep> { private static final long serialVersionUID = -1998232567; public static final QOsCurrentstep osCurrentstep = new QOsCurrentstep("OS_CURRENTSTEP"); public final NumberPath<Integer> actionId = createNumber("actionId", Integer.class); public final StringPath caller = createString("caller"); public final DateTimePath<java.sql.Timestamp> dueDate = createDateTime("dueDate", java.sql.Timestamp.class); public final NumberPath<Long> entryId = createNumber("entryId", Long.class); public final DateTimePath<java.sql.Timestamp> finishDate = createDateTime("finishDate", java.sql.Timestamp.class); public final NumberPath<Long> id = createNumber("id", Long.class); public final StringPath owner = createString("owner"); public final DateTimePath<java.sql.Timestamp> startDate = createDateTime("startDate", java.sql.Timestamp.class); public final StringPath status = createString("status"); public final NumberPath<Integer> stepId = createNumber("stepId", Integer.class); public final com.querydsl.sql.PrimaryKey<QOsCurrentstep> sysIdx137 = createPrimaryKey(id); public QOsCurrentstep(String variable) { super(QOsCurrentstep.class, forVariable(variable), "PUBLIC", "OS_CURRENTSTEP"); addMetadata(); } public QOsCurrentstep(String variable, String schema, String table) { super(QOsCurrentstep.class, forVariable(variable), schema, table); addMetadata(); } public QOsCurrentstep(Path<? extends QOsCurrentstep> path) { super(path.getType(), path.getMetadata(), "PUBLIC", "OS_CURRENTSTEP"); addMetadata(); } public QOsCurrentstep(PathMetadata metadata) { super(QOsCurrentstep.class, metadata, "PUBLIC", "OS_CURRENTSTEP"); addMetadata(); } public void addMetadata() { addMetadata(actionId, ColumnMetadata.named("ACTION_ID").withIndex(4).ofType(Types.INTEGER)); addMetadata(caller, ColumnMetadata.named("CALLER").withIndex(10).ofType(Types.VARCHAR).withSize(2147483647)); addMetadata(dueDate, ColumnMetadata.named("DUE_DATE").withIndex(7).ofType(Types.TIMESTAMP).withSize(6)); addMetadata(entryId, ColumnMetadata.named("ENTRY_ID").withIndex(2).ofType(Types.BIGINT)); addMetadata(finishDate, ColumnMetadata.named("FINISH_DATE").withIndex(8).ofType(Types.TIMESTAMP).withSize(6)); addMetadata(id, ColumnMetadata.named("ID").withIndex(1).ofType(Types.BIGINT).notNull()); addMetadata(owner, ColumnMetadata.named("OWNER").withIndex(5).ofType(Types.VARCHAR).withSize(2147483647)); addMetadata(startDate, ColumnMetadata.named("START_DATE").withIndex(6).ofType(Types.TIMESTAMP).withSize(6)); addMetadata(status, ColumnMetadata.named("STATUS").withIndex(9).ofType(Types.VARCHAR).withSize(2147483647)); addMetadata(stepId, ColumnMetadata.named("STEP_ID").withIndex(3).ofType(Types.INTEGER)); } }
[ "adam.kicsak@everit.biz" ]
adam.kicsak@everit.biz
ee13c7e06b2f1525331d35c3ab68d3672bb64dd6
1e615ac3f11820d798ecac41e7782e0efa96e1a2
/src/main/entity/Location.java
e27a806e043669801e0c53175523dfa78a98a22c
[]
no_license
BuiXuanThaiDEV/AgraphDB
fdcb0d8b88089735476f6ba4fa550eccc1080018
a4cd932eac75b5b2a9c10cea6609332ebb2b3eab
refs/heads/master
2020-04-09T04:32:35.854021
2018-12-25T10:43:59
2018-12-25T10:43:59
160,027,341
0
1
null
null
null
null
UTF-8
Java
false
false
1,181
java
package main.entity; import main.database.Triple; import java.util.ArrayList; public class Location extends ParentObject { private String country; public Location(String id, String label, String description, Source source, String type) { super(id, label, description, source, type); } public Location(String id, String label, String description, Source source, String type, String country) { super(id, label, description, source, type); this.country = country; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } @Override public void displayInfor() { super.displayInfor(); if (country != null) System.out.println("country : " + country); System.out.println("----"); } @Override public ArrayList toTriple() { ArrayList triples = super.toTriple(); String IDString = getIDString(); if (country != null) { Triple triple1 = new Triple(IDString, "country", country); triples.add(triple1); } return triples; } }
[ "300conga@gmail.com" ]
300conga@gmail.com
94f138f83c771ec22171450a5a4289a8342ac463
ed5a6bd2f224b1a74037916781a56c78ac2306da
/DoctorRestApi/src/main/java/com/app/dao/IDoctorDao.java
59a9c92bda6f8b78b97c51c83e545a6bc65b047a
[]
no_license
Gayatri0513/AppointmentSystem
388b81d34e23369f503a799e60a2e67152e18718
c61fa2ff2c2147a024ac1b4fc6f7538ad7d3bb8f
refs/heads/main
2023-03-02T11:46:30.527723
2021-02-09T17:15:03
2021-02-09T17:15:03
335,221,104
0
0
null
null
null
null
UTF-8
Java
false
false
711
java
package com.app.dao; import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import com.app.pojos.Doctor; import com.app.pojos.DoctorSpecialization; import com.app.pojos.Patient; public interface IDoctorDao extends JpaRepository<Doctor,Integer> { List<Doctor> findAll(); Optional<Doctor> findByDoctorId(Integer doctorId); //search by doctor name Optional<Doctor> findByFirstName(String doctorName); Doctor findByEmailAndPassword(String email,String password ); List<Doctor> findAllByFlag(boolean value); List<Doctor> findAllByDoctorSpecializationAndFlag(DoctorSpecialization specialization,boolean flag); }
[ "gayatrisharma0513@gmail.com" ]
gayatrisharma0513@gmail.com
500523d4f79633b11973ccf5d5d6a618f1e9d2f2
c79bad4f601f6b1ed82f49187b3b3bf93ce3c449
/src/main/java/com/fzjianzhi/jianzhi/base/system/role/SystemRoleService.java
de4000584a0c79b8cb9fd6c8211c826465478fee
[]
no_license
numb-men/jianzhi
8c2dc90d0b5a8a3b5b23eeaae2fb2ecd1e8f5c4e
e202cfc776dc21d2dc02129efaa872bea2a7e761
refs/heads/master
2020-07-27T07:18:39.277295
2019-09-19T09:27:16
2019-09-19T09:27:16
208,960,734
0
0
null
null
null
null
UTF-8
Java
false
false
1,737
java
package com.fzjianzhi.jianzhi.base.system.role; import com.fzjianzhi.jianzhi.base.mvc.BaseService; import com.fzjianzhi.jianzhi.base.system.exception.common.SystemException; import com.fzjianzhi.jianzhi.base.system.exception.enums.SystemResultEnum; import com.fzjianzhi.jianzhi.base.system.resource.SystemResourceEntity; import com.fzjianzhi.jianzhi.base.system.resource.SystemResourceService; import org.springframework.stereotype.Service; import javax.annotation.Resource; /** * SystemRoleService * * @author hengyumo * @version 1.0 * @since 2019/9/11 */ @Service public class SystemRoleService extends BaseService<SystemRoleEntity, Long> { @Resource private SystemResourceService systemResourceService; private SystemRoleEntity systemRoleEntity; private SystemResourceEntity systemResourceEntity; public void addResource(Long roleId, Long resourceId) { setRoleAndResource(roleId, resourceId); systemRoleEntity.getResources().add(systemResourceEntity); save(systemRoleEntity); } public void deleteResource(Long roleId, Long resourceId) { setRoleAndResource(roleId, resourceId); systemRoleEntity.getResources().remove(systemResourceEntity); save(systemRoleEntity); } private void setRoleAndResource(Long roleId, Long resourceId) { systemRoleEntity = findOne(roleId).orElse(null); if (systemRoleEntity == null) { throw new SystemException(SystemResultEnum.ROLE_NOT_FOUND); } systemResourceEntity = systemResourceService.findOne(resourceId).orElse(null); if (systemResourceEntity == null) { throw new SystemException(SystemResultEnum.RESOURCE_NOT_FOUND); } } }
[ "le@hengyumo.cn" ]
le@hengyumo.cn
c8c58cfb61f12a30721240a5fa779c9e96030aa3
fc6e4250dbbbaed8e1899e1dbcbcbee752e1ce30
/src/Squeak.java
628b87079dd2961e76d11c3e57b511564b81048d
[]
no_license
ashleyeatly/CSF202Labs
f5a826b5c793b725a2065a3a0fb7b04b52b69c20
0b7b58de3062b690580ed4da8056a0cf3ecf9468
refs/heads/main
2023-08-27T23:35:10.365282
2021-11-07T22:13:38
2021-11-07T22:13:38
425,624,843
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
// 5.1 4 Create implementations of interfaces public class Squeak implements QuackBehaviour { @Override public void quack() { System.out.println("Squeak ...."); } }
[ "Ashley.Eatly@dvla.gov.uk" ]
Ashley.Eatly@dvla.gov.uk
39a32aa953b31eb515402b471f3d9b9a979d2823
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.minihd.qq/assets/exlibs.2.jar/classes.jar/com/tencent/tmassistant/e.java
36abc40f691588a0991db14e6bf203aae7201f10
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
3,258
java
package com.tencent.tmassistant; import android.content.Context; import com.tencent.tmassistantsdk.internal.b.b; import java.util.ArrayList; import java.util.Iterator; public class e { protected static e a = null; protected static ArrayList c = new ArrayList(); protected static ArrayList d = new ArrayList(); protected Context b = null; protected e(Context paramContext) { this.b = paramContext; } public static e a(Context paramContext) { try { if (a == null) { a = new e(paramContext); } paramContext = a; return paramContext; } finally {} } public b a(String paramString) { for (;;) { try { Iterator localIterator = d.iterator(); if (localIterator.hasNext()) { b localb = (b)localIterator.next(); boolean bool = localb.c.equals(paramString); if (bool == true) { paramString = localb; return paramString; } } else { paramString = new b(this.b, paramString, "com.tencent.android.qqdownloader.SDKService"); if (paramString.e()) { d.add(paramString); } else { paramString = null; } } } finally {} } } /* Error */ public boolean b(String paramString) { // Byte code: // 0: aload_0 // 1: monitorenter // 2: getstatic 22 com/tencent/tmassistant/e:c Ljava/util/ArrayList; // 5: invokevirtual 37 java/util/ArrayList:iterator ()Ljava/util/Iterator; // 8: astore_3 // 9: aload_3 // 10: invokeinterface 43 1 0 // 15: ifeq +49 -> 64 // 18: aload_3 // 19: invokeinterface 47 1 0 // 24: checkcast 72 com/tencent/tmassistant/b // 27: astore 4 // 29: aload 4 // 31: ifnull -22 -> 9 // 34: aload 4 // 36: getfield 73 com/tencent/tmassistant/b:c Ljava/lang/String; // 39: aload_1 // 40: invokevirtual 58 java/lang/String:equals (Ljava/lang/Object;)Z // 43: iconst_1 // 44: if_icmpne -35 -> 9 // 47: aload 4 // 49: invokevirtual 76 com/tencent/tmassistant/b:f ()V // 52: aload_3 // 53: invokeinterface 79 1 0 // 58: iconst_1 // 59: istore_2 // 60: aload_0 // 61: monitorexit // 62: iload_2 // 63: ireturn // 64: iconst_0 // 65: istore_2 // 66: goto -6 -> 60 // 69: astore_1 // 70: aload_0 // 71: monitorexit // 72: aload_1 // 73: athrow // Local variable table: // start length slot name signature // 0 74 0 this e // 0 74 1 paramString String // 59 7 2 bool boolean // 8 45 3 localIterator Iterator // 27 21 4 localb b // Exception table: // from to target type // 2 9 69 finally // 9 29 69 finally // 34 58 69 finally } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.2.jar\classes.jar * Qualified Name: com.tencent.tmassistant.e * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
d1b90c0ed511fcb5468f0f965d8b5212cc6e1e97
2d47e9e4423850b93e2368035390fa0fe1b6fb7d
/xcx_web/src/main/java/com/sanbangzi/xcx_web/api/CompanyController.java
0ac230ff8c2e6c803e0a2b3134befdf8002c113e
[]
no_license
sushaoqi/demo_mall
d8306b3885654b4220095d236e5785c37a755cfc
7c4058b323a43caae77d2d663d6d323fa110f65e
refs/heads/master
2021-01-08T10:48:18.534048
2019-05-14T06:39:29
2019-05-14T06:39:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,941
java
package com.sanbangzi.xcx_web.api; import com.sanbangzi.common.utils.WebResponse; import com.sanbangzi.company_service_api.api.CompanyBannerService; import com.sanbangzi.company_service_api.api.CompanyProductTypeService; import com.sanbangzi.company_service_api.api.CompanyService; import com.sanbangzi.domain.dto.res.CompanyBannerResDTO; import com.sanbangzi.xcx_web.annotation.IgnoreLogin; import com.sanbangzi.xcx_web.annotation.RequestParamsNotEmpty; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/company") public class CompanyController extends BaseController { @Autowired private CompanyBannerService companyBannerService; @Autowired private CompanyProductTypeService companyProductTypeService; @Autowired private CompanyService companyService; @IgnoreLogin @GetMapping("/config") @RequestParamsNotEmpty(names = {"companyId"}) public WebResponse config(Long companyId) throws Exception { return xcxSuccess(companyService.config(companyId)); } @IgnoreLogin @GetMapping("/getById") @RequestParamsNotEmpty(names = {"companyId"}) public WebResponse getById(Long companyId) throws Exception { return xcxSuccess(companyService.getById(companyId)); } @IgnoreLogin @GetMapping("/banner") @RequestParamsNotEmpty(names = {"companyId"}) public WebResponse banner(Long companyId) throws Exception { List<CompanyBannerResDTO> companyBannerResDTOS = companyBannerService.listByCompanyId(companyId); return xcxSuccess(companyBannerResDTOS); } @IgnoreLogin @GetMapping("/productType") @RequestParamsNotEmpty(names = {"companyId"}) public WebResponse productType(Long companyId) throws Exception { return xcxSuccess(companyProductTypeService.listByCompanyId(companyId)); } }
[ "wangwj@i31.com" ]
wangwj@i31.com
f91543164c899f0d3f4811bffd172e9b522a76c4
bf1414b48ca348295b0e3dbf77b038fc8e91134f
/src/club/codeapes/common/api/ipip/getLinuxIp.java
0dfb8492f3613f7eba917de7acb33a952a594892
[]
no_license
geke520/ExpressAndroid
59fce5fa01fd6776557637c68f08c5e0d3dea413
1183af767396e6fd3aae4e963772b2a37fbfb22e
refs/heads/main
2023-04-10T15:33:36.922691
2021-04-23T09:02:25
2021-04-23T09:02:25
360,823,897
0
0
null
null
null
null
UTF-8
Java
false
false
2,299
java
package club.codeapes.common.api.ipip; import java.net.Inet6Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; public class getLinuxIp { public static void main(String[] args) { getLinuxIp t = new getLinuxIp(); System.out.println(t.getLocalIP()); System.out.println(t.getMacAddr()); } public static String getMacAddr() { String MacAddr = ""; String str = ""; try { NetworkInterface NIC = NetworkInterface.getByName("eth0"); byte[] buf = NIC.getHardwareAddress(); for (int i = 0; i < buf.length; i++) { str = str + byteHEX(buf[i]); } MacAddr = str.toUpperCase(); } catch (SocketException e) { e.printStackTrace(); System.exit(-1); } return MacAddr; } public static String getLocalIP() { String ip = ""; try { Enumeration<?> e1 = (Enumeration<?>) NetworkInterface.getNetworkInterfaces(); while (e1.hasMoreElements()) { NetworkInterface ni = (NetworkInterface) e1.nextElement(); if (!ni.getName().equals("eth0")) { continue; } else { Enumeration<?> e2 = ni.getInetAddresses(); while (e2.hasMoreElements()) { InetAddress ia = (InetAddress) e2.nextElement(); if (ia instanceof Inet6Address) continue; ip = ia.getHostAddress(); } break; } } } catch (SocketException e) { e.printStackTrace(); System.exit(-1); } return ip; } /* 一个将字节转化为十六进制ASSIC码的函数 */ public static String byteHEX(byte ib) { char[] Digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a','b', 'c', 'd', 'e', 'f' }; char[] ob = new char[2]; ob[0] = Digit[(ib >>> 4) & 0X0F]; ob[1] = Digit[ib & 0X0F]; String s = new String(ob); return s; } }
[ "18684706805@163.com" ]
18684706805@163.com
b97f3e82af5f4327cc695d7bd4160aa53ce77562
8ab06127644dc0469375cb91d318b4e8480249df
/schema/src/main/java/com/springer/api/schema/xpp/TheadImpl.java
eaf9437ec9f8fa138c990baeb570b0ac2e3a3700
[]
no_license
GordinMaxim/sprinder_loader
8a434612043fbe410720120eb9effb6af6b31bf2
41437324168d373ae34a19c0d0413319a0f5126d
refs/heads/master
2021-01-15T23:02:00.221993
2015-03-23T03:01:33
2015-03-23T03:01:33
32,708,118
0
0
null
null
null
null
UTF-8
Java
false
false
2,498
java
/* * Copyright 2010-2011 Nabeel Mukhtar * * 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.springer.api.schema.xpp; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; import com.springer.api.schema.Row; import com.springer.api.schema.Thead; /** * The Class TheadImpl. */ public class TheadImpl extends BaseSchemaEntity implements Thead { /** The Constant serialVersionUID. */ private final static long serialVersionUID = 2461660169443089969L; /** The rows. */ protected List<Row> rows; /* (non-Javadoc) * @see com.springer.api.schema.Thead#getRows() */ public List<Row> getRows() { if (rows == null) { rows = new ArrayList<Row>(); } return this.rows; } /* (non-Javadoc) * @see com.springer.api.schema.xpp.BaseSchemaEntity#init(org.xmlpull.v1.XmlPullParser) */ @Override public void init(XmlPullParser parser) throws IOException, XmlPullParserException { parser.require(XmlPullParser.START_TAG, null, null); while (parser.nextTag() == XmlPullParser.START_TAG) { String name = parser.getName(); if (name.equals("row")) { RowImpl node = new RowImpl(); node.init(parser); getRows().add(node); } else { // Consume something we don't understand. LOG.warning("Found tag that we don't recognize: " + name); XppUtils.skipSubTree(parser); } } } /* (non-Javadoc) * @see com.springer.api.schema.xpp.BaseSchemaEntity#toXml(org.xmlpull.v1.XmlSerializer) */ @Override public void toXml(XmlSerializer serializer) throws IOException { } }
[ "gormakc.ru@gmail.com" ]
gormakc.ru@gmail.com
24bc4154eff0a2a869a2eac5296f3a27f2425657
ec6ce601b875df01c11ac901f5b266fbe32464d6
/DiscountCalculatorSolution/source/DiscountCalculator/src/main/java/com/sg/gsc/interview/tanb/discalc/model/Brand.java
c70a43193b8b69bf9a2ab6d50dac87e19147aac6
[]
no_license
tanmoybanerjee2003/javaPOC
8995b948dab5aedb6dda31c03a7576a5aeee954f
9fe8e89dd145e180d2439821baf28ea3545ea96b
refs/heads/master
2021-09-07T17:13:14.334382
2018-02-26T17:43:08
2018-02-26T17:43:08
112,336,745
0
0
null
null
null
null
UTF-8
Java
false
false
1,338
java
/** * */ package com.sg.gsc.interview.tanb.discalc.model; import java.util.List; import com.sg.gsc.interview.tanb.discalc.util.DoubleUtil; import com.sg.gsc.interview.tanb.discalc.util.StringUtil; /** * @author tanmoy * */ public class Brand { private String name; private double discountPercent; /** * @param name * @param discountPercent */ public Brand(String name, double discountPercent) { this.name = name; this.discountPercent = discountPercent; } /** * * @param brandData */ public Brand(List<String> brandData) { if((brandData != null) && (brandData.size() > 0)) { String name = brandData.get(0); if(!StringUtil.isEmpty(name, true)) { this.name = name; //brand discount is optional if(brandData.size() >= 2) { String discountPercentStr = brandData.get(1); if(!StringUtil.isEmpty(discountPercentStr, true)) { discountPercent = DoubleUtil.round(Double.parseDouble(discountPercentStr.trim()), 2); } else { discountPercent = 0; } } else { discountPercent = 0; } } } } /** * @return the name */ public String getName() { return name; } /** * @return the discountPercent */ public double getDiscountPercent() { return discountPercent; } }
[ "noreply@github.com" ]
noreply@github.com
e2c75c7cb121524f3d7ecd93ca79854d34cbc60e
41bcc770cd6ecaed08c518ed1e3fd0a68de0927f
/agarwalamit/src/main/java/playground/agarwalamit/fundamentalDiagrams/dynamicPCU/estimation/LinkPCUInfoCollector.java
87ed0c874b795d706e0c7bef0daffb146dd0598c
[]
no_license
zhuyuan0624/playgrounds
ed822de1c744b83dea4693bebd71c73cf5dbccb2
98d8b430790d39666072ea4a66f392d87d2c1280
refs/heads/master
2021-01-01T19:33:28.217457
2017-07-27T10:06:28
2017-07-27T10:06:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,970
java
/* *********************************************************************** * * project: org.matsim.* * * * *********************************************************************** * * * * copyright : (C) 2017 by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * * *********************************************************************** * * * * This program 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 2 of the License, or * * (at your option) any later version. * * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ package playground.agarwalamit.fundamentalDiagrams.dynamicPCU.estimation; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; /** * Created by amit on 29.06.17. * * update pcu at the end of track, eventually, this will also have effect on flow capacity * */ public class LinkPCUInfoCollector { private final Id<Link> linkId; private final double timeBin; private double pcu; LinkPCUInfoCollector (final Id<Link> linkId, final double timeBin) { this.linkId = linkId; this.timeBin = timeBin; } public double getPCU () { return this.pcu; } }
[ "amit.agarwal@campus.tu-berlin.de" ]
amit.agarwal@campus.tu-berlin.de
f0ebf0ad00b267aa48f8033d7002c6818e01daf9
d44491429deae5b7d21bc272dea9f24635a44d87
/app/src/main/java/com/example/kurobe/javalog/Thinkable.java
526bbaec285aec3ee7395835b989be294d01760e
[]
no_license
Yuuki-Kurobe/Human
c94317122de4c27ed0e85abaabc4a71688bb182c
bba7a8dfa995bccbe8b722b808f9da2553c0e1aa
refs/heads/master
2021-01-17T18:02:36.930376
2017-06-27T08:38:27
2017-06-27T08:38:27
95,535,140
0
0
null
null
null
null
UTF-8
Java
false
false
138
java
package com.example.kurobe.javalog; /** * Created by kurobe on 2017/06/27. */ public interface Thinkable { public void think(); }
[ "yuuki.kurobe@infodex.co.jp" ]
yuuki.kurobe@infodex.co.jp
8d279fca121b83b3aa3b17fc515dda40a54a37bd
8dbc1870e27b8df67d81ef9683a8b14e96a9fd75
/api/src/edu/utep/trustlab/visko/util/GetURLContents.java
171c8de2c7c257a2672d4028da87cb4f5b69caaa
[]
no_license
temoc28/visko
52dc6830e367fb34584c3badc68a97d198b3c4d7
5652302dfd6a157254ab655d93aa44ee5670ee71
refs/heads/master
2021-01-21T00:36:19.578186
2012-03-23T01:10:27
2012-03-23T01:10:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,651
java
/* Copyright (c) 2012, University of Texas at El Paso All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ /* Copyright (c) 2012, University of Texas at El Paso All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ package edu.utep.trustlab.visko.util; import java.io.*; import java.net.*; public class GetURLContents { public static byte[] downloadFile(String url) {// download file via http // protocol and return // contents as byte array try { ByteArrayOutputStream output = new ByteArrayOutputStream(); // initialize connection URL someURL = new URL(url); URLConnection fileLocation = someURL.openConnection(); BufferedInputStream bis = new BufferedInputStream( fileLocation.getInputStream()); byte[] buff = new byte[1024]; int bytesRead; // int totalBytes = 0; // Simple read/write loop while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) { output.write(buff, 0, bytesRead); } // close inputstream bis.close(); return output.toByteArray(); } catch (MalformedURLException u) { u.printStackTrace(); return null; } catch (IOException i) { i.printStackTrace(); return null; } } public static String downloadText(String _uri) throws IOException, MalformedURLException { return GetURLContents.downloadText(new URL(_uri)); } public static String downloadText(URL u) throws IOException { URLConnection conn = u.openConnection(); conn.setUseCaches(true); Object resp = conn.getContent(); // String ct = conn.getContentType(); InputStream body = (InputStream) resp; InputStreamReader isr = new InputStreamReader(body); LineNumberReader lr = new LineNumberReader(isr); StringBuffer ret = new StringBuffer(); while (true) { String line = lr.readLine(); // System.out.println("Line:" + line); if (line == null) { break; } // ret.append(line).append(System.getProperty("line.separator")); ret.append(line).append("\n"); } return ret.toString(); } public static String downloadRawChars(String _uri) throws IOException, MalformedURLException { return GetURLContents.downloadRawChars(new URL(_uri)); } public static String downloadRawChars(URL u) throws IOException { URLConnection conn = u.openConnection(); Object resp = conn.getContent(); // String ct = conn.getContentType(); InputStream body = (InputStream) resp; StringBuffer ret = new StringBuffer(); int currentChar; while ((currentChar = body.read()) != -1) { ret.append(Character.toString((char) currentChar)); } return ret.toString(); } public static boolean isWellFormedURL(String url) { try { new URL(url); return true; } catch (Exception e) { e.printStackTrace(); } return false; } public static URI getURI(String namespace) { URI ontURI = null; try { ontURI = new URI(namespace); } catch (URISyntaxException e) { e.printStackTrace(); } return ontURI; } public static String getContentType(String urlStr) throws IOException, MalformedURLException { String cType = null; URL url = new URL(urlStr); URLConnection conn = url.openConnection(); cType = conn.getContentType(); return cType; } } /* END of GetURLContents */
[ "nicholas.delrio@gmail.com" ]
nicholas.delrio@gmail.com
d27f30ebc59912dfa63ddabb1b1473b0275a34f4
beb0fae36d51bf6acc3ffc3d9b1b0bfe3e6e3d1a
/core/src/main/java/com/aurora/impuestos/entidades/TipoGasto.java
29ac4f6034aa8b4ed1c6ff4e1abada1c6b7af945
[]
no_license
cclozano/facturador
b1ac49df4a5c3fad7f45f255386e98f724f7bc9c
d40bca120ffa32389880ffee12754e5813e9de61
refs/heads/master
2023-02-17T20:20:05.901952
2019-12-24T16:04:05
2019-12-24T16:04:05
329,779,650
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package com.aurora.impuestos.entidades; public enum TipoGasto { VIVIENDA("Vivienda"), EDUCACION("Educacion"), SALUD("Salud"), ALIMENTACION("Alimentacion"), VESTIMENTA("Vivienda"), OTROS("Otros"); private String value; TipoGasto(String value) { this.value = value; } public String getValue() { return value; } }
[ "cclozano@gmail.com" ]
cclozano@gmail.com
8019af5b25478e1c496d87b6f25a553c38a646bb
92f06600f6e6959c13a61b416809c8cfc613778b
/src/main/java/kodlamaio/hrms/Adapters/abstracts/EmailValidatorService.java
ba3b56137e25f70992305c56e4a34e7d5ce7d685
[]
no_license
Dxdiagx/Hrms
80f6a37d1bc07b5f853c37174cad8fb32f2f3d5f
77d5a1c3a99b6ff1af085f90f004f7d6c5704eab
refs/heads/master
2023-05-06T16:25:03.452147
2021-06-06T22:23:32
2021-06-06T22:23:32
372,040,583
2
0
null
null
null
null
UTF-8
Java
false
false
140
java
package kodlamaio.hrms.Adapters.abstracts; public interface EmailValidatorService { public boolean isEmailValid(String emailInput); }
[ "40319021+Dxdiagx@users.noreply.github.com" ]
40319021+Dxdiagx@users.noreply.github.com
932ddf514f64f88872bc111424f52a0e9404cc71
bd6278fede710f60ad28bd88382d29d70f6fb81d
/src/main/java/online/wangxuan/miaosha/controller/MiaoshaController.java
84f58752221981ee66262432ca4b36312f25048a
[]
no_license
Demons-wx/miaosha
b10751c25ce4eb14ba221f9377c8fbaed379808e
1f1971a93ef850b6eeebf9835f65d478e64ac3b6
refs/heads/master
2021-09-15T14:00:02.127045
2018-06-03T15:45:13
2018-06-03T15:45:13
135,917,587
0
0
null
null
null
null
UTF-8
Java
false
false
5,948
java
package online.wangxuan.miaosha.controller; import online.wangxuan.miaosha.domain.MiaoshaOrder; import online.wangxuan.miaosha.domain.MiaoshaUser; import online.wangxuan.miaosha.domain.OrderInfo; import online.wangxuan.miaosha.rabbitmq.MQSender; import online.wangxuan.miaosha.rabbitmq.MiaoshaMessage; import online.wangxuan.miaosha.redis.GoodsKey; import online.wangxuan.miaosha.redis.MiaoshaKey; import online.wangxuan.miaosha.redis.OrderKey; import online.wangxuan.miaosha.redis.RedisService; import online.wangxuan.miaosha.result.CodeMsg; import online.wangxuan.miaosha.result.Result; import online.wangxuan.miaosha.service.GoodsService; import online.wangxuan.miaosha.service.MiaoshaService; import online.wangxuan.miaosha.service.OrderService; import online.wangxuan.miaosha.vo.GoodsVo; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import java.util.HashMap; import java.util.List; /** * @author wangxuan * @date 2018/5/30 下午11:19 */ @Controller @RequestMapping("/miaosha") public class MiaoshaController implements InitializingBean { @Autowired GoodsService goodsService; @Autowired OrderService orderService; @Autowired MiaoshaService miaoshaService; @Autowired RedisService redisService; @Autowired MQSender sender; private HashMap<Long, Boolean> localOverMap = new HashMap<Long, Boolean>(); @RequestMapping("/do_miaosha") public String miaosha2(Model model, MiaoshaUser user, @RequestParam("goodsId") long goodsId) { model.addAttribute("user", user); if (user == null) { return "login"; } // 判断库存 GoodsVo goods = goodsService.getGoodsVoByGoodsId(goodsId); int stock = goods.getStockCount(); if (stock <= 0) { model.addAttribute(" errmsg", CodeMsg.MIAO_SHA_OVER.getMsg()); return "miaosha_fail"; } // 判断是否已经秒杀到了 MiaoshaOrder order = orderService.getMiaoshaOrderByUserIdGoodsId(user.getId(), goodsId); if (order != null) { model.addAttribute("errmsg", CodeMsg.REPEATE_MIAOSHA.getMsg()); return "miaosha_fail"; } // 减库存 下订单 写入秒杀订单 OrderInfo orderInfo = miaoshaService.miaosha(user, goods); model.addAttribute("orderInfo", orderInfo); model.addAttribute("goods", goods); return "order_detail"; } @RequestMapping(value="/do_miaosha", method= RequestMethod.POST) @ResponseBody public Result<Integer> miaosha(Model model, MiaoshaUser user, @RequestParam("goodsId")long goodsId) { model.addAttribute("user", user); if(user == null) { return Result.error(CodeMsg.SESSION_ERROR); } //内存标记,减少redis访问 boolean over = localOverMap.get(goodsId); if(over) { return Result.error(CodeMsg.MIAO_SHA_OVER); } // 预减库存 long stock = redisService.decr(GoodsKey.getMiaoshaGoodsStock, "" + goodsId); if (stock < 0) { localOverMap.put(goodsId, true); return Result.error(CodeMsg.MIAO_SHA_OVER); } //判断是否已经秒杀到了 MiaoshaOrder order = orderService.getMiaoshaOrderByUserIdGoodsId(user.getId(), goodsId); if(order != null) { return Result.error(CodeMsg.REPEATE_MIAOSHA); } // 入队 MiaoshaMessage message = new MiaoshaMessage(); message.setUser(user); message.setGoodsId(goodsId); sender.sendMiaoshaMessage(message); return Result.success(0); } /** * 系统初始化时调用 * @throws Exception */ @Override public void afterPropertiesSet() throws Exception { List<GoodsVo> goodsList = goodsService.listGoodsVo(); if (goodsList == null) { return; } for (GoodsVo goodsVo : goodsList) { redisService.set(GoodsKey.getMiaoshaGoodsStock, "" + goodsVo.getId(), goodsVo.getStockCount()); localOverMap.put(goodsVo.getId(), false); } } /** * * @param model * @param user * @param goodsId * @return 秒杀成功:orderId,失败:-1,排队中 0 */ @RequestMapping(value = "/result", method = RequestMethod.GET) @ResponseBody public Result<Long> miaoshaResult(Model model, MiaoshaUser user, @RequestParam("goodsId") long goodsId) { model.addAttribute("user", user); if (user == null) { return Result.error(CodeMsg.SESSION_ERROR); } long result = miaoshaService.getMiaoshaResult(user.getId(), goodsId); return Result.success(result); } @RequestMapping(value="/reset", method=RequestMethod.GET) @ResponseBody public Result<Boolean> reset(Model model) { List<GoodsVo> goodsList = goodsService.listGoodsVo(); for (GoodsVo goods : goodsList) { goods.setStockCount(10); redisService.set(GoodsKey.getMiaoshaGoodsStock, "" + goods.getId(), 10); localOverMap.put(goods.getId(), false); } redisService.delete(OrderKey.getMiaoshaOrderByUidGid); redisService.delete(MiaoshaKey.isGoodsOver); miaoshaService.reset(goodsList); return Result.success(true); } }
[ "demons_wx@163.com" ]
demons_wx@163.com
c1301c82851a159d8df134baddd675d28b0f8fd1
41f2f76f6878b8f058c7c52ee4e55cb41f974aaa
/common/src/main/java/de/l3s/common/features/TimeSeriesFeatures.java
bac3d5a16e6d192b81606a527ba26f800809aed6
[]
no_license
timetool/TemporalSearch
459f73e476159a2144f24f1f561378633adf2d2e
a3aedcc36800b14c62d8a30576467c9e88eeedf7
refs/heads/master
2020-04-05T17:17:23.984721
2017-03-23T15:21:19
2017-03-23T15:21:19
12,304,642
1
0
null
null
null
null
UTF-8
Java
false
false
26,814
java
package de.l3s.common.features; import java.util.Arrays; import org.rosuda.JRI.REXP; import org.rosuda.JRI.Rengine; import de.l3s.common.TextConsole; public class TimeSeriesFeatures { Rengine engine; public TimeSeriesFeatures(){ String[] rOptions = { "--vanilla" }; engine = new Rengine(rOptions, false, new TextConsole()); engine.eval("library(e1071)"); engine.eval("library(lsa)"); } /** * * @param lengthOfPeriod * @param timeSeries * @return */ public double[] computeAutoCorrel(int lengthOfPeriod, int[] timeSeries) { engine.assign("data", timeSeries); engine.eval("data <- ts(data, frequency =" + lengthOfPeriod +")",false); engine.eval("query_acf = acf(data, lag.max = NULL, plot = FALSE, type = \"correlation\", na.action = na.pass)",false); REXP x = engine.eval("query_acf$acf"); double[] scores = x.asDoubleArray(); System.out.println(Arrays.toString(scores)); return scores; } /** * get Kurtosis of the TimeSeries * @param timeSeries * @return */ public double getKurtosisTimeSeries(int[] timeSeries){ engine.assign("data", timeSeries); REXP x = engine.eval("kurtosis(data)"); double kurtosis = x.asDouble(); return kurtosis; } /** * * @param timeSeries * @return */ public double[] decomposeTSSeasonalityfromNYT(int[] timeSeries){ engine.assign("data", timeSeries); engine.eval("dataTs = ts(data,frequency=365,start=c(1987,01,01),end=c(2007,06,19))"); engine.eval("dataTsdecompose = decompose(dataTs)"); engine.eval("seasonal_acf = acf(dataTsdecompose$seasonal, lag.max = NULL, plot = FALSE, type = \"correlation\", na.action = na.pass)"); REXP x = engine.eval("seasonal_acf$acf"); double[] scores = x.asDoubleArray(); return scores; } /** * get seasonality value of the timeSeries * @param timeSeries * @return */ public double decomposeTSSeasonalityfromNYTwithCosineSim(int[] timeSeries){ engine.assign("data", timeSeries); engine.eval("dataTs = ts(data,frequency=12,start=c(1987,01))"); engine.eval("dataTsdecompose = decompose(dataTs)"); engine.eval("seasonal_vector = as.numeric(dataTsdecompose$seasonal)"); REXP x = engine.eval("cosine(data,seasonal_vector)"); return x.asDouble(); } /** * get seasonality value of the timeSeries * @param timeSeries * @return */ public double decomposeTSSeasonalityfromQLwithCosineSim(int[] timeSeries){ engine.assign("data", timeSeries); engine.eval("dataTs = ts(data,frequency=3)"); engine.eval("dataTsdecompose = decompose(dataTs)"); engine.eval("seasonal_vector = as.numeric(dataTsdecompose$seasonal)"); REXP x = engine.eval("cosine(data,seasonal_vector)"); return x.asDouble(); } /** * detect surprise (SSE on prediction model) short timeseries * @param timeSeries * @return */ public double exponentialSmoothingQLTimeseries(int[] timeSeries){ engine.assign("data", timeSeries); engine.eval("data_ts = ts(data,frequency=3)"); engine.eval("data_ts_forecasts = HoltWinters(data_ts, gamma=FALSE)"); REXP x = engine.eval("data_ts_forecasts$SSE"); return x.asDouble(); } public void endEngine(){ engine.end(); } public static void main(String[] args) { TimeSeriesFeatures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,22,2,9,3,0,3,1,7,0,0,1,1,1,2,0,3,2,2,0,0,1,0,3,1,0,2,0,3,0,1,0,1,0,0,0,3,1,0,0,6,0,0,0,3,0,0,1,0,1,0,0,3,0,0,0,0,0,0,0,0}; int[] american_idol_ts = {359,581,470,178,67,88,173,442,533,505,153,190,122,262,825,510,135,94,68,144,257,694,479,207,192,110,113,209,643,482,105,55,85,71,165,681,463,139,74,83,60,194,345,240,120,59,34,65,214,696,465,70,61,71,59,270,648,450,120,56,84,71,206,762,514,125,89,89,129,266,1244,1149,384,198,169,226,412,12,538,196,137,118,188,393,716,421,159,85,50,97,51,33}; System.out.println(sample_NYT.length); System.out.println(eval.getKurtosisTimeSeries(american_idol_ts)); System.out.println(eval.getKurtosisTimeSeries(april_fool_ts)); System.out.println("seasonality:"+ Arrays.toString(eval.decomposeTSSeasonalityfromNYT(sample_NYT))); System.out.println("Seasonality: " + eval.decomposeTSSeasonalityfromNYTwithCosineSim(sample_NYT)); eval.endEngine(); } }
[ "tumeteor@gmail.com" ]
tumeteor@gmail.com
7ffb26a2c906cd04f02c0f85e5cb911f1349a2fc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/17/17_9a6ecc18c828c61bf1a8dd65cf378023cf972d17/HtmlElementTest/17_9a6ecc18c828c61bf1a8dd65cf378023cf972d17_HtmlElementTest_t.java
44c84a8955fbce33cfe96957f0787f078e26e385
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
43,296
java
/* * Copyright (c) 2002-2008 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact info@GargoyleSoftware.com. * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit.html; import static org.junit.Assert.assertSame; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.Assert; import org.junit.Test; import org.w3c.dom.NodeList; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.WebTestCase; /** * Unit tests for {@link HtmlElement}. * * @version $Revision$ * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a> * @author Denis N. Antonioli * @author Daniel Gredler * @author Ahmed Ashour */ public class HtmlElementTest extends WebTestCase { /** * Test hasAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementHasAttributeWith() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should have attribute", true, node.hasAttribute("id")); } /** * Test hasAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementHasAttributeNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should not have attribute", false, node.hasAttribute("foo")); } /** * Test hasAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementHasAttributeNSWith() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should have attribute", true, node.hasAttributeNS("http://foobar", "foo")); } /** * Test hasAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementHasAttributeNSNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should not have attribute", false, node.hasAttributeNS("http://foobar", "foo")); } /** * Test getAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementGetAttributeWith() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should have attribute", "tag", node.getAttribute("id")); } /** * Test getAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementGetAttributeNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should not have attribute", "", node.getAttribute("foo")); } /** * Test getAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementGetAttributeNSWith() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should have attribute", "bar", node.getAttributeNS("http://foobar", "foo")); } /** * Test getAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementGetAttributeNSNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); Assert.assertEquals("Element should not have attribute", "", node.getAttributeNS("http://foobar", "foo")); } /** * Test getNamespaceURI on an attribute that has a namespace. * @throws Exception if the test fails */ @Test public void testElementGetNamespaceURIWith() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); for (final HtmlAttr attr : node.getAttributesCollection()) { if (attr.getName().equals("ns:foo")) { Assert.assertEquals("Element should have a namespace URI", "http://foobar", attr.getNamespaceURI()); return; } } Assert.assertFalse("Attribute ns:foo not found.", true); } /** * Test getNamespaceURI on an attribute that has a namespace. * @throws Exception if the test fails */ @Test public void testElementGetNamespaceURINone() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); for (final HtmlAttr attr : node.getAttributesCollection()) { if (attr.getName().equals("id")) { Assert.assertEquals("Element should not have a namespace URI", null, attr.getNamespaceURI()); return; } } Assert.assertFalse("Attribute ns:foo not found.", true); } /** * Test getLocalName on an attribute that has a local name. * @throws Exception if the test fails */ @Test public void testElementGetLocalNameWith() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); for (final HtmlAttr attr : node.getAttributesCollection()) { if (attr.getName().equals("ns:foo")) { Assert.assertEquals("Element should have a local name", "foo", attr.getLocalName()); return; } } Assert.assertFalse("Attribute ns:foo not found.", true); } /** * Test getLocalName on an attribute that has a local name. * @throws Exception if the test fails */ @Test public void testElementGetLocalNameNone() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); for (final HtmlAttr attr : node.getAttributesCollection()) { if (attr.getName().equals("id")) { // This is not standard, but to change it now would break backwards compatibility. Assert.assertEquals("Element should not have a local name", "id", attr.getLocalName()); return; } } Assert.assertFalse("Attribute ns:foo not found.", true); } /** * Test getPrefix on an attribute that has a prefix. * @throws Exception if the test fails */ @Test public void testElementGetPrefixWith() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); for (final HtmlAttr attr : node.getAttributesCollection()) { if (attr.getName().equals("ns:foo")) { Assert.assertEquals("Element should have a prefix", "ns", attr.getPrefix()); return; } } Assert.assertFalse("Attribute ns:foo not found.", true); } /** * Test getPrefix on an attribute that has a prefix. * @throws Exception if the test fails */ @Test public void testElementGetPrefixNone() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); for (final HtmlAttr attr : node.getAttributesCollection()) { if (attr.getName().equals("id")) { Assert.assertEquals("Element should not have a prefix", null, attr.getPrefix()); return; } } Assert.assertFalse("Attribute ns:foo not found.", true); } /** * Test setPrefix on an attribute that has a prefix. * @throws Exception if the test fails */ @Test public void testElementSetPrefix() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); for (final HtmlAttr attr : node.getAttributesCollection()) { if (attr.getName().equals("ns:foo")) { attr.setPrefix("other"); Assert.assertEquals("Element should have a changed prefix", "other", attr.getPrefix()); Assert.assertEquals("setPrefix should change qualified name", "other:foo", attr.getName()); return; } } Assert.assertFalse("Attribute ns:foo not found.", true); } /** * Test setAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementSetAttributeWith() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.setAttribute("id", "other"); Assert.assertEquals("Element should have attribute", "other", node.getAttribute("id")); } /** * Test setAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementSetAttributeNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.setAttribute("foo", "other"); Assert.assertEquals("Element should have attribute", "other", node.getAttribute("foo")); } /** * Test setAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementSetAttributeNSWith() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.setAttributeNS("http://foobar", "ns:foo", "other"); Assert.assertEquals("Element should have attribute", "other", node.getAttributeNS("http://foobar", "foo")); } /** * Test setAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementSetAttributeNSNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.setAttributeNS("http://foobar", "ns:foo", "other"); Assert.assertEquals("Element should not have attribute", "other", node.getAttributeNS("http://foobar", "foo")); } /** * Test removeAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementRemoveAttributeWith() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.removeAttribute("id"); Assert.assertEquals("Element should not have removed attribute", "", node.getAttribute("id")); } /** * Test removeAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementRemoveAttributeNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.removeAttribute("foo"); Assert.assertEquals("Element should not have attribute", "", node.getAttribute("foo")); } /** * Test removeAttribute() on an element with the attribute. * @throws Exception if the test fails */ @Test public void testElementRemoveAttributeNSWith() throws Exception { final String content = "<html><head></head><body xmlns:ns='http://foobar' id='tag' ns:foo='bar'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.removeAttributeNS("http://foobar", "foo"); Assert.assertEquals("Element should not have removed attribute", "", node.getAttributeNS("http://foobar", "foo")); } /** * Test removeAttribute() on an element without the attributes. * @throws Exception if the test fails */ @Test public void testElementRemoveAttributeNSNone() throws Exception { final String content = "<html><head></head><body id='tag'>text</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); final HtmlElement node = page.getDocumentHtmlElement().getHtmlElementById("tag"); node.removeAttributeNS("http://foobar", "foo"); Assert.assertEquals("Element should not have attribute", "", node.getAttributeNS("http://foobar", "foo")); } /** * Verifies that cloned node attributes have the same initial values, but changes can be made * to the clone without affecting the original node, and that the id attribute is treated the * same as all the other attributes. See bug 1707726. * @throws Exception if an error occurs */ @Test public void testClonedNodeAttributes() throws Exception { final String html = "<html><body id='a' title='b'><script>\n" + "var x = document.body.cloneNode(true);\n" + "alert(document.body==x);\n" + "alert(document.getElementById('a')==document.body);\n" + "alert(document.body.id);\n" + "alert(x.id);\n" + "alert(document.body.title);\n" + "alert(x.title);\n" + "x.title='c';\n" + "alert(document.body.title);\n" + "alert(x.title);\n" + "</script></body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); loadPage(html, collectedAlerts); final String[] expectedAlerts = {"false", "true", "a", "a", "b", "b", "b", "c"}; assertEquals(expectedAlerts, collectedAlerts); } /** * @throws Exception if the test fails */ @Test public void testGetEnclosingForm() throws Exception { final String htmlContent = "" + "<html><head><title>foo</title></head><body>\n" + "<form id='form1'>\n" + "<table><tr><td><input type='text' id='foo'/></td></tr></table>\n" + "</form></body></html>"; final HtmlPage page = loadPage(htmlContent); final HtmlForm form = (HtmlForm) page.getHtmlElementById("form1"); final HtmlInput input = (HtmlInput) form.getHtmlElementById("foo"); assertSame(form, input.getEnclosingForm()); } /** * @throws Exception if the test fails */ @Test public void testGetEnclosing() throws Exception { final String htmlContent = "" + "<html><head><title>foo</title></head><body>\n" + "<form id='form1'>\n" + "<table id='table1'>\n" + "<tr id='tr1'><td id='td1'>foo</td></tr>\n" + "<tr id='tr2'><td id='td2'>foo</td></tr>\n" + "</table>\n" + "</form></body></html>"; final HtmlPage page = loadPage(htmlContent); final HtmlElement td1 = page.getHtmlElementById("td1"); assertEquals("tr1", td1.getEnclosingElement("tr").getId()); assertEquals("tr1", td1.getEnclosingElement("TR").getId()); assertEquals("table1", td1.getEnclosingElement("table").getId()); assertEquals("form1", td1.getEnclosingElement("form").getId()); final HtmlElement td2 = page.getHtmlElementById("td2"); assertEquals("tr2", td2.getEnclosingElement("tr").getId()); assertEquals("tr2", td2.getEnclosingElement("TR").getId()); assertEquals("table1", td2.getEnclosingElement("table").getId()); assertEquals("form1", td2.getEnclosingElement("form").getId()); } /** * @throws Exception if the test fails */ @Test public void testAsText_WithComments() throws Exception { final String htmlContent = "<html><head><title>foo</title></head><body>\n" + "<p id='p1'>foo<!--bar--></p>\n" + "</body></html>"; final HtmlPage page = loadPage(htmlContent); final HtmlElement element = page.getHtmlElementById("p1"); assertEquals("foo", element.asText()); } /** * Tests constants. */ @Test public void testConstants() { assertEquals("", HtmlElement.ATTRIBUTE_NOT_DEFINED); assertEquals("", HtmlElement.ATTRIBUTE_VALUE_EMPTY); assertTrue("Not the same object", HtmlElement.ATTRIBUTE_NOT_DEFINED != HtmlElement.ATTRIBUTE_VALUE_EMPTY); } static class HtmlAttributeChangeListenerTestImpl implements HtmlAttributeChangeListener { private final List<String> collectedValues_ = new ArrayList<String>(); @Test public void attributeAdded(final HtmlAttributeChangeEvent event) { collectedValues_.add("attributeAdded: " + event.getHtmlElement().getTagName() + ',' + event.getName() + ',' + event.getValue()); } @Test public void attributeRemoved(final HtmlAttributeChangeEvent event) { collectedValues_.add("attributeRemoved: " + event.getHtmlElement().getTagName() + ',' + event.getName() + ',' + event.getValue()); } @Test public void attributeReplaced(final HtmlAttributeChangeEvent event) { collectedValues_.add("attributeReplaced: " + event.getHtmlElement().getTagName() + ',' + event.getName() + ',' + event.getValue()); } List<String> getCollectedValues() { return collectedValues_; } } /** * @throws Exception if the test fails */ @Test public void testHtmlAttributeChangeListener_AddAttribute() throws Exception { final String htmlContent = "<html><head><title>foo</title>\n" + "<script>\n" + " function clickMe() {\n" + " var p1 = document.getElementById('p1');\n" + " p1.setAttribute('title', 'myTitle');\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody'>\n" + "<p id='p1'></p>\n" + "<input id='myButton' type='button' onclick='clickMe()'>\n" + "</body></html>"; final String[] expectedValues = {"attributeAdded: p,title,myTitle", "attributeAdded: p,title,myTitle", "attributeAdded: p,title,myTitle"}; final HtmlPage page = loadPage(htmlContent); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); final HtmlElement p1 = page.getHtmlElementById("p1"); final HtmlAttributeChangeListenerTestImpl listenerImpl = new HtmlAttributeChangeListenerTestImpl(); p1.addHtmlAttributeChangeListener(listenerImpl); body.addHtmlAttributeChangeListener(listenerImpl); page.addHtmlAttributeChangeListener(listenerImpl); final HtmlButtonInput myButton = (HtmlButtonInput) page.getHtmlElementById("myButton"); myButton.click(); assertEquals(expectedValues, listenerImpl.getCollectedValues()); } /** * @throws Exception if the test fails */ @Test public void testHtmlAttributeChangeListener_ReplaceAttribute() throws Exception { final String htmlContent = "<html><head><title>foo</title>\n" + "<script>\n" + " function clickMe() {\n" + " var p1 = document.getElementById('p1');\n" + " p1.setAttribute('title', p1.getAttribute('title') + 'a');\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody'>\n" + "<p id='p1' title='myTitle'></p>\n" + "<input id='myButton' type='button' onclick='clickMe()'>\n" + "</body></html>"; final String[] expectedValues = {"attributeReplaced: p,title,myTitle", "attributeReplaced: p,title,myTitle", "attributeReplaced: p,title,myTitle"}; final HtmlPage page = loadPage(htmlContent); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); final HtmlElement p1 = page.getHtmlElementById("p1"); final HtmlAttributeChangeListenerTestImpl listenerImpl = new HtmlAttributeChangeListenerTestImpl(); page.addHtmlAttributeChangeListener(listenerImpl); body.addHtmlAttributeChangeListener(listenerImpl); p1.addHtmlAttributeChangeListener(listenerImpl); final HtmlButtonInput myButton = (HtmlButtonInput) page.getHtmlElementById("myButton"); myButton.click(); assertEquals(expectedValues, listenerImpl.getCollectedValues()); assertEquals("myTitle" + 'a', p1.getAttributeValue("title")); } /** * @throws Exception if the test fails */ @Test public void testHtmlAttributeChangeListener_RemoveAttribute() throws Exception { final String htmlContent = "<html><head><title>foo</title>\n" + "<script>\n" + " function clickMe() {\n" + " var p1 = document.getElementById('p1');\n" + " p1.removeAttribute('title');\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody'>\n" + "<p id='p1' title='myTitle'></p>\n" + "<input id='myButton' type='button' onclick='clickMe()'>\n" + "</body></html>"; final String[] expectedValues = {"attributeRemoved: p,title,myTitle", "attributeRemoved: p,title,myTitle", "attributeRemoved: p,title,myTitle"}; final HtmlPage page = loadPage(htmlContent); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); final HtmlElement p1 = page.getHtmlElementById("p1"); final HtmlAttributeChangeListenerTestImpl listenerImpl = new HtmlAttributeChangeListenerTestImpl(); page.addHtmlAttributeChangeListener(listenerImpl); body.addHtmlAttributeChangeListener(listenerImpl); p1.addHtmlAttributeChangeListener(listenerImpl); final HtmlButtonInput myButton = (HtmlButtonInput) page.getHtmlElementById("myButton"); myButton.click(); assertEquals(expectedValues, listenerImpl.getCollectedValues()); assertSame(HtmlElement.ATTRIBUTE_NOT_DEFINED, p1.getAttributeValue("title")); } /** * @throws Exception if the test fails */ @Test public void testHtmlAttributeChangeListener_RemoveListener() throws Exception { final String htmlContent = "<html><head><title>foo</title>\n" + "<script>\n" + " function clickMe() {\n" + " var p1 = document.getElementById('p1');\n" + " p1.setAttribute('title', p1.getAttribute('title') + 'a');\n" + " }\n" + "</script>\n" + "</head>\n" + "<body>\n" + "<p id='p1' title='myTitle'></p>\n" + "<input id='myButton' type='button' onclick='clickMe()'>\n" + "</body></html>"; final String[] expectedValues = {"attributeReplaced: p,title,myTitle"}; final HtmlPage page = loadPage(htmlContent); final HtmlElement p1 = page.getHtmlElementById("p1"); final HtmlAttributeChangeListenerTestImpl listenerImpl = new HtmlAttributeChangeListenerTestImpl(); p1.addHtmlAttributeChangeListener(listenerImpl); final HtmlButtonInput myButton = (HtmlButtonInput) page.getHtmlElementById("myButton"); myButton.click(); p1.removeHtmlAttributeChangeListener(listenerImpl); myButton.click(); assertEquals(expectedValues, listenerImpl.getCollectedValues()); assertEquals("myTitle" + 'a' + 'a', p1.getAttributeValue("title")); } /** * @throws Exception if the test fails */ @Test public void testMouseOver() throws Exception { final String content = "<html>\n" + "<head>\n" + "<script>\n" + " function mouseOverMe() {\n" + " document.getElementById('myTextarea').value+='mouseover-';\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody' onmouseover='mouseOverMe()'>\n" + "<textarea id='myTextarea'></textarea>\n" + "</body></html>"; final HtmlPage page = loadPage(content); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); body.mouseOver(); final HtmlTextArea textArea = (HtmlTextArea) page.getHtmlElementById("myTextarea"); assertEquals("mouseover-", textArea.getText()); } /** * @throws Exception if the test fails */ @Test public void testMouseMove() throws Exception { final String content = "<html>\n" + "<head>\n" + "<script>\n" + " function mouseMoveMe() {\n" + " document.getElementById('myTextarea').value+='mousemove-';\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody' onmousemove='mouseMoveMe()'>\n" + "<textarea id='myTextarea'></textarea>\n" + "</body></html>"; final HtmlPage page = loadPage(content); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); body.mouseMove(); final HtmlTextArea textArea = (HtmlTextArea) page.getHtmlElementById("myTextarea"); assertEquals("mousemove-", textArea.getText()); } /** * @throws Exception if the test fails */ @Test public void testMouseOut() throws Exception { final String content = "<html>\n" + "<head>\n" + "<script>\n" + " function mouseOutMe() {\n" + " document.getElementById('myTextarea').value+='mouseout-';\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody' onmouseout='mouseOutMe()'>\n" + "<textarea id='myTextarea'></textarea>\n" + "</body></html>"; final HtmlPage page = loadPage(content); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); body.mouseOut(); final HtmlTextArea textArea = (HtmlTextArea) page.getHtmlElementById("myTextarea"); assertEquals("mouseout-", textArea.getText()); } /** * @throws Exception if the test fails */ @Test public void testMouseDown() throws Exception { testMouseDown(BrowserVersion.FIREFOX_2, "mousedown-0"); testMouseDown(BrowserVersion.INTERNET_EXPLORER_6_0, "mousedown-1"); } private void testMouseDown(final BrowserVersion browserVersion, final String expected) throws Exception { final String content = "<html>\n" + "<head>\n" + "<script>\n" + " function mouseDownMe(e) {\n" + " document.getElementById('myTextarea').value+='mousedown-' + e.button;\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody' onmousedown='mouseDownMe(event)'>\n" + "<textarea id='myTextarea'></textarea>\n" + "</body></html>"; final List<String> emptyList = Collections.emptyList(); final HtmlPage page = loadPage(browserVersion, content, emptyList); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); body.mouseDown(); final HtmlTextArea textArea = (HtmlTextArea) page.getHtmlElementById("myTextarea"); assertEquals(expected, textArea.getText()); } /** * @throws Exception if the test fails */ @Test public void testMouseUp() throws Exception { final String content = "<html>\n" + "<head>\n" + "<script>\n" + " function mouseUpMe() {\n" + " document.getElementById('myTextarea').value+='mouseup-';\n" + " }\n" + "</script>\n" + "</head>\n" + "<body id='myBody' onmouseup='mouseUpMe()'>\n" + "<textarea id='myTextarea'></textarea>\n" + "</body></html>"; final HtmlPage page = loadPage(content); final HtmlBody body = (HtmlBody) page.getHtmlElementById("myBody"); body.mouseUp(); final HtmlTextArea textArea = (HtmlTextArea) page.getHtmlElementById("myTextarea"); assertEquals("mouseup-", textArea.getText()); } /** * @throws Exception if the test fails */ @Test public void testRightClick() throws Exception { testRightClick(BrowserVersion.INTERNET_EXPLORER_7_0, "mousedown-2-mouseup-2-contextmenu-0-"); testRightClick(BrowserVersion.FIREFOX_2, "mousedown-3-mouseup-3-contextmenu-3-"); } private void testRightClick(final BrowserVersion browserVersion, final String expected) throws Exception { final String content = "<html>\n" + "<head>\n" + "<script>\n" + " function divMouseEvent(e) {\n" + " var textarea = document.getElementById('myTextarea');\n" + " if (window.event)\n" + " textarea.value += event.type + '-' + event.button + '-';\n" + " else\n" + " textarea.value += e.type + '-' + e.which + '-';\n" + " }\n" + " function loadFunction(e) {\n" + " document.getElementById('myDiv').onmousedown = divMouseEvent;\n" + " document.getElementById('myDiv').onmouseup = divMouseEvent;\n" + " document.getElementById('myDiv').oncontextmenu = divMouseEvent;\n" + " }\n" + "</script>\n" + "</head>\n" + "<body onload='loadFunction()'>\n" + " <div id='myDiv'>Hello</div><br>\n" + " <textarea id='myTextarea'></textarea>\n" + "</body></html>"; final HtmlPage page = loadPage(browserVersion, content, null); final HtmlDivision div = (HtmlDivision) page.getHtmlElementById("myDiv"); div.rightClick(); final HtmlTextArea textArea = (HtmlTextArea) page.getHtmlElementById("myTextarea"); assertEquals(expected, textArea.getText()); } /** * Test the mouse down, then mouse up. * * @throws Exception if the test fails */ @Test public void testMouse_Down_Up() throws Exception { testMouse_Down_Up(BrowserVersion.INTERNET_EXPLORER_7_0, "mousedown-1-mouseup-1-"); testMouse_Down_Up(BrowserVersion.FIREFOX_2, "mousedown-1-mouseup-1-"); } private void testMouse_Down_Up(final BrowserVersion browserVersion, final String expected) throws Exception { final String content = "<html>\n" + "<head>\n" + "<script>\n" + " function divMouseEvent(e) {\n" + " var textarea = document.getElementById('myTextarea');\n" + " if (window.event)\n" + " textarea.value += event.type + '-' + event.button + '-';\n" + " else\n" + " textarea.value += e.type + '-' + e.which + '-';\n" + " }\n" + " function loadFunction(e) {\n" + " document.getElementById('myDiv').onmousedown=divMouseEvent;\n" + " document.getElementById('myDiv').onmouseup =divMouseEvent;\n" + " }\n" + "</script>\n" + "</head>\n" + "<body onload='loadFunction()'>\n" + " <div id='myDiv'>Hello</div><br>\n" + " <textarea id='myTextarea'></textarea>\n" + "</body></html>"; final HtmlPage page = loadPage(browserVersion, content, null); final HtmlDivision div = (HtmlDivision) page.getHtmlElementById("myDiv"); div.mouseDown(); div.mouseUp(); final HtmlTextArea textArea = (HtmlTextArea) page.getHtmlElementById("myTextarea"); assertEquals(expected, textArea.getText()); } /** * @throws Exception if the test fails */ @Test public void testAsXml_separateLineforEmptyElements() throws Exception { final String content = "<html><head><title>foo</title></head>\n" + "<body><table><tr><td></tr></table>\n" + "</body></html>"; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = loadPage(content, collectedAlerts); assertTrue(page.asXml().indexOf("/> ") == -1); } /** * @throws Exception if an error occurs */ @Test public void testGetElementsByTagName() throws Exception { final String html = "<html><head><title>First</title></head>\n" + "<body>\n" + "<form><input type='button' name='button1' value='pushme'></form>\n" + "<div>a</div> <div>b</div> <div>c</div>\n" + "</body></html>"; final HtmlPage page = loadPage(html); final HtmlElement body = page.getBody(); final NodeList inputs = body.getElementsByTagName("input"); assertEquals(1, inputs.getLength()); assertEquals("button", inputs.item(0).getAttributes().getNamedItem("type").getNodeValue()); final NodeList divs = body.getElementsByTagName("div"); assertEquals(3, divs.getLength()); final HtmlDivision newDiv = new HtmlDivision(null, HtmlDivision.TAG_NAME, page, null); body.appendChild(newDiv); assertEquals(4, divs.getLength()); } /** * @throws Exception if an error occurs */ @Test public void type() throws Exception { final String html = "<html><head><script>\n" + " function test() {\n" + " alert(document.getElementById('myInput').value);\n" + " }\n" + "</script></head>\n" + "<body>\n" + " <input id='myButton' type='button' onclick='test()'>\n" + " <input id='myInput' onclick='test()'>\n" + "</body></html>"; final String[] expectedAlerts = {"Hello Cruel World"}; final List<String> collectedAlerts = new ArrayList<String>(); final HtmlPage page = (HtmlPage) loadPage(BrowserVersion.getDefault(), html, collectedAlerts); final HtmlTextInput input = (HtmlTextInput) page.getHtmlElementById("myInput"); input.type("Hello Cruel World"); assertEquals("Hello Cruel World", input.getValueAttribute()); ((HtmlButtonInput) page.getHtmlElementById("myButton")).click(); assertEquals(expectedAlerts, collectedAlerts); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8f443b1100ec7f92186a23a00e2f2c417e8f44da
f566208ece504f86fc4504a2cd1491786ba4a7e6
/core/src/gamenode/GameNodeManager.java
3dd9c6707cc30aed27bcb45ae892adf7dbcf29ed
[]
no_license
Deneyr/Help-Game
9a85c160bb7964e1f7e3cb02b5d6db8467ad373e
d06153c16d40b371b11770ef1de7372c6724922a
refs/heads/master
2023-09-05T08:53:50.309621
2023-09-03T15:28:39
2023-09-03T15:28:39
86,726,925
0
0
null
null
null
null
UTF-8
Java
false
false
4,448
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 gamenode; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Disposable; import com.mygdx.game.GameEventListener; import com.mygdx.game.HelpGame; import com.mygdx.game.ScreenTouchListener; import java.util.HashMap; import java.util.Map; import ressourcesmanagers.ResourceManagerListener; import ressourcesmanagers.TextureManager; /** * * @author Deneyr */ public class GameNodeManager extends GameNode implements Disposable, ResourceManagerListener, GameEventListener{ private Map<String, GameNode> gameNodes; private GameNode currentGameNode; private LoadingGameNode loadingGameNode; private boolean waiting4Resources; public GameNodeManager(Batch batch){ super("gameNodeManager"); this.gameNodes = new HashMap<String, GameNode>(); this.currentGameNode = null; this.waiting4Resources = false; TextureManager.getInstance().addGameEventListener(this); // loading game node part. this.loadingGameNode = new LoadingGameNode(batch); } public void addGameNode(GameNode gameNode){ this.gameNodes.put(gameNode.getId(), gameNode); } public boolean changeCurrentGameNode(HelpGame game, GameNode gameNode){ if(gameNode != null && this.gameNodes.containsKey(gameNode.getId())){ if(this.currentGameNode != null){ this.currentGameNode.onEndingNode(game); } this.loadingGameNode.setDisplayLoadingGraphical(gameNode.hasLoadingScreen()); this.waiting4Resources = gameNode.onStartingNode(game); this.currentGameNode = gameNode; return true; } return false; } @Override public void updateLogic(HelpGame game, float deltaTime){ // Update logic current game node. if(this.waiting4Resources){ this.loadingGameNode.updateLogic(game, deltaTime); }else{ this.currentGameNode.updateLogic(game, deltaTime); } } @Override public void renderScreens(HelpGame game, float deltaTime){ if(this.waiting4Resources){ this.loadingGameNode.renderScreens(game, deltaTime); }else{ this.currentGameNode.renderScreens(game, deltaTime); } } @Override public void touchDown(int screenX, int screenY, int pointer, int button){ this.currentGameNode.touchDown(screenX, screenY, pointer, button); } @Override public void touchUp(int screenX, int screenY, int pointer, int button){ this.currentGameNode.touchUp(screenX, screenY, pointer, button); } @Override public void touchDragged(int screenX, int screenY, int pointer){ this.currentGameNode.touchDragged(screenX, screenY, pointer); } @Override public void mouseMoved(int screenX, int screenY){ this.currentGameNode.mouseMoved(screenX, screenY); } @Override public void scrolled(int amount) { this.currentGameNode.scrolled(amount); } @Override public void dispose() { } @Override public void onResourcesLoaded() { this.waiting4Resources = false; } @Override public void onHelpGameEvent(HelpGame helpGame, EventType type, String details, Vector2 location){ if(this.currentGameNode != null){ switch(type){ case GAMENODECHANGE: GameNode nextNode = this.currentGameNode.getGameNodeByKey(details); if(nextNode != null){ this.changeCurrentGameNode(helpGame, nextNode); } break; } } } @Override public void onGameEvent(EventType type, String details, Vector2 location) { // Nothing to do. } public String getCurrentGameNodeId(){ return this.currentGameNode.getId(); } public boolean isCurrentGameNodeLvl(){ return this.currentGameNode instanceof LvlGameNode; } }
[ "ihzazsh@gmail.com" ]
ihzazsh@gmail.com
e5e5f198d8c5bf162f96695a320ad8c9d47bba5a
64a79a6fe291a7bbdd5358f534a44dac284ca3cb
/src/com/stormnet/homework/homework2/theme3/TwoDimArray.java
d7ade65b55927de15d2af4ca5a65fccde2eb35ba
[]
no_license
ansrazborskaya/RazborskayaProject
1663ad32e922c49b95ec5ac3ab88770b76470a7d
8fdb9b3a45099e454df84207541353e28ca3ed2d
refs/heads/master
2022-09-24T04:35:39.975039
2020-05-28T18:10:59
2020-05-28T18:10:59
255,119,365
0
0
null
2020-05-30T15:10:03
2020-04-12T16:03:21
Java
UTF-8
Java
false
false
788
java
package com.stormnet.homework.homework2.theme3; import java.util.Random; import java.util.Scanner; public class TwoDimArray { public static void main(String[] args) { Random random = new Random(); Scanner scanner = new Scanner(System.in); System.out.println("Enter the size of the array: "); int n = scanner.nextInt(); int[][] twoDim = new int[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { twoDim[i][j] = random.nextInt(); if (twoDim[i][j] % 2 == 0) { System.out.print(0 + " "); } else { System.out.print(1 + " "); } } System.out.print("\n"); } } }
[ "ans.razborskaya@gmail.com" ]
ans.razborskaya@gmail.com
1e9d9ced9d7147ae18c51fa376f389256eb6a790
f0a48b6da801d427d7157cd337e2c79d4525d9a6
/src/objects/defaultPieces/Knight.java
260e4140ed2ea31eac066d27f2d1007a74108b71
[]
no_license
Liniarc/Chess
021d4673a6044cc166b0b671970624b462c39e05
19d7e0bf61d54a2966bbf54cce5df44678923db5
refs/heads/master
2020-05-17T13:29:21.666137
2015-02-06T23:29:38
2015-02-06T23:29:38
26,835,663
0
0
null
null
null
null
UTF-8
Java
false
false
3,408
java
package objects.defaultPieces; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Point; import java.util.ArrayList; import objects.Board; import objects.ImageHelper; import objects.Piece; import objects.TextHelper; public class Knight extends Piece { public Knight(int xLoc, int yLoc, int team, Board board) { super(xLoc, yLoc, team, board); } @Override public ArrayList<Point> validMoves() { ArrayList<Point> moves = new ArrayList<Point>(); for (int i = 0; i < 8; i++) { int xDir = 1; int yDir = 1; int xLen = 1; int yLen = 1; if (i % 2 == 0) xDir = -1; if (i % 4 < 2) yDir = -1; if (i < 4) xLen = 2; else yLen = 2; Point move = new Point(loc.x + xDir * xLen, loc.y + yDir * yLen); if (!board.hasPieceAt(move) && board.inBounds(move) && board.validLocation(move)) if (board.isUncheckedMove(this, move)) moves.add(move); } return moves; } @Override public ArrayList<Point> threatens() { ArrayList<Point> moves = new ArrayList<Point>(); for (int i = 0; i < 8; i++) { int xDir = 1; int yDir = 1; int xLen = 1; int yLen = 1; if (i % 2 == 0) xDir = -1; if (i % 4 < 2) yDir = -1; if (i < 4) xLen = 2; else yLen = 2; Point move = new Point(loc.x + xDir * xLen, loc.y + yDir * yLen); if (board.hasPieceAt(move) && board.pieceAt(move).team != team) moves.add(move); } return moves; } @Override public ArrayList<Point> validTakes() { ArrayList<Point> moves = new ArrayList<Point>(); for (int i = 0; i < 8; i++) { int xDir = 1; int yDir = 1; int xLen = 1; int yLen = 1; if (i % 2 == 0) xDir = -1; if (i % 4 < 2) yDir = -1; if (i < 4) xLen = 2; else yLen = 2; Point move = new Point(loc.x + xDir * xLen, loc.y + yDir * yLen); if (board.hasPieceAt(move) && board.pieceAt(move).team != team) if (board.isUncheckedTake(this, move)) moves.add(move); } return moves; } @Override public void moveTo(Point newLoc) { loc = newLoc; } @Override public Piece takenPiece(Point newLoc) { Piece p = null; if (board.hasPieceAt(newLoc)) p = board.pieceAt(newLoc); return p; } @Override public void draw(Graphics2D g, int i, int j, int size) { if (team == 0) g.drawImage(ImageHelper.getPicture("pieces/WKnight.png"), i, j, size, size, null); else g.drawImage(ImageHelper.getPicture("pieces/BKnight.png"), i, j, size, size, null); } public Piece clone() { Knight n = new Knight(loc.x, loc.y, team, board); n.firstMove = firstMove; return n; } @Override public double value() { return 3; } @Override public int mobility() { int num = 0; for (int i = 0; i < 8; i++) { int xDir = 1; int yDir = 1; int xLen = 1; int yLen = 1; if (i % 2 == 0) xDir = -1; if (i % 4 < 2) yDir = -1; if (i < 4) xLen = 2; else yLen = 2; Point move = new Point(loc.x + xDir * xLen, loc.y + yDir * yLen); if (!board.hasPieceAt(move) && board.inBounds(move) && board.validLocation(move)) num++; } return num; } }
[ "Liniarc@gmail.com" ]
Liniarc@gmail.com
fed652acf239ddaac6260dca20ed632625456ffb
a926a835c723f0124b6fc7dbe9cc6ecbc610b04a
/src/main/java/view/MenuFrame.java
b7bf9156d11cdd860456b0dc6c6926e8110b34a7
[]
no_license
sacret2/DotsTheGame
fd11c093c5078a6097d8c5e45259247d89820b19
cc6c8b24fa451cdad39573be541d85d3ca0f807b
refs/heads/master
2020-12-08T21:04:10.878142
2019-12-26T12:08:03
2019-12-26T12:08:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,917
java
package main.java.view; import main.java.controller.NavigateMouseListener; import main.java.model.Settings; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class MenuFrame extends JFrame { private int width = 500; private int height = 525; private Color backgroundColor; private Color foregroundColor; private Font font; public MenuFrame(){ setSize(width,height); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); setVisible(true); setResizable(false); setIconImage(new ImageIcon("src/main/resources/1320183166943884936_128.png").getImage()); backgroundColor = Settings.gameSettings.getGlobalTheme().getBackgroundColor(); foregroundColor = Settings.gameSettings.getGlobalTheme().getForegroundColor(); font = Settings.gameSettings.getGlobalTheme().getFontLarge(); setTitle("MENU"); createPanel(); } private void createPanel(){ JPanel menuPanel = new JPanel(); add(menuPanel,BorderLayout.CENTER); menuPanel.setBackground(backgroundColor); BoxLayout layout = new BoxLayout(menuPanel,BoxLayout.Y_AXIS); menuPanel.setLayout(layout); menuPanel.setBorder(new EmptyBorder(new Insets(100, 180, 150, 180))); try { BufferedImage gameNameIcon = ImageIO.read(new File("src\\main\\resources\\picturetopeople.org-d3b02807efef49a5e8992c90051993385db6615ff94978b17a.png")); JLabel gameNameLabel = new JLabel(new ImageIcon(gameNameIcon.getScaledInstance(140,60,Image.SCALE_SMOOTH))); menuPanel.add(gameNameLabel); menuPanel.add(Box.createRigidArea(new Dimension(0, 30))); } catch (IOException e) { System.err.println("The game name icon could not be read"); } JLabel play = new JLabel(); play.setText(" Play"); play.setFont(font); play.addMouseListener(new NavigateMouseListener(play,this)); play.setForeground(foregroundColor); JLabel loadGame = new JLabel(); loadGame.setText(" Load Game"); loadGame.setFont(font); loadGame.addMouseListener(new NavigateMouseListener(loadGame,this)); loadGame.setForeground(foregroundColor); JLabel settings = new JLabel(); settings.setText(" Settings"); settings.setFont(font); settings.addMouseListener(new NavigateMouseListener(settings,this)); settings.setForeground(foregroundColor); menuPanel.add(play); menuPanel.add(Box.createRigidArea(new Dimension(0, 30))); menuPanel.add(loadGame); menuPanel.add(Box.createRigidArea(new Dimension(0, 30))); menuPanel.add(settings); } }
[ "kamilnowosad1@gmail.com" ]
kamilnowosad1@gmail.com
d1e62e00ac0313e6c8fff0ac483e84921d1a2a8e
d9095fb255cdb57bd59a333a38bb4098b39d6ff4
/src/main/java/cn/xpbootcamp/gilded_rose/CredentialCode.java
1fb84873aea7514409ec9ce34c940bac8a289eda
[ "Apache-2.0" ]
permissive
ShuangKou/tdd-locker-robot
908b9a9f33831edba0a29f4bdf8bc07576a919f5
df28784ae865f28a3b0a484192a6f2de988167dc
refs/heads/master
2021-04-23T03:41:02.515139
2020-04-09T11:56:52
2020-04-09T11:56:52
249,895,463
0
0
null
2020-03-25T05:34:52
2020-03-25T05:34:51
null
UTF-8
Java
false
false
135
java
package cn.xpbootcamp.gilded_rose; /** * @author shuang.kou */ public class CredentialCode { public CredentialCode() { } }
[ "koushuangbwcx@163.com" ]
koushuangbwcx@163.com
35daebd742af0d043b78091441a07ea9f7444e1b
bec6a3343580105d3342e12e1bb4ff3b6c412275
/Stage3/src/Stage3_1/Stage3.java
b865e84c4121ca7ae7ee46194ada66910b4ffe5d
[]
no_license
ComputerScience-Winter-Project/yewon
2cfd57ae0e82883d375c8f706b17a50ae99cefd4
8ae485e26f0cf64966fb9b4de2b9e208a9248a59
refs/heads/main
2023-03-22T16:23:12.280776
2021-03-13T06:00:34
2021-03-13T06:00:34
332,390,117
0
0
null
null
null
null
UTF-8
Java
false
false
15,068
java
package Stage3_1; import java.awt.Color; import java.awt.Container; import java.awt.Cursor; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class Stage3 extends JFrame { private Image screenImage; private Graphics screenGraphic; private Image background = new ImageIcon(Main.class.getClassLoader().getResource("images/background_bora.png")) .getImage(); private ImageIcon hbb_basic = new ImageIcon(Main.class.getClassLoader().getResource("images/호빵이_기본.gif")); private ImageIcon hbb_swordReady = new ImageIcon(Main.class.getClassLoader().getResource("images/호빵이_공격준비.gif")); private ImageIcon hbb_swordAction = new ImageIcon(Main.class.getClassLoader().getResource("images/호빵이_공격 loop.gif")); private ImageIcon hbb_bribe = new ImageIcon(Main.class.getClassLoader().getResource("images/돈거래 loop.gif")); private ImageIcon hbb_die = new ImageIcon(Main.class.getClassLoader().getResource("images/호빵이_죽음.gif")); private ImageIcon hbb_hurt = new ImageIcon(Main.class.getClassLoader().getResource("images/호빵이_아픔.gif")); private ImageIcon guard_basic = new ImageIcon(Main.class.getClassLoader().getResource("images/겨엉비.png")); private ImageIcon guard_sword = new ImageIcon(Main.class.getClassLoader().getResource("images/겨엉비_공격 loop.gif")); private ImageIcon exitButtonEnteredImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/cross.png")); private ImageIcon exitButtonBasicImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/cross_1.png")); private ImageIcon moneyButton_Basic = new ImageIcon( Main.class.getClassLoader().getResource("buttons/moneyButton.png")); private ImageIcon moneyButton_hover = new ImageIcon( Main.class.getClassLoader().getResource("buttons/moneyButton_hover.png")); private ImageIcon swordButton_Basic = new ImageIcon( Main.class.getClassLoader().getResource("buttons/swordButton.png")); private ImageIcon swordButton_hover = new ImageIcon( Main.class.getClassLoader().getResource("buttons/swordButton_hover.png")); private ImageIcon nextButtonBasicImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/nextbuttonbasic.png")); private ImageIcon nextButtonEnteredImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/nextbuttonentered.png")); private ImageIcon swordFightBasicImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/swordfightbasic.png")); private ImageIcon swordFightEnteredImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/swordfightentered.png")); private ImageIcon swordRunBasicImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/swordrunbasic.png")); private ImageIcon swordRunEnteredImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/swordrunentered.png")); private ImageIcon endingButtonImage = new ImageIcon( Main.class.getClassLoader().getResource("buttons/exit.png")); private JLabel menuBar = new JLabel( new ImageIcon(Main.class.getClassLoader().getResource("buttons/menubar_1.png"))); private JLabel gameOver = new JLabel( new ImageIcon(Main.class.getClassLoader().getResource("buttons/gameover.png"))); private JLabel hobbang = new JLabel(hbb_basic); private JLabel hobbangFix = new JLabel(hbb_basic); private JLabel ssung = new JLabel(new ImageIcon(Main.class.getClassLoader().getResource("images/슝슝이.png"))); private JLabel guard = new JLabel(guard_basic); private JButton exitButton = new JButton(exitButtonBasicImage); // 상단 우측 X 버튼 private JButton moneyButton = new JButton(moneyButton_Basic); // 돈과 칼 선택지 중 돈 private JButton swordButton = new JButton(swordButton_Basic); // 돈과 칼 선택지 중 칼 private JButton nextButton = new JButton(nextButtonBasicImage); // next 버튼 private JButton swordFightButton = new JButton(swordFightBasicImage); // 칼 스토리 중 경비 이벤트 선택지 private JButton swordRunButton = new JButton(swordRunBasicImage); // 칼 스토리 중 경비 이벤트 선택지 private JButton endingButton = new JButton(endingButtonImage); // 하단 우측 나가기 버튼 private boolean guardEvent = false; private int mouseX, mouseY, x = 100, y = 300, hbb_x, hbb_y; private int choice = 0; // sword is 1, money is 2 public Stage3() { setUndecorated(true); // 기본 메뉴바 보이지 않음 setTitle("Stage3"); // 프로그램 이름 setSize(Main.SCREEN_WIDTH, Main.SCREEN_HEIGHT); // 게임 창 크기 setResizable(false); // 창 크기 임의적 변경 불가 setLocationRelativeTo(null); // 창이 화면 정중앙에 위치 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 창을 닫으면 프로그램 종료 setVisible(true); // 창 정상적으로 출력 setBackground(new Color(0, 0, 0, 0)); setLayout(null); exitButton.setBounds(1250, 5, 20, 20); exitButton.setBorderPainted(false); exitButton.setContentAreaFilled(false); exitButton.setFocusPainted(false); exitButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { Music ButtonMusic = new Music("mouse.mp3", false); ButtonMusic.start(); exitButton.setIcon(exitButtonEnteredImage); exitButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { exitButton.setIcon(exitButtonBasicImage); exitButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music ButtonMusic = new Music("mouse.mp3", false); ButtonMusic.start(); System.exit(0); } }); add(exitButton); menuBar.setBounds(0, 0, 1280, 30); menuBar.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { mouseX = e.getX(); mouseY = e.getY(); } }); menuBar.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { int x = e.getXOnScreen(); int y = e.getYOnScreen(); setLocation(x - mouseX, y - mouseY); } }); add(menuBar); endingButton.setVisible(false); endingButton.setBounds(1200, 650, 60, 60); endingButton.setBorderPainted(false); endingButton.setContentAreaFilled(false); endingButton.setFocusPainted(false); endingButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { Music buttonMusic = new Music("mouse.mp3", false); buttonMusic.start(); exitButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { endingButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { System.exit(0); } }); add(endingButton); swordButton.setBounds(100, 500, 500, 100); swordButton.setBorderPainted(false); swordButton.setContentAreaFilled(false); swordButton.setFocusPainted(false); swordButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { swordButton.setIcon(swordButton_hover); swordButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { swordButton.setIcon(swordButton_Basic); swordButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonMusic = new Music("mouse.mp3", false); buttonMusic.start(); start(); choice = 1; guardEvent = true; } }); add(swordButton); moneyButton.setBounds(700, 500, 500, 100); moneyButton.setBorderPainted(false); moneyButton.setContentAreaFilled(false); moneyButton.setFocusPainted(false); moneyButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { moneyButton.setIcon(moneyButton_hover); moneyButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { moneyButton.setIcon(moneyButton_Basic); moneyButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonMusic = new Music("mouse.mp3", false); buttonMusic.start(); start(); choice = 2; guardEvent = true; } }); add(moneyButton); nextButton.setVisible(false); nextButton.setBounds(1030, 550, 160, 80); nextButton.setBorderPainted(false); nextButton.setContentAreaFilled(false); nextButton.setFocusPainted(false); nextButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { nextButton.setIcon(nextButtonEnteredImage); nextButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { nextButton.setIcon(nextButtonBasicImage); nextButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music ButtonMusic = new Music("mouse.mp3", false); ButtonMusic.start(); guardEvent = false; bossEvent(choice); } }); add(nextButton); swordFightButton.setBounds(470, 500, 340, 70); swordFightButton.setBorderPainted(false); swordFightButton.setContentAreaFilled(false); swordFightButton.setFocusPainted(false); swordFightButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { swordFightButton.setIcon(swordFightEnteredImage); swordFightButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { swordFightButton.setIcon(swordFightBasicImage); swordFightButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music ButtonMusic = new Music("mouse.mp3", false); ButtonMusic.start(); swordFightButton.setVisible(false); swordRunButton.setVisible(false); hobbangFix.setIcon(hbb_swordAction); hobbangFix.setBounds(490, 300, 256, 128); guard.setIcon(guard_sword); guard.setBounds(534, 300, 256, 128); nextButton.setVisible(true); } }); swordRunButton.setBounds(470, 580, 340, 70); swordRunButton.setBorderPainted(false); swordRunButton.setContentAreaFilled(false); swordRunButton.setFocusPainted(false); swordRunButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { swordRunButton.setIcon(swordRunEnteredImage); swordRunButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { swordRunButton.setIcon(swordRunBasicImage); swordRunButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music ButtonMusic = new Music("mouse.mp3", false); ButtonMusic.start(); swordFightButton.setVisible(false); swordRunButton.setVisible(false); guard.setIcon(guard_sword); guard.setBounds(512, 300, 256, 128); hobbangFix.setIcon(hbb_hurt); endingButton.setVisible(true); gameOver.setBounds(405, 150, 470, 100); add(gameOver); } }); hobbang.setBounds(512, 300, 128, 128); ssung.setBounds(640, 300, 128, 128); guard.setBounds(640, 300, 128, 128); add(hobbang); add(ssung); } public void bossEvent(int choice) { background = new ImageIcon(Main.class.getClassLoader().getResource("images/background_bora.png")).getImage(); hobbangFix.setVisible(false); guard.setVisible(false); nextButton.setVisible(false); x = 100; y = 300; hobbang.setBounds(x, y, 128, 128); hobbang.setVisible(true); } public void guardEvent(int choice) { // 경비 근처로 다가가면 실행됨 if (choice == 1) { hobbang.setVisible(false); add(hobbangFix); hobbangFix.setBounds(512, 300, 128, 128); add(swordFightButton); add(swordRunButton); } else if (choice == 2) { hobbang.setVisible(false); guard.setVisible(false); hobbangFix.setIcon(hbb_bribe); add(hobbangFix); hobbangFix.setBounds(512, 300, 256, 128); nextButton.setVisible(true); } } public void start() { // 호빵이 움직이기 + 칼과 돈 선택지 이후 설정 Container c = getContentPane(); c.setLayout(null); hobbang.setBounds(x, y, 128, 128); c.add(hobbang); c.addKeyListener(new MyKeyListener()); c.setFocusable(true); c.requestFocus(); background = new ImageIcon(Main.class.getClassLoader().getResource("images/background_bora.png")).getImage(); moneyButton.setVisible(false); swordButton.setVisible(false); ssung.setVisible(false); add(guard); } public void paint(Graphics g) { // 화면을 그려주는 함수, 약속된 것으로 바뀌지 않음 screenImage = createImage(Main.SCREEN_WIDTH, Main.SCREEN_HEIGHT); // 화면 크기만큼 이미지 생성 screenGraphic = screenImage.getGraphics(); screenDraw(screenGraphic); // 이미지에 원하는 내용을 그려줌 g.drawImage(screenImage, 0, 0, null); // screenImage를 (0,0) 위치에 그려줌 } public void screenDraw(Graphics g) { g.drawImage(background, 0, 0, null); paintComponents(g); // add된 것 그려줌 this.repaint(); } class MyKeyListener implements KeyListener { @Override public void keyPressed(KeyEvent e) { Container c = (Container) e.getSource(); switch (e.getKeyCode()) { case KeyEvent.VK_UP: if (y - 10 < 0) y = 0; else y -= 10; hobbang.setLocation(x, y); break; case KeyEvent.VK_DOWN: if (y + 10 > c.getHeight() - 20) y = c.getHeight() - 20; else y += 10; hobbang.setLocation(x, y); break; case KeyEvent.VK_LEFT: if (x - 10 < 0) x = 0; else x -= 10; hobbang.setLocation(x, y); break; case KeyEvent.VK_RIGHT: if (x + 10 > c.getWidth() - 30) x = c.getWidth() - 30; else x += 10; hobbang.setLocation(x, y); break; } hbb_x = hobbang.getLocation().x; hbb_y = hobbang.getLocation().y; if (guardEvent) { if (500 < hbb_x && hbb_x < 908 && 160 < hbb_y && hbb_y < 568) { guardEvent(choice); } } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } } }
[ "noreply@github.com" ]
noreply@github.com
16558277c88646dfef40163b97669566d30eb5e0
126890040f4132228f468b42041a65cc6b6dd8ce
/src/edu/sru/thangiah/zeus/pvrp/PVRPRoot.java
0f51ebf7093c025b387672d36ff791133122fe91
[]
no_license
arockburn/Zeus_TR
1ff0691ec7af725d37eb3adc9a958b6d4af73064
fdba1c75ecf970e7ae159a8a551409548d50d255
refs/heads/master
2021-01-15T20:43:12.257971
2015-03-21T19:08:35
2015-03-21T19:08:35
32,483,867
0
0
null
2015-03-20T00:27:43
2015-03-18T20:55:29
Java
UTF-8
Java
false
false
7,668
java
//PVRP PROBLEM //CPSC 464 //AARON ROCKBURN; JOSHUA SARVER //*********** DECLARATION_S_OTHER // **********************************************************************************\\ // FUNCTION_START >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< //PACKAGE TITLE package edu.sru.thangiah.zeus.pvrp; import edu.sru.thangiah.zeus.pvrp.pvrpcostfunctions.*; //import edu.sru.thangiah.zeus.trGeneric.TRSolutionHierarchy.TRShipmentsList; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import java.io.File; import java.io.IOException; import java.util.Scanner; /** * PVRP (Periodic Vehicle Routing) * Routes vehicles to various nodes over a given number of days * <p/> * Version 1.0 * <p/> * 10/17/14 * <p/> * AUTHORS * Aaron Rockburn and Joshua Sarver * Slippery Rock University of Pa * CPSC 464 - Fall 2014 * <p/> * COPYLEFT * Attribution-ShareAlike 4.0 International * <p/> * BASED ON * Dr. Sam R. Thangiah's work at Slippery Rock University of Pa * A Heuristic for the Periodic Vehicle Routing Problem by M. Gaudioso, G. Paletta * Chou * The Periodic Vehicle Routing Problem by S. Coene, A. Arnout and F. Spieksma * A Variable Neighborhood Search Heuristic for Periodic Routing Problems by Vera C. Hemmelmayr, Karl F. Doerner§, * Richard F. Hartl * <p/> * Methods are generally sorted by breadth-first order */ //CLASS public class PVRPRoot { //VARIABLES final String FS = System.getProperty("file.separator"); //allows us to work with DOS based or Unix/Unix-like systems automagically public PVRPRoot() throws Exception { //SETUP SOME PARAMETERS FOR THE PROBLEM INFO CLASS //these are all very important...the program will not function //properly without them PVRPProblemInfo.nodesLLLevelCostF = new PVRPNodesLLCostFunctions(); PVRPProblemInfo.truckLevelCostF = new PVRPTruckCostFunctions(); PVRPProblemInfo.truckLLLevelCostF = new PVRPTruckLLCostFunctions(); PVRPProblemInfo.depotLevelCostF = new PVRPDepotCostFunctions(); PVRPProblemInfo.depotLLLevelCostF = new PVRPDepotLLCostFunctions(); PVRPProblemInfo.daysLLLevelCostF = new PVRPDaysLLCostFunctions(); PVRPProblemInfo.daysLevelCostF = new PVRPDaysCostFunctions(); PVRPProblemInfo.tempFileLocation = PVRPProblemInfo.workingDirectory + FS + "temp"; //temp file location PVRPProblemInfo.inputPath = PVRPProblemInfo.workingDirectory + FS + "data" + FS + "PVRP" + FS + "data" + FS; //input file location PVRPProblemInfo.outputPath = PVRPProblemInfo.workingDirectory + FS + "data" + FS + "PVRP" + FS + "results" + FS; //output file location //PVRP SPECIFIC PARAMETERS //ADDED STATIC VARIABLES IN INHERITING PVRP CLASS PVRPProblemInfo.MAX_HORIZON = 14; PVRPProblemInfo.compareToInputPath = PVRPProblemInfo.workingDirectory + FS + "data" + FS + "PVRP" + FS + "compareTo" + FS; PVRPProblemInfo.compareToInputFile = "Comparison_List.xlsx"; PVRPProblemInfo.comparisonOutputFile = "Comparison_Results.xlsx"; PVRPProblemInfo.longSolutionOutputFile = "All_Long_Solutions.xlsx"; PVRPProblemInfo.shortSolutionOutputFile = "All_Short_Solutions.xlsx"; //ONE-PROBLEM (BETTER) // new PVRP(PROBLEM_NAME + ".xlsx"); // for(int x = 15; x <= 32; x++){ // new PVRP("p"+x+".xlsx"); // } String problemName; boolean isMakeSeparateFile = false; String userInput = ""; Scanner scanIn = new Scanner(System.in); File f = new File("thisFileProbablyDoesntExist.jpeg.exe"); while (!f.exists()) { System.out.println("Enter a valid problem to solve (ex. p14):"); userInput = scanIn.nextLine(); f = new File(PVRPProblemInfo.inputPath + userInput + ".xlsx"); } problemName = userInput + ".xlsx"; userInput = "*"; while (!userInput.equals("Y") && !userInput.equals("N")) { System.out.println("Would you like a separate output file created for this problem? (Y/N)"); userInput = scanIn.nextLine().toUpperCase(); if (userInput.equals("Y")) { isMakeSeparateFile = true; } else { isMakeSeparateFile = false; } } System.out.println("Choose an insertion heuristic: (1/2/3)"); while (!userInput.equals("1") && !userInput.equals("2") && !userInput.equals("3")) { System.out.println("1. Next Closest Distance to Depot"); System.out.println("2. Next Smallest Angle to Depot"); System.out.println("3. Next Closest Angle and Distance to Depot"); userInput = scanIn.nextLine(); } if (userInput.equals("1")) { new PVRP(problemName, isMakeSeparateFile, new PVRPClosestEuclideanDistToDepot()); } else if (userInput.equals("2")) { new PVRP(problemName, isMakeSeparateFile, new PVRPSmallestPolarAngleToDepot()); } else if (userInput.equals("3")) { new PVRP(problemName, isMakeSeparateFile, new PVRPSmallestPolarAngleShortestDistToDepot()); } }//END CONSTRUCTOR *******************<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< public PVRPRoot(PVRPShipmentLinkedList nodes) throws IOException, InvalidFormatException { //SETUP SOME PARAMETERS FOR THE PROBLEM INFO CLASS //these are all very important...the program will not function //properly without them PVRPProblemInfo.nodesLLLevelCostF = new PVRPNodesLLCostFunctions(); PVRPProblemInfo.truckLevelCostF = new PVRPTruckCostFunctions(); PVRPProblemInfo.truckLLLevelCostF = new PVRPTruckLLCostFunctions(); PVRPProblemInfo.depotLevelCostF = new PVRPDepotCostFunctions(); PVRPProblemInfo.depotLLLevelCostF = new PVRPDepotLLCostFunctions(); PVRPProblemInfo.daysLLLevelCostF = new PVRPDaysLLCostFunctions(); PVRPProblemInfo.daysLevelCostF = new PVRPDaysCostFunctions(); PVRPProblemInfo.tempFileLocation = PVRPProblemInfo.workingDirectory + FS + "temp"; //temp file location PVRPProblemInfo.inputPath = PVRPProblemInfo.workingDirectory + FS + "data" + FS + "TR" + FS + "problem" + FS; //input file location PVRPProblemInfo.outputPath = PVRPProblemInfo.workingDirectory + FS + "data" + FS + "TR" + FS + "results" + FS; //output file location //PVRP SPECIFIC PARAMETERS //ADDED STATIC VARIABLES IN INHERITING PVRP CLASS PVRPProblemInfo.MAX_HORIZON = 7; // PVRPProblemInfo.compareToInputPath = PVRPProblemInfo.workingDirectory + FS + "data" + FS + "PVRP" + FS + // "compareTo" + FS; // PVRPProblemInfo.compareToInputFile = "Comparison_List.xlsx"; // PVRPProblemInfo.comparisonOutputFile = "Comparison_Results.xlsx"; PVRPProblemInfo.longSolutionOutputFile = "All_Long_Solutions.xlsx"; PVRPProblemInfo.shortSolutionOutputFile = "All_Short_Solutions.xlsx"; String problemName; boolean isMakeSeparateFile = false; String userInput = ""; problemName = "TrashRoutes-Frequency.xlsx"; isMakeSeparateFile = true; userInput = "1"; // if (userInput.equals("1")) { // new PVRP(problemName, isMakeSeparateFile, new PVRPClosestEuclideanDistToDepot(), nodes); // } else if (userInput.equals("2")) { // new PVRP(problemName, isMakeSeparateFile, new PVRPSmallestPolarAngleToDepot(), nodes); // } else if (userInput.equals("3")) { // new PVRP(problemName, isMakeSeparateFile, new PVRPSmallestPolarAngleShortestDistToDepot(), nodes); // } } }
[ "joshuasarver@Hackintosh.local" ]
joshuasarver@Hackintosh.local
53e87e6f8e12228048a0b3302497fc13c5191db5
05fe154644f35f1ff5d731ea8d300567a5c236ab
/CoreJava_MarToMay18/com/vtalent/branch/three/srilakshmi/corejava/oops/ExampleTwo.java
f317fbff5154031145bc1a604febacc1a52f347e
[]
no_license
narsinghraom/JavaMar_May_2018
b6de8298599f35ef1ec5c64e7db1e66aa34ce4e7
030a0d44172764cf339db618d632a9aab5e2e8e1
refs/heads/master
2021-04-03T04:17:59.058813
2018-07-19T06:19:14
2018-07-19T06:19:14
124,994,050
0
0
null
2018-03-15T05:49:44
2018-03-13T04:50:50
Java
UTF-8
Java
false
false
666
java
package com.vtalent.branch.three.srilakshmi.corejava.oops; class ExampleThree { int i,j; static float f1; public int function(int i,float f1) { ExampleOne.f1=f1+ExampleOne.f1; this.i=this.i+i; return(int)f1+i; } public static Example function(int j) { Example e=new Example(); e.j=j+j; e.i=e.function(j,(float)j); return e; } public float function(float f1) { ExampleOne.f1=ExampleOne.f1+f1; return f1; } } public class ExampleTwo extends ExampleThree { int i,k; public int function(int i,float f1) { super.function(i, f1); super.i=super.i+i; this.i=super.i+this.i; ExampleOne.f1=f1+ExampleOne.f1; return i; } }
[ "kandakatlasahithi@gmail.com" ]
kandakatlasahithi@gmail.com
f6e9a7a21338dcb8676c9ac9e96c4f65991b68b8
901ccdb3b5562bff98589e0285ed929b6db1d6c3
/DelayFunctionGenerator/src/ukim/finki/mps/delay_fucntion_generator/Elements.java
1102d97b2f1aef23af2a5df27245360e1f2cdf73
[ "MIT" ]
permissive
gajduk/delay-function-generator-for-8085mp
0b6fc5f3c8e8f1c55d4a01ebef16b22fdb38bdae
7013452b2c046aed6c7eab80b21cdaa651683e84
refs/heads/master
2021-01-21T12:12:06.819685
2016-04-12T10:00:35
2016-04-12T10:00:35
32,350,655
0
0
null
null
null
null
UTF-8
Java
false
false
7,852
java
package ukim.finki.mps.delay_fucntion_generator; /** * class that contains the data which instructions uses which resources of a mP system such as registers, memory and stack * This class is specialized for 8085, since the last update in specification stated that the project is not general but specific and native to 8085 * @author Andrej Gajduk */ public class Elements { /** * all the elements that are affected by this instruction * the integer is coded as follows * * bits 0-7 represent the 8 REGs in the following order * bit|register * 0 | A * 1 | B * 2 | C * 3 | D * 4 | E * 5 | H * 6 | L * * bits 8-10 represent the number of memory locations required to be allowed access to by the instruction * bit|number of memory location * 8 | 0 * 9 | 1 * 10 | 2 * * bit 11 states whether or not the instruction affects or need the stack to be operational * * in all cases the value '0' stands for NO, it is NOT needed and/or it is NOT affected * while the value '1' stands for the opposite YES, it IS needed and/or it IS affected * * bits are order form lowest significance in ascending order meaning the bit 0 is the least significant one, * bit 1 is the next least significant and so on. * * Sample encoding * instruction - DAD SP * registers affected - HL * memory locations - 0 * needed * stack required - 1 * * HL => bits 6 & 7 are set all other bits 0-5 are clear * memory location needed=1 => bit 8 is set, bits 9&10 are clear * stack required => bit 11 is set * the value of 'e' will be : * 100111000000 in binary * 2496 normal * * *IMPORTANT NOTICE: unlike the registers who are only included here if their contents (value) is changed * the memory locations are included even if their value is not changed i.e. * a memory location is included if it is being accessed. * This is to prevent the code from attempts at accessing inexistent memory locations or memory locations that have a I/O device mapped to it. * concerning the stack:is included if the instructions reads/changes the value of the SP(stack pointer) register, * or/and perform push or pop operations on the stack. * */ private int e; /* * the next three integer arrays are used to encrypt within a single integer all the information provided about a given instructions interaction with the elements of the 8085 system * such as registers, memory locations and stack, * only for internal use, as showed in the first constructor * */ /** * registers encoding as seen */ // A B C D E F G H I J K L private static final int[] register_encoding = { 1 , 2 , 4 , 8 , 16 , 0 , 0 , 32 , 0 , 0 , 0 , 64 }; /** * memory locations needed 0 1 2 */ private static final int[] memory_encoding = { 256 , 512 , 1024 }; /** * is stack needed 0 = no , 1 = yes 0 1 */ private static final int[] stack_encoding = { 0 , 2048 }; /** * a constructor for creating elements objects from string descriptors of instruction read from files * @param registers - string descriptor of the available registers * @param memory_locations - string descriptor of the available memory locations * @param stack - string descriptor of the available stack resource */ public Elements ( String registers , String memory_locations , String stack ) { e = 0; for ( int i = 0 ; i < registers.length() ; ++i ) { char c = registers.charAt(i); e += encodeRegister(c,e); } e += memory_encoding[Integer.parseInt(memory_locations)]; e += stack_encoding[Integer.parseInt(stack)]; } /** * constructor for when we want to create a stub-comparison object for determining whether or not we can use a specific instruction * with the usable elements, used when we want to separate the available instructions out of the whole instruction set * @param elements_usable - a descriptions of all the elements that needs to be encrypted in a single integer, as an instance of this class */ public Elements ( Element elements_usable[] ) { e = 0; int memory_locations_counter = 0; e += memory_encoding[memory_locations_counter++]; if ( elements_usable == null || elements_usable.length == 0 ) return; for ( Element el : elements_usable ) { if ( el == null ) continue; if ( el.type == Element.REGISTER ) { if ( el.status.equals(Element.available) ) { char c = el.description.charAt(0); e += encodeRegister(c,e); } } else { if ( el.type == Element.MEMORY ) { if ( memory_locations_counter < 3 ) { if ( el.status.equals(Element.available) ) { e += memory_encoding[memory_locations_counter++]; } } } else { if ( el.type == Element.STACK ) { if ( el.description.equals("not valid stack") ) { if ( (e&stack_encoding[1]) == 0 ) { if ( el.status.equals(Element.available) ) { e += stack_encoding[1]; } } } } else { System.err.println("UNKNOWN TYPE"); } }} } } /** * to be used internally as a method that returns the integer value that needs to be added to the description encoding, * so that it states availability of the register described by its char * @param register - char representing the register (A,B .. H,L .. ) * @param e - current encoding - check if we already have that register encoded as available * @return */ private int encodeRegister ( char register , int e ) { if ( (register >= 'A' && register <='H' && register != 'G') || ( register == 'L' ) ) { if ( (e&register_encoding[register-'A']) == 0 ) return register_encoding[register-'A']; } return 0; } /** * @return the e */ public int getE() { return e; } /** * @param e the e to set */ public void setE(int e) { this.e = e; } /** * gives a nice detailed description of the resources used by an instruction */ @Override public String toString() { String res = "REGISTERS: "; boolean flag = true; for ( int i = 0 ; i < register_encoding.length ; ++i ) { if ( register_encoding[i] != 0 && (e&register_encoding[i]) != 0 ) { res += (char)('A'+i)+" , "; flag = false; } } if ( flag ) res += " NONE ,"; res += "MEMORY: "; for ( int i = 0 ; i < memory_encoding.length ; ++i ) { if ( (e&memory_encoding[i]) != 0 ) { res += i+" locations required , "; break; } } res += "STACK: "; if ( (e&stack_encoding[1]) == 0 ) res += " NOT "; res += " REQUIRED"; return res; } /** * a function used to separate available instructions from the whole instruction set, * it checks whether the given comparator object contains all the resources required for a given instruction to execute * @param comparator - an object describing the available resources * @return - boolean value - can we use this instruction, with the given resource */ public boolean isAvailable ( Elements comparator ) { return (comparator.e&e) == e; } /** * reverse mapping on which bit does which register corresponds */ private static final String registers[] = { "A" , "B" , "C" , "D" , "E" , "H" , "L" }; /** * a function to determine which register corresponds to the bit-index in the e-integer * @param index - of a bit in the e-integer * @return - the register the bit at position index corresponds */ public String getRegister(int index) { if ( index >= 0 && index < registers.length )return registers[index]; return null; } }
[ "Gajduk.andrej@gmail.com@b3caaeaa-726b-6cce-de1a-de057e0fad72" ]
Gajduk.andrej@gmail.com@b3caaeaa-726b-6cce-de1a-de057e0fad72
ff76256b9c70e94cfbbd583713828755ae3ef1ed
a3f54caaa9e51156f471338811635b802f930679
/setter with xml/src/MessageRenderer.java
eb50b77e784f1f98ad6a96157edb6d6df4a842d6
[]
no_license
deeptishakya20/spring-workspace
fee17e217ad9d0d46d7c4a1badbacc495a80c750
15aa6f05979e4e91c5d9682360557ceaa0db5606
refs/heads/master
2020-05-05T03:54:23.048509
2019-04-10T13:51:18
2019-04-10T13:51:18
179,689,710
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.capgemini.spring.renderer; import com.capgemini.spring.provider.*; public class MessageRenderer{ private MessageProvider provider; public void render(){ System.out.println(provider.message()); } public void setMessageProvider(MessageProvider provider){ this.provider = provider; } }
[ "deepti.shakya@capgemini.com" ]
deepti.shakya@capgemini.com
b47c2a354b08b8f2f4f21d145d8d64dc724f37ad
92b559e93339b26a9d2805b4c4ebf9941c7ff26c
/src/main/java/com/emanuelalso/disney/service/PoSServiceImpl.java
2885a24c30121f7557c136a984441e5f637f29cc
[]
no_license
bingombou/APIDisneyBACKEND
a95ff69ae8f4ad09c42757f60c36e3500e2f69f2
4a4cde58eca7fedb1b9725610e1ed083d91d6d42
refs/heads/main
2023-06-29T11:53:05.349139
2021-08-07T02:22:31
2021-08-07T02:22:31
391,244,184
0
0
null
null
null
null
UTF-8
Java
false
false
1,364
java
package com.emanuelalso.disney.service; import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.emanuelalso.disney.entity.Personaje; import com.emanuelalso.disney.entity.PoS; import com.emanuelalso.disney.respository.PoSRepository; @Service public class PoSServiceImpl implements PoSService{ @Autowired private PoSRepository poSRepository; @Override @Transactional(readOnly = true) public List<PoS> findAll() { return poSRepository.findAll(); } @Override @Transactional public PoS save(PoS poS) { return poSRepository.save(poS); } @Override @Transactional(readOnly = true) public Optional<PoS> findById(Long id){ return poSRepository.findById(id); } @Override public void deleteById(Long id) { poSRepository.deleteById(id); } @Override @Transactional(readOnly = true) public List<PoS> findByName(String poSTitle) { List<PoS> poSByName = new ArrayList<>(); List<PoS> poSs= poSRepository.findAll(); for(int i=0; i<poSs.size(); i++) { if(poSs.get(i).getTitulo().equals(poSTitle) || poSs.get(i).getTitulo().toLowerCase().equals(poSTitle)) { poSByName.add(poSs.get(i)); } } return poSByName; } }
[ "emanuel.pablo.also@gmail.com" ]
emanuel.pablo.also@gmail.com
173b2dd6714b5dbfe3c24c6699fd922347270e0e
fadfc40528c5473c8454a4835ba534a83468bb3b
/domain-api/jbb-event-registry/src/main/java/org/jbb/system/event/InstallUpgradePerformedEvent.java
b522b948cda1051766780def55d0bcde00f52ff8
[ "Apache-2.0" ]
permissive
jbb-project/jbb
8d04e72b2f2d6c088b870e9a6c9dba8aa2e1768e
cefa12cda40804395b2d6e8bea0fb8352610b761
refs/heads/develop
2023-08-06T15:26:08.537367
2019-08-25T21:32:19
2019-08-25T21:32:19
60,918,871
4
3
Apache-2.0
2023-09-01T22:21:04
2016-06-11T17:20:33
Java
UTF-8
Java
false
false
661
java
/* * Copyright (C) 2018 the original author or authors. * * This file is part of jBB Application Project. * * Licensed under the Apache License, Version 2.0 (the "License"); * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 */ package org.jbb.system.event; import org.jbb.lib.eventbus.JbbEvent; import javax.validation.constraints.NotBlank; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.ToString; @Getter @RequiredArgsConstructor @ToString(callSuper = true) public class InstallUpgradePerformedEvent extends JbbEvent { @NotBlank private final String jbbVersion; }
[ "baart92@gmail.com" ]
baart92@gmail.com
d3c31e6409941a0939af41fee702ef32948dae97
cf881a41872117c85c6f440138fa8368f8e5b289
/seminar-014/src/ro/ase/csie/cts/laborator/exceptii/ExceptieNota.java
2435b29f967a0550f00e9220c69d1186ee11c4ea
[]
no_license
vladescualexandra/cts-labs
d9f16bad1bab2564a77ec5238eb3eeb5099f8851
6d9e783b73dc344e70a30ba4309c30d4abd35883
refs/heads/master
2023-05-13T01:51:23.254927
2021-06-03T16:40:23
2021-06-03T16:40:23
341,537,644
1
0
null
null
null
null
UTF-8
Java
false
false
93
java
package ro.ase.csie.cts.laborator.exceptii; public class ExceptieNota extends Exception { }
[ "vladescualexandra18@stud.ase.ro" ]
vladescualexandra18@stud.ase.ro
5f4c14fd60b6e2de72db4fc132f4ebd2f5bfe0b1
1fe35a2ec958cbe8be8d343119d44d502735d4c8
/src/stack/NGL.java
0f0ce2d5dd5873936491bb257a04cfc650187f61
[ "MIT" ]
permissive
xxEasterGrymm/DSA-Practice
56fcfe8a4ac13c2194b278b823e15e54d58cbafc
0538ad9b47367c4250733fd8120aa74e948f8083
refs/heads/main
2023-07-16T11:30:52.559215
2021-08-16T20:17:33
2021-08-16T20:17:33
395,947,595
1
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
/*Nearest Greater to Left - program to find the nearest greater number to its left. Example - given Array - {1, 3, 2, 4} Output - {-1, -1, 3, -1} */ package stack; import java.util.Scanner; import java.util.Stack; import java.util.Vector; public class NGL { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the length of the array: "); int n = sc.nextInt(); int[] arr = new int[n]; System.out.println("Enter the elements of the array"); for(int i = 0; i < n; i++) arr[i] = sc.nextInt(); Vector<Integer> v = new Vector<>(); Stack<Integer> s = new Stack<>(); for(int i = 0; i < n; i++) { if(s.size() == 0) v.add(-1); // stack empty, hence no element is bigger to the left of current element else if(s.size() > 0 && s.peek() > arr[i]) v.add(s.peek()); else if(s.size() > 0 && s.peek() <= arr[i]) { while (s.size() > 0 && s.peek() <= arr[i]) s.pop(); // deleting elements from the stack until a greater element is found or stack becomes empty if(s.size() == 0) v.add(-1); else v.add(s.peek()); } s.push(arr[i]); } System.out.println(v); } }
[ "aryabhattacharyya.study@gmail.com" ]
aryabhattacharyya.study@gmail.com
ea8ae4103265e4050872263171ad533dbb0ac10a
919de549ee1d65c693ca2b8dfdd4b916d6e02e0e
/app/src/main/java/qyw/xhx/zwzs/wh/HouseAdapter.java
6262bf6eb26040fd3b8273a769af80b0263b8c04
[]
no_license
xuhuixin/zwzs2
0ddb155a028e069b62c6b7f486946ded1439cb7f
d111f25de90d5b26278ca6593e39997239d9bee6
refs/heads/master
2021-08-10T20:54:30.551650
2019-01-03T09:48:27
2019-01-03T09:48:27
153,763,063
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
package qyw.xhx.zwzs.wh; import android.content.Context; import android.widget.TextView; import java.util.List; import qyw.xhx.zwzs.ListViewAdapter; import qyw.xhx.zwzs.R; import qyw.xhx.zwzs.ViewHolder; /** * Created by xhx on 2018/9/27. */ public class HouseAdapter extends ListViewAdapter<House> { //MyAdapter需要一个Context,通过Context获得Layout.inflater,然后通过inflater加载item的布局 public HouseAdapter(Context context, List<House> datas) { super(context, datas, R.layout.house_item); } @Override public void convert(ViewHolder holder, House house) { ((TextView) holder.getView(R.id.full_addr)).setText(house.getFULL_ADDR()); ((TextView) holder.getView(R.id.sfzy)).setText(house.getSFZY()); } }
[ "13553179781@139.com" ]
13553179781@139.com
74b2e60b3acc515f0e88e542f72da7a086a10af6
824e4bfa936f0ae7f4dc480786015e85093c01e7
/src/main/java/com/ridibooks/clone_ridibooks_be/model/LikeIt.java
df1c53529f84bd0d4b7b10d188407a390c0e78e0
[]
no_license
peses0326/Clone_Ridibooks_BE
4ea0fb6f8a09199e08467ad1a7899a460a0b2a49
2d10226daa5fb9b462cbabf351e5c901d4fa8a2f
refs/heads/main
2023-06-30T14:41:02.203010
2021-08-09T08:09:45
2021-08-09T08:09:45
386,547,439
0
1
null
2021-07-17T02:11:06
2021-07-16T07:21:21
Java
UTF-8
Java
false
false
678
java
package com.ridibooks.clone_ridibooks_be.model; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import javax.persistence.*; @Getter @NoArgsConstructor @AllArgsConstructor @Entity public class LikeIt { @GeneratedValue(strategy = GenerationType.IDENTITY) @Id private Long id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="Comment_ID",nullable = false) private Comment comment; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="User_ID",nullable = false) private User user; public LikeIt(Comment comment, User user) { this.comment = comment; this.user = user; } }
[ "peses0326@gmail.com" ]
peses0326@gmail.com
7aec4c2f5fd4e21dd7cb88a59d6113ac231b43d6
48f5ab895d822a78345f8ba306f12e72f255de8f
/heat-gen-processor/src/com/nestedtori/heatgen/serdes/GridLocationSerializer.java
ef0e4311a630cc0eead8169f14ffb956a2b11098
[]
no_license
ch0ndawg/its-roasting
ad609069e47557fde8c0e0319193a626ee73ce67
06baf2fd84a01278597da9bcfd663dbaf7560eda
refs/heads/master
2020-12-25T18:07:52.443282
2017-04-25T07:11:24
2017-04-25T07:11:24
68,648,964
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
package com.nestedtori.heatgen.serdes; import com.nestedtori.heatgen.datatypes.GridLocation; import org.apache.kafka.common.serialization.LongSerializer; import org.apache.kafka.common.serialization.Serializer; import java.util.Map; public class GridLocationSerializer implements Serializer<GridLocation> { private LongSerializer longSerializer; public GridLocationSerializer() { longSerializer = new LongSerializer(); } @Override public void configure(Map<String, ?> configs, boolean isKey) { } @Override public byte[] serialize(String topic, GridLocation data) { if (data == null) return null; //byte[] iBytes = intSerializer.serialize(topic, data.i); //byte[] jBytes = intSerializer.serialize(topic, data.j); long hi = (long) data.i << 32; return longSerializer.serialize(topic, hi + data.j); } @Override public void close() { // nothing to do } }
[ "choni0281@gmail.com" ]
choni0281@gmail.com
abc25626467094241d9662685073560ea85e33d0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_6a71e3aee071ae3d37ff66b6e4597d1d6fe3577e/TableCG/8_6a71e3aee071ae3d37ff66b6e4597d1d6fe3577e_TableCG_s.java
7be99d2f119c03e91adcccc24cdc5643d7b54c44
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
20,429
java
/* * $Id$ * Copyright 2000,2005 wingS development team. * * This file is part of wingS (http://www.j-wings.org). * * wingS 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. * * Please see COPYING for the complete licence. */ package org.wings.plaf.css; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wings.SCellRendererPane; import org.wings.SComponent; import org.wings.SConstants; import org.wings.SDimension; import org.wings.SIcon; import org.wings.SLabel; import org.wings.SListSelectionModel; import org.wings.STable; import org.wings.io.CachingDevice; import org.wings.io.Device; import org.wings.io.StringBuilderDevice; import org.wings.plaf.CGManager; import org.wings.session.SessionManager; import org.wings.table.SDefaultTableCellRenderer; import org.wings.table.STableCellRenderer; import org.wings.table.STableColumn; import org.wings.table.STableColumnModel; import org.wings.util.SStringBuilder; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class TableCG extends AbstractComponentCG implements org.wings.plaf.TableCG { private static final long serialVersionUID = 1L; /** * Apache jakarta commons logger */ private final static Log log = LogFactory.getLog(TableCG.class); protected String fixedTableBorderWidth; protected SIcon editIcon; protected String selectionColumnWidth = "22px"; /** * Initialize properties from config */ public TableCG() { final CGManager manager = SessionManager.getSession().getCGManager(); setFixedTableBorderWidth((String) manager.getObject("TableCG.fixedTableBorderWidth", String.class)); setEditIcon(manager.getIcon("TableCG.editIcon")); selectionColumnWidth = (String) manager.getObject("TableCG.selectionColumnWidth", String.class); } /** * Tweak property. Declares a deprecated BORDER=xxx attribute on the HTML TABLE element. */ public String getFixedTableBorderWidth() { return fixedTableBorderWidth; } /** * Tweak property. Declares a deprecated BORDER=xxx attribute on the HTML TABLE element. */ public void setFixedTableBorderWidth(String fixedTableBorderWidth) { this.fixedTableBorderWidth = fixedTableBorderWidth; } /** * Sets the icon used to indicated an editable cell (if content is not direct clickable). */ public void setEditIcon(SIcon editIcon) { this.editIcon = editIcon; } /** * @return Returns the icon used to indicated an editable cell (if content is not direct clickable). */ public SIcon getEditIcon() { return editIcon; } /** * @return The width of the (optional) row selection column in px */ public String getSelectionColumnWidth() { return selectionColumnWidth; } /** * The width of the (optional) row selection column in px * * @param selectionColumnWidth The width of the (optional) row selection column with unit */ public void setSelectionColumnWidth(String selectionColumnWidth) { this.selectionColumnWidth = selectionColumnWidth; } public void installCG(final SComponent comp) { super.installCG(comp); final STable table = (STable) comp; final CGManager manager = table.getSession().getCGManager(); Object value; value = manager.getObject("STable.defaultRenderer", STableCellRenderer.class); if (value != null) { table.setDefaultRenderer((STableCellRenderer) value); if (value instanceof SDefaultTableCellRenderer) { SDefaultTableCellRenderer cellRenderer = (SDefaultTableCellRenderer) value; cellRenderer.setEditIcon(editIcon); } } value = manager.getObject("STable.headerRenderer", STableCellRenderer.class); if (value != null) { table.setHeaderRenderer((STableCellRenderer) value); } value = manager.getObject("STable.rowSelectionRenderer", org.wings.table.STableCellRenderer.class); if (value != null) { table.setRowSelectionRenderer((org.wings.table.STableCellRenderer) value); } InputMap inputMap = new InputMap(); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.ALT_DOWN_MASK, false), "left"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.ALT_DOWN_MASK, false), "right"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK, false), "up"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK, false), "down"); table.setInputMap(SComponent.WHEN_IN_FOCUSED_FRAME, inputMap); Action action = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (!table.isEditing()) return; if (table.getEditingRow() > 0 && "up".equals(e.getActionCommand())) table.setEditingRow(table.getEditingRow() - 1); if (table.getEditingRow() < table.getRowCount() -1 && "down".equals(e.getActionCommand())) table.setEditingRow(table.getEditingRow() + 1); if (table.getEditingColumn() > 0 && "left".equals(e.getActionCommand())) table.setEditingColumn(table.getEditingColumn() - 1); if (table.getEditingColumn() < table.getColumnCount() -1 && "right".equals(e.getActionCommand())) table.setEditingColumn(table.getEditingColumn() + 1); table.requestFocus(); } }; ActionMap actionMap = new ActionMap(); actionMap.put("up", action); actionMap.put("down", action); actionMap.put("left", action); actionMap.put("right", action); table.setActionMap(actionMap); } public void uninstallCG(SComponent component) { super.uninstallCG(component); final STable table = (STable) component; table.setHeaderRenderer(null); table.setDefaultRenderer(null); table.setRowSelectionRenderer(null); table.setActionMap(null); table.setInputMap(null); } /** * write a specific cell to the device */ protected void renderCellContent(final Device device, final STable table, final SCellRendererPane rendererPane, final int row, final int col) throws IOException { SComponent component = null; final boolean isEditingCell = table.isEditing() && row == table.getEditingRow() && col == table.getEditingColumn(); final boolean editableCell = table.isCellEditable(row, col); final boolean selectableCell = table.getSelectionMode() != SListSelectionModel.NO_SELECTION && !table.isEditable(); if (isEditingCell) { component = table.getEditorComponent(); } else { component = table.prepareRenderer(table.getCellRenderer(row, col), row, col); } final boolean contentContainsClickables = !(component instanceof SLabel); device.print("<td"); Utils.optAttribute(device, "col", col); if (component == null) { device.print("></td>"); return; } Utils.printTableCellAlignment(device, component, SConstants.LEFT, SConstants.TOP); device.print(">"); // Collect inline dynamic styles of cell renderer component: // Cell renderer components are not visible to the DynamicStyleResource as they are not // reachable via the component hierarchy. They'd also not be reachable for the event // dispatcher if not added to the CellRendererPane. Adding to the cellrenderer pane // does the job of registering those items as low level event listener. // the following code does the job of rendering their styles inline. // TODO: Maybe "compress" repeated styles here as well as in the stylesheet writer. try { final StringBuilderDevice stringBuilderDevice = new StringBuilderDevice(); final String styleString = stringBuilderDevice.toString(); if (styleString.length() > 0) { device.print("<style>").print(styleString).print("</style>"); } } catch (Exception e) { log.info("Unexpected Exception durign collection of cell renderer styles", e); } String parameter = null; if (table.isEditable() && !isEditingCell && editableCell) parameter = table.getEditParameter(row, col); else if (selectableCell) parameter = table.getToggleSelectionParameter(row, col); if (parameter != null && !isEditingCell && (selectableCell || editableCell) && !contentContainsClickables) { Utils.printButtonStart(device, table, parameter, true, table.getShowAsFormComponent()); device.print(">"); } else device.print("<span>"); rendererPane.writeComponent(device, component, table); if (parameter != null && !isEditingCell && selectableCell && !contentContainsClickables) { Utils.printButtonEnd(device, table, parameter, true); } else device.print("</span>"); device.print("</td>"); Utils.printNewline(device, component); } protected void writeHeaderCell(final Device device, final STable table, final SCellRendererPane rendererPane, final int c) throws IOException { final SComponent comp = table.prepareHeaderRenderer(c); device.print("<th"); Utils.printTableCellAlignment(device, comp, SConstants.CENTER, SConstants.CENTER); device.print(">"); rendererPane.writeComponent(device, comp, table); device.print("</th>"); Utils.printNewline(device, comp); } public final void writeInternal(final Device _device, final SComponent _c) throws IOException { final STable table = (STable) _c; final SDimension intercellPadding = table.getIntercellPadding(); final SDimension intercellSpacing = table.getIntercellSpacing(); final SListSelectionModel selectionModel = table.getSelectionModel(); final SCellRendererPane rendererPane = table.getCellRendererPane(); final boolean needsSelectionRow = selectionModel.getSelectionMode() != SListSelectionModel.NO_SELECTION && table.isEditable(); final boolean showAsFormComponent = table.getShowAsFormComponent(); final SDimension tableWidthByColumnModel = determineTableWidthByColumnModel(table, needsSelectionRow); /** * Description: This is a FIREFOX bug workaround. Currently we render all components surrounded by a DIV. * During heavy load and incremental delivery of a page this leads to disorted tables as the firefox seems * to have an bug. Refer to http://jira.j-wings.org/browse/WGS-139 * * THis workaround tries to deliver the HTML code of a table at once. This should resolve this issue to 99%. */ final boolean innerTable = _device instanceof CachingDevice; final CachingDevice device = innerTable ? (CachingDevice) _device : new CachingDevice(_device); try { device.print("<table"); if (tableWidthByColumnModel != null) Utils.optAttribute(device,"style",tableWidthByColumnModel.toString()); // apply table dimension if set else Utils.printCSSInlineFullSize(device, table.getPreferredSize()); // stretch if outer dimension has been set // TODO: border="" should be obsolete // TODO: cellspacing and cellpadding may be in conflict with border-collapse /* Tweaking: CG configured to have a fixed border="xy" width */ Utils.optAttribute(device, "class", "STable"); Utils.optAttribute(device, "border", fixedTableBorderWidth); Utils.optAttribute(device, "cellspacing", ((intercellSpacing != null) ? ""+intercellSpacing.getWidthInt() : null)); Utils.optAttribute(device, "cellpadding", ((intercellPadding != null) ? ""+intercellPadding.getHeightInt() : null)); device.print(">"); Utils.printNewline(device, table); STableColumnModel columnModel = table.getColumnModel(); if (columnModel != null && atLeastOneColumnWidthIsNotNull(columnModel)) { if (needsSelectionRow) writeCol(device, selectionColumnWidth); int columnCount = columnModel.getColumnCount(); for (int i=0; i < columnCount; i++) { STableColumn column = columnModel.getColumn(i); if (!column.isHidden()) writeCol(device, column.getWidth()); } } /* * get viewable area */ int startRow = 0; int startCol = 0; int endRow = table.getRowCount(); int endCol = table.getColumnCount(); final Rectangle viewport = table.getViewportSize(); if (viewport != null) { startRow = viewport.y; startCol = viewport.x; endRow = Math.min(startRow + viewport.height, endRow); endCol = Math.min(startCol + viewport.width, endCol); } /* * render the header */ if (table.isHeaderVisible()) { SStringBuilder headerArea = Utils.inlineStyles(table.getDynamicStyle(STable.SELECTOR_HEADER)); device.print("<thead><tr class=\"header\""); Utils.optAttribute(device, "style", headerArea); device.print(">"); Utils.printNewline(device, table); if (needsSelectionRow) device.print("<th width=\"").print(selectionColumnWidth).print("\"></th>"); for (int c = startCol; c < endCol; c++) { writeHeaderCell(device, table, rendererPane, table.convertColumnIndexToModel(c)); } device.print("</tr></thead>\n"); } SStringBuilder selectedArea = Utils.inlineStyles(table.getDynamicStyle(STable.SELECTOR_SELECTED)); SStringBuilder evenArea = Utils.inlineStyles(table.getDynamicStyle(STable.SELECTOR_EVEN_ROWS)); SStringBuilder oddArea = Utils.inlineStyles(table.getDynamicStyle(STable.SELECTOR_ODD_ROWS)); device.print("<tbody>\n"); for (int r = startRow; r < endRow; r++) { SStringBuilder rowClass = new SStringBuilder(table.getRowStyle(r) != null ? table.getRowStyle(r)+" " : ""); device.print("<tr"); if (selectionModel.isSelectedIndex(r)){ Utils.optAttribute(device, "style", selectedArea); rowClass.append("selected "); } else if (r % 2 != 0) Utils.optAttribute(device, "style", oddArea); else Utils.optAttribute(device, "style", evenArea); rowClass.append(r % 2 != 0 ? "odd" : "even"); Utils.optAttribute(device, "class", rowClass); device.print(">"); if (needsSelectionRow) { renderSelectionColumn(device, table, rendererPane, r, showAsFormComponent); } for (int c = startCol; c < endCol; c++) { renderCellContent(device, table, rendererPane, r, table.convertColumnIndexToModel(c)); } device.print("</tr>"); Utils.printNewline(device, table); } device.print("</tbody>"); device.print("</table>"); } finally { /* Refer to description above. */ device.flush(); //device = null; } } private boolean atLeastOneColumnWidthIsNotNull(STableColumnModel columnModel) { int columnCount = columnModel.getColumnCount(); for (int i=0; i < columnCount; i++) if (columnModel.getColumn(i).getWidth() != null) return true; return false; } private void writeCol(Device device, String width) throws IOException { device.print("<col"); Utils.optAttribute(device, "width", width); device.print(">"); } /** * Renders a COLGROUP html element to format the column widths */ protected List determineColumnWidths(final STable table, final boolean needsSelectionRow, final int startcol, final int endcol) throws IOException { final STableColumnModel columnModel = table.getColumnModel(); final String totalWidth = columnModel.getTotalColumnWidth(); ArrayList widthStrings = null; if (totalWidth != null) { widthStrings = new ArrayList(); for (int i = startcol; i < endcol; i++) { final STableColumn column = columnModel.getColumn(i); if (column != null && !column.isHidden()) { widthStrings.add(column.getWidth()); } } } return widthStrings; } /** * Renders the row sometimes needed to allow row selection. */ protected void renderSelectionColumn(final Device device, final STable table, final SCellRendererPane rendererPane, final int row, final boolean showAsFormComponent) throws IOException { final STableCellRenderer rowSelectionRenderer = table.getRowSelectionRenderer(); final String columnStyle = Utils.joinStyles((SComponent) rowSelectionRenderer, "numbering"); device.print("<td"); Utils.optAttribute(device, "class", columnStyle); Utils.optAttribute(device, "width", selectionColumnWidth); device.print(">"); String value = table.getToggleSelectionParameter(row, -1); Utils.printButtonStart(device, table, value, true, table.getShowAsFormComponent()); device.print(">"); renderSelectionColumnContent(device, row, table, rendererPane); Utils.printButtonEnd(device, table, value, true); device.print("</td>"); } /** * Renders the <b>content</b> of the row selection row. */ private void renderSelectionColumnContent(final Device device, int row, final STable table, final SCellRendererPane rendererPane) throws IOException { final STableCellRenderer rowSelectionRenderer = table.getRowSelectionRenderer(); if (rowSelectionRenderer == null) { // simple case: just row number device.print(row); } else { // default case: use row selection renderer component final SComponent comp = rowSelectionRenderer.getTableCellRendererComponent(table, table.getToggleSelectionParameter(row, -1), table.isRowSelected(row), row, -1); rendererPane.writeComponent(device, comp, table); } } /** * @return The total width for this table or <code>null</code> if none. */ protected SDimension determineTableWidthByColumnModel(final STable table, final boolean needsSelectionRow) { if (table.getColumnModel() == null) { return null; } else { String totalWidth = table.getColumnModel().getTotalColumnWidth(); return totalWidth != null ? new SDimension(totalWidth, null) : null; } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
5ccef12267050219e29137143329944229d66480
a4e099107772bfa94408b97f96f823c76dec183e
/src/main/java/spring/mybatis/XmlBuilderMapper.java
ce156890f4fbb8a62491622162163ed9439663ff
[]
no_license
aini207080/MySSM
2202c6deab360300e2884dc0f80ac8632c74a8d5
694dfc428a70c5a4ef5aa788e535f552decba260
refs/heads/master
2020-03-25T14:09:35.033436
2018-08-07T10:02:59
2018-08-07T10:02:59
143,854,717
0
0
null
null
null
null
UTF-8
Java
false
false
1,780
java
package spring.mybatis; import lombok.extern.slf4j.Slf4j; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; import spring.constants.Constants; import java.io.File; import java.util.ArrayList; import java.util.List; /** * @ClassName XmlBuilder * @Description */ @Slf4j public class XmlBuilderMapper { public List<MapperInfo> buildMapper(String xmlMapperPath){ List<MapperInfo> mapperInfoList = new ArrayList<>(); MapperInfo mapperInfo = new MapperInfo(); // 创建saxReader对象 SAXReader reader = new SAXReader(); // 通过read方法读取一个文件 转换成Document对象 Document document = null; String pathName = Constants.PATH + xmlMapperPath; try { document = reader.read(new File(pathName)); } catch (DocumentException e) { log.error("文件没有找到,{}", pathName); } //获取根节点元素 Element node = document.getRootElement(); mapperInfo.setInterfaceName(node.attributeValue("namespace")); //获取所有的bean List<Element> elementsList = node.elements(); for (Element element : elementsList) { if ("select".equals(element.getName())){ mapperInfo.setMethodName(element.attributeValue("id")); mapperInfo.setResultClassName(element.attributeValue("resultType")); mapperInfo.setSqlContent(element.getText()); } mapperInfoList.add(mapperInfo); } return mapperInfoList; } public static void main(String[] args) { new XmlBuilderMapper().buildMapper(Constants.mybatisConfigLocation); } }
[ "997281047@qq.com" ]
997281047@qq.com
fae09c6327e311864d47278a1f8043b4a48d7a47
5c2275a3522380f60035b2b147db2b07ca1fd8fc
/app/src/main/java/app/view/custom/widget/CircleProgressView.java
3a5abe6f7f69629df1f6555673d3b9ea39ee29c1
[]
no_license
thkcheng/CustomView
df11265e95c918808150412b14719c6670a114f8
9671d728e4b68a42940d6a4b0d45ca6e4bb34d89
refs/heads/master
2020-05-20T11:59:41.329169
2019-05-15T07:51:52
2019-05-15T07:51:52
185,562,776
5
1
null
null
null
null
UTF-8
Java
false
false
4,357
java
package app.view.custom.widget; import android.content.Context; import android.graphics.BlurMaskFilter; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; /** * Created by Mysim on 2016/10/14. * Github: https://github.com/micadalee/miclee-fir-demo */ public class CircleProgressView extends View { private int[] RATE_COLORS = {0xFFbb59ff,0xFF44dcfc}; private float mMaxProgress; private float mProgress; private String mLevel; private final int mCircleLineStrokeWidth = 50; private final int mTxtStrokeWidth = 10; // 画圆所在的距形区域 private final RectF mRectF; private final Paint mPaint; private final Paint mTxtPaint; private final Context mContext; private float mWidth; private float mHeight; public CircleProgressView(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; mRectF = new RectF(); mPaint = new Paint(); mTxtPaint = new Paint(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); mWidth = this.getMeasuredWidth(); mHeight = this.getMeasuredHeight(); setLayerType(LAYER_TYPE_SOFTWARE,null); // 位置 mRectF.left = mCircleLineStrokeWidth / 2 + 100; // 左上角x mRectF.top = mCircleLineStrokeWidth / 2 + 100; // 左上角y mRectF.right = mWidth - mCircleLineStrokeWidth / 2 - 100; // 左下角x mRectF.bottom = mHeight - mCircleLineStrokeWidth / 2 - 100; // 右下角y //绘制等级 mTxtPaint.setAntiAlias(true); mTxtPaint.setStrokeWidth(mTxtStrokeWidth); mTxtPaint.setTextSize(100); mTxtPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD_ITALIC)); int strWidth = (int) mTxtPaint.measureText(mLevel,0,mLevel.length()); int strHeight = 210; mTxtPaint.setStyle(Paint.Style.FILL); mTxtPaint.setColor(Color.WHITE); canvas.drawText(mLevel,mWidth/2 - strWidth/2,mHeight/2 + strHeight/2 + 50,mTxtPaint); // 绘制进度文案显示 mTxtPaint.setAntiAlias(true); mTxtPaint.setStrokeWidth(mTxtStrokeWidth); mTxtPaint.setTypeface(Typeface.DEFAULT); String text = (int) mProgress + "/" + (int) mMaxProgress; float textHeight = mHeight / 8; mTxtPaint.setTextSize(textHeight); int textWidth = ((int) mTxtPaint.measureText(text, 0, text.length())); mTxtPaint.setStyle(Paint.Style.FILL); mTxtPaint.setColor(Color.YELLOW); canvas.drawText(text, mWidth / 2 - textWidth / 2, mHeight / 2 + textHeight / 2, mTxtPaint); // 设置圆的画笔相关属性 mPaint.setAntiAlias(true); mPaint.setColor(Color.rgb(0xe9, 0xe9, 0xe9)); mPaint.setStrokeWidth(mCircleLineStrokeWidth); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setMaskFilter(null); mPaint.setShader(null); // 绘制圆圈,进度条背景 canvas.drawArc(mRectF, -90, 360, false, mPaint); float section = mProgress / mMaxProgress; mPaint.setColor(Color.RED); LinearGradient gradient = new LinearGradient(mWidth /2,0, mWidth /2, mHeight,RATE_COLORS,null, Shader.TileMode.MIRROR); mPaint.setShader(gradient); mPaint.setMaskFilter(new BlurMaskFilter(50, BlurMaskFilter.Blur.SOLID)); canvas.drawArc(mRectF, -90, section * 360, false, mPaint); } public float getProgress() { return mProgress; } public void setProgress(float progress) { mProgress = progress; // this.invalidate(); } public float getMaxProgress() { return mMaxProgress; } public void setMaxProgress(float maxProgress) { mMaxProgress = maxProgress; } public String getLevel() { return mLevel; } public void setLevel(String level) { mLevel = level; } }
[ "xiexucheng@228.com.cn" ]
xiexucheng@228.com.cn
b386a8c8043cb8ea6daac7cd4fce3c02b75e1751
23320b46f2ad7da24ee8376b779cdfbcff04e5b0
/src/com/lqm/home/mapper/PostMapper.java
796426239d06e3ea319aaa61cc733d4a41508867
[]
no_license
chaiyisong/HomeServer
f5e6c9eb6c78a3e75ff54f5d36dfd53188baefda
cd64060fde0b3c866770b8f83619fca912b384c6
refs/heads/master
2021-06-22T02:21:53.567711
2021-01-31T15:41:51
2021-01-31T15:41:51
185,707,437
0
0
null
2019-05-09T01:54:20
2019-05-09T01:54:20
null
UTF-8
Java
false
false
784
java
package com.lqm.home.mapper; import com.lqm.home.po.Post; import com.lqm.home.po.PostExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface PostMapper { int countByExample(PostExample example); int deleteByExample(PostExample example); int deleteByPrimaryKey(Integer id); int insert(Post record); int insertSelective(Post record); List<Post> selectByExample(PostExample example); Post selectByPrimaryKey(Integer id); int updateByExampleSelective(@Param("record") Post record, @Param("example") PostExample example); int updateByExample(@Param("record") Post record, @Param("example") PostExample example); int updateByPrimaryKeySelective(Post record); int updateByPrimaryKey(Post record); }
[ "1002438809@qq.com" ]
1002438809@qq.com
a379ee469df22a426f8990be0b690b05fcfeb123
8dc71c7ca2669f64ae9b8560743f6b4a79d57e16
/src/main/java/com/guangguanger/MyCRUD/web/dao/PermissionMapper.java
75610e95828a38c384b29c2d03470a0e67f3527d
[]
no_license
CarloXiang/MyCRUD
0fe66bfc39962dcf09fc14e25fb87c8c63ac7c8a
bc0d0bcf8dbbb59401b5fc2f705ab464e70e3666
refs/heads/master
2021-01-14T08:50:04.489732
2015-09-10T08:10:49
2015-09-10T08:10:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,283
java
package com.guangguanger.MyCRUD.web.dao; import java.util.List; import com.guangguanger.MyCRUD.core.generic.GenericDao; import com.guangguanger.MyCRUD.web.model.Permission; import com.guangguanger.MyCRUD.web.model.PermissionExample; import org.apache.ibatis.annotations.Param; /** * 权限 Dao 接口 * * @author StarZou * @since 2014年7月5日 上午11:59:03 **/ public interface PermissionMapper extends GenericDao<Permission, Long> { int countByExample(PermissionExample example); int deleteByExample(PermissionExample example); int deleteByPrimaryKey(Long id); int insert(Permission record); int insertSelective(Permission record); List<Permission> selectByExample(PermissionExample example); Permission selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") Permission record, @Param("example") PermissionExample example); int updateByExample(@Param("record") Permission record, @Param("example") PermissionExample example); int updateByPrimaryKeySelective(Permission record); int updateByPrimaryKey(Permission record); /** * 通过角色id 查询角色 拥有的权限 * * @param roleId * @return */ List<Permission> selectPermissionsByRoleId(Long roleId); }
[ "lacelove@163.com" ]
lacelove@163.com
4a39aff488b3f687b7a4d48d263d050c78db930f
5fff42916c4b1ca2e7c05b72e0f9b64ce5a35198
/src/main/java/ai/msg/modules/controller/AnalyticsController.java
164cf3943f274ec79b1159cdcdbcdf8bb152e356
[]
no_license
sohanKumawat/angular2-jwtsecurity-springmvc
03cbf6f854b5368c75e4d3b2afcadc4e3a236bb4
84ba8b1ac65d054d791af3f4ed4c5285f6a089b0
refs/heads/master
2020-05-24T00:36:22.920635
2017-03-13T09:18:14
2017-03-13T09:18:14
84,806,596
2
0
null
null
null
null
UTF-8
Java
false
false
1,195
java
package ai.msg.modules.controller; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import ai.msg.security.auth.JwtAuthenticationToken; import ai.msg.security.model.UserContext; @RequestMapping(value="api/v1") @RestController public class AnalyticsController { @Autowired RestTemplate restTemplate; public AnalyticsController(){ } @RequestMapping(value="/analytics/dashboard",method={RequestMethod.GET,RequestMethod.POST}) public @ResponseBody String fetchAnalyticsData(HttpServletRequest request,JwtAuthenticationToken token){ System.out.println("inside the dashboard"); return "hello"; } @RequestMapping(value="/user/profile",method={RequestMethod.GET,RequestMethod.POST}) public @ResponseBody UserContext get(JwtAuthenticationToken token) { return (UserContext) token.getPrincipal(); } }
[ "sohan@msg.ai" ]
sohan@msg.ai
5a4955bc96b326ff5a2f4871b03e6011e53b8796
592c4d65ee7a9c1baedbe81a3e74db55242b5bf1
/app/src/main/java/com/guardado/comunicacionf/OpcionesActivity.java
7329d01e1ea7c7b653445b3933422fc52c43cfa5
[]
no_license
nguardadov/Ventas
c3b8179ac01d433099a9950371d9ce728c0e7382
587efe692c584f6308e1224760ba7fc843bbe956
refs/heads/master
2020-03-14T04:49:58.106864
2018-04-29T01:30:19
2018-04-29T01:30:19
131,450,730
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package com.guardado.comunicacionf; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class OpcionesActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_opciones); } }
[ "nguardadov@gmail.com" ]
nguardadov@gmail.com
bcd71a6da3b03b25ed3ffe493cc1e8fee86140d6
61852d4b2864a0a474b87d2ec4c2589470c93520
/serwer/src/serwer/Gracz.java
f1a54d92adfa2419c5b887fd0252b8d0b4519bb9
[]
no_license
pawelwaz/javazadania
de071711df49c754f2e4ab4e1c15d100a7ecde5d
b8ffdcb42c90e79d5514d7a50e25e8860e568237
refs/heads/master
2021-01-17T17:03:52.844235
2016-08-04T20:01:47
2016-08-04T20:01:47
64,963,374
0
0
null
null
null
null
UTF-8
Java
false
false
3,042
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 serwer; import java.net.*; import java.io.*; class Gracz implements Runnable { private int plansza[][]; // liczba >= 100 to mina, 0, 1, ..., 8 --ile wokól min private boolean klikniete[][]; private PrintWriter out; private BufferedReader in; private Socket polaczenie; private void InicjujPlansze() { plansza = new int[11][11]; klikniete = new boolean[11][11]; int w, k, licznik; licznik = 0; while (licznik < 10) { w = (int)(Math.random()*9) + 1; k = (int)(Math.random()*9) + 1; if (plansza[w][k] < 100) { ++licznik; plansza[w][k] = 100; ++plansza[w-1][k-1]; ++plansza[w-1][k]; ++plansza[w-1][k+1]; ++plansza[w][k-1]; ++plansza[w][k+1]; ++plansza[w+1][k-1]; ++plansza[w+1][k]; ++plansza[w+1][k+1]; } } } public Gracz(Socket polaczenie) { InicjujPlansze(); this.polaczenie = polaczenie; try { out = new PrintWriter(polaczenie.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(polaczenie.getInputStream())); } catch (IOException e) { System.out.println(e.toString()); } } public void run() { int w, k, odkryte, liczba; String wsp, odp; boolean koniec = false; odkryte=0; try { out.println("OK."); while ((!koniec) && (odkryte<71)) { wsp = in.readLine(); if (wsp == null) koniec = true; else { try { liczba = Integer.parseInt(wsp); w = (int)((liczba-1)/9) + 1; k = (liczba-1) % 9 + 1; } catch (NumberFormatException e) { w = 200; k = 200; } if ((w>=1) && (w<=9) && (k>=1) && (k<=9)) { if (plansza[w][k] >= 100) { out.println("bum"); koniec = true; } else { out.println(Integer.toString(plansza[w][k])); if(!klikniete[w][k]) ++odkryte; } klikniete[w][k] = true; } } } } catch (IOException e) { System.out.println(e.toString()); } finally { try { polaczenie.close(); } catch (IOException e) {} } } }
[ "waz-pawel@wp.pl" ]
waz-pawel@wp.pl
605ec8b10a2af22ffd0eee5af6098e85dfbbaba3
58d0cdad9a9bb30dbbc9aa271623dc50cb44397b
/src/main/java/org/bqftest/design/factory/operations/OperationFactory.java
3418399d045ab4c0e5c38e1a1a3a57a8b585819e
[]
no_license
signbird/mytest
f2847239898ea72fd8afda4c1d6016a3f5370250
fdaf20598eaac777d390ad0fb612dc8fdd1b2691
refs/heads/master
2022-12-23T09:58:54.864930
2019-12-23T03:31:34
2019-12-23T03:31:34
144,944,491
0
0
null
2022-12-16T02:56:55
2018-08-16T06:10:45
Java
UTF-8
Java
false
false
499
java
package org.bqftest.design.factory.operations; import org.bqftest.design.factory.IOperate; public class OperationFactory { public static IOperate createOperate(String operator) { IOperate oper = null; switch (operator) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; case "*": oper = new OperationAdd(); break; case "/": oper = new OperationDiv(); break; default: break; } return oper; } }
[ "baiqiufei@migu.cn" ]
baiqiufei@migu.cn
f8e2c0a4f464a9b00dbb983606c3361cecadb212
96c576ab675fea05544ca0a7a54019cefd5a454e
/skyeye-promote/skyeye-common/src/main/java/com/skyeye/dsform/service/DsFormPageService.java
068301134f13ddb2c00cbe70a5e7b2e29226e40c
[]
permissive
weizhiqiang1995/erp-pro
1cf07409cb4caca79573cb898dd2f348e95b2163
2381ff145a73314d027be6567757b380b9503039
refs/heads/company_server
2023-06-25T11:54:01.056544
2023-06-19T06:14:11
2023-06-19T06:14:11
214,651,539
318
109
Apache-2.0
2022-06-18T05:49:04
2019-10-12T13:26:35
Java
UTF-8
Java
false
false
1,031
java
/******************************************************************************* * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye ******************************************************************************/ package com.skyeye.dsform.service; import com.skyeye.base.business.service.SkyeyeBusinessService; import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; import com.skyeye.dsform.entity.DsFormPage; public interface DsFormPageService extends SkyeyeBusinessService<DsFormPage> { void queryDsFormPageList(InputObject inputObject, OutputObject outputObject); void writeDsFormPageContent(InputObject inputObject, OutputObject outputObject); void writeDsFormPageTable(InputObject inputObject, OutputObject outputObject); void queryBusinessDataByObject(InputObject inputObject, OutputObject outputObject); void queryDsFormPageForProcess(InputObject inputObject, OutputObject outputObject); }
[ "598748873@qq.com" ]
598748873@qq.com
1f6efb9a837e249c5896599a40f7b09dda9c13b0
90e9ec6fa6c90174ad4cb652af63834e16b90815
/MyApp/app/build/generated/source/r/debug/android/support/compat/R (2019_04_17 17_37_00 UTC).java
a42fc336ff6233155cb0b11617c6e5cf935615c2
[]
no_license
terriljoel/Android-Basic-Apps-
478e208cd147cd2083fde0f9284400fa4c99bf38
b38ed84006914c443cdaa52b8dac8ad0ffcf7fcc
refs/heads/master
2022-12-22T14:41:37.171823
2020-09-23T18:43:45
2020-09-23T18:43:45
298,059,514
0
0
null
null
null
null
UTF-8
Java
false
false
8,588
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.compat; public final class R { public static final class attr { public static final int font = 0x7f02007a; public static final int fontProviderAuthority = 0x7f02007c; public static final int fontProviderCerts = 0x7f02007d; public static final int fontProviderFetchStrategy = 0x7f02007e; public static final int fontProviderFetchTimeout = 0x7f02007f; public static final int fontProviderPackage = 0x7f020080; public static final int fontProviderQuery = 0x7f020081; public static final int fontStyle = 0x7f020082; public static final int fontVariationSettings = 0x7f020083; public static final int fontWeight = 0x7f020084; public static final int ttcIndex = 0x7f02013c; } public static final class color { public static final int notification_action_color_filter = 0x7f04003f; public static final int notification_icon_bg_color = 0x7f040040; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_light = 0x7f04004c; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f05005b; public static final int notification_action_text_size = 0x7f05005c; public static final int notification_big_circle_margin = 0x7f05005d; public static final int notification_content_margin_start = 0x7f05005e; public static final int notification_large_icon_height = 0x7f05005f; public static final int notification_large_icon_width = 0x7f050060; public static final int notification_main_column_padding_top = 0x7f050061; public static final int notification_media_narrow_margin = 0x7f050062; public static final int notification_right_icon_size = 0x7f050063; public static final int notification_right_side_padding_top = 0x7f050064; public static final int notification_small_icon_background_padding = 0x7f050065; public static final int notification_small_icon_size_as_large = 0x7f050066; public static final int notification_subtext_size = 0x7f050067; public static final int notification_top_pad = 0x7f050068; public static final int notification_top_pad_large_text = 0x7f050069; } public static final class drawable { public static final int notification_action_background = 0x7f060057; public static final int notification_bg = 0x7f060058; public static final int notification_bg_low = 0x7f060059; public static final int notification_bg_low_normal = 0x7f06005a; public static final int notification_bg_low_pressed = 0x7f06005b; public static final int notification_bg_normal = 0x7f06005c; public static final int notification_bg_normal_pressed = 0x7f06005d; public static final int notification_icon_background = 0x7f06005e; public static final int notification_template_icon_bg = 0x7f06005f; public static final int notification_template_icon_low_bg = 0x7f060060; public static final int notification_tile_bg = 0x7f060061; public static final int notify_panel_notification_icon_bg = 0x7f060062; } public static final class id { public static final int action_container = 0x7f07000d; public static final int action_divider = 0x7f07000f; public static final int action_image = 0x7f070010; public static final int action_text = 0x7f070016; public static final int actions = 0x7f070017; public static final int async = 0x7f07001d; public static final int blocking = 0x7f070020; public static final int chronometer = 0x7f070029; public static final int forever = 0x7f07003e; public static final int icon = 0x7f070043; public static final int icon_group = 0x7f070044; public static final int info = 0x7f070048; public static final int italic = 0x7f07004a; public static final int line1 = 0x7f07004c; public static final int line3 = 0x7f07004d; public static final int normal = 0x7f070055; public static final int notification_background = 0x7f070056; public static final int notification_main_column = 0x7f070057; public static final int notification_main_column_container = 0x7f070058; public static final int right_icon = 0x7f070061; public static final int right_side = 0x7f070062; public static final int tag_transition_group = 0x7f070082; public static final int tag_unhandled_key_event_manager = 0x7f070083; public static final int tag_unhandled_key_listeners = 0x7f070084; public static final int text = 0x7f070085; public static final int text2 = 0x7f070086; public static final int time = 0x7f070089; public static final int title = 0x7f07008a; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { public static final int notification_action = 0x7f09001e; public static final int notification_action_tombstone = 0x7f09001f; public static final int notification_template_custom_big = 0x7f090020; public static final int notification_template_icon_group = 0x7f090021; public static final int notification_template_part_chronometer = 0x7f090022; public static final int notification_template_part_time = 0x7f090023; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0c0029; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0d00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00ee; public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00ef; public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f0; public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0158; public static final int Widget_Compat_NotificationActionText = 0x7f0d0159; } public static final class styleable { public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; } }
[ "terriljoel@gmail.com" ]
terriljoel@gmail.com
9023c52fa471677b52fbf2fa0d7eec1e3b84f338
014440b6443d7b08d9312f15d7028779ed1490c5
/src/main/java/com/logos/controller/ProductController.java
b0568832a949b83f855e01b2aa5fa3ee6f8df359
[]
no_license
bohdanrud/Consultation
c5e6e4724ca80279af6fdce015a4f2fa0d140121
288d5d88ea57f78142200df9d9b6adc6dc8ed8d8
refs/heads/master
2020-03-12T04:45:14.734687
2018-05-05T09:44:09
2018-05-05T09:44:09
130,451,027
0
0
null
null
null
null
UTF-8
Java
false
false
1,626
java
package com.logos.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.logos.entity.Product; import com.logos.service.ProductService; import com.logos.service.cloudinary.CloudinaryService; @Controller @RequestMapping("/product") public class ProductController { @Autowired private CloudinaryService cloudinaryService; @Autowired private ProductService productService; @GetMapping("/add") public String showAddProductForm(Model model) { model.addAttribute("productModel", new Product()); return "product/add-product"; } @PostMapping("/add") public String saveProduct( @ModelAttribute("productModel") Product product, @RequestParam("productImage") MultipartFile file) { productService.saveProduct(product); String imageUrl = cloudinaryService.uploadFile(file, "product/" + product.getId()); product.setImageUrl(imageUrl); productService.saveProduct(product); return "redirect:/"; } @GetMapping("/list") public String showProducts(Model model) { model.addAttribute("products", productService.findAllProducts()); return "product/products"; } }
[ "ащч@SAMSUNG350U2B" ]
ащч@SAMSUNG350U2B
7546998a01131b5aed2ec2e0b6d83dbbdeeb373c
afe0a82242287e0578496a34f75eade4c5801da1
/lab7/src/entity/Student.java
b635dd6a66db8637f63862d3eb71af4433e30e68
[]
no_license
MuriLOCO/JavaJpaCourse
83152bdc73fbcdf57efdd2c11e41980fe0425bba
25f1f1ac9e2affb3a5bcb2d612a28f0d3e80574a
refs/heads/master
2021-01-10T18:21:34.225142
2016-10-14T15:19:02
2016-10-14T15:19:02
70,167,676
0
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
package entity; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; @Entity public class Student { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String studentName; @OneToMany(cascade={CascadeType.PERSIST, CascadeType.REMOVE}) @JoinColumn(name = "student_id") private List<Guide> guides; public Student() { } public Student(String studentName, List<Guide> guides){ this.studentName = studentName; this.guides = guides; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public List<Guide> getGuides() { return guides; } public void setGuides(List<Guide> guides) { this.guides = guides; } }
[ "jmmendes@opessoftware.com" ]
jmmendes@opessoftware.com
0e7b0f4f55072992234d78d53fa7f09598916050
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_5652dc09bde06b52b4452c4e0f0f2b6f3231c0f2/CreatePresenterTask/7_5652dc09bde06b52b4452c4e0f0f2b6f3231c0f2_CreatePresenterTask_s.java
8568ea8791cb43fe4e3e1434c3c263a56942c8f1
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
23,461
java
/** * Copyright 2013 ArcBees Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.arcbees.plugin.eclipse.wizard.createpresenter; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.IBuffer; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.ToolFactory; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ASTParser; import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.ImportDeclaration; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; import org.eclipse.jdt.core.dom.rewrite.ListRewrite; import org.eclipse.jdt.internal.core.ResolvedSourceType; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.text.edits.MalformedTreeException; import org.eclipse.text.edits.TextEdit; import com.arcbees.plugin.eclipse.domain.PresenterConfigModel; import com.arcbees.plugin.eclipse.util.CodeFormattingUtil; import com.arcbees.plugin.eclipse.util.PackageHierarchy; import com.arcbees.plugin.eclipse.util.PackageHierarchyElement; import com.arcbees.plugin.template.create.place.CreateNameTokens; import com.arcbees.plugin.template.create.presenter.CreateNestedPresenter; import com.arcbees.plugin.template.domain.place.CreatedNameTokens; import com.arcbees.plugin.template.domain.place.NameToken; import com.arcbees.plugin.template.domain.place.NameTokenOptions; import com.arcbees.plugin.template.domain.presenter.CreatedNestedPresenter; import com.arcbees.plugin.template.domain.presenter.NestedPresenterOptions; import com.arcbees.plugin.template.domain.presenter.PresenterOptions; import com.arcbees.plugin.template.domain.presenter.RenderedTemplate; public class CreatePresenterTask { public static CreatePresenterTask run(PresenterConfigModel presenterConfigModel, IProgressMonitor progressMonitor) { CreatePresenterTask createPresenterTask = new CreatePresenterTask(presenterConfigModel, progressMonitor); createPresenterTask.run(); return createPresenterTask; } private PresenterConfigModel presenterConfigModel; private IProgressMonitor progressMonitor; private CreatedNestedPresenter createdNestedPresenterTemplates; private IPackageFragment presenterCreatedPackage; private boolean forceWriting; private PackageHierarchy packageHierarchy; private CreatedNameTokens createdNameTokenTemplates; private IPackageFragment createdNameTokensPackage; private CodeFormattingUtil codeFormatter; private CreatePresenterTask(PresenterConfigModel presenterConfigModel, IProgressMonitor progressMonitor) { this.presenterConfigModel = presenterConfigModel; this.progressMonitor = progressMonitor; codeFormatter = new CodeFormattingUtil(presenterConfigModel.getJavaProject(), progressMonitor); } private void run() { createPackageHierachyIndex(); createNameTokensPackage(); createNametokensFile(); fetchTemplatesNameTokens(); fetchTemplatesNestedPresenter(); forceWriting = true; createNameTokensFieldAndMethods(); createPresenterPackage(); createPresenterModule(); createPresenterModuleLinkForGin(); createPresenter(); createPresenterUiHandlers(); createPresenterView(); createPresenterViewUi(); // TODO focus on new presenter and open it up // TODO logger System.out.println("finished"); } private void createPackageHierachyIndex() { packageHierarchy = new PackageHierarchy(presenterConfigModel, progressMonitor); packageHierarchy.run(); } private void fetchTemplatesNameTokens() { if (!presenterConfigModel.getPlace()) { return; } NameToken token = new NameToken(); token.setCrawlable(presenterConfigModel.getCrawlable()); token.setToken(presenterConfigModel.getNameToken()); List<NameToken> nameTokens = new ArrayList<NameToken>(); nameTokens.add(token); NameTokenOptions nameTokenOptions = new NameTokenOptions(); nameTokenOptions.setPackageName(createdNameTokensPackage.getElementName()); nameTokenOptions.setNameTokens(nameTokens); boolean processFileOnly = false; createdNameTokenTemplates = CreateNameTokens.run(nameTokenOptions, true, processFileOnly); } private void fetchTemplatesNestedPresenter() { // Translate options from PresenterConfigModel to PresenterOptions PresenterOptions presenterOptions = new PresenterOptions(); presenterOptions.setPackageName(presenterConfigModel.getSelectedPackageAndNameAsSubPackage()); presenterOptions.setName(presenterConfigModel.getName()); // TODO add more options... if (presenterConfigModel.getNestedPresenter()) { fetchNestedTemplate(presenterOptions); } else if (presenterConfigModel.getPresenterWidget()) { // TODO } else if (presenterConfigModel.getPopupPresenter()) { // TODO } } private void fetchNestedTemplate(PresenterOptions presenterOptions) { NestedPresenterOptions nestedPresenterOptions = new NestedPresenterOptions(); nestedPresenterOptions.setPlace(presenterConfigModel.getPlace()); nestedPresenterOptions.setNameToken(presenterConfigModel.getNameToken()); nestedPresenterOptions.setCrawlable(presenterConfigModel.getCrawlable()); nestedPresenterOptions.setCodeSplit(presenterConfigModel.getCodeSplit()); nestedPresenterOptions.setNameToken(presenterConfigModel.getNameTokenWithClass()); nestedPresenterOptions.setNameTokenImport(presenterConfigModel.getNameTokenUnitImport()); if (presenterConfigModel.getRevealInRoot()) { nestedPresenterOptions.setRevealType("Root"); } else if (presenterConfigModel.getRevealInRootLayout()) { nestedPresenterOptions.setRevealType("RootLayout"); } else if (presenterConfigModel.getPopupPresenter()) { nestedPresenterOptions.setRevealType("RootPopup"); } else if (presenterConfigModel.getRevealInSlot()) { nestedPresenterOptions.setRevealType(presenterConfigModel.getContentSlotAsString()); } nestedPresenterOptions.setContentSlotImport(presenterConfigModel.getContentSlotImport()); createdNestedPresenterTemplates = CreateNestedPresenter.run(presenterOptions, nestedPresenterOptions, true); } /** * Create a sub package for the presenter classes */ private String createPresenterPackage() { String presenterPackageName = presenterConfigModel.getSelectedPackageAndNameAsSubPackage(); createPackage(presenterPackageName, forceWriting); // TODO logger System.out.println("Created Package: " + presenterPackageName); return presenterPackageName; } private IPackageFragment createPackage(String packageName, boolean forceWriting) { IPackageFragment selectedPackage = presenterConfigModel.getSelectedPackage(); IPackageFragmentRoot selectedPackageRoot = (IPackageFragmentRoot) selectedPackage.getParent(); IPackageFragment created = null; try { created = presenterCreatedPackage = selectedPackageRoot.createPackageFragment(packageName, forceWriting, progressMonitor); } catch (JavaModelException e) { // TODO display error e.printStackTrace(); } return created; } private void createNameTokensPackage() { if (!presenterConfigModel.getPlace()) { return; } IPackageFragment selectedPackage = presenterConfigModel.getSelectedPackage(); String selectedPackageString = selectedPackage.getElementName(); PackageHierarchyElement clientPackage = packageHierarchy.findParentClient(selectedPackageString); String clientPackageString = clientPackage.getPackageFragment().getElementName(); // name tokens package ...client.place.NameTokens clientPackageString += ".place"; PackageHierarchyElement nameTokensPackageExists = packageHierarchy.find(clientPackageString); if (nameTokensPackageExists != null && nameTokensPackageExists.getPackageFragment() != null) { createdNameTokensPackage = nameTokensPackageExists.getPackageFragment(); } else { createdNameTokensPackage = createPackage(clientPackageString, forceWriting); } } private void createPresenterModule() { RenderedTemplate rendered = createdNestedPresenterTemplates.getModule(); createClass(rendered, forceWriting); } /** * TODO extraction of functions TODO extract "GinModule" to constant TODO extract "gin" to constant */ private void createPresenterModuleLinkForGin() { // 1. first search parent ICompilationUnit unit = packageHierarchy.findInterfaceTypeInParentPackage( presenterConfigModel.getSelectedPackage(), "GinModule"); // 2. next check if the parent is client and if so, scan all packages for ginModule String selectedPackageElementName = presenterConfigModel.getSelectedPackage().getElementName(); if (unit == null && packageHierarchy.isParentTheClientPackage(selectedPackageElementName)) { // first check for a gin package with GinModule PackageHierarchyElement hierarchyElement = packageHierarchy.findParentClientAndAddPackage( selectedPackageElementName, "gin"); if (hierarchyElement != null) { IPackageFragment clienPackage = hierarchyElement.getPackageFragment(); unit = packageHierarchy.findInterfaceTypeInParentPackage(clienPackage, "GinModule"); } // If no gin package check for any existence of a GinModule // TODO could make this smarter in the future, this is a last resort, to install it somewhere. if (unit == null) { unit = packageHierarchy.findFirstInterfaceType("GinModule"); // TODO logger System.out .println("Warning: This didn't find a ideal place to put the gin install for the new presenter module"); } } // 3. walk up next parent for and look for gin module if (unit == null) { if (selectedPackageElementName.contains("client")) { PackageHierarchyElement hierarchyElement = packageHierarchy.findParent(selectedPackageElementName); if (hierarchyElement.getPackageFragment() != null) { IPackageFragment parentParentPackage = hierarchyElement.getPackageFragment(); unit = packageHierarchy.findInterfaceTypeInParentPackage(parentParentPackage, "GinModule"); } } } // 4. search all filter by GinModule interface, this would be easy // If no gin package check for any existence of a GinModule // TODO could make this smarter in the future, this is a last resort, to install it somewhere. if (unit == null) { unit = packageHierarchy.findFirstInterfaceType("GinModule"); // TODO logger System.out .println("Warning: This didn't find a ideal place to put the gin install for the new presenter module"); } // (could do this next for ease) if (unit != null) { try { createPresenterGinlink(unit); } catch (JavaModelException e) { // TODO e.printStackTrace(); } catch (MalformedTreeException e) { // TODO e.printStackTrace(); } catch (BadLocationException e) { // TODO e.printStackTrace(); } } else { // TODO display error, wasn't able to install gin module System.out.println("Error: Wasn't able to install Module"); } } /** * TODO extract this possibly, but I think I'll wait till I get into slots before I do it see what is common. */ private void createPresenterGinlink(ICompilationUnit unit) throws JavaModelException, MalformedTreeException, BadLocationException { Document document = new Document(unit.getSource()); CompilationUnit astRoot = initAstRoot(unit); // creation of ASTRewrite ASTRewrite rewrite = ASTRewrite.create(astRoot.getAST()); // find the configure method MethodDeclaration method = findMethod(astRoot, "configure"); if (method == null) { // TODO throw exception return; } // presenter import String fileNameForModule = createdNestedPresenterTemplates.getModule().getNameAndNoExts(); String importName = presenterConfigModel.getSelectedPackageAndNameAsSubPackage() + "." + fileNameForModule; String[] presenterPackage = importName.split("\\."); ImportDeclaration importDeclaration = astRoot.getAST().newImportDeclaration(); importDeclaration.setName(astRoot.getAST().newName(presenterPackage)); ListRewrite lrw = rewrite.getListRewrite(astRoot, CompilationUnit.IMPORTS_PROPERTY); lrw.insertLast(importDeclaration, null); // presenter configure method install(new Module()); String moduleName = fileNameForModule + "()"; String installModuleStatement = "install(new " + moduleName + ");"; Block block = method.getBody(); ListRewrite listRewrite = rewrite.getListRewrite(block, Block.STATEMENTS_PROPERTY); ASTNode placeHolder = rewrite.createStringPlaceholder(installModuleStatement, ASTNode.EMPTY_STATEMENT); listRewrite.insertFirst(placeHolder, null); // computation of the text edits TextEdit edits = rewrite.rewriteAST(document, unit.getJavaProject().getOptions(true)); // computation of the new source code edits.apply(document); String newSource = document.get(); // update of the compilation unit and save it IBuffer buffer = unit.getBuffer(); buffer.setContents(newSource); buffer.save(progressMonitor, forceWriting); // TODO logger System.out.println("Added presenter gin install into " + unit.getElementName() + " " + installModuleStatement); } private MethodDeclaration findMethod(CompilationUnit astRoot, String methodName) { MethodDeclaration[] methods = ((TypeDeclaration) astRoot.types().get(0)).getMethods(); if (methods == null) { return null; } for (MethodDeclaration method : methods) { if (method.getName().toString().contains(methodName)) { return method; } } return null; } /** * Creation of DOM/AST from a ICompilationUnit. */ private CompilationUnit initAstRoot(ICompilationUnit unit) { ASTParser parser = ASTParser.newParser(AST.JLS4); parser.setSource(unit); CompilationUnit astRoot = (CompilationUnit) parser.createAST(progressMonitor); return astRoot; } private void createPresenter() { RenderedTemplate rendered = createdNestedPresenterTemplates.getPresenter(); createClass(rendered, forceWriting); } private void createPresenterUiHandlers() { if (!presenterConfigModel.getUseUiHandlers()) { return; } RenderedTemplate rendered = createdNestedPresenterTemplates.getUihandlers(); createClass(rendered, forceWriting); } private void createPresenterView() { RenderedTemplate rendered = createdNestedPresenterTemplates.getView(); createClass(rendered, forceWriting); } private void createPresenterViewUi() { RenderedTemplate rendered = createdNestedPresenterTemplates.getViewui(); IFolder folder = (IFolder) presenterCreatedPackage.getResource(); IFile newFile = folder.getFile(rendered.getNameAndNoExt()); byte[] bytes = rendered.getContents().getBytes(); InputStream source = new ByteArrayInputStream(bytes); try { newFile.create(source, IResource.NONE, progressMonitor); } catch (CoreException e) { // TODO or throw exception e.printStackTrace(); } } private void createNametokensFile() { if (!presenterConfigModel.getPlace()) { return; } // look for existing name tokens first. List<ResolvedSourceType> foundNameTokens = packageHierarchy.findClassName("NameTokens"); ICompilationUnit unitNameTokens = null; if (foundNameTokens != null && foundNameTokens.size() > 0) { ResolvedSourceType foundNameTokensSource = foundNameTokens.get(0); unitNameTokens = foundNameTokensSource.getCompilationUnit(); } else { unitNameTokens = createNewNameTokensFile(); } if (unitNameTokens == null) { // TODO display error that NameTokens could not be created. return; } // used for import string presenterConfigModel.setNameTokenUnit(unitNameTokens); } /** * create name tokens class, if it doesn't exist */ private void createNameTokensFieldAndMethods() { ICompilationUnit unitNameTokens = presenterConfigModel.getNameTokenUnit(); if (unitNameTokens == null) { // TODO nothing to do return; } try { addMethodsToNameTokens(unitNameTokens); } catch (JavaModelException e) { // TODO e.printStackTrace(); } catch (MalformedTreeException e) { // TODO e.printStackTrace(); } catch (BadLocationException e) { // TODO e.printStackTrace(); } } private void addMethodsToNameTokens(ICompilationUnit unit) throws JavaModelException, MalformedTreeException, BadLocationException { Document document = new Document(unit.getSource()); CompilationUnit astRoot = initAstRoot(unit); // creation of ASTRewrite ASTRewrite rewrite = ASTRewrite.create(astRoot.getAST()); // find existing method MethodDeclaration method = findMethod(astRoot, presenterConfigModel.getNameTokenMethodName()); if (method != null) { // TODO already exists, display warning return; } List<String> fields = createdNameTokenTemplates.getFields(); List<String> methods = createdNameTokenTemplates.getMethods(); String fieldSource = fields.get(0); String methodSource = methods.get(0); List types = astRoot.types(); ASTNode rootNode = (ASTNode) types.get(0); ListRewrite listRewrite = rewrite.getListRewrite(rootNode, TypeDeclaration.BODY_DECLARATIONS_PROPERTY); ASTNode fieldNode = rewrite.createStringPlaceholder(fieldSource, ASTNode.EMPTY_STATEMENT); ASTNode methodNode = rewrite.createStringPlaceholder(methodSource, ASTNode.EMPTY_STATEMENT); listRewrite.insertFirst(fieldNode, null); listRewrite.insertLast(methodNode, null); // computation of the text edits TextEdit edits = rewrite.rewriteAST(document, unit.getJavaProject().getOptions(true)); // computation of the new source code edits.apply(document); // format code String newSource = codeFormatter.formatCodeJavaClass(document); // update of the compilation unit and save it IBuffer buffer = unit.getBuffer(); buffer.setContents(newSource); buffer.save(progressMonitor, forceWriting); } private ICompilationUnit createNewNameTokensFile() { boolean processFileOnly = true; NameTokenOptions nameTokenOptions = new NameTokenOptions(); nameTokenOptions.setPackageName(createdNameTokensPackage.getElementName()); CreatedNameTokens createdNameToken = CreateNameTokens.run(nameTokenOptions, true, processFileOnly); RenderedTemplate rendered = createdNameToken.getNameTokensFile(); String className = rendered.getNameAndNoExt(); String contents = rendered.getContents(); ICompilationUnit nameTokenUnit = null; try { nameTokenUnit = createdNameTokensPackage.createCompilationUnit(className, contents, forceWriting, progressMonitor); } catch (JavaModelException e) { // TODO display error System.out.println("Couldn't create className: " + className); e.printStackTrace(); } return nameTokenUnit; } private void createClass(RenderedTemplate rendered, boolean force) { String className = rendered.getNameAndNoExt(); String contents = rendered.getContents(); ICompilationUnit unit = null; try { unit = presenterCreatedPackage.createCompilationUnit(className, contents, force, progressMonitor); } catch (JavaModelException e) { // TODO display error System.out.println("Couldn't create className: " + className); e.printStackTrace(); return; } try { codeFormatter.formatCodeJavaClassAndSaveIt(unit, forceWriting); } catch (JavaModelException e) { // TODO display code formatter error e.printStackTrace(); } codeFormatter.organizeImports(unit); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
d994da9dcdd55e2e2d8ad8bb73183068dce6fe60
18e164428793fe731c1487ed216ce01f648fc184
/ly-user/ly-user-service/src/main/java/com/leyou/user/mapper/TbUserMapper.java
11204a5af2f2ed56157972eadf1178284165a339
[]
no_license
cwjgit/101
fc77e99c591a869ade7a38522ab3938d79562bb3
5e5ef6aa27c02d6e1ae3bd7471a7dc0938923722
refs/heads/master
2022-12-01T21:32:15.013783
2019-09-22T12:24:11
2019-09-22T12:24:14
210,143,246
1
0
null
2022-11-16T11:56:37
2019-09-22T12:26:31
Java
UTF-8
Java
false
false
276
java
package com.leyou.user.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.leyou.user.entiry.TbUser; /** * <p> * 用户表 Mapper 接口 * </p> * * @author HM * @since 2019-08-27 */ public interface TbUserMapper extends BaseMapper<TbUser> { }
[ "1369493732@qq.com" ]
1369493732@qq.com
09d1e92d3b6c35db43224730af25dfb1f1498251
1a86f68561b4bc0f6b8be7f966661d388ef1d051
/app/src/main/java/com/example/adit/mobiletagloc/http/api.java
8cba0a936d326882fe117096de2b9198a4cbc09d
[]
no_license
beblank/loginTest
d10415f84ae03342fc41ac8f98f7e6de0f1440f3
a815fff1b6291608f8802bc60dd50ff7777f7054
refs/heads/master
2021-01-19T22:40:08.497108
2017-04-20T07:41:58
2017-04-20T07:41:58
88,835,634
0
0
null
null
null
null
UTF-8
Java
false
false
107
java
package com.example.adit.mobiletagloc.http; /** * Created by adit on 4/19/2017. */ public class api { }
[ "hadiwijaya.aditya@gmail.com" ]
hadiwijaya.aditya@gmail.com
d6c5aaee5864094e38f1b4a46d33ae8d3d6588ee
ad1c3354fb26ffca7376e8e90442640c60b8b6fd
/app/src/main/java/application/justpets/dal/myapplication/Helper/DateTimePicker.java
f9b61b0e677095b431b01411e8182bcb15e25b6d
[]
no_license
rahulmidha/JustPetsProject
dcff70aff1be80bebf017549f2f4ae834e09debd
5e2b6ac720ac29fe3e8b4c3fb6acfe3cfb898f22
refs/heads/master
2021-09-04T03:04:13.407733
2018-01-15T01:34:02
2018-01-15T01:34:02
117,481,588
1
1
null
null
null
null
UTF-8
Java
false
false
3,284
java
package application.justpets.dal.myapplication.Helper; import android.app.DatePickerDialog; import android.app.TimePickerDialog; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; import android.widget.TimePicker; import java.text.DateFormat; import java.util.Calendar; import application.justpets.dal.myapplication.R; import application.justpets.dal.myapplication.Walker_Search; public class DateTimePicker extends AppCompatActivity { DateFormat formatDateTime = DateFormat.getDateTimeInstance(); Calendar dateTime = Calendar.getInstance(); TextView Time_selected; private Button btn_date; private Button btn_time,btn_nxt; private String time; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_date_time_picker); // Time_selected = (TextView)findViewById(R.id.txt_TextDateTime); // btn_date = (Button) findViewById(R.id.btn_datePicker); // btn_time = (Button) findViewById(R.id.btn_timePicker); // btn_nxt = (Button)findViewById(R.id.Next); // btn_date.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // updateDate(); // } // }); btn_time.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { updateTime(); } }); updateTextLabel(); btn_nxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(DateTimePicker.this, Walker_Search.class); intent.putExtra("Time",time); startActivity(intent); } }); } private void updateDate(){ new DatePickerDialog(this, d, dateTime.get(Calendar.YEAR),dateTime.get(Calendar.MONTH),dateTime.get(Calendar.DAY_OF_MONTH)).show(); } private void updateTime(){ new TimePickerDialog(this, t, dateTime.get(Calendar.HOUR_OF_DAY), dateTime.get(Calendar.MINUTE), true).show(); } DatePickerDialog.OnDateSetListener d = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { dateTime.set(Calendar.YEAR, year); dateTime.set(Calendar.MONTH, monthOfYear); dateTime.set(Calendar.DAY_OF_MONTH, dayOfMonth); updateTextLabel(); } }; TimePickerDialog.OnTimeSetListener t = new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { dateTime.set(Calendar.HOUR_OF_DAY, hourOfDay); dateTime.set(Calendar.MINUTE, minute); updateTextLabel(); } }; private void updateTextLabel(){ Time_selected.setText(formatDateTime.format(dateTime.getTime())); time = formatDateTime.format(dateTime.getTime()); } }
[ "rahul.midha.mca.418@gmail.com" ]
rahul.midha.mca.418@gmail.com
35671fc7ec4c23f880cc82e223dee1c835e68ffd
f37a2c03634c08fae81708695bd38e446baeb373
/src/main/java/com/jiessie/test01/utils/service/TestService.java
33b00a3b4a7efeb3e282ee81933b5c6dd8b02e8f
[]
no_license
JiessieJ/test01
a85b11b728d627251d3ef59175e50f2abe93d205
39b876a2832413bd699e596c31fa4c19d5bcdd51
refs/heads/master
2023-03-23T12:06:47.319981
2021-03-11T06:58:48
2021-03-11T06:58:48
292,515,067
0
0
null
null
null
null
UTF-8
Java
false
false
596
java
package com.jiessie.test01.utils.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class TestService { @Autowired private ObjectMapper objectMapper; public String test(){ Object o = new Object(); try { objectMapper.writeValueAsString(o); } catch (JsonProcessingException e) { e.printStackTrace(); } return null; } }
[ "huangmingjie@ttjianbao.com" ]
huangmingjie@ttjianbao.com
3b50f6b1c36f92badd6d359ac66451348b1ce22c
9c7b97df9b8f31691394c932b759c24d57aaf2a7
/rabbit-java/java-errors-examples/src/main/java/com/frozendo/rabbit/errors/consumer/direct/SmallQuantityConsumerService.java
d1696e48deef49342fca6bde3b10ab5ba9d6dd9a
[]
no_license
frozendo/study-rabbitmq
74739588410cf770371c0684cb99108e27c64ef0
dcdbb431d93fb58faaa51da6aea3b30bb914d1b7
refs/heads/main
2023-07-08T10:59:25.868458
2021-08-26T13:51:57
2021-08-26T13:51:57
329,149,940
0
0
null
null
null
null
UTF-8
Java
false
false
1,958
java
package com.frozendo.rabbit.errors.consumer.direct; import com.frozendo.rabbit.errors.config.RabbitBaseConfig; import com.frozendo.rabbit.errors.consumer.BaseConsumer; import com.frozendo.rabbit.errors.domain.Product; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.DefaultConsumer; import com.rabbitmq.client.Envelope; import org.apache.commons.lang3.SerializationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.io.IOException; import static com.frozendo.rabbit.errors.domain.enums.DirectEnum.SMALL_QUANTITY_DELAYED_QUEUE; import static com.frozendo.rabbit.errors.domain.enums.DirectEnum.SMALL_QUANTITY_QUEUE; @Component public class SmallQuantityConsumerService extends DefaultConsumer { Logger log = LoggerFactory.getLogger(SmallQuantityConsumerService.class); private final BaseConsumer baseConsumer; public SmallQuantityConsumerService(RabbitBaseConfig baseConfig, BaseConsumer baseConsumer) { super(baseConfig.getChannel()); this.baseConsumer = baseConsumer; this.baseConsumer.init(this, SMALL_QUANTITY_QUEUE.getValue()); } @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { var product = (Product) SerializationUtils.deserialize(body); log.info("queue {}, value read = {}", SMALL_QUANTITY_QUEUE.getValue(), product); log.info("message routingKey = {}", envelope.getRoutingKey()); var value = baseConsumer.getRandomNumber(); if (value % 2 == 0) { log.info("sending ack to rabbit"); this.getChannel().basicAck(envelope.getDeliveryTag(), false); } else { baseConsumer.rejectOrRequeueMessage(getChannel(), product, properties, SMALL_QUANTITY_DELAYED_QUEUE.getValue(), envelope.getDeliveryTag()); } } }
[ "flavio.ap.rozendo@gmail.com" ]
flavio.ap.rozendo@gmail.com
84e09d206acf842aebec295ecba49fc15f624cce
8f270e9b238c6d72a2934deae7fe465c7bd227be
/AndroidMysqlConn2/src/main/java/com/android/smartbox/AController.java
f80b498e74fcc53ecb52591b8376b3985cd62991
[]
no_license
subinmun1997/conn
b4c1639ef63819a3cabef678e7e081022c2aa78b
1fe3f35db753862d14a65e599a1e80da0c3f1575
refs/heads/master
2023-07-25T20:32:21.852747
2021-09-06T01:54:09
2021-09-06T01:54:09
361,091,572
0
0
null
null
null
null
UTF-8
Java
false
false
9,617
java
package com.android.smartbox; import java.io.File; import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartRequest; import com.csslect.app.command.ACommand; import com.csslect.app.command.ADeleteMultiCommand; import com.csslect.app.command.AInsertMultiCommand; import com.csslect.app.command.AJoinCommand; import com.csslect.app.command.ALoginCommand; import com.csslect.app.command.ASelectMultiCommand; import com.csslect.app.command.AUpdateMultiCommand; import com.csslect.app.command.AUpdateMultiNoCommand; @Controller public class AController { ACommand command; @RequestMapping(value="/anLogin", method = {RequestMethod.GET, RequestMethod.POST} ) public String anLogin(HttpServletRequest req, Model model){ System.out.println("anLogin()"); try { req.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } String id = (String) req.getParameter("id"); String passwd = (String) req.getParameter("passwd"); System.out.println(id); System.out.println(passwd); model.addAttribute("id", id); model.addAttribute("passwd", passwd); command = new ALoginCommand(); command.execute(model); return "anLogin"; } @RequestMapping(value="/anJoin", method = {RequestMethod.GET, RequestMethod.POST} ) public String anJoin(HttpServletRequest req, Model model){ System.out.println("anJoin()"); try { req.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String id = (String) req.getParameter("id"); String passwd = (String) req.getParameter("passwd"); String name = (String) req.getParameter("name"); String phonenumber = (String) req.getParameter("phonenumber"); String address = (String) req.getParameter("address"); System.out.println(id); System.out.println(passwd); System.out.println(name); System.out.println(phonenumber); System.out.println(address); model.addAttribute("id", id); model.addAttribute("passwd", passwd); model.addAttribute("name", name); model.addAttribute("phonenumber", phonenumber); model.addAttribute("address", address); command = new AJoinCommand(); command.execute(model); return "anJoin"; } @RequestMapping(value="/anSelectMulti", method = {RequestMethod.GET, RequestMethod.POST} ) public String anSelectMulti(HttpServletRequest req, Model model){ System.out.println("anSelectMulti()"); command = new ASelectMultiCommand(); command.execute(model); return "anSelectMulti"; } @RequestMapping(value="/anInsertMulti", method = {RequestMethod.GET, RequestMethod.POST} ) public String anInsertMulti(HttpServletRequest req, Model model){ System.out.println("anInsertMulti()"); try { req.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } String id = (String) req.getParameter("id"); String name = (String) req.getParameter("name"); String date = (String) req.getParameter("date"); String dbImgPath = (String) req.getParameter("dbImgPath"); System.out.println(id); System.out.println(name); System.out.println(date); System.out.println(dbImgPath); model.addAttribute("id", id); model.addAttribute("name", name); model.addAttribute("date", date); model.addAttribute("dbImgPath", dbImgPath); MultipartRequest multi = (MultipartRequest)req; MultipartFile file = multi.getFile("image"); if(file != null) { String fileName = file.getOriginalFilename(); System.out.println(fileName); // 디렉토리 존재하지 않으면 생성 makeDir(req); if(file.getSize() > 0){ String realImgPath = req.getSession().getServletContext() .getRealPath("/resources/"); System.out.println( fileName + " : " + realImgPath); System.out.println( "fileSize : " + file.getSize()); try { // 이미지파일 저장 file.transferTo(new File(realImgPath, fileName)); } catch (Exception e) { e.printStackTrace(); } }else{ // 이미지파일 실패시 fileName = "FileFail.jpg"; String realImgPath = req.getSession().getServletContext() .getRealPath("/resources/" + fileName); System.out.println(fileName + " : " + realImgPath); } } command = new AInsertMultiCommand(); command.execute(model); return "anInsertMulti"; } public void makeDir(HttpServletRequest req){ File f = new File(req.getSession().getServletContext() .getRealPath("/resources")); if(!f.isDirectory()){ f.mkdir(); } } @RequestMapping(value="/anUpdateMulti", method = {RequestMethod.GET, RequestMethod.POST}) public void anUpdateMulti(HttpServletRequest req, Model model){ System.out.println("anUpdateMulti()"); try { req.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } String id = (String) req.getParameter("id"); String name = (String) req.getParameter("name"); String date = (String) req.getParameter("date"); String dbImgPath = (String) req.getParameter("dbImgPath"); String pDbImgPath = (String) req.getParameter("pDbImgPath"); System.out.println(id); System.out.println(name); System.out.println(date); System.out.println("Sub1Update:dbImgPath " + dbImgPath); System.out.println("Sub1Update:pDbImgPath " + pDbImgPath); model.addAttribute("id", id); model.addAttribute("name", name); model.addAttribute("date", date); model.addAttribute("dbImgPath", dbImgPath); // 이미지가 서로 같으면 삭제하지 않고 다르면 기존이미지 삭제 if(!dbImgPath.equals(pDbImgPath)){ String pFileName = req.getParameter("pDbImgPath").split("/")[req.getParameter("pDbImgPath").split("/").length -1]; String delDbImgPath = req.getSession().getServletContext().getRealPath("/resources/" + pFileName); File delfile = new File(delDbImgPath); System.out.println(delfile.getAbsolutePath()); if(delfile.exists()) { boolean deleteFile = false; while(deleteFile != true){ deleteFile = delfile.delete(); } }//if(delfile.exists()) }//if(!dbImgPath.equals(pDbImgPath)) MultipartRequest multi = (MultipartRequest)req; MultipartFile file = null; file = multi.getFile("image"); if(file != null) { String fileName = file.getOriginalFilename(); System.out.println(fileName); // 디렉토리 존재하지 않으면 생성 makeDir(req); if(file.getSize() > 0){ String realImgPath = req.getSession().getServletContext() .getRealPath("/resources/"); System.out.println( fileName + " : " + realImgPath); System.out.println( "fileSize : " + file.getSize()); try { // 이미지파일 저장 file.transferTo(new File(realImgPath, fileName)); } catch (Exception e) { e.printStackTrace(); } }else{ fileName = "FileFail.jpg"; String realImgPath = req.getSession().getServletContext() .getRealPath("/resources/" + fileName); System.out.println(fileName + " : " + realImgPath); } } command = new AUpdateMultiCommand(); command.execute(model); } @RequestMapping(value="/anUpdateMultiNo", method = {RequestMethod.GET, RequestMethod.POST}) public void anUpdateMultiNo(HttpServletRequest req, Model model){ System.out.println("anUpdateMultiNo()"); try { req.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } String id = (String) req.getParameter("id"); String name = (String) req.getParameter("name"); String date = (String) req.getParameter("date"); model.addAttribute("id", id); model.addAttribute("name", name); model.addAttribute("date", date); command = new AUpdateMultiNoCommand(); command.execute(model); } @RequestMapping(value="/anDeleteMulti", method = {RequestMethod.GET, RequestMethod.POST}) public void anDeleteMulti(HttpServletRequest req, Model model){ System.out.println("anDeleteMulti()"); model.addAttribute("id", req.getParameter("id")); System.out.println((String)req.getParameter("id")); System.out.println((String)req.getParameter("delDbImgPath")); String pFileName = req.getParameter("delDbImgPath").split("/")[req.getParameter("delDbImgPath").split("/").length -1]; String delDbImgPath = req.getSession().getServletContext().getRealPath("/resources/" + pFileName); // 이미지 파일지우기 File delfile = new File(delDbImgPath); System.out.println(delfile.getAbsolutePath()); if(delfile.exists()) { System.out.println("Sub1Del:pDelImagePath " + delfile.exists()); boolean deleteFile = false; while(deleteFile != true){ deleteFile = delfile.delete(); } } command = new ADeleteMultiCommand(); command.execute(model); } }
[ "qzxy812@gmail.com" ]
qzxy812@gmail.com
76419510aa6d43d6d6efc0f18a339caaa6ffc596
d82c7583f54322bb046dbb0d59757772f83bb7fd
/app/src/main/java/com/yyjlr/tickets/viewutils/chosen/CarouselLayoutManager.java
0a85c729ec0715ec25882111805ce1866d2b0685
[]
no_license
LoveElvira/CinemaManager
e1335214e671620526a47c260b4f8b235689de9a
4e9b9322e4251f0b1097bf8769b939b762d8521d
refs/heads/master
2021-01-10T23:28:28.113129
2017-08-31T03:47:16
2017-08-31T03:47:16
70,583,083
1
0
null
null
null
null
UTF-8
Java
false
false
40,938
java
package com.yyjlr.tickets.viewutils.chosen; import android.graphics.PointF; import android.os.Handler; import android.os.Looper; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.CallSuper; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.view.ViewCompat; import android.support.v7.widget.OrientationHelper; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.view.ViewGroup; import com.yyjlr.tickets.R; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * An implementation of {@link RecyclerView.LayoutManager} that layout items like carousel. * Generally there is one center item and bellow this item there are maximum {@link CarouselLayoutManager#getMaxVisibleItems()} items on each side of the center * item. By default {@link CarouselLayoutManager#getMaxVisibleItems()} is {@link CarouselLayoutManager#MAX_VISIBLE_ITEMS}.<br /> * <br /> * This LayoutManager supports only fixedSized adapter items.<br /> * <br /> * This LayoutManager supports {@link CarouselLayoutManager#HORIZONTAL} and {@link CarouselLayoutManager#VERTICAL} orientations. <br /> * <br /> * This LayoutManager supports circle layout. By default it if disabled. We don't recommend to use circle layout with adapter items count less then 3. <br /> * <br /> * Please be sure that layout_width of adapter item is a constant value and not {@link ViewGroup.LayoutParams#MATCH_PARENT} * for {@link #HORIZONTAL} orientation. * So like layout_height is not {@link ViewGroup.LayoutParams#MATCH_PARENT} for {@link CarouselLayoutManager#VERTICAL}<br /> * <br /> */ @SuppressWarnings({"ClassWithTooManyMethods", "OverlyComplexClass"}) public class CarouselLayoutManager extends RecyclerView.LayoutManager { public static final int HORIZONTAL = OrientationHelper.HORIZONTAL; public static final int VERTICAL = OrientationHelper.VERTICAL; //用于5.0以下手机显示错位判断 private int mLastVisible1 = 0, mFirstVisible1 = 0; private int mLastVisible2 = 0, mFirstVisible2 = 0; private static final int INVALID_POSITION = -1; public static final int MAX_VISIBLE_ITEMS = 2; private static final boolean CIRCLE_LAYOUT = false; private Integer mDecoratedChildWidth; private Integer mDecoratedChildHeight; private final int mOrientation; /** * 无限循环 */ private final boolean mCircleLayout; private int mPendingScrollPosition; private final LayoutHelper mLayoutHelper = new LayoutHelper(MAX_VISIBLE_ITEMS); private PostLayoutListener mViewPostLayout; private final List<OnCenterItemSelectionListener> mOnCenterItemSelectionListeners = new ArrayList<>(); private int mCenterItemPosition = INVALID_POSITION; private int mItemsCount; private CarouselSavedState mPendingCarouselSavedState; /** * @param orientation should be {@link #VERTICAL} or {@link #HORIZONTAL} */ @SuppressWarnings("unused") public CarouselLayoutManager(final int orientation) { this(orientation, CIRCLE_LAYOUT); } /** * If circleLayout is true then all items will be in cycle. Scroll will be infinite on both sides. * * @param orientation should be {@link #VERTICAL} or {@link #HORIZONTAL} * @param circleLayout true for enabling circleLayout */ @SuppressWarnings("unused") public CarouselLayoutManager(final int orientation, final boolean circleLayout) { if (HORIZONTAL != orientation && VERTICAL != orientation) { throw new IllegalArgumentException("orientation should be HORIZONTAL or VERTICAL"); } mOrientation = orientation; mCircleLayout = circleLayout; mPendingScrollPosition = INVALID_POSITION; } /** * Setup {@link CarouselLayoutManager.PostLayoutListener} for this LayoutManager. * Its methods will be called for each visible view item after general LayoutManager layout finishes. <br /> * <br /> * Generally this method should be used for scaling and translating view item for better (different) view presentation of layouting. * * @param postLayoutListener listener for item layout changes. Can be null. */ @SuppressWarnings("unused") public void setPostLayoutListener(@Nullable final PostLayoutListener postLayoutListener) { mViewPostLayout = postLayoutListener; requestLayout(); } /** * Setup maximum visible (layout) items on each side of the center item. * Basically during scrolling there can be more visible items (+1 item on each side), but in idle state this is the only reached maximum. * * @param maxVisibleItems should be great then 0, if bot an {@link IllegalAccessException} will be thrown */ @CallSuper @SuppressWarnings("unused") public void setMaxVisibleItems(final int maxVisibleItems) { if (0 >= maxVisibleItems) { throw new IllegalArgumentException("maxVisibleItems can't be less then 1"); } mLayoutHelper.mMaxVisibleItems = maxVisibleItems; requestLayout(); } /** * @return current setup for maximum visible items. * @see #setMaxVisibleItems(int) */ @SuppressWarnings("unused") public int getMaxVisibleItems() { return mLayoutHelper.mMaxVisibleItems; } @Override public RecyclerView.LayoutParams generateDefaultLayoutParams() { return new RecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); } /** * @return current layout orientation * @see #VERTICAL * @see #HORIZONTAL */ public int getOrientation() { return mOrientation; } @Override public boolean canScrollHorizontally() { return 0 != getChildCount() && HORIZONTAL == mOrientation; } @Override public boolean canScrollVertically() { return 0 != getChildCount() && VERTICAL == mOrientation; } /** * @return current layout center item */ public int getCenterItemPosition() { return mCenterItemPosition; } /** * @param onCenterItemSelectionListener listener that will trigger when ItemSelectionChanges. can't be null */ public void addOnItemSelectionListener(@NonNull final OnCenterItemSelectionListener onCenterItemSelectionListener) { mOnCenterItemSelectionListeners.add(onCenterItemSelectionListener); } /** * @param onCenterItemSelectionListener listener that was previously added by {@link #addOnItemSelectionListener(OnCenterItemSelectionListener)} */ public void removeOnItemSelectionListener(@NonNull final OnCenterItemSelectionListener onCenterItemSelectionListener) { mOnCenterItemSelectionListeners.remove(onCenterItemSelectionListener); } @SuppressWarnings("RefusedBequest") @Override public void scrollToPosition(final int position) { if (0 > position) { throw new IllegalArgumentException("position can't be less then 0. position is : " + position); } if (position >= mItemsCount) { throw new IllegalArgumentException("position can't be great then adapter items count. position is : " + position); } mPendingScrollPosition = position; requestLayout(); } @SuppressWarnings("RefusedBequest") @Override public void smoothScrollToPosition(@NonNull final RecyclerView recyclerView, @NonNull final RecyclerView.State state, final int position) { if (0 > position) { throw new IllegalArgumentException("position can't be less then 0. position is : " + position); } if (position >= state.getItemCount()) { throw new IllegalArgumentException("position can't be great then adapter items count. position is : " + position); } final CarouselSmoothScroller mySmoothScroller = new CarouselSmoothScroller(recyclerView.getContext()) { @Override public PointF computeScrollVectorForPosition(final int targetPosition) { return CarouselLayoutManager.this.computeScrollVectorForPosition(targetPosition); } }; mySmoothScroller.setTargetPosition(position); startSmoothScroll(mySmoothScroller); } protected PointF computeScrollVectorForPosition(final int targetPosition) { if (0 == getChildCount()) { return null; } final float currentScrollPosition = makeScrollPositionInRange0ToCount(getCurrentScrollPosition(), mItemsCount); final int direction = targetPosition < currentScrollPosition ? -1 : 1; if (HORIZONTAL == mOrientation) { return new PointF(direction, 0); } else { return new PointF(0, direction); } } @Override public int scrollVerticallyBy(final int dy, @NonNull final RecyclerView.Recycler recycler, @NonNull final RecyclerView.State state) { if (HORIZONTAL == mOrientation) { return 0; } return scrollBy(dy, recycler, state); } @Override public int scrollHorizontallyBy(final int dx, final RecyclerView.Recycler recycler, final RecyclerView.State state) { if (VERTICAL == mOrientation) { return 0; } return scrollBy(dx, recycler, state); } /** * This method is called from {@link #scrollHorizontallyBy(int, RecyclerView.Recycler, RecyclerView.State)} and * {@link #scrollVerticallyBy(int, RecyclerView.Recycler, RecyclerView.State)} to calculate needed scroll that is allowed. <br /> * <br /> * This method may do relayout work. * * @param diff distance that we want to scroll by * @param recycler Recycler to use for fetching potentially cached views for a position * @param state Transient state of RecyclerView * @return distance that we actually scrolled by */ @CallSuper protected int scrollBy(final int diff, @NonNull final RecyclerView.Recycler recycler, @NonNull final RecyclerView.State state) { if (0 == getChildCount() || 0 == diff) { return 0; } final int resultScroll; if (mCircleLayout) { resultScroll = diff; mLayoutHelper.mScrollOffset += resultScroll; final int maxOffset = getScrollItemSize() * mItemsCount; while (0 > mLayoutHelper.mScrollOffset) { mLayoutHelper.mScrollOffset += maxOffset; } while (mLayoutHelper.mScrollOffset > maxOffset) { mLayoutHelper.mScrollOffset -= maxOffset; } mLayoutHelper.mScrollOffset -= resultScroll; } else { final int maxOffset = getMaxScrollOffset(); if (0 > mLayoutHelper.mScrollOffset + diff) { resultScroll = -mLayoutHelper.mScrollOffset; //to make it 0 } else if (mLayoutHelper.mScrollOffset + diff > maxOffset) { resultScroll = maxOffset - mLayoutHelper.mScrollOffset; //to make it maxOffset } else { resultScroll = diff; } } if (0 != resultScroll) { mLayoutHelper.mScrollOffset += resultScroll; fillData(recycler, state, false); } return resultScroll; } @Override public void onMeasure(final RecyclerView.Recycler recycler, final RecyclerView.State state, final int widthSpec, final int heightSpec) { mDecoratedChildHeight = null; mDecoratedChildWidth = null; super.onMeasure(recycler, state, widthSpec, heightSpec); } @SuppressWarnings("RefusedBequest") @Override @CallSuper public void onLayoutChildren(@NonNull final RecyclerView.Recycler recycler, @NonNull final RecyclerView.State state) { if (0 == state.getItemCount()) { removeAndRecycleAllViews(recycler); selectItemCenterPosition(INVALID_POSITION); return; } boolean childMeasuringNeeded = false; if (null == mDecoratedChildWidth) { final View view = recycler.getViewForPosition(0); addView(view); measureChildWithMargins(view, 0, 0); mDecoratedChildWidth = getDecoratedMeasuredWidth(view); mDecoratedChildHeight = getDecoratedMeasuredHeight(view); removeAndRecycleView(view, recycler); if (INVALID_POSITION == mPendingScrollPosition && null == mPendingCarouselSavedState) { mPendingScrollPosition = mCenterItemPosition; } childMeasuringNeeded = true; } if (INVALID_POSITION != mPendingScrollPosition) { mLayoutHelper.mScrollOffset = calculateScrollForSelectingPosition(mPendingScrollPosition, state); mPendingScrollPosition = INVALID_POSITION; mPendingCarouselSavedState = null; } else if (null != mPendingCarouselSavedState) { mLayoutHelper.mScrollOffset = calculateScrollForSelectingPosition(mPendingCarouselSavedState.mCenterItemPosition, state); mPendingCarouselSavedState = null; } else if (state.didStructureChange() && INVALID_POSITION != mCenterItemPosition) { mLayoutHelper.mScrollOffset = calculateScrollForSelectingPosition(mCenterItemPosition, state); } fillData(recycler, state, childMeasuringNeeded); } private int calculateScrollForSelectingPosition(final int itemPosition, final RecyclerView.State state) { final int fixedItemPosition = itemPosition < state.getItemCount() ? itemPosition : state.getItemCount() - 1; return VERTICAL == mOrientation ? fixedItemPosition * mDecoratedChildHeight : fixedItemPosition * mDecoratedChildWidth; } private void fillData(@NonNull final RecyclerView.Recycler recycler, @NonNull final RecyclerView.State state, final boolean childMeasuringNeeded) { final float currentScrollPosition = getCurrentScrollPosition(); generateLayoutOrder(currentScrollPosition, state); removeAndRecycleUnusedViews(mLayoutHelper, recycler); final int width = getWidthNoPadding(); final int height = getHeightNoPadding(); if (VERTICAL == mOrientation) { fillDataVertical(recycler, width, height, childMeasuringNeeded); } else { fillDataHorizontal(recycler, width, height, childMeasuringNeeded); } recycler.clear(); detectOnItemSelectionChanged(currentScrollPosition, state); } private void detectOnItemSelectionChanged(final float currentScrollPosition, final RecyclerView.State state) { final float absCurrentScrollPosition = makeScrollPositionInRange0ToCount(currentScrollPosition, state.getItemCount()); final int centerItem = Math.round(absCurrentScrollPosition); if (mCenterItemPosition != centerItem) { mCenterItemPosition = centerItem; new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { selectItemCenterPosition(centerItem); } }); } } private void selectItemCenterPosition(final int centerItem) { for (final OnCenterItemSelectionListener onCenterItemSelectionListener : mOnCenterItemSelectionListeners) { onCenterItemSelectionListener.onCenterItemChanged(centerItem); } } private void fillDataVertical(final RecyclerView.Recycler recycler, final int width, final int height, final boolean childMeasuringNeeded) { final int start = (width - mDecoratedChildWidth) / 2; final int end = start + mDecoratedChildWidth; final int centerViewTop = (height - mDecoratedChildHeight) / 2; for (int i = 0, count = mLayoutHelper.mLayoutOrder.length; i < count; ++i) { final LayoutOrder layoutOrder = mLayoutHelper.mLayoutOrder[i]; final int offset = getCardOffsetByPositionDiff(layoutOrder.mItemPositionDiff); final int top = centerViewTop + offset; final int bottom = top + mDecoratedChildHeight; fillChildItem(start, top, end, bottom, layoutOrder, recycler, i, childMeasuringNeeded); } } private void fillDataHorizontal(final RecyclerView.Recycler recycler, final int width, final int height, final boolean childMeasuringNeeded) { final int top = (height - mDecoratedChildHeight); final int bottom = top + mDecoratedChildHeight; final int centerViewStart = (width - mDecoratedChildWidth) / 2; for (int i = 0, count = mLayoutHelper.mLayoutOrder.length; i < count; ++i) { final LayoutOrder layoutOrder = mLayoutHelper.mLayoutOrder[i]; final int offset = getCardOffsetByPositionDiff(layoutOrder.mItemPositionDiff); final int start = centerViewStart + offset; final int end = start + mDecoratedChildWidth; fillChildItem(start, top/4, end, bottom + bottom/6, layoutOrder, recycler, i, childMeasuringNeeded); } } private void removeAndRecycleUnusedViews(final LayoutHelper layoutHelper, final RecyclerView.Recycler recycler) { final List<View> viewsToRemove = new ArrayList<>(); for (int i = 0, size = getChildCount(); i < size; ++i) { final View child = getChildAt(i); final ViewGroup.LayoutParams lp = child.getLayoutParams(); if (!(lp instanceof RecyclerView.LayoutParams)) { viewsToRemove.add(child); continue; } final RecyclerView.LayoutParams recyclerViewLp = (RecyclerView.LayoutParams) lp; final int adapterPosition = recyclerViewLp.getViewAdapterPosition(); if (recyclerViewLp.isItemRemoved() || !layoutHelper.hasAdapterPosition(adapterPosition)) { viewsToRemove.add(child); } } for (final View view : viewsToRemove) { removeAndRecycleView(view, recycler); } } @SuppressWarnings("MethodWithTooManyParameters") private void fillChildItem(final int start, final int top, final int end, final int bottom, @NonNull final LayoutOrder layoutOrder, @NonNull final RecyclerView.Recycler recycler, final int i, final boolean childMeasuringNeeded) { final View view = bindChild(layoutOrder.mItemAdapterPosition, recycler, childMeasuringNeeded); View white = view.findViewById(R.id.item_chosen__white); ViewCompat.setElevation(view, i); ItemTransformation transformation = null; if (null != mViewPostLayout) { transformation = mViewPostLayout.transformChild(view, layoutOrder.mItemPositionDiff, mOrientation); } if (null == transformation) { view.layout(start, top, end, bottom); } else { view.layout(Math.round(start + transformation.mTranslationX), Math.round(top + transformation.mTranslationY), Math.round(end + transformation.mTranslationX), Math.round(bottom + transformation.mTranslationY)); if (transformation.mScaleX==1.0){ white.setAlpha(0); }else if(transformation.mScaleX<0.7){ white.setAlpha(1); }else { white.setAlpha(1-transformation.mScaleX); } view.setAlpha(transformation.mScaleX); ViewCompat.setScaleX(view, transformation.mScaleX); ViewCompat.setScaleY(view, transformation.mScaleY); } } /** * @return current scroll position of center item. this value can be in any range if it is cycle layout. * if this is not, that then it is in [0, {@link #mItemsCount - 1}] */ private float getCurrentScrollPosition() { final int fullScrollSize = getMaxScrollOffset(); if (0 == fullScrollSize) { return 0; } return 1.0f * mLayoutHelper.mScrollOffset / getScrollItemSize(); } /** * @return maximum scroll value to fill up all items in layout. Generally this is only needed for non cycle layouts. */ private int getMaxScrollOffset() { return getScrollItemSize() * (mItemsCount - 1); } /** * Because we can support old Android versions, we should layout our children in specific order to make our center view in the top of layout * (this item should layout last). So this method will calculate layout order and fill up {@link #mLayoutHelper} object. * This object will be filled by only needed to layout items. Non visible items will not be there. * * @param currentScrollPosition current scroll position this is a value that indicates position of center item * (if this value is int, then center item is really in the center of the layout, else it is near state). * Be aware that this value can be in any range is it is cycle layout * @param state Transient state of RecyclerView * @see #getCurrentScrollPosition() */ private int j; private void generateLayoutOrder(final float currentScrollPosition, @NonNull final RecyclerView.State state) { mItemsCount = state.getItemCount(); final float absCurrentScrollPosition = makeScrollPositionInRange0ToCount(currentScrollPosition, mItemsCount); final int centerItem = Math.round(absCurrentScrollPosition); if (mCircleLayout && 1 < mItemsCount) { final int layoutCount = Math.min(mLayoutHelper.mMaxVisibleItems * 2 + 3, mItemsCount);// + 3 = 1 (center item) + 2 (addition bellow maxVisibleItems) mLayoutHelper.initLayoutOrder(layoutCount); final int countLayoutHalf = layoutCount / 2; // before center item for (int i = 1; i <= countLayoutHalf; ++i) { final int position = Math.round(absCurrentScrollPosition - i + mItemsCount) % mItemsCount; mLayoutHelper.setLayoutOrder(countLayoutHalf - i, position, centerItem - absCurrentScrollPosition - i); } // after center item for (int i = layoutCount - 1; i >= countLayoutHalf + 1; --i) { final int position = Math.round(absCurrentScrollPosition - i + layoutCount) % mItemsCount; mLayoutHelper.setLayoutOrder(i - 1, position, centerItem - absCurrentScrollPosition + layoutCount - i); } mLayoutHelper.setLayoutOrder(layoutCount - 1, centerItem, centerItem - absCurrentScrollPosition); } else { final int firstVisible = Math.max(centerItem - mLayoutHelper.mMaxVisibleItems - 1, 0); final int lastVisible = Math.min(centerItem + mLayoutHelper.mMaxVisibleItems + 1, mItemsCount - 1); final int layoutCount = lastVisible - firstVisible + 1; mLayoutHelper.initLayoutOrder(layoutCount); for (int i = firstVisible; i <= lastVisible; ++i) { j = i; if (i == centerItem) { mLayoutHelper.setLayoutOrder(layoutCount - 1, i, i - absCurrentScrollPosition); } else if (i < centerItem) { mLayoutHelper.setLayoutOrder(i - firstVisible, i, i - absCurrentScrollPosition); } else { mLayoutHelper.setLayoutOrder(layoutCount - (i - centerItem) - 1, i, i - absCurrentScrollPosition); } } } } public int getWidthNoPadding() { return getWidth() - getPaddingStart() - getPaddingEnd(); } public int getHeightNoPadding() { return getHeight() - getPaddingEnd() - getPaddingStart(); } private View bindChild(final int position, @NonNull final RecyclerView.Recycler recycler, final boolean childMeasuringNeeded) { final View view = findViewForPosition(recycler, position); final float absCurrentScrollPosition = makeScrollPositionInRange0ToCount(getCurrentScrollPosition(), mItemsCount); final int centerItem = Math.round(absCurrentScrollPosition); final int firstVisible = Math.max(centerItem - mLayoutHelper.mMaxVisibleItems - 1, 0); final int lastVisible = Math.min(centerItem + mLayoutHelper.mMaxVisibleItems + 1, mItemsCount - 1); if (null == view.getParent()) { addView(view); measureChildWithMargins(view, 0, 0); //5.0以下的手机会产生错位再次判断 if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { if (firstVisible > mLastVisible1 || firstVisible < mFirstVisible1) { view.setVisibility(View.GONE); } else if ((firstVisible != mFirstVisible1 && lastVisible != mLastVisible1) && mCircleLayout || (firstVisible != mFirstVisible1 || lastVisible != mLastVisible1)) { view.setVisibility(View.GONE); } else { view.setVisibility(View.VISIBLE); } mLastVisible1 = lastVisible; mFirstVisible1 = firstVisible; } } else { if (childMeasuringNeeded) { measureChildWithMargins(view, 0, 0); //5.0以下的手机会产生错位再次判断 if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { if (firstVisible > mLastVisible2 || firstVisible < mFirstVisible2) { view.setVisibility(View.GONE); } else if (firstVisible != mFirstVisible2 || lastVisible != mLastVisible2 && mCircleLayout) { view.setVisibility(View.GONE); } else { view.setVisibility(View.VISIBLE); } mLastVisible2 = lastVisible; mFirstVisible2 = firstVisible; } } } return view; } private View findViewForPosition(final RecyclerView.Recycler recycler, final int position) { for (int i = 0, size = getChildCount(); i < size; ++i) { final View child = getChildAt(i); final ViewGroup.LayoutParams lp = child.getLayoutParams(); if (!(lp instanceof RecyclerView.LayoutParams)) { continue; } final RecyclerView.LayoutParams recyclerLp = (RecyclerView.LayoutParams) lp; final int adapterPosition = recyclerLp.getViewAdapterPosition(); if (adapterPosition == position) { if (recyclerLp.isItemChanged()) { recycler.bindViewToPosition(child, position); measureChildWithMargins(child, 0, 0); } return child; } } final View view = recycler.getViewForPosition(position); recycler.bindViewToPosition(view, position); return view; } /** * Called during {@link #fillData(RecyclerView.Recycler, RecyclerView.State, boolean)} to calculate item offset from layout center line. <br /> * <br /> * Returns {@link #convertItemPositionDiffToSmoothPositionDiff(float)} * (size off area above center item when it is on the center). <br /> * Sign is: plus if this item is bellow center line, minus if not<br /> * <br /> * ----- - area above it<br /> * ||||| - center item<br /> * ----- - area bellow it (it has the same size as are above center item)<br /> * * @param itemPositionDiff current item difference with layout center line. if this is 0, then this item center is in layout center line. * if this is 1 then this item is bellow the layout center line in the full item size distance. * @return offset in scroll px coordinates. */ protected int getCardOffsetByPositionDiff(final float itemPositionDiff) { final double smoothPosition = convertItemPositionDiffToSmoothPositionDiff(itemPositionDiff); final int dimenDiff; if (VERTICAL == mOrientation) { dimenDiff = (getHeightNoPadding() - mDecoratedChildHeight) / 2; } else { dimenDiff = (getWidthNoPadding() - mDecoratedChildWidth) / 2; } //noinspection NumericCastThatLosesPrecision return (int) Math.round(Math.signum(itemPositionDiff) * dimenDiff * smoothPosition); } /** * Called during {@link #getCardOffsetByPositionDiff(float)} for better item movement. <br/> * Current implementation speed up items that are far from layout center line and slow down items that are close to this line. * This code is full of maths. If you want to make items move in a different way, probably you should override this method.<br /> * Please see code comments for better explanations. * * @param itemPositionDiff current item difference with layout center line. if this is 0, then this item center is in layout center line. * if this is 1 then this item is bellow the layout center line in the full item size distance. * @return smooth position offset. needed for scroll calculation and better user experience. * @see #getCardOffsetByPositionDiff(float) */ @SuppressWarnings({"MagicNumber", "InstanceMethodNamingConvention"}) protected double convertItemPositionDiffToSmoothPositionDiff(final float itemPositionDiff) { // generally item moves the same way above center and bellow it. So we don't care about diff sign. final float absIemPositionDiff = Math.abs(itemPositionDiff); // we detect if this item is close for center or not. We use (1 / maxVisibleItem) ^ (1/3) as close definer. if (absIemPositionDiff > StrictMath.pow(1.0f / mLayoutHelper.mMaxVisibleItems, 1.0f / 3)) { // this item is far from center line, so we should make it move like square root function return StrictMath.pow(absIemPositionDiff / mLayoutHelper.mMaxVisibleItems, 1 / 2.0f); } else { // this item is close from center line. we should slow it down and don't make it speed up very quick. // so square function in range of [0, (1/maxVisible)^(1/3)] is quite good in it; return StrictMath.pow(absIemPositionDiff, 2.0f); } } /** * @return full item size */ protected int getScrollItemSize() { if (VERTICAL == mOrientation) { return mDecoratedChildHeight; } else { return mDecoratedChildWidth; } } @Override public Parcelable onSaveInstanceState() { if (null != mPendingCarouselSavedState) { return new CarouselSavedState(mPendingCarouselSavedState); } final CarouselSavedState savedState = new CarouselSavedState(super.onSaveInstanceState()); savedState.mCenterItemPosition = mCenterItemPosition; return savedState; } @Override public void onRestoreInstanceState(final Parcelable state) { if (state instanceof CarouselSavedState) { mPendingCarouselSavedState = (CarouselSavedState) state; super.onRestoreInstanceState(mPendingCarouselSavedState.mSuperState); } else { super.onRestoreInstanceState(state); } } /** * @return Scroll offset from nearest item from center */ int getOffsetCenterView() { return Math.round(getCurrentScrollPosition()) * getScrollItemSize() - mLayoutHelper.mScrollOffset; } int getOffsetForCurrentView(@NonNull final View view) { final int position = getPosition(view); final int fullCircles = mLayoutHelper.mScrollOffset / (mItemsCount * getScrollItemSize()); int fullOffset = fullCircles * mItemsCount * getScrollItemSize(); if (0 > mLayoutHelper.mScrollOffset) { fullOffset -= 1; } if (0 == fullOffset || 0 < Math.signum(fullOffset)) { return mLayoutHelper.mScrollOffset - position * getScrollItemSize() - fullOffset; } else { return mLayoutHelper.mScrollOffset + position * getScrollItemSize() - fullOffset; } } /** * Helper method that make scroll in range of [0, count). Generally this method is needed only for cycle layout. * * @param currentScrollPosition any scroll position range. * @param count adapter items count * @return good scroll position in range of [0, count) */ private static float makeScrollPositionInRange0ToCount(final float currentScrollPosition, final int count) { float absCurrentScrollPosition = currentScrollPosition; while (0 > absCurrentScrollPosition) { absCurrentScrollPosition += count; } while (Math.round(absCurrentScrollPosition) >= count) { absCurrentScrollPosition -= count; } return absCurrentScrollPosition; } /** * This interface methods will be called for each visible view item after general LayoutManager layout finishes. <br /> * <br /> * Generally this method should be used for scaling and translating view item for better (different) view presentation of layouting. */ @SuppressWarnings("InterfaceNeverImplemented") public interface PostLayoutListener { /** * Called after child layout finished. Generally you can do any translation and scaling work here. * * @param child view that was layout * @param itemPositionToCenterDiff view center line difference to layout center. if > 0 then this item is bellow layout center line, else if not * @param orientation layoutManager orientation {@link #getLayoutDirection()} */ ItemTransformation transformChild(@NonNull final View child, final float itemPositionToCenterDiff, final int orientation); } public interface OnCenterItemSelectionListener { /** * Listener that will be called on every change of center item. * This listener will be triggered on <b>every</b> layout operation if item was changed. * Do not do any expensive operations in this method since this will effect scroll experience. * * @param adapterPosition current layout center item */ void onCenterItemChanged(final int adapterPosition); } /** * Helper class that holds currently visible items. * Generally this class fills this list. <br /> * <br /> * This class holds all scroll and maxVisible items state. * * @see #getMaxVisibleItems() */ private static class LayoutHelper { private int mMaxVisibleItems; private int mScrollOffset; private LayoutOrder[] mLayoutOrder; private final List<WeakReference<LayoutOrder>> mReusedItems = new ArrayList<>(); LayoutHelper(final int maxVisibleItems) { mMaxVisibleItems = maxVisibleItems; } /** * Called before any fill calls. Needed to recycle old items and init new array list. Generally this list is an array an it is reused. * * @param layoutCount items count that will be layout */ public void initLayoutOrder(final int layoutCount) { if (null == mLayoutOrder || mLayoutOrder.length != layoutCount) { if (null != mLayoutOrder) { recycleItems(mLayoutOrder); } mLayoutOrder = new LayoutOrder[layoutCount]; fillLayoutOrder(); } } /** * Called during layout generation process of filling this list. Should be called only after {@link #initLayoutOrder(int)} method call. * * @param arrayPosition position in layout order * @param itemAdapterPosition adapter position of item for future data filling logic * @param itemPositionDiff difference of current item scroll position and center item position. * if this is a center item and it is in real center of layout, then this will be 0. * if current layout is not in the center, then this value will never be int. * if this item center is bellow layout center line then this value is greater then 0, * else less then 0. */ public void setLayoutOrder(final int arrayPosition, final int itemAdapterPosition, final float itemPositionDiff) { final LayoutOrder item = mLayoutOrder[arrayPosition]; item.mItemAdapterPosition = itemAdapterPosition; item.mItemPositionDiff = itemPositionDiff; } /** * Checks is this screen Layout has this adapterPosition view in layout * * @param adapterPosition adapter position of item for future data filling logic * @return true is adapterItem is in layout */ public boolean hasAdapterPosition(final int adapterPosition) { if (null != mLayoutOrder) { for (final LayoutOrder layoutOrder : mLayoutOrder) { if (layoutOrder.mItemAdapterPosition == adapterPosition) { return true; } } } return false; } @SuppressWarnings("VariableArgumentMethod") private void recycleItems(@NonNull final LayoutOrder... layoutOrders) { for (final LayoutOrder layoutOrder : layoutOrders) { //noinspection ObjectAllocationInLoop mReusedItems.add(new WeakReference<>(layoutOrder)); } } private void fillLayoutOrder() { for (int i = 0; i < mLayoutOrder.length; ++i) { if (null == mLayoutOrder[i]) { mLayoutOrder[i] = createLayoutOrder(); } } } private LayoutOrder createLayoutOrder() { final Iterator<WeakReference<LayoutOrder>> iterator = mReusedItems.iterator(); while (iterator.hasNext()) { final WeakReference<LayoutOrder> layoutOrderWeakReference = iterator.next(); final LayoutOrder layoutOrder = layoutOrderWeakReference.get(); iterator.remove(); if (null != layoutOrder) { return layoutOrder; } } return new LayoutOrder(); } } /** * Class that holds item data. * This class is filled during {@link #generateLayoutOrder(float, RecyclerView.State)} and used during {@link #fillData(RecyclerView.Recycler, RecyclerView.State, boolean)} */ private static class LayoutOrder { /** * Item adapter position */ private int mItemAdapterPosition; /** * Item center difference to layout center. If center of item is bellow layout center, then this value is greater then 0, else it is less. */ private float mItemPositionDiff; } public static class CarouselSavedState implements Parcelable { private final Parcelable mSuperState; private int mCenterItemPosition; public CarouselSavedState(@Nullable final Parcelable superState) { mSuperState = superState; } private CarouselSavedState(@NonNull final Parcel in) { mSuperState = in.readParcelable(Parcelable.class.getClassLoader()); mCenterItemPosition = in.readInt(); } public CarouselSavedState(@NonNull final CarouselSavedState other) { mSuperState = other.mSuperState; mCenterItemPosition = other.mCenterItemPosition; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(final Parcel dest, final int flags) { dest.writeParcelable(mSuperState, flags); dest.writeInt(mCenterItemPosition); } public static final Creator<CarouselSavedState> CREATOR = new Creator<CarouselSavedState>() { @Override public CarouselSavedState createFromParcel(final Parcel source) { return new CarouselSavedState(source); } @Override public CarouselSavedState[] newArray(final int size) { return new CarouselSavedState[size]; } }; } }
[ "xiaomei7878@126.com" ]
xiaomei7878@126.com
9e69df346a904d9d9b50255826b30968ce429705
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/MOCKITO-1b-3-6-SPEA2-WeightedSum:TestLen:CallDiversity/org/mockito/internal/handler/NullResultGuardian_ESTest.java
e06b8e2948a1100f42183ba78bf0dfad023025c3
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
/* * This file was automatically generated by EvoSuite * Mon Apr 06 17:16:53 UTC 2020 */ package org.mockito.internal.handler; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class NullResultGuardian_ESTest extends NullResultGuardian_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
a9418db0307cab624a264ba768311891651e8c84
dc54461554ccb453c3b5237f612ecfc4586bc5db
/app/src/main/java/com/kagwisoftwares/nhms/Facility/DashboardListAdapter.java
80ed72762648ce8946ee292ebe3ffb637b078224
[]
no_license
kagwicharles/NHMs
7c6cfcad72d9da5ab7542252c2c837a3d33891a7
723b3bf6af18157d725d25e5879f90cde1695ffc
refs/heads/master
2023-04-24T12:10:51.133596
2021-04-22T07:06:26
2021-04-22T07:06:26
344,372,821
0
0
null
null
null
null
UTF-8
Java
false
false
1,959
java
package com.kagwisoftwares.nhms.Facility; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.kagwisoftwares.nhms.R; import java.util.ArrayList; public class DashboardListAdapter extends RecyclerView.Adapter<DashboardListAdapter.ViewHolder> { private ArrayList<DashMenu> data; public DashboardListAdapter(ArrayList<DashMenu> data) { this.data = data; } public static class ViewHolder extends RecyclerView.ViewHolder{ private TextView item1; private TextView item2; private ImageView item3; public ViewHolder(View view) { super(view); item1 = (TextView) view.findViewById(R.id.item1); item2 = (TextView) view.findViewById(R.id.item2); item3 = (ImageView) view.findViewById(R.id.dashIcon); } public TextView getItem1() { return item1; } public TextView getItem2() {return item2;} public ImageView getItem3() {return item3;} } @NonNull @Override public DashboardListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.dash_item, parent, false); return new DashboardListAdapter.ViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { DashMenu item = data.get(position); holder.getItem1().setText(item.getItem1()); Log.d("ITEM 1", item.getItem1()); holder.getItem2().setText(item.getItem2()); holder.getItem3().setImageResource(item.getItem3()); } @Override public int getItemCount() { return data.size(); } }
[ "ckagwi8@gmail.com" ]
ckagwi8@gmail.com
81cbf5025f3e9c754c8b41316590573f09634d81
97b46ff38b675d934948ff3731cf1607a1cc0fc9
/Server/java/pk/elfo/gameserver/scripting/scriptengine/listeners/player/PlayerSpawnListener.java
8e39f98f5086fbf284b7541d2b078deb2da1e27b
[]
no_license
l2brutal/pk-elfo_H5
a6703d734111e687ad2f1b2ebae769e071a911a4
766fa2a92cb3dcde5da6e68a7f3d41603b9c037e
refs/heads/master
2020-12-28T13:33:46.142303
2016-01-20T09:53:10
2016-01-20T09:53:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,536
java
/* * Copyright (C) 2004-2013 L2J Server * * This file is part of L2J Server. * * L2J Server 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. * * L2J Server 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package pk.elfo.gameserver.scripting.scriptengine.listeners.player; import pk.elfo.gameserver.model.actor.instance.L2PcInstance; import pk.elfo.gameserver.network.clientpackets.EnterWorld; import pk.elfo.gameserver.scripting.scriptengine.impl.L2JListener; /** * Gets triggered when a L2PcInstance is spawned in the world * @author TheOne */ public abstract class PlayerSpawnListener extends L2JListener { public PlayerSpawnListener() { register(); } /** * Triggered when a player is spawned * @param player */ public abstract void onSpawn(L2PcInstance player); @Override public void register() { EnterWorld.addSpawnListener(this); } @Override public void unregister() { EnterWorld.removeSpawnListener(this); } }
[ "PkElfo@13720c4f-9a1f-4619-977f-b36a0ac534ba" ]
PkElfo@13720c4f-9a1f-4619-977f-b36a0ac534ba
573be823f83cbb03889f9ba1949d60ffa0c491b5
c68c5720e52c4c8315496218a689e066b527d594
/testJava/src/testJava/vol2/ch12/s61/ThreadB.java
52425091306d349b7e038cf345788046e95a716d
[]
no_license
s-jinipark/first
0941ca45a6483b9dbdb24ebb04271283b87294fc
2aec08afe3e233ee394e09e3fb2dc74e2e6d482d
refs/heads/master
2021-06-17T01:13:18.326012
2019-05-21T03:24:15
2019-05-21T03:24:15
111,877,617
0
0
null
null
null
null
UHC
Java
false
false
448
java
package testJava.vol2.ch12.s61; public class ThreadB extends Thread { public boolean stop = false; // 종료 플래그 public boolean work = true; // 작업 진행 여부 플래그 public void run() { while (!stop) { if (work) { System.out.println("ThreadB 작업 내용"); } else { Thread.yield(); // work 가 false 가 되면 다른 스레드에게 실행 양보 } } System.out.println("ThreadB 종료"); } }
[ "jinipark@naver.com" ]
jinipark@naver.com
8ead585a32c2a281d6620886a9f9d9d934a90f42
f251908eb932c00a3a99f8909d2873f3f88db575
/src/main/java/org/chuckame/dofus2/protocol/messages/game/context/mount/MountEquipedErrorMessage.java
bbafaf47f98794ad24b3ce6c6f6ba443ea74c790
[]
no_license
Chuckame/dofus-protocol
613c6e27f67ef24b4ec0eb3acf74e3adae859e7c
5d96fb83929e0fd4f58492d8445cbb7b7181af8f
refs/heads/master
2021-07-05T16:21:00.824668
2017-07-27T13:12:22
2017-07-27T13:37:12
96,158,319
2
0
null
null
null
null
UTF-8
Java
false
false
1,020
java
package org.chuckame.dofus2.protocol.messages.game.context.mount; import org.chuckame.dofus2.common.io.IDataReader; import org.chuckame.dofus2.common.io.IDataWriter; import org.chuckame.dofus2.common.io.INetworkMessage; import lombok.Data; import lombok.ToString; import lombok.EqualsAndHashCode; @Data @ToString @EqualsAndHashCode public class MountEquipedErrorMessage implements INetworkMessage { public static final int MESSAGE_ID = 5963; private byte errorType; public MountEquipedErrorMessage() { } public MountEquipedErrorMessage(byte errorType) { this.errorType = errorType; } public int getProtocolId() { return MESSAGE_ID; } public void deserialize(IDataReader reader) { this.errorType = reader.readSByte(); if (errorType < 0) throw new IllegalArgumentException(String.format("Forbidden value on errorType = %s, it doesn't respect the following condition : errorType < 0", errorType)); } public void serialize(IDataWriter writer) { writer.writeSByte(this.errorType); } }
[ "chuckame@users.noreply.github.com" ]
chuckame@users.noreply.github.com
eeddaa3c1932d4cfe94a4c67a7e0c1d1da898848
e85a519fbc05ced36aa732cb197b6ee3cf27352d
/mdo-core/jopendocument/src/main/java/org/jopendocument/model/text/TextChapter.java
9fbfef1889457dc37919b16b6baee2222fa27891
[]
no_license
mathieu-ma/montagnesdor
1791fae256c7525e0f2a23a2cd7f03ca65ca13bb
e149fc14253b60d30a9e98f6c7b467b807ec5d65
refs/heads/master
2021-01-23T11:48:43.639476
2014-08-20T20:41:27
2014-08-20T20:41:27
3,204,171
3
0
null
null
null
null
UTF-8
Java
false
false
2,419
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2008 jOpenDocument, by ILM Informatique. All rights reserved. * * The contents of this file are subject to the terms of the GNU * General Public License Version 3 only ("GPL"). * You may not use this file except in compliance with the License. * You can obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.html * See the License for the specific language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each file. * */ package org.jopendocument.model.text; /** * */ public class TextChapter { protected String textDisplay; protected String textOutlineLevel; protected String value; /** * Gets the value of the textDisplay property. * * @return possible object is {@link String } * */ public String getTextDisplay() { if (this.textDisplay == null) { return "number-and-name"; } else { return this.textDisplay; } } /** * Gets the value of the textOutlineLevel property. * * @return possible object is {@link String } * */ public String getTextOutlineLevel() { if (this.textOutlineLevel == null) { return "1"; } else { return this.textOutlineLevel; } } /** * Gets the value of the value property. * * @return possible object is {@link String } * */ public String getvalue() { return this.value; } /** * Sets the value of the textDisplay property. * * @param value allowed object is {@link String } * */ public void setTextDisplay(final String value) { this.textDisplay = value; } /** * Sets the value of the textOutlineLevel property. * * @param value allowed object is {@link String } * */ public void setTextOutlineLevel(final String value) { this.textOutlineLevel = value; } /** * Sets the value of the value property. * * @param value allowed object is {@link String } * */ public void setvalue(final String value) { this.value = value; } }
[ "mathieu.ma.dev@free.fr" ]
mathieu.ma.dev@free.fr
a84ee36110fa1828d481854590c2699921c6ae01
180e78725121de49801e34de358c32cf7148b0a2
/dataset/protocol1/neo4j/learning/5707/DatabaseManagementSystemSettings.java
0a4171664630b2dcc0ec4b8cfe6a1cb157fad68a
[]
no_license
ASSERT-KTH/synthetic-checkstyle-error-dataset
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
40c057e1669584bfc6fecf789b5b2854660222f3
refs/heads/master
2023-03-18T12:50:55.410343
2019-01-25T09:54:39
2019-01-25T09:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
/* * Copyright (c) 2002-2018 "Neo4j," * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j 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. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.dbms; import java.io.File; import org.neo4j.configuration.Internal; import org.neo4j.configuration.LoadableConfig; import org.neo4j.graphdb.config.Setting; import org.neo4j.graphdb.factory.GraphDatabaseSettings; import static org.neo4j.kernel.configuration .Settings.PATH; import static org.neo4j.kernel.configuration.Settings.derivedSetting; public class DatabaseManagementSystemSettings implements LoadableConfig { @Internal public static final Setting<File> auth_store_directory = derivedSetting( "unsupported.dbms.directories.auth", GraphDatabaseSettings.data_directory, data -> new File( data, "dbms" ), PATH ); }
[ "bloriot97@gmail.com" ]
bloriot97@gmail.com
ed196912cecbd21650b7991bde2b8eabf71bc49f
30544ca1cb2a73755a4694b72b1d43f0f09f7f72
/src/main/java/com/mdSolutions/myPhoto/IndividualMedia.java
fb17ec04be0cb0a45f1958c0347145d814bc2ccb
[ "MIT" ]
permissive
mollidrivdahl/myPhoto
ad38348ac76da7cf216b67bba93c74d628723960
932c8d67cfc7e05bc873df68349d3c9f890cc009
refs/heads/master
2021-09-12T16:48:28.065366
2018-04-19T00:08:58
2018-04-19T00:08:58
117,637,026
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package com.mdSolutions.myPhoto; import lombok.Getter; import lombok.Setter; public abstract class IndividualMedia extends MediaItem { protected @Getter @Setter boolean isCoverPhoto; protected IndividualMedia() { super(); isCoverPhoto = false; } protected IndividualMedia(String name, Integer id, String relPath, MediaItem nextItem, MediaItem previusItem, Integer parentId, String parentCollectionPath, int levelNum) { super(name, id, relPath, nextItem, previusItem, parentId, parentCollectionPath, levelNum); isCoverPhoto = false; } }
[ "molli.drivdahl@oit.edu" ]
molli.drivdahl@oit.edu
2f07830737ccb0cfc98e98292a12745f0853d8f6
31c459c281e2b7bd495062cf54a2dbc74b3003b6
/src/com/lm/model/Block.java
be8cf5d28e4cb7e07e5868794973d716da3d75aa
[]
no_license
mocayo/bpel
1e0e7531752f8f90e4fc0b4b3236c99904b168f0
e14bed75794ff753d1fd0909a1c43ff393631aa2
refs/heads/master
2021-01-17T06:45:58.645902
2016-09-19T11:35:32
2016-09-19T11:35:32
68,571,903
0
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package com.lm.model; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Block { public String name; private ICFGNode node; public Set<Define> in = new HashSet<Define>(); public Set<Define> out = new HashSet<Define>(); public Set<Define> gen = new HashSet<Define>(); public Set<Define> kill = new HashSet<Define>(); public List<Block> pres = new ArrayList<Block>(); /*public List<String> bin = new ArrayList<String>(); public List<String> bout = new ArrayList<String>(); public List<String> bgen = new ArrayList<String>(); public List<String> bkill = new ArrayList<String>(); public List<Block> bpres = new ArrayList<Block>();*/ public Block(String name){ this.name = name; } public Block(ICFGNode node){ this.node = node; this.name = node.toString(); } @Override public String toString(){ return this.name; } public ICFGNode getNode() { return node; } public void setNode(ICFGNode node) { this.node = node; } }
[ "qihaiqh@qq.com" ]
qihaiqh@qq.com
3006e388e084bedeef795793c1797e9302ea9286
5be44f022a14d3a1587f557958d64d6958cfe9c3
/spring-boot/configuration/src/test/java/io/reflectoring/configuration/unknownandinvalidfield/UnkownFieldPropertiesTest.java
1011bcd90fd92ba6961d9f16e15b51144d23aab4
[ "MIT" ]
permissive
thombergs/code-examples
4608b7d9ea3201ffa26d305f24d1ac1aa77f2c08
ca500ac4d4a0e501565e30dcdea37bb17d4d26e7
refs/heads/master
2023-09-04T23:14:37.811206
2023-08-14T21:04:33
2023-08-14T21:04:33
98,801,926
2,492
2,710
MIT
2023-09-10T20:42:50
2017-07-30T14:12:24
Java
UTF-8
Java
false
false
976
java
package io.reflectoring.configuration.unknownandinvalidfield; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.*; @SpringBootTest(properties = { "myapp.unknown-and-invalid-field-module.unknown-property=foo" }) class UnkownFieldPropertiesTest { @Autowired(required = false) private UnkownAndInvalidFieldProperties properties; @Test @Disabled("disabled due to unexpected behavior") void loadsApplicationContext() { // This test passes. // However, I would expect this test to fail application context startup due to the unknown property. // If we set ignoreInvalidFields to true, it works as expected. assertThat(properties).isNotNull(); } }
[ "tom.hombergs@gmail.com" ]
tom.hombergs@gmail.com
3949e47473550c9ce1e40bb4bfaaa74b368490ea
aa9597ee7d4396e9e44c35e5b0bef30ba7a8be62
/Proyecto/src/application/Register.java
e6d03bd10a89950a83de78d57a88a3dd9fa19466
[]
no_license
ChienMort/PAE-Game-Hub
f97f96ec9ad9797df62b56792a2e586bf1db1fa7
8d4f350569232a845d03e0a93743869356460a87
refs/heads/master
2020-04-01T06:01:12.124389
2018-12-03T01:08:59
2018-12-03T01:08:59
152,930,062
0
0
null
2018-10-15T13:55:04
2018-10-14T01:48:52
Java
ISO-8859-1
Java
false
false
3,674
java
package application; import javax.swing.JOptionPane; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.input.MouseEvent; import javafx.scene.layout.GridPane; import javafx.stage.Stage; import localization.ProjectLocale; import resources.sounds.ProjectSound; public class Register { public static Scene register(Stage stage, ProjectSound ps, DBConnection dbt) { //Ricardo - Agregando cosas para adaptar el código int sceneWidth = 280, sceneHeight = 340; ProjectImages pi = new ProjectImages(); //Añadiendo lenguajes ChoiceBox<String> cb = new ChoiceBox<String>(); cb.getItems().addAll("English", "Español"); //Tec - Código Button lbtn = new Button(ProjectLocale.rb.getString("register")); Button cbtn = new Button(ProjectLocale.rb.getString("login")); TextField utf = new TextField(); TextField mtf = new TextField(); Label ulb = new Label(ProjectLocale.rb.getString("user")); Label plb = new Label(ProjectLocale.rb.getString("password")); Label mlb = new Label(ProjectLocale.rb.getString("mail")); PasswordField pf = new PasswordField(); GridPane gp = new GridPane(); gp.setBackground(pi.backGround1()); utf.setMaxWidth(120.0); pf.setMaxWidth(120.0); gp.setAlignment(Pos.CENTER); gp.add(ulb, 0, 0); gp.add(utf, 1, 0); gp.add(plb, 0, 1); gp.add(pf, 1, 1); gp.add(mlb, 0, 2); gp.add(mtf, 1, 2); gp.add(lbtn, 1, 3); gp.add(cb, 0, 5); gp.add(cbtn, 1, 6); gp.setHgap(10.0); gp.setVgap(20.0); Scene scene = new Scene(gp, sceneWidth, sceneHeight); cbtn.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> { stage.setScene(Login.login(stage, ps, dbt)); }); lbtn.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> { if(utf.getText().equals("null") || utf.getText().equals("")) JOptionPane.showMessageDialog(null, ProjectLocale.rb.getString("inuser")); else if(pf.getText().equals("")) JOptionPane.showMessageDialog(null, ProjectLocale.rb.getString("inpass")); else if(mtf.getText().length() < 3) JOptionPane.showMessageDialog(null, ProjectLocale.rb.getString("inmail")); else { String re = dbt.register(utf.getText(), pf.getText(), mtf.getText()); if(re.equals("")) { dbt.usuario = utf.getText(); stage.close(); JOptionPane.showMessageDialog(null, ProjectLocale.rb.getString("rme")); stage.setScene(MainMenu.Menu(stage, ps, dbt)); stage.show(); } else if(re.contains("uniUser")) JOptionPane.showMessageDialog(null, ProjectLocale.rb.getString("uerr")); else if(re.contains("uniMail")) JOptionPane.showMessageDialog(null, ProjectLocale.rb.getString("merr")); else JOptionPane.showMessageDialog(null, ProjectLocale.rb.getString("ltt")); } }); cb.getSelectionModel().selectedItemProperty().addListener( (options, oldValue, newValue) -> { switch(newValue) { case "English": ProjectLocale.setBundleEng(); break; case "Español": ProjectLocale.setBundleEsp(); break; } lbtn.setText(ProjectLocale.rb.getString("login")); ulb.setText(ProjectLocale.rb.getString("user")); plb.setText(ProjectLocale.rb.getString("password")); stage.setTitle(ProjectLocale.rb.getString("title")); cbtn.setText(ProjectLocale.rb.getString("register")); mlb.setText(ProjectLocale.rb.getString("mail")); }); return scene; } }
[ "Sedna@Sedna" ]
Sedna@Sedna
f8b7bc49f285629aa48fd0fd3d96c4e88554297b
e1af7696101f8f9eb12c0791c211e27b4310ecbc
/MCP/src/minecraft/net/minecraft/init/MobEffects.java
fc87014a664b434cacf5e1190c690e5bee067d34
[]
no_license
VinmaniaTV/Mania-Client
e36810590edf09b1d78b8eeaf5cbc46bb3e2d8ce
7a12b8bad1a8199151b3f913581775f50cc4c39c
refs/heads/main
2023-02-12T10:31:29.076263
2021-01-13T02:29:35
2021-01-13T02:29:35
329,156,099
0
0
null
null
null
null
UTF-8
Java
false
false
4,203
java
package net.minecraft.init; import javax.annotation.Nullable; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; public class MobEffects { public static final Potion SPEED; public static final Potion SLOWNESS; public static final Potion HASTE; public static final Potion MINING_FATIGUE; public static final Potion STRENGTH; public static final Potion INSTANT_HEALTH; public static final Potion INSTANT_DAMAGE; public static final Potion JUMP_BOOST; public static final Potion NAUSEA; /** The regeneration Potion object. */ public static final Potion REGENERATION; public static final Potion RESISTANCE; /** The fire resistance Potion object. */ public static final Potion FIRE_RESISTANCE; /** The water breathing Potion object. */ public static final Potion WATER_BREATHING; /** The invisibility Potion object. */ public static final Potion INVISIBILITY; /** The blindness Potion object. */ public static final Potion BLINDNESS; /** The night vision Potion object. */ public static final Potion NIGHT_VISION; /** The hunger Potion object. */ public static final Potion HUNGER; /** The weakness Potion object. */ public static final Potion WEAKNESS; /** The poison Potion object. */ public static final Potion POISON; /** The wither Potion object. */ public static final Potion WITHER; /** The health boost Potion object. */ public static final Potion HEALTH_BOOST; /** The absorption Potion object. */ public static final Potion ABSORPTION; /** The saturation Potion object. */ public static final Potion SATURATION; public static final Potion GLOWING; public static final Potion LEVITATION; public static final Potion LUCK; public static final Potion UNLUCK; @Nullable private static Potion getRegisteredMobEffect(String id) { Potion potion = Potion.REGISTRY.getObject(new ResourceLocation(id)); if (potion == null) { throw new IllegalStateException("Invalid MobEffect requested: " + id); } else { return potion; } } static { if (!Bootstrap.isRegistered()) { throw new RuntimeException("Accessed MobEffects before Bootstrap!"); } else { SPEED = getRegisteredMobEffect("speed"); SLOWNESS = getRegisteredMobEffect("slowness"); HASTE = getRegisteredMobEffect("haste"); MINING_FATIGUE = getRegisteredMobEffect("mining_fatigue"); STRENGTH = getRegisteredMobEffect("strength"); INSTANT_HEALTH = getRegisteredMobEffect("instant_health"); INSTANT_DAMAGE = getRegisteredMobEffect("instant_damage"); JUMP_BOOST = getRegisteredMobEffect("jump_boost"); NAUSEA = getRegisteredMobEffect("nausea"); REGENERATION = getRegisteredMobEffect("regeneration"); RESISTANCE = getRegisteredMobEffect("resistance"); FIRE_RESISTANCE = getRegisteredMobEffect("fire_resistance"); WATER_BREATHING = getRegisteredMobEffect("water_breathing"); INVISIBILITY = getRegisteredMobEffect("invisibility"); BLINDNESS = getRegisteredMobEffect("blindness"); NIGHT_VISION = getRegisteredMobEffect("night_vision"); HUNGER = getRegisteredMobEffect("hunger"); WEAKNESS = getRegisteredMobEffect("weakness"); POISON = getRegisteredMobEffect("poison"); WITHER = getRegisteredMobEffect("wither"); HEALTH_BOOST = getRegisteredMobEffect("health_boost"); ABSORPTION = getRegisteredMobEffect("absorption"); SATURATION = getRegisteredMobEffect("saturation"); GLOWING = getRegisteredMobEffect("glowing"); LEVITATION = getRegisteredMobEffect("levitation"); LUCK = getRegisteredMobEffect("luck"); UNLUCK = getRegisteredMobEffect("unluck"); } } }
[ "vinmaniamc@gmail.com" ]
vinmaniamc@gmail.com
431e0d795e20fd3f871dc13701ed79959512fd0e
35348f6624d46a1941ea7e286af37bb794bee5b7
/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/util/MatchStatusRenderer.java
9ec0dbf8a90f6eb4eb04c526f3c3b95a865768b0
[ "Apache-2.0", "GPL-1.0-or-later", "GPL-3.0-only", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "LicenseRef-scancode-unknown-license-reference" ]
permissive
StarCrossPortal/ghidracraft
7af6257c63a2bb7684e4c2ad763a6ada23297fa3
a960e81ff6144ec8834e187f5097dfcf64758e18
refs/heads/master
2023-08-23T20:17:26.250961
2021-10-22T00:53:49
2021-10-22T00:53:49
359,644,138
80
19
Apache-2.0
2021-10-20T03:59:55
2021-04-20T01:14:29
Java
UTF-8
Java
false
false
3,637
java
/* ### * IP: GHIDRA * * 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 ghidra.feature.vt.gui.util; import java.awt.Component; import javax.swing.Icon; import javax.swing.JLabel; import docking.widgets.table.GTableCellRenderingData; import ghidra.util.table.GhidraTableCellRenderer; import resources.MultiIcon; import resources.ResourceManager; import resources.icons.TranslateIcon; public class MatchStatusRenderer extends GhidraTableCellRenderer { // private static final Icon DISABLED_APPLIED_ICON = // ResourceManager.getDisabledIcon(ResourceManager.loadImage("images/flag.png")); private static final Icon ACCEPTED_ICON = ResourceManager.loadImage("images/flag.png"); private static final Icon REJECTED_ICON = ResourceManager.loadImage("images/dialog-cancel.png"); // private static final Icon REJECTED_ICON = ResourceManager.loadImage("images/delete.png"); private static final Icon BLOCKED_ICON = ResourceManager.loadImage("images/kgpg.png"); // private static final ImageIcon LOCK_ICON = // ResourceManager.loadImage("images/lock.png"); private static final Icon WARN_ICON = new TranslateIcon( ResourceManager.loadImage("images/bullet_error.png"), 10, 8); private static final Icon FAILURE_ICON = new TranslateIcon(ResourceManager.getScaledIcon( ResourceManager.loadImage("images/edit-delete.png"), 8, 8), 10, 8); private static final Icon FULLY_APPLIED_ICON = new TranslateIcon(ResourceManager.getScaledIcon( ResourceManager.loadImage("images/checkmark_green.gif"), 8, 8), 10, 8); private static final Icon FULLY_CONSIDERED_ICON = new TranslateIcon( ResourceManager.getScaledIcon(ResourceManager.loadImage("images/checkmark_yellow.gif"), 8, 8), 10, 8); @Override public Component getTableCellRendererComponent(GTableCellRenderingData data) { // be sure to let our parent perform any initialization needed JLabel renderer = (JLabel) super.getTableCellRendererComponent(data); Object value = data.getValue(); renderer.setText(""); renderer.setHorizontalAlignment(CENTER); MungedAssocationAndMarkupItemStatus status = (MungedAssocationAndMarkupItemStatus) value; if (status == null) { // // Hack Alert! We should never get here, as any row will be backed by a match that // has a status. I believe this is some sort of timing issue related // to using a threaded table model. // return renderer; } Icon icon = null; switch (status) { case ACCEPTED_FULLY_APPLIED: icon = new MultiIcon(ACCEPTED_ICON, FULLY_APPLIED_ICON); break; case ACCEPTED_HAS_ERRORS: icon = new MultiIcon(ACCEPTED_ICON, FAILURE_ICON); break; case ACCEPTED_NO_UNEXAMINED: icon = new MultiIcon(ACCEPTED_ICON, FULLY_CONSIDERED_ICON); break; case ACCEPTED_SOME_UNEXAMINED: icon = new MultiIcon(ACCEPTED_ICON, WARN_ICON); break; case AVAILABLE: // no icon break; case BLOCKED: icon = BLOCKED_ICON; break; case REJECTED: icon = REJECTED_ICON; break; } renderer.setIcon(icon); renderer.setToolTipText(status.getDescription()); return renderer; } }
[ "46821332+nsadeveloper789@users.noreply.github.com" ]
46821332+nsadeveloper789@users.noreply.github.com
aa34f6f07c1918623f0ce22e81c81bac36832279
deb9495ec13a0978eaa73542af0b5f65645c93e3
/app/src/androidTest/java/com/quanpv/tablayoutcustom/ExampleInstrumentedTest.java
d1e4fd156e058a8e77b454118cf410222686172f
[]
no_license
quanpv/TabLayoutCustome
b802e12ccaeb826cfe00a65dc50fb8f669ac6034
e6637fe0aa0cbcb6ecdbc3afdb339b04b31e67d2
refs/heads/master
2020-03-10T05:24:02.613766
2018-04-12T08:16:41
2018-04-12T08:16:41
129,216,889
0
0
null
null
null
null
UTF-8
Java
false
false
753
java
package com.quanpv.tablayoutcustom; 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.*; /** * Instrumented 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.quanpv.tablayoutcustom", appContext.getPackageName()); } }
[ "quanpv.hut@gmial.com" ]
quanpv.hut@gmial.com
89055226a39de0e5b62979a20e76da83e1cb43b0
b7bcfbd46f0744e082a07cd0479de4a695c4b8b4
/src/main/java/com/tmall/service/CategoryService.java
08a66709581a7fdffd28898ee3b8a778c86bc8d1
[]
no_license
xieyijie147/tmall_springboot
4d14ce29864bdc1f0e5770ef905e4c655ec21939
2eedac16153532c20efe1f8ddb8b9e721c20d837
refs/heads/master
2022-07-18T12:42:16.504300
2019-08-23T10:24:17
2019-08-23T10:26:08
203,721,393
0
0
null
2022-06-21T01:43:38
2019-08-22T05:36:09
HTML
UTF-8
Java
false
false
3,114
java
package com.tmall.service; import com.tmall.dao.CategoryDAO; import com.tmall.pojo.Category; import com.tmall.pojo.Product; import com.tmall.util.Page4Navigator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.List; @Service @CacheConfig(cacheNames = "categories") public class CategoryService { @Autowired CategoryDAO categoryDAO; @Cacheable(key="'categories-page-'+#p0+ '-' + #p1") public Page4Navigator<Category> list(int start, int size, int navigatePages){ Sort sort = new Sort(Sort.Direction.DESC, "id"); Pageable pageable = new PageRequest(start, size, sort); Page pageFromJPA = categoryDAO.findAll(pageable); return new Page4Navigator<>(pageFromJPA, navigatePages); } @Cacheable(key="'categories-all'") public List<Category> list(){ Sort sort = new Sort(Sort.Direction.DESC, "id"); return categoryDAO.findAll(sort); } @CacheEvict(allEntries=true) public void add(Category bean){ categoryDAO.save(bean); } @CacheEvict(allEntries=true) public void delete(int id) { categoryDAO.delete(id); } @Cacheable(key = "'categories-one-'+ #p0") public Category get(int id) { Category category = categoryDAO.findOne(id); return category; } @CacheEvict(allEntries=true) public void update(Category bean) { categoryDAO.save(bean); } /* * 增加两个 removeCategoryFromProduct 方法。 * 这个方法的用处是删除Product对象上的 分类。 为什么要删除呢? 因为在对分类做序列还转换为 json 的时候,会遍历里面的 products, 然后遍历出来的产品上,又会有分类,接着就开始子子孙孙无穷溃矣地遍历了,就搞死个人了 * 而在这里去掉,就没事了。 只要在前端业务上,没有通过产品获取分类的业务,去掉也没有关系。 * */ public void removeCategoryFromProduct(List<Category> categories){ for (Category category : categories){ removeCategoryFromProduct(category); } } public void removeCategoryFromProduct(Category category) { List<Product> products = category.getProducts(); if(null != products){ for(Product product : products){ product.setCategory(null); } } List<List<Product>> productsByRow = category.getProductsByRow(); if(null != productsByRow){ for(List<Product> productList : productsByRow){ for(Product product : productList){ product.setCategory(null); } } } } }
[ "363527072@qq.com" ]
363527072@qq.com