blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9b9737fab9921af499ca06cefe5e298da7f1539a | e2dead21edc5813172efd35de367df14fbd191ed | /EJBModule/src/java/test/DimsalesreasonFacade.java | efd1244babf2a3518412fd59571084270bae8df3 | [] | no_license | D-Malyszko/MB2015 | a6797ab425944f17c4654fffef46f8e151090ad3 | 603ff6d4c3f2e09fe3ea3fccab4f5ea93fcbb0f4 | refs/heads/master | 2021-01-10T17:38:15.331358 | 2015-12-15T15:25:19 | 2015-12-15T15:25:19 | 45,944,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import data.Dimsalesreason;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author admin
*/
@Stateless
public class DimsalesreasonFacade extends AbstractFacade<Dimsalesreason> implements test.DimsalesreasonFacadeRemote {
@PersistenceContext(unitName = "EJBModule1PU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public DimsalesreasonFacade() {
super(Dimsalesreason.class);
}
}
| [
"u@m.pl"
] | u@m.pl |
fded5b9b163581c5e998f15a26b88cf1db7bdb81 | 1084c1fe48a238a95813764961f855c0fd45afb4 | /eclipse/CraftBukkit/src/net/mine_diver/aethermp/blocks/BlockTrap.java | 5e56ea703fa8f28ff3b3948ce1d9e901bebd7dbe | [] | no_license | ModificationStation/AetherMP | 01cd17f613a68868730745aed62acff1fa3b0cb7 | a1ca25a1b1f679629514881732d7ea7f3c781752 | refs/heads/master | 2022-05-12T11:32:23.760092 | 2021-01-01T21:22:48 | 2021-01-01T21:22:48 | 163,419,866 | 13 | 4 | null | 2022-03-21T20:33:32 | 2018-12-28T14:38:45 | Java | UTF-8 | Java | false | false | 2,068 | java | package net.mine_diver.aethermp.blocks;
import java.util.Random;
import net.mine_diver.aethermp.entities.EntitySentry;
import net.mine_diver.aethermp.network.PacketManager;
import net.minecraft.server.BlockBreakable;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityHuman;
import net.minecraft.server.Material;
import net.minecraft.server.MathHelper;
import net.minecraft.server.World;
import net.minecraft.server.WorldServer;
public class BlockTrap extends BlockBreakable {
public BlockTrap(int i) {
super(i, -1, Material.STONE, false);
a(true);
}
@Override
public boolean a() {
return true;
}
@Override
public int a(Random random) {
return 1;
}
@Override
public void b(World world, int i, int j, int k, Entity entity) {
if(entity instanceof EntityHuman) {
PacketManager.makeSound((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, "aether.sound.other.dungeontrap.activateTrap", 1.0F, 1.0F, ((WorldServer) world).dimension);
int l = MathHelper.floor(i);
int i1 = MathHelper.floor(j);
int j1 = MathHelper.floor(k);
switch(world.getData(i, j, k))
{
case 0: // '\0'
EntitySentry entitysentry = new EntitySentry(world);
entitysentry.setPosition((double)l + 0.5D, (double)i1 + 1.5D, (double)j1 + 0.5D);
world.addEntity(entitysentry);
break;
/*case 1: // '\001'
EntityValkyrie entityvalkyrie = new EntityValkyrie(world);
entityvalkyrie.setPosition((double)l + 0.5D, (double)i1 + 1.5D, (double)j1 + 0.5D);
world.entityJoinedWorld(entityvalkyrie);
break;*/
}
world.setTypeIdAndData(i, j, k, BlockManager.LockedDungeonStone.id, world.getData(i, j, k));
}
}
@Override
protected int a_(int i) {
return i;
}
}
| [
"aabesedin@mail.ru"
] | aabesedin@mail.ru |
4cd7ae5f39b2f6c6c1a2d323f6dc318407c9c643 | 77b90b3ad2fb5955b437a308deb7b25755954c40 | /app/src/main/java/android/ye/zhbjj/base/submenu/InteractMenuDetailPaper.java | 32e747bdd437d73b996c1cfbbdd96c70149037a2 | [] | no_license | yyy000112/Zhbj | aa8fe78692d0b25164df214872f50ffee5c33e7f | 4ccf9295920c6a6f7075f575252c7d8906547b1d | refs/heads/master | 2021-01-12T10:41:45.229960 | 2016-11-09T04:47:29 | 2016-11-09T04:47:33 | 72,620,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | package android.ye.zhbjj.base.submenu;
import android.app.Activity;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.ye.zhbjj.base.BaseMenuDetailPager;
/**
* 菜单详情页-互动
* Created by ye on 2016/11/3.
*/
public class InteractMenuDetailPaper extends BaseMenuDetailPager {
public InteractMenuDetailPaper(Activity activity) {
super(activity);
}
@Override
public View initView() {
TextView textView = new TextView(mActivity);
textView.setText("菜单详情页-互动");
textView.setTextColor(Color.RED);
textView.setTextSize(22);
textView.setGravity(Gravity.CENTER);
return textView;
}
@Override
public void initData() {
}
}
| [
"yyy000112@126.com"
] | yyy000112@126.com |
bb54292718d91f0eb01679bb6942e7bc0774cbb7 | 460e46afd1281b3509cb96d27d1a4e7fb62ae8bc | /src/me/tuke/sktuke/hooks/legendchat/expressions/ExprTellReceiver.java | 01eda14abc974900c01a356c7a0b106ad4a28674 | [] | no_license | mccrafter1212/TuSKe | cf7bca8c4ba39050926baf1ba8f8f46577c7e640 | 7fc43a18c9e9c50b13ae6d0bb35674d5251d2a8a | refs/heads/master | 2021-01-01T17:20:51.838618 | 2017-07-14T19:16:38 | 2017-07-14T19:16:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,004 | java | package me.tuke.sktuke.hooks.legendchat.expressions;
import me.tuke.sktuke.util.Registry;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Event;
import br.com.devpaulo.legendchat.api.events.PrivateMessageEvent;
import javax.annotation.Nullable;
import ch.njol.skript.ScriptLoader;
import ch.njol.skript.Skript;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
public class ExprTellReceiver extends SimpleExpression<CommandSender>{
static {
Registry.newSimple(ExprTellReceiver.class, 0, "[tell] receiver");
}
//private boolean noWait = true;
@Override
public Class<? extends CommandSender> getReturnType() {
return CommandSender.class;
}
@Override
public boolean isSingle() {
return true;
}
@Override
public boolean init(Expression<?>[] arg0, int arg1, Kleenean arg2, ParseResult arg3) {
if (!ScriptLoader.isCurrentEvent(PrivateMessageEvent.class)){
Skript.error("Receiver can only be used on Legendchat tell event.");
return false;
}
//if (arg2 == Kleenean.TRUE)
// noWait = false;
return true;
}
@Override
public String toString(@Nullable Event arg0, boolean arg1) {
return "receiver";
}
@Override
@Nullable
protected CommandSender[] get(Event e) {
PrivateMessageEvent tell = (PrivateMessageEvent)e;
return new CommandSender[] { (CommandSender) tell.getReceiver() };
}
/*
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
PrivateMessageEvent tell = (PrivateMessageEvent)e;
if (mode == ChangeMode.SET)
tell.setReceiver((Player)delta[0]);
}
@SuppressWarnings("unchecked")
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
if (!noWait){
Skript.error("Can't set tell receiver to anything after the event has already passed", ErrorQuality.SEMANTIC_ERROR);
return null;
}
if (mode == ChangeMode.SET)
return CollectionUtils.array(Player.class);
return null;
}
*/
} | [
"leandro.p.alencar@gmail.com"
] | leandro.p.alencar@gmail.com |
4d67d0574c9c8bf70dfe22420100880b4e7cd436 | 956863fa385fa69ea31638393fc6a9d3c6bf9f04 | /squelPartie1/squelette1FRog/src/environment/Car.java | 3bfd310c1e94a9a2b2b9e09a97b5b4fcd038ca51 | [] | no_license | Julien-LG/Projet-Frogger | d61f54b4f30a0f0ff31bd74dc2e7c2d66d4f9aff | 8c6f078e02f794b4fff91802b8e77074e2154d22 | refs/heads/master | 2023-04-07T18:32:02.642699 | 2023-03-19T18:36:37 | 2023-03-19T18:36:37 | 311,374,560 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,092 | java | package environment;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import util.Case;
import gameCommons.Game;
import graphicalElements.Element;
import javax.imageio.ImageIO;
public class Car {
private Game game;
private Case leftPosition;
private boolean leftToRight;
private int length;
private final Color colorLtR = Color.BLACK;;
private final Color colorRtL = Color.BLUE;
private BufferedImage sprite = null;
//TODO Constructeur(s)
public Car(Game game, Case frontPosition, boolean leftToRight) {
this.game = game;
this.length = game.randomGen.nextInt(3) /*+ 1*/;
this.leftPosition = new Case(frontPosition.absc - this.length, frontPosition.ord);
this.leftToRight = leftToRight;
this.sprite = spriteGenerator();
}
//TODO : ajout de methodes
/**
* Renvoie un sprite de voiture de couleur aléatoire
* @return Une image (sprite) pour la voiture
*/
public BufferedImage spriteGenerator() {
BufferedImage spriteGen = null;
int random = game.randomGen.nextInt(3);
String spriteName = "";
if (leftToRight) {
switch (random) {
case 0:
spriteName = "images/leftCar.png";
break;
case 1:
spriteName ="images/leftCar2.png";
break;
case 2:
spriteName ="images/leftCar3.png";
break;
}
}
else {
switch (random) {
case 0:
spriteName ="images/rightCar.png";
break;
case 1:
spriteName ="images/rightCar2.png";
break;
case 2:
spriteName ="images/rightCar3.png";
break;
}
}
try {
spriteGen = ImageIO.read(new File(spriteName));
} catch (IOException ioException) {
System.out.println(ioException);
}
return spriteGen;
}
/**
* Actualise l'affichage de la voiture
* @param b true si la voiture c'est déplacée
*/
public void displace(boolean b) {
if (b) {
if (this.leftToRight) {
this.leftPosition = new Case(this.leftPosition.absc + 1, this.leftPosition.ord);
}
else {
this.leftPosition = new Case(this.leftPosition.absc - 1, this.leftPosition.ord);
}
}
this.addToGraphics();
}
/**
* Indique si l'a voiture est dans les limites du tableau
* @return true si la voiture est dans les limites
*/
public boolean inLimits() {
return this.leftPosition.absc + this.length > 0 || this.leftPosition.absc < this.game.width;
}
/**
* Fourni : addToGraphics() permettant d'ajouter un element graphique correspondant a la voiture
*/
private void addToGraphics() {
for (int i = 0; i < length; i++) {
Color color = colorRtL;
if (this.leftToRight){
color = colorLtR;
}
game.getGraphic().add(new Element(leftPosition.absc + i, leftPosition.ord, color, sprite));
}
}
/**
* Indique si la voiture est sur la case
* @param c la case que l'on veut vérifier
* @return true si la voiture est sur la case
*/
public boolean aboveCase(Case c) {
if (c.ord == this.leftPosition.ord) {
if (c.absc >= this.leftPosition.absc && c.absc < this.leftPosition.absc + this.length) {
return true;
}
}
return false;
}
}
| [
"58564546+Julien-LG@users.noreply.github.com"
] | 58564546+Julien-LG@users.noreply.github.com |
3ec8326b20fa4f8ef1c3aa75ff6fdd52f664e899 | c170ab623b801984012b1d511a5e65eea24ee6d9 | /src/main/java/me/Fupery/FuppyMon/AI/WrappedMoveController.java | dc852d056a7f20f895cc23b37145b725628b87e1 | [] | no_license | Fupery/FuppyMon | fd8ac069b712d989606b6baf357709a66c57ddd7 | c50b3cce5862a5880249716fdbc2c761a713acc1 | refs/heads/master | 2021-01-09T20:45:40.425623 | 2016-07-29T01:46:28 | 2016-07-29T01:46:28 | 64,440,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package me.Fupery.FuppyMon.AI;
import net.minecraft.server.v1_10_R1.ControllerMove;
import net.minecraft.server.v1_10_R1.EntityInsentient;
public class WrappedMoveController extends ControllerMove {
public WrappedMoveController(EntityInsentient entityInsentient) {
super(entityInsentient);
}
public WrappedMoveController(EntityInsentient entityInsentient, ControllerMove controller) {
super(entityInsentient);
controller.a(b, c, d, e);
}
public ControllerMove.Operation getCurrentOperation() {
return h;
}
}
| [
"Fupery1@gmail.com"
] | Fupery1@gmail.com |
175683e061b1d3f110abd6a7e0701246008b00c6 | 4b84c74bfb8b6fb4cd20aed393dba47d256292b8 | /MyApplication/app/src/main/java/mensajeria/tomas/com/myapplication/MainActivity.java | a05a40fb470c72bc27829687dc724ed262e3990d | [] | no_license | tomas-93/PracticasAndroid | c3561d213e87d3c5108efee5c559567af09b7544 | b47a3e1c96f248aa7c809369f4883ea49b4eb78c | refs/heads/master | 2021-01-01T18:37:23.324130 | 2016-02-13T06:47:30 | 2016-02-13T06:47:30 | 38,970,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | package mensajeria.tomas.com.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void procesarMensaje(View vista)
{
//Instanciado los componentes, creando el objeto y llamndo desde la XML con R
EditText editorTexto = (EditText) this.findViewById(R.id.textoDeEntradaET);
TextView mensaje = (TextView) this.findViewById(R.id.mensajeTV);
//Cambiando valores
mensaje.setText("Mensaje: "+editorTexto.getText());
}
}
| [
"tomasyussef@gmail.com"
] | tomasyussef@gmail.com |
b5e912eab8025e2e2037447cc148c63786fc3de7 | c7c7c0df36104921847948a9e5478532811d99c8 | /src/ifc4javatoolbox/ifc4/IfcFaceBound.java | c3d9faabd0073a7b2e23ea45f38c9366ff3f3935 | [] | no_license | puneetarora2000/buildingrules | c57b63a2a3328cd458249ceb6eacb4a5dcf05c06 | 829a739360165fd395f12be511c702f53676df73 | refs/heads/master | 2020-04-17T17:07:38.978972 | 2016-12-21T06:23:58 | 2016-12-21T06:23:58 | 66,047,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,891 | java | /* Generated By: IFC Tools Project EXPRESS TO JAVA COMPILER: Do not edit this file!! */
package ifc4javatoolbox.ifc4;
/**
* This is a default implementation of the entity IfcFaceBound<br><br>
*<br><br>
* Copyright: CC BY-NC-SA 3.0 DE (cc) 2013 Eike Tauscher and Michael Theiler<br><br>
* The whole package including this class is licensed under<br>
* <a rel='license' href='http://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.en/'>
* Creative Commons Attribution-Non-Commercial-Share Alike 3.0 Germany</a>.<br><br>
* If you are using the package or parts of it in any commercial way, a commercial license is required.
* Visit <a href='http://www.ifctoolsproject.com'>http://www.ifctoolsproject.com</a> for more information
* or contact us directly: <a href='mailto:info@ifctoolsproject.com'>info@ifctoolsproject.com</a><br>
*/
public class IfcFaceBound extends IfcTopologicalRepresentationItem implements ClassInterface
{
private static final String[] nonInverseAttributes = new String[]{"IfcLoop","BOOLEAN"};
private java.util.ArrayList<CloneableObject> stepParameter = null;
private java.util.HashSet<ObjectChangeListener> listenerList = null;
protected int stepLineNumber;
/** Bound is an DEMANDED attribute - may not be null**/
protected IfcLoop Bound;
/** Orientation is an DEMANDED attribute - may not be null**/
protected BOOLEAN Orientation;
/**
* The default constructor.
**/
public IfcFaceBound(){}
/**
* Constructs a new IfcFaceBound object using the given parameters.
*
* @param Bound DEMANDED parameter of type IfcLoop - may not be null.
* @param Orientation DEMANDED parameter of type BOOLEAN - may not be null.
**/
public IfcFaceBound(IfcLoop Bound, BOOLEAN Orientation)
{
this.Bound = Bound;
this.Orientation = Orientation;
resolveInverses();
}
/**
* This method initializes the IfcFaceBound object using the given parameters.
*
* @param Bound DEMANDED parameter of type IfcLoop - may not be null.
* @param Orientation DEMANDED parameter of type BOOLEAN - may not be null.
**/
public void setParameters(IfcLoop Bound, BOOLEAN Orientation)
{
this.Bound = Bound;
this.Orientation = Orientation;
resolveInverses();
}
/**
* This method is used internally and should NOT be used for own purposes.
**/
void initialize(java.util.ArrayList<CloneableObject> parameters)
{
this.Bound = (IfcLoop) parameters.get(0);
this.Orientation = (BOOLEAN) parameters.get(1);
resolveInverses();
}
/**
* This method is used internally and should NOT be used for own purposes.
**/
void destruct()
{
super.destruct();
listenerList = null;
}
private void resolveInverses()
{
}
/**
* This method is used internally and should NOT be used for own purposes.
**/
String[] getNonInverseAttributeTypes()
{
return IfcFaceBound.nonInverseAttributes; }
/**
* This method is used internally and should NOT be used for own purposes.
**/
private java.util.HashSet<String> getRedefinedDerivedAttributeTypes()
{
java.util.HashSet<String> redefinedDerivedAttributes = new java.util.HashSet<String>();
return redefinedDerivedAttributes; }
/**
* This method returns the object IFC STEP representation. This method is called by the IfcModel object to write IFC STEP files.
*
* @return the IFC STEP representation of this object
**/
public String getStepLine()
{
String stepString = new String("#"+this.stepLineNumber+"= ");
stepString = stepString.concat("IFCFACEBOUND(");
if(getRedefinedDerivedAttributeTypes().contains("Bound")) stepString = stepString.concat("*,");
else{
if(this.Bound != null) stepString = stepString.concat(((RootInterface)this.Bound).getStepParameter(IfcLoop.class.isInterface())+",");
else stepString = stepString.concat("$,");
}
if(getRedefinedDerivedAttributeTypes().contains("Orientation")) stepString = stepString.concat("*);");
else{
if(this.Orientation != null) stepString = stepString.concat(((RootInterface)this.Orientation).getStepParameter(BOOLEAN.class.isInterface())+");");
else stepString = stepString.concat("$);");
}
return stepString;
}
/**
* This method is used internally and should NOT be used for own purposes.
**/
public String getStepParameter(boolean isSelectType)
{
return "#" + this.stepLineNumber;
}
/**
* This method returns the line number within a IFC STEP representation. This method is called from other objects, where this one is referenced.
*
* @return the STEP line number
**/
public int getStepLineNumber()
{
return this.stepLineNumber;
}
/**
* This method is used internally and should NOT be used for own purposes.
**/
void setStepLineNumber(int number)
{
this.stepLineNumber = number;
}
/**
* This method sets the Bound attribute to the given value.
*
* @param Bound OPTIONAL value to set
**/
public void setBound(IfcLoop Bound)
{
this.Bound = Bound;
fireChangeEvent();
}
/**
* This method returns the value of the Bound attribute.
*
* @return the value of Bound
/**/
public IfcLoop getBound()
{
return this.Bound;
}
/**
* This method sets the Orientation attribute to the given value.
*
* @param Orientation OPTIONAL value to set
**/
public void setOrientation(BOOLEAN Orientation)
{
this.Orientation = Orientation;
fireChangeEvent();
}
/**
* This method returns the value of the Orientation attribute.
*
* @return the value of Orientation
/**/
public BOOLEAN getOrientation()
{
return this.Orientation;
}
/**
* This method is used internally and should NOT be used for own purposes.
**/
void setStepParameter(java.util.ArrayList<CloneableObject> parameter)
{
this.stepParameter = parameter;
}
/**
* This method is used internally and should NOT be used for own purposes.
**/
java.util.ArrayList<CloneableObject> getStepParameter()
{
return this.stepParameter;
}
/**
* This method registers an ObjectChangeListener to this object. An event is fired whenever one of its values was changed.
*
*@param listener the listener to register
**/
public void addObjectChangeListener(ObjectChangeListener listener)
{
if (listenerList == null) listenerList = new java.util.HashSet<ObjectChangeListener>(1,1);
listenerList.add(listener);
}
/**
* This method unregisters an ObjectChangeListener from this object.
*
*@param listener the listener to unregister
**/
public void removeObjectChangeListener(ObjectChangeListener listener)
{
if (listenerList == null) return;
listenerList.remove(listener);
if (listenerList.size()==0) listenerList = null;
}
/**
* This method removes all currently registered ObjectChangeListeners from this object.
**/
public void removeAllObjectChangeListeners()
{
listenerList = null;
}
protected void fireChangeEvent()
{
if(listenerList == null) return;
for(ObjectChangeListener listener : listenerList)
listener.ifcModelObjectChange(this);
}
/**
* This method clones the object (deep cloning).
*
* @return the cloned object
**/
public Object clone()
{
IfcFaceBound ifcFaceBound = new IfcFaceBound();
if(this.Bound != null)
ifcFaceBound.setBound((IfcLoop)this.Bound.clone());
if(this.Orientation != null)
ifcFaceBound.setOrientation((BOOLEAN)this.Orientation.clone());
return ifcFaceBound;
}
/**
* This method copys the object as shallow copy (all referenced objects are remaining).
*
* @return the cloned object
**/
public Object shallowCopy()
{
IfcFaceBound ifcFaceBound = new IfcFaceBound();
if(this.Bound != null)
ifcFaceBound.setBound(this.Bound);
if(this.Orientation != null)
ifcFaceBound.setOrientation(this.Orientation);
return ifcFaceBound;
}
/**
* This method returns the objects standard description.
*
* @return the standard description
**/
public String toString()
{
return "#"+ this.getStepLineNumber() + " " + this.getClass().getSimpleName();
}
}
| [
"puneetarora2000@gmail.com"
] | puneetarora2000@gmail.com |
baab3c4d75b1e3b2827efe7d5d6831c29fda8c3c | bb211d8d6ba1785ce575b6af55d4b7eafbe8061f | /src/BuildServer/ServerStudy01/Person.java | c4c1a235aebd472f82ffae5cce3b53c21a52907a | [] | no_license | Git-zhoujunjie/ShangXueTang300 | 5f3989c721c23397719d0898bc358d19f28ad85c | 82d099ca1dfbec11d163f8423a0828f72e3552d4 | refs/heads/master | 2021-07-01T03:47:16.679181 | 2020-09-26T17:14:54 | 2020-09-26T17:14:54 | 169,690,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | package BuildServer.ServerStudy01;
/**
* 存储person信息,一个person相当于一个类的对象
* <person>
* <name>至尊宝</name>
* <age>9000</age>
* </person>
* 可看出包含name和age
*/
public class Person {
private String name;
private int age;
public Person(){}
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
}
| [
"1160529743@qq.com"
] | 1160529743@qq.com |
8ce47ae88ce2ac02b58788b70cf2911708201e5d | a202ff86d5295cf96ad93a5686d54570386485ed | /Presidente/src/Presidente/Presidencia.java | e85c96b5c0360102011345fcb4b1da1ed3de3627 | [] | no_license | goncalves-felipe/Java | dc47110e7195543718dd8af83b520eccd0befd11 | 32610a33b7b674cc6e5a38ed5351b11f840e758c | refs/heads/master | 2021-06-02T23:28:40.949216 | 2016-05-23T12:21:48 | 2016-05-23T12:21:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | 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 Presidente;
/**
*
* @author GABRIEL HADDAD
*/
public class Presidencia{
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Candidato[] candidatos = new Candidato[4];
String[] nomes = {"Lulalele", "Cirogrude", "Criancinha", "Roseacai"};
for (int i=0; i<candidatos.length;i++){
candidatos[i]= new Candidato(nomes[i]);
}
Eleicao presidencial = new Eleicao(candidatos);
}
}
| [
"gabriel.haddad15@gmail.com"
] | gabriel.haddad15@gmail.com |
b67ea3348fa91852a953763048d5a12891b6adf6 | b8eee5dc79169f7c7ecd9c684751f6d18a60e809 | /app/src/test/java/com/codiyapa/myapplication/ExampleUnitTest.java | 116cff77b564627d65af00589d073a40e8424e29 | [] | no_license | Aditya8840/MemeApp | 95b03fc23e41799008145160829078292d3ba3a7 | edfe237d4b7671093257245834885e2c69169bbb | refs/heads/master | 2023-04-13T17:54:17.697365 | 2021-04-22T07:34:19 | 2021-04-22T07:34:19 | 360,431,575 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.codiyapa.myapplication;
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);
}
} | [
"akasaudhan02@gmail.com"
] | akasaudhan02@gmail.com |
69d36ef7384842f41326be908adee31bd54c7ebe | 80696d2553eb38693d9faadca881530d28d48201 | /onlineobjects/trunk/src/main/java/dk/in2isoft/onlineobjects/service/video/VideoController.java | 3cfcf8c971509c0d171127758aaecc8e0ba0c411 | [] | no_license | AbsSecurePwd/AbsSecurePwd | c5bbab6d592848aff0c5db70f6fde69c471db431 | b0a6d8151573673b12900a8a0d4b76004a8b1361 | refs/heads/master | 2023-02-08T07:23:07.768558 | 2020-12-11T13:31:56 | 2020-12-11T13:31:56 | 320,307,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,706 | java | package dk.in2isoft.onlineobjects.service.video;
import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import dk.in2isoft.commons.http.FilePusher;
import dk.in2isoft.onlineobjects.core.ModelService;
import dk.in2isoft.onlineobjects.core.exceptions.EndUserException;
import dk.in2isoft.onlineobjects.core.exceptions.IllegalRequestException;
import dk.in2isoft.onlineobjects.model.Video;
import dk.in2isoft.onlineobjects.modules.video.VideoService;
import dk.in2isoft.onlineobjects.service.ServiceController;
import dk.in2isoft.onlineobjects.services.FileService;
import dk.in2isoft.onlineobjects.ui.Request;
import dk.in2isoft.onlineobjects.util.images.ImageService;
public class VideoController extends ServiceController {
private ImageService imageService;
private ModelService modelService;
private FileService fileService;
private VideoService videoService;
private Pattern idPattern;
public VideoController() {
super("video");
idPattern = Pattern.compile("id([0-9]+)");
}
@Override
public void unknownRequest(Request request) throws IOException, EndUserException {
String[] path = request.getLocalPath();
if (path.length>0) {
String subject = path[0];
long id = Long.valueOf(match(idPattern,subject));
process(request,id);
} else {
throw new IllegalRequestException();
}
}
private String match(Pattern pattern, String subject) {
Matcher matcher = pattern.matcher(subject);
if (matcher.find()) {
for (int i = 0; i <= matcher.groupCount(); i++) {
if (i==1) {
return matcher.group(i);
}
}
}
return null;
}
private void process(Request request, long id) throws IOException, EndUserException {
Video video = modelService.get(Video.class, id, request.getSession());
File file = videoService.getVideoFile(video);
FilePusher pusher = new FilePusher(file);
pusher.setClientSideCaching(true);
pusher.setDownload(request.getBoolean("download"));
pusher.push(request.getResponse(), video.getContentType());
}
public void setImageService(ImageService imageService) {
this.imageService = imageService;
}
public ImageService getImageService() {
return imageService;
}
public void setModelService(ModelService modelService) {
this.modelService = modelService;
}
public ModelService getModelService() {
return modelService;
}
public void setFileService(FileService fileService) {
this.fileService = fileService;
}
public FileService getFileService() {
return fileService;
}
public void setVideoService(VideoService videoService) {
this.videoService = videoService;
}
public VideoService getVideoService() {
return videoService;
}
}
| [
"738501@TCS.com"
] | 738501@TCS.com |
5e99daf13586866ce3a78ff30e68c5c2da5e7405 | 17457fa1dc8a7e2e57130d0e9fcd298d0d7f21a6 | /Source-Code Gumbel-20200508.zip_expanded/de/hsmannheim/inf/pr2/ads/TreeNodeTest.java | 5bda63d3ca594901c0666ba9d44245507dd78a0a | [] | no_license | zer0x0/pr2 | 80a0a457a4383a86daff312113728f1f39c9fea4 | 70df0dc22f6c449554150ee943430af4e35d9718 | refs/heads/master | 2021-05-21T19:29:09.537570 | 2021-03-20T07:36:52 | 2021-03-20T07:36:52 | 260,512,806 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,477 | java | package de.hsmannheim.inf.pr2.ads;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
class TreeNodeTest {
/**
* PÜ3 - Aufgabe 6
*/
@Test
void isEmptytest() {
SearchTree<Integer> t1 = new SearchTree<>();
SearchTree<String> ts = new SearchTree<>();
assertTrue(t1.isEmpty());
assertTrue(ts.isEmpty());
}
/**
* PÜ3 - Aufgabe 6
*/
@Test
void isEmptytest2() {
SearchTree<Integer> t2 = new SearchTree<>();
SearchTree<String> ts2 = new SearchTree<>();
t2.add(1);
t2.add(3);
ts2.add("Hallo");
ts2.add("Welt");
assertFalse(t2.isEmpty());
assertFalse(ts2.isEmpty());
}
/**
* PÜ3 - Aufgabe 6
*/
@Test
void isEmptytest3() {
SearchTree<Integer> t3 = new SearchTree<>();
SearchTree<String> ts3 = new SearchTree<>();
t3.add(4);
t3.add(8);
t3.clear();
ts3.add("ist");
ts3.add("Hallo");
ts3.clear();
assertTrue(t3.isEmpty());
assertTrue(ts3.isEmpty());
}
/**
* PÜ3 - Aufgabe 7
*/
@Test
void clear() {
SearchTree<Integer> t3 = new SearchTree<>();
SearchTree<String> ts3 = new SearchTree<>();
t3.add(83);
t3.add(25);
t3.clear();
ts3.add("Welt");
ts3.add("schön");
ts3.clear();
assertTrue(t3.isEmpty());
assertTrue(ts3.isEmpty());
}
/**
* PÜ3 - Aufgabe 9
*/
@Test
void containsRek() {
SearchTree<Integer> t4 = new SearchTree<>();
SearchTree<String> ts4 = new SearchTree<>();
t4.add(83);
t4.add(25);
ts4.add("Welt");
ts4.add("schön");
assertTrue(t4.contains(25));
assertTrue(t4.contains(83));
assertFalse(t4.contains(5));
assertFalse(t4.contains(2));
assertTrue(ts4.contains("Welt"));
assertTrue(ts4.contains("sch�n"));
assertFalse(ts4.contains("Hallo"));
assertFalse(ts4.contains("Bier"));
}
/**
* PÜ3 - Aufgabe 8
*/
@Test
void heightTest() {
SearchTree<Integer> t = new SearchTree<Integer>();
t.add(1);
t.add(2);
t.add(3);
assertEquals(3, t.height());
SearchTree<Integer> t6 = new SearchTree<Integer>();
t6.add(10);
t6.add(5);
t6.add(5);
t6.add(3);
t6.add(7);
t6.add(6);
t6.add(15);
t6.add(12);
t6.add(17);
assertEquals(4, t6.height());
SearchTree<Integer> t7 = new SearchTree<Integer>();
t7.add(0);
assertEquals(1, t7.height());
}
/**
* PÜ3 - Aufgabe 5
*/
@Test
void equalStructureTest() {
TreeNode<Integer> t1 = new TreeNode<Integer>(1, new TreeNode<Integer>(2), new TreeNode<Integer>(3));
TreeNode<Integer> t2 = new TreeNode<Integer>(1, new TreeNode<Integer>(2), new TreeNode<Integer>(3));
TreeNode<Integer> t3 = new TreeNode<Integer>(5, new TreeNode<Integer>(8), new TreeNode<Integer>(2));
TreeNode<Integer> t4 = new TreeNode<Integer>(3, new TreeNode<Integer>(6), new TreeNode<Integer>(1));
TreeNode<Integer> t5 = new TreeNode<Integer>(1, t3, t4);
TreeNode<Integer> t6 = new TreeNode<Integer>(4, t3, t5);
TreeNode<Integer> t7 = new TreeNode<Integer>(null);
TreeNode<Integer> t8 = new TreeNode<Integer>(null);
TreeNode<Integer> t9 = new TreeNode<Integer>(1, t3, t4);
assertTrue(t1.equalStructure(t2));
assertTrue(t5.equalStructure(t9));
assertTrue(t7.equalStructure(t8));
assertFalse(t1.equalStructure(t3));
assertFalse(t4.equalStructure(t7));
}
} | [
"zer0x0@pm.me"
] | zer0x0@pm.me |
201986bbcc3ecf1ece1a8af9355fb1307a827b84 | 9f4fe251161bb9b2c4345e94c00823e2a6f3dd1b | /gulimall-pms/src/main/java/com/atguigu/gulimall/pms/entity/BrandEntity.java | 41a55c770bbbc7d2c27566d627893b8525c21009 | [
"Apache-2.0"
] | permissive | zhuyeqingya/gulimall | 6d187b19883e2b5e68307640b7142770e010fd20 | ba52002276ca128fa62eeec37658dc7a6d97b4ad | refs/heads/master | 2022-07-21T16:22:55.345145 | 2019-08-02T08:24:20 | 2019-08-02T08:24:20 | 200,030,146 | 0 | 0 | Apache-2.0 | 2022-07-06T20:40:38 | 2019-08-01T10:30:26 | JavaScript | UTF-8 | Java | false | false | 1,372 | java | package com.atguigu.gulimall.pms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 品牌
*
* @author zhuyeqingya
* @email 1334741385@qq.com
* @date 2019-08-01 20:40:45
*/
@ApiModel
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 品牌id
*/
@TableId
@ApiModelProperty(name = "brandId",value = "品牌id")
private Long brandId;
/**
* 品牌名
*/
@ApiModelProperty(name = "name",value = "品牌名")
private String name;
/**
* 品牌logo地址
*/
@ApiModelProperty(name = "logo",value = "品牌logo地址")
private String logo;
/**
* 介绍
*/
@ApiModelProperty(name = "descript",value = "介绍")
private String descript;
/**
* 显示状态[0-不显示;1-显示]
*/
@ApiModelProperty(name = "showStatus",value = "显示状态[0-不显示;1-显示]")
private Integer showStatus;
/**
* 检索首字母
*/
@ApiModelProperty(name = "firstLetter",value = "检索首字母")
private String firstLetter;
/**
* 排序
*/
@ApiModelProperty(name = "sort",value = "排序")
private Integer sort;
}
| [
"1334741385@qq.com"
] | 1334741385@qq.com |
23e98edf1790d8281db115f4a9299eb2f8e7c757 | 48a793a036e8144e14da5f551e0b38ab6e14d230 | /de/kalio/Durchrasten/warps/command/WarpCommand.java | 997ad421e15e8cbc204471a19773d504f1861e14 | [] | no_license | KalioCraft/Durchrasten | 8455427afa86c6dc4cd36e0e7bd0d24685f90be3 | e6fe6989ac20b0dfd269d49dfd1671dd4f460084 | refs/heads/main | 2023-03-20T19:45:14.964066 | 2021-03-07T10:13:50 | 2021-03-07T10:13:50 | 345,314,105 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,492 | java | package de.kalio.Durchrasten.warps.command;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import de.kalio.Durchrasten.Durchrasten;
public class WarpCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage(Durchrasten.prefix + "§7Du musst ein Spieler sein!");
return true;
}
Player player = (Player) sender;
if(args.length == 0) {
player.sendMessage(Durchrasten.prefix + "§7Unbekannter Befehl. Benutze §6§l/sw help §7für Hilfe!");
return true;
}
if(args.length >= 1) {
String sub = args[0];
if(sub.equalsIgnoreCase("help")) {
sendHelp(player);
return true;
} else if(sub.equalsIgnoreCase("create")) {
if(!(args.length == 2)) {
syntax(player, "sw create <Name>");
return true;
}
String name = args[1];
if(Durchrasten.warp.hasPlayerWarp(player.getUniqueId().toString())) {
player.sendMessage(Durchrasten.prefix + "§7Du hast bereits ein Warp!");
return true;
}
Durchrasten.warp.createWarp(player.getLocation(), player.getUniqueId().toString(), name);
player.sendMessage(Durchrasten.prefix + "§7Du hast den Warp §6§l"+name+" §7erstellt!");
return true;
} else if(sub.equalsIgnoreCase("menu")) {
Durchrasten.warp.openInvetory(player);
} else if(sub.equalsIgnoreCase("teleport")) {
if(!(args.length == 2)) {
syntax(player, "sw teleport <Name>");
return true;
}
String name = args[1];
if(!Durchrasten.warp.warpExist(name)) {
player.sendMessage(Durchrasten.prefix + "§7Der Warp existiert nicht!");
return true;
}
Durchrasten.warp.teleport(player, name);
} else if(sub.equalsIgnoreCase("wartung")) {
if(!(args.length == 2)) {
syntax(player, "sw wartung <Aus/An>");
return true;
}
if(!Durchrasten.warp.hasPlayerWarp(player.getUniqueId().toString())) {
player.sendMessage(Durchrasten.prefix + "§7Du hast kein Warp!");
return true;
}
String bool = args[1];
Boolean b;
if(bool.equalsIgnoreCase("aus")) {
b = false;
} else if(bool.equalsIgnoreCase("an")) {
b = true;
} else {
syntax(player, "sw wartung <Aus/An>");
return true;
}
boolean wartung = Durchrasten.warp.getWartung(Durchrasten.warp.getPlayerWarp(player.getUniqueId().toString()));
if(b == false && wartung == false) {
player.sendMessage(Durchrasten.prefix + "§7Die Wartung sind bereits Aus!");
return true;
}
if(b == true && wartung == true) {
player.sendMessage(Durchrasten.prefix + "§7Die Wartung sind bereits Aus!");
return true;
}
Durchrasten.warp.setWartung(b, Durchrasten.warp.getPlayerWarp(player.getUniqueId().toString()));
player.sendMessage(Durchrasten.prefix + "§7Du hast die Wartungen umgeschaltet!");
return true;
} else if(sub.equalsIgnoreCase("delete")) {
if(!Durchrasten.warp.hasPlayerWarp(player.getUniqueId().toString())) {
player.sendMessage(Durchrasten.prefix + "§7Du hast kein Warp!");
return true;
}
Durchrasten.warp.deleteWarp(player.getUniqueId().toString());
player.sendMessage(Durchrasten.prefix + "§7Du hast den Warp gelöscht!");
return true;
}
}
player.sendMessage(Durchrasten.prefix + "§7Unbekannter Befehl. Benutze §6§l/sw help §7für Hilfe!");
return false;
}
public void syntax(Player player, String syntax) {
player.sendMessage(Durchrasten.prefix + "§7Benutze: §6§l/"+syntax);
}
public void sendHelp(Player player) {
player.sendMessage(Durchrasten.prefix + "§8§m--------------------------");
player.sendMessage(Durchrasten.prefix + "§6§l/sw create <Name> §8➜ §7Erstelle einen Spieler Warp!");
player.sendMessage(Durchrasten.prefix + "§6§l/sw teleport <Name> §8➜ §7Teleportiere dich zu ein Warp!");
player.sendMessage(Durchrasten.prefix + "§6§l/sw delete §8➜ §7Lösche deinen Warp!");
player.sendMessage(Durchrasten.prefix + "§6§l/sw menu §8➜ §7Öffne das Menü, wo du alle Warps siehst!");
player.sendMessage(Durchrasten.prefix + "§6§l/sw wartung <Aus/An> §8➜ §7Mache die Wartungen aus oder an!");
player.sendMessage(Durchrasten.prefix + "§8§m--------------------------");
}
}
| [
"linus@DESKTOP-13509.13506"
] | linus@DESKTOP-13509.13506 |
7e0cb1931021a373485a01709c73580e795e80e8 | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE319_Cleartext_Tx_Sensitive_Info/CWE319_Cleartext_Tx_Sensitive_Info__listen_tcp_kerberosKey_67b.java | 59a1513007f4d4c2b42c64dc4af3ccaa36a0b5a6 | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,307 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE319_Cleartext_Tx_Sensitive_Info__listen_tcp_kerberosKey_67b.java
Label Definition File: CWE319_Cleartext_Tx_Sensitive_Info.label.xml
Template File: sources-sinks-67b.tmpl.java
*/
/*
* @description
* CWE: 319 Cleartext Transmission of Sensitive Information
* BadSource: listen_tcp Read password using a listening tcp connection
* GoodSource: Set password to a hardcoded value (one that was not sent over the network)
* Sinks: kerberosKey
* GoodSink: Decrypt password before using in KerberosKey()
* BadSink : Use password directly in KerberosKey()
* Flow Variant: 67 Data flow: data passed in a class from one method to another in different source files in the same package
*
* */
package testcases.CWE319_Cleartext_Tx_Sensitive_Info;
import testcasesupport.*;
import javax.security.auth.kerberos.KerberosPrincipal;
import javax.security.auth.kerberos.KerberosKey;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class CWE319_Cleartext_Tx_Sensitive_Info__listen_tcp_kerberosKey_67b
{
public void badSink(CWE319_Cleartext_Tx_Sensitive_Info__listen_tcp_kerberosKey_67a.Container passwordContainer ) throws Throwable
{
String password = passwordContainer.containerOne;
if (password != null)
{
KerberosPrincipal principal = new KerberosPrincipal("test");
/* POTENTIAL FLAW: Use password directly in KerberosKey() */
KerberosKey key = new KerberosKey(principal, password.toCharArray(), null);
IO.writeLine(key.toString());
}
}
/* goodG2B() - use goodsource and badsink */
public void goodG2BSink(CWE319_Cleartext_Tx_Sensitive_Info__listen_tcp_kerberosKey_67a.Container passwordContainer ) throws Throwable
{
String password = passwordContainer.containerOne;
if (password != null)
{
KerberosPrincipal principal = new KerberosPrincipal("test");
/* POTENTIAL FLAW: Use password directly in KerberosKey() */
KerberosKey key = new KerberosKey(principal, password.toCharArray(), null);
IO.writeLine(key.toString());
}
}
/* goodB2G() - use badsource and goodsink */
public void goodB2GSink(CWE319_Cleartext_Tx_Sensitive_Info__listen_tcp_kerberosKey_67a.Container passwordContainer ) throws Throwable
{
String password = passwordContainer.containerOne;
if (password != null)
{
KerberosPrincipal principal = new KerberosPrincipal("test");
/* FIX: Decrypt password before using in KerberosKey() */
{
Cipher aesCipher = Cipher.getInstance("AES");
/* INCIDENTAL: CWE-321: Use of Hard-coded Cryptographic Key */
SecretKeySpec secretKeySpec = new SecretKeySpec("ABCDEFGHABCDEFGH".getBytes("UTF-8"), "AES");
aesCipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
password = new String(aesCipher.doFinal(password.getBytes("UTF-8")), "UTF-8");
}
KerberosKey key = new KerberosKey(principal, password.toCharArray(), null);
IO.writeLine(key.toString());
}
}
}
| [
"bqcuong2212@gmail.com"
] | bqcuong2212@gmail.com |
3e6a856a31fe1b0f28164f14089b6276c44167ef | 1c1d4ae86a6daa85eb13cc9f918602e93f1a7cfe | /Assignment 3/G7_Assignment3/PROJECT/G7_Assignment3-Project/G7_Assignment3-Project_Server/src/config/database/tables/DailyReport.java | 7d0d81f5e67f2d252a9f4346d629906bbd459fd9 | [] | no_license | oreliyahu1/GCM-Global-City-Map | 85f39949b6a9219f406cc0ca2a9c6387899d1fa7 | 742671901eba35e4b4c4c4bb0a3d051624497606 | refs/heads/master | 2022-01-15T03:34:25.341829 | 2022-01-13T03:01:31 | 2022-01-13T03:01:31 | 200,386,387 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 971 | java | /*
* this class defines DailyReport table with columns , primary key and foreign keys
*/
package config.database.tables;
import java.util.HashMap;
// TODO: Auto-generated Javadoc
/**
* The Class DailyReport.
* Static class
* This class consist of columns types of DailyReport table on db scheme.
*/
public final class DailyReport {
/** The Constant TABLE_NAME. */
public static final String TABLE_NAME = "dailyreport";
/** The Constant DB_TABLE. */
@SuppressWarnings("serial")
public static final java.util.Map<String,String> DB_TABLE = new HashMap<String, String>()
{
{
put(config.database.tables.columns.DailyReport.DATE, "date");
put(config.database.tables.columns.DailyReport.REPORT, "mediumblob");
//define primary key
put("", String.format("primary key(`%s`)", config.database.tables.columns.DailyReport.DATE));
}
};
/**
* Override public contractor to make it static.
*/
private DailyReport() {}
}
| [
"oreliyahu93@gmail.com"
] | oreliyahu93@gmail.com |
f9c873388c49a50f483360f3d94f59fa5280b246 | b3f322e30956fcfdf232969e17e825073d57af75 | /src/main/java/by/bntu/coursework/service/UserService.java | 3beb9b2e1c68d54fe3e1dcb7e95de83fb8cbabb4 | [] | no_license | Lukyanau/CourceWork | 4cc111d2f404efa6e6dbd940d0f7a554d380d81f | f296382d4153d3e6f60f7ebb2d91d0bf1354304c | refs/heads/master | 2023-03-09T16:53:34.746055 | 2021-02-25T07:34:44 | 2021-02-25T07:34:44 | 313,619,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package by.bntu.coursework.service;
import by.bntu.coursework.entity.User;
import by.bntu.coursework.exception.ServiceException;
public interface UserService {
User checkPassword(String login, String password) throws ServiceException;
boolean signUpUser(User user) throws ServiceException;
}
| [
"7592396@mail.ru"
] | 7592396@mail.ru |
160cc0a24b684b5eab6c63761734e994f5789245 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_13897e71ebfd68d3562c5535712926cdd6c4af63/SmartSleep/1_13897e71ebfd68d3562c5535712926cdd6c4af63_SmartSleep_t.java | 5711a16842fee73506bfa5c4871beb4f3ac42e43 | [] | 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 | 2,523 | java | package robot.engine.relist.ocr;
import java.awt.image.BufferedImage;
import ocr.Ocr;
import org.sikuli.api.ScreenRegion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import robot.engine.commons.Controller;
import robot.engine.commons.ImageLogger;
import robot.region.TradePileRegion;
public class SmartSleep {
private static final int DEFAULT_SLEEP_IN_MILLIS = 3600000; // default to 1 hour
private TradePileRegion tradePileRegion;
private Controller controller;
private Ocr ocr;
public SmartSleep(Controller controller, TradePileRegion tradePileRegion) {
this.controller = controller;
this.tradePileRegion = tradePileRegion;
ocr = new Ocr();
}
private boolean clickFirstCard() {
Logger logger = LoggerFactory.getLogger(this.getClass());
ScreenRegion firstCard = tradePileRegion.findFirstCard(1000);
boolean successful = false;
logger.info("looking for first card...");
if(firstCard != null) {
logger.info("clicking first card");
controller.clickCenterOf(firstCard);
successful = true;
}
return successful;
}
private int parseRemainingTime(String s) {
Logger logger = LoggerFactory.getLogger(this.getClass());
logger.info("Parsing Raw Time Ramaining String");
return new TimeParser(s).getInMillis();
}
private int calculateFromRemaining(BufferedImage timeBox) {
Logger logger = LoggerFactory.getLogger(this.getClass());
logger.info("OCR Time Remaining - start");
String s = ocr.recognizeCharacters(timeBox);
logger.info("OCR aquired: {}", s);
int timeRemaining = parseRemainingTime(s);
logger.info("OCR parsed: {} millis", timeRemaining);
return timeRemaining;
}
// ensure full screen refresh first - wait for a second :)
private void sleepForASec() throws InterruptedException {
Thread.sleep(1000);
}
public int getRequiredSleepTime() throws InterruptedException {
int sleepTime = DEFAULT_SLEEP_IN_MILLIS;
Logger logger = LoggerFactory.getLogger(this.getClass());
sleepForASec();
if(clickFirstCard()) {
logger.info("looking for time remaining");
ScreenRegion timeRemaining = tradePileRegion.findTimeRemaining(2000);
if(timeRemaining != null) {
sleepForASec();
BufferedImage timeBox = timeRemaining.capture();
ImageLogger.getLogger().logToResource(timeBox);
sleepTime = calculateFromRemaining(timeBox);
}
else {
logger.info("could not find time remaining!");
}
}
return sleepTime;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
6067f324bd3f24155134d52763ad23fc5fc4e26e | 714c55016c950cf033e231c32df214cc0a5ea07c | /app/src/main/java/com/zakaprov/braincodemobihackathon/fragments/SourcesSettingsFragment.java | 9d001c57d777dedb4e2a33ca437ab505900d010c | [] | no_license | kmazurek/braincode-hackathon | cc9652f11937c2df83d94d3566ebeabff8eb50e1 | c35b2c4e8194f3ca382b0b1f1a5148b97ba348ca | refs/heads/master | 2022-10-05T12:20:04.507134 | 2015-03-25T08:31:11 | 2015-03-25T08:31:11 | 32,172,194 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package com.zakaprov.braincodemobihackathon.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.melnykov.fab.FloatingActionButton;
import com.zakaprov.braincodemobihackathon.MainActivity;
import com.zakaprov.braincodemobihackathon.R;
/**
* Created by kulak on 14/03/15.
*/
public class SourcesSettingsFragment extends AbstractFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
MainActivity activity = (MainActivity) getActivity();
View layout = inflater.inflate(R.layout.sources_settings_fragment, container, false);
FloatingActionButton fab = (FloatingActionButton)layout.findViewById(R.id.fab);
fab.show();
return layout;
}
}
| [
"kulak@kulak.at"
] | kulak@kulak.at |
b68fc4ad970db2a7b7fc138e60255f89a99936d3 | 4acd19cb59d61b846a9b204cd54f6bdf342751bc | /yomio-core/src/main/java/io/yom/parser/CatalogXmlIRIMapper.java | cb1c18c6d5df885b2a8ca9bada13dadad6b1cf2b | [] | no_license | cmungall/yaml-ontology-metalanguage | e41489f077b28d5c3e1878a35399b534d86b1fcb | 98cd92bab2ee12311ef92a14bed01a851e63192d | refs/heads/master | 2021-01-10T13:06:15.807043 | 2016-04-09T18:00:19 | 2016-04-09T18:00:19 | 47,483,185 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,073 | java | package io.yom.parser;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntologyIRIMapper;
import org.xml.sax.SAXException;
/**
* {@link OWLOntologyIRIMapper} using the mappings from a catalog.xml file.
* Taken from ROBOT
* @author <a href="mailto:james@overton.ca">James A. Overton</a>
*/
public class CatalogXmlIRIMapper implements OWLOntologyIRIMapper {
/**
* Logger.
*/
private static final Logger logger =
LoggerFactory.getLogger(CatalogXmlIRIMapper.class);
/**
* Mappings from OntologyIRIs to (usually) file IRIs,
* allowing a layer of indirection when importing ontologies.
*/
private final Map<IRI, IRI> mappings;
/**
* Initialize with IRI mappings.
*
* @param mappings initial mappings from IRIs to IRIs
*/
CatalogXmlIRIMapper(Map<IRI, IRI> mappings) {
this.mappings = mappings;
}
/**
* Given a String path to a catalog file, create a CatalogXmlIRIMapper
* that interprets any relative paths as relative
* to the catalog file location.
*
* @param catalogFile the String path to the catalog file
* @throws IOException on any problem
*/
public CatalogXmlIRIMapper(String catalogFile) throws IOException {
this(new File(catalogFile).getAbsoluteFile());
}
/**
* Given a catalog File, create a CatalogXmlIRIMapper
* that interprets any relative paths as relative
* to the catalog file location.
*
* @param catalogFile the catalog File
* @throws IOException on any problem
*/
public CatalogXmlIRIMapper(File catalogFile) throws IOException {
this(catalogFile, catalogFile.getAbsoluteFile().getParentFile());
}
/**
* Given a catalog File and a parent folder, create a CatalogXmlIRIMapper
* that interprets any relative paths as relative to the parent folder.
*
* @param catalogFile the catalog File
* @param parentFolder the File for the parent folder
* @throws IOException on any problem
*/
public CatalogXmlIRIMapper(File catalogFile, File parentFolder)
throws IOException {
this(parseCatalogXml(new FileInputStream(catalogFile), parentFolder));
}
/**
* Given an IRI, create a CatalogXmlIRIMapper
* that interprets any relative paths as relative
* to the catalog file location.
*
* @param catalogIRI the IRI of the catalog file
* @throws IOException on any problem
*/
public CatalogXmlIRIMapper(IRI catalogIRI) throws IOException {
this(catalogIRI.toURI().toURL());
}
/**
* Given an URL, create a CatalogXmlIRIMapper
* that interprets any relative paths as relative
* to the catalog file location.
*
* @param catalogURL the URL of the catalog file
* @throws IOException on any problem
*/
public CatalogXmlIRIMapper(URL catalogURL) throws IOException {
if ("file".equals(catalogURL.getProtocol())) {
try {
File catalogFile = new File(catalogURL.toURI());
mappings = parseCatalogXml(
new FileInputStream(catalogFile),
catalogFile.getParentFile());
} catch (URISyntaxException e) {
throw new IOException(e);
}
} else {
mappings = parseCatalogXml(catalogURL.openStream(), null);
}
}
/**
* Given an URL and a parent folder, create a CatalogXmlIRIMapper
* that interprets any relative paths as relative to the parent folder.
*
* @param catalogURL the URL of the catalog file
* @param parentFolder the File for the parent folder
* @throws IOException on any problem
*/
public CatalogXmlIRIMapper(URL catalogURL, File parentFolder)
throws IOException {
this(parseCatalogXml(catalogURL.openStream(), parentFolder));
}
/**
* Given an IRI, return the mapped IRI.
*
* @param ontologyIRI the IRI that we want to look up
* @return the mapped IRI, usually to a local file
*/
@Override
public IRI getDocumentIRI(IRI ontologyIRI) {
return mappings.get(ontologyIRI);
}
/**
* Parse the inputStream as a catalog.xml file and extract IRI mappings.
*
* Optional: Resolve relative file paths with the given parent folder.
*
* @param inputStream input stream (never null)
* @param parentFolder folder or null
* @return mappings
* @throws IOException on general IO problems
* @throws IllegalArgumentException if input stream is null
*/
static Map<IRI, IRI> parseCatalogXml(InputStream inputStream,
final File parentFolder)
throws IOException, IllegalArgumentException {
if (inputStream == null) {
throw new IllegalArgumentException(
"InputStream should never be null, missing resource?");
}
// use the Java built-in SAX parser
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(false);
try {
final Map<IRI, IRI> mappings = new HashMap<IRI, IRI>();
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(inputStream,
new CatalogElementHandler(parentFolder, mappings));
return mappings;
} catch (ParserConfigurationException e) {
throw new IOException(e);
} catch (SAXException e) {
throw new IOException(e);
} finally {
inputStream.close();
}
}
}
| [
"cjm@berkeleybop.org"
] | cjm@berkeleybop.org |
d1403e50d067ef8ec6cde5a0989ae97aefb674f7 | 7cbccc84e77181beb3d3682b008f6ece072671e2 | /base/src/main/java/com/sunshineftg/kbase/filter/LoggerMDCFilter.java | a4591528ccc96adea594f713f965ab691f69200c | [
"MIT"
] | permissive | curd-team/kbase | e2e4a51977bfd138ebe16e1181f1ca6c0608890f | 076e975cea0047828374e265c2991e8f59edfac4 | refs/heads/main | 2023-03-28T03:18:57.491096 | 2021-03-30T03:24:43 | 2021-03-30T03:24:43 | 309,667,540 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,225 | java | package com.sunshineftg.kbase.filter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.ThreadContext;
import org.springframework.context.annotation.Configuration;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
import java.util.UUID;
@WebFilter(urlPatterns = "/*",filterName = "LoggerMDCFilter")
@Configuration
@Slf4j
public class LoggerMDCFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) {
log.info("LoggerMDCFilter start");
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
String reqId = request.getParameter("reqId");
if (StringUtils.isEmpty(reqId)) {
reqId = UUID.randomUUID().toString();
}
ThreadContext.put("req.id", reqId);
// ThreadContext.put("req.requestURIWithQueryString", ((HttpServletRequest) request).getRequestURI() + (((HttpServletRequest) request).getQueryString() == null ? "" : "?" + ((HttpServletRequest) request).getQueryString()));
chain.doFilter(request, response);
}
}
| [
"zjp20123258@163.com"
] | zjp20123258@163.com |
4e70525712ee7db848295b4c6f7e2ca7fbf5b3b7 | 9627aa196b5518fa3226a48c8bf4db9a830fc951 | /Project/src/test/java/com/asgdrones/drones/repositories/CourseJPATest.java | de80b953582ed461a2c46ae37ee8abdc241fc1c3 | [] | no_license | JamesBuckland98/security_project | b2ab294c419a136c853640c30b1babf23dc272eb | b506cfda31f222975b98c2d7bca7a527f2e864b4 | refs/heads/master | 2022-07-19T09:34:52.362057 | 2019-05-09T19:17:13 | 2019-05-09T19:17:13 | 264,645,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,214 | java | package com.asgdrones.drones.repositories;
import com.asgdrones.drones.domain.Address;
import com.asgdrones.drones.domain.Course;
import com.asgdrones.drones.domain.Instructor;
import com.asgdrones.drones.domain.Login;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestEntityManager;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import java.sql.Date;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@DataJpaTest
@DirtiesContext
@AutoConfigureTestEntityManager
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
public class CourseJPATest {
@Autowired
private TestEntityManager entityManager;
@Autowired
private CourseRepoJPA courseRepoJPA;
@Test
public void CourseRepoTest(){
Address address = new Address(null,"CF244AN","Cardiff","Abby Lane",4,"");
Login login = new Login(null,"jbuckland","1234","customer");
Instructor instructor = new Instructor(null,"james","buckland","01895430027",login,address);
Course course = new Course(null,"Course1","Type2","Cardiff", java.sql.Date.valueOf(LocalDate.now()),instructor);
this.entityManager.merge(course);
List<Course> courseList = courseRepoJPA.findAll();
assertThat(courseList.get(courseList.size()-1).getCourseName()).isEqualTo("Course1");
assertThat(courseList.get(courseList.size()-1).getCourseType()).isEqualTo("Type2");
assertThat(courseList.get(courseList.size()-1).getCourseDate()).isEqualTo(Date.valueOf(LocalDate.now()));
assertThat(courseList.get(courseList.size()-1).getCourseLocation()).isEqualTo("Cardiff");
}
}
| [
"BucklandJ2@cardiff.ac.uk"
] | BucklandJ2@cardiff.ac.uk |
b2e0a0878ea85afec890c46204c4f4edd158b6d0 | 4265eaacadd0eab8f8cf7c1ce18084cbdbe7228d | /src/main/java/ch/sbb/maven/plugins/iib/mojos/PackageIibParMojo.java | 6575c215fdde8c242f7110ea29f1ecf02ac0ae82 | [
"Apache-2.0"
] | permissive | SchweizerischeBundesbahnen/iib-maven-plugin | a5c3508a64ec7092ccd760703c3c354e42e2c372 | 223a4ebc5eb03b431032a3ebec13dc197560ba63 | refs/heads/develop | 2022-07-04T21:31:13.377246 | 2016-05-13T13:05:15 | 2016-05-13T13:05:15 | 18,362,406 | 9 | 22 | Apache-2.0 | 2022-07-01T22:17:37 | 2014-04-02T10:16:32 | Java | UTF-8 | Java | false | false | 4,653 | java | package ch.sbb.maven.plugins.iib.mojos;
import static org.twdata.maven.mojoexecutor.MojoExecutor.artifactId;
import static org.twdata.maven.mojoexecutor.MojoExecutor.configuration;
import static org.twdata.maven.mojoexecutor.MojoExecutor.dependency;
import static org.twdata.maven.mojoexecutor.MojoExecutor.element;
import static org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo;
import static org.twdata.maven.mojoexecutor.MojoExecutor.executionEnvironment;
import static org.twdata.maven.mojoexecutor.MojoExecutor.goal;
import static org.twdata.maven.mojoexecutor.MojoExecutor.groupId;
import static org.twdata.maven.mojoexecutor.MojoExecutor.name;
import static org.twdata.maven.mojoexecutor.MojoExecutor.plugin;
import static org.twdata.maven.mojoexecutor.MojoExecutor.version;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.BuildPluginManager;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
/**
* Creates a .par file from a iib-par Project
*
* Implemented with help from: https://github.com/TimMoore/mojo-executor/blob/master/README.md
*/
@Mojo(name = "package-par")
public class PackageIibParMojo extends AbstractMojo {
/**
* The path to write the assemblies/iib-bar-project.xml file to before invoking the maven-assembly-plugin.
*/
@Parameter(defaultValue = "${project.build.directory}/assemblies/iib-par-project.xml", readonly = true)
private File buildAssemblyFile;
/**
* The Maven Project Object
*/
@Parameter(property = "project", required = true, readonly = true)
protected MavenProject project;
/**
* The Maven Session Object
*/
@Parameter(property = "session", required = true, readonly = true)
protected MavenSession session;
/**
* The Maven PluginManager Object
*/
@Component
protected BuildPluginManager buildPluginManager;
public void execute() throws MojoFailureException, MojoExecutionException {
packageIibBarArtifact();
}
private void packageIibBarArtifact() throws MojoFailureException, MojoExecutionException {
InputStream is = this.getClass().getResourceAsStream("/assemblies/iib-par-project.xml");
FileOutputStream fos;
buildAssemblyFile.getParentFile().mkdirs();
try {
fos = new FileOutputStream(buildAssemblyFile);
} catch (FileNotFoundException e) {
// should never happen, as the file is packaged in this plugin's jar
throw new MojoFailureException("Error creating the build assembly file: " + buildAssemblyFile, e);
}
try {
IOUtil.copy(is, fos);
} catch (IOException e) {
// should never happen
throw new MojoFailureException("Error creating the assembly file: " + buildAssemblyFile.getAbsolutePath(), e);
}
// mvn org.apache.maven.plugins:maven-assembly-plugin:2.4:single -Ddescriptor=target\assemblies\iib-classloader-project.xml -Dassembly.appendAssemblyId=false
// for par packaging, the assembly plugin needs the par-archiver dependency
List<Dependency> dependencies = new ArrayList<Dependency>();
dependencies.add(dependency("ch.sbb.wmb.utils", "par-archiver", "1.1.0"));
executeMojo(plugin(groupId("org.apache.maven.plugins"), artifactId("maven-assembly-plugin"), version("2.4"), dependencies), goal("single"),
configuration(
element(name("descriptorRefs"), element("descriptorRef", "par")),
element(name("ignoreDirFormatExtensions"), "false"),
element(name("appendAssemblyId"), "false")), executionEnvironment(project, session, buildPluginManager));
// delete the archive-tmp directory
try {
FileUtils.deleteDirectory(new File(project.getBuild().getDirectory(), "archive-tmp"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"jamie.townsend@sbb.ch"
] | jamie.townsend@sbb.ch |
ccdae4947904714e059ba8c237ea53a185070ffc | 5d4acebd365fa0b143966dc79ab45f34ed1f3e8c | /app/src/main/java/com/usmc/usmcdrummer/pftcalculator/pftwhatiffrag.java | 0bb77b0fca716554982d8c62042b4f3311d46f1a | [] | no_license | hcknbrgr/PFTCalculator | 1e63867f196472fe7312a065b02614a9eadece31 | 51a1cc0c3fe2b277829fd51ac3a81fb3f76f91b6 | refs/heads/master | 2022-02-11T22:25:21.520821 | 2022-01-23T04:19:43 | 2022-01-23T04:19:43 | 159,081,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,680 | java | package com.usmc.usmcdrummer.pftcalculator;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.service.autofill.Validator;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.SpannableStringBuilder;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class pftwhatiffrag extends Fragment implements AdapterView.OnItemSelectedListener {
boolean gender = true;
String agegroup = "";
int ageGroupPos = 0;
boolean pullupsSelected = true;
boolean runningSelected = true;
boolean plankSelected = false;
int scoreClass = 0;
int desiredScore = 0;
boolean elevation = true;
ArrayList<String> scoreArrayList = new ArrayList<>();
ArrayAdapter<String> scoreAdapter;
Spinner scoreSpinner;
View rootView;
public pftwhatiffrag() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_pftwhatiffrag, container, false);
rootView = view;
MainActivity profileGetter = (MainActivity)getActivity();
String userProfile = profileGetter.getUserProfile();
String userGender = userProfile.substring(0,1);//0 male 1 female
String userAge = userProfile.substring(1);//position of spinner
Spinner ageSpinner = view.findViewById(R.id.age_spinner);
ageSpinner.setOnItemSelectedListener(this);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this.getActivity(),
R.array.age_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
ageSpinner.setAdapter(adapter);
ageSpinner.setSelection(Integer.parseInt(userAge));
Spinner crunchSpinner = view.findViewById(R.id.crunchplank_spinner);
crunchSpinner.setOnItemSelectedListener(this);
ArrayAdapter<CharSequence> crunchAdapter = ArrayAdapter.createFromResource(this.getActivity(),R.array.crunchplank_array, android.R.layout.simple_spinner_item);
crunchAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
crunchSpinner.setAdapter(crunchAdapter);
Spinner pushpullSpinner = view.findViewById(R.id.pushpull_spinner);
pushpullSpinner.setOnItemSelectedListener(this);
ArrayAdapter<CharSequence> pushpulladapter = ArrayAdapter.createFromResource(this.getActivity(),
R.array.pushpull_array, android.R.layout.simple_spinner_item);
pushpulladapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
pushpullSpinner.setAdapter(pushpulladapter);
Spinner runrowSpinner = view.findViewById(R.id.runrow_spinner);
runrowSpinner.setOnItemSelectedListener(this);
ArrayAdapter<CharSequence> runrowadapter = ArrayAdapter.createFromResource(this.getActivity(),
R.array.runrow_array, android.R.layout.simple_spinner_item);
runrowadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
runrowSpinner.setAdapter(runrowadapter);
scoreSpinner = view.findViewById(R.id.score_spinner);
scoreAdapter = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_dropdown_item, scoreArrayList);
scoreAdapter.add("First Class (235+)");
scoreAdapter.add("Second Class (200–234)");
scoreAdapter.add("Third Class (150–199)");
scoreAdapter.add("Select your own score (150-300)");
scoreSpinner.setAdapter(scoreAdapter);
scoreSpinner.setOnItemSelectedListener(this);
RadioButton maleRadioButton = view.findViewById(R.id.radio_male);
RadioButton femaleRadioButton = view.findViewById(R.id.radio_female);
if(userGender.equals("0"))
maleRadioButton.setChecked(true);
else {
femaleRadioButton.setChecked(true);
gender = false;
}
Button calculateButton = view.findViewById(R.id.calculate_button);
calculateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
calculateScore(view);
}
});
Button howToButton = view.findViewById(R.id.howto_button);
howToButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showHowTo(view);
}
});
final EditText runMinET = view.findViewById(R.id.runtime_minutes_text_input);
final EditText runSecET = view.findViewById(R.id.runtime_seconds_text_input);
runMinET.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(runMinET.getText().toString().length()==2)
runSecET.requestFocus();
}
@Override
public void afterTextChanged(Editable s) {
}
});
final EditText plankMinutes = view.findViewById(R.id.crunches_text_input);
final EditText plankSeconds = view.findViewById(R.id.plank_seconds);
plankMinutes.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(plankSelected)
if(plankMinutes.getText().toString().length()==1)
plankSeconds.requestFocus();
}
@Override
public void afterTextChanged(Editable s) {
}
});
final RadioGroup radioGroup = view.findViewById(R.id.radio_gender);
radioGroup.setOnCheckedChangeListener(
new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.radio_male: //Male
gender = true;
break;
case R.id.radio_female: //Female
gender = false;
break;
default:
break;
}
}
});
CheckBox checkboxvariable = view.findViewById(R.id.elevation_checkbox);
checkboxvariable.setOnCheckedChangeListener(
new CheckBox.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
elevation = !elevation;
}
});
return view;
}
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) {
// An item was selected. You can retrieve the selected item using
switch (parent.getId()) {
case R.id.age_spinner:
agegroup = parent.getItemAtPosition(pos).toString();
ageGroupPos = pos;
break;
case R.id.pushpull_spinner:
if (parent.getItemAtPosition(pos).toString().equals("Pullups"))
pullupsSelected = true;
else pullupsSelected = false;
break;
case R.id.runrow_spinner:
if (parent.getItemAtPosition(pos).toString().equals("Row Time"))
runningSelected = false;
else runningSelected = true;
break;
case R.id.score_spinner:
scoreClass = pos; //0=first, 1=second, 2-third, 3-user defined
if (scoreClass == 0)
desiredScore = 235;
else if (scoreClass == 1)
desiredScore = 200;
else if (scoreClass == 2)
desiredScore = 150;
else if (scoreClass == 3)
setUserDefinedScore();
else {
desiredScore = Integer.parseInt(scoreSpinner.getItemAtPosition(4).toString());
setScoreClass(desiredScore);
}
break;
case R.id.crunchplank_spinner:
if (parent.getItemAtPosition(pos).toString().equals("Plank Time"))
{
plankSelected = true;
TextView colon = rootView.findViewById(R.id.plank_colon);
colon.setVisibility(View.VISIBLE);
EditText plankSeconds = rootView.findViewById(R.id.plank_seconds);
plankSeconds.setVisibility(View.VISIBLE);
EditText crunchInput = rootView.findViewById(R.id.crunches_text_input);
crunchInput.setNextFocusDownId(R.id.plank_seconds);
crunchInput.requestFocus();
}
else {
plankSelected = false;
TextView colon = rootView.findViewById(R.id.plank_colon);
colon.setVisibility(View.GONE);
EditText plankSeconds = rootView.findViewById(R.id.plank_seconds);
plankSeconds.setVisibility(View.GONE);
EditText crunchInput = rootView.findViewById(R.id.crunches_text_input);
crunchInput.setNextFocusDownId(R.id.runtime_minutes_text_input);
}
}
}
private void setUserDefinedScore() {
LayoutInflater alertInflater = LayoutInflater.from(this.getActivity());
final View inflator = alertInflater.inflate(R.layout.userdefinedscorelayout, null);
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this.getActivity());
alertDialogBuilder.setView(inflator);
final EditText editTextScore = (EditText) inflator.findViewById(R.id.score_text_input);
alertDialogBuilder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
final String temp = Integer.toString(desiredScore);
desiredScore = retrieveValue(editTextScore);
if ((desiredScore < 150) || (desiredScore > 300)) {
Toast.makeText(getActivity(), "Please enter a score between 150 and 300!", Toast.LENGTH_LONG).show();
setUserDefinedScore();
} else {
setScoreClass(desiredScore);
if (scoreSpinner.getCount() == 5)
scoreAdapter.remove(temp);
scoreAdapter.add(Integer.toString(desiredScore));
scoreSpinner.setSelection(5);
scoreAdapter.notifyDataSetChanged();
}
}
});
alertDialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
alertDialog.show();
}
private void setScoreClass(int score) {
if (score >= 235)
scoreClass = 0;
else if (score >= 200)
scoreClass = 1;
else scoreClass = 2;
}
public void onNothingSelected(AdapterView<?> parent) {
// Another interface callback
}
private int retrieveValue(EditText edit) {
int value = 0;
String userInput = "";
userInput = edit.getText().toString();
try {
value = Integer.parseInt(userInput);
} catch (NumberFormatException ex) {
value = 0;
}
return value;
}
public void calculateScore(View view) {
int tempPull = 0;
int tempCrunch = 0;
int tempPlankSeconds = 0;
int tempRunMin = 0;
int tempRunSec = 0;
SpannableStringBuilder results = new SpannableStringBuilder();
tempPull = retrieveValue((EditText) view.findViewById(R.id.pullups_text_input));
tempCrunch = retrieveValue((EditText) view.findViewById(R.id.crunches_text_input));
tempPlankSeconds = retrieveValue((EditText) view.findViewById(R.id.plank_seconds));
tempRunMin = retrieveValue((EditText) view.findViewById(R.id.runtime_minutes_text_input));
tempRunSec = retrieveValue((EditText) view.findViewById(R.id.runtime_seconds_text_input));
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this.getActivity());
if (tempRunSec > 59 || tempPlankSeconds > 59) {
results.append("Please enter a valid time for seconds (<60)");
} else {
PFT pft = new PFT(tempPull, pullupsSelected, tempCrunch, tempPlankSeconds, plankSelected,tempRunMin, tempRunSec, runningSelected, gender, ageGroupPos, elevation);
results.append(pft.getWhatIfResults(scoreClass, desiredScore, agegroup));
}
alertDialogBuilder.setMessage(results);
alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
public void showHowTo(View view) {
SpannableStringBuilder message = new SpannableStringBuilder();
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this.getActivity());
message.append("Select what score you wish to achieve and leave one, two, or all three events empty. \n\n" +
"The calculator will tell you what you need to achieve to get the desired score.");
alertDialogBuilder.setMessage(message);
alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
| [
"hcknbrgr@gmail.com"
] | hcknbrgr@gmail.com |
c7169e3b0d9496ff1d0b460c91dbfaf751fdcfc9 | bc3c7b0641fd04277e3cd670f36c19f3abec0f65 | /src/com/zx/Controller/Controller.java | baa2c83bf17b467f37eb37aad35d586ddb32d124 | [] | no_license | zhangxingits/train-mvc-cargoat-games | 1c30d1ab0a491919ca391bcff8a0b0ce7377b0d8 | 18198cf110993782c681d07f57f0bf342948711e | refs/heads/master | 2021-05-28T12:46:12.689244 | 2015-04-19T11:24:17 | 2015-04-19T11:24:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package com.zx.Controller;
import com.zx.Model.Model;
import com.zx.View.View;
public class Controller {
public static void main(String[] args) {
//this easy
View view=new View();
Model model = new Model();
model.addView(view);
view.update(model);
}
}
| [
"zxae868@gmail.com"
] | zxae868@gmail.com |
634dad20b4bf666d441563aedcdb39e4c780c230 | 2f21df6f2d225769dfef70aa0889948a91a533a3 | /week-06/day-4/Cookbook/src/main/java/com/example/demo/CookbookApplication.java | a7cd59993157d49f8b72d99a8e835345110c8119 | [] | no_license | green-fox-academy/rocksophie92 | eaffbb8495544e5db62f8e48a6487c906657b0a3 | d05b3f452fc06b6e9fca0eb9745b79169d2ebb7b | refs/heads/master | 2021-09-07T02:07:54.042528 | 2018-02-15T14:31:09 | 2018-02-15T14:31:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CookbookApplication {
public static void main(String[] args) {
SpringApplication.run(CookbookApplication.class, args);
}
}
| [
"toroksophie.92@gmail.com"
] | toroksophie.92@gmail.com |
10d52efeec7b1a54541f3002f4d57f401192f557 | c76e78581983830158b2a6f56b807e37132f4bba | /COCI/src/COCI_XX/coci09c1p1.java | 4f32d2b7cd9363c467900272b5315dff30450dd8 | [] | no_license | itslinotlie/competitive-programming-solutions | 7f72e27bbc53046174a95246598c3c9c2096b965 | b639ebe3c060bb3c0b304080152cc9d958e52bfb | refs/heads/master | 2021-07-17T17:48:42.639357 | 2021-05-29T03:07:47 | 2021-05-29T03:07:47 | 249,599,291 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,084 | java | // 11/16/2019
// https://dmoj.ca/problem/coci09c1p1
package COCI_XX;
import java.util.*;
import java.io.*;
public class C1P1Note {
final private static int BUFFER_SIZE = 1 << 16;
private static DataInputStream din = new DataInputStream(System.in);
private static byte[] buffer = new byte[BUFFER_SIZE];
private static int bufferPointer = 0, bytesRead = 0;
static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
public static void main (String[] args) throws IOException {
String temp = readLine();
switch (temp) {
case "8 7 6 5 4 3 2 1":
out.println("descending");
break;
case "1 2 3 4 5 6 7 8":
out.println("ascending");
break;
default:
out.println("mixed");
break;
}
exit();
}
public static String read() throws IOException {
byte[] ret = new byte[1024];
int idx = 0;
byte c = Read();
while (c <= ' ') {
c = Read();
}
do {
ret[idx++] = c;
c = Read();
} while (c != -1 && c != ' ' && c != '\n' && c != '\r');
return new String(ret, 0, idx);
}
public static String readLine() throws IOException {
byte[] buf = new byte[64]; // line length
int cnt = 0, c;
while ((c = Read()) != -1) {
if (c == '\n') {
break;
}
buf[cnt++] = (byte) c;
}
return new String(buf, 0, cnt);
}
public static int readInt() throws IOException {
int ret = 0;
byte c = Read();
while (c <= ' ') {
c = Read();
}
boolean neg = (c == '-');
if (neg) {
c = Read();
}
do {
ret = ret * 10 + c - '0';
} while ((c = Read()) >= '0' && c <= '9');
if (neg) {
return -ret;
}
return ret;
}
public static long readLong() throws IOException {
long ret = 0;
byte c = Read();
while (c <= ' ') {
c = Read();
}
boolean neg = (c == '-');
if (neg) {
c = Read();
}
do {
ret = ret * 10 + c - '0';
} while ((c = Read()) >= '0' && c <= '9');
if (neg) {
return -ret;
}
return ret;
}
public static double readDouble() throws IOException {
double ret = 0, div = 1;
byte c = Read();
while (c <= ' ') {
c = Read();
}
boolean neg = (c == '-');
if (neg) {
c = Read();
}
do {
ret = ret * 10 + c - '0';
} while ((c = Read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = Read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg) {
return -ret;
}
return ret;
}
private static void fillBuffer() throws IOException {
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1) {
buffer[0] = -1;
}
}
private static byte Read() throws IOException {
if (bufferPointer == bytesRead) {
fillBuffer();
}
return buffer[bufferPointer++];
}
static void flush() {
out.flush();
}
static void exit() throws IOException {
din.close();
out.close();
System.exit(0);
}
}
| [
"michael.li.web@gmail.com"
] | michael.li.web@gmail.com |
efe128994820eb2dc08e4d6fc04ae7c59797104f | 6ff29bcb7a35380329dfc495e1430d5f0d21036a | /src/main/java/com/pronoia/camel/splunk/httpec/bean/SplunkEventBuilderBean.java | 26373f0e7b387105a2b7da0220ab3197d242cc0c | [
"Apache-2.0"
] | permissive | sffej/camel-splunk-httpec | 3e87da86bb3af7d8b659853f4a7c062f25f5f5cb | 097443df8cd31e27b4967913eb66ad1745ea0bea | refs/heads/master | 2020-03-28T21:43:34.093307 | 2017-09-25T14:13:24 | 2017-09-25T14:13:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,898 | java | package com.pronoia.camel.splunk.httpec.bean;
import com.pronoia.splunk.eventcollector.eventbuilder.StringEventBuilder;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.camel.Body;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangeProperty;
import org.apache.camel.Handler;
import org.apache.camel.Headers;
import org.apache.camel.MessageHistory;
public class SplunkEventBuilderBean {
static final double MILLISECONDS_PER_SECOND = 1000.0;
static final int CALLING_ROUTE_LOCATION = 0;
static final int AUDIT_ROUTE_OFFSET = 1;
StringEventBuilder stringEventBuilder;
String overrideBody;
public SplunkEventBuilderBean() {
this.stringEventBuilder = new StringEventBuilder();
this.stringEventBuilder.includeSystemProperty("karaf.name", "container");
}
@Handler
public String buildEvent(@ExchangeProperty("CamelCreatedTimestamp") Date camelCreatedTimestamp,
@ExchangeProperty(Exchange.MESSAGE_HISTORY) List<MessageHistory> messageHistoryList,
@Headers Map<String, Object> messageHeaders,
@Body String body) throws Exception {
stringEventBuilder.setTimestamp(camelCreatedTimestamp.getTime() / MILLISECONDS_PER_SECOND);
for (Map.Entry<String, Object> entry : messageHeaders.entrySet()) {
if (entry.getValue() instanceof byte[]) {
continue;
}
if (entry.getValue() == null) {
continue;
}
if (getOverrideBody() != null && getOverrideBody().equals(entry.getKey().toString())) {
continue;
}
stringEventBuilder.setField(entry.getKey(), entry.getValue().toString());
}
stringEventBuilder.setField("CallingRouteId", messageHistoryList.get(CALLING_ROUTE_LOCATION).getRouteId());
stringEventBuilder.setField("TriggeredAuditRouteId", messageHistoryList.get(messageHistoryList.size() - AUDIT_ROUTE_OFFSET).getRouteId());
if (overrideBody == null) {
stringEventBuilder.setEventBody(body);
} else if (overrideBody.equals("audit")) {
String auditEvent = "UCLA.AuditCode:\"" + messageHeaders.get("UCLA.AuditCode").toString() + "\""
+ " UCLA.AuditSource:\"" + messageHeaders.get("UCLA.AuditSource").toString() + "\""
+ " UCLA.AuditReason:\"" + messageHeaders.get("UCLA.AuditReason").toString() + "\""
+ " UCLA.AuditText:\"" + messageHeaders.get("UCLA.AuditText").toString() + "\"";
stringEventBuilder.setEventBody(auditEvent);
} else {
stringEventBuilder.setEventBody(messageHeaders.get(overrideBody).toString());
}
return stringEventBuilder.build();
}
public boolean hasHost() {
return stringEventBuilder.hasDefaultHost();
}
public String getHost() {
return stringEventBuilder.getDefaultHost();
}
public void setHost(String host) {
stringEventBuilder.setDefaultHost(host);
}
public boolean hasIndex() {
return stringEventBuilder.hasDefaultIndex();
}
public String getIndex() {
return stringEventBuilder.getDefaultIndex();
}
public void setIndex(String index) {
stringEventBuilder.setDefaultIndex(index);
}
public boolean hasSource() {
return stringEventBuilder.hasDefaultSource();
}
public String getSource() {
return stringEventBuilder.getDefaultSource();
}
public void setSource(String source) {
stringEventBuilder.setDefaultSource(source);
}
public boolean hasSourcetype() {
return stringEventBuilder.hasDefaultSourcetype();
}
public String getSourcetype() {
return stringEventBuilder.getDefaultSourcetype();
}
public void setSourcetype(String sourcetype) {
stringEventBuilder.setDefaultSourcetype(sourcetype);
}
public String getOverrideBody() {
return overrideBody;
}
public void setOverrideBody(String overrideBody) {
this.overrideBody = overrideBody;
}
}
| [
"quinn@pronoia-solutions.com"
] | quinn@pronoia-solutions.com |
638f5a33633e1b2f8484d9e6ca5a8a5700a89eb9 | e515cf0db89d00c2557b7686f7bc5710352e9559 | /src/main/java/high_st_hospital/Nurse.java | f2fc85b1fc926807d0869f05f5ad937f112cab07 | [] | no_license | Dean110/hospital2 | 36450428a584439f9c0162b535b689b639df2571 | aad5c24a340485ff5a6372d14497679ef2b0a529 | refs/heads/master | 2021-05-03T08:00:14.594104 | 2018-02-09T03:40:05 | 2018-02-09T03:40:05 | 120,557,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 801 | java | package high_st_hospital;
import java.util.ArrayList;
public class Nurse extends Employee implements MedicalDuties {
private ArrayList<Patient> patientsUnderCare = new ArrayList<Patient>();
public Nurse(String empName, String empNumber) {
this.empName = empName;
this.empNumber = empNumber;
}
@Override
public int getSalary() {
return 50000;
}
public void lookAfter(Patient patient) {
patientsUnderCare.add(patient);
}
public int numberOfPatients() {
return patientsUnderCare.size();
}
@Override
public void careForPatient(Patient patient) {
patient.improveHealth(5);
}
@Override
public void drawBloods(Patient patient) {
patient.giveBloods(5);
}
@Override
public String toString() {
return empName + "\t" + empNumber + "\t" + this.numberOfPatients();
}
}
| [
"deanpbr@gmail.com"
] | deanpbr@gmail.com |
23d2b4ba59eac8e31540f1754f6341eb3ad031ea | a9fcd509b522147ba955f5ccb5145651dfba74d1 | /src/main/java/com/wakin/tech/designpattern/structure/strategyPattern/Test.java | b648ea45374512f3192d16dedd176e6aea8060ea | [] | no_license | wakin12138/design-pattern | 34590fe92beadb4f8ac61ced3b6f6207e50db081 | 4e8341d29f7f469f7b51e2a93603dee9a448d10b | refs/heads/master | 2020-04-09T18:54:53.922748 | 2019-10-04T03:09:41 | 2019-10-04T03:09:41 | 160,528,012 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package com.wakin.tech.designpattern.structure.strategyPattern;
public class Test {
public static void main(String args[])
{
int arr[]={1,4,6,2,5,3,7,10,9};
int result[];
ArrayHandler ah=new ArrayHandler();
Sort sort = new SelectSort(); //使用选择排序
ah.setSortObj(sort); //设置具体策略
result=ah.sort(arr);
for(int i=0;i<result.length;i++)
{
System.out.print(result[i] + ",");
}
}
}
| [
"huajian9206@163.com"
] | huajian9206@163.com |
6ae7c1688fb2173ff2b1e572fda85890bd31a6bd | 8ef0b19edcb4e8db78bb1da760a63ced02c34f69 | /app/src/main/java/mom/com/WebService/RestapiCall.java | e723a45dfca16fddf8e3098166b64bbca6801f9a | [] | no_license | sagar2938/mom_user_android | 8b7831385a26d29617986ec91f3a3c69cd492d98 | 920d2e4ffb0235c38b0d48ed48a57aabedca86f4 | refs/heads/master | 2023-02-08T12:50:16.568330 | 2020-12-31T11:04:02 | 2020-12-31T11:04:02 | 325,717,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package mom.com.WebService;
import android.content.Context;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
public class RestapiCall {
private static RestapiCall mInstance;
private static Context mContext;
private RequestQueue mRequestQueue;
private RestapiCall(Context context){
mContext = context;
mRequestQueue = getRequestQueue();
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(mContext.getApplicationContext());
}
return mRequestQueue;
}
public static synchronized RestapiCall getInstance(Context context) {
if (mInstance == null) {
mInstance = new RestapiCall(context);
}
return mInstance;
}
public <T> void addToRequestQueue(Request<T> req) {
getRequestQueue().add(req);
}
}
| [
"vbula@manh.com"
] | vbula@manh.com |
2e3df7617b06d76c9cbaac93909c7f704125af07 | bbe30b68de029e91752c44a31d7b77c54fb8d805 | /orientation/app/src/androidTest/java/com/wjjzst/orientation/ExampleInstrumentedTest.java | a299617710ee5ad03250aba598e8d22bd435bc26 | [] | no_license | lyyzwjj/android | dc7ee9eed63b206c9a51464adeb7b3c36f10a22b | 064df89bcea0fbaeea5c430ededade5cd6d8e339 | refs/heads/master | 2022-04-02T20:49:59.921471 | 2020-01-15T18:46:08 | 2020-01-15T18:46:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package com.wjjzst.orientation;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.wjjzst.orientation", appContext.getPackageName());
}
}
| [
"wzzst310@163.com"
] | wzzst310@163.com |
e9eab1c56d8b69a3f72a485f4b2b8ae2485e4a48 | c5449e9a00e00b8cf2bb10aad867a44de6ad5991 | /Sunday/.apt_generated/tk/woppo/sunday/ui/fragment/DrawerFragment_.java | 14f9bbb2051828c6d5b1eff9e41921bfec1b809f | [] | no_license | Mike520/workspaces | b06faf588344dd920192c4da4028b1c3d37cee65 | 437b00a0cb13a8b78e0aae366bf422cf918723a8 | refs/heads/master | 2021-01-14T12:02:17.267184 | 2016-07-18T06:39:51 | 2016-07-18T06:39:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,168 | java | //
// DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations 3.0.1.
//
package tk.woppo.sunday.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import org.androidannotations.api.view.HasViews;
import org.androidannotations.api.view.OnViewChangedListener;
import org.androidannotations.api.view.OnViewChangedNotifier;
import tk.woppo.sunday.R.layout;
public final class DrawerFragment_
extends DrawerFragment
implements HasViews, OnViewChangedListener
{
private final OnViewChangedNotifier onViewChangedNotifier_ = new OnViewChangedNotifier();
private View contentView_;
@Override
public void onCreate(Bundle savedInstanceState) {
OnViewChangedNotifier previousNotifier = OnViewChangedNotifier.replaceNotifier(onViewChangedNotifier_);
init_(savedInstanceState);
super.onCreate(savedInstanceState);
OnViewChangedNotifier.replaceNotifier(previousNotifier);
}
public View findViewById(int id) {
if (contentView_ == null) {
return null;
}
return contentView_.findViewById(id);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
contentView_ = super.onCreateView(inflater, container, savedInstanceState);
if (contentView_ == null) {
contentView_ = inflater.inflate(layout.fragment_drawer, container, false);
}
return contentView_;
}
private void init_(Bundle savedInstanceState) {
OnViewChangedNotifier.registerOnViewChangedListener(this);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
onViewChangedNotifier_.notifyViewChanged(this);
}
public static DrawerFragment_.FragmentBuilder_ builder() {
return new DrawerFragment_.FragmentBuilder_();
}
@Override
public void onViewChanged(HasViews hasViews) {
ivWeatherImg = ((ImageView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_weather_img));
tvChuanyi = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_chuanyi));
tvGanmao = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_ganmao));
ivWeather = ((ImageView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_weather));
tvXiche = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_xiche));
tvTemp = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_temp));
tvTigan = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_tigan));
tvWeather = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_tv_weather));
tvZhiwaixian = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_ziwaixian));
tvYundong = ((TextView) hasViews.findViewById(tk.woppo.sunday.R.id.drawer_yundong));
{
View view = hasViews.findViewById(tk.woppo.sunday.R.id.drawer_add_city);
if (view!= null) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
DrawerFragment_.this.clickAddCity();
}
}
);
}
}
{
View view = hasViews.findViewById(tk.woppo.sunday.R.id.drawer_del_city);
if (view!= null) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
DrawerFragment_.this.clickDelCity();
}
}
);
}
}
{
View view = hasViews.findViewById(tk.woppo.sunday.R.id.drawwer_setting);
if (view!= null) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
DrawerFragment_.this.clickSetting();
}
}
);
}
}
{
View view = hasViews.findViewById(tk.woppo.sunday.R.id.drawer_exit);
if (view!= null) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
DrawerFragment_.this.clickExit();
}
}
);
}
}
initFragment();
}
public static class FragmentBuilder_ {
private Bundle args_;
private FragmentBuilder_() {
args_ = new Bundle();
}
public DrawerFragment build() {
DrawerFragment_ fragment_ = new DrawerFragment_();
fragment_.setArguments(args_);
return fragment_;
}
}
}
| [
"mdjros123@gmail.com"
] | mdjros123@gmail.com |
c881bf3b32722c10fabdd0305d6e69b02bcc8454 | fc3a10825bd535a20ceda45d4e025ec7f8cde74d | /src/java/org/archive/bacon/Catenate.java | 88b2ba9824011eea4b5a4a70fc05915ef4c9bbbd | [] | no_license | darkseed/bacon | e4dd49e329bf2b4c46ae5bb94c6dfc9800370eba | 5a42fcdf2e3d778d56e1d844e5f543df268cd5e7 | refs/heads/master | 2021-01-18T06:26:19.229553 | 2013-03-19T19:51:18 | 2013-03-19T19:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,564 | java | /*
* Copyright 2011 Internet Archive
*
* 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.archive.bacon;
import java.io.*;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.DataBag;
import org.apache.pig.data.DataType;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.logicalLayer.schema.Schema;
/**
* Catenate all strings in the given input, with a delimiter string.
* Kinda/sorta approximates Python str.join().
*
* If any input object is a tuple or bag, it is traversed recursively
* and the all strings found within are catenated, separated by the
* given delimiter.
*/
public class Catenate extends EvalFunc<String>
{
public Catenate( )
throws IOException
{
}
public String exec( Tuple input )
throws IOException
{
if ( input == null || input.size() < 2 ) return null;
String delim = input.get(0).toString();
StringBuilder sb = new StringBuilder();
for ( int i = 1 ; i < input.size() ; i++ )
{
cat( sb, input.get(i), delim );
}
return sb.toString();
}
public void cat( StringBuilder sb, Object input, String delim )
throws IOException
{
if ( input == null ) return;
if ( input instanceof Tuple )
{
Tuple tuple = (Tuple) input;
for ( Object o : tuple.getAll( ) )
{
cat( sb, o, delim );
}
}
else if ( input instanceof DataBag )
{
DataBag bag = (DataBag) input;
for ( Tuple t : bag )
{
for ( Object o : t.getAll( ) )
{
cat( sb, o, delim );
}
}
}
else
{
String s = input.toString();
s = s.trim();
if ( s.length() > 0 )
{
sb.append( s ).append( delim );
}
}
}
@SuppressWarnings("deprecation")
@Override
public Schema outputSchema(Schema input)
{
return new Schema( new Schema.FieldSchema( null, DataType.CHARARRAY ) );
}
}
| [
"aaron@archive.org"
] | aaron@archive.org |
0553647b43ecdeefd7f87ab13d8ee3d8be316684 | 79c8a709a9dc6767d244acff3910942ada212949 | /src/FacadePattern/ClassThree.java | c3a80dda2fabb3cec4fb1f26b48defbeba69c588 | [] | no_license | sruthidanda5a9/DesignPattern | 5e1050cc3e6f1b2b12737c96bb75ad21233e1321 | aa48ad9aa6a7ad147aaa4ed00b7d07f7d30dc861 | refs/heads/master | 2020-12-30T15:29:28.274459 | 2017-05-13T02:39:01 | 2017-05-13T02:39:01 | 91,143,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 126 | java | package FacadePattern;
public class ClassThree {
public void sayHello(){
System.out.println("Hello from class3");
}
}
| [
"go2partners@go2partnerssmbp.hsd1.il.comcast.net"
] | go2partners@go2partnerssmbp.hsd1.il.comcast.net |
c01204e9f80b3c6dadb16f3afacad6d43ec0c3c4 | 93010ce3e0f6a06cd9b1cdf4aa219e920530a442 | /src/main/java/com/stormclass/BaseObject.java | 574d62e28d650a93d1b852970503bf1fa8aeac32 | [] | no_license | yijiansheng/storm_prect2 | e641e87e97f97c0998b2825ec49e847cf185dbfe | bf3326a2f9b1a6fbd2553c316c496a5890d9b638 | refs/heads/master | 2021-01-23T09:45:40.962468 | 2018-03-27T09:12:00 | 2018-03-27T09:12:00 | 102,598,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.stormclass;
/**
* Author: changdalin
* Date: 2017/9/20
* Description:
**/
public class BaseObject {
public static void main(String[] args) {
Object o = new Object();
System.out.println(o.toString());
}
}
| [
"changdalin@autohome.com.cn"
] | changdalin@autohome.com.cn |
360759cd019c62f5360edf130567afacca3cb5d6 | 51473c415f2a968744d4ef4d5a31b5a2de4505e4 | /android/app/src/main/java/com/chetna_mo_dev_14139/MainApplication.java | 8e26e8e6208af65666bf0f4dfc5b208e86dc2baf | [] | no_license | crowdbotics-apps/chetna-mo-dev-14139 | 52bad6431bbbaad3b0fa7a90105a9083830fc79b | 8f371119e00bc1574ee4ed7dd8294c51981d2595 | refs/heads/master | 2023-01-04T23:12:38.625486 | 2020-10-31T20:13:57 | 2020-10-31T20:13:57 | 307,999,430 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,696 | java | package com.chetna_mo_dev_14139;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.rndiffapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"team@crowdbotics.com"
] | team@crowdbotics.com |
c8dc5c105bbf7ebde47875764e650d0d1bd3f222 | 795265016ea771c523b717cf534dabcb127248d1 | /src/entities/Hours.java | ae4e82e6b47a69bb8f6a42357c0b114c02656480 | [] | no_license | DobosN/WebFinal | 839e26da5f0adb709d28670f0086ede64fb4abff | 3d7b5bd21b4add0b32ea898f5df7416238f76e27 | refs/heads/master | 2023-03-15T01:33:03.691105 | 2021-03-02T21:26:36 | 2021-03-02T21:26:36 | 343,914,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 566 | java | package entities;
public class Hours {
private Integer hoursID;
private String hours;
public Hours() {
}
public Hours(Integer hoursID, String hours) {
this.hoursID = hoursID;
this.hours = hours;
}
public Integer getHoursID() {
return hoursID;
}
public void setHoursID(Integer hoursID) {
this.hoursID = hoursID;
}
public String getHours() {
return hours;
}
public void setHours(String hours) {
this.hours = hours;
}
@Override
public String toString() {
return "Hours hoursID = " + hoursID + ", hours = " + hours;
}
}
| [
"norbertdobos93@gmail.com"
] | norbertdobos93@gmail.com |
2c8dc9ea03cb7958de8e800cbf67615a4adb7f1e | ffa6f9bebf89a08687346f2e6cea6e54207ee4b4 | /Passwordprotect/src/com/password/protect/Privacy.java | 6b1ebedeceddc64f50f06ccd4d7223988608d779 | [
"Apache-2.0"
] | permissive | Lifestohack/Password-Protect | 176065f7d91812be77f99417f215d9bf9209b784 | c12d7254f0627fafb7a14e6a458ebaef76680faa | refs/heads/master | 2020-06-01T07:30:20.940285 | 2017-09-07T12:05:32 | 2017-09-07T12:05:32 | 17,018,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,066 | java | /* Copyright 2014 www.lifestohack.com
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.password.protect;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class Privacy extends Activity implements OnClickListener{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.security);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
} | [
"diwas.bhattarai@lifestohack.com"
] | diwas.bhattarai@lifestohack.com |
020eaab13d6b21bf5fe2133b743a8581cccec27f | 02e13ddc667a82f5aaa3dcf3e2ea699946d187bd | /src/File/File_1.java | c9e53c86bcd2f9e547cc145e92b6910fca2b7489 | [] | no_license | Wmt-Monica/javaSE2 | 54810dbbf4e029542cf74123d1536a2c173098f0 | ab8a8e7ce42ba216d6dc3b5b4dd796a1fd70c99d | refs/heads/master | 2023-01-09T10:45:54.874797 | 2020-11-17T09:21:46 | 2020-11-17T09:21:46 | 299,301,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,180 | java | package File;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class File_1 {
public static void main(String[] args) throws IOException {
//指定目录的文件对象,将目录的位置传入,如果使用反斜杠则要用两条,起到转义的作用,也可以受用单斜杠
File file1 = new File("D:\\123");
File file2 = new File("D:/123/JavaProgram");
File file3 = new File("java.txt"); //当不指定路径则会默认在指定本目录下
//打印文件对象只是将文件对象的指定地址打印出来,如果需要打印文件内容则需要用到IO流中的内容
System.out.println("file1:"+file1);
System.out.println("file2:"+file2);
//可以对文件进行改文件名的操作
file2.renameTo(new File("D:\\123\\JavaProgramTest"));
//格式化时间:输出文件最后一次修改的时间的输出格式
SimpleDateFormat simpleDateFormat= new SimpleDateFormat("YYYY-MM-dd hh:mm:ss");
Date date = new Date(file1.lastModified()); //file1.lastModified()输出file1文件最后一次修改的时间参数传入
String str = simpleDateFormat.format(date);
//除此之外File还有很多其他的方法
System.out.println("File文件是否存在:"+file1.exists());
System.out.println("File文件是否为一个目录:"+file1.isDirectory());
System.out.println("File是否是一个文件:"+file1.isFile());
System.out.println("File最后修改的时间:"+str);
System.out.println("File的所占内存大小:"+file1.length());
System.out.println("File的文件名:"+file1.getName());
System.out.println("File的目录路径:"+file3.getPath());//如果文件指向当前目录则用getPath()方法只是会打相对路径
System.out.println("File的目录路径:"+file3.getAbsolutePath());//用getAbsolutePath()则会打印出绝对路径
//创建文件
File file4 = new File("D:\\123\\JavaProgramTest\\one.txt");
System.out.println("file4是否存在:"+file4.exists());//创建前判断文件是否存在fault
file4.createNewFile(); //此处需要抛出或者捕捉一下 IOException异常
System.out.println("file4是否存在:"+file4.exists());//创建后判断文件是否存在true
//删除文件
file4.delete();
System.out.println("file4删除后是否存在:"+file4.exists());
/**
* mkdir()和mkdirs()方法的区别
* */
File file5 = new File("D:\\123\\JavaProgram\\two");
System.out.println("file5是否存在:"+file5.exists());
//使用mkdir()方法创建树目录在中间除了最后文件夹之外只要有一个不存在则创建失败
file5.mkdir();
System.out.println("file5是否创建成功:"+file5.exists());
//使用mkdirs()方法创建树目录,假如目录中间不存在的目录就会创建一个完整的目录
file5.mkdirs();
System.out.println("file5是否创建成功:"+file5.exists());
}
}
| [
"3040988158@qq.com"
] | 3040988158@qq.com |
1c504d3e0986f65c0e05bac92ff022f04329849a | 2995b9200d5e0b20bbe03e597a9ed95c4506994f | /Western/src/westernjava/Bartender.java | 99a983207474d86a4e22bd049197af06a2538426 | [] | no_license | leximatias/JAVA2 | b45aa8ce9c137bae4777976a77472edcc897fc7c | 23c3f37e21b8f8517179975c4f73e82ca8c9363f | refs/heads/master | 2020-04-08T03:31:49.476391 | 2018-11-25T02:42:18 | 2018-11-25T02:42:18 | 158,979,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,599 | 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 westernjava;
/**
* characterizes the Bartender Human type
*
* @author Matias & Suarez
*/
public class Bartender extends Human {
/**
* constructor
*
* @param name name of the character
* @param favoriteDrink favorite drink of the character
* @param place character's current place
* /
*/
public Bartender(String name, String favoriteDrink, Places place, String barName) {
super(name, favoriteDrink, place);
// this.barName=barName;
}
/**
* serve a drink to someone
*
* @param someone someone
*/
public void serve(Human someone) {
action(this.name + " serves a glass to " + someone.name);
talk("Here is your drink," + someone.name +"." );
}
/**
* formatting his speech in the console
*
* @param say what he says
*/
@Override
public void talk(String say) {
System.out.println("Bartender " + name + ": " + say);
}
/**
* introduces himself
*/
@Override
public void introduceYourself() {
action(this.name + " presents.");
talk("Helo " + name + ", it is a pleasure to serve you!");
}
}
| [
"victoria.matias@obf.ateneo.edu"
] | victoria.matias@obf.ateneo.edu |
7576056985c789bb3beb37f5fe0ae57800a93805 | c19cb77e3958a194046d6f84ca97547cc3a223c3 | /core/src/main/j2me/org/bouncycastle/util/Shorts.java | 71f04fd029f2aabe7abff87a1c1171b861b049ad | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bcgit/bc-java | 1b6092bc5d2336ec26ebd6da6eeaea6600b4c70a | 62b03c0f704ebd243fe5f2d701aef4edd77bba6e | refs/heads/main | 2023-09-04T00:48:33.995258 | 2023-08-30T05:33:42 | 2023-08-30T05:33:42 | 10,416,648 | 1,984 | 1,021 | MIT | 2023-08-26T05:14:28 | 2013-06-01T02:38:42 | Java | UTF-8 | Java | false | false | 146 | java | package org.bouncycastle.util;
public class Shorts
{
public static Short valueOf(short value)
{
return new Short(value);
}
}
| [
"peter.dettman@bouncycastle.org"
] | peter.dettman@bouncycastle.org |
b7043a105a076673a9d8ad6a24b1de9ddeaafd19 | 96977a92194c1717692a9b1d9280139f3e087419 | /net.oliver.samples/src/net/oliver/j2se/concurrent/WaxOMatic2.java | 87c3f34b3037f96ad1cb74a7229a00bb2f502716 | [] | no_license | oliverswan/OliverGitRepo | 8dc011ef960b58bbca1418dab3e392ed5f3dfad1 | 1e135a29cd8117f0c8cec419f46f2719ee5e9b67 | refs/heads/master | 2016-09-06T02:25:39.174428 | 2012-07-17T01:20:51 | 2012-07-17T01:20:51 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,101 | java | package net.oliver.j2se.concurrent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
class Car2 {
private Lock lock = new ReentrantLock();
private Condition condition = lock.newCondition();
private boolean waxOn = false;
public void waxed() {
lock.lock();
try {
waxOn = true;
condition.signalAll();
} finally {
lock.unlock();
}
}
public void buffed() {
lock.lock();
try {
waxOn = false;
condition.signalAll();
} finally {
lock.unlock();
}
}
public void waitForWaxing() throws InterruptedException {
lock.lock();
try {
while (waxOn == false) {
condition.await();
}
} finally {
lock.unlock();
}
}
public void waitForBuffing() throws InterruptedException {
lock.lock();
try {
while (waxOn == true) {
condition.await();
}
} finally {
lock.unlock();
}
}
}
class WaxOn2 implements Runnable {
private Car2 car;
public WaxOn2(Car2 car) {
this.car = car;
}
public void run() {
try {
while (!Thread.interrupted()) {
System.out.println("Wax On!");
TimeUnit.MILLISECONDS.sleep(200);
car.waxed();
car.waitForBuffing();
}
} catch (InterruptedException e) {
System.out.println("Exiting via interrupt");
}
System.out.println("Ending Wax On task");
}
}
class WaxOff2 implements Runnable {
private Car2 car;
public WaxOff2(Car2 car) {
this.car = car;
}
public void run() {
try {
while (!Thread.interrupted()) {
car.waitForWaxing();
System.out.println("Wax Off");
TimeUnit.MILLISECONDS.sleep(200);
car.buffed();
}
} catch (InterruptedException e) {
System.out.println("Exiting via interrupt");
}
System.out.println("Ending Wax Off task");
}
}
public class WaxOMatic2 {
public static void main(String[] args) throws InterruptedException {
Car2 car = new Car2();
ExecutorService exec = Executors.newCachedThreadPool();
// 两个线程同时对car进行操作
exec.execute(new WaxOn2(car));
exec.execute(new WaxOff2(car));
TimeUnit.SECONDS.sleep(5);
exec.shutdownNow();
}
}
| [
"oliver_tech@126.com"
] | oliver_tech@126.com |
2a0f36c9b96f38981aeec7d39094b87c63003a07 | aae16a2750afc3e5a81620317447c2357cc1eb3b | /ko4j/src/main/java/org/netbeans/html/ko4j/KOTech.java | 32f0ea90a7da082a0b2f302c4795c78fc75251c3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | pzhao12testa/incubator-netbeans-html4j | b02a69911387c1e1686f01ebe6a15e8a9e5be4bf | 8245e5a5d41b2877aa38841c94a23128af53fc8f | refs/heads/master | 2020-04-20T04:33:27.369447 | 2019-01-26T08:14:13 | 2019-01-26T08:14:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,250 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.html.ko4j;
import java.util.List;
import net.java.html.json.Models;
import org.netbeans.html.context.spi.Contexts;
import org.netbeans.html.json.spi.FunctionBinding;
import org.netbeans.html.json.spi.PropertyBinding;
import org.netbeans.html.json.spi.Technology;
/** This is an implementation package - just
* include its JAR on classpath and use official {@link Context} API
* to access the functionality.
* <p>
*
* @author Jaroslav Tulach
*/
@Contexts.Id("ko4j")
final class KOTech
implements Technology.BatchCopy<Knockout>, Technology.ValueMutated<Knockout>,
Technology.ApplyId<Knockout>, Technology.ToJavaScript<Knockout> {
private Object[] jsObjects;
private int jsIndex;
public KOTech() {
}
@Override
public Knockout wrapModel(Object model, Object copyFrom, PropertyBinding[] propArr, FunctionBinding[] funcArr) {
return createKO(model, copyFrom, propArr, funcArr, null);
}
final Knockout createKO(Object model, Object copyFrom, PropertyBinding[] propArr, FunctionBinding[] funcArr, Knockout[] ko) {
String[] propNames = new String[propArr.length];
Number[] propInfo = new Number[propArr.length];
Object[] propValues = new Object[propArr.length];
for (int i = 0; i < propNames.length; i++) {
propNames[i] = propArr[i].getPropertyName();
int info =
(propArr[i].isReadOnly() ? 1 : 0) +
(propArr[i].isConstant()? 2 : 0);
propInfo[i] = info;
Object value = propArr[i].getValue();
if (value instanceof Enum) {
value = value.toString();
}
propValues[i] = value;
}
String[] funcNames = new String[funcArr.length];
for (int i = 0; i < funcNames.length; i++) {
funcNames[i] = funcArr[i].getFunctionName();
}
Object ret = getJSObject();
Knockout newKO = new Knockout(model, ret, propArr, funcArr);
if (ko != null) {
ko[0] = newKO;
}
Knockout.wrapModel(
newKO,
ret, copyFrom,
propNames, propInfo, propValues, funcNames
);
return newKO;
}
private Object getJSObject() {
int len = 64;
if (jsObjects != null && jsIndex < (len = jsObjects.length)) {
Object ret = jsObjects[jsIndex];
jsObjects[jsIndex] = null;
jsIndex++;
return ret;
}
jsObjects = Knockout.allocJS(len * 2);
jsIndex = 1;
Object ret = jsObjects[0];
jsObjects[0] = null;
return ret;
}
@Override
public Knockout wrapModel(Object model) {
throw new UnsupportedOperationException();
}
@Override
public void bind(PropertyBinding b, Object model, Knockout data) {
throw new UnsupportedOperationException();
}
@Override
public void valueHasMutated(Knockout data, String propertyName) {
valueHasMutated(data, propertyName, null, null);
}
@Override
public void valueHasMutated(Knockout data, String propertyName, Object oldValue, Object newValue) {
Knockout.cleanUp();
if (data != null) {
if (newValue instanceof Enum) {
newValue = newValue.toString();
}
Knockout.valueHasMutated(data.js(), propertyName, oldValue, newValue);
}
}
@Override
public void expose(FunctionBinding fb, Object model, Knockout data) {
throw new UnsupportedOperationException();
}
@Override
public void applyBindings(Knockout data) {
applyBindings(null, data);
}
@Override
public void applyBindings(String id, Knockout data) {
Object ko = Knockout.applyBindings(id, data.js());
if (ko instanceof Knockout) {
((Knockout)ko).hold();
applied.add((Knockout) ko);
}
}
private static final List<Knockout> applied = Models.asList();
@Override
public Object wrapArray(Object[] arr) {
return arr;
}
@Override
public void runSafe(final Runnable r) {
r.run();
}
@Override
public <M> M toModel(Class<M> modelClass, Object data) {
return modelClass.cast(Knockout.toModel(data));
}
@Override
public Object toJavaScript(Knockout data) {
return data.js();
}
}
| [
"jaroslav.tulach@oracle.com"
] | jaroslav.tulach@oracle.com |
62ef642b9317b978b33f6e05b2029c349f8f092c | 27f0c61910da9f10913bb7c5c2697a7e184843e5 | /server/src/net/minecraft/src/forestry/api/liquids/LiquidContainer.java | 503b9ea6207937762ae560dd0de3e31b1d5825b1 | [] | no_license | Tom-V/BucketFiller | 6daff4cc4dec26bfe742d9081712cb4cc94aeea3 | ac16dcb5efee7d55791ead60c826528454c17395 | refs/heads/master | 2016-08-08T11:32:13.628289 | 2012-04-29T12:40:07 | 2012-04-29T12:40:07 | 3,389,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package net.minecraft.src.forestry.api.liquids;
import net.minecraft.src.ItemStack;
/**
* Represents buckets/items that contain water.
*/
public class LiquidContainer {
/**
* Contained liquid.
*/
public LiquidStack liquid;
/**
* Item filled with water.
*/
public ItemStack filled;
/**
* Item without water.
*/
public ItemStack empty;
/**
* Bucket behaviour. Non-stackable, leaves {@link empty} after contents are consumed.
*/
public boolean isBucket;
public LiquidContainer(LiquidStack liquid, ItemStack filled, ItemStack empty, boolean isBucket)
{
this.liquid = liquid;
this.filled = filled;
this.empty = empty;
this.isBucket = isBucket;
}
}
| [
"tv.vervoort@gmail.com"
] | tv.vervoort@gmail.com |
9ac9bdd1f24b22499875457d2ad2e0082aabbe29 | 8ad7302bb063469972b04fd6a8cd967571e4128b | /src/main/java/kodlamaio/hrms/dataAccess/abstracts/PersonalDao.java | 0da5b8586556526b0c82db002b67080de39a4472 | [
"MIT"
] | permissive | semihshn/HRMS-Project | feed252d9c69e04c4500453edaedad78f6e7c39f | 198851918df9c8cba0ea950426c5fb9b773d121c | refs/heads/main | 2023-09-01T06:35:18.531166 | 2021-10-24T21:44:55 | 2021-10-24T21:44:55 | 366,198,523 | 16 | 2 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package kodlamaio.hrms.dataAccess.abstracts;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import kodlamaio.hrms.entities.concretes.Personal;
public interface PersonalDao extends JpaRepository<Personal, Integer>{
Personal findByUserId(int id);
Optional<Personal> findByUser_EmailAndUser_Password(String email,String password);
}
| [
"s.semih.sahan@hotmail.com"
] | s.semih.sahan@hotmail.com |
cf064f112071d26570039e6eccd1ca059d9ecec1 | 106250722f933531ece0bf0a66a8d6706f437eef | /src/main/java/com/tamnt/spring/sample/repository/TodoRepositoryCustom.java | 8d4d0e053a72bb5e9172a41b60ec0b76ef4bbe10 | [] | no_license | tamnguyenthanh20/taskandtodolist | ac9f19651df851a36262903470577b8431f522e5 | 65bf6a87a659daf0f920c38e17481da9d00678da | refs/heads/master | 2020-03-17T13:12:21.018426 | 2018-05-18T04:13:17 | 2018-05-18T05:51:48 | 133,621,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package com.tamnt.spring.sample.repository;
import com.tamnt.spring.sample.form.TodoSearchForm;
import com.tamnt.spring.sample.model.Todo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.time.LocalDate;
import java.util.List;
public interface TodoRepositoryCustom {
Page<Todo> findByConditionsPageable(TodoSearchForm todoSearchForm, Pageable pageable);
}
| [
"nguyen.thanh.tam@framgia.com"
] | nguyen.thanh.tam@framgia.com |
9360540ff1d46c15f10370b6e099d998da450dc3 | a8419a0fde2b4bfaa9c6c72214fd16b43955a01c | /src/main/java/com/bol/kalah/service/rule/EndPitRule.java | 999ab4fa4a0be660752a6fd7493e1e81ca02ec4a | [] | no_license | amit-dali/kalah-final | ad35e1a4d08efe2687b2c06d8b393bf330efc937 | 43845d40b722c01c7326664f05e0ec399db02474 | refs/heads/master | 2020-05-03T15:39:28.030999 | 2019-03-31T16:04:10 | 2019-03-31T16:04:10 | 178,707,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,931 | java | package com.bol.kalah.service.rule;
import static com.bol.kalah.helpers.PitHelper.MIN_STONE_COUNT;
import com.bol.kalah.helpers.GameHelper;
import com.bol.kalah.helpers.PitHelper;
import com.bol.kalah.model.Game;
import com.bol.kalah.model.Pit;
import lombok.extern.slf4j.Slf4j;
/**
* Holds logic to verify the last stone placing.
*
* @author AMDALI
*/
@Slf4j
public class EndPitRule extends KalahRuleProcessor {
public EndPitRule(KalahRuleProcessor nextProcessor) {
this.nextProcessor = nextProcessor;
}
@Override
public void apply(Game game, Pit endPit) {
log.info("enter apply");
log.debug("game = {}", game);
log.debug("pit = {}", endPit);
lastEmptyPitRule(game, endPit);
nextPlayerTurnRule(game, endPit);
if (nextProcessor != null) {
nextProcessor.apply(game, endPit);
}
log.info("exit apply");
}
/**
* @param game
* @param endPit
*/
private void lastEmptyPitRule(Game game, Pit endPit) {
log.info("enter lastEmptyPitRule");
log.debug("game = {}", game);
log.debug("pit = {}", endPit);
if (PitHelper.shouldApplyEmptyPitRule(game, endPit)) {
var oppositePit = game.getBoard().getOppositePit(endPit);
var house = game.getBoard().getPlayerHouse(endPit.getPlayerIndex());
var totalStoneCount = house.getStoneCount() + oppositePit.getStoneCount() + endPit.getStoneCount();
house.setStoneCount(totalStoneCount);
oppositePit.setStoneCount(MIN_STONE_COUNT);
endPit.setStoneCount(MIN_STONE_COUNT);
}
log.info("exit lastEmptyPitRule");
}
/**
* @param game
* @param endPit
*/
private void nextPlayerTurnRule(Game game, Pit endPit) {
log.info("enter nextPlayerTurnRue");
log.debug("game = {}", game);
log.debug("pit = {}", endPit);
var gameStatus = GameHelper.determineGameStatus(game, endPit);
game.setGameStatus(gameStatus);
game.updateTime();
log.info("exit nextPlayerTurnRue");
}
}
| [
"12517713+amit-dali@users.noreply.github.com"
] | 12517713+amit-dali@users.noreply.github.com |
45a08a4e600145cd4f4cb44b6500d589d2136d06 | 3ce7fece75b77dda5832bf89d217b0084fec5996 | /src/main/java/vedebug/asm/ClassWriter.java | e88c77ac87069a23c653a1dc937068eb7a1b1e0a | [
"Apache-2.0"
] | permissive | EngineeringSoftware/VeDebug | ff5b49e3cb5e1ab729a015f6b422d616bf8aab9f | ec46c786866d4858e7057675bfffdea388ad4595 | refs/heads/master | 2022-12-07T15:52:28.190564 | 2022-11-29T04:51:22 | 2022-11-29T04:51:22 | 170,969,258 | 9 | 1 | null | null | null | null | UTF-8 | Java | false | false | 42,558 | java | // ASM: a very small and fast Java bytecode manipulation framework
// Copyright (c) 2000-2011 INRIA, France Telecom
// 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. Neither the name of the copyright holders nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
package vedebug.asm;
/**
* A {@link ClassVisitor} that generates a corresponding ClassFile structure, as defined in the Java
* Virtual Machine Specification (JVMS). It can be used alone, to generate a Java class "from
* scratch", or with one or more {@link ClassReader} and adapter {@link ClassVisitor} to generate a
* modified class from one or more existing Java classes.
*
* @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html">JVMS 4</a>
* @author Eric Bruneton
*/
public class ClassWriter extends ClassVisitor {
/**
* A flag to automatically compute the maximum stack size and the maximum number of local
* variables of methods. If this flag is set, then the arguments of the {@link
* MethodVisitor#visitMaxs} method of the {@link MethodVisitor} returned by the {@link
* #visitMethod} method will be ignored, and computed automatically from the signature and the
* bytecode of each method.
*
* <p><b>Note:</b> for classes whose version is {@link Opcodes#V1_7} of more, this option requires
* valid stack map frames. The maximum stack size is then computed from these frames, and from the
* bytecode instructions in between. If stack map frames are not present or must be recomputed,
* used {@link #COMPUTE_FRAMES} instead.
*
* @see #ClassWriter(int)
*/
public static final int COMPUTE_MAXS = 1;
/**
* A flag to automatically compute the stack map frames of methods from scratch. If this flag is
* set, then the calls to the {@link MethodVisitor#visitFrame} method are ignored, and the stack
* map frames are recomputed from the methods bytecode. The arguments of the {@link
* MethodVisitor#visitMaxs} method are also ignored and recomputed from the bytecode. In other
* words, {@link #COMPUTE_FRAMES} implies {@link #COMPUTE_MAXS}.
*
* @see #ClassWriter(int)
*/
public static final int COMPUTE_FRAMES = 2;
// Note: fields are ordered as in the ClassFile structure, and those related to attributes are
// ordered as in Section 4.7 of the JVMS.
/**
* The minor_version and major_version fields of the JVMS ClassFile structure. minor_version is
* stored in the 16 most significant bits, and major_version in the 16 least significant bits.
*/
private int version;
/** The symbol table for this class (contains the constant_pool and the BootstrapMethods). */
private final SymbolTable symbolTable;
/**
* The access_flags field of the JVMS ClassFile structure. This field can contain ASM specific
* access flags, such as {@link Opcodes#ACC_DEPRECATED}, which are removed when generating the
* ClassFile structure.
*/
private int accessFlags;
/** The this_class field of the JVMS ClassFile structure. */
private int thisClass;
/** The super_class field of the JVMS ClassFile structure. */
private int superClass;
/** The interface_count field of the JVMS ClassFile structure. */
private int interfaceCount;
/** The 'interfaces' array of the JVMS ClassFile structure. */
private int[] interfaces;
/**
* The fields of this class, stored in a linked list of {@link FieldWriter} linked via their
* {@link FieldWriter#fv} field. This field stores the first element of this list.
*/
private FieldWriter firstField;
/**
* The fields of this class, stored in a linked list of {@link FieldWriter} linked via their
* {@link FieldWriter#fv} field. This field stores the last element of this list.
*/
private FieldWriter lastField;
/**
* The methods of this class, stored in a linked list of {@link MethodWriter} linked via their
* {@link MethodWriter#mv} field. This field stores the first element of this list.
*/
private MethodWriter firstMethod;
/**
* The methods of this class, stored in a linked list of {@link MethodWriter} linked via their
* {@link MethodWriter#mv} field. This field stores the last element of this list.
*/
private MethodWriter lastMethod;
/** The number_of_classes field of the InnerClasses attribute, or 0. */
private int numberOfInnerClasses;
/** The 'classes' array of the InnerClasses attribute, or {@literal null}. */
private ByteVector innerClasses;
/** The class_index field of the EnclosingMethod attribute, or 0. */
private int enclosingClassIndex;
/** The method_index field of the EnclosingMethod attribute. */
private int enclosingMethodIndex;
/** The signature_index field of the Signature attribute, or 0. */
private int signatureIndex;
/** The source_file_index field of the SourceFile attribute, or 0. */
private int sourceFileIndex;
/** The debug_extension field of the SourceDebugExtension attribute, or {@literal null}. */
private ByteVector debugExtension;
/**
* The last runtime visible annotation of this class. The previous ones can be accessed with the
* {@link AnnotationWriter#previousAnnotation} field. May be {@literal null}.
*/
private AnnotationWriter lastRuntimeVisibleAnnotation;
/**
* The last runtime invisible annotation of this class. The previous ones can be accessed with the
* {@link AnnotationWriter#previousAnnotation} field. May be {@literal null}.
*/
private AnnotationWriter lastRuntimeInvisibleAnnotation;
/**
* The last runtime visible type annotation of this class. The previous ones can be accessed with
* the {@link AnnotationWriter#previousAnnotation} field. May be {@literal null}.
*/
private AnnotationWriter lastRuntimeVisibleTypeAnnotation;
/**
* The last runtime invisible type annotation of this class. The previous ones can be accessed
* with the {@link AnnotationWriter#previousAnnotation} field. May be {@literal null}.
*/
private AnnotationWriter lastRuntimeInvisibleTypeAnnotation;
/** The Module attribute of this class, or {@literal null}. */
private ModuleWriter moduleWriter;
/** The host_class_index field of the NestHost attribute, or 0. */
private int nestHostClassIndex;
/** The number_of_classes field of the NestMembers attribute, or 0. */
private int numberOfNestMemberClasses;
/** The 'classes' array of the NestMembers attribute, or {@literal null}. */
private ByteVector nestMemberClasses;
/**
* The first non standard attribute of this class. The next ones can be accessed with the {@link
* Attribute#nextAttribute} field. May be {@literal null}.
*
* <p><b>WARNING</b>: this list stores the attributes in the <i>reverse</i> order of their visit.
* firstAttribute is actually the last attribute visited in {@link #visitAttribute}. The {@link
* #toByteArray} method writes the attributes in the order defined by this list, i.e. in the
* reverse order specified by the user.
*/
private Attribute firstAttribute;
/**
* Indicates what must be automatically computed in {@link MethodWriter}. Must be one of {@link
* MethodWriter#COMPUTE_NOTHING}, {@link MethodWriter#COMPUTE_MAX_STACK_AND_LOCAL}, {@link
* MethodWriter#COMPUTE_INSERTED_FRAMES}, or {@link MethodWriter#COMPUTE_ALL_FRAMES}.
*/
private int compute;
// -----------------------------------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------------------------------
/**
* Constructs a new {@link ClassWriter} object.
*
* @param flags option flags that can be used to modify the default behavior of this class. Must
* be zero or more of {@link #COMPUTE_MAXS} and {@link #COMPUTE_FRAMES}.
*/
public ClassWriter(final int flags) {
this(null, flags);
}
/**
* Constructs a new {@link ClassWriter} object and enables optimizations for "mostly add" bytecode
* transformations. These optimizations are the following:
*
* <ul>
* <li>The constant pool and bootstrap methods from the original class are copied as is in the
* new class, which saves time. New constant pool entries and new bootstrap methods will be
* added at the end if necessary, but unused constant pool entries or bootstrap methods
* <i>won't be removed</i>.
* <li>Methods that are not transformed are copied as is in the new class, directly from the
* original class bytecode (i.e. without emitting visit events for all the method
* instructions), which saves a <i>lot</i> of time. Untransformed methods are detected by
* the fact that the {@link ClassReader} receives {@link MethodVisitor} objects that come
* from a {@link ClassWriter} (and not from any other {@link ClassVisitor} instance).
* </ul>
*
* @param classReader the {@link ClassReader} used to read the original class. It will be used to
* copy the entire constant pool and bootstrap methods from the original class and also to
* copy other fragments of original bytecode where applicable.
* @param flags option flags that can be used to modify the default behavior of this class.Must be
* zero or more of {@link #COMPUTE_MAXS} and {@link #COMPUTE_FRAMES}. <i>These option flags do
* not affect methods that are copied as is in the new class. This means that neither the
* maximum stack size nor the stack frames will be computed for these methods</i>.
*/
public ClassWriter(final ClassReader classReader, final int flags) {
super(Opcodes.ASM7);
symbolTable = classReader == null ? new SymbolTable(this) : new SymbolTable(this, classReader);
if ((flags & COMPUTE_FRAMES) != 0) {
this.compute = MethodWriter.COMPUTE_ALL_FRAMES;
} else if ((flags & COMPUTE_MAXS) != 0) {
this.compute = MethodWriter.COMPUTE_MAX_STACK_AND_LOCAL;
} else {
this.compute = MethodWriter.COMPUTE_NOTHING;
}
}
// -----------------------------------------------------------------------------------------------
// Implementation of the ClassVisitor abstract class
// -----------------------------------------------------------------------------------------------
@Override
public final void visit(
final int version,
final int access,
final String name,
final String signature,
final String superName,
final String[] interfaces) {
this.version = version;
this.accessFlags = access;
this.thisClass = symbolTable.setMajorVersionAndClassName(version & 0xFFFF, name);
if (signature != null) {
this.signatureIndex = symbolTable.addConstantUtf8(signature);
}
this.superClass = superName == null ? 0 : symbolTable.addConstantClass(superName).index;
if (interfaces != null && interfaces.length > 0) {
interfaceCount = interfaces.length;
this.interfaces = new int[interfaceCount];
for (int i = 0; i < interfaceCount; ++i) {
this.interfaces[i] = symbolTable.addConstantClass(interfaces[i]).index;
}
}
if (compute == MethodWriter.COMPUTE_MAX_STACK_AND_LOCAL && (version & 0xFFFF) >= Opcodes.V1_7) {
compute = MethodWriter.COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES;
}
}
@Override
public final void visitSource(final String file, final String debug) {
if (file != null) {
sourceFileIndex = symbolTable.addConstantUtf8(file);
}
if (debug != null) {
debugExtension = new ByteVector().encodeUtf8(debug, 0, Integer.MAX_VALUE);
}
}
@Override
public final ModuleVisitor visitModule(
final String name, final int access, final String version) {
return moduleWriter =
new ModuleWriter(
symbolTable,
symbolTable.addConstantModule(name).index,
access,
version == null ? 0 : symbolTable.addConstantUtf8(version));
}
@Override
public void visitNestHost(final String nestHost) {
nestHostClassIndex = symbolTable.addConstantClass(nestHost).index;
}
@Override
public final void visitOuterClass(
final String owner, final String name, final String descriptor) {
enclosingClassIndex = symbolTable.addConstantClass(owner).index;
if (name != null && descriptor != null) {
enclosingMethodIndex = symbolTable.addConstantNameAndType(name, descriptor);
}
}
@Override
public final AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
// Create a ByteVector to hold an 'annotation' JVMS structure.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.16.
ByteVector annotation = new ByteVector();
// Write type_index and reserve space for num_element_value_pairs.
annotation.putShort(symbolTable.addConstantUtf8(descriptor)).putShort(0);
if (visible) {
return lastRuntimeVisibleAnnotation =
new AnnotationWriter(symbolTable, annotation, lastRuntimeVisibleAnnotation);
} else {
return lastRuntimeInvisibleAnnotation =
new AnnotationWriter(symbolTable, annotation, lastRuntimeInvisibleAnnotation);
}
}
@Override
public final AnnotationVisitor visitTypeAnnotation(
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
// Create a ByteVector to hold a 'type_annotation' JVMS structure.
// See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.20.
ByteVector typeAnnotation = new ByteVector();
// Write target_type, target_info, and target_path.
TypeReference.putTarget(typeRef, typeAnnotation);
TypePath.put(typePath, typeAnnotation);
// Write type_index and reserve space for num_element_value_pairs.
typeAnnotation.putShort(symbolTable.addConstantUtf8(descriptor)).putShort(0);
if (visible) {
return lastRuntimeVisibleTypeAnnotation =
new AnnotationWriter(symbolTable, typeAnnotation, lastRuntimeVisibleTypeAnnotation);
} else {
return lastRuntimeInvisibleTypeAnnotation =
new AnnotationWriter(symbolTable, typeAnnotation, lastRuntimeInvisibleTypeAnnotation);
}
}
@Override
public final void visitAttribute(final Attribute attribute) {
// Store the attributes in the <i>reverse</i> order of their visit by this method.
attribute.nextAttribute = firstAttribute;
firstAttribute = attribute;
}
@Override
public void visitNestMember(final String nestMember) {
if (nestMemberClasses == null) {
nestMemberClasses = new ByteVector();
}
++numberOfNestMemberClasses;
nestMemberClasses.putShort(symbolTable.addConstantClass(nestMember).index);
}
@Override
public final void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
if (innerClasses == null) {
innerClasses = new ByteVector();
}
// Section 4.7.6 of the JVMS states "Every CONSTANT_Class_info entry in the constant_pool table
// which represents a class or interface C that is not a package member must have exactly one
// corresponding entry in the classes array". To avoid duplicates we keep track in the info
// field of the Symbol of each CONSTANT_Class_info entry C whether an inner class entry has
// already been added for C. If so, we store the index of this inner class entry (plus one) in
// the info field. This trick allows duplicate detection in O(1) time.
Symbol nameSymbol = symbolTable.addConstantClass(name);
if (nameSymbol.info == 0) {
++numberOfInnerClasses;
innerClasses.putShort(nameSymbol.index);
innerClasses.putShort(outerName == null ? 0 : symbolTable.addConstantClass(outerName).index);
innerClasses.putShort(innerName == null ? 0 : symbolTable.addConstantUtf8(innerName));
innerClasses.putShort(access);
nameSymbol.info = numberOfInnerClasses;
}
// Else, compare the inner classes entry nameSymbol.info - 1 with the arguments of this method
// and throw an exception if there is a difference?
}
@Override
public final FieldVisitor visitField(
final int access,
final String name,
final String descriptor,
final String signature,
final Object value) {
FieldWriter fieldWriter =
new FieldWriter(symbolTable, access, name, descriptor, signature, value);
if (firstField == null) {
firstField = fieldWriter;
} else {
lastField.fv = fieldWriter;
}
return lastField = fieldWriter;
}
@Override
public final MethodVisitor visitMethod(
final int access,
final String name,
final String descriptor,
final String signature,
final String[] exceptions) {
MethodWriter methodWriter =
new MethodWriter(symbolTable, access, name, descriptor, signature, exceptions, compute);
if (firstMethod == null) {
firstMethod = methodWriter;
} else {
lastMethod.mv = methodWriter;
}
return lastMethod = methodWriter;
}
@Override
public final void visitEnd() {
// Nothing to do.
}
// -----------------------------------------------------------------------------------------------
// Other public methods
// -----------------------------------------------------------------------------------------------
/**
* Returns the content of the class file that was built by this ClassWriter.
*
* @return the binary content of the JVMS ClassFile structure that was built by this ClassWriter.
* @throws ClassTooLargeException if the constant pool of the class is too large.
* @throws MethodTooLargeException if the Code attribute of a method is too large.
*/
public byte[] toByteArray() throws ClassTooLargeException, MethodTooLargeException {
// First step: compute the size in bytes of the ClassFile structure.
// The magic field uses 4 bytes, 10 mandatory fields (minor_version, major_version,
// constant_pool_count, access_flags, this_class, super_class, interfaces_count, fields_count,
// methods_count and attributes_count) use 2 bytes each, and each interface uses 2 bytes too.
int size = 24 + 2 * interfaceCount;
int fieldsCount = 0;
FieldWriter fieldWriter = firstField;
while (fieldWriter != null) {
++fieldsCount;
size += fieldWriter.computeFieldInfoSize();
fieldWriter = (FieldWriter) fieldWriter.fv;
}
int methodsCount = 0;
MethodWriter methodWriter = firstMethod;
while (methodWriter != null) {
++methodsCount;
size += methodWriter.computeMethodInfoSize();
methodWriter = (MethodWriter) methodWriter.mv;
}
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
int attributesCount = 0;
if (innerClasses != null) {
++attributesCount;
size += 8 + innerClasses.length;
symbolTable.addConstantUtf8(Constants.INNER_CLASSES);
}
if (enclosingClassIndex != 0) {
++attributesCount;
size += 10;
symbolTable.addConstantUtf8(Constants.ENCLOSING_METHOD);
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && (version & 0xFFFF) < Opcodes.V1_5) {
++attributesCount;
size += 6;
symbolTable.addConstantUtf8(Constants.SYNTHETIC);
}
if (signatureIndex != 0) {
++attributesCount;
size += 8;
symbolTable.addConstantUtf8(Constants.SIGNATURE);
}
if (sourceFileIndex != 0) {
++attributesCount;
size += 8;
symbolTable.addConstantUtf8(Constants.SOURCE_FILE);
}
if (debugExtension != null) {
++attributesCount;
size += 6 + debugExtension.length;
symbolTable.addConstantUtf8(Constants.SOURCE_DEBUG_EXTENSION);
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
++attributesCount;
size += 6;
symbolTable.addConstantUtf8(Constants.DEPRECATED);
}
if (lastRuntimeVisibleAnnotation != null) {
++attributesCount;
size +=
lastRuntimeVisibleAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_ANNOTATIONS);
}
if (lastRuntimeInvisibleAnnotation != null) {
++attributesCount;
size +=
lastRuntimeInvisibleAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_ANNOTATIONS);
}
if (lastRuntimeVisibleTypeAnnotation != null) {
++attributesCount;
size +=
lastRuntimeVisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
++attributesCount;
size +=
lastRuntimeInvisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
}
if (symbolTable.computeBootstrapMethodsSize() > 0) {
++attributesCount;
size += symbolTable.computeBootstrapMethodsSize();
}
if (moduleWriter != null) {
attributesCount += moduleWriter.getAttributeCount();
size += moduleWriter.computeAttributesSize();
}
if (nestHostClassIndex != 0) {
++attributesCount;
size += 8;
symbolTable.addConstantUtf8(Constants.NEST_HOST);
}
if (nestMemberClasses != null) {
++attributesCount;
size += 8 + nestMemberClasses.length;
symbolTable.addConstantUtf8(Constants.NEST_MEMBERS);
}
if (firstAttribute != null) {
attributesCount += firstAttribute.getAttributeCount();
size += firstAttribute.computeAttributesSize(symbolTable);
}
// IMPORTANT: this must be the last part of the ClassFile size computation, because the previous
// statements can add attribute names to the constant pool, thereby changing its size!
size += symbolTable.getConstantPoolLength();
int constantPoolCount = symbolTable.getConstantPoolCount();
if (constantPoolCount > 0xFFFF) {
throw new ClassTooLargeException(symbolTable.getClassName(), constantPoolCount);
}
// Second step: allocate a ByteVector of the correct size (in order to avoid any array copy in
// dynamic resizes) and fill it with the ClassFile content.
ByteVector result = new ByteVector(size);
result.putInt(0xCAFEBABE).putInt(version);
symbolTable.putConstantPool(result);
int mask = (version & 0xFFFF) < Opcodes.V1_5 ? Opcodes.ACC_SYNTHETIC : 0;
result.putShort(accessFlags & ~mask).putShort(thisClass).putShort(superClass);
result.putShort(interfaceCount);
for (int i = 0; i < interfaceCount; ++i) {
result.putShort(interfaces[i]);
}
result.putShort(fieldsCount);
fieldWriter = firstField;
while (fieldWriter != null) {
fieldWriter.putFieldInfo(result);
fieldWriter = (FieldWriter) fieldWriter.fv;
}
result.putShort(methodsCount);
boolean hasFrames = false;
boolean hasAsmInstructions = false;
methodWriter = firstMethod;
while (methodWriter != null) {
hasFrames |= methodWriter.hasFrames();
hasAsmInstructions |= methodWriter.hasAsmInstructions();
methodWriter.putMethodInfo(result);
methodWriter = (MethodWriter) methodWriter.mv;
}
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
result.putShort(attributesCount);
if (innerClasses != null) {
result
.putShort(symbolTable.addConstantUtf8(Constants.INNER_CLASSES))
.putInt(innerClasses.length + 2)
.putShort(numberOfInnerClasses)
.putByteArray(innerClasses.data, 0, innerClasses.length);
}
if (enclosingClassIndex != 0) {
result
.putShort(symbolTable.addConstantUtf8(Constants.ENCLOSING_METHOD))
.putInt(4)
.putShort(enclosingClassIndex)
.putShort(enclosingMethodIndex);
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && (version & 0xFFFF) < Opcodes.V1_5) {
result.putShort(symbolTable.addConstantUtf8(Constants.SYNTHETIC)).putInt(0);
}
if (signatureIndex != 0) {
result
.putShort(symbolTable.addConstantUtf8(Constants.SIGNATURE))
.putInt(2)
.putShort(signatureIndex);
}
if (sourceFileIndex != 0) {
result
.putShort(symbolTable.addConstantUtf8(Constants.SOURCE_FILE))
.putInt(2)
.putShort(sourceFileIndex);
}
if (debugExtension != null) {
int length = debugExtension.length;
result
.putShort(symbolTable.addConstantUtf8(Constants.SOURCE_DEBUG_EXTENSION))
.putInt(length)
.putByteArray(debugExtension.data, 0, length);
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
result.putShort(symbolTable.addConstantUtf8(Constants.DEPRECATED)).putInt(0);
}
if (lastRuntimeVisibleAnnotation != null) {
lastRuntimeVisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_ANNOTATIONS), result);
}
if (lastRuntimeInvisibleAnnotation != null) {
lastRuntimeInvisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_ANNOTATIONS), result);
}
if (lastRuntimeVisibleTypeAnnotation != null) {
lastRuntimeVisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS), result);
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
lastRuntimeInvisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS), result);
}
symbolTable.putBootstrapMethods(result);
if (moduleWriter != null) {
moduleWriter.putAttributes(result);
}
if (nestHostClassIndex != 0) {
result
.putShort(symbolTable.addConstantUtf8(Constants.NEST_HOST))
.putInt(2)
.putShort(nestHostClassIndex);
}
if (nestMemberClasses != null) {
result
.putShort(symbolTable.addConstantUtf8(Constants.NEST_MEMBERS))
.putInt(nestMemberClasses.length + 2)
.putShort(numberOfNestMemberClasses)
.putByteArray(nestMemberClasses.data, 0, nestMemberClasses.length);
}
if (firstAttribute != null) {
firstAttribute.putAttributes(symbolTable, result);
}
// Third step: replace the ASM specific instructions, if any.
if (hasAsmInstructions) {
return replaceAsmInstructions(result.data, hasFrames);
} else {
return result.data;
}
}
/**
* Returns the equivalent of the given class file, with the ASM specific instructions replaced
* with standard ones. This is done with a ClassReader -> ClassWriter round trip.
*
* @param classFile a class file containing ASM specific instructions, generated by this
* ClassWriter.
* @param hasFrames whether there is at least one stack map frames in 'classFile'.
* @return an equivalent of 'classFile', with the ASM specific instructions replaced with standard
* ones.
*/
private byte[] replaceAsmInstructions(final byte[] classFile, final boolean hasFrames) {
final Attribute[] attributes = getAttributePrototypes();
firstField = null;
lastField = null;
firstMethod = null;
lastMethod = null;
lastRuntimeVisibleAnnotation = null;
lastRuntimeInvisibleAnnotation = null;
lastRuntimeVisibleTypeAnnotation = null;
lastRuntimeInvisibleTypeAnnotation = null;
moduleWriter = null;
nestHostClassIndex = 0;
numberOfNestMemberClasses = 0;
nestMemberClasses = null;
firstAttribute = null;
compute = hasFrames ? MethodWriter.COMPUTE_INSERTED_FRAMES : MethodWriter.COMPUTE_NOTHING;
new ClassReader(classFile, 0, /* checkClassVersion = */ false)
.accept(
this,
attributes,
(hasFrames ? ClassReader.EXPAND_FRAMES : 0) | ClassReader.EXPAND_ASM_INSNS);
return toByteArray();
}
/**
* Returns the prototypes of the attributes used by this class, its fields and its methods.
*
* @return the prototypes of the attributes used by this class, its fields and its methods.
*/
private Attribute[] getAttributePrototypes() {
Attribute.Set attributePrototypes = new Attribute.Set();
attributePrototypes.addAttributes(firstAttribute);
FieldWriter fieldWriter = firstField;
while (fieldWriter != null) {
fieldWriter.collectAttributePrototypes(attributePrototypes);
fieldWriter = (FieldWriter) fieldWriter.fv;
}
MethodWriter methodWriter = firstMethod;
while (methodWriter != null) {
methodWriter.collectAttributePrototypes(attributePrototypes);
methodWriter = (MethodWriter) methodWriter.mv;
}
return attributePrototypes.toArray();
}
// -----------------------------------------------------------------------------------------------
// Utility methods: constant pool management for Attribute sub classes
// -----------------------------------------------------------------------------------------------
/**
* Adds a number or string constant to the constant pool of the class being build. Does nothing if
* the constant pool already contains a similar item. <i>This method is intended for {@link
* Attribute} sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param value the value of the constant to be added to the constant pool. This parameter must be
* an {@link Integer}, a {@link Float}, a {@link Long}, a {@link Double} or a {@link String}.
* @return the index of a new or already existing constant item with the given value.
*/
public int newConst(final Object value) {
return symbolTable.addConstant(value).index;
}
/**
* Adds an UTF8 string to the constant pool of the class being build. Does nothing if the constant
* pool already contains a similar item. <i>This method is intended for {@link Attribute} sub
* classes, and is normally not needed by class generators or adapters.</i>
*
* @param value the String value.
* @return the index of a new or already existing UTF8 item.
*/
// DontCheck(AbbreviationAsWordInName): can't be renamed (for backward binary compatibility).
public int newUTF8(final String value) {
return symbolTable.addConstantUtf8(value);
}
/**
* Adds a class reference to the constant pool of the class being build. Does nothing if the
* constant pool already contains a similar item. <i>This method is intended for {@link Attribute}
* sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param value the internal name of the class.
* @return the index of a new or already existing class reference item.
*/
public int newClass(final String value) {
return symbolTable.addConstantClass(value).index;
}
/**
* Adds a method type reference to the constant pool of the class being build. Does nothing if the
* constant pool already contains a similar item. <i>This method is intended for {@link Attribute}
* sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param methodDescriptor method descriptor of the method type.
* @return the index of a new or already existing method type reference item.
*/
public int newMethodType(final String methodDescriptor) {
return symbolTable.addConstantMethodType(methodDescriptor).index;
}
/**
* Adds a module reference to the constant pool of the class being build. Does nothing if the
* constant pool already contains a similar item. <i>This method is intended for {@link Attribute}
* sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param moduleName name of the module.
* @return the index of a new or already existing module reference item.
*/
public int newModule(final String moduleName) {
return symbolTable.addConstantModule(moduleName).index;
}
/**
* Adds a package reference to the constant pool of the class being build. Does nothing if the
* constant pool already contains a similar item. <i>This method is intended for {@link Attribute}
* sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param packageName name of the package in its internal form.
* @return the index of a new or already existing module reference item.
*/
public int newPackage(final String packageName) {
return symbolTable.addConstantPackage(packageName).index;
}
/**
* Adds a handle to the constant pool of the class being build. Does nothing if the constant pool
* already contains a similar item. <i>This method is intended for {@link Attribute} sub classes,
* and is normally not needed by class generators or adapters.</i>
*
* @param tag the kind of this handle. Must be {@link Opcodes#H_GETFIELD}, {@link
* Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, {@link
* Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL},
* {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}.
* @param owner the internal name of the field or method owner class.
* @param name the name of the field or method.
* @param descriptor the descriptor of the field or method.
* @return the index of a new or already existing method type reference item.
* @deprecated this method is superseded by {@link #newHandle(int, String, String, String,
* boolean)}.
*/
@Deprecated
public int newHandle(
final int tag, final String owner, final String name, final String descriptor) {
return newHandle(tag, owner, name, descriptor, tag == Opcodes.H_INVOKEINTERFACE);
}
/**
* Adds a handle to the constant pool of the class being build. Does nothing if the constant pool
* already contains a similar item. <i>This method is intended for {@link Attribute} sub classes,
* and is normally not needed by class generators or adapters.</i>
*
* @param tag the kind of this handle. Must be {@link Opcodes#H_GETFIELD}, {@link
* Opcodes#H_GETSTATIC}, {@link Opcodes#H_PUTFIELD}, {@link Opcodes#H_PUTSTATIC}, {@link
* Opcodes#H_INVOKEVIRTUAL}, {@link Opcodes#H_INVOKESTATIC}, {@link Opcodes#H_INVOKESPECIAL},
* {@link Opcodes#H_NEWINVOKESPECIAL} or {@link Opcodes#H_INVOKEINTERFACE}.
* @param owner the internal name of the field or method owner class.
* @param name the name of the field or method.
* @param descriptor the descriptor of the field or method.
* @param isInterface true if the owner is an interface.
* @return the index of a new or already existing method type reference item.
*/
public int newHandle(
final int tag,
final String owner,
final String name,
final String descriptor,
final boolean isInterface) {
return symbolTable.addConstantMethodHandle(tag, owner, name, descriptor, isInterface).index;
}
/**
* Adds a dynamic constant reference to the constant pool of the class being build. Does nothing
* if the constant pool already contains a similar item. <i>This method is intended for {@link
* Attribute} sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param name name of the invoked method.
* @param descriptor field descriptor of the constant type.
* @param bootstrapMethodHandle the bootstrap method.
* @param bootstrapMethodArguments the bootstrap method constant arguments.
* @return the index of a new or already existing dynamic constant reference item.
*/
public int newConstantDynamic(
final String name,
final String descriptor,
final Handle bootstrapMethodHandle,
final Object... bootstrapMethodArguments) {
return symbolTable.addConstantDynamic(
name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments)
.index;
}
/**
* Adds an invokedynamic reference to the constant pool of the class being build. Does nothing if
* the constant pool already contains a similar item. <i>This method is intended for {@link
* Attribute} sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param name name of the invoked method.
* @param descriptor descriptor of the invoke method.
* @param bootstrapMethodHandle the bootstrap method.
* @param bootstrapMethodArguments the bootstrap method constant arguments.
* @return the index of a new or already existing invokedynamic reference item.
*/
public int newInvokeDynamic(
final String name,
final String descriptor,
final Handle bootstrapMethodHandle,
final Object... bootstrapMethodArguments) {
return symbolTable.addConstantInvokeDynamic(
name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments)
.index;
}
/**
* Adds a field reference to the constant pool of the class being build. Does nothing if the
* constant pool already contains a similar item. <i>This method is intended for {@link Attribute}
* sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param owner the internal name of the field's owner class.
* @param name the field's name.
* @param descriptor the field's descriptor.
* @return the index of a new or already existing field reference item.
*/
public int newField(final String owner, final String name, final String descriptor) {
return symbolTable.addConstantFieldref(owner, name, descriptor).index;
}
/**
* Adds a method reference to the constant pool of the class being build. Does nothing if the
* constant pool already contains a similar item. <i>This method is intended for {@link Attribute}
* sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param owner the internal name of the method's owner class.
* @param name the method's name.
* @param descriptor the method's descriptor.
* @param isInterface {@literal true} if {@code owner} is an interface.
* @return the index of a new or already existing method reference item.
*/
public int newMethod(
final String owner, final String name, final String descriptor, final boolean isInterface) {
return symbolTable.addConstantMethodref(owner, name, descriptor, isInterface).index;
}
/**
* Adds a name and type to the constant pool of the class being build. Does nothing if the
* constant pool already contains a similar item. <i>This method is intended for {@link Attribute}
* sub classes, and is normally not needed by class generators or adapters.</i>
*
* @param name a name.
* @param descriptor a type descriptor.
* @return the index of a new or already existing name and type item.
*/
public int newNameType(final String name, final String descriptor) {
return symbolTable.addConstantNameAndType(name, descriptor);
}
// -----------------------------------------------------------------------------------------------
// Default method to compute common super classes when computing stack map frames
// -----------------------------------------------------------------------------------------------
/**
* Returns the common super type of the two given types. The default implementation of this method
* <i>loads</i> the two given classes and uses the java.lang.Class methods to find the common
* super class. It can be overridden to compute this common super type in other ways, in
* particular without actually loading any class, or to take into account the class that is
* currently being generated by this ClassWriter, which can of course not be loaded since it is
* under construction.
*
* @param type1 the internal name of a class.
* @param type2 the internal name of another class.
* @return the internal name of the common super class of the two given classes.
*/
protected String getCommonSuperClass(final String type1, final String type2) {
ClassLoader classLoader = getClassLoader();
Class<?> class1;
try {
class1 = Class.forName(type1.replace('/', '.'), false, classLoader);
} catch (ClassNotFoundException e) {
throw new TypeNotPresentException(type1, e);
}
Class<?> class2;
try {
class2 = Class.forName(type2.replace('/', '.'), false, classLoader);
} catch (ClassNotFoundException e) {
throw new TypeNotPresentException(type2, e);
}
if (class1.isAssignableFrom(class2)) {
return type1;
}
if (class2.isAssignableFrom(class1)) {
return type2;
}
if (class1.isInterface() || class2.isInterface()) {
return "java/lang/Object";
} else {
do {
class1 = class1.getSuperclass();
} while (!class1.isAssignableFrom(class2));
return class1.getName().replace('.', '/');
}
}
/**
* Returns the {@link ClassLoader} to be used by the default implementation of {@link
* #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type by
* default.
*
* @return ClassLoader
*/
protected ClassLoader getClassLoader() {
return getClass().getClassLoader();
}
}
| [
"capapoc@gmail.com"
] | capapoc@gmail.com |
f1f3c0757c79e5b81478e6df9bc569e01a2f328c | 60cad3da5a6d52758c860504b96ff11668dc5f8a | /QLCT_frontend/app/src/main/java/com/example/qlchitieu/models/DanhSach.java | fa8011296313157c9af7cf18071a6eedd82fbfbd | [] | no_license | SouthBlue/QLCT | ed0b79460feb6141386a59867628d6a46aad4bca | d1610069757b07ea7c20c2495ab54f3478b7db7b | refs/heads/main | 2023-02-20T08:12:58.115840 | 2021-01-19T04:16:03 | 2021-01-19T04:16:03 | 330,715,213 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | package com.example.qlchitieu.models;
import java.util.List;
public class DanhSach {
private String ngayphatsinh;
private List<PhatSinh1> phatsinh;
public DanhSach(String ngayphatsinh, List<PhatSinh1> phatsinh) {
this.ngayphatsinh = ngayphatsinh;
this.phatsinh = phatsinh;
}
public String getNgayphatsinh() {
return ngayphatsinh;
}
public void setNgayphatsinh(String ngayphatsinh) {
this.ngayphatsinh = ngayphatsinh;
}
public List<PhatSinh1> getPhatsinh() {
return phatsinh;
}
public void setPhatsinh(List<PhatSinh1> phatsinh) {
this.phatsinh = phatsinh;
}
}
| [
"giangnamstyle1998@gmail.com"
] | giangnamstyle1998@gmail.com |
769c96213da954aec8f68f057fb6a2aafeeb5cdd | 9dd9d31d150f1312c6b29e107b0429c06cf5ebda | /src/java/co/fac/bean/BEmpresa.java | 79b4fdfe0707c109f28a99d330d38fbb20eaa0d2 | [] | no_license | arturs23/TratamientoFacturas | 749c1b8f9a9b73366713905ec53624a43b740c7c | 759b0f262006111b2c9a0fd107d4deb858455c91 | refs/heads/master | 2022-11-26T19:07:10.709878 | 2020-07-23T18:54:50 | 2020-07-23T18:54:50 | 282,030,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,758 | java | package co.fac.bean;
import co.fac.dao.OperEmpresa;
import co.fac.dto.Empresa;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author Esteban
*/
@ManagedBean
@ViewScoped
public class BEmpresa implements Serializable {
private static final Logger LOG = LogManager.getLogger(OperEmpresa.class);
private String usuario;
private String contrasena;
private String direccion;
private int telefono;
private int nit;
private String privilegio;
private Map<String, String> privilegios = new HashMap<String, String>();
private Empresa user;
@PostConstruct
public void init() {
privilegios = new HashMap<String, String>();
privilegios.put("Cliente", "Cliente");
privilegios.put("Administrador", "Administrador");
}
public BEmpresa() {
Map sesion = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
user = (Empresa) sesion.get("usuarioSesion");
}
public Empresa usuarioEnSesion() {
return user;
}
public void insertarEmpresa() {
if (usuario == null || usuario.isEmpty() || direccion == null || direccion.isEmpty() || contrasena == null || telefono == 0 || nit == 0 || privilegio.isEmpty() || privilegio == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Atención", "Datos Nulos Revise"));
return;
}
System.out.println(" Placa " + this.contrasena);
Empresa em = new Empresa();
em.setUsuario(usuario);
em.setContrasena(contrasena);
em.setDireccion(direccion);
em.setTelefono(telefono);
em.setNit(nit);
em.setPrivilegio(privilegio);
OperEmpresa operEm = new OperEmpresa();
int rta = operEm.insertar(em);
System.out.println("rta " + rta);
if (rta > 0) {
this.limpiar();
//this.mensaje = "Inserto "+r;
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Atención", "Se registro la empresa"));
LOG.debug("Se registro la empresa: " + em.getUsuario());
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Atención", "llave repetida"));
}
}
public void borrarEmpresa() {
OperEmpresa operEm = new OperEmpresa();
int rtas = operEm.borrar(usuario);
System.out.println("rta " + rtas);
if (rtas > 0) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Atención", "Se eliminado con exito"));
LOG.debug("El usuario: " + (user.getUsuario()) + " elimino la empresa: " + usuario);
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Atención", "No existe llave"));
}
}
public void actualizar() {
if (usuario == null || usuario.isEmpty() || direccion == null || direccion.isEmpty() || contrasena == null || telefono == 0 || nit == 0 || privilegio.isEmpty() || privilegio == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Atención", "Datos Nulos Revise"));
return;
}
Empresa em = new Empresa();
em.setUsuario(usuario);
em.setContrasena(contrasena);
em.setDireccion(direccion);
em.setTelefono(telefono);
em.setNit(nit);
em.setPrivilegio(privilegio);
OperEmpresa operEm = new OperEmpresa();
int rtas = operEm.actualizar(em);
System.out.println("rta " + rtas);
if (rtas > 0) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Atención", "Se actualizo con exito"));
LOG.debug("Se actualizo la empresa: " + em.getUsuario());
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Atención", "No se actualizo"));
}
}
public String regresar() {
return "irRegistrar";
}
public void limpiar() {
this.usuario = "";
this.contrasena = "";
this.direccion = "";
this.nit = 0;
this.telefono = 0;
}
public Map<String, String> getPrivilegios() {
return privilegios;
}
public void setPrivilegios(Map<String, String> privilegios) {
this.privilegios = privilegios;
}
public String getPrivilegio() {
return privilegio;
}
public void setPrivilegio(String privilegio) {
this.privilegio = privilegio;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getContrasena() {
return contrasena;
}
public void setContrasena(String contrasena) {
this.contrasena = contrasena;
}
public String getDireccion() {
return direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
public int getTelefono() {
return telefono;
}
public void setTelefono(int telefono) {
this.telefono = telefono;
}
public int getNit() {
return nit;
}
public void setNit(int nit) {
this.nit = nit;
}
public Empresa getUser() {
return user;
}
public void setUser(Empresa user) {
this.user = user;
}
public String lista() {
return "listaEmpresa";
}
public String cerrarSesion() {
return "cerrarSesion";
}
public String cerrarsesionmenu(){
return "Login";
}
public String actuliza() {
return "actualizarEmpresa";
}
public String filtocli(){
return "filtroCliente";
}
public String regresarmenu(){
return "menuPrincipal";
}
public String cerrarsesionfiltrocli(){
return "Login";
}
public String filtofec(){
return "filtroFecha";
}
}
| [
"Usuario@Esteban"
] | Usuario@Esteban |
aa353357a105c5acb27e7e4f1e3672f8d5b82692 | d7f62ba20fd37f68015203bd1876a0a10ac363b1 | /src/com/qingzhou/app/db/BaseDao.java | 2bb81b936cc0012dda651ac4701ff70ed07d443b | [] | no_license | gengyn/QZAPP_CLIENT | 3018e556a3f4c58693e86373e0fad93541ee7c75 | 7a8004f907378a20dc8547b1f85d2ce41abdfb27 | refs/heads/master | 2016-09-09T19:46:17.777310 | 2014-01-03T06:40:21 | 2014-01-03T06:40:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,737 | java | package com.qingzhou.app.db;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
/**
* 基础DAO,每个DAO都要继承此类
*
*
*/
public class BaseDao<T> {
private Context mContext;
private SQLiteDatabase db;
public Context getmContext() {
return mContext;
}
public BaseDao(Context context) {
this.mContext = context;
DBHelper dbHelper = new DBHelper(mContext, Configuration.DB_NAME,
null, Configuration.DB_VERSION);
db = dbHelper.getWritableDatabase();
}
public BaseDao(Context context,SQLiteDatabase db)
{
this.mContext = context;
this.db = db;
}
/**
* 增加、删除、修改表时,调用此方法
* @param sql DDL语句
* @throws SQLException
*/
public void execute(String sql){
db.execSQL(sql);
}
/**
* 删除表中的记录
* @param table 表名
* @param whereClause 删除条件 如:( id>? and time>?)
* @param whereArgs 条件里的参数 用来替换"?" 第1个参数,代表第1个问号;第2个参数,代表第2个问号;依此类推......
* @return 返回删除的条数
*/
public int delete(String table, String whereClause, String[] whereArgs) {
return db.delete(table, whereClause, whereArgs);
}
/**
* 插入数据
* @param table 表名
* @param values ContentValues对象
* @return 返回当前行ID值,如果失败返回-1
*/
public long insert(String table, ContentValues values){
return this.insert(table, null, values);
}
/**
* 插入数据
* @param table 表名
* @param values ContentValues对象
* @param nullColumnHack 空列
* @return 返回当前行ID值,如果失败返回-1
*/
public long insert(String table, String nullColumnHack,
ContentValues values) throws SQLException {
return db.insertOrThrow(table, nullColumnHack, values);
}
/**
* 修改数据
* @param table 表名
* @param values ContentValues对象 表示要修改的列,如: name="steven" 即 values.put("name", "steven");
* @param whereClause 修改条件 如:( id=?)
* @param whereArgs 条件里的参数 用来替换"?" 第1个参数,代表第1个问号;第2个参数,代表第2个问号;依此类推......
* @return 返回修改的条数
*/
public int update(String table, ContentValues values,
String whereClause, String[] whereArgs) {
return db.update(table, values, whereClause, whereArgs);
}
/**
* 查询数据
* @param table 表名
* @param columns 要查询的列名
* @param selection 查询条件 如:( id=?)
* @param selectionArgs 条件里的参数,用来替换"?"
* @return 返回Cursor
*/
public Cursor query(String table, String[] columns, String selection,
String[] selectionArgs) {
return db.query(table, columns, selection, selectionArgs, null, null,
null);
}
/**
* 查询数据
* @param table 表名
* @param columns 要查询的列名
* @param selection 查询条件 如:( id=?)
* @param selectionArgs 条件里的参数,用来替换"?"
* @param orderBy 排序 如:id desc
* @return 返回Cursor
*/
public Cursor query(String table, String[] columns, String selection,
String[] selectionArgs, String orderBy) {
return db.query(table, columns, selection, selectionArgs, null, null,
orderBy);
}
/**
* 查询数据
* @param distinct 每行是唯一 true:表示唯一 false:表示不唯一
* @param table 表名
* @param columns 要查询的列名
* @param selection 查询条件 如:( id=?)
* @param selectionArgs 条件里的参数,用来替换"?"
* @param orderBy 排序 如:id desc
* @param limit 查询的条数 如:10
* @return 返回Cursor
*/
public Cursor query(boolean distinct, String table, String[] columns, String selection,
String[] selectionArgs, String orderBy, String limit){
return db.query(distinct, table, columns, selection, selectionArgs, null, null, orderBy, limit);
}
/**
* 查询某个字段
* @param classz 字节码 如:String.class
* @param table 表名
* @param columns 要查询的列名
* @param selection 查询条件 如:( id=?)
* @param selectionArgs 条件里的参数,用来替换"?"
* @return 返回Object
*/
public Object queryField(Class<?> classz, String table, String[] columns, String selection,
String[] selectionArgs){
Object o = null;
//查询单条记录
Cursor c = db.query(table, columns, selection, selectionArgs, null, null, null, "1");
if(c.moveToFirst()){
try {
if(classz == Integer.TYPE) { //int
o = c.getInt(0);
}else if(classz == String.class){ //String
o = c.getString(0);
}else if(classz == Long.TYPE){ //long
o = c.getLong(0);
}else if(classz == Float.TYPE){ //float
o = c.getFloat(0);
}else if(classz == Double.TYPE){ //double
o = c.getDouble(0);
}else if(classz == Short.TYPE){ //short
o = c.getShort(0);
}
} catch (Exception e) {
Log.e("queryField", e.toString());
}
}
c.close();
return o;
}
/**
* 查询数据 单个对象
* @param classz 字节码 如:String.class
* @param table 表名
* @param columns 要查询的列名
* @param selection 查询条件 如:( id=?)
* @param selectionArgs 条件里的参数,用来替换"?"
* @return 返回Object
*/
@SuppressWarnings("unchecked")
public T queryObject(Class<?> classz, String table, String[] columns, String selection,
String[] selectionArgs){
//查询单条记录
Cursor c = db.query(table, columns, selection, selectionArgs, null, null, null, "1");
T t = null;
if(c.moveToFirst()){
try{
//生成新的实例
t = (T) classz.newInstance();
//把列的值,转换成对象里属性的值
columnToField(t, c);
}catch(Exception e){
Log.e("newInstance error", "生成新实例时出错 :" + e.toString());
}
}
c.close();
return t;
}
/**
* 查询数据 带分页功能
* @param classz 字节码 如:String.class
* @param table 表名
* @param columns 要查询的列名
* @param selection 查询条件 如:( id=?)
* @param selectionArgs 条件里的参数,用来替换"?"
* @param orderBy 排序 如:id desc
* @param pageNo 页码 不分页时,为null
* @param pageSize 每页的个数 不分页时,为null
* @return 返回List
*/
@SuppressWarnings("unchecked")
public List<T> queryList(Class<?> classz, String table, String[] columns, String selection,
String[] selectionArgs, String orderBy, Integer pageNo, Integer pageSize){
//分页
if(!(pageNo == null || pageSize ==null)){
//分页的起始位置
int begin = (pageNo -1)*pageSize;
orderBy = orderBy + " limit " + begin + ", " + pageSize;
}
//查询数据
Cursor c = db.query(table, columns, selection, selectionArgs, null, null, orderBy);
List<T> list = new ArrayList<T>();
T t = null;
while (c.moveToNext()) {
try{
//生成新的实例
t = (T) classz.newInstance();
}catch(Exception e){
Log.e("newInstance error", "生成新实例时出错 :" + e.toString());
}
//把列的值,转换成对象里属性的值
columnToField(t, c);
list.add(t);
}
c.close();
return list;
}
/**
* 把列的值,转换成对象里属性的值
*/
private void columnToField(T t, Cursor c){
//获取T里的所有属性
Field[] f = t.getClass().getDeclaredFields();
for (int i = 0; i < f.length; i++) {
int columnIndex = c.getColumnIndex(f[i].getName().toUpperCase());
//如果为-1,表示不存在此列
if(columnIndex == -1){
continue;
}
Class<?> classz = f[i].getType();
//设置成可访问,否则不能set值
f[i].setAccessible(true);
try {
if(classz == Integer.TYPE) { //int
f[i].set(t, c.getInt(columnIndex));
}else if(classz == String.class){ //String
f[i].set(t, c.getString(columnIndex));
}else if(classz == Long.TYPE){ //long
f[i].set(t, c.getLong(columnIndex));
}else if(classz == byte[].class){ //byte
f[i].set(t, c.getBlob(columnIndex));
}else if(classz == Float.TYPE){ //float
f[i].set(t, c.getFloat(columnIndex));
}else if(classz == Double.TYPE){ //double
f[i].set(t, c.getDouble(columnIndex));
}else if(classz == Short.TYPE){ //short
f[i].set(t, c.getShort(columnIndex));
}
} catch (Exception e) {
Log.e("column to field error", "字段转换成对象时出错 :" + e.toString());
}
}
}
/**
* 开始事务
*/
public void beginTransaction() {
db.beginTransaction();
}
/**
* 提交事务及结束事务
*/
public void commit() {
db.setTransactionSuccessful();
db.endTransaction();
}
/**
* 回滚事务
*/
public void rollback() {
db.endTransaction();
}
/**
* 关闭连接
*/
public void close() {
if (db != null && db.isOpen())
db.close();
}
}
| [
"china.hihi@gmail.com"
] | china.hihi@gmail.com |
7eefd8c6a14c5847b6d0621e758f5980c895e5a6 | 44b168404cf2506eac47bc86507805447e37a1c7 | /Flippr/src/me/flippr/fragments/PageFragment.java | 778cff3f54688d84e54f347553d842eb7c9137b3 | [] | no_license | kevinchen96/flippr-android | 5780490306770efb6208eb7b3df0b52ab45d5647 | dcf9735b34eb3ccfad80e156f084303b2c9b013f | refs/heads/master | 2020-07-21T13:30:43.993532 | 2015-09-17T06:30:33 | 2015-09-17T06:30:33 | 42,638,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,151 | java | package me.flippr.fragments;
import java.util.Locale;
import me.flippr.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class PageFragment extends Fragment {
public static final String ARG_PAGE_NUMBER = "page_number";
public PageFragment() {
// Empty constructor required for fragment subclasses
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_page, container, false);
int i = getArguments().getInt(ARG_PAGE_NUMBER);
String page = getResources().getStringArray(R.array.pages_array)[i];
int imageId = getResources().getIdentifier(page.toLowerCase(Locale.getDefault()),
"drawable", getActivity().getPackageName());
((ImageView) rootView.findViewById(R.id.image)).setImageResource(imageId);
getActivity().setTitle(page);
return rootView;
}
}
| [
"Kevin@Kevins-MacBook-Pro.local"
] | Kevin@Kevins-MacBook-Pro.local |
407886c9b940f0860ed803bb88374de7ec3e788b | 6b578ce2a1b925446adb543e4a28afe38caba140 | /src/main/java/udptest/UDPNodeRun.java | e7e98496d4ba8c31f6d2383c5cffb04a13b5832d | [] | no_license | brucerobbins/commlayer_experiment | fd956ac6c851694a9cab64f17d822755c02e1fe1 | 76e1ffe0c5dec754c1b1cb8824e991fb94b855d6 | refs/heads/master | 2020-04-27T04:52:49.897983 | 2011-08-22T23:53:36 | 2011-08-22T23:53:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,140 | java | package udptest;
import generictest.Node;
import io.Emitter;
import io.Listener;
import java.io.File;
import java.io.Reader;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import nettytest.NettyEmitter;
import nettytest.NettyListener;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import topology.Assignment;
import topology.AssignmentFromFile;
import topology.Topology;
import topology.TopologyFromFile;
import udptest.UDPListener;
public class UDPNodeRun {
public static Logger logger = Logger.getLogger(UDPNodeRun.class);
public static void main(String[] args) {
BasicConfigurator.configure();
Options options = new Options();
options.addOption(OptionBuilder.withArgName("udpbuffersize").hasArg()
.withDescription("UDP Buffer Size").create("u"));
CommandLineParser parser = new GnuParser();
CommandLine commandLine = null;
try {
// parse the command line arguments
commandLine = parser.parse(options, args);
} catch (ParseException exp) {
// oops, something went wrong
logger.error("Parsing failed. Reason: " + exp.getMessage());
System.exit(1);
}
int udpBufferSize = -1;
if (commandLine.hasOption("u")) {
try {
udpBufferSize = Integer.parseInt(commandLine
.getOptionValue("u"));
} catch (NumberFormatException e) {
logger.error("Bad queue "
+ commandLine.getOptionValue("u"));
System.exit(1);
}
}
List loArgs = commandLine.getArgList();
if (loArgs.size() < 1) {
logger.error("No cluster name specified");
System.exit(1);
}
String clusterName = (String) loArgs.get(0);
if (loArgs.size() < 2) {
logger.error("No configuration file specified");
System.exit(1);
}
String configFilename = (String)loArgs.get(1);
if (!(new File(configFilename)).exists()) {
logger.error(String.format("Specified configuration file %s does not exist", configFilename));
}
Assignment assignment = new AssignmentFromFile(clusterName, configFilename);
Topology topology = new TopologyFromFile(clusterName, configFilename);
logger.info("Creating listener");
Listener listener = new UDPListener(assignment, udpBufferSize);
logger.info("Creating emitter");
Emitter emitter = new UDPEmitter(topology);
Node node = new Node(emitter, listener);
node.run();
}
} | [
"robbins@everychoose-lm.corp.yahoo.com"
] | robbins@everychoose-lm.corp.yahoo.com |
313d1fa021e05da50db54beaaf315aa2d9970695 | faf0682f5b489cc12f1e58498e2dd41fc0e82111 | /app/src/main/java/com/gcu/liam/muccoursework/laMapActivity.java | e99a5734761c14a33cebb0b4709a3bb8aeb961dd | [] | no_license | Baranzo94/MUC-Coursework | 0c02f1a84c79a367366aae93f9c3bfaf534338e0 | cf484b34be35fc32bac354e06b841cc3183060c5 | refs/heads/master | 2021-05-02T13:08:26.014805 | 2015-12-15T22:05:46 | 2015-12-15T22:05:46 | 44,912,991 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,421 | java | package com.gcu.liam.muccoursework;
import android.annotation.TargetApi;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
/**
* Created by Liam on 08/12/2015.
*/
public class laMapActivity extends AppCompatActivity
{
List<laMapData> mapDataList;
private Marker[] mapDataMarkerList = new Marker[5];
private GoogleMap maplunchtime;
private float markerColours[] = {210.0f, 120.0f, 300.0f, 330.0f, 270.0f};
private LatLng latLngGlasgowCentre = new LatLng (55.861201, -4.250385);
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.la_map_view);
mapDataList = new ArrayList<laMapData>();
laMapDataDBMgr mapDB = new laMapDataDBMgr(this,"lunchtimeInfo.s3db",null,1);
try {
mapDB.dbCreate();
} catch (IOException e) {
e.printStackTrace();
}
mapDataList = mapDB.allMapData();
SetUpMap();
AddMarkers();
}
public void SetUpMap()
{
maplunchtime = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
if (maplunchtime != null)
{
maplunchtime.moveCamera(CameraUpdateFactory.newLatLngZoom(latLngGlasgowCentre, 12));
maplunchtime.setMyLocationEnabled(true);
maplunchtime.getUiSettings().setCompassEnabled(true);
maplunchtime.getUiSettings().setMyLocationButtonEnabled(true);
maplunchtime.getUiSettings().setRotateGesturesEnabled(true);
}
}
public void AddMarkers()
{
MarkerOptions marker;
laMapData mapData;
String mrkTitle;
String mrkText;
for(int i = 0; i < mapDataList.size(); i++)
{
mapData = mapDataList.get(i);
mrkTitle = mapData.getVenue();
mrkText = "Lunch Choice";
marker = SetMarker(mrkTitle, mrkText, new LatLng(mapData.getLatitude(), mapData.getLongitude()), markerColours[i],true);
mapDataMarkerList[i] = maplunchtime.addMarker(marker);
}
}
public MarkerOptions SetMarker (String title, String snippet, LatLng position, float markerColour, boolean centreAnchor)
{
float anchorX;
float anchorY;
if (centreAnchor)
{
anchorX = 0.5f;
anchorY = 0.5f;
}
else
{
anchorX = 0.05f;
anchorY = 1.0f;
}
MarkerOptions marker = new MarkerOptions().title(title).snippet(snippet).icon(BitmapDescriptorFactory.defaultMarker(markerColour)).anchor(anchorX, anchorY).position(position);
return marker;
}
}
| [
"Liam@Unknown-3c-15-c2-e4-05-78.home"
] | Liam@Unknown-3c-15-c2-e4-05-78.home |
6a3235d4039f35f9da5c20a9bfecff0e278a105f | d053e66ba74dd6a51a83bec8c374fbcc36b6f382 | /eGIcommerce/src/main/java/entites/Client.java | de1605392fd8041dc068da5e91a60e3e41fdd1ac | [] | no_license | SebbarSara/Egicom | 9f5726575300597f159ef597da3bea10335f7cca | b513f9ccd9e9a4c3263869f67d1117d9f9792a1c | refs/heads/master | 2016-08-12T13:04:37.448412 | 2016-01-07T19:49:25 | 2016-01-07T19:49:35 | 49,198,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,639 | java | package entites;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Client implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long idClient;
private String nomClient;
private String adresse;
private String email;
private String tel;
@OneToMany(mappedBy="client")
private Collection<Commande> commandes;
public Client() {
super();
// TODO Auto-generated constructor stub
}
protected Client(Long idClient, String nomClient, String adresse, String email,
String tel) {
super();
this.idClient = idClient;
this.nomClient = nomClient;
this.adresse = adresse;
this.email = email;
this.tel = tel;
}
public Long getIdClient() {
return idClient;
}
public void setIdClient(Long idClient) {
this.idClient = idClient;
}
public String getNomClient() {
return nomClient;
}
public void setNomClient(String nomClient) {
this.nomClient = nomClient;
}
public String getAdresse() {
return adresse;
}
public void setAdresse(String adresse) {
this.adresse = adresse;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public Collection<Commande> getCommandes() {
return commandes;
}
public void setCommandes(Collection<Commande> commandes) {
this.commandes = commandes;
}
} | [
"Sara@10.3.21.12"
] | Sara@10.3.21.12 |
9ff095fb55d3d61836a732049ecd39c5dae4154d | e5f06932730106c6f5b785315bfdea00075f7d89 | /studio-idea-plugin/src/main/java/com/evolveum/midpoint/studio/impl/DocGeneratorOptions.java | 991fca9cb11025d847edf7c8e56a997cb033073e | [
"Apache-2.0"
] | permissive | Evolveum/midpoint-studio | 4377acc067bb6add1805378791623aca17e2059e | 9fb8beb9adc2c87771a864aea4b4308cd5623371 | refs/heads/master | 2023-08-16T14:16:41.224370 | 2023-08-14T13:39:58 | 2023-08-14T13:39:58 | 208,789,988 | 4 | 2 | Apache-2.0 | 2021-02-09T08:15:13 | 2019-09-16T12:06:54 | Java | UTF-8 | Java | false | false | 5,424 | java | package com.evolveum.midpoint.studio.impl;
import com.evolveum.midpoint.studio.util.FileConverter;
import com.evolveum.midscribe.generator.ExportFormat;
import com.evolveum.midscribe.generator.GenerateOptions;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.annotations.OptionTag;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by Viliam Repan (lazyman).
*/
public class DocGeneratorOptions {
@OptionTag(converter = FileConverter.class)
private File sourceDirectory;
private List<String> include;
private List<String> exclude;
private ExportFormat exportFormat;
@OptionTag(converter = FileConverter.class)
private File template;
@OptionTag(converter = FileConverter.class)
private File adocOutput;
@OptionTag(converter = FileConverter.class)
private File exportOutput;
public File getSourceDirectory() {
return sourceDirectory;
}
public void setSourceDirectory(File sourceDirectory) {
this.sourceDirectory = sourceDirectory;
}
public List<String> getInclude() {
if (include == null) {
include = new ArrayList<>();
}
return include;
}
public void setInclude(List<String> include) {
this.include = include;
}
public List<String> getExclude() {
if (exclude == null) {
exclude = new ArrayList<>();
}
return exclude;
}
public void setExclude(List<String> exclude) {
this.exclude = exclude;
}
public ExportFormat getExportFormat() {
return exportFormat;
}
public void setExportFormat(ExportFormat exportFormat) {
this.exportFormat = exportFormat;
}
public File getTemplate() {
return template;
}
public void setTemplate(File template) {
this.template = template;
}
public File getAdocOutput() {
return adocOutput;
}
public void setAdocOutput(File adocOutput) {
this.adocOutput = adocOutput;
}
public File getExportOutput() {
return exportOutput;
}
public void setExportOutput(File exportOutput) {
this.exportOutput = exportOutput;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DocGeneratorOptions that = (DocGeneratorOptions) o;
if (sourceDirectory != null ? !sourceDirectory.equals(that.sourceDirectory) : that.sourceDirectory != null)
return false;
if (include != null ? !include.equals(that.include) : that.include != null) return false;
if (exclude != null ? !exclude.equals(that.exclude) : that.exclude != null) return false;
if (exportFormat != that.exportFormat) return false;
if (template != null ? !template.equals(that.template) : that.template != null) return false;
if (adocOutput != null ? !adocOutput.equals(that.adocOutput) : that.adocOutput != null) return false;
return exportOutput != null ? exportOutput.equals(that.exportOutput) : that.exportOutput == null;
}
@Override
public int hashCode() {
int result = sourceDirectory != null ? sourceDirectory.hashCode() : 0;
result = 31 * result + (include != null ? include.hashCode() : 0);
result = 31 * result + (exclude != null ? exclude.hashCode() : 0);
result = 31 * result + (exportFormat != null ? exportFormat.hashCode() : 0);
result = 31 * result + (template != null ? template.hashCode() : 0);
result = 31 * result + (adocOutput != null ? adocOutput.hashCode() : 0);
result = 31 * result + (exportOutput != null ? exportOutput.hashCode() : 0);
return result;
}
public static DocGeneratorOptions createDefaultOptions(Project project) {
DocGeneratorOptions opts = new DocGeneratorOptions();
opts.setSourceDirectory(new File(project.getBasePath(), "objects"));
opts.setInclude(Arrays.asList("**/*.xml"));
opts.setExportFormat(ExportFormat.HTML);
opts.setExportOutput(new File(project.getBasePath(), "documentation.html"));
return opts;
}
public static GenerateOptions buildGenerateOptions(DocGeneratorOptions opts) {
GenerateOptions go = new GenerateOptions();
go.setAdocOutput(opts.getAdocOutput());
go.setExportFormat(opts.getExportFormat());
go.setTemplate(opts.getTemplate());
go.setExportOutput(opts.getExportOutput());
go.setSourceDirectory(List.of(opts.getSourceDirectory()));
go.setInclude(opts.getInclude());
go.setExclude(opts.getExclude());
return go;
}
public static DocGeneratorOptions buildDocGenerateOptions(GenerateOptions opts) {
DocGeneratorOptions dgo = new DocGeneratorOptions();
List<File> sources = opts.getSourceDirectory();
File source = sources != null && !sources.isEmpty() ? sources.get(0) : null;
dgo.setSourceDirectory(source);
dgo.setInclude(opts.getInclude());
dgo.setExclude(opts.getExclude());
dgo.setExportFormat(opts.getExportFormat());
dgo.setTemplate(opts.getTemplate());
dgo.setAdocOutput(opts.getAdocOutput());
dgo.setExportOutput(opts.getExportOutput());
return dgo;
}
}
| [
"vilo.repan@evolveum.com"
] | vilo.repan@evolveum.com |
8d3413555f2096b37b293959c2e99a5a1332b43c | 57cbe1f891df4ec38c90a5ba65e6a3e705901dae | /src/test/java/TinyShop/TinyShopTest.java | 08adb041446cd6cdccdba64505c96db078f113f1 | [] | no_license | czf0122/czf | 600975532c1efb1adb2d0572a0557f9cd2b97311 | b343ddaace5da286c73434bce7b665a91d7d7cab | refs/heads/master | 2021-01-20T01:50:52.023568 | 2017-04-25T08:36:54 | 2017-04-25T08:36:54 | 89,332,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package TinyShop;
import Interfaces.TinyShop.TinyShop_yw;
import Utils.ExcelIterator;
import Utils.ReportUtils;
import Utils.RequestUtils;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.asserts.Assertion;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
/**
* Created by MrChen on 2017/4/24.
*/
public class TinyShopTest {
ReportUtils report = new ReportUtils();
Assertion assertion = new Assertion();
//打开首页
@DataProvider(name = "shouye")
public Iterator<Object[]> datashouye() throws IOException {
return new ExcelIterator("E:\\CZF_Project\\TestData\\TinyShop_data\\TinyShopTest", "shouye");
}
@Test(dataProvider = "shouye",priority = 0)
public void OpenShouYe(Map<String,String> map) {
TinyShop_yw.openShouYe(map);
}
//登录
@DataProvider(name = "login")
public Iterator<Object[]> datalogin() throws IOException {
return new ExcelIterator("E:\\CZF_Project\\TestData\\TinyShop_data\\TinyShopTest", "Login");
}
@Test(dataProvider = "login",priority = 1)
public String Login(Map<String,String > map) throws IOException {
String response = TinyShop_yw.Login(map);
report.log("登录成功");
// //业务逻辑判断
// if(response.contains(map.get("expected result"))){
// report.log("登录成功");
// return response;
// }else{
// report.log("登录失败,请重新登录");
// }
return response;
}
}
| [
"zhenzhaofeng@163.com"
] | zhenzhaofeng@163.com |
d30ade7eeae7e2882be7561c54e70a7210a3c0f9 | 8b176b97f7b1f3357d8151a76ffbc288c0dd4b2e | /eureka-7001/src/main/java/com/jiaoyu/springcloud/EurekaServer7001_App.java | f35d55706378ff9e8926b2a9efc520e34b96bb72 | [] | no_license | jiaoyu-xuyisheng/springcloud-project | 7061a097eaf665efe8bce0856403b04fa6853f61 | 14ed2f8d6676ca5b059cf64ec049f87696eae4c1 | refs/heads/master | 2022-06-22T10:55:08.008325 | 2019-12-14T02:53:47 | 2019-12-14T02:53:47 | 227,956,785 | 0 | 0 | null | 2022-06-21T02:26:34 | 2019-12-14T02:51:07 | Java | UTF-8 | Java | false | false | 424 | java | package com.jiaoyu.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer7001_App {
public static void main(String[] args){
SpringApplication.run(EurekaServer7001_App.class,args);
}
}
| [
"422062338@qq.com"
] | 422062338@qq.com |
5faf991012fa8e12baac77f1b4a2f4fc5ecc01db | 8a2fd08b7c224048daedcc493ad4145a1cf684bb | /src/main/java/net/mcreator/oreslite/item/AmethystGemItem.java | 177df613d936a643916932230dd879bd6635f641 | [] | no_license | ManiacOG/OresPlus | 8dde1cebd1d9b8489707a6274bd610143c6ffbdb | 38feb79bb17ccbe8c4816cb241f0cc15dbb4c0ea | refs/heads/master | 2023-01-14T15:58:19.458597 | 2020-11-23T23:11:19 | 2020-11-23T23:11:19 | 315,458,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java |
package net.mcreator.oreslite.item;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.block.BlockState;
import net.mcreator.oreslite.itemgroup.OresLiteItemGroup;
import net.mcreator.oreslite.OresliteModElements;
@OresliteModElements.ModElement.Tag
public class AmethystGemItem extends OresliteModElements.ModElement {
@ObjectHolder("oreslite:amethyst_gem")
public static final Item block = null;
public AmethystGemItem(OresliteModElements instance) {
super(instance, 135);
}
@Override
public void initElements() {
elements.items.add(() -> new ItemCustom());
}
public static class ItemCustom extends Item {
public ItemCustom() {
super(new Item.Properties().group(OresLiteItemGroup.tab).maxStackSize(64));
setRegistryName("amethyst_gem");
}
@Override
public int getItemEnchantability() {
return 0;
}
@Override
public int getUseDuration(ItemStack itemstack) {
return 0;
}
@Override
public float getDestroySpeed(ItemStack par1ItemStack, BlockState par2Block) {
return 1F;
}
}
}
| [
"Steve@192.168.0.7"
] | Steve@192.168.0.7 |
ab51dbb144c086e884bdb5fd56293b7f249ab3a8 | 75f388b17e579b514de029f136b1fd3fa05ca75f | /src/main/java/br/com/swaggsige/model/service/resource/ServiceCliente.java | 24b9ca217ada00686cdcb26641547f0bbeb06778 | [
"Apache-2.0"
] | permissive | sergiostorinojr/SwaggSigePortal | a62b631ef2ae673d4db66b94fc766e7cb1125efc | 2d699754bce292c0bcb4b64358f193046c0c7ac6 | refs/heads/master | 2021-01-10T04:56:32.595129 | 2016-02-17T01:42:33 | 2016-02-17T01:42:33 | 47,892,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package br.com.swaggsige.model.service.resource;
import javax.ejb.Local;
import javax.ws.rs.core.Response;
@Local
public interface ServiceCliente {
public Response getAll();
}
| [
"Junior@Juniior"
] | Junior@Juniior |
5599f8020dd493f269bfa1f91b6568935e062887 | 328264117caf634f1a487cb0d76d95565fe89d4d | /hover/src/main/java/io/mattcarroll/hover/content/Navigator.java | 4a99d10c4a22cb0f2398bcdf2b1e1f3dabab870a | [] | no_license | gunwook/transAppRelease | 72f1ac20808ff50676ae3377516aa3f68a73cdde | 23f2a4a4d02a2a119926c738f6f99918e88c4705 | refs/heads/master | 2020-11-30T02:34:00.613758 | 2019-12-26T14:30:33 | 2019-12-26T14:30:33 | 230,277,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,955 | java | /*
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.mattcarroll.hover.content;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import java.util.Stack;
/**
* A visual display that can push and pop {@link NavigatorContent} in a content area. The size and
* location of the content area is chosen by implementing classes.
*
* A {@code Navigator} also displays a title that can be set by a client.
*
* The content to display in a {@code Navigator} must be provided as a {@link NavigatorContent}. Each
* pushed {@code NavigatorContent} is retained in a navigation stack until a corresponding
* {@link #popContent()} is called. Therefore, {@code NavigatorContent}s must retain their {@code View}
* and state until garbage collected.
*/
public class Navigator extends FrameLayout {
private final boolean mIsFullscreen;
private Stack<NavigatorContent> mContentStack;
private ViewGroup.LayoutParams mContentLayoutParams;
public Navigator(@NonNull Context context) {
this(context, true);
}
public Navigator(@NonNull Context context, @NonNull AttributeSet attrs) {
super(context, attrs);
mIsFullscreen = false;
init();
}
public Navigator(@NonNull Context context, boolean isFullscreen) {
super(context);
mIsFullscreen = isFullscreen;
init();
}
private void init() {
int heightMode = mIsFullscreen ? ViewGroup.LayoutParams.MATCH_PARENT : ViewGroup.LayoutParams.WRAP_CONTENT;
mContentStack = new Stack<>();
mContentLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightMode);
setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, heightMode));
}
/**
* Removes the current content {@code View} if content is visible. Then displays the provided
* {@code content}.
*
* The given {@code content} is retained in a navigation stack so that this {@code Navigator}
* can navigate to other content and then later return to this content.
*
* To remove the given {@code content}, make a corresponding call to {@link #popContent()}.
*
* @param content Content to display
*/
public void pushContent(@NonNull NavigatorContent content) {
// Remove the currently visible content (if there is any).
if (!mContentStack.isEmpty()) {
removeView(mContentStack.peek().getView());
mContentStack.peek().onHidden();
}
// Push and display the new page.
mContentStack.push(content);
showContent(content);
}
/**
* Removes the current content {@code View} and restores the previous content {@code View}. If
* there is no previous content then this {@code Navigator} returns to its base visual state
* without any content.
*
* @return true if there was content to remove, false if there was no content to remove
*/
public boolean popContent() {
if (mContentStack.size() > 1) {
// Remove the currently visible content.
removeCurrentContent();
// Add back the previous content (if there is any).
if (!mContentStack.isEmpty()) {
showContent(mContentStack.peek());
}
return true;
} else {
return false;
}
}
/**
* Pops all content {@code View}s and returns this {@code Navigator} to its base visual state
* without any content.
*/
public void clearContent() {
if (mContentStack.isEmpty()) {
// Nothing to clear.
return;
}
// Pop every content View that we can.
boolean didPopContent = popContent();
while (didPopContent) {
didPopContent = popContent();
}
// Clear the root View.
removeCurrentContent();
}
private void showContent(@NonNull NavigatorContent content) {
addView(content.getView(), mContentLayoutParams);
content.onShown(this);
}
private void removeCurrentContent() {
NavigatorContent visibleContent = mContentStack.pop();
removeView(visibleContent.getView());
visibleContent.onHidden();
}
}
| [
"eorjstldzm@gmail.com"
] | eorjstldzm@gmail.com |
d3644f64c9334f62d8ca451c3c169b8d98091ded | 136d8873d69740d2efdc6b32b5ffdb0e84c21803 | /app/src/androidTest/java/com/example/textrecognition/ExampleInstrumentedTest.java | 9fc090fb20b51856d7ee01b09518b0abfb9fd169 | [] | no_license | PrathameshTayade/Image-Text-Recognition- | 089c2e201e14ba7d0df085c5df5893d710560771 | ad2fa864b7d08e3ee2ff499b09422e3f970bce71 | refs/heads/master | 2023-01-23T08:34:14.837988 | 2020-11-20T17:01:04 | 2020-11-20T17:01:04 | 315,081,957 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.example.textrecognition;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.textrecognition", appContext.getPackageName());
}
} | [
"tayadeprathameshdev25@gmail.com"
] | tayadeprathameshdev25@gmail.com |
454f8b49b627da69830a504bcff4b82ae761a3ec | 0d2a9edf6f9864f6780152f5b8cfaedb36157b0f | /lib/src/main/java/viewstack/contract/animation/AnimationContract.java | bc80fa825a167fbc31e55fcbd92b9f375ad444ca | [] | no_license | KidNox/viewstack | e3c5551a69ff1bc7ab8fdd0e847dd60f380f2096 | 2c2d12c2ab4a3d258ad96a42fc56bff97edae42f | refs/heads/master | 2021-09-05T12:22:37.408922 | 2018-01-27T14:39:10 | 2018-01-27T14:39:10 | 115,209,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package viewstack.contract.animation;
import android.view.ViewGroup;
import viewstack.ViewComponent;
public interface AnimationContract {
Object animate(ViewComponent from, ViewComponent to, ViewGroup container, boolean stackIncreased);
}
| [
"truthno3@gmail.com"
] | truthno3@gmail.com |
7274c5416c10b6e349659c2576252826a48bcb17 | 793ef091cb1a0c5974abfc0b604ecfa31d7c0d5d | /ClientMaV/src/ui/util/dtpicker/DTPickerRB.java | 98c9c170b4a07ddddab689e6ae0e787687643058 | [] | no_license | BackupTheBerlios/xagdop2 | 3ab0965c9af15892a7ef6c0dfa84bec128304788 | 2eb7b40360ffa8be5ca2de1cdb062f9ff98b5f41 | refs/heads/master | 2021-03-12T23:27:16.716855 | 2007-06-18T22:27:20 | 2007-06-18T22:27:20 | 40,044,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | package ui.util.dtpicker;
import java.util.ListResourceBundle;
/**
* Title: Baghera Anomalies
* Description:
* Copyright: Copyright (c)
* Company:
* @author
* @version 1.0
*/
public class DTPickerRB extends ListResourceBundle
{
public Object[][] getContents() {
return contents;
}
static final Object[][] contents = {
{"LUNDI", "L"},
{"MARDI", "M"},
{"MERCREDI", "M"},
{"JEUDI", "J"},
{"VENDREDI", "V"},
{"SAMEDI", "S"},
{"DIMANCHE", "D"}
};
} | [
"nephos"
] | nephos |
4c27b8a02d9618c3f249dc6ce78aa82970266eb4 | 9b78480ea758284fa1dc321a610fd3a572ea8d29 | /src/main/java/frc/robot/subsystems/Limelight.java | 4ab00dd5294ca27e5c73448f5a4ff966b8977b15 | [] | no_license | HVA-FRC-3824/Competition2020 | 4f557b523dea09f49bdf0aeae21ad3d1e9b9e1b1 | a774d8be8945f6304d9c636bb9671cbc5998555a | refs/heads/master | 2020-12-15T04:52:53.315337 | 2020-09-23T04:21:04 | 2020-09-23T04:21:04 | 235,000,099 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,495 | java | package frc.robot.subsystems;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;
/**
* Limelight is a camera that emits a bright green light to track
* reflective tape commonly placed around targets for alignment.
* This class creates all the necessary objects and methods to
* retrieve data from the limelight in other classes.
*/
public class Limelight
{
/**
* Declaring objects that are used for retrieving data from the limelight.
*/
private static Limelight instance = null;
private static NetworkTable table;
private static NetworkTableEntry tx;
private static NetworkTableEntry ty;
private static NetworkTableEntry tv;
private static NetworkTableEntry ta;
private static NetworkTableEntry camMode;
private static NetworkTableEntry ledMode;
/**
* Enums allow for values to have labels. This is especially useful
* when a parameter takes a value that has a specific function associated
* with said value. With labels, it is clearer what a passed in value does.
* Example: ledMode will blink the green light if the parameter int is "2."
* Instead of passing in "2," pass in "LEDMode.BLINK." Still passes in the
* value of "2," just with a label describing what it does.
*/
private enum LEDMode
{
PIPELINE(0),
OFF(1),
BLINK(2),
ON(3);
private int modeValue;
private LEDMode(int modeVal)
{
this.modeValue = modeVal;
}
}
private enum CamMode
{
VISION(0),
DRIVER(1);
private int modeValue;
private CamMode(int modeVal)
{
this.modeValue = modeVal;
}
}
/**
* Method for other classes to use this class' methods.
* @return the limelight instance object.
*/
public static Limelight getInstance()
{
if (instance == null)
instance = new Limelight();
return instance;
}
/**
* Get limelight data from network table.
*/
private Limelight()
{
table = NetworkTableInstance.getDefault().getTable("limelight");
tx = table.getEntry("tx"); // Horizontal offset from crosshair to target (-29.8 to 29.8 degrees).
ty = table.getEntry("ty"); // Vertical offset from crosshair to target (-24.85 to 24.85 degrees).
tv = table.getEntry("tv"); // Whether the limelight has any valid targets (0 or 1).
ta = table.getEntry("ta"); // Target area (0% of image to 100% of image).
ledMode = table.getEntry("ledMode"); // limelight's LED state (0-3).
camMode = table.getEntry("camMode"); // limelight's operation mode (0-1).
}
/**
* Horizontal offset from crosshair to target.
* @return offset from -29.8 to 29.8 degrees.
*/
public double getTargetOffsetX()
{
return tx.getDouble(0.0);
}
/**
* Vertical offset from crosshair to target.
* @return offset from -24.85 to 24.85 degrees.
*/
public double getTargetOffsetY()
{
return ty.getDouble(0.0);
}
/**
* Get whether or not a target is detected.
* @return true if target is found and false if target is not found.
*/
public boolean isTargetAvailable()
{
return tv.getNumber(0).intValue() == 1 ? true : false;
}
/**
* Get area of detected target.
* @return target area from 0% to 100%.
*/
public double getTargetArea()
{
return ta.getDouble(0.0);
}
/**
* Method to set the green light's status.
* @param mode either pipeline, off, blink, or on.
*/
private void setLEDMode(LEDMode mode)
{
ledMode.setNumber(mode.modeValue);
}
/**
* Methods for external classes to change green light's status.
*/
public void turnOnLED()
{
this.setLEDMode(LEDMode.ON);
}
public void turnOffLED()
{
this.setLEDMode(LEDMode.OFF);
}
public void blinkLED()
{
this.setLEDMode(LEDMode.BLINK);
}
/**
* Method to set camera mode.
* @param mode either driver or vision mode.
*/
private void setCamMode(CamMode mode)
{
camMode.setNumber(mode.modeValue);
}
/**
* Method to set video feed in driver mode.
* Turns off green light and switches camera mode to driver.
*/
public void setModeDriver()
{
this.setLEDMode(LEDMode.OFF);
this.setCamMode(CamMode.DRIVER);
}
/**
* Method to set video feed in vision mode.
* Turns on green light and switches camera mode to vision.
*/
public void setModeVision()
{
this.setLEDMode(LEDMode.ON);
this.setCamMode(CamMode.VISION);
}
/**
* Methods to tell whether the limelight is in driver or vision mode.
* Driver mode will consist of the LEDs being off and the camera being in color.
* Vision mode will consist of the LEDs being on and the camera being in black and white.
*/
private boolean isModeDriver()
{
return ledMode.getDouble(0.0) == LEDMode.OFF.modeValue && camMode.getDouble(0.0) == CamMode.DRIVER.modeValue;
}
private boolean isModeVision()
{
return ledMode.getDouble(0.0) == LEDMode.ON.modeValue && camMode.getDouble(0.0) == CamMode.VISION.modeValue;
}
/**
* Method to toggle the type of video feed.
*/
public void toggleMode()
{
if (this.isModeDriver())
{
this.setModeVision();
}
else if (this.isModeVision())
{
this.setModeDriver();
}
else
{
this.blinkLED();
}
}
} | [
"programmingsensei@gmail.com"
] | programmingsensei@gmail.com |
09347d0a232f5d2b39b5a2cc230e1cd6790e1d1a | 7b12a35b0ff5fa84344277514dffb76667ce145c | /EclipseToJenkins_E2EProj/src/main/java/etsyPages/CraftSupplies.java | a402262238de4521480d28ebfd1b50c1d842b23a | [] | no_license | jpenumudi/EclipseToJenkins_E2E-Project | 272fcb7be8d235140459283365a76fb945aa6d7d | 417a06b49df304498f927d7760c6e40d1ae71df4 | refs/heads/master | 2023-05-12T21:47:05.416618 | 2020-03-13T23:48:07 | 2020-03-13T23:48:07 | 246,940,622 | 0 | 0 | null | 2023-05-01T20:28:03 | 2020-03-12T22:19:27 | HTML | UTF-8 | Java | false | false | 1,656 | java | package etsyPages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import testBase.TestBaseClass;
public class CraftSupplies extends TestBaseClass {
// create page factory for the objects on homenliving page
@FindBy(xpath="//span[contains(text(), 'Craft Supplies')]")
WebElement CraftSupplieslink;
@FindBy(xpath="//*[@id='search-filter-reset-form']/fieldset[1]/div/button[1]")
WebElement showmore;
@FindBy(xpath="//label[contains(text(),'FREE shipping')]")
WebElement freeshippingchkbox;
@FindBy(xpath="//label[contains(text(),'Handmade')]")
WebElement handmaderadiobtn;
@FindBy(id="shop-location-input")
WebElement locationtextbox;
@FindBy(xpath="//form[1]/fieldset[6]/div[1]/div[1]/div[3]/div[2]/div[1]/div[1]/button[1]/span[1]/*")
WebElement locationarrow;
// INITIALIZING THE PAGE OBJECTS
public CraftSupplies() // CONSTRUCTOR CLASS
{
PageFactory.initElements(driver, this);
}
// ACTIONS
// Validate Show more feature
public void ValidateShowMore()
{
CraftSupplieslink.click();
showmore.click();
return;
}
// validate checkbox
public void ValidateCheckBox()
{
CraftSupplieslink.click();
freeshippingchkbox.click();
return;
}
// validate checkbox
public void ValidateRadioButton()
{
CraftSupplieslink.click();
handmaderadiobtn.click();
return;
}
public void ValidateTextBox(String location)
{
CraftSupplieslink.click();
locationtextbox.sendKeys(location);
locationarrow.click();
return;
}
}
| [
"jpenumudi@yahoo.com"
] | jpenumudi@yahoo.com |
8429f4390676cecc66844b0cf52ef12b90e9f623 | 08bdbb40aa57d91f409dab947702800221ee2107 | /src/main/java/com/qa/dbmanager/DBConnection.java | 50f7117b6c16404a9347ff4612813541e8db9288 | [] | no_license | jpal-helm360/jpal-helm360 | 0d7300be05d40fde0b9e20cc9930f42473aaf147 | 615a64a6ade4d7e3ef3f4b7e690bfc147964fb79 | refs/heads/master | 2023-05-31T00:55:31.219944 | 2021-06-30T00:59:05 | 2021-06-30T00:59:05 | 348,296,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,255 | java | package com.qa.dbmanager;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBConnection {
public static Connection connection = null;
public static Connection getConnection(String environment) {
String dbURL = null;
String userName = null;
String password = null;
// 1.To Get Production Database Connection :
if (environment.equalsIgnoreCase("prod")) {
dbURL = DBConstant.dbURL_Prod;
userName = DBConstant.dbUser_Prod;
password = DBConstant.dbPwd_Prod;
}
// 1.To Get Staging Database Connection :
else if (environment.equalsIgnoreCase("stage")) {
dbURL = DBConstant.dbURL_Stage;
userName = DBConstant.dbUser_Stage;
password = DBConstant.dbPwd_Stage;
} else {
org.testng.Reporter.log("Database Environment Not Found", true);
}
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection = DriverManager.getConnection(dbURL, userName, password);
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
return connection;
}
public static void closeConnection() {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
}
| [
"jpal@helm360.com"
] | jpal@helm360.com |
1adc8b12d8cb93ce348ca896bf1b73d7433459c2 | f1b278a665f00103c00e2a37d59a57ce7821131c | /platforms/android/app/src/main/java/com/AK/test2/MainActivity.java | 7e7e829dca424d1ef6f460ff290b606d2eada3ac | [] | no_license | Avinash-CT/Cordova_CT_FB_PN | 55e28aa6656faeb7f6460faac2de6770d1436cf2 | e9aa7dde75cdcc0e0b176333560382c65dd8e449 | refs/heads/main | 2023-04-05T00:18:43.209357 | 2021-04-15T13:23:17 | 2021-04-15T13:23:17 | 358,263,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,445 | java | /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.AK.test2;
import android.os.Bundle;
import org.apache.cordova.*;
public class MainActivity extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// enable Cordova apps to be started in the background
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
moveTaskToBack(true);
}
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
}
}
| [
"avinash@clevertap.com"
] | avinash@clevertap.com |
2642cbb5424c0db856e21bcc684f9ee628531d89 | ac1c365c79b1ee7bc71d2691e924345e5c1b99cb | /StorePassengers.java | 324f0b205c7857088ce6e8e64a04f4dbe78070fa | [] | no_license | lei-ezz/CSVtoDB | 6545a08bcf0be57f363e92e339a18d6cd25798cf | 43632d72bedd675781393aa5a75a7d259ae3f201 | refs/heads/master | 2020-03-17T00:41:57.185265 | 2018-05-12T08:09:25 | 2018-05-12T08:09:25 | 133,126,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | import java.util.List;
/**
* This class is for storing Passenger objects in the database. The objects are created in the
* usual way, then used as parameters in the 'persist' call.
*
* This eliminates the need to write SQL of the form "INSERT INTO TABLE..VALUES..."
*/
public class StorePassengers {
public List<Passenger> passengers;
public void getPassengers(String fileName){
}
}
| [
"39172959+lei-ezz@users.noreply.github.com"
] | 39172959+lei-ezz@users.noreply.github.com |
1233b89245eb8990114a080b9835f7bf55c5b4ef | 0cb3e70977e11503739290a8c9610234e68026b6 | /library/src/main/java/com/wzx/lightmodule/Module.java | efd212cfd44cb2ce354062db012823904a60d484 | [] | no_license | sjtuwzx/LightModule | b6e36bd7250164fe59ee28aa7f409a3e3f9ff15d | 3d9daf11b656ab3b61dcd7004d162a2842549715 | refs/heads/master | 2020-06-10T03:35:42.970807 | 2017-04-21T04:27:36 | 2017-04-21T04:27:36 | 76,098,698 | 14 | 4 | null | null | null | null | UTF-8 | Java | false | false | 3,803 | java | package com.wzx.lightmodule;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by wang_zx on 2016/3/29.
*/
public abstract class Module {
protected Context mContext;
private LayoutInflater mInflater;
protected ModuleParent mParent;
private View mView;
private boolean mIsStarted = false;
private boolean mIsResumed = false;
private boolean mIsForcePause = false;
private boolean mIsForceStop = false;
public abstract boolean shouldShowModule();
public abstract View onCreateView(LayoutInflater inflater, ViewGroup parent);
public abstract void onRefresh();
public Module(Context context) {
mContext = context;
mInflater = LayoutInflater.from(context);
}
void setParent(ModuleParent parent) {
mParent = parent;
}
protected final View getView(ViewGroup parent) {
if (mView == null) {
mView = onCreateView(mInflater, parent);
}
return mView;
}
public final View getViewIfCreated() {
return mView;
}
void performPreRefreshModuleTree() {
onPreRefreshModuleTree();
}
/**
* module tree刷新前调用,可用于module内发服务
*/
protected void onPreRefreshModuleTree() {
}
void refresh(Object... targets) {
onRefresh();
}
/**
* 请求刷新module树。若targets为空,则刷新整颗module树;targets中元素若为module且module树中包含该module,
* 刷新该module及其父module链;targets中元素若为String,刷新module树中tag为target的module及其父module链。
*
* @param targets
*/
public void requestRefresh(Object... targets) {
if (mParent != null) {
mParent.requestModulesRefresh(targets);
}
}
/**
* 请求刷新自身
*/
public final void requestRefreshSelf() {
requestRefresh(this);
}
protected String getTag() {
return null;
}
protected boolean contain(Object... targets) {
if (targets == null) {
return false;
}
for (Object target : targets) {
if (target == this) {
return true;
} else if (!TextUtils.isEmpty(getTag()) && getTag().equals(target)) {
return true;
}
}
return false;
}
protected void onStart() {
}
protected void onResume() {
}
protected void onPause() {
}
protected void onStop() {
}
protected void onDestroyView() {
}
protected void onDestroy() {
}
void start(boolean force) {
mIsForceStop &= !force;
if (!mIsForceStop && !mIsStarted && getViewIfCreated() != null && shouldShowModule()) {
onStart();
mIsStarted = true;
}
}
void resume(boolean force) {
mIsForcePause &= !force;
if (!mIsForcePause && !mIsResumed && getViewIfCreated() != null && shouldShowModule()) {
onResume();
mIsResumed = true;
}
}
void pause(boolean force) {
mIsForcePause |= force;
if (mIsResumed) {
onPause();
mIsResumed = false;
}
}
void stop(boolean force) {
mIsForceStop |= force;
if (mIsStarted) {
onStop();
mIsStarted = false;
}
}
void destroyView() {
if (getViewIfCreated() != null) {
onDestroyView();
}
}
void destroy() {
onDestroy();
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}
| [
"wangzhenxing03@meituan.com"
] | wangzhenxing03@meituan.com |
4ccadce2fb189af16cf5608372d96a55cb7ebe4b | 7fd8a5e63261605644e4c6c92b84fee6dc0e1109 | /springcloudalibaba/alibaba-sentinel-zuul/src/main/java/com/hikvision/SentinelZuulApplication.java | 4857ff037e3309c406ab59ba62d01b5b8bdfd20b | [] | no_license | jackgulu/springcloudalibaba | 824195fe41a6b18d3c9cdbb24e83aef7a16fba2f | 2edf926e2248c8e8664e9c7233b799d894b3f8a4 | refs/heads/master | 2023-06-21T02:37:05.626535 | 2021-07-24T07:05:11 | 2021-07-24T07:05:11 | 389,025,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,372 | java | package com.hikvision;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.fallback.BlockResponse;
import com.alibaba.csp.sentinel.adapter.gateway.zuul.fallback.ZuulBlockFallbackProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableZuulProxy
public class SentinelZuulApplication {
public static void main(String[] args) {
SpringApplication.run(SentinelZuulApplication.class, args);
}
@Bean
public ZuulBlockFallbackProvider zuulBlockFallbackProvider1() {
return new ZuulBlockFallbackProvider() {
@Override
public String getRoute() {
return "*";
}
@Override
public BlockResponse fallbackResponse(String route, Throwable throwable) {
if(route.equals("my-provider1")){
return new BlockResponse(403,"Provider1 Block", route);
}else if(route.equals("my-provider2")){
return new BlockResponse(403, "Provider2 Block", route);
}else {
return new BlockResponse(403, "Sentinel Block", route);
}
}
};
}
}
| [
"1833729329@qq.com"
] | 1833729329@qq.com |
74cceb41fe8acc6f3cf5c7a58322c1c823767746 | 66a0d66cc56b66c963f119c16e3d33d68be01645 | /src/test/java/pages/MainPage.java | 9452bd0a4a564773534f8f9dbc23d7bc27be8d79 | [] | no_license | hks225/hh-update-java | b546249680a6b8c383f4b966bea3f50e7c9078fd | 6b3205522ed2f1632e4cc270bb6319e5d9e81744 | refs/heads/master | 2020-04-12T03:37:47.296257 | 2019-01-03T15:36:16 | 2019-01-03T15:36:16 | 162,272,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package pages;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import io.qameta.allure.Step;
import static com.codeborne.selenide.Selenide.*;
import static com.codeborne.selenide.Selectors.*;
public class MainPage extends BasePage {
private SelenideElement resumeMenu = $("div[data-qa='mainmenu_resumes']");
private SelenideElement myResume = $(byText("Мои резюме"));
@Step
public MyResumePage openMyResumes() {
resumeMenu.hover();
myResume.click();
myResume.should(Condition.disappear);
return new MyResumePage();
}
}
| [
"hks.donntu@gmail.com"
] | hks.donntu@gmail.com |
82e89268038a38b47d46b569df9f65be70643c2c | 1a319a2df61cd90b0ec9728c7436e7c407d2f46c | /src/main/java/com/fontend/fontendlearn/config/MyConfigurationSupport.java | 774731a7de7df7337e2673a8598ecaa7219a0085 | [] | no_license | lumingfei156/FontEndLearn | 384eeb63d0aa979dea971be1f37f954eaf03013f | a1b323c19e4364b0b6be266b092324b1a233f99b | refs/heads/master | 2020-04-11T06:18:11.592189 | 2019-01-21T07:56:51 | 2019-01-21T07:56:51 | 161,577,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,160 | java | package com.fontend.fontendlearn.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
/**
* @author lulu
* @since 2018/12/13
* 默认的静态文件所在文件夹是static
* 自定义静态文件所在文件夹,改成my
*/
@Configuration
public class MyConfigurationSupport extends WebMvcConfigurationSupport {
/**
* 自定义静态文件存放位置
* @param registry ss
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry){
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
// registry.addResourceHandler("/templates/**").addResourceLocations("classpath:/templates/");
super.addResourceHandlers(registry);
}
/**
* 将某一访问路径和某个页面绑定,即不通过controller直接访问某个页面
* @param registry ss
*/
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/xmlHttRequestAttr").setViewName("XMLHttpRequestAttr");
registry.addViewController("/XMLHttpRequestGet").setViewName("XMLHttpRequestGet");
registry.addViewController("/xhrLoadEvent").setViewName("xhrLoadEvent");
registry.addViewController("/xhrProgressEvent").setViewName("xhrProgressEvent");
registry.addViewController("/httpFlow").setViewName("httpFlow");
super.addViewControllers(registry);
}
/**
*实现拦截器效果
* @param registry ss
*/
// @Override
// public void addInterceptors(InterceptorRegistry registry) {
// // addPathPatterns 用于添加拦截规则
// // excludePathPatterns 用户排除拦截
// registry.addInterceptor(new MyInterceptor()).excludePathPatterns("/userService/goLogin","/login","/static/**").addPathPatterns("/**");
// super.addInterceptors(registry);
// }
}
| [
"33613049+lumingfei156@users.noreply.github.com"
] | 33613049+lumingfei156@users.noreply.github.com |
3d2725342e9305a654e08bf4cdf64b0bd5da8be6 | b55109e36f35eda6cb84bfbe67cf2f363ace235e | /Server/src/DataService/AccountDataService.java | ddc33f4f8456698b6f0e28ade36efb5fb73f79b1 | [] | no_license | JonySheep/XiangXiangDeng | cb87e65e24080302f3f135e9e22f23735fe424d5 | 4ad25e3781d30050c5c7e0b29767e07477cae750 | refs/heads/master | 2021-04-30T12:18:09.803163 | 2018-02-12T16:51:37 | 2018-02-12T16:51:37 | 121,271,929 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package DataService;
import PO.AccountPO;
import Util.ResultMessage;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
/**
* Created by Jeven on 2017/10/23.
*/
public interface AccountDataService extends Remote
{
/**
*
* @param id
* @return 返回删除结果
* @throws RemoteException
*/
ResultMessage disguiseDeleteAccount(String id) throws RemoteException;
/**
*
* @param po
* @return 返回新增结果
* @throws RemoteException
*/
ResultMessage insert(AccountPO po) throws RemoteException;
/**
*
* @param po
* @return 返回更新结果
* @throws RemoteException
*/
ResultMessage update(AccountPO po) throws RemoteException;
/**
*
* @param cardName
* @return 返回找到的Account信息(唯一确定)
* @throws RemoteException
*/
AccountPO getInfo(String cardName) throws RemoteException;
/**
*
* @param str
* @return 返回模糊查找的结果(不唯一)
* @throws RemoteException
*/
ArrayList<AccountPO> search(String str) throws RemoteException;
ArrayList<AccountPO> getAllAccounts() throws RemoteException;
}
| [
"161250180@mail.smal.nju.edu.cn"
] | 161250180@mail.smal.nju.edu.cn |
d7b7355ff37c2d1e17f277053b386ad950693289 | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/DB/Lang39/AstorMain-lang39/src/variant-1384/org/apache/commons/lang3/StringUtils.java | ac8722f1a05b0a223993017f9aae2d771e667032 | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74,410 | java | package org.apache.commons.lang3;
public class StringUtils {
public static final java.lang.String EMPTY = "";
public static final int INDEX_NOT_FOUND = -1;
private static final int PAD_LIMIT = 8192;
public StringUtils() {
super();
}
public static boolean isEmpty(java.lang.CharSequence str) {
return (str == null) || ((str.length()) == 0);
}
public static boolean isNotEmpty(java.lang.CharSequence str) {
return !(org.apache.commons.lang3.StringUtils.isEmpty(str));
}
public static boolean isBlank(java.lang.CharSequence str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return true;
}
for (int i = 0 ; i < strLen ; i++) {
if ((java.lang.Character.isWhitespace(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNotBlank(java.lang.CharSequence str) {
return !(org.apache.commons.lang3.StringUtils.isBlank(str));
}
public static java.lang.String trim(java.lang.String str) {
return str == null ? null : str.trim();
}
public static java.lang.String trimToNull(java.lang.String str) {
java.lang.String ts = org.apache.commons.lang3.StringUtils.trim(str);
return org.apache.commons.lang3.StringUtils.isEmpty(ts) ? null : ts;
}
public static java.lang.String trimToEmpty(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : str.trim();
}
public static java.lang.String strip(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.strip(str, null);
}
public static java.lang.String stripToNull(java.lang.String str) {
if (str == null) {
return null;
}
str = org.apache.commons.lang3.StringUtils.strip(str, null);
return (str.length()) == 0 ? null : str;
}
public static java.lang.String stripToEmpty(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : org.apache.commons.lang3.StringUtils.strip(str, null);
}
public static java.lang.String strip(java.lang.String str, java.lang.String stripChars) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
str = org.apache.commons.lang3.StringUtils.stripStart(str, stripChars);
return org.apache.commons.lang3.StringUtils.stripEnd(str, stripChars);
}
public static java.lang.String stripStart(java.lang.String str, java.lang.String stripChars) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
int start = 0;
if (stripChars == null) {
while ((start != strLen) && (java.lang.Character.isWhitespace(str.charAt(start)))) {
start++;
}
} else {
if ((stripChars.length()) == 0) {
return str;
} else {
while ((start != strLen) && ((stripChars.indexOf(str.charAt(start))) != (-1))) {
start++;
}
}
}
return str.substring(start);
}
public static java.lang.String stripEnd(java.lang.String str, java.lang.String stripChars) {
int end;
if ((str == null) || ((end = str.length()) == 0)) {
return str;
}
if (stripChars == null) {
while ((end != 0) && (java.lang.Character.isWhitespace(str.charAt((end - 1))))) {
end--;
}
} else {
if ((stripChars.length()) == 0) {
return str;
} else {
while ((end != 0) && ((stripChars.indexOf(str.charAt((end - 1)))) != (-1))) {
end--;
}
}
}
return str.substring(0, end);
}
public static java.lang.String[] stripAll(java.lang.String[] strs) {
return org.apache.commons.lang3.StringUtils.stripAll(strs, null);
}
public static java.lang.String[] stripAll(java.lang.String[] strs, java.lang.String stripChars) {
int strsLen;
if ((strs == null) || ((strsLen = strs.length) == 0)) {
return strs;
}
java.lang.String[] newArr = new java.lang.String[strsLen];
for (int i = 0 ; i < strsLen ; i++) {
newArr[i] = org.apache.commons.lang3.StringUtils.strip(strs[i], stripChars);
}
return newArr;
}
public static java.lang.String stripAccents(java.lang.String input) {
if (input == null) {
return null;
}
if (org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(1.6F)) {
try {
java.lang.Class normalizerFormClass = org.apache.commons.lang3.ClassUtils.getClass("java.text.Normalizer$Form", false);
java.lang.Class normalizerClass = org.apache.commons.lang3.ClassUtils.getClass("java.text.Normalizer", false);
java.lang.reflect.Method method = normalizerClass.getMethod("normalize", java.lang.CharSequence.class, normalizerFormClass);
java.lang.reflect.Field nfd = normalizerFormClass.getField("NFD");
java.lang.String decomposed = ((java.lang.String)(method.invoke(null, input, nfd.get(null))));
java.util.regex.Pattern accentPattern = java.util.regex.Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
return accentPattern.matcher(decomposed).replaceAll("");
} catch (java.lang.ClassNotFoundException cnfe) {
throw new java.lang.RuntimeException("ClassNotFoundException occurred during 1.6 backcompat code" , cnfe);
} catch (java.lang.NoSuchMethodException nsme) {
throw new java.lang.RuntimeException("NoSuchMethodException occurred during 1.6 backcompat code" , nsme);
} catch (java.lang.NoSuchFieldException nsfe) {
throw new java.lang.RuntimeException("NoSuchFieldException occurred during 1.6 backcompat code" , nsfe);
} catch (java.lang.IllegalAccessException iae) {
throw new java.lang.RuntimeException("IllegalAccessException occurred during 1.6 backcompat code" , iae);
} catch (java.lang.IllegalArgumentException iae) {
throw new java.lang.RuntimeException("IllegalArgumentException occurred during 1.6 backcompat code" , iae);
} catch (java.lang.reflect.InvocationTargetException ite) {
throw new java.lang.RuntimeException("InvocationTargetException occurred during 1.6 backcompat code" , ite);
} catch (java.lang.SecurityException se) {
throw new java.lang.RuntimeException("SecurityException occurred during 1.6 backcompat code" , se);
}
} else {
throw new java.lang.UnsupportedOperationException("The stripAccents(String) method is not supported until Java 1.6");
}
}
public static boolean equals(java.lang.String str1, java.lang.String str2) {
return str1 == null ? str2 == null : str1.equals(str2);
}
public static boolean equalsIgnoreCase(java.lang.String str1, java.lang.String str2) {
return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2);
}
public static int indexOf(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.indexOf(searchChar);
}
public static int indexOf(java.lang.String str, char searchChar, int startPos) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.indexOf(searchChar, startPos);
}
public static int indexOf(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.indexOf(searchStr);
}
public static int ordinalIndexOf(java.lang.String str, java.lang.String searchStr, int ordinal) {
if (((str == null) || (searchStr == null)) || (ordinal <= 0)) {
return org.apache.commons.lang3.StringUtils.INDEX_NOT_FOUND;
}
if ((searchStr.length()) == 0) {
return 0;
}
int found = 0;
int index = org.apache.commons.lang3.StringUtils.INDEX_NOT_FOUND;
do {
index = str.indexOf(searchStr, (index + 1));
if (index < 0) {
return index;
}
found++;
} while (found < ordinal );
return index;
}
public static int indexOf(java.lang.String str, java.lang.String searchStr, int startPos) {
if ((str == null) || (searchStr == null)) {
return -1;
}
if (((searchStr.length()) == 0) && (startPos >= (str.length()))) {
return str.length();
}
return str.indexOf(searchStr, startPos);
}
public static int lastIndexOf(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar);
}
public static int lastIndexOf(java.lang.String str, char searchChar, int startPos) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return -1;
}
return str.lastIndexOf(searchChar, startPos);
}
public static int lastIndexOf(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.lastIndexOf(searchStr);
}
public static int lastIndexOf(java.lang.String str, java.lang.String searchStr, int startPos) {
if ((str == null) || (searchStr == null)) {
return -1;
}
return str.lastIndexOf(searchStr, startPos);
}
public static boolean contains(java.lang.String str, char searchChar) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return false;
}
return (str.indexOf(searchChar)) >= 0;
}
public static boolean contains(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return false;
}
return (str.indexOf(searchStr)) >= 0;
}
public static boolean containsIgnoreCase(java.lang.String str, java.lang.String searchStr) {
if ((str == null) || (searchStr == null)) {
return false;
}
int len = searchStr.length();
int max = (str.length()) - len;
for (int i = 0 ; i <= max ; i++) {
if (str.regionMatches(true, i, searchStr, 0, len)) {
return true;
}
}
return false;
}
public static int indexOfAny(java.lang.String str, char[] searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchChars))) {
return -1;
}
for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
return i;
}
}
}
return -1;
}
public static int indexOfAny(java.lang.String str, java.lang.String searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return -1;
}
return org.apache.commons.lang3.StringUtils.indexOfAny(str, searchChars.toCharArray());
}
public static boolean containsAny(java.lang.String str, char[] searchChars) {
if ((((str == null) || ((str.length()) == 0)) || (searchChars == null)) || ((searchChars.length) == 0)) {
return false;
}
for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
return true;
}
}
}
return false;
}
public static boolean containsAny(java.lang.String str, java.lang.String searchChars) {
if (searchChars == null) {
return false;
}
return org.apache.commons.lang3.StringUtils.containsAny(str, searchChars.toCharArray());
}
public static int indexOfAnyBut(java.lang.String str, char[] searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchChars))) {
return -1;
}
outer : for (int i = 0 ; i < (str.length()) ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < (searchChars.length) ; j++) {
if ((searchChars[j]) == ch) {
continue outer;
}
}
return i;
}
return -1;
}
public static int indexOfAnyBut(java.lang.String str, java.lang.String searchChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return -1;
}
for (int i = 0 ; i < (str.length()) ; i++) {
if ((searchChars.indexOf(str.charAt(i))) < 0) {
return i;
}
}
return -1;
}
public static boolean containsOnly(java.lang.String str, char[] valid) {
if ((valid == null) || (str == null)) {
return false;
}
if ((str.length()) == 0) {
return true;
}
if ((valid.length) == 0) {
return false;
}
return (org.apache.commons.lang3.StringUtils.indexOfAnyBut(str, valid)) == (-1);
}
public static boolean containsOnly(java.lang.String str, java.lang.String validChars) {
if ((str == null) || (validChars == null)) {
return false;
}
return org.apache.commons.lang3.StringUtils.containsOnly(str, validChars.toCharArray());
}
public static boolean containsNone(java.lang.String str, char[] invalidChars) {
if ((str == null) || (invalidChars == null)) {
return true;
}
int strSize = str.length();
int validSize = invalidChars.length;
for (int i = 0 ; i < strSize ; i++) {
char ch = str.charAt(i);
for (int j = 0 ; j < validSize ; j++) {
if ((invalidChars[j]) == ch) {
return false;
}
}
}
return true;
}
public static boolean containsNone(java.lang.String str, java.lang.String invalidChars) {
if ((str == null) || (invalidChars == null)) {
return true;
}
return org.apache.commons.lang3.StringUtils.containsNone(str, invalidChars.toCharArray());
}
public static int indexOfAny(java.lang.String str, java.lang.String[] searchStrs) {
if ((str == null) || (searchStrs == null)) {
return -1;
}
int sz = searchStrs.length;
int ret = java.lang.Integer.MAX_VALUE;
int tmp = 0;
for (int i = 0 ; i < sz ; i++) {
java.lang.String search = searchStrs[i];
if (search == null) {
continue;
}
tmp = str.indexOf(search);
if (tmp == (-1)) {
continue;
}
if (tmp < ret) {
ret = tmp;
}
}
return ret == (java.lang.Integer.MAX_VALUE) ? -1 : ret;
}
public static int lastIndexOfAny(java.lang.String str, java.lang.String[] searchStrs) {
if ((str == null) || (searchStrs == null)) {
return -1;
}
int sz = searchStrs.length;
int ret = -1;
int tmp = 0;
for (int i = 0 ; i < sz ; i++) {
java.lang.String search = searchStrs[i];
if (search == null) {
continue;
}
tmp = str.lastIndexOf(search);
if (tmp > ret) {
ret = tmp;
}
}
return ret;
}
public static java.lang.String substring(java.lang.String str, int start) {
if (str == null) {
return null;
}
if (start < 0) {
start = (str.length()) + start;
}
if (start < 0) {
start = 0;
}
if (start > (str.length())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring(start);
}
public static java.lang.String substring(java.lang.String str, int start, int end) {
if (str == null) {
return null;
}
if (end < 0) {
end = (str.length()) + end;
}
if (start < 0) {
start = (str.length()) + start;
}
if (end > (str.length())) {
end = str.length();
}
if (start > end) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if (start < 0) {
start = 0;
}
if (end < 0) {
end = 0;
}
return str.substring(start, end);
}
public static java.lang.String left(java.lang.String str, int len) {
if (str == null) {
return null;
}
if (len < 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if ((str.length()) <= len) {
return str;
}
return str.substring(0, len);
}
public static java.lang.String right(java.lang.String str, int len) {
if (str == null) {
return null;
}
if (len < 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if ((str.length()) <= len) {
return str;
}
return str.substring(((str.length()) - len));
}
public static java.lang.String mid(java.lang.String str, int pos, int len) {
if (str == null) {
return null;
}
if ((len < 0) || (pos > (str.length()))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
if (pos < 0) {
pos = 0;
}
if ((str.length()) <= (pos + len)) {
return str.substring(pos);
}
return str.substring(pos, (pos + len));
}
public static java.lang.String substringBefore(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (separator == null)) {
return str;
}
if ((separator.length()) == 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.indexOf(separator);
if (pos == (-1)) {
return str;
}
return str.substring(0, pos);
}
public static java.lang.String substringAfter(java.lang.String str, java.lang.String separator) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if (separator == null) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.indexOf(separator);
if (pos == (-1)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring((pos + (separator.length())));
}
public static java.lang.String substringBeforeLast(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(separator))) {
return str;
}
int pos = str.lastIndexOf(separator);
if (pos == (-1)) {
return str;
}
return str.substring(0, pos);
}
public static java.lang.String substringAfterLast(java.lang.String str, java.lang.String separator) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(separator)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int pos = str.lastIndexOf(separator);
if ((pos == (-1)) || (pos == ((str.length()) - (separator.length())))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str.substring((pos + (separator.length())));
}
public static java.lang.String substringBetween(java.lang.String str, java.lang.String tag) {
return org.apache.commons.lang3.StringUtils.substringBetween(str, tag, tag);
}
public static java.lang.String substringBetween(java.lang.String str, java.lang.String open, java.lang.String close) {
if (((str == null) || (open == null)) || (close == null)) {
return null;
}
int start = str.indexOf(open);
if (start != (-1)) {
int end = str.indexOf(close, (start + (open.length())));
if (end != (-1)) {
return str.substring((start + (open.length())), end);
}
}
return null;
}
public static java.lang.String[] substringsBetween(java.lang.String str, java.lang.String open, java.lang.String close) {
if (((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(open))) || (org.apache.commons.lang3.StringUtils.isEmpty(close))) {
return null;
}
int strLen = str.length();
if (strLen == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
int closeLen = close.length();
int openLen = open.length();
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int pos = 0;
while (pos < (strLen - closeLen)) {
int start = str.indexOf(open, pos);
if (start < 0) {
break;
}
start += openLen;
int end = str.indexOf(close, start);
if (end < 0) {
break;
}
list.add(str.substring(start, end));
pos = end + closeLen;
}
if (list.isEmpty()) {
return null;
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] split(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.split(str, null, (-1));
}
public static java.lang.String[] split(java.lang.String str, char separatorChar) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChar, false);
}
public static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, (-1), false);
}
public static java.lang.String[] split(java.lang.String str, java.lang.String separatorChars, int max) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, max, false);
}
public static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, (-1), false);
}
public static java.lang.String[] splitByWholeSeparator(java.lang.String str, java.lang.String separator, int max) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, max, false);
}
public static java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String str, java.lang.String separator) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, (-1), true);
}
public static java.lang.String[] splitByWholeSeparatorPreserveAllTokens(java.lang.String str, java.lang.String separator, int max) {
return org.apache.commons.lang3.StringUtils.splitByWholeSeparatorWorker(str, separator, max, true);
}
private static java.lang.String[] splitByWholeSeparatorWorker(java.lang.String str, java.lang.String separator, int max, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
if ((separator == null) || (org.apache.commons.lang3.StringUtils.EMPTY.equals(separator))) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, null, max, preserveAllTokens);
}
int separatorLength = separator.length();
java.util.ArrayList<java.lang.String> substrings = new java.util.ArrayList<java.lang.String>();
int numberOfSubstrings = 0;
int beg = 0;
int end = 0;
while (end < len) {
end = str.indexOf(separator, beg);
if (end > (-1)) {
if (end > beg) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
substrings.add(str.substring(beg, end));
beg = end + separatorLength;
}
} else {
if (preserveAllTokens) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
substrings.add(org.apache.commons.lang3.StringUtils.EMPTY);
}
}
beg = end + separatorLength;
}
} else {
substrings.add(str.substring(beg));
end = len;
}
}
return substrings.toArray(new java.lang.String[substrings.size()]);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, null, (-1), true);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, char separatorChar) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChar, true);
}
private static java.lang.String[] splitWorker(java.lang.String str, char separatorChar, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int i = 0;
int start = 0;
boolean match = false;
boolean lastMatch = false;
while (i < len) {
if ((str.charAt(i)) == separatorChar) {
if (match || preserveAllTokens) {
list.add(str.substring(start, i));
match = false;
lastMatch = true;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
if (match || (preserveAllTokens && lastMatch)) {
list.add(str.substring(start, i));
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, (-1), true);
}
public static java.lang.String[] splitPreserveAllTokens(java.lang.String str, java.lang.String separatorChars, int max) {
return org.apache.commons.lang3.StringUtils.splitWorker(str, separatorChars, max, true);
}
private static java.lang.String[] splitWorker(java.lang.String str, java.lang.String separatorChars, int max, boolean preserveAllTokens) {
if (str == null) {
return null;
}
int len = str.length();
if (len == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int sizePlus1 = 1;
int i = 0;
int start = 0;
boolean match = false;
boolean lastMatch = false;
if (separatorChars == null) {
while (i < len) {
if (java.lang.Character.isWhitespace(str.charAt(i))) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else {
if ((separatorChars.length()) == 1) {
char sep = separatorChars.charAt(0);
while (i < len) {
if ((str.charAt(i)) == sep) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else {
while (i < len) {
if ((separatorChars.indexOf(str.charAt(i))) >= 0) {
if (match || preserveAllTokens) {
lastMatch = true;
if ((sizePlus1++) == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
}
}
if (match || (preserveAllTokens && lastMatch)) {
list.add(str.substring(start, i));
}
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String[] splitByCharacterType(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitByCharacterType(str, false);
}
public static java.lang.String[] splitByCharacterTypeCamelCase(java.lang.String str) {
return org.apache.commons.lang3.StringUtils.splitByCharacterType(str, true);
}
private static java.lang.String[] splitByCharacterType(java.lang.String str, boolean camelCase) {
if (str == null) {
return null;
}
if ((str.length()) == 0) {
return org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
}
char[] c = str.toCharArray();
java.util.List<java.lang.String> list = new java.util.ArrayList<java.lang.String>();
int tokenStart = 0;
int currentType = java.lang.Character.getType(c[tokenStart]);
for (int pos = tokenStart + 1 ; pos < (c.length) ; pos++) {
int type = java.lang.Character.getType(c[pos]);
if (type == currentType) {
continue;
}
if ((camelCase && (type == (java.lang.Character.LOWERCASE_LETTER))) && (currentType == (java.lang.Character.UPPERCASE_LETTER))) {
int newTokenStart = pos - 1;
if (newTokenStart != tokenStart) {
list.add(new java.lang.String(c , tokenStart , (newTokenStart - tokenStart)));
tokenStart = newTokenStart;
}
} else {
list.add(new java.lang.String(c , tokenStart , (pos - tokenStart)));
tokenStart = pos;
}
currentType = type;
}
list.add(new java.lang.String(c , tokenStart , ((c.length) - tokenStart)));
return list.toArray(new java.lang.String[list.size()]);
}
public static java.lang.String join(java.lang.Object[] array) {
return org.apache.commons.lang3.StringUtils.join(array, null);
}
public static java.lang.String join(java.lang.Object[] array, char separator) {
if (array == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(array, separator, 0, array.length);
}
public static java.lang.String join(java.lang.Object[] array, char separator, int startIndex, int endIndex) {
if (array == null) {
return null;
}
int bufSize = endIndex - startIndex;
if (bufSize <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
bufSize *= ((array[startIndex]) == null ? 16 : array[startIndex].toString().length()) + 1;
java.lang.StringBuilder buf = new java.lang.StringBuilder(bufSize);
for (int i = startIndex ; i < endIndex ; i++) {
if (i > startIndex) {
buf.append(separator);
}
if ((array[i]) != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
public static java.lang.String join(java.lang.Object[] array, java.lang.String separator) {
if (array == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(array, separator, 0, array.length);
}
public static java.lang.String join(java.lang.Object[] array, java.lang.String separator, int startIndex, int endIndex) {
if (array == null) {
return null;
}
if (separator == null) {
separator = org.apache.commons.lang3.StringUtils.EMPTY;
}
int bufSize = endIndex - startIndex;
if (bufSize <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
bufSize *= ((array[startIndex]) == null ? 16 : array[startIndex].toString().length()) + (separator.length());
java.lang.StringBuilder buf = new java.lang.StringBuilder(bufSize);
for (int i = startIndex ; i < endIndex ; i++) {
if (i > startIndex) {
buf.append(separator);
}
if ((array[i]) != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
public static java.lang.String join(java.util.Iterator<?> iterator, char separator) {
if (iterator == null) {
return null;
}
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
java.lang.Object first = iterator.next();
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.ObjectUtils.toString(first);
}
java.lang.StringBuilder buf = new java.lang.StringBuilder(256);
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
buf.append(separator);
java.lang.Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
}
return buf.toString();
}
public static java.lang.String join(java.util.Iterator<?> iterator, java.lang.String separator) {
if (iterator == null) {
return null;
}
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
java.lang.Object first = iterator.next();
if (!(iterator.hasNext())) {
return org.apache.commons.lang3.ObjectUtils.toString(first);
}
java.lang.StringBuilder buf = new java.lang.StringBuilder(256);
if (first != null) {
buf.append(first);
}
while (iterator.hasNext()) {
if (separator != null) {
buf.append(separator);
}
java.lang.Object obj = iterator.next();
if (obj != null) {
buf.append(obj);
}
}
return buf.toString();
}
public static java.lang.String join(java.lang.Iterable<?> iterable, char separator) {
if (iterable == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(iterable.iterator(), separator);
}
public static java.lang.String join(java.lang.Iterable<?> iterable, java.lang.String separator) {
if (iterable == null) {
return null;
}
return org.apache.commons.lang3.StringUtils.join(iterable.iterator(), separator);
}
public static java.lang.String deleteWhitespace(java.lang.String str) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
int sz = str.length();
char[] chs = new char[sz];
int count = 0;
for (int i = 0 ; i < sz ; i++) {
if (!(java.lang.Character.isWhitespace(str.charAt(i)))) {
chs[(count++)] = str.charAt(i);
}
}
if (count == sz) {
return str;
}
return new java.lang.String(chs , 0 , count);
}
public static java.lang.String removeStart(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (str.startsWith(remove)) {
return str.substring(remove.length());
}
return str;
}
public static java.lang.String removeStartIgnoreCase(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (org.apache.commons.lang3.StringUtils.startsWithIgnoreCase(str, remove)) {
return str.substring(remove.length());
}
return str;
}
public static java.lang.String removeEnd(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (str.endsWith(remove)) {
return str.substring(0, ((str.length()) - (remove.length())));
}
return str;
}
public static java.lang.String removeEndIgnoreCase(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
if (org.apache.commons.lang3.StringUtils.endsWithIgnoreCase(str, remove)) {
return str.substring(0, ((str.length()) - (remove.length())));
}
return str;
}
public static java.lang.String remove(java.lang.String str, java.lang.String remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(remove))) {
return str;
}
return org.apache.commons.lang3.StringUtils.replace(str, remove, org.apache.commons.lang3.StringUtils.EMPTY, (-1));
}
public static java.lang.String remove(java.lang.String str, char remove) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || ((str.indexOf(remove)) == (-1))) {
return str;
}
char[] chars = str.toCharArray();
int pos = 0;
for (int i = 0 ; i < (chars.length) ; i++) {
if ((chars[i]) != remove) {
chars[(pos++)] = chars[i];
}
}
return new java.lang.String(chars , 0 , pos);
}
public static java.lang.String replaceOnce(java.lang.String text, java.lang.String searchString, java.lang.String replacement) {
return org.apache.commons.lang3.StringUtils.replace(text, searchString, replacement, 1);
}
public static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.String replacement) {
return org.apache.commons.lang3.StringUtils.replace(text, searchString, replacement, (-1));
}
public static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.String replacement, int max) {
if ((((org.apache.commons.lang3.StringUtils.isEmpty(text)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchString))) || (replacement == null)) || (max == 0)) {
return text;
}
int start = 0;
int end = text.indexOf(searchString, start);
if (end == (-1)) {
return text;
}
int replLength = searchString.length();
int increase = (replacement.length()) - replLength;
increase = increase < 0 ? 0 : increase;
increase *= max < 0 ? 16 : max > 64 ? 64 : max;
java.lang.StringBuilder buf = new java.lang.StringBuilder(((text.length()) + increase));
while (end != (-1)) {
buf.append(text.substring(start, end)).append(replacement);
start = end + replLength;
if ((--max) == 0) {
break;
}
end = text.indexOf(searchString, start);
}
buf.append(text.substring(start));
return buf.toString();
}
public static java.lang.String replaceEach(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList) {
return org.apache.commons.lang3.StringUtils.replaceEach(text, searchList, replacementList, false, 0);
}
public static java.lang.String replaceEachRepeatedly(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList) {
int timeToLive = searchList == null ? 0 : searchList.length;
return org.apache.commons.lang3.StringUtils.replaceEach(text, searchList, replacementList, true, timeToLive);
}
private static java.lang.String replaceEach(java.lang.String text, java.lang.String[] searchList, java.lang.String[] replacementList, boolean repeat, int timeToLive) {
if ((((((text == null) || ((text.length()) == 0)) || (searchList == null)) || ((searchList.length) == 0)) || (replacementList == null)) || ((replacementList.length) == 0)) {
return text;
}
if (timeToLive < 0) {
throw new java.lang.IllegalStateException(((("TimeToLive of " + timeToLive) + " is less than 0: ") + text));
}
int searchLength = searchList.length;
int replacementLength = replacementList.length;
if (searchLength != replacementLength) {
throw new java.lang.IllegalArgumentException(((("Search and Replace array lengths don't match: " + searchLength) + " vs ") + replacementLength));
}
boolean[] noMoreMatchesForReplIndex = new boolean[searchLength];
int textIndex = -1;
int count = 0;
int replaceIndex = -1;
int tempIndex = -1;
for (int i = 0 ; i < searchLength ; i++) {
if ((((noMoreMatchesForReplIndex[i]) || ((searchList[i]) == null)) || ((searchList[i].length()) == 0)) || ((replacementList[i]) == null)) {
continue;
}
tempIndex = text.indexOf(searchList[i]);
if (tempIndex == (-1)) {
noMoreMatchesForReplIndex[i] = true;
} else {
if ((textIndex == (-1)) || (tempIndex < textIndex)) {
textIndex = tempIndex;
replaceIndex = i;
}
}
}
if (textIndex == (-1)) {
return text;
}
int start = 0;
int increase = 0;
for (int i = 0 ; i < (searchList.length) ; i++) {
int greater = (replacementList[i].length()) - (searchList[i].length());
if (greater > 0) {
increase += 3 * greater;
}
}
increase = java.lang.Math.min(increase, ((text.length()) / 5));
java.lang.StringBuilder buf = new java.lang.StringBuilder(((text.length()) + increase));
while (textIndex != (-1)) {
for (int i = start ; i < textIndex ; i++) {
buf.append(text.charAt(i));
}
buf.append(replacementList[replaceIndex]);
start = textIndex + (searchList[replaceIndex].length());
textIndex = -1;
replaceIndex = -1;
tempIndex = -1;
for (int i = 0 ; i < searchLength ; i++) {
if ((((noMoreMatchesForReplIndex[i]) || ((searchList[i]) == null)) || ((searchList[i].length()) == 0)) || ((replacementList[i]) == null)) {
continue;
}
tempIndex = text.indexOf(searchList[i], start);
if (tempIndex == (-1)) {
noMoreMatchesForReplIndex[i] = true;
} else {
if ((textIndex == (-1)) || (tempIndex < textIndex)) {
textIndex = tempIndex;
replaceIndex = i;
}
}
}
}
int textLength = text.length();
for (int i = start ; i < textLength ; i++) {
buf.append(text.charAt(i));
}
java.lang.String result = buf.toString();
if (!repeat) {
return result;
}
return org.apache.commons.lang3.StringUtils.replaceEach(result, searchList, replacementList, repeat, (timeToLive - 1));
}
public static java.lang.String replaceChars(java.lang.String str, char searchChar, char replaceChar) {
if (str == null) {
return null;
}
return str.replace(searchChar, replaceChar);
}
public static java.lang.String replaceChars(java.lang.String str, java.lang.String searchChars, java.lang.String replaceChars) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(searchChars))) {
return str;
}
if (replaceChars == null) {
replaceChars = org.apache.commons.lang3.StringUtils.EMPTY;
}
boolean modified = false;
int replaceCharsLength = replaceChars.length();
int strLength = str.length();
java.lang.StringBuilder buf = new java.lang.StringBuilder(strLength);
for (int i = 0 ; i < strLength ; i++) {
char ch = str.charAt(i);
int index = searchChars.indexOf(ch);
if (index >= 0) {
modified = true;
if (index < replaceCharsLength) {
buf.append(replaceChars.charAt(index));
}
} else {
buf.append(ch);
}
}
if (modified) {
return buf.toString();
}
return str;
}
public static java.lang.String overlay(java.lang.String str, java.lang.String overlay, int start, int end) {
if (str == null) {
return null;
}
if (overlay == null) {
overlay = org.apache.commons.lang3.StringUtils.EMPTY;
}
int len = str.length();
if (start < 0) {
start = 0;
}
if (start > len) {
start = len;
}
if (end < 0) {
end = 0;
}
if (end > len) {
end = len;
}
if (start > end) {
int temp = start;
start = end;
end = temp;
}
return new java.lang.StringBuilder(((((len + start) - end) + (overlay.length())) + 1)).append(str.substring(0, start)).append(overlay).append(str.substring(end)).toString();
}
public static java.lang.String chomp(java.lang.String str) {
if (org.apache.commons.lang3.StringUtils.isEmpty(str)) {
return str;
}
if ((str.length()) == 1) {
char ch = str.charAt(0);
if ((ch == (org.apache.commons.lang3.CharUtils.CR)) || (ch == (org.apache.commons.lang3.CharUtils.LF))) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str;
}
int lastIdx = (str.length()) - 1;
char last = str.charAt(lastIdx);
if (last == (org.apache.commons.lang3.CharUtils.LF)) {
if ((str.charAt((lastIdx - 1))) == (org.apache.commons.lang3.CharUtils.CR)) {
lastIdx--;
}
} else {
if (last != (org.apache.commons.lang3.CharUtils.CR)) {
lastIdx++;
}
}
return str.substring(0, lastIdx);
}
public static java.lang.String chomp(java.lang.String str, java.lang.String separator) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (separator == null)) {
return str;
}
if (str.endsWith(separator)) {
return str.substring(0, ((str.length()) - (separator.length())));
}
return str;
}
public static java.lang.String chop(java.lang.String str) {
if (str == null) {
return null;
}
int strLen = str.length();
if (strLen < 2) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int lastIdx = strLen - 1;
java.lang.String ret = str.substring(0, lastIdx);
char last = str.charAt(lastIdx);
if (last == (org.apache.commons.lang3.CharUtils.LF)) {
if ((ret.charAt((lastIdx - 1))) == (org.apache.commons.lang3.CharUtils.CR)) {
return ret.substring(0, (lastIdx - 1));
}
}
return ret;
}
public static java.lang.String repeat(java.lang.String str, int repeat) {
if (str == null) {
return null;
}
if (repeat <= 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int inputLength = str.length();
if ((repeat == 1) || (inputLength == 0)) {
return str;
}
if ((inputLength == 1) && (repeat <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.padding(repeat, str.charAt(0));
}
int outputLength = inputLength * repeat;
switch (inputLength) {
case 1 :
char ch = str.charAt(0);
char[] output1 = new char[outputLength];
for (int i = repeat - 1 ; i >= 0 ; i--) {
output1[i] = ch;
}
return new java.lang.String(output1);
case 2 :
char ch0 = str.charAt(0);
char ch1 = str.charAt(1);
char[] output2 = new char[outputLength];
for (int i = (repeat * 2) - 2 ; i >= 0 ; i-- , i--) {
output2[i] = ch0;
output2[(i + 1)] = ch1;
}
return new java.lang.String(output2);
default :
java.lang.StringBuilder buf = new java.lang.StringBuilder(outputLength);
for (int i = 0 ; i < repeat ; i++) {
buf.append(str);
}
return buf.toString();
}
}
public static java.lang.String repeat(java.lang.String str, java.lang.String separator, int repeat) {
if ((str == null) || (separator == null)) {
return org.apache.commons.lang3.StringUtils.repeat(str, repeat);
} else {
java.lang.String result = org.apache.commons.lang3.StringUtils.repeat((str + separator), repeat);
return org.apache.commons.lang3.StringUtils.removeEnd(result, separator);
}
}
private static java.lang.String padding(int repeat, char padChar) throws java.lang.IndexOutOfBoundsException {
if (repeat < 0) {
throw new java.lang.IndexOutOfBoundsException(("Cannot pad a negative amount: " + repeat));
}
final char[] buf = new char[repeat];
for (int i = 0 ; i < (buf.length) ; i++) {
buf[i] = padChar;
}
return new java.lang.String(buf);
}
public static java.lang.String rightPad(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, ' ');
}
public static java.lang.String rightPad(java.lang.String str, int size, char padChar) {
if (str == null) {
return null;
}
int pads = size - (str.length());
if (pads <= 0) {
return str;
}
if (pads > (org.apache.commons.lang3.StringUtils.PAD_LIMIT)) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, java.lang.String.valueOf(padChar));
}
return str.concat(org.apache.commons.lang3.StringUtils.padding(pads, padChar));
}
public static java.lang.String rightPad(java.lang.String str, int size, java.lang.String padStr) {
if (str == null) {
return null;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int padLen = padStr.length();
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
if ((padLen == 1) && (pads <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.rightPad(str, size, padStr.charAt(0));
}
if (pads == padLen) {
return str.concat(padStr);
} else {
if (pads < padLen) {
return str.concat(padStr.substring(0, pads));
} else {
char[] padding = new char[pads];
char[] padChars = padStr.toCharArray();
for (int i = 0 ; i < pads ; i++) {
padding[i] = padChars[(i % padLen)];
}
return str.concat(new java.lang.String(padding));
}
}
}
public static java.lang.String leftPad(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, ' ');
}
public static java.lang.String leftPad(java.lang.String str, int size, char padChar) {
if (str == null) {
return null;
}
int pads = size - (str.length());
if (pads <= 0) {
return str;
}
if (pads > (org.apache.commons.lang3.StringUtils.PAD_LIMIT)) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, java.lang.String.valueOf(padChar));
}
return org.apache.commons.lang3.StringUtils.padding(pads, padChar).concat(str);
}
public static java.lang.String leftPad(java.lang.String str, int size, java.lang.String padStr) {
if (str == null) {
return null;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int padLen = padStr.length();
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
if ((padLen == 1) && (pads <= (org.apache.commons.lang3.StringUtils.PAD_LIMIT))) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, padStr.charAt(0));
}
if (pads == padLen) {
return padStr.concat(str);
} else {
if (pads < padLen) {
return padStr.substring(0, pads).concat(str);
} else {
char[] padding = new char[pads];
char[] padChars = padStr.toCharArray();
for (int i = 0 ; i < pads ; i++) {
padding[i] = padChars[(i % padLen)];
}
return new java.lang.String(padding).concat(str);
}
}
}
public static int length(java.lang.String str) {
return str == null ? 0 : str.length();
}
public static java.lang.String center(java.lang.String str, int size) {
return org.apache.commons.lang3.StringUtils.center(str, size, ' ');
}
public static java.lang.String center(java.lang.String str, int size, char padChar) {
if ((str == null) || (size <= 0)) {
return str;
}
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
str = org.apache.commons.lang3.StringUtils.leftPad(str, (strLen + (pads / 2)), padChar);
str = org.apache.commons.lang3.StringUtils.rightPad(str, size, padChar);
return str;
}
public static java.lang.String center(java.lang.String str, int size, java.lang.String padStr) {
if ((str == null) || (size <= 0)) {
return str;
}
if (org.apache.commons.lang3.StringUtils.isEmpty(padStr)) {
padStr = " ";
}
int strLen = str.length();
int pads = size - strLen;
if (pads <= 0) {
return str;
}
str = org.apache.commons.lang3.StringUtils.leftPad(str, (strLen + (pads / 2)), padStr);
str = org.apache.commons.lang3.StringUtils.rightPad(str, size, padStr);
return str;
}
public static java.lang.String upperCase(java.lang.String str) {
if (str == null) {
return null;
}
return str.toUpperCase();
}
public static java.lang.String upperCase(java.lang.String str, java.util.Locale locale) {
if (str == null) {
return null;
}
return str.toUpperCase(locale);
}
public static java.lang.String lowerCase(java.lang.String str) {
if (str == null) {
return null;
}
return str.toLowerCase();
}
public static java.lang.String lowerCase(java.lang.String str, java.util.Locale locale) {
if (str == null) {
return null;
}
return str.toLowerCase(locale);
}
public static java.lang.String capitalize(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
return new java.lang.StringBuilder(strLen).append(java.lang.Character.toTitleCase(str.charAt(0))).append(str.substring(1)).toString();
}
public static java.lang.String uncapitalize(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
return new java.lang.StringBuilder(strLen).append(java.lang.Character.toLowerCase(str.charAt(0))).append(str.substring(1)).toString();
}
public static java.lang.String swapCase(java.lang.String str) {
int strLen;
if ((str == null) || ((strLen = str.length()) == 0)) {
return str;
}
java.lang.StringBuilder buffer = new java.lang.StringBuilder(strLen);
char ch = 0;
for (int i = 0 ; i < strLen ; i++) {
ch = str.charAt(i);
if (java.lang.Character.isUpperCase(ch)) {
ch = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isTitleCase(ch)) {
ch = java.lang.Character.toLowerCase(ch);
} else {
if (java.lang.Character.isLowerCase(ch)) {
ch = java.lang.Character.toUpperCase(ch);
}
}
}
buffer.append(ch);
}
return buffer.toString();
}
public static int countMatches(java.lang.String str, java.lang.String sub) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(str)) || (org.apache.commons.lang3.StringUtils.isEmpty(sub))) {
return 0;
}
int count = 0;
int idx = 0;
while ((idx = str.indexOf(sub, idx)) != (-1)) {
count++;
idx += sub.length();
}
return count;
}
public static boolean isAlpha(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLetter(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAlphaSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isLetter(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isAlphanumeric(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLetterOrDigit(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAlphanumericSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isLetterOrDigit(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isAsciiPrintable(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((org.apache.commons.lang3.CharUtils.isAsciiPrintable(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNumeric(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isDigit(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isNumericSpace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if (((java.lang.Character.isDigit(str.charAt(i))) == false) && ((str.charAt(i)) != ' ')) {
return false;
}
}
return true;
}
public static boolean isWhitespace(java.lang.String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isWhitespace(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAllLowerCase(java.lang.String str) {
if ((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(str))) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isLowerCase(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static boolean isAllUpperCase(java.lang.String str) {
if ((str == null) || (org.apache.commons.lang3.StringUtils.isEmpty(str))) {
return false;
}
int sz = str.length();
for (int i = 0 ; i < sz ; i++) {
if ((java.lang.Character.isUpperCase(str.charAt(i))) == false) {
return false;
}
}
return true;
}
public static java.lang.String defaultString(java.lang.String str) {
return str == null ? org.apache.commons.lang3.StringUtils.EMPTY : str;
}
public static java.lang.String defaultString(java.lang.String str, java.lang.String defaultStr) {
return str == null ? defaultStr : str;
}
public static java.lang.String defaultIfEmpty(java.lang.String str, java.lang.String defaultStr) {
return org.apache.commons.lang3.StringUtils.isEmpty(str) ? defaultStr : str;
}
public static java.lang.String reverse(java.lang.String str) {
if (str == null) {
return null;
}
return new java.lang.StringBuilder(str).reverse().toString();
}
public static java.lang.String reverseDelimited(java.lang.String str, char separatorChar) {
if (str == null) {
return null;
}
java.lang.String[] strs = org.apache.commons.lang3.StringUtils.split(str, separatorChar);
org.apache.commons.lang3.ArrayUtils.reverse(strs);
return org.apache.commons.lang3.StringUtils.join(strs, separatorChar);
}
public static java.lang.String abbreviate(java.lang.String str, int maxWidth) {
return org.apache.commons.lang3.StringUtils.abbreviate(str, 0, maxWidth);
}
public static java.lang.String abbreviate(java.lang.String str, int offset, int maxWidth) {
if (str == null) {
return null;
}
if (maxWidth < 4) {
throw new java.lang.IllegalArgumentException("Minimum abbreviation width is 4");
}
if ((str.length()) <= maxWidth) {
return str;
}
if (offset > (str.length())) {
offset = str.length();
}
if (((str.length()) - offset) < (maxWidth - 3)) {
offset = (str.length()) - (maxWidth - 3);
}
if (offset <= 4) {
return (str.substring(0, (maxWidth - 3))) + "...";
}
if (maxWidth < 7) {
throw new java.lang.IllegalArgumentException("Minimum abbreviation width with offset is 7");
}
if ((offset + (maxWidth - 3)) < (str.length())) {
return "..." + (org.apache.commons.lang3.StringUtils.abbreviate(str.substring(offset), (maxWidth - 3)));
}
return "..." + (str.substring(((str.length()) - (maxWidth - 3))));
}
public static java.lang.String difference(java.lang.String str1, java.lang.String str2) {
if (str1 == null) {
return str2;
}
if (str2 == null) {
return str1;
}
int at = org.apache.commons.lang3.StringUtils.indexOfDifference(str1, str2);
if (at == (-1)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return str2.substring(at);
}
public static int indexOfDifference(java.lang.String str1, java.lang.String str2) {
if (str1 == str2) {
return -1;
}
if ((str1 == null) || (str2 == null)) {
return 0;
}
int i;
for (i = 0 ; (i < (str1.length())) && (i < (str2.length())) ; ++i) {
if ((str1.charAt(i)) != (str2.charAt(i))) {
break;
}
}
if ((i < (str2.length())) || (i < (str1.length()))) {
return i;
}
return -1;
}
public static int indexOfDifference(java.lang.String[] strs) {
if ((strs == null) || ((strs.length) <= 1)) {
return -1;
}
boolean anyStringNull = false;
boolean allStringsNull = true;
int arrayLen = strs.length;
int shortestStrLen = java.lang.Integer.MAX_VALUE;
int longestStrLen = 0;
for (int i = 0 ; i < arrayLen ; i++) {
if ((strs[i]) == null) {
anyStringNull = true;
shortestStrLen = 0;
} else {
allStringsNull = false;
shortestStrLen = java.lang.Math.min(strs[i].length(), shortestStrLen);
longestStrLen = java.lang.Math.max(strs[i].length(), longestStrLen);
}
}
if (allStringsNull || ((longestStrLen == 0) && (!anyStringNull))) {
return -1;
}
if (shortestStrLen == 0) {
return 0;
}
int firstDiff = -1;
for (int stringPos = 0 ; stringPos < shortestStrLen ; stringPos++) {
char comparisonChar = strs[0].charAt(stringPos);
for (int arrayPos = 1 ; arrayPos < arrayLen ; arrayPos++) {
if ((strs[arrayPos].charAt(stringPos)) != comparisonChar) {
firstDiff = stringPos;
break;
}
}
if (firstDiff != (-1)) {
break;
}
}
if ((firstDiff == (-1)) && (shortestStrLen != longestStrLen)) {
return shortestStrLen;
}
return firstDiff;
}
public static java.lang.String getCommonPrefix(java.lang.String[] strs) {
if ((strs == null) || ((strs.length) == 0)) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
int smallestIndexOfDiff = org.apache.commons.lang3.StringUtils.indexOfDifference(strs);
if (smallestIndexOfDiff == (-1)) {
if ((strs[0]) == null) {
return org.apache.commons.lang3.StringUtils.EMPTY;
}
return strs[0];
} else {
if (smallestIndexOfDiff == 0) {
return org.apache.commons.lang3.StringUtils.EMPTY;
} else {
return strs[0].substring(0, smallestIndexOfDiff);
}
}
}
public static int getLevenshteinDistance(java.lang.String s, java.lang.String t) {
if ((s == null) || (t == null)) {
throw new java.lang.IllegalArgumentException("Strings must not be null");
}
int n = s.length();
int m = t.length();
if (n == 0) {
return m;
} else {
if (m == 0) {
return n;
}
}
if (n > m) {
java.lang.String tmp = s;
s = t;
t = tmp;
n = m;
m = t.length();
}
int[] p = new int[n + 1];
int[] d = new int[n + 1];
int[] _d;
int i;
int j;
char t_j;
int cost;
for (i = 0 ; i <= n ; i++) {
p[i] = i;
}
for (j = 1 ; j <= m ; j++) {
t_j = t.charAt((j - 1));
d[0] = j;
for (i = 1 ; i <= n ; i++) {
cost = (s.charAt((i - 1))) == t_j ? 0 : 1;
d[i] = java.lang.Math.min(java.lang.Math.min(((d[(i - 1)]) + 1), ((p[i]) + 1)), ((p[(i - 1)]) + cost));
}
_d = p;
p = d;
d = _d;
}
return p[n];
}
public static boolean startsWith(java.lang.String str, java.lang.String prefix) {
return org.apache.commons.lang3.StringUtils.startsWith(str, prefix, false);
}
public static boolean startsWithIgnoreCase(java.lang.String str, java.lang.String prefix) {
return org.apache.commons.lang3.StringUtils.startsWith(str, prefix, true);
}
private static boolean startsWith(java.lang.String str, java.lang.String prefix, boolean ignoreCase) {
if ((str == null) || (prefix == null)) {
return (str == null) && (prefix == null);
}
if ((prefix.length()) > (str.length())) {
return false;
}
return str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length());
}
public static boolean startsWithAny(java.lang.String string, java.lang.String[] searchStrings) {
if ((org.apache.commons.lang3.StringUtils.isEmpty(string)) || (org.apache.commons.lang3.ArrayUtils.isEmpty(searchStrings))) {
return false;
}
for (int i = 0 ; i < (searchStrings.length) ; i++) {
java.lang.String searchString = searchStrings[i];
if (org.apache.commons.lang3.StringUtils.startsWith(string, searchString)) {
return true;
}
}
return false;
}
public static boolean endsWith(java.lang.String str, java.lang.String suffix) {
return org.apache.commons.lang3.StringUtils.endsWith(str, suffix, false);
}
public static boolean endsWithIgnoreCase(java.lang.String str, java.lang.String suffix) {
return org.apache.commons.lang3.StringUtils.endsWith(str, suffix, true);
}
private static boolean endsWith(java.lang.String str, java.lang.String suffix, boolean ignoreCase) {
if ((str == null) || (suffix == null)) {
return (str == null) && (suffix == null);
}
if ((suffix.length()) > (str.length())) {
return false;
}
int strOffset = (str.length()) - (suffix.length());
return str.regionMatches(ignoreCase, strOffset, suffix, 0, suffix.length());
}
}
| [
"sajjad.syed@ucalgary.ca"
] | sajjad.syed@ucalgary.ca |
2089354e898110742bdcc1c9d5083b012df9324e | 1dfda0be57e17647136807851014abd25a361b27 | /hourstoseconds/Challenge.java | d50c0de9fdc891e57aa38cad104ba3a9ae8859c8 | [] | no_license | bretbaker/edbt-java | ac472930aba04c9098084600e26eece9175cd311 | 96fcff9fcd5dbafc499d393729534a9351fcee55 | refs/heads/master | 2022-10-12T14:01:22.102095 | 2020-06-15T18:13:04 | 2020-06-15T18:13:04 | 257,369,820 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package hourstoseconds;
public class Challenge {
public static void main(String[] args) {
System.out.println(hoursToSeconds(7));
}
public static int hoursToSeconds(int hours) {
return hours * 3600;
}
} | [
"bretbaker808@gmail.com"
] | bretbaker808@gmail.com |
a812f2b8c9cd4864d0be2a0594d7d2d3e1362b06 | 47365cac064e6cd6ce4bb86aab1c40fe812d06aa | /behavioral/observer/src/main/java/com/outlook/bigkun/demo2/TimeReaderObserver.java | 1cceabc7935c0e1391cfb1669abb1ebc621ee55b | [
"LicenseRef-scancode-mulanpsl-1.0-en"
] | permissive | bigkun/design_pattern | 14cbe0ac2b426996f4ce06e3dbe38014358b7856 | ac40926adc567567f85a8fb93ef571ff39802dfb | refs/heads/master | 2022-12-22T13:45:47.249590 | 2019-08-15T02:18:53 | 2019-08-15T02:18:53 | 199,612,880 | 0 | 0 | NOASSERTION | 2022-12-16T05:02:36 | 2019-07-30T08:49:23 | Java | UTF-8 | Java | false | false | 481 | java | package com.outlook.bigkun.demo2;
import java.util.Observable;
import java.util.Observer;
/**
* @author zhanghk
* @since 2019/8/14
*/
public class TimeReaderObserver implements Observer {
private String name;
public TimeReaderObserver(String name) {
this.name = name;
}
@Override
public void update(Observable o, Object arg) {
System.out.println("["+name + "] TimeReader:" + ((ClockObservable) o).getTime());
}
}
| [
"bigkun@outlook.com"
] | bigkun@outlook.com |
beb1270eef0df4b5e9415e3fcd36e14746110631 | cef851d78ea8ed14df1a072aa32e57753049bffb | /guli-shop-common/src/main/java/henu/soft/common/to/SkuHasStockTo.java | 8c689565cd266742d64632aae181bf6b64918709 | [
"Apache-2.0"
] | permissive | sichaolong/guli-shop | fb54ff575fccd25b481386853592c86efaf36285 | 962e0d5e88a124602f1e85686ab7f03150ce4406 | refs/heads/main | 2023-07-25T16:28:30.520374 | 2021-09-01T03:24:03 | 2021-09-01T03:24:03 | 401,920,219 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 145 | java | package henu.soft.common.to;
import lombok.Data;
@Data
public class SkuHasStockTo {
private Long skuId;
private Boolean hasStock;
}
| [
"2589165806@qq.com"
] | 2589165806@qq.com |
bd4e026c279b690c8b4ecc0f1c7cee9e9d3b6746 | 3e909d759fa6fb4694447064a80dfb185a77d907 | /busineService_budian/src/com/xmniao/service/sellerAddress/SellerAddressServiceImpl.java | 4bb7820c34b9774d112d73904c63701e211dc28c | [] | no_license | liveqmock/seeyouagain | 9703616f59ae0b9cd2e641d135170c84c18a257c | fae0cb3471f07520878e51358cfa5ea88e1d659c | refs/heads/master | 2020-04-04T14:47:00.192619 | 2017-11-14T12:47:31 | 2017-11-14T12:47:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,546 | java | package com.xmniao.service.sellerAddress;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xmniao.common.MapUtil;
import com.xmniao.dao.sellerAddress.SellerAddressDao;
import com.xmniao.thrift.busine.common.FailureException;
import com.xmniao.thrift.busine.sellerAddress.SellerAddressService;
@Service("SellerAddressServiceImpl")
public class SellerAddressServiceImpl implements SellerAddressService.Iface {
@Autowired
private SellerAddressDao sellerAddressDao;
// 初始化日志类
private final Logger log = Logger.getLogger(SellerAddressServiceImpl.class);
/**
* 添加商家地址
*/
@Override
@Transactional(rollbackFor={FailureException.class,Exception.class,RuntimeException.class})
public Map<String, String> add(Map<String, String> sellerMap)
throws FailureException, TException {
log.info("添加商家地址add:" + sellerMap);
Map<String, String> resultMap = new HashMap<>();
try {
if (StringUtils.isNotBlank(sellerMap.get("sellerid"))
&& StringUtils.isNotBlank(sellerMap.get("is_default"))) {
// 设置省名称
if (StringUtils.isNotBlank(sellerMap.get("province_id"))) {
Map<String, Object> province = sellerAddressDao
.getArea(sellerMap.get("province_id"));
sellerMap.put("province", province.get("title") + "");
}
// 设置市名称
if (StringUtils.isNotBlank(sellerMap.get("city_id"))) {
Map<String, Object> city = sellerAddressDao
.getArea(sellerMap.get("city_id"));
sellerMap.put("city", city.get("title") + "");
}
// 设置区名称
if (StringUtils.isNotBlank(sellerMap.get("area_id"))) {
Map<String, Object> area = sellerAddressDao
.getArea(sellerMap.get("area_id"));
sellerMap.put("area_name", area.get("title") + "");
}
Map<String,String> paraMap = new HashMap<>();
paraMap.put("sellerid", sellerMap.get("sellerid"));
paraMap.put("is_default","1");
List<Map<String, Object>> list = sellerAddressDao.getList(paraMap);
//添加新的默认地址,取消商家原默认地址
if (list != null) {
if (StringUtils.isNotBlank(sellerMap.get("is_default"))&& "1".equals(sellerMap.get("is_default"))){
if(list.size()==1){
paraMap.put("id",list.get(0).get("id")+"");
paraMap.put("is_default","0");
Integer update = sellerAddressDao.update(paraMap);
if (update != 1) {
log.error("取消商家原默认地址失败");
throw new FailureException(1,"取消商家原默认地址失败");
}
}else if(list.size() != 0) {
log.error("更新商家地址失败,数据库数据异常:商家"+sellerMap.get("sellerid")+"存在多个默认地址");
throw new FailureException(1,"更新商家地址失败,数据库数据异常");
}
}else if(list.size() == 0){
sellerMap.put("is_default","1");
}
}
sellerMap.put("create_date",getFormatDate());//创建时间
sellerMap.put("update_date",getFormatDate());//更新时间
// 添加商家地址
sellerAddressDao.add(sellerMap);
log.info("添加商家地址成功");
resultMap.put("id",String.valueOf(sellerMap.get("id")));
return resultMap;
} else {
log.error("添加商家地址失败,参数异常");
throw new FailureException(1, "添加商家地址失败,参数异常");
}
} catch (Exception e) {
log.error("添加商家地址失败", e);
throw new FailureException(1, "添加商家地址失败");
}
}
/**
* 删除商家地址
*/
@Override
@Transactional(rollbackFor={FailureException.class,Exception.class,RuntimeException.class})
public Map<String, String> deleteSellerAddress(Map<String, String> sellerMap)
throws FailureException, TException {
log.info("删除商家地址deleteSellerAddress:" + sellerMap);
Map<String,String> resultMap = new HashMap<>();
try {
if (StringUtils.isNotBlank(sellerMap.get("id"))) {
resultMap.put("id",sellerMap.get("id"));
List<Map<String, Object>> list = sellerAddressDao.getList(sellerMap);
if (list == null || list.size()==0) {
log.info("商家地址id:"+sellerMap.get("id")+"不存在");
}
Integer result = sellerAddressDao.delete(sellerMap);
if (result == 1) {
log.info("删除商家地址成功");
return resultMap;
}else {
log.error("删除商家地址成功");
throw new FailureException(1,"删除商家地址失败");
}
}else {
log.error("传入参数有误");
throw new FailureException(1,"传入参数有误");
}
} catch (Exception e) {
log.error("删除商家地址失败",e);
throw new FailureException(1,"删除商家地址失败");
}
}
/**
* 更新商家地址
*/
@Override
@Transactional(rollbackFor={FailureException.class,Exception.class,RuntimeException.class})
public Map<String, String> update(Map<String, String> sellerMap)
throws FailureException, TException {
log.info("更新商家地址update:" + sellerMap);
Map<String,String> resultMap = new HashMap<>();
try {
if (StringUtils.isNotBlank(sellerMap.get("id"))&&StringUtils.isNotBlank(sellerMap.get("sellerid"))) {
resultMap.put("id",sellerMap.get("id"));
//修改新的默认地址,取消商家原默认地址
if (StringUtils.isNotBlank(sellerMap.get("is_default"))&& "1".equals(sellerMap.get("is_default"))){
Map<String,String> paraMap = new HashMap<>();
paraMap.put("sellerid", sellerMap.get("sellerid"));
paraMap.put("is_default","1");
List<Map<String, Object>> list = sellerAddressDao.getList(paraMap);
if (list != null) {
if(list.size()==1){
paraMap.put("id",list.get(0).get("id")+"");
paraMap.put("is_default","0");
Integer update = sellerAddressDao.update(paraMap);
if (update != 1) {
log.error("取消商家原默认地址失败");
throw new FailureException(1,"取消商家原默认地址失败");
}
}else if(list.size() != 0){
log.error("更新商家地址失败,数据库数据异常:商家"+sellerMap.get("sellerid")+"存在多个默认地址");
throw new FailureException(1,"更新商家地址失败,数据库数据异常");
}
}
}
sellerMap.put("update_date",getFormatDate());
// 设置省名称
if (StringUtils.isNotBlank(sellerMap.get("province_id"))) {
Map<String, Object> province = sellerAddressDao
.getArea(sellerMap.get("province_id"));
sellerMap.put("province", province.get("title") + "");
}
// 设置市名称
if (StringUtils.isNotBlank(sellerMap.get("city_id"))) {
Map<String, Object> city = sellerAddressDao
.getArea(sellerMap.get("city_id"));
sellerMap.put("city", city.get("title") + "");
}
// 设置区名称
if (StringUtils.isNotBlank(sellerMap.get("area_id"))) {
Map<String, Object> area = sellerAddressDao
.getArea(sellerMap.get("area_id"));
sellerMap.put("area_name", area.get("title") + "");
}
//更新商家地址
Integer result = sellerAddressDao.update(sellerMap);
if (result==1) {
log.info("更新商家地址成功");
return resultMap;
}else {
log.error("更新商家地址失败");
throw new FailureException(1,"更新商家地址失败");
}
}else {
log.error("传入参数有误,记录id或sellerid不能为空");
throw new FailureException(1,"传入参数有误");
}
} catch (Exception e) {
log.error("更新商家地址失败",e);
throw new FailureException(1,"更新商家地址失败");
}
}
/**
* 获取商家地址
*/
@Override
public List<Map<String, String>> getSellerAddress(
Map<String, String> sellerMap) throws FailureException, TException {
log.info("获取商家地址getSellerAddress:" + sellerMap);
List<Map<String,String>> resultList = new ArrayList<>();
try {
if (StringUtils.isNotBlank(sellerMap.get("sellerid"))) {
List<Map<String, Object>> list = sellerAddressDao.getList(sellerMap);
for (Map<String, Object> map : list) {
resultList.add(MapUtil.formatMapStr(map));
}
log.info("获取商家地址成功");
return resultList;
}else {
log.error("商家id不能为空");
throw new FailureException(1,"商家id不能为空");
}
} catch (Exception e) {
log.error("获取商家地址失败");
throw new FailureException(1,"获取商家地址失败");
}
}
private String getFormatDate(){
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
}
/**
* 获取区域下级信息
*/
@Override
public List<Map<String, String>> getAreaChildren(
Map<String, String> sellerMap) throws FailureException, TException {
log.info("获取区域下级信息getAreaChildren:"+sellerMap);
List<Map<String,String>> list = new ArrayList<>();
try {
if (StringUtils.isNotBlank(sellerMap.get("area_id"))) {
List<Map<String, Object>> areaList = sellerAddressDao.areaList(sellerMap);
for (Map<String, Object> map : areaList) {
list.add(MapUtil.formatMapStr(map));
}
log.info("获取区域下级信息成功");
return list;
}else {
log.error("传入参数id为空");
throw new FailureException(1,"传入参数id为空");
}
} catch (Exception e) {
log.error("获取区域下级信息失败",e);
throw new FailureException(1,"获取区域下级信息失败");
}
}
/**
* 根据区域名称获取区域信息
*/
@Override
public Map<String, String> getAreaByName(Map<String, String> sellerMap)
throws FailureException, TException {
log.info("根据区域名称获取区域信息getAreaByName:"+sellerMap);
if (StringUtils.isNotBlank(sellerMap.get("title"))) {
Map<String, Object> areaByTitle = sellerAddressDao.getAreaByTitle(sellerMap);
if (areaByTitle == null) {
log.error("该区域不存在"+sellerMap);
throw new FailureException(1,"该区域不存在");
}
return MapUtil.formatMapStr(areaByTitle);
}else {
log.error("传入参数title为空");
throw new FailureException(1,"传入参数title为空");
}
}
}
| [
"641013587@qq.com"
] | 641013587@qq.com |
7162b673b21f3abd9770a10b01d5c968305aac42 | 2c1a40e80228db30410370f3b4f2ce04b2f03c01 | /serverv2/src/main/java/com/kiwihouse/shiro/realm/JwtRealm.java | f92852583aebd3a8b337e012a17d418e72367091 | [] | no_license | SxxGDZB/SxxGDZB-customization | 5bbc6508dae521812d8e72ee7cd4fc8e90b13a16 | 85873f6033b6c2bd81018d0197aba52566d85a80 | refs/heads/master | 2023-02-16T23:33:19.442961 | 2021-01-11T07:16:29 | 2021-01-11T07:16:29 | 289,149,752 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,070 | java | package com.kiwihouse.shiro.realm;
import com.kiwihouse.shiro.token.JwtToken;
import com.kiwihouse.util.JsonWebTokenUtil;
import io.jsonwebtoken.MalformedJwtException;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import java.util.Map;
import java.util.Set;
/**
* @author tomsun28
* @date 18:07 2018/3/3
*/
public class JwtRealm extends AuthorizingRealm {
private static final String JWT = "jwt:";
private static final int NUM_4 = 4;
private static final char LEFT = '{';
private static final char RIGHT = '}';
@Override
public Class<?> getAuthenticationTokenClass() {
// 此realm只支持jwtToken
return JwtToken.class;
}
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
String payload = (String) principalCollection.getPrimaryPrincipal();
// likely to be json, parse it:
if (payload.startsWith(JWT) && payload.charAt(NUM_4) == LEFT
&& payload.charAt(payload.length() - 1) == RIGHT) {
Map<String, Object> payloadMap = JsonWebTokenUtil.readValue(payload.substring(4));
Set<String> roles = JsonWebTokenUtil.split((String)payloadMap.get("roles"));
Set<String> permissions = JsonWebTokenUtil.split((String)payloadMap.get("perms"));
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
if(null!=roles&&!roles.isEmpty()) {
info.setRoles(roles);
}
if(null!=permissions&&!permissions.isEmpty()) {
info.setStringPermissions(permissions);
}
return info;
}
return null;
}
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
if (!(authenticationToken instanceof JwtToken)) {
return null;
}
JwtToken jwtToken = (JwtToken)authenticationToken;
String jwt = (String)jwtToken.getCredentials();
String payload = null;
try{
// 预先解析Payload
// 没有做任何的签名校验
payload = JsonWebTokenUtil.parseJwtPayload(jwt);
} catch(MalformedJwtException e){
//令牌格式错误
throw new AuthenticationException("errJwt");
} catch(Exception e){
//令牌无效
throw new AuthenticationException("errsJwt");
}
if(null == payload){
//令牌无效
throw new AuthenticationException("errJwt");
}
return new SimpleAuthenticationInfo("jwt:"+payload,jwt,this.getName());
}
}
| [
"49900640+SxxGDZB@users.noreply.github.com"
] | 49900640+SxxGDZB@users.noreply.github.com |
718b13e632a44f6b98ed9e20b473e5c314ac3170 | dd5f0f3c45acbfc5d894cc8141930414600d26af | /ExerciseFryday20141024/src/AbstrakteFabrik/TextCell.java | 3c82386647d763b6485be720e3443cf245d9b871 | [] | no_license | McRadio/Learning-JAVA | accae1bd6f2faf569f3ac0b137cdf8331825d31e | bd11b3a61a28b2ffc03f9869ad9f5ad20ad709ab | refs/heads/master | 2016-09-05T11:20:37.059452 | 2014-11-05T08:00:39 | 2014-11-05T08:00:39 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 427 | java | package AbstrakteFabrik;
public class TextCell extends Cell{
/**
* der Konstruktor der Klasse reicht den Wert für den Zellinhalt
*
* direkt an den Konstruktor der Cell-Klasse weiter
*
* @param c
*/
public TextCell(String c) {
super(c);
// TODO Auto-generated constructor stub
}
@Override
public void display() {
// TODO Auto-generated method stub
System.out.print(" | " + this.content);
}
}
| [
"steinhagen.steffen@gmail.com"
] | steinhagen.steffen@gmail.com |
a2798616b65e531489b1016f049ecadbd56d9a0d | 2e696ef582545e0200333c7831ed389558bd2360 | /src/private/nc/bs/mapub/costtype/rule/AccPeriodValidateRule.java | 19a5dbd4d40c131aec8e06ec083ab6d244d35dcd | [] | no_license | xsTao/costprice | 78671d9f664cc840a2e02771e5f35518c5046118 | 5f19cc6af8ae46f2a791375ba6b7474118125697 | refs/heads/master | 2021-01-01T18:19:15.144405 | 2017-08-11T12:02:38 | 2017-08-11T12:02:38 | 98,301,300 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,875 | java | /**
*
*/
package nc.bs.mapub.costtype.rule;
import java.util.ArrayList;
import java.util.List;
import nc.bd.framework.base.CMArrayUtil;
import nc.bs.uif2.validation.ValidationException;
import nc.bs.uif2.validation.ValidationFailure;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.vo.mapub.costtype.entity.CostTypeVO;
import nc.vo.pub.lang.UFDate;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
/**
* @since v6.3
* @version 2015年5月18日 上午9:22:43
* @author zhangshyb
*/
public class AccPeriodValidateRule implements IRule<CostTypeVO> {
@Override
public void process(CostTypeVO[] vos) {
// 校验:要素与物料对照表中要素所对应的要素表与单据中要素表保持一致
try {
if (CMArrayUtil.isNotEmpty(vos)) {
// 首先进行数据校验,判断是否 失效期间 >= 生效期间 ————纪录2010-04-15修改
this.accPeriodValidate(vos);
}
}
catch (ValidationException e) {
ExceptionUtils.wrappException(e);
}
}
/**
* 保存时进行数据校验,判断是否 失效期间 >= 生效期间
*
* @param costTypeVOs
* CostTypeVO[]
* @throws ValidationException
* 异常
*/
public void accPeriodValidate(CostTypeVO[] costTypeVOs) throws ValidationException {
List<ValidationFailure> failure = new ArrayList<ValidationFailure>();
StringBuffer errStrNum = new StringBuffer();
// 数据校验,只要发现有错误的,跳出并输出错误
for (int i = 0; i < costTypeVOs.length; i++) {
UFDate beginDate = costTypeVOs[i].getCbeginmonth();
UFDate endDate = costTypeVOs[i].getCendmonth();
// t1不需要判空处理,因为t1首先进行保存的非空校验,此处t1必非空
int compResult = beginDate.compareTo(endDate);
if (compResult > 0) {
// 为输出错误的行号做准备,每个行号后面以","连接如1,2,3(行)
errStrNum.append(costTypeVOs[i].getVcosttypecode() + "[" + costTypeVOs[i].getVcosttypename() + "]");
errStrNum.append(",");
}
}
if (errStrNum.length() > 0) {
errStrNum.deleteCharAt(errStrNum.length() - 1); // 要去掉最后一个","
// 返回完整的错误警告信息,创建校验警告
failure.add(new ValidationFailure(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("3810006_0",
"03810006-0312")/*
* @res
* "错误:[生效期间]不能晚于[失效期间]:"
*/
+ errStrNum.toString()));
throw new ValidationException(failure); // 校验警告输出
}
}
}
| [
"1360809120@qq.com"
] | 1360809120@qq.com |
66174c267af86fc533566ac14c505176da9e3983 | ff98d59a0d2e6e1d2bb95df10c2f7dad32013916 | /src/a/Client.java | 374f69f398f142d851678a685948af2ecb6b1726 | [] | no_license | ccuuiiccaann/test | 66e80bbb891cd67fa1a553c49ec44fb7e40543d2 | 3186975b5d4504e475de48b4e23af26f4c1e7218 | refs/heads/master | 2021-01-01T03:40:00.991123 | 2016-06-06T06:18:39 | 2016-06-06T06:18:39 | 58,507,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,468 | java | package a;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import javax.swing.JTextArea;
public class Client {
public static final String IP_ADDR = "192.168.5.222";//服务器地址
public static final int PORT = 8081;//服务器端口号
private JFrame frame;
private static Socket socket;
public static void main(String[] args) {
Client window = new Client();
window.frame.setVisible(true);
try {
socket = new Socket(IP_ADDR, PORT);
} catch (Exception e) {
e.printStackTrace();
}
while(true){
//创建一个流套接字并将其连接到指定主机上的指定端口号
try {
//读取服务器端数据
DataInputStream input = new DataInputStream(socket.getInputStream());
String ret = input.readUTF()+"";
System.out.println("服务器端返回过来的是: " + ret);
input.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public Client() {
initialize();
}
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JTextArea textArea = new JTextArea();
textArea.setBounds(194, 27, 197, 39);
frame.getContentPane().add(textArea);
JButton button = new JButton("生成二维码");
try {
socket = new Socket(IP_ADDR, PORT);
} catch (Exception e1) {
e1.printStackTrace();
}
button.addMouseListener(new MouseAdapter() {
/*
* 生成二维码
*/
@Override
public void mouseClicked(MouseEvent arg0) {
String code="";
try {
InetAddress addr;
addr = InetAddress.getLocalHost();
String ip= addr.getHostAddress().toString();
code="code:"+ip;
System.out.println("发送生成二维码的请求是:"+code);
socket = new Socket(IP_ADDR, PORT);
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
out.writeUTF(code);
DataInputStream input = new DataInputStream(socket.getInputStream());
String ret = input.readUTF()+"";
System.out.println("服务器端返回过来的是: " + ret);
out.close();
input.close();
socket.close();
} catch (Exception e) {
e.printStackTrace();
}
}
});
button.setBounds(72, 27, 93, 23);
frame.getContentPane().add(button);
JButton btnPlay = new JButton("play");
btnPlay.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
}
});
btnPlay.setBounds(112, 115, 93, 23);
frame.getContentPane().add(btnPlay);
JButton endGameButton = new JButton("结束游戏");
endGameButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("结束游戏");
}
});
endGameButton.setBounds(250, 115, 93, 23);
frame.getContentPane().add(endGameButton);
}
}
| [
"cuican@human-PC"
] | cuican@human-PC |
84bcb78ee55b778e7d95de03b9e82c98204eac62 | 953c9f028a90ec44d6f4acd57cef98b39cd4810d | /core/src/com/redartedgames/ball/myobjects/MovesData.java | b6a420f0dcec4590f1f22b3522575bf4a0295f63 | [] | no_license | AconLight/Erron | 49f8864ec3d4d3544b4383bec46e7f3c46d8f275 | 1459295f7ee09de54bc64a14c8432bdb444a20d0 | refs/heads/master | 2023-02-20T12:38:16.388672 | 2021-01-22T13:42:41 | 2021-01-22T13:42:41 | 307,698,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,965 | java | package com.redartedgames.ball.myobjects;
import java.math.BigDecimal;
import java.util.ArrayList;
public class MovesData {
public ArrayList<BigDecimal> accelerationsX, accelerationsY;
public MovesData() {
accelerationsX = new ArrayList<BigDecimal>();
accelerationsY = new ArrayList<BigDecimal>();
}
public void addMove(BigDecimal accX, BigDecimal accY) {
BigDecimal tempX = accX;
BigDecimal tempY = accY;
accelerationsX.add(tempX);
accelerationsY.add(tempY);
}
public void removeMove() {
if (accelerationsX.size() > 0) {
accelerationsX.remove(accelerationsX.size()-1);
accelerationsY.remove(accelerationsY.size()-1);
}
}
public BigDecimal getLastAccX() {
if (accelerationsX.size() > 0) {
return accelerationsX.get(accelerationsX.size()-1);
}
else {
return BigDecimal.ZERO;
}
}
public BigDecimal getLastAccY() {
if (accelerationsX.size() > 0) {
return accelerationsY.get(accelerationsY.size()-1);
}
else {
return BigDecimal.ZERO;
}
}
public void addToLastAccX(BigDecimal accX) {
BigDecimal temp = getLastAccX();
temp = temp.add(accX);
accelerationsX.remove(getLastAccX());
accelerationsX.add(temp);
}
public void addToLastAccY(BigDecimal accY) {
BigDecimal temp = getLastAccY();
temp = temp.add(accY);
accelerationsY.remove(getLastAccY());
accelerationsY.add(temp);
}
public void pastePlayerMoves(MovesData movesData) {
accelerationsX = new ArrayList<BigDecimal>();
for(BigDecimal accX : movesData.accelerationsX) {
accelerationsX.add(accX);
}
accelerationsY = new ArrayList<BigDecimal>();
for(BigDecimal accY : movesData.accelerationsY) {
accelerationsY.add(accY);
}
}
public void shortenMovesDataToNumb(int numb) {
int size = accelerationsX.size();
for (int i = 0 ; i < size - numb; i++) {
accelerationsX.remove(0);
}
size = accelerationsY.size();
for (int i = 0 ; i < size - numb; i++) {
accelerationsY.remove(0);
}
}
}
| [
"w.mosienski@gmail.com"
] | w.mosienski@gmail.com |
82a6013b1226cfb7a14d45834f8b7da626eef4d3 | 9fbe70845372f629da2ace0e460c3316fc4dd92c | /src/main/java/com/dd/web/rest/RequestTaskResource.java | 411044469f98213c1dfe55022a8ddb09558a5444 | [] | no_license | durdan/classschedule | 8c2f04a1d2b651ac3262175c68aac55bf96189c8 | c2cfccc1e9c9e3cbcb754c8f188ea92ab1b10557 | refs/heads/master | 2023-02-13T03:23:23.820524 | 2021-01-14T13:17:32 | 2021-01-14T13:17:32 | 316,349,975 | 0 | 0 | null | 2020-11-26T22:46:08 | 2020-11-26T22:37:41 | null | UTF-8 | Java | false | false | 6,641 | java | package com.dd.web.rest;
import com.dd.domain.RequestTask;
import com.dd.service.RequestTaskService;
import com.dd.web.rest.errors.BadRequestAlertException;
import com.dd.service.dto.RequestTaskCriteria;
import com.dd.service.RequestTaskQueryService;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing {@link com.dd.domain.RequestTask}.
*/
@RestController
@RequestMapping("/api")
public class RequestTaskResource {
private final Logger log = LoggerFactory.getLogger(RequestTaskResource.class);
private static final String ENTITY_NAME = "requestTask";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final RequestTaskService requestTaskService;
private final RequestTaskQueryService requestTaskQueryService;
public RequestTaskResource(RequestTaskService requestTaskService, RequestTaskQueryService requestTaskQueryService) {
this.requestTaskService = requestTaskService;
this.requestTaskQueryService = requestTaskQueryService;
}
/**
* {@code POST /request-tasks} : Create a new requestTask.
*
* @param requestTask the requestTask to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new requestTask, or with status {@code 400 (Bad Request)} if the requestTask has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/request-tasks")
public ResponseEntity<RequestTask> createRequestTask(@RequestBody RequestTask requestTask) throws URISyntaxException {
log.debug("REST request to save RequestTask : {}", requestTask);
if (requestTask.getId() != null) {
throw new BadRequestAlertException("A new requestTask cannot already have an ID", ENTITY_NAME, "idexists");
}
RequestTask result = requestTaskService.save(requestTask);
return ResponseEntity.created(new URI("/api/request-tasks/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /request-tasks} : Updates an existing requestTask.
*
* @param requestTask the requestTask to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated requestTask,
* or with status {@code 400 (Bad Request)} if the requestTask is not valid,
* or with status {@code 500 (Internal Server Error)} if the requestTask couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/request-tasks")
public ResponseEntity<RequestTask> updateRequestTask(@RequestBody RequestTask requestTask) throws URISyntaxException {
log.debug("REST request to update RequestTask : {}", requestTask);
if (requestTask.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
RequestTask result = requestTaskService.save(requestTask);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, requestTask.getId().toString()))
.body(result);
}
/**
* {@code GET /request-tasks} : get all the requestTasks.
*
* @param pageable the pagination information.
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of requestTasks in body.
*/
@GetMapping("/request-tasks")
public ResponseEntity<List<RequestTask>> getAllRequestTasks(RequestTaskCriteria criteria, Pageable pageable) {
log.debug("REST request to get RequestTasks by criteria: {}", criteria);
Page<RequestTask> page = requestTaskQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* {@code GET /request-tasks/count} : count all the requestTasks.
*
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body.
*/
@GetMapping("/request-tasks/count")
public ResponseEntity<Long> countRequestTasks(RequestTaskCriteria criteria) {
log.debug("REST request to count RequestTasks by criteria: {}", criteria);
return ResponseEntity.ok().body(requestTaskQueryService.countByCriteria(criteria));
}
/**
* {@code GET /request-tasks/:id} : get the "id" requestTask.
*
* @param id the id of the requestTask to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the requestTask, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/request-tasks/{id}")
public ResponseEntity<RequestTask> getRequestTask(@PathVariable Long id) {
log.debug("REST request to get RequestTask : {}", id);
Optional<RequestTask> requestTask = requestTaskService.findOne(id);
return ResponseUtil.wrapOrNotFound(requestTask);
}
/**
* {@code DELETE /request-tasks/:id} : delete the "id" requestTask.
*
* @param id the id of the requestTask to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/request-tasks/{id}")
public ResponseEntity<Void> deleteRequestTask(@PathVariable Long id) {
log.debug("REST request to delete RequestTask : {}", id);
requestTaskService.delete(id);
return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build();
}
}
| [
"durgesh_d@hotmail.com"
] | durgesh_d@hotmail.com |
9faca5fb2eaf872ceb4a00c90a36ae7a32dea3ac | 42b90535fc4de4f4ba657550752b9a9eb89aedf2 | /tag-web/src/main/java/cn/itcast/tag/web/user/controller/LoginController.java | 8b23af9765d8efc34691c2b6d0fae267f111c643 | [] | no_license | mukedev/tags | 32aef053ab80341f9839684840fae28359e88051 | 9cbcb5f18744a9cdf1a5e5a91bdab28d41ead0c8 | refs/heads/master | 2023-06-02T12:28:03.569976 | 2021-06-25T03:13:54 | 2021-06-25T03:13:54 | 323,093,956 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,981 | java | package cn.itcast.tag.web.user.controller;
import cn.itcast.tag.web.basictag.service.BasicTagService;
import cn.itcast.tag.web.commons.bean.Result;
import cn.itcast.tag.web.commons.bean.StateCode;
import cn.itcast.tag.web.commons.controller.BaseController;
import cn.itcast.tag.web.user.bean.ResourceBean;
import cn.itcast.tag.web.user.bean.UserBean;
import cn.itcast.tag.web.user.bean.UserRoleMapBean;
import cn.itcast.tag.web.user.form.LoginForm;
import cn.itcast.tag.web.user.service.UserService;
import cn.itcast.tag.web.utils.JsonUtil;
import cn.itcast.tag.web.utils.MD5Util;
import cn.itcast.tag.web.utils.PageEnum;
import cn.itcast.tag.web.utils.UserUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.util.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
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.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
/**
* 登录、登出
*
* @author zhaocs
*/
@Controller
@RequestMapping("/")
public class LoginController extends BaseController {
private static final String LOGIN_RESULT = "==== login@result:{} ====";
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private UserService userService;
@Resource
private BasicTagService basicTagService;
/**
* 登录页(默认页)
*
* @return
*/
@RequestMapping(value = {"/", "login"}, method = RequestMethod.GET)
public ModelAndView loginView(HttpServletRequest request) {
final ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName(PageEnum.LOGIN.getPage());
return modelAndView;
}
@RequestMapping(value = {"login"}, method = RequestMethod.POST)
public ModelAndView login(LoginForm form, HttpServletRequest request, PrintWriter pw) {
ModelAndView modelAndView = new ModelAndView();
Result responseMsg = new Result();
UserBean user = null;
// 非空校验
if (null == form || StringUtils.isBlank(form.getUsername()) || StringUtils.isBlank(form.getPassword())) {
responseMsg.set(StateCode.PARAM_NULL_FAILD, "参数输入错误");
modelAndView.setViewName(PageEnum.LOGIN.getPage());
} else {
// 获取数据库中用户信息
logger.info("==== login@params:{} ====", form);
user = userService.login(new UserBean(form.getUsername(),
MD5Util.getMd5(form.getPassword() + UserUtil.ENCRYPTING_KEY)));
if (null == user) {
responseMsg.set(StateCode.QUERY_ZERO_SUCCESS, "用户名或者密码错误");
modelAndView.setViewName(PageEnum.LOGIN.getPage());
logger.error(LOGIN_RESULT, responseMsg);
} else if (user.getState() == 0 || null == user.getRoleMaps() || user.getRoleMaps().isEmpty()) {
responseMsg.set(StateCode.RECORD_DISABLED, "用户没有权限或被禁用");
modelAndView.setViewName(PageEnum.LOGIN.getPage());
logger.error(LOGIN_RESULT, responseMsg);
} else {
// 校验通过的处理
return shiroLogin(user, form.getRememberMe() != null && form.getRememberMe().equals("true"), request);
}
}
logger.info(LOGIN_RESULT, responseMsg);
modelAndView.addObject("data", JsonUtil.obj2Json(responseMsg));
return modelAndView;
}
private ModelAndView shiroLogin(UserBean user, Boolean rememberMe, HttpServletRequest request) {
ModelAndView modelAndView = new ModelAndView();
//获取密码令牌并验证
UsernamePasswordToken token = null;
token = new UsernamePasswordToken(user.getUsername(), user.getPassword());
Subject currentUser = SecurityUtils.getSubject();
if (!currentUser.isAuthenticated()) {
//使用shiro来验证
if (rememberMe) token.setRememberMe(true);
currentUser.login(token);// 验证角色和权限
}
if (currentUser.isAuthenticated()) {
// 登录成功
Subject subject = SecurityUtils.getSubject();
List<ResourceBean> resources = new ArrayList<>();
if (subject.hasRole(UserUtil.RoleEnum.SUPPER_ADMIN.getStateInfo())) {
resources = userService.queryAllResources();
} else {
List<UserRoleMapBean> beans = user.getRoleMaps();
if (beans != null && !beans.isEmpty()) {
// 目前用户最多只有一个角色
resources = userService.queryCurrentResources(beans.get(0));
}
}
// 头部资源导航栏
HttpSession session = WebUtils.toHttp(request).getSession();
session.removeAttribute("resources");
session.setAttribute("resources", resources);
modelAndView.setViewName("redirect:" + resources.get(0).getSign() + "/index");
} else {
modelAndView.setViewName(PageEnum.LOGIN.getPage());
}
return modelAndView;
}
/**
* 检查注册的登录名是否重复
*
* @param username 登录名
* @param request
* @param pw
*/
@RequestMapping(value = {"registerCheck"}, method = RequestMethod.POST)
public void registerCheck(String username, HttpServletRequest request, PrintWriter pw) {
Result responseMsg = new Result();
if (StringUtils.isBlank(username)) responseMsg.set(StateCode.PARAM_NULL_FAILD, "参数输入错误");
else {
UserBean bean = userService.login(new UserBean(username));
if (null == bean) responseMsg.set(StateCode.SUCCESS, "用户名不重复");
else responseMsg.set(StateCode.RECORD_DUP_FAILD, "用户名重复");
}
String result = JsonUtil.obj2Json(responseMsg);
try {
pw.write(result);
logger.info("==== registerCheck@result:{} ====", result);
} catch (RuntimeException e) {
logger.error("==== registerCheck@result:服务器错误 ====");
}
}
/**
* 登录校验
*
* @param pw
* @param loginUser
* @return
*/
@RequestMapping(value = "/loginChk")
public ModelAndView loginChk(UserBean bean, HttpServletRequest request) {
final ModelAndView modelAndView = new ModelAndView();
if (null != bean) {
logger.info("==== login@params:{} ====", bean);
bean = userService.login(bean);
} else {
logger.info("==== login@params:param error ====");
}
if (null != bean) {
logger.info("==== login@result: {} login success, go to home! ====", bean);
} else {
modelAndView.setViewName(PageEnum.LOGIN.getPage());
logger.info("==== login@result:login faild, go to login! ====");
}
return modelAndView;
}
@ResponseBody
@RequestMapping(value = "/clearUserCache", produces = "text/plain;charset=UTF-8")
public void clearUserCache(PrintWriter pw) {
Result result = new Result();
Boolean isOk = false;
isOk = userService.clearUserCache();
if (isOk) {
result.set(StateCode.SUCCESS, "成功清空用户缓存");
} else {
result.set(StateCode.FAILD, "清空用户缓存失败");
}
String resultJson = JsonUtil.obj2Json(result);
try {
pw.write(resultJson);
logger.info("==== clearCache@result:{} ====", result);
} catch (Exception e) {
logger.error("==== clearCache@result:服务器错误 ====");
}
}
@ResponseBody
@RequestMapping(value = "/clearCache", produces = "text/plain;charset=UTF-8")
public void clearCache(PrintWriter pw) {
Result result = new Result();
Boolean isOk = false;
isOk = userService.clearCache();
if (isOk) {
result.set(StateCode.SUCCESS, "成功清空所有缓存");
} else {
result.set(StateCode.FAILD, "清空所有缓存失败");
}
String resultJson = JsonUtil.obj2Json(result);
try {
pw.write(resultJson);
logger.info("==== clearCache@result:{} ====", result);
} catch (Exception e) {
logger.error("==== clearCache@result:服务器错误 ====");
}
}
}
| [
"1169050279@qq.com"
] | 1169050279@qq.com |
9a30585e99f9bd7557ac44044e7cc7611114be52 | 090242a5b9d892f34178b090ae6f50fc6c2d7ed6 | /classes/org/w3c/dom/html/HTMLMapElement.java | b17254428cb0c0e9e8bd98c960f52e50e193f7dd | [] | no_license | realityforge/q2java | e0097bce832600cc32ae6836139f93a2933d6542 | dc67c81629e45bc69ddbd4b834f4e09e87cd30e0 | refs/heads/master | 2022-04-20T18:45:34.346489 | 2015-06-24T21:27:04 | 2015-06-24T21:27:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | /*
* Copyright (c) 1999 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de Recherche
* en Informatique et en Automatique, Keio University).
* All Rights Reserved. http://www.w3.org/Consortium/Legal/
*/
package org.w3c.dom.html;
/**
* Client-side image map. See the MAP element definition in HTML 4.0.
*/
public interface HTMLMapElement extends HTMLElement {
/**
* The list of areas defined for the image map.
*/
public HTMLCollection getAreas();
/**
* Names the map (for use with <code>usemap</code>). See the name attribute
* definition in HTML 4.0.
*/
public String getName();
public void setName(String name);
}
| [
"bp@barryp.org"
] | bp@barryp.org |
76328390f692b4139f532a283f9b2a15bb4f5f1a | c26d26e4a064f9c064e5301fe8a63f7964d5acda | /src/npw/Invention1.java | 8058f9a2f8cc129a70b766fb1ea13f414f9ecf76 | [] | no_license | KoKoAung58/CSC212 | d1a4b119a4aa0030cd2eb238a7e0f251ad767544 | 45b53410ac3ceb13e63b8e3ca0687260b8551159 | refs/heads/master | 2020-08-25T00:43:48.284877 | 2019-10-23T00:57:35 | 2019-10-23T00:57:35 | 216,936,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,988 | java | /*
*program paints an image subject of own creation
* In this program, the user will be the traffic police who have to handle the traffic light whether it should red,
* green or yellow! Do ur job the best OFFICER!
*/
package npw;
import painter.SPainter;
import shapes.SCircle;
import shapes.SSquare;
import javax.swing.*;
import java.awt.*;
import java.util.Random;
import java.util.Scanner;
public class Invention1 {
private void paintTheImage() {
SPainter painter = new SPainter("Traffic Light", 300, 900);
painter.setBrushWidth(3);
SSquare square = new SSquare(300);
SCircle smallCircle = new SCircle(120);
painter.setColor(metallicGray());
painter.paint(square);
painter.setColor(Color.BLACK);
painter.draw(square);
painter.draw(smallCircle);
painter.setColor(deadOrange());
painter.paint(smallCircle);
painter.setColor(Color.BLACK);
//middle light
painter.mfd(square.side());
painter.setColor(metallicGray());
painter.paint(square);
painter.setColor(Color.BLACK);
painter.draw(square);
painter.draw(smallCircle);
painter.setColor(deadRed());
painter.paint(smallCircle);
painter.setColor(Color.BLACK);
//red
painter.mbk(2 * square.side());
painter.setColor(metallicGray());
painter.paint(square);
painter.setColor(Color.BLACK);
painter.draw(square);
painter.draw(smallCircle);
painter.setColor(deadGreen());
painter.paint(smallCircle);
painter.setColor(Color.BLACK);
painter.mfd(square.side());
//green
while (true) {
String command = JOptionPane.showInputDialog(null, "Command?");
if (command == null) {
command = "exit";
} //user clicked on Cancel
if (command.equalsIgnoreCase("go")) {
go(painter, square, smallCircle);
} else if (command.equalsIgnoreCase("stop")) {
;
stop(painter, square, smallCircle);
} else if (command.equalsIgnoreCase("ready")) {
ready(painter, square, smallCircle);
} else if (command.equalsIgnoreCase("random") || command.equalsIgnoreCase("r")) {
randomColor(painter, square, smallCircle);
} else if (command.equalsIgnoreCase("exit")) {
painter.end();
System.out.println("Thanks You For Your Help!....");
break;
} else {
JOptionPane.showMessageDialog(null, "Unrecognizable command:" + command.toUpperCase());
}
}
}
private void allDead(SPainter painter, SSquare square, SCircle smallCircle) {
painter.setColor(deadOrange());
painter.paint(smallCircle);
painter.mfd(square.side());
painter.setColor(deadRed());
painter.paint(smallCircle);
painter.mbk(2 * square.side());
painter.setColor(deadGreen());
painter.paint(smallCircle);
painter.mfd(square.side());
}
private void go(SPainter painter, SSquare square, SCircle smallCircle) {
allDead(painter, square, smallCircle);
painter.setColor(Color.green);
painter.mbk(square.side());
painter.paint(smallCircle);
painter.mfd(square.side());
}
private void stop(SPainter painter, SSquare square, SCircle smallCircle) {
allDead(painter, square, smallCircle);
painter.setColor(Color.RED);
painter.mfd(square.side());
painter.paint(smallCircle);
painter.mbk(square.side());
}
private void ready(SPainter painter, SSquare square, SCircle smallCircle) {
allDead(painter, square, smallCircle);
painter.setColor(orange());
painter.paint(smallCircle);
}
private Color metallicGray() {
return new Color(67, 70, 75);
}
private Color orange() {
return new Color(255, 165, 0);
}
private Color deadGreen() {
return new Color(42, 163, 50);
}
private Color deadOrange() {
return new Color(181, 96, 25);
}
private Color deadRed() {
return new Color(181, 5, 5);
}
private void randomColor(SPainter painter, SSquare square, SCircle smallCircle) {
Random rgen = new Random();
int rn = rgen.nextInt(3);
if (rn == 0) {
go(painter, square, smallCircle);
} else if (rn == 1) {
ready(painter, square, smallCircle);
} else if (rn == 2) {
stop(painter, square, smallCircle);
}
}
public Invention1() {
paintTheImage();
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Invention1();
}
});
}
}
| [
"kka@res-dhcp-129-3-136-178.oswego.edu"
] | kka@res-dhcp-129-3-136-178.oswego.edu |
36fdc5988390f8441dd9fa0348666d804a5005dc | e2bcc84f6c734affba77c1d5c94976cc9329f92e | /scm1/src/main/java/com/best1/scm/modules/cms/dao/GuestbookDao.java | 1e311b5a4b9d6b5f6037591dd705768abdd01e0c | [] | no_license | CaptainJ93/SpringStudy | 422985fa6e6be3d1b7415efdeb7bad4d243d108d | 40d0665f9e1917f7189e7d9554c951c13d7d5c5a | refs/heads/master | 2020-03-17T05:50:07.857946 | 2018-06-22T09:06:47 | 2018-06-22T09:06:47 | 133,330,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | /**
* Copyright © 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.best1.scm.modules.cms.dao;
import com.best1.scm.common.persistence.CrudDao;
import com.best1.scm.common.persistence.annotation.MyBatisDao;
import com.best1.scm.modules.cms.entity.Guestbook;
/**
* 留言DAO接口
* @author ThinkGem
* @version 2013-8-23
*/
@MyBatisDao
public interface GuestbookDao extends CrudDao<Guestbook> {
}
| [
"jiashizhen@JSB-0019.best1.com"
] | jiashizhen@JSB-0019.best1.com |
e9dcf888df51266667dde749c0fcb4ecd7fb4ac3 | 84633f125620e86100c4bd4ac1e5b69c240e4f4f | /src/main/java/com/example/demo/FirstController.java | 1c7a47a7275f3efd61957059438e1f28f74aa001 | [] | no_license | amshegokar/SpringBootDemo | 9c16d981019bf12a7334c6b2f77782d508a3fad7 | 087603f7ea4a376c5437a025eb575c5130c11376 | refs/heads/master | 2023-01-24T20:03:45.819189 | 2020-12-06T04:47:09 | 2020-12-06T04:47:09 | 318,952,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package com.example.demo;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("/first")
//@RequestMapping("/first")
public class FirstController {
@Autowired
GreetingService greetingService;
@GetMapping("/greet")
public String greeting() {
return greetingService.greet();
}
}
| [
"amshegokar@gmail.com"
] | amshegokar@gmail.com |
327dd30abd9eea909ea5465155be7e464545176a | 303d584470fb57857890f35510517b6c58d74a6a | /app/src/main/java/com/webi/covid19/Activities/DetailIndia.java | 60f76c769bf97f9ae46fa67b246cebd5b7f86694 | [] | no_license | Suman942/Covid19Tracker | 6bb6b56f617ffc49c284656849a6d56b6267350d | ebadea1ac562631fe11decd3b01762a248dcc92c | refs/heads/master | 2022-11-24T09:14:04.387858 | 2020-08-03T06:36:16 | 2020-08-03T06:36:16 | 284,622,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,416 | java | package com.webi.covid19.Activities;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;
import com.webi.covid19.Model.DistrictModel;
import com.webi.covid19.R;
import com.webi.covid19.adapters.IndianDistricDetailAdapter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
public class DetailIndia extends AppCompatActivity {
@BindView(R.id.recyclerrView)
RecyclerView recyclerView;
int position;
String url = "https://api.covid19india.org/v2/state_district_wise.json";
IndianDistricDetailAdapter indianDistricDetailAdapter;
ArrayList<DistrictModel> districtList = new ArrayList<>();
Intent intent;
InterstitialAd interstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_india);
ButterKnife.bind(this);
intent = getIntent();
position = intent.getIntExtra("position", 0);
fetchdata();
// prepare interstitial ads
interstitialAds();
}
private void interstitialAds() {
// prepare interstitial ads
interstitialAd = new InterstitialAd(this);
interstitialAd.setAdUnitId("ca-app-pub-4687730962574001/4535636768");
interstitialAd.loadAd(new AdRequest.Builder().build());
}
private void fetchdata() {
final RequestQueue requestQueue = Volley.newRequestQueue(this);
JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, url, null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
for (int i = 0; i < response.length(); i++) {
try {
JSONObject jsonObject = response.getJSONObject(i);
JSONArray jsonArray = jsonObject.getJSONArray("districtData");
if (position == i) {
for (int j = 0; j < jsonArray.length(); j++) {
JSONObject jsonObject1 = jsonArray.getJSONObject(j);
String district = jsonObject1.getString("district");
String cases = jsonObject1.getString("confirmed");
String recovered = jsonObject1.getString("recovered");
String deaths = jsonObject1.getString("deceased");
String active = jsonObject1.getString("active");
districtList.add(new DistrictModel(district, cases, recovered, deaths,active));
}
}
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(DetailIndia.this, "" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
indianDistricDetailAdapter = new IndianDistricDetailAdapter(getApplicationContext(), districtList);
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
recyclerView.setAdapter(indianDistricDetailAdapter);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(DetailIndia.this, "" + error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
requestQueue.add(jsonArrayRequest);
}
@Override
public void onBackPressed() {
if (interstitialAd.isLoaded()) {
interstitialAd.show();
finish();
} else {
interstitialAd.show();
finish();
}
}
}
| [
"suman19da@gmail.com"
] | suman19da@gmail.com |
6809ddcec802960c6aa23b73593165727030dc1b | 28adcde875c60b752ede090d4675b36cd7db98db | /src/net/wit/dao/impl/TopicDaoImpl.java | dad14dd00a5336511294ecfa6d16786ed5b3af3a | [] | no_license | rzico/mp-java | 95f1dc0acd889d455fd23cd32c3b11842b51754d | 980afd1a264b2f24fcbac508b116cd4dab4aa4a5 | refs/heads/master | 2021-09-27T13:49:31.257550 | 2018-05-10T10:53:47 | 2018-05-10T10:53:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,368 | java | package net.wit.dao.impl;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.FlushModeType;
import javax.persistence.NoResultException;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import net.wit.entity.Member;
import net.wit.entity.Payment;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import net.wit.Page;
import net.wit.Pageable;
import net.wit.dao.TopicDao;
import net.wit.entity.Topic;
/**
* @ClassName: TopicDaoImpl
* @author 降魔战队
* @date 2017-9-14 19:42:6
*/
@Repository("topicDaoImpl")
public class TopicDaoImpl extends BaseDaoImpl<Topic, Long> implements TopicDao {
/**
* @Title:findPage
* @Description:标准代码
* @param beginDate
* @param endDate
* @param pageable
* @return Page<Topic>
*/
public Page<Topic> findPage(Date beginDate,Date endDate, Pageable pageable) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Topic> criteriaQuery = criteriaBuilder.createQuery(Topic.class);
Root<Topic> root = criteriaQuery.from(Topic.class);
criteriaQuery.select(root);
Predicate restrictions = criteriaBuilder.conjunction();
restrictions = criteriaBuilder.conjunction();
if (beginDate!=null) {
Date b = DateUtils.truncate(beginDate,Calendar.DATE);
restrictions = criteriaBuilder.and(restrictions,criteriaBuilder.greaterThanOrEqualTo(root.<Date> get("createDate"), b));
}
if (endDate!=null) {
Date e = DateUtils.truncate(endDate,Calendar.DATE);
e =DateUtils.addDays(e,1);
restrictions = criteriaBuilder.and(restrictions,criteriaBuilder.lessThan(root.<Date> get("createDate"), e));
}
criteriaQuery.where(restrictions);
return super.findPage(criteriaQuery,pageable);
}
public Topic find(Member member) {
if (member == null) {
return null;
}
String jpql = "select topic from Topic topic where topic.member = :member";
try {
return entityManager.createQuery(jpql, Topic.class).setFlushMode(FlushModeType.COMMIT).setParameter("member", member).getSingleResult();
} catch (NoResultException e) {
return null;
}
}
} | [
"zhangsr@tiaohuo.com"
] | zhangsr@tiaohuo.com |
07db5474c13ad160c5969af6e0bc9028a70ee641 | 7990b92adb286b7bf95ca6edf461c6f3d43de7c9 | /app/src/main/java/com/coxtunes/joruriseba/Wifi.java | 4b95623e779667739acc9dba62c9d2c3a62193ee | [] | no_license | saiful-cse/JoruriSeba_app | 69e61c48a44d2c260f5a439b2f0bcafb54ca1140 | 88fddde56dfd1cc280fcc5e58d45eef3e0bb2906 | refs/heads/master | 2020-07-24T06:09:52.407474 | 2019-09-11T13:15:12 | 2019-09-11T13:15:12 | 207,816,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.coxtunes.joruriseba;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Wifi extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wifi);
}
}
| [
"saif559161@gmail.com"
] | saif559161@gmail.com |
5a992640a2fe1cdd1f50eb333ff2ccde4e12a964 | 3da2407b62631a70e519bf032ef9f0ef049888c6 | /src/main/java/com/yang/pattern/factory/abstr/CarFactory.java | fcb7f261f979221e99758794976eaeae7c1db476 | [] | no_license | OceansYang/factory_pattern | c0c860b19217a1bd28bc609bf6f8fcbb0a60041d | 2d64e4f1727c6ad6db091d91fa7385ab5b1bee21 | refs/heads/master | 2020-04-10T21:45:00.113397 | 2019-11-19T03:14:40 | 2019-11-19T03:14:40 | 161,305,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package com.yang.pattern.factory.abstr;
import com.yang.pattern.factory.AudiCar;
import com.yang.pattern.factory.BMWCar;
import com.yang.pattern.factory.Car;
import com.yang.pattern.factory.VWCar;
import com.yang.pattern.factory.func.AudiFactory;
/**
* 抽象工厂实现类
*/
public class CarFactory extends AbstractFactory {
@Override
public Car getAudi() {
return new AudiCar();
//结合工厂方法
//return new AudiFactory().getCar();
}
@Override
public Car getBMW() {
return new BMWCar();
//结合工厂方法
//return new BMWFactory().getCar();
}
@Override
public Car getVW() {
return new VWCar();
//结合工厂方法
//return new VWFactory().getCar();
}
}
| [
"15539628720@163.om"
] | 15539628720@163.om |
c74bf7fdf8bbb77e35be8cc8226bbb24fc0bf365 | 593aca225e47edb95fd0cc81d6e2ffba4d7b74cd | /src/main/java/cat/indiketa/degiro/model/raw/DRawVwdPrice.java | 26236d6792b8da8bfc824d4ef2bb8a3a3912c3f0 | [
"Apache-2.0"
] | permissive | xzavrel/degiro-java-client | 3fbde4508b027fe5d95a312f0e4cdeb668a70d53 | e6b4dcb60acad4a24ad34df174b9d7e5419635b7 | refs/heads/master | 2020-03-21T08:15:48.504158 | 2018-06-22T17:40:29 | 2018-06-22T17:40:29 | 138,331,282 | 0 | 0 | Apache-2.0 | 2018-06-22T17:40:37 | 2018-06-22T17:40:37 | null | UTF-8 | Java | false | false | 603 | 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 cat.indiketa.degiro.model.raw;
import java.util.List;
/**
*
* @author indiketa
*/
public class DRawVwdPrice {
public String m;
public List<String> v = null;
public String getM() {
return m;
}
public void setM(String m) {
this.m = m;
}
public List<String> getV() {
return v;
}
public void setV(List<String> v) {
this.v = v;
}
}
| [
"eduard.catala@gmail.com"
] | eduard.catala@gmail.com |
47f80e5ba636756dd94304dc4f2b74d433851ace | d67e2c55835b365c79a7a1a25e0572579998a08b | /app/src/main/java/com/ibtdi/team/mkssab/Activity/Exhibitions.java | 362a3ca1b5d8829d44daacb48d55aaf7a0ce48db | [] | no_license | NourAshraf/TestApp | b12648b513e90dc800554ca6ca6f8018770993a6 | eb10a75ae22ec348faab20424580749c0d692090 | refs/heads/master | 2021-01-20T04:58:32.045820 | 2018-06-07T13:21:16 | 2018-06-07T13:21:16 | 83,847,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,205 | java | package com.ibtdi.team.mkssab.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.ibtdi.team.mkssab.Adapter.StoresAdapter;
import com.ibtdi.team.mkssab.Decoration.EndlessRecyclerOnScrollListener;
import com.ibtdi.team.mkssab.Decoration.VerticalSpaceItemDecoration;
import com.ibtdi.team.mkssab.MainApp.MainApp;
import com.ibtdi.team.mkssab.Model.StoresModel;
import com.ibtdi.team.mkssab.Network.VolleySingleton;
import com.ibtdi.team.mkssab.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class Exhibitions extends AppCompatActivity implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener{
private Context mContext;
private RecyclerView mRecyclerViewStories;
private ArrayList<StoresModel> models;
private RequestQueue mVolleySingletonRequestQueue;
private ArrayList<String>State_Id;
private ArrayList<String>State_Name;
private ArrayList<String>City_Id;
private ArrayList<String>City_Name;
private Spinner mSpinnerNewAccountArea;
private Spinner mSpinnerNewAccountCity;
private String mStateId;
private String mCityId;
private TextView mImageViewSearch;
private LinearLayout mLinearLayoutSearchStories;
private Button mButtonAllAreas;
private Button mButtonSearchStories;
private ArrayList<StoresModel> modelsSearch;
private SwipeRefreshLayout mSwipeRefreshLayoutStories;
private ProgressBar mProgressBar;
private TextView mTextViewNoInternet;
private ImageView mImageViewBack;
private TextView mTextViewTitle;
private String mCarBrandsId;
private String mCarModelsId;
private Spinner mSpinnerNewAccountMarka;
private Spinner mSpinnerNewAccountKind;
private ArrayList<String>carModels_Name;
private ArrayList<String>carModels_Id;
private ArrayList<String>carBrands_Id;
private ArrayList<String>carBrands_Name;
private StoresAdapter mStoresAdapter;
private String next_page_url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_exhibitions);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("");
onVariables();
}
private void onVariables() {
mContext = Exhibitions.this;
mCarBrandsId = "";
mCarModelsId = "";
carBrands_Id = new ArrayList<String>();
carBrands_Name = new ArrayList<String>();
carModels_Id = new ArrayList<String>();
carModels_Name = new ArrayList<String>();
mSpinnerNewAccountMarka = (Spinner) findViewById(R.id.NewAccountSpinnerMarka);
mSpinnerNewAccountMarka.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == -1) {
mCarBrandsId = "";
mSpinnerNewAccountKind.setVisibility(View.GONE);
} else {
mSpinnerNewAccountKind.setVisibility(View.VISIBLE);
mCarBrandsId = carBrands_Id.get(position);
onCarModels(carBrands_Id.get(position));
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
mSpinnerNewAccountKind = (Spinner) findViewById(R.id.NewAccountSpinnerKind);
mSpinnerNewAccountKind.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == -1) {
mCarModelsId = "";
} else {
mCarModelsId = carModels_Id.get(position);
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
mStateId = "";
mCityId = "";
mTextViewNoInternet = (TextView) findViewById(R.id.tvNoInternet);
mTextViewTitle = (TextView) findViewById(R.id.tvTitle);
mTextViewTitle.setText("معارض فى السعوديه");
mSpinnerNewAccountArea = (Spinner) findViewById(R.id.NewAccountSpinnerArea);
mSpinnerNewAccountArea.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == -1) {
mStateId = "";
mSpinnerNewAccountCity.setVisibility(View.GONE);
} else {
mStateId = State_Id.get(position);
onCity(State_Id.get(position));
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
mSpinnerNewAccountCity = (Spinner) findViewById(R.id.NewAccountSpinnerCity);
mSpinnerNewAccountCity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (i == -1) {
mCityId = "";
} else {
mCityId = City_Id.get(i);
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
State_Id = new ArrayList<String>();
State_Name = new ArrayList<String>();
City_Id = new ArrayList<String>();
City_Name = new ArrayList<String>();
VolleySingleton mVolleySingleton = VolleySingleton.getsInstance();
mVolleySingletonRequestQueue = mVolleySingleton.getRequestQueue();
mRecyclerViewStories = (RecyclerView) findViewById(R.id.rvStories);
LinearLayoutManager manager = new LinearLayoutManager(mContext);
mRecyclerViewStories.setLayoutManager(manager);
mRecyclerViewStories.addItemDecoration(new VerticalSpaceItemDecoration(60));
mRecyclerViewStories.addOnScrollListener(new EndlessRecyclerOnScrollListener(manager) {
@Override
public void onLoadMore(int current_page)
{
Log.i(MainApp.Tag,next_page_url);
if (next_page_url.equals("null")){
}else {
onLoadBuildingsData(next_page_url);
}
}
});
models = new ArrayList<StoresModel>();
modelsSearch = new ArrayList<StoresModel>();
mImageViewSearch = (TextView) findViewById(R.id.ivSearchStories);
mImageViewSearch.setOnClickListener(this);
mImageViewBack = (ImageView) findViewById(R.id.ivBackButton);
mImageViewBack.setOnClickListener(this);
mLinearLayoutSearchStories = (LinearLayout) findViewById(R.id.llSearchStories);
mButtonAllAreas = (Button) findViewById(R.id.bAllAreas);
mButtonSearchStories = (Button) findViewById(R.id.bSearchStories);
mButtonSearchStories.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onSearch();
}
});
mButtonAllAreas.setOnClickListener(this);
// mButtonSearchStories.setOnClickListener(this);
mSwipeRefreshLayoutStories = (SwipeRefreshLayout) findViewById(R.id.srlStories);
mSwipeRefreshLayoutStories.setOnRefreshListener(this);
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
mProgressBar.setVisibility(View.GONE);
mStoresAdapter=new StoresAdapter(mContext,models, "3");
mRecyclerViewStories.setAdapter(mStoresAdapter);
onLoadBuildingsData(MainApp.ExhibitionsUrl);
onStates();
onCarBrands();
}
public void onCarBrands(){
String Url=MainApp.CarBrandsUrl;
StringRequest mStringRequestonCarBrands=new StringRequest(Request.Method.GET, Url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray mJsonArray = new JSONArray(response);
if (mJsonArray.length() == 1) {
JSONObject mJsonObject = mJsonArray.getJSONObject(0);
String error = mJsonObject.getString("error");
Toast.makeText(getApplicationContext(), error, Toast.LENGTH_SHORT).show();
}
for (int i = 0; i < mJsonArray.length(); i++) {
JSONObject jsonObject = mJsonArray.getJSONObject(i);
String id = jsonObject.getString("id");
String name = jsonObject.getString("name");
carBrands_Id.add(id);
carBrands_Name.add(name);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getApplicationContext(),
R.layout.item_spinner,R.id.tvItem,carBrands_Name);
mSpinnerNewAccountMarka.setAdapter(dataAdapter);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
onCarBrands();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params=new HashMap<String, String>();
return params;
}
};
mVolleySingletonRequestQueue.add(mStringRequestonCarBrands);
}
public void onCarModels(final String position){
if (carModels_Name!=null){
carModels_Name.clear();
carModels_Id.clear();
}
String Url=MainApp.CarModelsUrl+position;
StringRequest mStringRequestonCarModels=new StringRequest(Request.Method.GET, Url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray mJsonArray = new JSONArray(response);
if (mJsonArray.length() == 1) {
JSONObject mJsonObject = mJsonArray.getJSONObject(0);
String error = mJsonObject.getString("error");
Toast.makeText(getApplicationContext(), error, Toast.LENGTH_SHORT).show();
}
for (int i = 0; i < mJsonArray.length(); i++) {
JSONObject jsonObject = mJsonArray.getJSONObject(i);
String id = jsonObject.getString("id");
String name = jsonObject.getString("name");
carModels_Id.add(id);
carModels_Name.add(name);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getApplicationContext(),
R.layout.item_spinner,R.id.tvItem,carModels_Name);
mSpinnerNewAccountKind.setAdapter(dataAdapter);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
onCarModels(position);
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params=new HashMap<String, String>();
return params;
}
};
mVolleySingletonRequestQueue.add(mStringRequestonCarModels);
}
private void onLoadBuildingsData(final String exhibitionsUrl) {
mProgressBar.setVisibility(View.VISIBLE);
StringRequest mStringRequestBuildings=new StringRequest(Request.Method.GET, exhibitionsUrl,new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
mTextViewNoInternet.setVisibility(View.GONE);
mProgressBar.setVisibility(View.GONE);
JSONObject mJsonObject=new JSONObject(response);
next_page_url = mJsonObject.getString("next_page_url");
JSONArray data = mJsonObject.getJSONArray("data");
for (int i=0;i<data.length();i++){
JSONObject jsonObject=data.getJSONObject(i);
String id = jsonObject.getString("id");
String name = jsonObject.getString("name");
String photo = jsonObject.getString("photo");
String description = jsonObject.getString("description");
String phone = jsonObject.getString("phone");
String longitude = jsonObject.getString("longitude");
String latitude = jsonObject.getString("latitude");
String ads_count = jsonObject.getString("ads_count");
JSONObject user = jsonObject.getJSONObject("user");
JSONObject city = user.getJSONObject("city");
String name1 = city.getString("name");
String id1 = city.getString("id");
String username = user.getString("username");
String UserId = user.getString("id");
StoresModel storesModel = new StoresModel(id, name, photo, description, phone, longitude, latitude, ads_count, name1, id1,UserId,username);
models.add(storesModel);
}
mStoresAdapter.notifyDataSetChanged();
mRecyclerViewStories.setVisibility(View.VISIBLE);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextViewNoInternet.setText("لا يوجد انترنت !");
mTextViewNoInternet.setVisibility(View.VISIBLE);
onLoadBuildingsData(exhibitionsUrl);
}
});
mVolleySingletonRequestQueue.add(mStringRequestBuildings);
}
public void onStates(){
String Url=MainApp.StatesUrl;
StringRequest mStringRequestonStates=new StringRequest(Request.Method.GET, Url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray mJsonArray = new JSONArray(response);
if (mJsonArray.length() == 1) {
JSONObject mJsonObject = mJsonArray.getJSONObject(0);
String error = mJsonObject.getString("error");
Toast.makeText(getApplicationContext(), error, Toast.LENGTH_SHORT).show();
}
for (int i = 0; i < mJsonArray.length(); i++) {
JSONObject jsonObject = mJsonArray.getJSONObject(i);
String id = jsonObject.getString("id");
String name = jsonObject.getString("name");
State_Id.add(id);
State_Name.add(name);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getApplicationContext(),
R.layout.item_spinner,R.id.tvItem,State_Name);
mSpinnerNewAccountArea.setAdapter(dataAdapter);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
onStates();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params=new HashMap<String, String>();
return params;
}
};
mVolleySingletonRequestQueue.add(mStringRequestonStates);
}
public void onCity(final String position){
if (City_Name!=null){
City_Name.clear();
City_Id.clear();
}
String Url=MainApp.CitiesUrl+position;
StringRequest mStringRequestonCity=new StringRequest(Request.Method.GET, Url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONArray mJsonArray = new JSONArray(response);
if (mJsonArray.length() == 1) {
JSONObject mJsonObject = mJsonArray.getJSONObject(0);
String error = mJsonObject.getString("error");
Toast.makeText(getApplicationContext(), error, Toast.LENGTH_SHORT).show();
}
for (int i = 0; i < mJsonArray.length(); i++) {
JSONObject jsonObject = mJsonArray.getJSONObject(i);
String id = jsonObject.getString("id");
String name = jsonObject.getString("name");
City_Id.add(id);
City_Name.add(name);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getApplicationContext(),
R.layout.item_spinner,R.id.tvItem,City_Name);
mSpinnerNewAccountCity.setAdapter(dataAdapter);
mSpinnerNewAccountCity.setVisibility(View.VISIBLE);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
onCity(position);
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params=new HashMap<String, String>();
return params;
}
};
mVolleySingletonRequestQueue.add(mStringRequestonCity);
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.ivSearchStories:
mTextViewNoInternet.setVisibility(View.GONE);
if (mLinearLayoutSearchStories.getVisibility()==View.GONE){
mLinearLayoutSearchStories.setVisibility(View.VISIBLE);
}else {
mLinearLayoutSearchStories.setVisibility(View.GONE);
}
break;
case R.id.bAllAreas:
mTextViewNoInternet.setVisibility(View.GONE);
StoresAdapter mStoresAdapter=new StoresAdapter(mContext,models, "3");
mRecyclerViewStories.setAdapter(mStoresAdapter);
mLinearLayoutSearchStories.setVisibility(View.GONE);
break;
// case R.id.bSearchStories:
// mTextViewNoInternet.setVisibility(View.GONE);
// if (modelsSearch!=null){
// modelsSearch.clear();
// }
// for (int i=0;i<models.size();i++){
// if (mCityId.equals(models.get(i).getCity_id())){
// modelsSearch.add(models.get(i));
// }
// }
// if (modelsSearch.size()==0){
// mTextViewNoInternet.setText("لا يوجد معارض في هذه المنطقة!");
// mTextViewNoInternet.setVisibility(View.VISIBLE);
// }
// StoresAdapter mStoresAdapter2=new StoresAdapter(mContext,modelsSearch, "3");
// mRecyclerViewStories.setAdapter(mStoresAdapter2);
// mLinearLayoutSearchStories.setVisibility(View.GONE);
// break;
case R.id.ivBackButton:
finish();
break;
}
}
@Override
public void onRefresh() {
mRecyclerViewStories.setVisibility(View.GONE);
if (models!=null){
models.clear();
}
onLoadBuildingsData(MainApp.ExhibitionsUrl);
if (mSwipeRefreshLayoutStories.isRefreshing()){
mSwipeRefreshLayoutStories.setRefreshing(false);
}
}
public void onSearch(){
final String Url=MainApp.SearchUrl+mStateId+"&city_id="+mCityId+"&car_id="+mCarBrandsId+"&model_id="+mCarModelsId;
StringRequest mStringRequestonSearch=new StringRequest(Request.Method.GET, Url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject mJsonObject=new JSONObject(response);
Log.i(MainApp.Tag,response);
if (modelsSearch!=null){
modelsSearch.clear();
}
next_page_url = mJsonObject.getString("next_page_url");
JSONArray data = mJsonObject.getJSONArray("data");
for (int i=0;i<data.length();i++){
JSONObject jsonObject=data.getJSONObject(i);
String id = jsonObject.getString("id");
String name = jsonObject.getString("name");
String photo = jsonObject.getString("photo");
String description = jsonObject.getString("description");
String phone = jsonObject.getString("phone");
String longitude = jsonObject.getString("longitude");
String latitude = jsonObject.getString("latitude");
String ads_count = jsonObject.getString("ads_count");
JSONObject user = jsonObject.getJSONObject("user");
JSONObject city = user.getJSONObject("city");
String name1 = city.getString("name");
String id1 = city.getString("id");
String username = user.getString("username");
String UserId = user.getString("id");
StoresModel storesModel = new StoresModel(id, name, photo, description, phone, longitude, latitude, ads_count, name1, id1,UserId,username);
modelsSearch.add(storesModel);
}
mStoresAdapter=new StoresAdapter(mContext,modelsSearch, "3");
mRecyclerViewStories.setAdapter(mStoresAdapter);
mLinearLayoutSearchStories.setVisibility(View.GONE);
mRecyclerViewStories.setVisibility(View.VISIBLE);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextViewNoInternet.setText("لا يوجد انترنت !");
mTextViewNoInternet.setVisibility(View.VISIBLE);
onSearch();
}
});
mVolleySingletonRequestQueue.add(mStringRequestonSearch);
}
@Override
public void onBackPressed() {
if (mLinearLayoutSearchStories.getVisibility()==View.VISIBLE){
mLinearLayoutSearchStories.setVisibility(View.GONE);
}else {
super.onBackPressed();
}
}
}
| [
"plasmazxzx@gmail.com"
] | plasmazxzx@gmail.com |
3ae2d7489b48a74d180b59f02d11945e246d7b61 | f8a76d2ae4a76127987afbc02a7be1311e843112 | /src/main/java/com/lxg/acm/support/OnlineUserSupport.java | 33dfaae80967ca98b36b638d36237b6fe4c7d833 | [
"Apache-2.0"
] | permissive | college-design/acm | 815a51966f16a9866816d4040ccedfcbb25af6a8 | 91502ba775c043b218b6dfff10e773b3955e0c38 | refs/heads/master | 2022-05-03T04:34:07.498072 | 2022-03-14T13:53:20 | 2022-03-14T13:53:20 | 81,220,188 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package com.lxg.acm.support;
import com.lxg.acm.entity.User;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class OnlineUserSupport {
private static List<User> users = new CopyOnWriteArrayList<User>();
public static void add(User user) {
users.add(user);
}
public static void remove(User user) {
users.remove(user);
}
public static int size() {
return users.size();
}
public static List<User> getUsers() {
return users;
}
}
| [
"lxghoney@163.com"
] | lxghoney@163.com |
f5bf0a66d4e7616246ae38123769b5d85c8e0c96 | b01c0745a554530f4ca5dde1fcfb74e713235a15 | /src/de/Kurfat/Java/Minecraft/BetterSleep/BetterSleep.java | 55674529b35850e1905b188bb55819213629e243 | [] | no_license | Xevenut/BetterSleep | 1a7b282bfb23f2b25f9a72973dc1474265674c8a | 83afc6b1c5a824ee95b79f1a54feb453a7796192 | refs/heads/master | 2020-08-01T05:11:52.158051 | 2020-06-28T14:56:50 | 2020-06-28T14:56:50 | 210,875,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,747 | java | package de.Kurfat.Java.Minecraft.BetterSleep;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class BetterSleep extends JavaPlugin implements Listener{
public static BetterSleep INSTANCE;
private Map<String, BetterSleepWorld> worlds = new HashMap<>();
public BetterSleep(){
INSTANCE = this;
}
public List<UUID> getSleepingPlayersByWorld(World world) {
return worlds.containsKey(world.getName()) == false ? null : new ArrayList<UUID>(worlds.get(world.getName()).sleep);
}
@Override
public void onEnable() {
for(World world : Bukkit.getWorlds()) {
BetterSleepWorld sworld = new BetterSleepWorld(world);
Bukkit.getPluginManager().registerEvents(sworld, this);
worlds.put(world.getName(), sworld);
}
Bukkit.getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {}
@EventHandler
public void onWorldDelete(WorldUnloadEvent event) {
String name = event.getWorld().getName();
if(worlds.containsKey(name) == false) return;
HandlerList.unregisterAll(worlds.get(name));
worlds.remove(name);
}
@EventHandler
public void onWorldCreate(WorldLoadEvent event) {
BetterSleepWorld sworld = new BetterSleepWorld(event.getWorld());
Bukkit.getPluginManager().registerEvents(sworld, this);
worlds.put(event.getWorld().getName(), sworld);
}
}
| [
"dogano14@hotmail.de"
] | dogano14@hotmail.de |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.