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
1130905f0e3c122e5903af3893840a8d083744d4
92461f746bfea0d1e15ebb31c516c203f9974414
/index-cloud-ens-portal/index-cloud-ens-portal-file-browser-filter/src/main/java/fr/index/cloud/ens/selectors/filter/portlet/model/FileBrowserFilterWindowProperties.java
e50558dc50bf36b3c015f7b23cdd595227ceead3
[]
no_license
osivia/index-cloud-ens
ccbe2fb239bcddb85c8586a3ef8e5a3d1a6ee457
0aad14b82ad3e9d95172a0edde01cdd93a4a1f31
refs/heads/master
2022-12-22T00:14:19.132443
2022-01-24T15:37:47
2022-01-24T15:37:47
165,016,451
0
1
null
2022-12-16T08:18:21
2019-01-10T07:58:49
Java
UTF-8
Java
false
false
1,184
java
package fr.index.cloud.ens.selectors.filter.portlet.model; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; /** * File browser filter window properties java-bean. */ @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class FileBrowserFilterWindowProperties { /** * Title. */ private String title; /** * Selector identifier. */ private String selectorId; /** * Vocabulary. */ private String vocabulary; /** * Constructor. */ public FileBrowserFilterWindowProperties() { super(); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getSelectorId() { return selectorId; } public void setSelectorId(String selectorId) { this.selectorId = selectorId; } public String getVocabulary() { return vocabulary; } public void setVocabulary(String vocabulary) { this.vocabulary = vocabulary; } }
[ "cedric.krommenhoek@gmail.com" ]
cedric.krommenhoek@gmail.com
5d69fc226da4a0021c5b72f60b6412f7a2a95257
337be2c56f60b78fa3f1f71306aebd2e005bcfa0
/app/src/main/java/test/com/myapplication/selfwordview/WordView.java
5e1e7d939ad59ab6557bc32fb30fd776f6075ae4
[]
no_license
xiaochuanchuanzi/theSencondDemo
9d06e52fa234c3ee58c9cf7e740035ce64df2e59
48c8ef743170da90e0e333798a27974cf56bd580
refs/heads/master
2020-03-16T03:14:41.310790
2018-05-07T15:55:49
2018-05-07T15:55:49
132,478,503
0
0
null
null
null
null
UTF-8
Java
false
false
4,455
java
package test.com.myapplication.selfwordview; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; /** * Created by zhangsixia on 18/4/19. */ public class WordView extends View { /*头部*/ private Paint titlePaint; private Rect titleRect; /*左侧*/ private Paint leftPaint; private Rect leftRect; /*主体*/ private Paint bodytPaint; private Rect bodyRect; /*尺寸单位*/ private int totalSizeWidth; private int totalSizeHeight; /*单位Rect*/ private int leftItem = 0; private int topItem = 0; private Rect itemTitleRect; /*左上角固定不动的一个view*/ private Rect leftTopRect = new Rect(0, 0, 200, 200); private Paint leftTopPaint = new Paint(); /*发生滚动或者缩放时,产生的尺寸变化差值*/ public int distance_X = 0; public int distance_Y = 0; public WordView(Context context) { super(context); init(); } public WordView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(); } public WordView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } /*初始化的方法*/ private void init() { titlePaint = new Paint(); leftPaint = new Paint(); bodytPaint = new Paint(); titleRect = new Rect(); leftRect = new Rect(); bodyRect = new Rect(); //Typeface font = Typeface.create("哈哈",Typeface.BOLD); leftTopPaint.setColor(Color.RED); leftTopPaint.setAntiAlias(true); leftTopPaint.setStyle(Paint.Style.FILL); leftTopPaint.setStrokeWidth(2); //leftTopPaint.setTextAlign(Paint.Align.CENTER); //leftTopPaint.setTextSize(16); //leftTopPaint.setTypeface(font); leftPaint.setColor(Color.GRAY); leftPaint.setAntiAlias(true); leftPaint.setStyle(Paint.Style.STROKE); leftPaint.setStrokeWidth(5); titlePaint.setColor(Color.BLUE); titlePaint.setAntiAlias(true); titlePaint.setStyle(Paint.Style.STROKE); titlePaint.setStrokeWidth(5); bodytPaint.setColor(Color.BLACK); bodytPaint.setAntiAlias(true); bodytPaint.setStyle(Paint.Style.STROKE); bodytPaint.setStrokeWidth(3); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); totalSizeWidth = MeasureSpec.getSize(widthMeasureSpec); totalSizeHeight = MeasureSpec.getSize(heightMeasureSpec); setMeasuredDimension(totalSizeWidth, totalSizeHeight); } @Override protected void onDraw(Canvas canvas) { canvas.translate(0, 0); drawTitle(canvas); } /*绘制头部控件*/ public void drawTitle(Canvas canvas) { Log.i("TAG", "distance_X " + distance_X); if(distance_X > 0) distance_X = 0; if(distance_Y > 0) distance_Y = 0; BodyView.getInstance().onDraw(200 + distance_X, 200 + distance_Y, canvas, bodytPaint); LeftView.getInstance(this).onDraw(0, 200 + distance_Y, canvas, leftPaint); TitleView.getInstance(this).onDraw(200 + distance_X, 0, canvas, titlePaint); canvas.drawRect(leftTopRect, leftTopPaint); } int last_X = 0; int last_Y = 0; @Override public boolean onTouchEvent(MotionEvent event) { int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: last_X = (int) event.getRawX(); last_Y = (int) event.getRawY(); break; case MotionEvent.ACTION_MOVE: // 两次的偏移量 distance_X = (int) (event.getRawX() - last_X); distance_Y = (int) (event.getRawY() - last_Y); break; case MotionEvent.ACTION_UP: last_X = (int) event.getRawX(); last_Y = (int) event.getRawY(); break; } invalidate(); return true; } }
[ "zhanglt@qiezzi.com" ]
zhanglt@qiezzi.com
8293df2ed62714aa7c79caf4bf8590cf305364d8
9da178b40c87ef375fd4cad7a8fb42b4d7760849
/app/src/main/java/com/example/shree/demo1/Demo1.java
3928ec1814d40b3cb3774c78b5bc96c74a74ea1d
[]
no_license
nishibagale/demo1
167a4e7e0dd2a823cf3a7a0d0dfd398022c99335
3b21b3556f4abb5e7ebdee07db78af678ab16dd8
refs/heads/master
2021-04-28T06:57:26.639013
2018-02-20T15:11:38
2018-02-20T15:11:38
122,213,716
0
0
null
null
null
null
UTF-8
Java
false
false
831
java
package com.example.shree.demo1; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; public class Demo1 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo1); final Animation animFadein= AnimationUtils.loadAnimation(this,R.anim.fade_in); final Button btn_save=(Button)findViewById(R.id.btn1); btn_save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { btn_save.startAnimation(animFadein); } }); } }
[ "nishigandhabagale1@gmail.com" ]
nishigandhabagale1@gmail.com
49518537589ccf8fd03f6d2a362b546a3cac71cf
7c32234b16bd19a6588e9752f33a626e4c602b77
/src/main/java/net/mcreator/variety/MCreatorZeplecakgui.java
0859137e979847e12a10613d3a0861ca8aa315e6
[]
no_license
FrikGamer/Variety
ecdd1b4c7499a33af7826f4b36e483e88064a572
c8002b8e712bf14cb026b2fdb471042faa9f37f0
refs/heads/master
2022-04-13T16:16:08.565593
2020-03-21T18:43:45
2020-03-21T18:43:45
246,090,699
0
0
null
null
null
null
UTF-8
Java
false
false
13,823
java
package net.mcreator.variety; import org.lwjgl.opengl.GL11; import org.lwjgl.input.Keyboard; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraft.world.World; import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.inventory.Slot; import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryBasic; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Container; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.GuiButton; import java.util.HashMap; import java.io.IOException; @Elementsvariety.ModElement.Tag public class MCreatorZeplecakgui extends Elementsvariety.ModElement { public static int GUIID = 6; public static HashMap guiinventory = new HashMap(); public static IInventory slots; public MCreatorZeplecakgui(Elementsvariety instance) { super(instance, 142); } @Override public void preInit(FMLPreInitializationEvent event) { elements.addNetworkMessage(GUIButtonPressedMessageHandler.class, GUIButtonPressedMessage.class, Side.SERVER); elements.addNetworkMessage(GUISlotChangedMessageHandler.class, GUISlotChangedMessage.class, Side.SERVER); } public static class GuiContainerMod extends Container { World world; EntityPlayer entity; int x, y, z; public GuiContainerMod(World world, int x, int y, int z, EntityPlayer player) { this.world = world; this.entity = player; this.x = x; this.y = y; this.z = z; slots = new InventoryBasic("slots", true, 9); guiinventory.put("slots", slots); this.addSlotToContainer(new Slot(slots, 0, 8, 12) { }); this.addSlotToContainer(new Slot(slots, 1, 26, 12) { }); this.addSlotToContainer(new Slot(slots, 3, 62, 12) { }); this.addSlotToContainer(new Slot(slots, 4, 80, 12) { }); this.addSlotToContainer(new Slot(slots, 5, 98, 12) { }); this.addSlotToContainer(new Slot(slots, 6, 116, 12) { }); this.addSlotToContainer(new Slot(slots, 7, 134, 12) { }); this.addSlotToContainer(new Slot(slots, 8, 152, 12) { }); this.addSlotToContainer(new Slot(slots, 9, 8, 30) { }); this.addSlotToContainer(new Slot(slots, 10, 26, 30) { }); this.addSlotToContainer(new Slot(slots, 11, 44, 30) { }); this.addSlotToContainer(new Slot(slots, 12, 62, 30) { }); this.addSlotToContainer(new Slot(slots, 13, 80, 30) { }); this.addSlotToContainer(new Slot(slots, 14, 98, 30) { }); this.addSlotToContainer(new Slot(slots, 15, 116, 30) { }); this.addSlotToContainer(new Slot(slots, 16, 134, 30) { }); this.addSlotToContainer(new Slot(slots, 17, 152, 30) { }); this.addSlotToContainer(new Slot(slots, 18, 8, 48) { }); this.addSlotToContainer(new Slot(slots, 2, 44, 12) { }); this.addSlotToContainer(new Slot(slots, 19, 26, 48) { }); this.addSlotToContainer(new Slot(slots, 20, 44, 48) { }); this.addSlotToContainer(new Slot(slots, 21, 62, 48) { }); this.addSlotToContainer(new Slot(slots, 22, 80, 48) { }); this.addSlotToContainer(new Slot(slots, 23, 98, 48) { }); this.addSlotToContainer(new Slot(slots, 24, 116, 48) { }); this.addSlotToContainer(new Slot(slots, 25, 134, 48) { }); this.addSlotToContainer(new Slot(slots, 26, 152, 48) { }); int si; int sj; for (si = 0; si < 3; ++si) for (sj = 0; sj < 9; ++sj) this.addSlotToContainer(new Slot(player.inventory, sj + (si + 1) * 9, 0 + 8 + sj * 18, 0 + 84 + si * 18)); for (si = 0; si < 9; ++si) this.addSlotToContainer(new Slot(player.inventory, si, 0 + 8 + si * 18, 0 + 142)); } @Override public boolean canInteractWith(EntityPlayer player) { return true; } @Override public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = (Slot) this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index < 27) { if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if (!this.mergeItemStack(itemstack1, 0, 27, false)) { if (index < 27 + 27) { if (!this.mergeItemStack(itemstack1, 27 + 27, this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } } else { if (!this.mergeItemStack(itemstack1, 27, 27 + 27, false)) { return ItemStack.EMPTY; } } return ItemStack.EMPTY; } if (itemstack1.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(playerIn, itemstack1); } return itemstack; } @Override /** * Merges provided ItemStack with the first avaliable one in the container/player inventor between minIndex (included) and maxIndex (excluded). Args : stack, minIndex, maxIndex, negativDirection. /!\ the Container implementation do not check if the item is valid for the slot */ protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) { boolean flag = false; int i = startIndex; if (reverseDirection) { i = endIndex - 1; } if (stack.isStackable()) { while (!stack.isEmpty()) { if (reverseDirection) { if (i < startIndex) { break; } } else if (i >= endIndex) { break; } Slot slot = this.inventorySlots.get(i); ItemStack itemstack = slot.getStack(); if (slot.isItemValid(itemstack) && !itemstack.isEmpty() && itemstack.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getMetadata() == itemstack.getMetadata()) && ItemStack.areItemStackTagsEqual(stack, itemstack)) { int j = itemstack.getCount() + stack.getCount(); int maxSize = Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize()); if (j <= maxSize) { stack.setCount(0); itemstack.setCount(j); slot.putStack(itemstack); flag = true; } else if (itemstack.getCount() < maxSize) { stack.shrink(maxSize - itemstack.getCount()); itemstack.setCount(maxSize); slot.putStack(itemstack); flag = true; } } if (reverseDirection) { --i; } else { ++i; } } } if (!stack.isEmpty()) { if (reverseDirection) { i = endIndex - 1; } else { i = startIndex; } while (true) { if (reverseDirection) { if (i < startIndex) { break; } } else if (i >= endIndex) { break; } Slot slot1 = this.inventorySlots.get(i); ItemStack itemstack1 = slot1.getStack(); if (itemstack1.isEmpty() && slot1.isItemValid(stack)) { if (stack.getCount() > slot1.getSlotStackLimit()) { slot1.putStack(stack.splitStack(slot1.getSlotStackLimit())); } else { slot1.putStack(stack.splitStack(stack.getCount())); } slot1.onSlotChanged(); flag = true; break; } if (reverseDirection) { --i; } else { ++i; } } } return flag; } @Override public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); InventoryHelper.dropInventoryItems(world, new BlockPos(x, y, z), slots); } private void slotChanged(int slotid, int ctype, int meta) { if (this.world != null && this.world.isRemote) { variety.PACKET_HANDLER.sendToServer(new GUISlotChangedMessage(slotid, x, y, z, ctype, meta)); handleSlotAction(entity, slotid, ctype, meta, x, y, z); } } } public static class GuiWindow extends GuiContainer { World world; int x, y, z; EntityPlayer entity; public GuiWindow(World world, int x, int y, int z, EntityPlayer entity) { super(new GuiContainerMod(world, x, y, z, entity)); this.world = world; this.x = x; this.y = y; this.z = z; this.entity = entity; this.xSize = 176; this.ySize = 166; } private static final ResourceLocation texture = new ResourceLocation("variety:textures/zeplecakgui.png"); @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); this.renderHoveredToolTip(mouseX, mouseY); } @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture(texture); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); zLevel = 100.0F; } @Override public void updateScreen() { super.updateScreen(); } @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); } @Override protected void keyTyped(char typedChar, int keyCode) throws IOException { super.keyTyped(typedChar, keyCode); } @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { } @Override public void onGuiClosed() { super.onGuiClosed(); Keyboard.enableRepeatEvents(false); } @Override public void initGui() { super.initGui(); this.guiLeft = (this.width - 176) / 2; this.guiTop = (this.height - 166) / 2; Keyboard.enableRepeatEvents(true); this.buttonList.clear(); } @Override protected void actionPerformed(GuiButton button) { variety.PACKET_HANDLER.sendToServer(new GUIButtonPressedMessage(button.id, x, y, z)); handleButtonAction(entity, button.id, x, y, z); } @Override public boolean doesGuiPauseGame() { return false; } } public static class GUIButtonPressedMessageHandler implements IMessageHandler<GUIButtonPressedMessage, IMessage> { @Override public IMessage onMessage(GUIButtonPressedMessage message, MessageContext context) { EntityPlayerMP entity = context.getServerHandler().player; entity.getServerWorld().addScheduledTask(() -> { int buttonID = message.buttonID; int x = message.x; int y = message.y; int z = message.z; handleButtonAction(entity, buttonID, x, y, z); }); return null; } } public static class GUISlotChangedMessageHandler implements IMessageHandler<GUISlotChangedMessage, IMessage> { @Override public IMessage onMessage(GUISlotChangedMessage message, MessageContext context) { EntityPlayerMP entity = context.getServerHandler().player; entity.getServerWorld().addScheduledTask(() -> { int slotID = message.slotID; int changeType = message.changeType; int meta = message.meta; int x = message.x; int y = message.y; int z = message.z; handleSlotAction(entity, slotID, changeType, meta, x, y, z); }); return null; } } public static class GUIButtonPressedMessage implements IMessage { int buttonID, x, y, z; public GUIButtonPressedMessage() { } public GUIButtonPressedMessage(int buttonID, int x, int y, int z) { this.buttonID = buttonID; this.x = x; this.y = y; this.z = z; } @Override public void toBytes(io.netty.buffer.ByteBuf buf) { buf.writeInt(buttonID); buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); } @Override public void fromBytes(io.netty.buffer.ByteBuf buf) { buttonID = buf.readInt(); x = buf.readInt(); y = buf.readInt(); z = buf.readInt(); } } public static class GUISlotChangedMessage implements IMessage { int slotID, x, y, z, changeType, meta; public GUISlotChangedMessage() { } public GUISlotChangedMessage(int slotID, int x, int y, int z, int changeType, int meta) { this.slotID = slotID; this.x = x; this.y = y; this.z = z; this.changeType = changeType; this.meta = meta; } @Override public void toBytes(io.netty.buffer.ByteBuf buf) { buf.writeInt(slotID); buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); buf.writeInt(changeType); buf.writeInt(meta); } @Override public void fromBytes(io.netty.buffer.ByteBuf buf) { slotID = buf.readInt(); x = buf.readInt(); y = buf.readInt(); z = buf.readInt(); changeType = buf.readInt(); meta = buf.readInt(); } } private static void handleButtonAction(EntityPlayer entity, int buttonID, int x, int y, int z) { World world = entity.world; // security measure to prevent arbitrary chunk generation if (!world.isBlockLoaded(new BlockPos(x, y, z))) return; } private static void handleSlotAction(EntityPlayer entity, int slotID, int changeType, int meta, int x, int y, int z) { World world = entity.world; // security measure to prevent arbitrary chunk generation if (!world.isBlockLoaded(new BlockPos(x, y, z))) return; } }
[ "barte@Bartosz" ]
barte@Bartosz
2fa36a38480c38bd8d8f6023be26836ef6fbd0cc
766620bdb70f6125487a92945a790bd0216d1620
/app/src/main/java/com/example/notelagi/DataBase/NotesDB.java
9ba36d8f73380ac70e2cb85023054334c9f3e9bf
[]
no_license
figoaulia404/NoteLagi
945f48babcea5a6daf6d260682c21a5aa5c3f101
ffeb333d41abdee5f49f2c5f70f2c161203c6f45
refs/heads/master
2020-12-07T18:24:26.508526
2020-01-09T09:34:05
2020-01-09T09:34:05
232,770,979
0
0
null
null
null
null
UTF-8
Java
false
false
723
java
package com.example.notelagi.DataBase; import android.content.Context; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; import com.example.notelagi.Model.Note; @Database(entities = Note.class, version = 1) public abstract class NotesDB extends RoomDatabase { public abstract NotesDAO notesDAO(); public static final String DATABASE_NAME = "notesDB"; private static NotesDB instance; public static NotesDB getInstance(Context context){ if (instance == null) instance = Room.databaseBuilder(context,NotesDB.class, DATABASE_NAME) .allowMainThreadQueries() .build(); return instance; } }
[ "figoaulia404@gmail.com" ]
figoaulia404@gmail.com
ed0bfa09d6a3d221031b555d6f7455f6255cc861
cf1b67485e51ab4df1a3ff16e1a17287737aa156
/synpower-box/.svn/pristine/07/078c96462df25392b1e9270cf03e7b6959fb1f72.svn-base
a3a19dee076fd1ac72e00964bbc0130709c42604
[]
no_license
FangtaoLiao/xienengWorkSpace
f6bab3c2be5f02a0683d5f6263a2abbd3ae56736
418f8897d246228489a900aa92530ed1a95c3a23
refs/heads/master
2020-04-25T02:35:12.088240
2018-12-07T10:30:06
2018-12-07T10:30:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,719
package com.synpower.service; import java.text.ParseException; import java.util.Map; import com.synpower.lang.ServiceException; import com.synpower.lang.SessionException; import com.synpower.lang.SessionTimeoutException; import com.synpower.msg.MessageBean; import com.synpower.msg.session.Session; public interface WXMonitorPlantService { /** * @Title: getCurrentPowerWX * @Description: 微信单电站实时功率接口 * @param jsonData * @return * @throws ServiceException: Map<String,Object> * @lastEditor: SP0011 * @lastEdit: 2017年12月16日上午10:28:49 */ public Map<String, Object> getCurrentPowerWX(String jsonData) throws ServiceException; /** * @Title: singlePlant * @Description: 单电站实时收益 * @param jsonData * @return * @throws ServiceException: MessageBean * @lastEditor: SP0011 * @lastEdit: 2017年12月16日下午1:50:11 */ public MessageBean singlePlant(String jsonData)throws ServiceException; /** * @Title: singleDynamic * @Description: 单电站静态信息 * @param jsonData * @param session * @return * @throws ServiceException * @throws SessionException * @throws SessionTimeoutException: MessageBean * @lastEditor: SP0011 * @lastEdit: 2017年12月16日下午1:49:52 */ public MessageBean singleDynamic(String jsonData,Session session)throws ServiceException, SessionException, SessionTimeoutException ; /** * @Title: singleGenCurve * @Description: 发电量柱状图 * @param jsonData * @param session * @return * @throws ServiceException * @throws SessionException * @throws SessionTimeoutException: MessageBean * @lastEditor: SP0011 * @lastEdit: 2017年12月16日下午1:49:48 */ public MessageBean singleGenCurve(String jsonData,Session session)throws ServiceException, SessionException, SessionTimeoutException,ParseException ; /** * @Title: device * @Description: 设备列表 * @param jsonData * @param session * @return * @throws ServiceException * @throws SessionException * @throws SessionTimeoutException: MessageBean * @lastEditor: SP0011 * @lastEdit: 2017年12月16日下午3:04:03 */ public MessageBean device(String jsonData, Session session)throws ServiceException, SessionException, SessionTimeoutException; /** * @Title: deviceWX * @Description: 微信获取设备列表 * @param jsonData * @param session * @return * @throws ServiceException * @throws SessionException * @throws SessionTimeoutException: MessageBean * @lastEditor: SP0009 * @lastEdit: 2018年3月29日下午6:29:57 */ public MessageBean deviceWX(String jsonData, Session session)throws ServiceException, SessionException, SessionTimeoutException; /** * @Title: deviceDetail * @Description: 设备详情 * @param jsonData * @param session * @return * @throws ServiceException * @throws SessionException * @throws SessionTimeoutException: MessageBean * @lastEditor: SP0011 * @lastEdit: 2017年12月16日下午3:39:16 */ public MessageBean deviceDetail(String jsonData, Session session)throws ServiceException, SessionException, SessionTimeoutException; /** * @Title: updateValueOfGuid * @Description: 遥控遥调指令下发 * @param jsonData * @param session * @return * @throws ServiceException * @throws SessionException * @throws SessionTimeoutException: MessageBean * @lastEditor: SP0011 * @lastEdit: 2017年12月16日下午4:20:39 */ public MessageBean updateValueOfGuid(String jsonData, Session session)throws ServiceException, SessionException, SessionTimeoutException; }
[ "691330215@qq.com" ]
691330215@qq.com
8c03333527014a1ffcfec6aa2f38c8867ed0449f
4cac0dcbc81a68b0a3820173a41aad396b6f8460
/src/main/java/com/corprall/practicemod/handler/ConfigHandler.java
51de601ec59e4f18f42afaa5464d4595fd3eadb3
[ "MIT" ]
permissive
Corprall/PracticeMod
674a77a61b318feb96825132e4190016bf75439c
c158793dd2cbe04285fee1b06723b118fb446b40
refs/heads/master
2021-01-25T07:34:29.880645
2015-06-30T15:29:30
2015-06-30T15:29:30
38,290,675
0
0
null
null
null
null
UTF-8
Java
false
false
987
java
package com.corprall.practicemod.handler; import com.corprall.practicemod.references.GeneralRef; import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.config.Configuration; import java.io.File; public class ConfigHandler { public static Configuration configuration; public static boolean testValue = false; public static void init(File configFile){ if (configuration == null){ configuration = new Configuration(configFile); } } @SubscribeEvent public void onConfigChangeEvent (ConfigChangedEvent.OnConfigChangedEvent event){ if (event.modID.equalsIgnoreCase(GeneralRef.MOD_ID)){} } public void loadConfiguration(){ testValue = configuration.getBoolean("configValue", Configuration.CATEGORY_GENERAL, false, "Test Config"); if (configuration.hasChanged()){ configuration.save(); } } }
[ "dan@shrapnel3d.com" ]
dan@shrapnel3d.com
ed9e3866319290cfc7692d4a6aac4d9f1c99222b
be6a7469b17207a4ab2f5919d7708e4a4737cd95
/1.JavaSyntax/src/com/javarush/task/task08/task0806/Solution.java
9b970775d094c02c9560c2b2523521d754d4f7f7
[]
no_license
krizzis/javaRushTasks
51817d2252fcb6add4401f3182e77c985f803fa8
3812b6f489915cc26e8c0482b5fded4674a18623
refs/heads/master
2021-01-22T23:05:57.954535
2017-12-04T13:05:12
2017-12-04T13:05:12
85,604,367
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
package com.javarush.task.task08.task0806; import java.util.HashMap; import java.util.Map; /* Коллекция HashMap из Object Есть коллекция HashMap<String, Object>, туда занесли 10 различных пар объектов. Вывести содержимое коллекции на экран, каждый элемент с новой строки. */ public class Solution { public static void main(String[] args) throws Exception { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("Sim", 5); map.put("Tom", 5.5); map.put("Arbus", false); map.put("Baby", null); map.put("Cat", "Cat"); map.put("Eat", new Long(56)); map.put("Food", new Character('3')); map.put("Gevey", '6'); map.put("Hugs", 111111111111L); map.put("Comp", (double) 123); map.forEach((k,v)-> System.out.println(k+" - "+v)); } }
[ "dn301182bva@gmail.com" ]
dn301182bva@gmail.com
e2163f337c0c9bbb1f585f8c9b16a6ab752da433
e24b419e55bbe6e66fec09d177583d0abfc71681
/FirstHomeWork/src/com/company/Main.java
e932b53e1758dea14c2cdb0044072a47873d262a
[]
no_license
nekochanoide/univer-9-java
a6f4203568cee631bf11b1acbc702187e004031e
37796f0fbb7c7e2a12024a05c102043431f4e150
refs/heads/main
2023-05-31T13:17:26.214752
2021-06-14T08:41:04
2021-06-14T08:41:04
356,609,340
0
0
null
null
null
null
UTF-8
Java
false
false
7,409
java
package com.company; import java.util.*; import java.util.stream.Collector; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { args = new String[]{ "C100_1-100", "C200_1-120-1200", "C300_1-120-30", "C400_1-80-20", "C100_2-50", "C200_2-40-1000", "C300_2-200-45", "C400_2-10-20", "C100_3-10", "C200_3-170-1100", "C300_3-150-29", "C400_3-100-28", "C100_1-300", "C200_1-100-750", "C300_1-32-15" }; AppContext appContext = new AppContext(); CarParser carParser = new CarParser(appContext); Car[] cars = new Car[args.length]; for (int i = 0; i < args.length; i++) { String arg = args[i]; Car car = carParser.parse(arg); cars[i] = car; appContext.carsByType.get(car.carType).add(car); } appContext.allCars = cars; ReportService reportService = new ReportService(appContext); double totalExpenses = reportService.getSumOfExpenses(Arrays.asList(cars)); System.out.println("Общая стоимость рахсодов на ГСМ: " + totalExpenses); String mostExpensiveType = ""; double mostExpenses = 0; String leastExpensiveType = ""; double leastExpenses = Double.MAX_VALUE; for (CarType carType : appContext.carTypes) { double typeExpenses = reportService.getSumOfExpensesByType(carType); if (typeExpenses > mostExpenses) { mostExpenses = typeExpenses; mostExpensiveType = carType.name; } if (typeExpenses < leastExpenses) { leastExpenses = typeExpenses; leastExpensiveType = carType.name; } System.out.println("Общая стоимость рахсодов на ГСМ для: " + carType.name + " - " + typeExpenses); } System.out.println("Тип авто имеющий наибольшую стомость расходов: " + mostExpensiveType); System.out.println("Тип авто имеющий наименьшую стомость расходов: " + leastExpensiveType); System.out.println(); System.out.println("Инфо об авто в разрезе типа, сортировка: пробег потом доп параметр (если он есть)"); for (Car car : reportService.getOrdered(appContext.carTypes[3])) { System.out.println("Номер - " + car.governmentNumber); System.out.println("Пробег - " + car.mileage); System.out.println("Доп параметр - " + car.extraParam); } } } class ReportService { private AppContext _appContext; public ReportService(AppContext appContext) { _appContext = appContext; } public Collection<Car> getOrdered(CarType carType) { List<Car> cars = _appContext.carsByType.get(carType); Comparator<Car> comparator = Comparator.comparing(x -> x.mileage); if (carType.hasExtraParam) { comparator = comparator.thenComparing(x -> x.extraParam); } return cars.stream().sorted(comparator).collect(Collectors.toList()); } public Collection<Car> getOrderedByMileage(CarType carType) { List<Car> cars = _appContext.carsByType.get(carType); Comparator<Car> comparator = Comparator.comparing(x -> x.mileage); return cars.stream().sorted(comparator).collect(Collectors.toList()); } public Collection<Car> getOrderedByExtraParam(CarType carType) { if (!carType.hasExtraParam) { throw new IllegalArgumentException("carType, Тип не имеет доп параметра."); } List<Car> cars = _appContext.carsByType.get(carType); Comparator<Car> comparator = Comparator.comparing(x -> x.extraParam); return cars.stream().sorted(comparator).collect(Collectors.toList()); } public double getSumOfExpensesByType(CarType carType) { return getSumOfExpenses(_appContext.carsByType.get(carType)); } public double getSumOfExpenses(Collection<Car> cars) { double totalExpenses = 0; for (Car car : cars) { totalExpenses += car.calculateExpenses(); } return totalExpenses; } } class CarParser { private AppContext _appContext; public CarParser(AppContext appContext) { _appContext = appContext; } public Car parse(String car) { String[] a = car.split("_"); String codeString = a[0].substring(1); int code = Integer.parseInt(codeString); CarType carType = _appContext.carTypeMap.get(code); String[] params = a[1].split("-"); if (carType.hasExtraParam) { return new Car(carType, Integer.parseInt(params[0]), Integer.parseInt(params[1]), Integer.parseInt(params[2])); } return new Car(carType, Integer.parseInt(params[0]), Integer.parseInt(params[1]), 0); } } class AppContext { public Map<Integer, CarType> carTypeMap; public Car[] allCars; public CarType[] carTypes = { new CarType("легковой авто", 100, 46.1, 12.5, false), new CarType("грузовой авто - объем перевезенного груза см. куб.", 200, 48.9, 12, true), new CarType("пассажирский транспорт - число перевезенных пассажиров", 300, 47.5, 11.5, true), new CarType("тяжелая техника(краны) - вес поднятых грузов тонн", 400, 48.9, 20, true) }; public Map<CarType, ArrayList<Car>> carsByType; public AppContext() { carTypeMap = Map.of( carTypes[0].typeCode, carTypes[0], carTypes[1].typeCode, carTypes[1], carTypes[2].typeCode, carTypes[2], carTypes[3].typeCode, carTypes[3] ); carsByType = Map.of( carTypes[0], new ArrayList<>(), carTypes[1], new ArrayList<>(), carTypes[2], new ArrayList<>(), carTypes[3], new ArrayList<>() ); } } class Car { public CarType carType; public int governmentNumber; public int mileage; public int extraParam; public Car(CarType carType, int governmentNumber, int mileage, int extraParam) { this.carType = carType; this.governmentNumber = governmentNumber; this.mileage = mileage; this.extraParam = extraParam; } public Car() { // PogChamp. } public double calculateExpenses() { return mileage / carType.fuelConsumption * carType.fuelCost; } } class CarType { public String name; public int typeCode; public double fuelCost; public double fuelConsumption; public boolean hasExtraParam; public CarType(String name, int typeCode, double fuelCost, double fuelConsumption, boolean hasExtraParam) { this.name = name; this.typeCode = typeCode; this.fuelCost = fuelCost; this.fuelConsumption = fuelConsumption; this.hasExtraParam = hasExtraParam; } } class YourMom { String weight = "A LOT!"; }
[ "motya202@gmail.com" ]
motya202@gmail.com
d87fb5d5811a53deb4468ae8865c9b0d67e08918
a4c7c5e9b1b92f92afcbc1aa7f2600f5695feee8
/visualizerview_java/src/test/java/com/vension/visualizerview_java/ExampleUnitTest.java
308e022afedac8c8ffa4ff4bcf9068d0c5126502
[ "Apache-2.0" ]
permissive
SkeletonKing-SNK/V-VisualizerView
6fb7d0ce9991512acc8071e354f7a643a64abcf5
5dc9d45cce717d6de0e2e6b027b52d184c4d16eb
refs/heads/master
2023-03-16T10:27:22.038199
2019-07-11T01:36:38
2019-07-11T01:36:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.vension.visualizerview_java; 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); } }
[ "2506856664@qq.com" ]
2506856664@qq.com
af943799ea27dc99c51f4cfa5945b59e7696d84f
0df7331fb9dfb68b00248c6b4cfa313fa0fd0f45
/real-estate-it/src/main/java/com/zawadz88/realestate/test/AllTests.java
5a2d36c8750e9acc2729560c2831c4ed79b69244
[]
no_license
zawadz88/real-estate-all
e829171bc562e470ae46d7e8188cd8805abac9ef
44048e7f33fd4f4df87f347ff9c2f755908176bc
refs/heads/master
2021-01-01T15:35:15.259257
2014-05-13T13:32:16
2014-05-13T13:32:16
14,076,044
2
2
null
null
null
null
UTF-8
Java
false
false
1,044
java
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.zawadz88.realestate.test; import android.test.suitebuilder.TestSuiteBuilder; import junit.framework.Test; import junit.framework.TestSuite; /** * A test suite containing all tests for MorseFlash. */ public class AllTests extends TestSuite { public static Test suite() { return new TestSuiteBuilder(AllTests.class) .includeAllPackagesUnderHere() .build(); } }
[ "zawadz88@gmail.com" ]
zawadz88@gmail.com
04f3927123292263abedd40d91306ee9b43e5d39
c212cfc47cbddd789d1988753c3a0a1bc88a5203
/src/main/java/de/uni_koeln/info/extraction/Writer.java
4bddab960205d86fdc11fc4418831238b991d592
[]
no_license
matana/rg-sent-preprocessor
7bc36fe76df06797b2e3ad12bd933346b86141e6
5e227a504794f40c7d348cb7e42834c37243eba9
refs/heads/master
2020-06-16T22:13:04.644932
2016-11-29T09:29:56
2016-11-29T09:29:56
75,062,753
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
package de.uni_koeln.info.extraction; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.List; public class Writer { /** * This routine writes the extracted sentences into a plain text file. Each * line represents a sentence. */ public static void writeSentenceFile(File file, List<String> data) throws IOException { BufferedWriter bw = new BufferedWriter(new FileWriter(file)); for (int i = 0; i < data.size(); i++) { bw.write(data.get(i)); bw.newLine(); } bw.close(); System.out.println(Writer.class.getName() + " | ouput: '" + file + "'"); } }
[ "atanassov.mihail@gmail.com" ]
atanassov.mihail@gmail.com
205c8c0ccc04008dde6a44505c0473fb2d7a6ff6
e4b31211bb855a5db8f5902b144e94d8d1f7c058
/src/collections/Programs.java
25072d020af41af1837ef7ffb2c78722ccbc3f78
[]
no_license
bhaskarbala/JavaPrograms
a6d2e421d4d5103d6c84cb7a2d669c4bd02185a1
b3a74cd1afc7430234490e5cf6eac3ec607082f6
refs/heads/master
2020-05-30T11:29:50.625064
2019-06-19T14:43:55
2019-06-19T14:43:55
189,703,191
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package collections; import java.util.ArrayList; import java.util.ListIterator; public class Programs { public static void main(String[] args) { int count=0 ; ArrayList<Integer> a=new ArrayList<>(); a.add(22); a.add(25); a.add(22); a.add(23); a.add(22); a.add(27); a.add(22); /* ListIterator <Integer>lt=a.listIterator(); while(lt.hasNext()) { if(lt.next()==22) { count ++; } } */ for(int i=0;i<=a.size()-1;i++) { if(a.get(i)==22) { count++; } } System.out.println(count); } }
[ "bhaskar3718@gmail.com" ]
bhaskar3718@gmail.com
40a2f816868496f57a91fe2360c395d917d16519
48cfa9254b369c7cd462816a783551f2843314da
/ArbolGeneral/NodoArbol.java
ce2cf8bce0ed786fb0d56d7fbce43ed51c665e6f
[]
no_license
Edy-Cabrera/estructuras-de-datos
4784a3536147a3dbdbc2e8582c117280965c83be
6b073deaeca5c76522b48b215e524d6e75259e33
refs/heads/master
2023-06-24T13:03:09.765621
2021-07-26T03:18:07
2021-07-26T03:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,148
java
package ArbolGeneral; /** * * @author Carlos San Juan <carlossanjuanc@gmail.com> */ public class NodoArbol { //De tipo Object para poder almacenar cualquier informacion private Object dato; private NodoArbol hijo; private NodoArbol hermano; // Constructor basico de un Nodo sin hijos ni hermanos (pero con el dato) public NodoArbol(Object elDato) { dato = elDato; hijo = null; hermano = null; } // Constructor con los 3 parametros public NodoArbol(Object elDato, NodoArbol elHijo, NodoArbol elHermano) { dato = elDato; hijo = elHijo; hermano = elHermano; } public Object getDato() { return dato; } public void setDato(Object elDato) { dato = elDato; } public NodoArbol getHijo() { return hijo; } public void setHijo(NodoArbol elHijo) { hijo = elHijo; } public NodoArbol getHermano() { return hermano; } public void setHermano(NodoArbol elHermano) { hermano = elHermano; } }
[ "carlossanjuanc@gmail.com" ]
carlossanjuanc@gmail.com
9ea1e865f34112111354e0f0590d526da73f2357
863acb02a064a0fc66811688a67ce3511f1b81af
/sources/com/google/android/gms/internal/ads/zzcsm.java
b002a902de7b07c565e9b6d6b7d6ca48b1ea22f1
[ "MIT" ]
permissive
Game-Designing/Custom-Football-Game
98d33eb0c04ca2c48620aa4a763b91bc9c1b7915
47283462b2066ad5c53b3c901182e7ae62a34fc8
refs/heads/master
2020-08-04T00:02:04.876780
2019-10-06T06:55:08
2019-10-06T06:55:08
211,914,568
1
1
null
null
null
null
UTF-8
Java
false
false
681
java
package com.google.android.gms.internal.ads; import com.google.android.gms.common.util.Clock; public final class zzcsm implements zzdti<zzcsk<zzcsg>> { /* renamed from: a */ private final zzdtu<zzcsh> f27335a; /* renamed from: b */ private final zzdtu<Clock> f27336b; public zzcsm(zzdtu<zzcsh> zzdtu, zzdtu<Clock> zzdtu2) { this.f27335a = zzdtu; this.f27336b = zzdtu2; } public final /* synthetic */ Object get() { zzcsk zzcsk = new zzcsk((zzcsh) this.f27335a.get(), 10000, (Clock) this.f27336b.get()); zzdto.m30114a(zzcsk, "Cannot return null from a non-@Nullable @Provides method"); return zzcsk; } }
[ "tusharchoudhary0003@gmail.com" ]
tusharchoudhary0003@gmail.com
2267e565e6f561125ebf8c395d86a96133bbd7ce
4686dd88101fa2c7bf401f1338114fcf2f3fc28e
/server/src/test/java/org/elasticsearch/cluster/health/ClusterShardHealthTests.java
6ee0fc1ee0a67b4d71ee80759daefa7192625ac9
[ "Apache-2.0", "LicenseRef-scancode-elastic-license-2018" ]
permissive
strapdata/elassandra
55f25be97533435d7d3ebaf9fa70d985020163e2
b90667791768188a98641be0f758ff7cd9f411f0
refs/heads/v6.8.4-strapdata
2023-08-27T18:06:35.023045
2022-01-03T14:21:32
2022-01-03T14:21:32
41,209,174
1,199
203
Apache-2.0
2022-12-08T00:38:37
2015-08-22T13:52:08
Java
UTF-8
Java
false
false
5,366
java
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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.elasticsearch.cluster.health; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.AbstractSerializingTestCase; import java.io.IOException; import java.util.Arrays; import java.util.function.Predicate; import java.util.stream.Collectors; public class ClusterShardHealthTests extends AbstractSerializingTestCase<ClusterShardHealth> { @Override protected ClusterShardHealth doParseInstance(XContentParser parser) throws IOException { return ClusterShardHealth.fromXContent(parser); } @Override protected ClusterShardHealth createTestInstance() { return randomShardHealth(randomInt(1000)); } static ClusterShardHealth randomShardHealth(int id) { return new ClusterShardHealth(id, randomFrom(ClusterHealthStatus.values()), randomInt(1000), randomInt(1000), randomInt(1000), randomInt(1000), randomBoolean()); } @Override protected Writeable.Reader<ClusterShardHealth> instanceReader() { return ClusterShardHealth::new; } @Override protected boolean supportsUnknownFields() { return true; } @Override protected Predicate<String> getRandomFieldsExcludeFilter() { //don't inject random fields at the root, which contains arbitrary shard ids return ""::equals; } @Override protected ClusterShardHealth mutateInstance(final ClusterShardHealth instance) { String mutate = randomFrom("shardId", "status", "activeShards", "relocatingShards", "initializingShards", "unassignedShards", "primaryActive"); switch (mutate) { case "shardId": return new ClusterShardHealth(instance.getShardId() + between(1, 10), instance.getStatus(), instance.getActiveShards(), instance.getRelocatingShards(), instance.getInitializingShards(), instance.getUnassignedShards(), instance.isPrimaryActive()); case "status": ClusterHealthStatus status = randomFrom( Arrays.stream(ClusterHealthStatus.values()).filter( value -> !value.equals(instance.getStatus()) ).collect(Collectors.toList()) ); return new ClusterShardHealth(instance.getShardId(), status, instance.getActiveShards(), instance.getRelocatingShards(), instance.getInitializingShards(), instance.getUnassignedShards(), instance.isPrimaryActive()); case "activeShards": return new ClusterShardHealth(instance.getShardId(), instance.getStatus(), instance.getActiveShards() + between(1, 10), instance.getRelocatingShards(), instance.getInitializingShards(), instance.getUnassignedShards(), instance.isPrimaryActive()); case "relocatingShards": return new ClusterShardHealth(instance.getShardId(), instance.getStatus(), instance.getActiveShards(), instance.getRelocatingShards() + between(1, 10), instance.getInitializingShards(), instance.getUnassignedShards(), instance.isPrimaryActive()); case "initializingShards": return new ClusterShardHealth(instance.getShardId(), instance.getStatus(), instance.getActiveShards(), instance.getRelocatingShards(), instance.getInitializingShards() + between(1, 10), instance.getUnassignedShards(), instance.isPrimaryActive()); case "unassignedShards": return new ClusterShardHealth(instance.getShardId(), instance.getStatus(), instance.getActiveShards(), instance.getRelocatingShards(), instance.getInitializingShards(), instance.getUnassignedShards() + between(1, 10), instance.isPrimaryActive()); case "primaryActive": return new ClusterShardHealth(instance.getShardId(), instance.getStatus(), instance.getActiveShards(), instance.getRelocatingShards(), instance.getInitializingShards(), instance.getUnassignedShards(), instance.isPrimaryActive() == false); default: throw new UnsupportedOperationException(); } } }
[ "luca@elastic.co" ]
luca@elastic.co
313d556869ec48e052021d60c8fdff78f6b683db
b111b77f2729c030ce78096ea2273691b9b63749
/db-example-large-multi-project/project58/src/test/java/org/gradle/test/performance/mediumjavamultiproject/project58/p293/Test5875.java
3b4deeb15bf3e028d00252b3995af4c66529c293
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
2,556
java
package org.gradle.test.performance.mediumjavamultiproject.project58.p293; import org.junit.Test; import static org.junit.Assert.*; public class Test5875 { Production5875 objectUnderTest = new Production5875(); @Test public void testProperty0() throws Exception { String value = "value"; objectUnderTest.setProperty0(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() throws Exception { String value = "value"; objectUnderTest.setProperty1(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() throws Exception { String value = "value"; objectUnderTest.setProperty2(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() throws Exception { String value = "value"; objectUnderTest.setProperty3(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() throws Exception { String value = "value"; objectUnderTest.setProperty4(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() throws Exception { String value = "value"; objectUnderTest.setProperty5(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() throws Exception { String value = "value"; objectUnderTest.setProperty6(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() throws Exception { String value = "value"; objectUnderTest.setProperty7(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() throws Exception { String value = "value"; objectUnderTest.setProperty8(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() throws Exception { String value = "value"; objectUnderTest.setProperty9(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty9()); } }
[ "nateweiler84@gmail.com" ]
nateweiler84@gmail.com
726337691e1d0f05882128e85cdedf42ad9f12a6
d0eec9d1ff774f28a1a7899a3ab996bad9d91baf
/src/main/java/fernando/learn/app/controller/SolicitudesController.java
f44fc172dfb6488af05c022c51f408e7b1d09abb
[]
no_license
fernanpm95/spring-empleos
93f982f1204b297b8a2ae6d68e76a077b1ccaffe
95d57c6a0e9f168b65dbcaf106973377e73203c3
refs/heads/master
2022-12-19T00:19:51.499224
2020-09-26T17:17:10
2020-09-26T17:17:10
298,855,364
0
0
null
null
null
null
UTF-8
Java
false
false
5,921
java
package fernando.learn.app.controller; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import fernando.learn.app.model.Solicitud; import fernando.learn.app.model.Usuario; import fernando.learn.app.model.Vacante; import fernando.learn.app.service.ISolicitudesService; import fernando.learn.app.service.IUsuariosService; import fernando.learn.app.service.IVacantesService; import fernando.learn.app.util.Utileria; @Controller @RequestMapping("/solicitudes") public class SolicitudesController { @Autowired ISolicitudesService serviceSolicitudes; @Autowired IVacantesService serviceVacantes; @Autowired IUsuariosService serviceUsuarios; /** * EJERCICIO: Declarar esta propiedad en el archivo application.properties. El valor sera el directorio * en donde se guardarán los archivos de los Curriculums Vitaes de los usuarios. */ @Value("${empleosapp.ruta.cv}") private String ruta; /** * Metodo que muestra la lista de solicitudes sin paginacion * Seguridad: Solo disponible para un usuarios con perfil ADMINISTRADOR/SUPERVISOR. * @return */ @GetMapping("/index") public String mostrarIndex(Model model) { // EJERCICIO List<Solicitud> solicitudes = serviceSolicitudes.buscarTodas(); model.addAttribute("solicitudes", solicitudes); return "solicitudes/listSolicitudes"; } /** * Metodo que muestra la lista de solicitudes con paginacion * Seguridad: Solo disponible para usuarios con perfil ADMINISTRADOR/SUPERVISOR. * @return */ @GetMapping("/indexPaginate") public String mostrarIndexPaginado(Model model, Pageable page) { // EJERCICIO Page<Solicitud> solicitudes = serviceSolicitudes.buscarTodas(page); model.addAttribute("solicitudes", solicitudes); return "solicitudes/listSolicitudes"; } /** * Método para renderizar el formulario para aplicar para una Vacante * Seguridad: Solo disponible para un usuario con perfil USUARIO. * @return */ @GetMapping("/create/{idVacante}") public String crear(Solicitud solicitud, @PathVariable("idVacante") int idVacante, Model model) { // EJERCICIO Vacante vacante = serviceVacantes.buscarPorId(idVacante); model.addAttribute("vacante", vacante); return "solicitudes/formSolicitud"; } /** * Método que guarda la solicitud enviada por el usuario en la base de datos * Seguridad: Solo disponible para un usuario con perfil USUARIO. * @return */ @PostMapping("/save") public String guardar(Solicitud solicitud, BindingResult result, @RequestParam(value="archivoCV",required = false) MultipartFile multiPart,@RequestParam(value="archivoCV2",required = false) String archivo2, HttpSession session, Authentication auth, RedirectAttributes attributes) { // EJERCICIO if (result.hasErrors()) { for (ObjectError error : result.getAllErrors()) { System.out.println("Ocurrio un error: " + error.getDefaultMessage()); } return "solicitudes/formSolicitud"; } System.out.println("Solicitud " + solicitud); System.out.println("Solicitudl " + solicitud.getUsuario()); if (solicitud.getUsuario().getId() == null) { String username = auth.getName(); Usuario usuario = serviceUsuarios.buscarPorUsername(username); solicitud.setUsuario(usuario); } solicitud.setFecha(new Date()); if (!multiPart.isEmpty()) { String nombreArchivo = Utileria.guardarArchivo(multiPart, ruta); if (nombreArchivo != null) { // La imagen si se subio // Procesamos la variable nombreImagen solicitud.setArchivo(nombreArchivo); System.out.println("Solicitud " + solicitud); } } else { //solicitud.setArchivo(archivo2); } serviceSolicitudes.guardar(solicitud); attributes.addFlashAttribute("msg", "Vacante guardada"); return "redirect:/"; } /** * Método para eliminar una solicitud * Seguridad: Solo disponible para usuarios con perfil ADMINISTRADOR/SUPERVISOR. * @return */ @GetMapping("/delete/{id}") public String eliminar(@PathVariable("id") int idSolicitud) { // EJERCICIO serviceSolicitudes.eliminar(idSolicitud); return "redirect:/solicitudes/indexPaginate"; } @GetMapping("/edit/{id}") public String edit(@PathVariable("id") int idSolicitud, Model model) { Solicitud solicitud = serviceSolicitudes.buscarPorId(idSolicitud); model.addAttribute("solicitud", solicitud); model.addAttribute("vacante", solicitud.getVacante()); return "solicitudes/formSolicitud"; } /** * Personalizamos el Data Binding para todas las propiedades de tipo Date * @param webDataBinder */ @InitBinder public void initBinder(WebDataBinder webDataBinder) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); } }
[ "fernanpm95@gmail.com" ]
fernanpm95@gmail.com
174387f441b94fb91078e114e646b357c08a0350
61cc96f885aaacc741ff6c4c28ec55fba8351d04
/app/src/main/java/com/example/joellim/singtour/About.java
f33035adf2f6ea909dde55e5eb53b7baa0627572
[]
no_license
joellimrl/SingTour
fd92c7dbe78125fc3582df93a501a056cbd9e8f7
40c064f64fd7e5e9a7f00aa9767d1c8379b4baa7
refs/heads/master
2020-03-28T12:11:05.117450
2018-09-21T07:58:47
2018-09-21T07:58:47
148,276,368
0
0
null
null
null
null
UTF-8
Java
false
false
1,563
java
package com.example.joellim.singtour; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; public class About extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); } public void close(View v){ finish(); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent; switch (item.getItemId()) { case R.id.print: intent = new Intent(this, Print.class); break; case R.id.account: intent = new Intent(this, Account.class); break; case R.id.settings: intent = new Intent(this, SettingsActivity.class); break; case R.id.logout: intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); break; default: return super.onOptionsItemSelected(item); } startActivity(intent); return true; } }
[ "joellimruili@gmail.com" ]
joellimruili@gmail.com
4dde99ee16cacffcbc0c537ce11b505759dd010d
52d9bd2513474a07525e06f6bc816090e6799717
/src/main/java/com/meitu/utils/ThreadPoolUtil.java
ace08d558eb7e9619262bbfcf755f4197cd45dec
[]
no_license
justin-zhu/AppiumFrame
4472a7801084c4f1492909361aa4fa030e258782
1322ca974a426a1b57722bdb570eb552db13666f
refs/heads/master
2022-07-24T18:49:16.731948
2019-11-12T01:10:20
2019-11-12T01:10:20
205,286,278
0
0
null
2022-06-29T17:36:50
2019-08-30T02:07:23
Java
UTF-8
Java
false
false
751
java
package com.meitu.utils; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; /** * 线程池 * @author p_xiaogzhu *2019年3月28日 * */ public class ThreadPoolUtil{ private static ExecutorService executor; private static ScheduledExecutorService scheduledThreadPool; private ThreadPoolUtil(){} public static ExecutorService getCachedThreadPool() { if(executor==null) { executor=Executors.newCachedThreadPool(); } return executor; } public static ScheduledExecutorService getScheduledThreadPool() { if(scheduledThreadPool==null) { scheduledThreadPool=Executors.newScheduledThreadPool(1); } return scheduledThreadPool; } }
[ "493241246@qq.com" ]
493241246@qq.com
75f996a2219bcf212bfe7e5b1d54ba65c31971d4
47d93a0109bf04566b92a48b43e211c6e67b35f4
/app/src/androidTest/java/com/hzj/widget/ExampleInstrumentedTest.java
62d483f0610d236ce4da4cf7534856112b396010
[]
no_license
wobuaihuangjun/Widget
7f21930036d5ed45fc9aafb793d1edf0c4075025
0dd7dbe9a84d5c71611cc3b2b9365d12e7294f4c
refs/heads/master
2020-07-05T16:02:50.578454
2016-11-18T08:42:04
2016-11-18T08:42:04
74,111,204
0
0
null
null
null
null
UTF-8
Java
false
false
732
java
package com.hzj.widget; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.hzj.widget", appContext.getPackageName()); } }
[ "892105817@qq.com" ]
892105817@qq.com
4f13c4c3adb6f668efa21aeba7e17bda6a5a0263
e185e1dbcfbe27762224c497c050d59371f888cd
/src/sample/Controller.java
947cd1768b26b2441a575b87c935d6b69b25138a
[]
no_license
AstralSonic/JavaFXSignInTemplate
8187f1e13cb3d94305b884e4cc4aa5a21c26f795
af463907e55202a9cc50691c87d7663f3d1acddb
refs/heads/master
2020-04-04T08:50:52.554265
2018-11-02T01:33:10
2018-11-02T01:33:10
155,797,009
0
0
null
null
null
null
UTF-8
Java
false
false
909
java
package sample; import java.util.ArrayList; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.control.TextField; public abstract class Controller { //All text fields in scene to be checked protected ArrayList<TextField> textFields = new ArrayList<TextField>(); protected void changeScene(String sceneName) throws Exception { //Load fxml file using the scene url in the scenes map in main using its key scene name Parent root = FXMLLoader.load(getClass().getResource(Main.scenes.get(sceneName))); //Load scene using root Main.loadScene(root); } //Check to see all text textFields in scene are all filled protected boolean checkFields() { for (TextField node : textFields) { //If a textfield node is empty and enabled if (node.getText().equals("") && !node.isDisabled()) { return false; } } return true; } }
[ "greglozada@gmail.com" ]
greglozada@gmail.com
f9be083f31d3165265a7c6c96ab19d69a695b817
035db371d9454d458e1a4fdcda8e22e440cda0e0
/app/src/main/java/com/jiefanproj/android/embutton_master2/data/HelpPageDbManager.java
3a80ea138cde3ea9f750183e0d1dc12bb108fa5f
[]
no_license
Nafeij/NUSH-icode-proj
2dbfec1dc15edd2a0deb49c76dda34707d7b0ff4
ee127bdf3afcff7acbee6e4b1acb298930f712c5
refs/heads/master
2021-04-06T00:22:49.837752
2016-07-11T13:07:48
2016-07-11T13:07:48
62,054,785
1
0
null
null
null
null
UTF-8
Java
false
false
6,913
java
package com.jiefanproj.android.embutton_master2.data; import android.content.ContentValues; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; import java.util.ArrayList; import java.util.List; import com.jiefanproj.android.embutton_master2.AppConstants; import com.jiefanproj.android.embutton_master2.model.HelpPage; import com.jiefanproj.android.embutton_master2.model.PageItem; /** * v 2.0.1.1 */ public class HelpPageDbManager { private static final String TAG = HelpPageDbManager.class.getSimpleName(); private static final String TABLE_CONTENT_HELP = "content_help_table"; private static final String PAGE_ID = "page_id"; private static final String PAGE_LANGUAGE = "page_language"; private static final String PAGE_TYPE = "page_type"; private static final String PAGE_TITLE = "page_title"; private static final String PAGE_HEADING = "page_heading"; // private static final String PAGE_CATEGORIES = "page_categories"; private static final String PAGE_SECTION_ORDER = "page_section_order"; // private static final String PAGE_TOC = "page_toc"; // private static final String PAGE_IMAGE_TITLE = "page_image_title"; // private static final String PAGE_IMAGE_CAPTION = "page_image_caption"; // private static final String PAGE_IMAGE_SRC = "page_image_src"; // private static final String PAGE_ALERT = "page_alert"; private static final String PAGE_CONTENT = "page_content"; private static final String CREATE_TABLE_CONTENT_HELP = "create table " + TABLE_CONTENT_HELP + " ( " + AppConstants.TABLE_PRIMARY_KEY + " integer primary key autoincrement, " + PAGE_ID + " text, " + PAGE_LANGUAGE + " text, " + PAGE_TYPE + " text, " + PAGE_TITLE + " text, " + PAGE_HEADING + " text, " + PAGE_SECTION_ORDER + " text, " + PAGE_CONTENT + " text);"; private static final String INSERT_SQL = "insert into " + TABLE_CONTENT_HELP + " (" + PAGE_ID + ", " + PAGE_LANGUAGE + ", " + PAGE_TYPE + ", " + PAGE_TITLE + ", " + PAGE_HEADING + ", " + PAGE_SECTION_ORDER + ", " + PAGE_CONTENT + ") values (?,?,?,?,?,?,?)"; public static void createTable(SQLiteDatabase db) { db.execSQL(CREATE_TABLE_CONTENT_HELP); } public static void dropTable(SQLiteDatabase db) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTENT_HELP); } public static long insert(SQLiteDatabase db, HelpPage page) throws SQLException { SQLiteStatement insertStatement = db.compileStatement(INSERT_SQL); if (page.getId() != null) insertStatement.bindString(1, page.getId()); if (page.getLang() != null) insertStatement.bindString(2, page.getLang()); if (page.getType() != null) insertStatement.bindString(3, page.getType()); if (page.getTitle() != null) insertStatement.bindString(4, page.getTitle()); if (page.getHeading() != null) insertStatement.bindString(5, page.getHeading()); if (page.getSectionOrder() != null) insertStatement.bindString(6, page.getSectionOrder()); if (page.getContent() != null) insertStatement.bindString(7, page.getContent()); return insertStatement.executeInsert(); // ContentValues cv = new ContentValues(); // // cv.put(PAGE_ID, page.getId()); // cv.put(PAGE_LANGUAGE, page.getLang()); // cv.put(PAGE_TYPE, page.getType()); // cv.put(PAGE_TITLE, page.getTitle()); // cv.put(PAGE_HEADING, page.getHeading()); // cv.put(PAGE_CATEGORIES, page.getCategories()); // cv.put(PAGE_SECTION_ORDER, page.getSectionOrder()); // cv.put(PAGE_TOC, page.getToc()); // cv.put(PAGE_CONTENT, page.getContent()); // cv.put(PAGE_ALERT, page.getAlert()); // // if(page.getImage() != null){ // cv.put(PAGE_IMAGE_TITLE, page.getImage().getTitle()); // cv.put(PAGE_IMAGE_CAPTION, page.getImage().getCaption()); // cv.put(PAGE_IMAGE_SRC, page.getImage().getSrc()); // } // // return db.insert(TABLE_CONTENT_HELP, null, cv); } public static List<HelpPage> retrieve(SQLiteDatabase db, String lang) throws SQLException { List<HelpPage> pageList = new ArrayList<HelpPage>(); Cursor c = db.query(TABLE_CONTENT_HELP, null, PAGE_LANGUAGE + "=?", new String[]{lang}, null, null, null); if (c != null && c.getCount() > 0) { c.moveToFirst(); while (!c.isAfterLast()) { String pageId = c.getString(c.getColumnIndex(PAGE_ID)); String pageType = c.getString(c.getColumnIndex(PAGE_TYPE)); String pageTitle = c.getString(c.getColumnIndex(PAGE_TITLE)); String pageHeading = c.getString(c.getColumnIndex(PAGE_HEADING)); String pageSectionOrder = c.getString(c.getColumnIndex(PAGE_SECTION_ORDER)); String pageContent = c.getString(c.getColumnIndex(PAGE_CONTENT)); List<PageItem> itemList = PageItemDbManager.retrieve(db, pageId, lang); HelpPage page = new HelpPage(pageId, lang, pageType, pageTitle, pageHeading, pageSectionOrder, pageContent, itemList); pageList.add(page); c.moveToNext(); } } c.close(); return pageList; } public static long update(SQLiteDatabase db, HelpPage page) throws SQLException { ContentValues cv = new ContentValues(); cv.put(PAGE_TYPE, page.getType()); cv.put(PAGE_TITLE, page.getTitle()); cv.put(PAGE_HEADING, page.getHeading()); cv.put(PAGE_SECTION_ORDER, page.getSectionOrder()); cv.put(PAGE_CONTENT, page.getContent()); return db.update(TABLE_CONTENT_HELP, cv, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{page.getId(), page.getLang()}); } public static boolean isExist(SQLiteDatabase db, String pageId, String lang) throws SQLException { boolean itemExist = false; Cursor c = db.query(TABLE_CONTENT_HELP, null, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang}, null, null, null); if ((c != null) && (c.getCount() > 0)) { itemExist = true; } c.close(); return itemExist; } public static void insertOrUpdate(SQLiteDatabase db, HelpPage page) { if (isExist(db, page.getId(), page.getLang())) { update(db, page); } else { insert(db, page); } } public static int delete(SQLiteDatabase db, String pageId, String lang) { return db.delete(TABLE_CONTENT_HELP, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang}); } }
[ "wng.jiefan@gmail.com" ]
wng.jiefan@gmail.com
baedc301619f8503d6423ffdb1ba8cf16141a8b5
17e366a3d1294885cab1c7a3e081173ab8750bc0
/src/main/java/org/softuni/finalpoject/domain/models/service/RoleServiceModel.java
96e46bd6f388f626025707254c2a8dcfea3d2090
[]
no_license
paykova/finalproject
5ae1c58ede43ebae893c6d819bb3e0b9481b8879
85e750cfbf9f55d894efd35792a634fa18d3bb6d
refs/heads/master
2020-05-07T11:11:56.043110
2019-04-23T10:43:20
2019-04-23T10:43:20
179,846,217
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package org.softuni.finalpoject.domain.models.service; public class RoleServiceModel extends BaseServiceModel { private String authority; public RoleServiceModel() { } public String getAuthority() { return authority; } public void setAuthority(String authority) { this.authority = authority; } }
[ "paykova@abv.bg" ]
paykova@abv.bg
5d6d3402cf2b4640e5cee2db239f5252e37ae531
6caffabe910567e1207b6172558748a09779da9e
/Grounders/neurologic/LRNN/src/main/java/lrnn/grounding/network/groundNetwork/RuleAggNeuron.java
dcc045905fd6a9f8454c4ddedc7e7a102f6073c1
[]
no_license
wmatex/SVP-grounders
2b238ad91edcec43f7e6fcf7db6165345c438e26
b941dbe304cfe27d6f8bd94bc729915c9a740350
refs/heads/master
2021-09-10T11:13:07.276005
2018-03-25T10:13:55
2018-03-25T10:13:55
109,993,249
0
0
null
null
null
null
UTF-8
Java
false
false
3,816
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 lrnn.grounding.network.groundNetwork; import lrnn.construction.template.LiftedTemplate; import lrnn.global.Global; import lrnn.grounding.network.GroundKappa; import lrnn.grounding.network.GroundLambda; import java.util.List; import java.util.Map; /** * * @author Gusta */ public class RuleAggNeuron extends GroundNeuron { //compressed representation public AtomNeuron[] inputNeuronsCompressed; // first counted sum of all grounded body literals, tehn avg, then sigmoid public int[] inputNeuronCompressedCounts; public int ruleBodyGroundingsCount; //uncompressed representation public AtomNeuron[][] ruleBodyGroundings = null; //uncompressed representation with proper rule neurons each with sigmoid, then avg public double[] sumedInputsOfEachBodyGrounding = null; public int maxBodyGroundingIndex; public double lambdaOffset; //public GroundLambda grl; RuleAggNeuron(GroundLambda gl, LiftedTemplate net) { name = gl.toString(net.constantNames); activation = gl.getGeneral().activation; if (Global.getGrounding().equals(Global.groundingSet.avg)) { outputValue = gl.getValueAvg(); } else if (Global.getGrounding().equals(Global.groundingSet.max)){ outputValue = gl.getValue(); } //grl = gl; lambdaOffset = gl.getGeneral().getOffset(); groundParentsCount = gl.getGroundParents(); ruleBodyGroundingsCount = gl.getConjunctsCountForAvg(); if (Global.uncompressedLambda) { ruleBodyGroundings = new AtomNeuron[gl.getConjunctsCountForAvg()][gl.getConjuncts().size()]; sumedInputsOfEachBodyGrounding = new double[gl.getConjunctsCountForAvg()]; if (gl.getConjunctsAvg().isEmpty()) { return; } //TODO check correctness of the uncompressed version HERE for (int j = 0; j < gl.getConjunctsCountForAvg(); j++) { List<GroundKappa> oneBodyGrounding = gl.fullBodyGroundings.get(j); ruleBodyGroundings[j] = new AtomNeuron[oneBodyGrounding.size()]; for (int k = 0; k < oneBodyGrounding.size(); k++) { GroundNeuron gn = net.neuronMapping.get(oneBodyGrounding.get(k)); if (gn == null) { ruleBodyGroundings[j][k] = new AtomNeuron(oneBodyGrounding.get(k), net); net.neuronMapping.put(oneBodyGrounding.get(k), ruleBodyGroundings[j][k]); } else { ruleBodyGroundings[j][k] = (AtomNeuron) gn; } } } } else { int i = 0; inputNeuronsCompressed = new AtomNeuron[gl.getConjunctsAvg().size()]; inputNeuronCompressedCounts = new int[gl.getConjunctsAvg().size()]; if (gl.getConjunctsAvg().isEmpty()) { return; } for (Map.Entry<GroundKappa, Integer> gki : gl.getConjunctsAvg().entrySet()) { GroundNeuron gn = net.neuronMapping.get(gki.getKey()); if (gn == null) { inputNeuronsCompressed[i] = new AtomNeuron(gki.getKey(), net); net.neuronMapping.put(gki.getKey(), inputNeuronsCompressed[i]); } else { inputNeuronsCompressed[i] = (AtomNeuron) gn; } inputNeuronCompressedCounts[i++] = gki.getValue(); } } net.tmpActiveNet.addNeuron(this); //rather put these "this" on the end of contructor } }
[ "wmatex@gmail.com" ]
wmatex@gmail.com
b35155eb3aac79591299c40ce882f2de17e58bf6
02adb6cf5c4a55028375cd99e9d9a2b0fd1b8c03
/io/reseau/client/ControleOutReseau.java
efbf7fbea3d22298cf086530e2c828fbbd09fbd1
[ "MIT" ]
permissive
adeprez/Sources-Jeu
0656870d5041bf62b9b03f00ca3cccd4c1496846
646484977569f14c1eb013cd1e6ae1f40f9cc493
refs/heads/master
2020-12-24T13:20:14.388906
2015-09-07T12:46:59
2015-09-07T12:46:59
23,883,632
0
0
null
null
null
null
UTF-8
Java
false
false
2,128
java
package reseau.client; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.HashSet; import java.util.Set; import jeu.EcranJeu; import listeners.ChangeSpecialiteListener; import perso.AbstractPerso; import perso.Perso; import reseau.paquets.jeu.PaquetAction; import specialite.Specialite; import vision.Camera; import controles.ControleActionListener; import controles.TypeAction; public class ControleOutReseau extends MouseAdapter implements ControleActionListener, ChangeSpecialiteListener { private final Set<TypeAction> actifs; private final Client client; private final Camera cam; public ControleOutReseau(Camera cam, Client client) { this.client = client; this.cam = cam; actifs = new HashSet<TypeAction>(); } public void action(TypeAction action, boolean appuie) { client.write(PaquetAction.getPaquet(action, client.getPerso(), appuie)); } public void setSens(MouseEvent e) { Component c = (Component) e.getSource(); Perso p = client.getPerso(); if(!p.enAction()) { boolean droite = c.getWidth()/2 < e.getX(); if(droite != p.estDroite()) p.setDroite(droite); } p.setAngle(EcranJeu.getAngle(cam, p, e.getX(), e.getY(), p.estDroite())); } @Override public void appuie(TypeAction action) { actifs.add(action); action(action, true); } @Override public void relache(TypeAction action) { actifs.remove(action); if(action.aFin()) action(action, false); if(!actifs.isEmpty()) appuie(actifs.iterator().next()); } @Override public void changeSpecialite(AbstractPerso perso, Specialite ancienne, Specialite nouvelle) { if(nouvelle != ancienne) client.write(PaquetAction.getPaquet(TypeAction.CHANGER_ARME, client.getPerso(), false) .addBytePositif(nouvelle.getType().ordinal())); } @Override public void mouseReleased(MouseEvent e) { setSens(e); action(TypeAction.ATTAQUER, false); if(!actifs.isEmpty()) appuie(actifs.iterator().next()); } }
[ "deprez.alexis@laposte.net" ]
deprez.alexis@laposte.net
07c9eb13c90bcc7caed9d9095a84304dc169945f
125f147787ec146d83234eef2a25776f0535b835
/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/bluetooth/IBluetoothHeadset.java
4e7416bc798adc56ca0d2f0b0160fa164966e12a
[]
no_license
team-miracle/android-7.1.1_r13_apps-lib
f9230d7c11d3c1d426d3412d275057be0ae6d1f7
9b978d982de9c87c7ee23806212e11785d12bddd
refs/heads/master
2021-01-09T05:47:54.721201
2019-05-09T05:36:23
2019-05-09T05:36:23
80,803,682
0
1
null
null
null
null
UTF-8
Java
false
false
30,962
java
/* * This file is auto-generated. DO NOT MODIFY. * Original file: frameworks/base/core/java/android/bluetooth/IBluetoothHeadset.aidl */ package android.bluetooth; /** * API for Bluetooth Headset service * * {@hide} */ public interface IBluetoothHeadset extends android.os.IInterface { /** Local-side IPC implementation stub class. */ public static abstract class Stub extends android.os.Binder implements android.bluetooth.IBluetoothHeadset { private static final java.lang.String DESCRIPTOR = "android.bluetooth.IBluetoothHeadset"; /** Construct the stub at attach it to the interface. */ public Stub() { this.attachInterface(this, DESCRIPTOR); } /** * Cast an IBinder object into an android.bluetooth.IBluetoothHeadset interface, * generating a proxy if needed. */ public static android.bluetooth.IBluetoothHeadset asInterface(android.os.IBinder obj) { if ((obj==null)) { return null; } android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (((iin!=null)&&(iin instanceof android.bluetooth.IBluetoothHeadset))) { return ((android.bluetooth.IBluetoothHeadset)iin); } return new android.bluetooth.IBluetoothHeadset.Stub.Proxy(obj); } @Override public android.os.IBinder asBinder() { return this; } @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException { switch (code) { case INTERFACE_TRANSACTION: { reply.writeString(DESCRIPTOR); return true; } case TRANSACTION_connect: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.connect(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_disconnect: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.disconnect(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_getConnectedDevices: { data.enforceInterface(DESCRIPTOR); java.util.List<android.bluetooth.BluetoothDevice> _result = this.getConnectedDevices(); reply.writeNoException(); reply.writeTypedList(_result); return true; } case TRANSACTION_getDevicesMatchingConnectionStates: { data.enforceInterface(DESCRIPTOR); int[] _arg0; _arg0 = data.createIntArray(); java.util.List<android.bluetooth.BluetoothDevice> _result = this.getDevicesMatchingConnectionStates(_arg0); reply.writeNoException(); reply.writeTypedList(_result); return true; } case TRANSACTION_getConnectionState: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } int _result = this.getConnectionState(_arg0); reply.writeNoException(); reply.writeInt(_result); return true; } case TRANSACTION_setPriority: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } int _arg1; _arg1 = data.readInt(); boolean _result = this.setPriority(_arg0, _arg1); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_getPriority: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } int _result = this.getPriority(_arg0); reply.writeNoException(); reply.writeInt(_result); return true; } case TRANSACTION_startVoiceRecognition: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.startVoiceRecognition(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_stopVoiceRecognition: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.stopVoiceRecognition(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_isAudioConnected: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.isAudioConnected(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_sendVendorSpecificResultCode: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } java.lang.String _arg1; _arg1 = data.readString(); java.lang.String _arg2; _arg2 = data.readString(); boolean _result = this.sendVendorSpecificResultCode(_arg0, _arg1, _arg2); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_getBatteryUsageHint: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } int _result = this.getBatteryUsageHint(_arg0); reply.writeNoException(); reply.writeInt(_result); return true; } case TRANSACTION_acceptIncomingConnect: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.acceptIncomingConnect(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_rejectIncomingConnect: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.rejectIncomingConnect(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_getAudioState: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } int _result = this.getAudioState(_arg0); reply.writeNoException(); reply.writeInt(_result); return true; } case TRANSACTION_isAudioOn: { data.enforceInterface(DESCRIPTOR); boolean _result = this.isAudioOn(); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_connectAudio: { data.enforceInterface(DESCRIPTOR); boolean _result = this.connectAudio(); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_disconnectAudio: { data.enforceInterface(DESCRIPTOR); boolean _result = this.disconnectAudio(); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_setAudioRouteAllowed: { data.enforceInterface(DESCRIPTOR); boolean _arg0; _arg0 = (0!=data.readInt()); this.setAudioRouteAllowed(_arg0); reply.writeNoException(); return true; } case TRANSACTION_getAudioRouteAllowed: { data.enforceInterface(DESCRIPTOR); boolean _result = this.getAudioRouteAllowed(); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_startScoUsingVirtualVoiceCall: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.startScoUsingVirtualVoiceCall(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_stopScoUsingVirtualVoiceCall: { data.enforceInterface(DESCRIPTOR); android.bluetooth.BluetoothDevice _arg0; if ((0!=data.readInt())) { _arg0 = android.bluetooth.BluetoothDevice.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result = this.stopScoUsingVirtualVoiceCall(_arg0); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_phoneStateChanged: { data.enforceInterface(DESCRIPTOR); int _arg0; _arg0 = data.readInt(); int _arg1; _arg1 = data.readInt(); int _arg2; _arg2 = data.readInt(); java.lang.String _arg3; _arg3 = data.readString(); int _arg4; _arg4 = data.readInt(); this.phoneStateChanged(_arg0, _arg1, _arg2, _arg3, _arg4); reply.writeNoException(); return true; } case TRANSACTION_clccResponse: { data.enforceInterface(DESCRIPTOR); int _arg0; _arg0 = data.readInt(); int _arg1; _arg1 = data.readInt(); int _arg2; _arg2 = data.readInt(); int _arg3; _arg3 = data.readInt(); boolean _arg4; _arg4 = (0!=data.readInt()); java.lang.String _arg5; _arg5 = data.readString(); int _arg6; _arg6 = data.readInt(); this.clccResponse(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6); reply.writeNoException(); return true; } case TRANSACTION_enableWBS: { data.enforceInterface(DESCRIPTOR); boolean _result = this.enableWBS(); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_disableWBS: { data.enforceInterface(DESCRIPTOR); boolean _result = this.disableWBS(); reply.writeNoException(); reply.writeInt(((_result)?(1):(0))); return true; } case TRANSACTION_bindResponse: { data.enforceInterface(DESCRIPTOR); int _arg0; _arg0 = data.readInt(); boolean _arg1; _arg1 = (0!=data.readInt()); this.bindResponse(_arg0, _arg1); reply.writeNoException(); return true; } } return super.onTransact(code, data, reply, flags); } private static class Proxy implements android.bluetooth.IBluetoothHeadset { private android.os.IBinder mRemote; Proxy(android.os.IBinder remote) { mRemote = remote; } @Override public android.os.IBinder asBinder() { return mRemote; } public java.lang.String getInterfaceDescriptor() { return DESCRIPTOR; } // Public API @Override public boolean connect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_connect, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean disconnect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_disconnect, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); java.util.List<android.bluetooth.BluetoothDevice> _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_getConnectedDevices, _data, _reply, 0); _reply.readException(); _result = _reply.createTypedArrayList(android.bluetooth.BluetoothDevice.CREATOR); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); java.util.List<android.bluetooth.BluetoothDevice> _result; try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeIntArray(states); mRemote.transact(Stub.TRANSACTION_getDevicesMatchingConnectionStates, _data, _reply, 0); _reply.readException(); _result = _reply.createTypedArrayList(android.bluetooth.BluetoothDevice.CREATOR); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public int getConnectionState(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); int _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_getConnectionState, _data, _reply, 0); _reply.readException(); _result = _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean setPriority(android.bluetooth.BluetoothDevice device, int priority) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } _data.writeInt(priority); mRemote.transact(Stub.TRANSACTION_setPriority, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public int getPriority(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); int _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_getPriority, _data, _reply, 0); _reply.readException(); _result = _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean startVoiceRecognition(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_startVoiceRecognition, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean stopVoiceRecognition(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_stopVoiceRecognition, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean isAudioConnected(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_isAudioConnected, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean sendVendorSpecificResultCode(android.bluetooth.BluetoothDevice device, java.lang.String command, java.lang.String arg) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } _data.writeString(command); _data.writeString(arg); mRemote.transact(Stub.TRANSACTION_sendVendorSpecificResultCode, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public int getBatteryUsageHint(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); int _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_getBatteryUsageHint, _data, _reply, 0); _reply.readException(); _result = _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } return _result; } // Internal functions, not be made public @Override public boolean acceptIncomingConnect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_acceptIncomingConnect, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean rejectIncomingConnect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_rejectIncomingConnect, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public int getAudioState(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); int _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_getAudioState, _data, _reply, 0); _reply.readException(); _result = _reply.readInt(); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean isAudioOn() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_isAudioOn, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean connectAudio() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_connectAudio, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean disconnectAudio() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_disconnectAudio, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public void setAudioRouteAllowed(boolean allowed) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(((allowed)?(1):(0))); mRemote.transact(Stub.TRANSACTION_setAudioRouteAllowed, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } @Override public boolean getAudioRouteAllowed() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_getAudioRouteAllowed, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean startScoUsingVirtualVoiceCall(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_startScoUsingVirtualVoiceCall, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean stopScoUsingVirtualVoiceCall(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); if ((device!=null)) { _data.writeInt(1); device.writeToParcel(_data, 0); } else { _data.writeInt(0); } mRemote.transact(Stub.TRANSACTION_stopScoUsingVirtualVoiceCall, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public void phoneStateChanged(int numActive, int numHeld, int callState, java.lang.String number, int type) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(numActive); _data.writeInt(numHeld); _data.writeInt(callState); _data.writeString(number); _data.writeInt(type); mRemote.transact(Stub.TRANSACTION_phoneStateChanged, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } @Override public void clccResponse(int index, int direction, int status, int mode, boolean mpty, java.lang.String number, int type) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(index); _data.writeInt(direction); _data.writeInt(status); _data.writeInt(mode); _data.writeInt(((mpty)?(1):(0))); _data.writeString(number); _data.writeInt(type); mRemote.transact(Stub.TRANSACTION_clccResponse, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } @Override public boolean enableWBS() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_enableWBS, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public boolean disableWBS() throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); boolean _result; try { _data.writeInterfaceToken(DESCRIPTOR); mRemote.transact(Stub.TRANSACTION_disableWBS, _data, _reply, 0); _reply.readException(); _result = (0!=_reply.readInt()); } finally { _reply.recycle(); _data.recycle(); } return _result; } @Override public void bindResponse(int ind_id, boolean ind_status) throws android.os.RemoteException { android.os.Parcel _data = android.os.Parcel.obtain(); android.os.Parcel _reply = android.os.Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(ind_id); _data.writeInt(((ind_status)?(1):(0))); mRemote.transact(Stub.TRANSACTION_bindResponse, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } } static final int TRANSACTION_connect = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); static final int TRANSACTION_disconnect = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); static final int TRANSACTION_getConnectedDevices = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2); static final int TRANSACTION_getDevicesMatchingConnectionStates = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3); static final int TRANSACTION_getConnectionState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4); static final int TRANSACTION_setPriority = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5); static final int TRANSACTION_getPriority = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6); static final int TRANSACTION_startVoiceRecognition = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7); static final int TRANSACTION_stopVoiceRecognition = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8); static final int TRANSACTION_isAudioConnected = (android.os.IBinder.FIRST_CALL_TRANSACTION + 9); static final int TRANSACTION_sendVendorSpecificResultCode = (android.os.IBinder.FIRST_CALL_TRANSACTION + 10); static final int TRANSACTION_getBatteryUsageHint = (android.os.IBinder.FIRST_CALL_TRANSACTION + 11); static final int TRANSACTION_acceptIncomingConnect = (android.os.IBinder.FIRST_CALL_TRANSACTION + 12); static final int TRANSACTION_rejectIncomingConnect = (android.os.IBinder.FIRST_CALL_TRANSACTION + 13); static final int TRANSACTION_getAudioState = (android.os.IBinder.FIRST_CALL_TRANSACTION + 14); static final int TRANSACTION_isAudioOn = (android.os.IBinder.FIRST_CALL_TRANSACTION + 15); static final int TRANSACTION_connectAudio = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16); static final int TRANSACTION_disconnectAudio = (android.os.IBinder.FIRST_CALL_TRANSACTION + 17); static final int TRANSACTION_setAudioRouteAllowed = (android.os.IBinder.FIRST_CALL_TRANSACTION + 18); static final int TRANSACTION_getAudioRouteAllowed = (android.os.IBinder.FIRST_CALL_TRANSACTION + 19); static final int TRANSACTION_startScoUsingVirtualVoiceCall = (android.os.IBinder.FIRST_CALL_TRANSACTION + 20); static final int TRANSACTION_stopScoUsingVirtualVoiceCall = (android.os.IBinder.FIRST_CALL_TRANSACTION + 21); static final int TRANSACTION_phoneStateChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 22); static final int TRANSACTION_clccResponse = (android.os.IBinder.FIRST_CALL_TRANSACTION + 23); static final int TRANSACTION_enableWBS = (android.os.IBinder.FIRST_CALL_TRANSACTION + 24); static final int TRANSACTION_disableWBS = (android.os.IBinder.FIRST_CALL_TRANSACTION + 25); static final int TRANSACTION_bindResponse = (android.os.IBinder.FIRST_CALL_TRANSACTION + 26); } // Public API public boolean connect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean disconnect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices() throws android.os.RemoteException; public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) throws android.os.RemoteException; public int getConnectionState(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean setPriority(android.bluetooth.BluetoothDevice device, int priority) throws android.os.RemoteException; public int getPriority(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean startVoiceRecognition(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean stopVoiceRecognition(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean isAudioConnected(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean sendVendorSpecificResultCode(android.bluetooth.BluetoothDevice device, java.lang.String command, java.lang.String arg) throws android.os.RemoteException; public int getBatteryUsageHint(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; // Internal functions, not be made public public boolean acceptIncomingConnect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean rejectIncomingConnect(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public int getAudioState(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean isAudioOn() throws android.os.RemoteException; public boolean connectAudio() throws android.os.RemoteException; public boolean disconnectAudio() throws android.os.RemoteException; public void setAudioRouteAllowed(boolean allowed) throws android.os.RemoteException; public boolean getAudioRouteAllowed() throws android.os.RemoteException; public boolean startScoUsingVirtualVoiceCall(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public boolean stopScoUsingVirtualVoiceCall(android.bluetooth.BluetoothDevice device) throws android.os.RemoteException; public void phoneStateChanged(int numActive, int numHeld, int callState, java.lang.String number, int type) throws android.os.RemoteException; public void clccResponse(int index, int direction, int status, int mode, boolean mpty, java.lang.String number, int type) throws android.os.RemoteException; public boolean enableWBS() throws android.os.RemoteException; public boolean disableWBS() throws android.os.RemoteException; public void bindResponse(int ind_id, boolean ind_status) throws android.os.RemoteException; }
[ "c1john0803@gmail.com" ]
c1john0803@gmail.com
cb061cd7321dbb93f6aa2f84fffe633b44acc7e3
d6b21db31c312ecb0da1b52b955eac1c93c373a9
/JavaSpring_Projects/TicketAdvantage/FinalEventProcessing/src/main/java/com/ticketadvantage/services/batch/FinalScoresBatch.java
98dc94a1cb1de16e26a4fd532b57a21ccc38f05e
[]
no_license
teja0009/Projects
84b366a0d0cb17245422c6e2aad5e65a5f7403ac
70a437a164cef33e42b65162f8b8c3cfaeda008b
refs/heads/master
2023-03-16T10:10:10.529062
2020-03-08T06:22:43
2020-03-08T06:22:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
43,798
java
/** * */ package com.ticketadvantage.services.batch; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Persistence; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; import org.apache.log4j.Logger; import org.springframework.stereotype.Service; import com.ibm.icu.util.Calendar; import com.ibm.icu.util.TimeZone; import com.ticketadvantage.services.dao.AccountEventDAO; import com.ticketadvantage.services.dao.AccountEventDAOImpl; import com.ticketadvantage.services.dao.AccountEventFinalDAO; import com.ticketadvantage.services.dao.AccountEventFinalDAOImpl; import com.ticketadvantage.services.dao.EventsDAO; import com.ticketadvantage.services.dao.EventsDAOImpl; import com.ticketadvantage.services.dao.RecordEventDAO; import com.ticketadvantage.services.dao.RecordEventDAOImpl; import com.ticketadvantage.services.dao.sites.sportsinsights.SportsInsightsSite; import com.ticketadvantage.services.errorhandling.BatchErrorCodes; import com.ticketadvantage.services.errorhandling.BatchErrorMessage; import com.ticketadvantage.services.errorhandling.BatchException; import com.ticketadvantage.services.model.AccountEvent; import com.ticketadvantage.services.model.AccountEventFinal; import com.ticketadvantage.services.model.ClosingLine; import com.ticketadvantage.services.model.EventPackage; import com.ticketadvantage.services.telegram.TelegramBotSender; /** * @author calderson * */ @WebListener @Service public class FinalScoresBatch implements Runnable, ServletContextListener { private static final Logger LOGGER = Logger.getLogger(FinalScoresBatch.class); private static final TimeZone TIMEZONE = TimeZone.getTimeZone("America/New_York"); private final EntityManager entityManager = Persistence.createEntityManagerFactory("entityManager").createEntityManager(); private volatile boolean shutdown = false; private EventsDAO eventDAO; private AccountEventDAO accountEventDAO; private AccountEventFinalDAO accountEventFinalDAO; private RecordEventDAO recordEventDAO; private List<EventPackage> events; private SportsInsightsSite processSite; /** * */ public FinalScoresBatch() { super(); LOGGER.info("Entering FinalScoresBatch()"); // Login to site processSite = new SportsInsightsSite("https://sportsinsights.actionnetwork.com", "mojaxsventures@gmail.com", "Jaxson17"); // Setup HTTP Client with proxy if there is one processSite.setProxy("None"); LOGGER.info("Exiting FinalScoresBatch()"); } /** * @param args */ public static void main(String[] args) { LOGGER.info("Entering main()"); try { final FinalScoresBatch finalScoresBatch = new FinalScoresBatch(); // finalScoresBatch.run(); finalScoresBatch.eventDAO = new EventsDAOImpl(); finalScoresBatch.accountEventDAO = new AccountEventDAOImpl(); finalScoresBatch.recordEventDAO = new RecordEventDAOImpl(); finalScoresBatch.eventDAO.setEntityManager(finalScoresBatch.entityManager); finalScoresBatch.accountEventDAO.setEntityManager(finalScoresBatch.entityManager); finalScoresBatch.recordEventDAO.setEntityManager(finalScoresBatch.entityManager); finalScoresBatch.entityManager.getTransaction().begin(); // Login to site finalScoresBatch.processSite = new SportsInsightsSite("https://sportsinsights.actionnetwork.com/", "mojaxsventures@gmail.com", "Jaxson17"); // Setup HTTP Client with proxy if there is one finalScoresBatch.processSite.setProxy("None"); // Authenticate first finalScoresBatch.processSite.loginToSite("mojaxsventures@gmail.com", "Jaxson17"); finalScoresBatch.proccessFinalScores(); finalScoresBatch.entityManager.getTransaction().commit(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } LOGGER.info("Exiting main()"); } /* * (non-Javadoc) * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) */ @Override public void contextInitialized(ServletContextEvent event) { LOGGER.error("Entering contextInitialized()"); new Thread(this).start(); LOGGER.error("Exiting contextInitialized()"); } /* * (non-Javadoc) * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) */ @Override public void contextDestroyed(ServletContextEvent event) { LOGGER.error("Entering contextDestroyed()"); this.shutdown = true; LOGGER.error("Exiting contextDestroyed()"); } /* * (non-Javadoc) * @see java.lang.Runnable#run() */ @Override public void run() { LOGGER.info("Entering run()"); eventDAO = new EventsDAOImpl(); accountEventDAO = new AccountEventDAOImpl(); accountEventFinalDAO = new AccountEventFinalDAOImpl(); recordEventDAO = new RecordEventDAOImpl(); eventDAO.setEntityManager(entityManager); accountEventDAO.setEntityManager(entityManager); accountEventFinalDAO.setEntityManager(entityManager); recordEventDAO.setEntityManager(entityManager); while (!shutdown) { try { entityManager.getTransaction().begin(); // Authenticate first processSite.loginToSite("mojaxsventures@gmail.com", "Jaxson17"); // Process the final scores proccessFinalScores(); entityManager.getTransaction().commit(); // Check every 15 minutes Thread.sleep(900000); } catch (Throwable t) { LOGGER.error(t.getMessage(), t); entityManager.getTransaction().commit(); } } } /** * */ public void proccessFinalScores() { LOGGER.info("Entering proccessFinalScores()"); try { // All events events = new ArrayList<EventPackage>(processSite.forceGetAllTodayOnEvents()); // Process events doProcess(); } catch (Throwable t) { LOGGER.error("Unexpected exception in proccessFinalScores()", t); } LOGGER.info("Exiting proccessEvents()"); } /** * * @throws BatchException */ private void doProcess() throws BatchException { LOGGER.info("Entering doProcess()"); final List<AccountEvent> accountEvents = accountEventDAO.getOpenAccountEventsForWeek(); LOGGER.debug("accountEvents: " + accountEvents); // Go through all account events to see if they are complete if (accountEvents != null && accountEvents.size() > 0) { LOGGER.debug("accountEvents.size(): " + accountEvents.size()); for (AccountEvent accountEvent : accountEvents) { try { LOGGER.debug("accountEvent.getSport(): " + accountEvent.getSport()); LOGGER.debug("accountEvent.getEventid(): " + accountEvent.getEventid()); if (accountEvent.getEventid() != null && accountEvent.getEventid().intValue() != 0) { // Find the event (if we can) at SportsInsights EventPackage event = findGameEvent(accountEvent); if (accountEvent.getEventid().intValue() == 915 || accountEvent.getEventid().intValue() == 1915) { LOGGER.error("Event: " + event); } if (event != null) { try { // Get the score for this event event = processSite.getScores(accountEvent.getSport(), event.getSportsInsightsEventId(), event); LOGGER.debug("Event: " + event); // Do we have a final? if (event != null && (accountEvent.getSport().contains("lines") && event.getGameIsFinal()) || (accountEvent.getSport().contains("first") && event.getFirstIsFinal()) || (accountEvent.getSport().contains("second") && event.getSecondIsFinal()) || (accountEvent.getSport().contains("third") && event.getThirdIsFinal()) || (accountEvent.getSport().contains("live") && event.getLiveIsFinal())) { // Update event and create event final updateAndCreateEventFinal(accountEvent, event); } else { LOGGER.debug("id: " + accountEvent.getId() + " eventname: " + accountEvent.getEventname() + " eventdatetime: " + accountEvent.getEventdatetime()); LOGGER.debug("game: " + event.getGameIsFinal() + " first: " + event.getFirstIsFinal() + " second: " + event.getSecondIsFinal()); } } catch (Throwable t) { LOGGER.error(t.getMessage(), t); } } else { try { final String eventResult = accountEvent.getEventresult(); if (eventResult == null || eventResult.length() == 0) { accountEvent.setEventresult("PUSH"); setupPushEventResultAmount(accountEvent); TelegramBotSender.sendToTelegram("256820278", "FEP : " + accountEvent.getEventid() + " " + accountEvent.getEventname()); } else { LOGGER.error("AccountEvent: " + accountEvent); } } catch (Throwable be) { LOGGER.warn(be.getMessage(), be); } } } } catch (Throwable t) { LOGGER.error(t.getMessage(), t); } } } LOGGER.info("Exiting doProcess()"); } /** * * @param accountEvent * @return */ private EventPackage findGameEvent(AccountEvent accountEvent) { LOGGER.info("Entering findGameEvent()"); LOGGER.debug("accountEvent.getSport(): " + accountEvent.getSport()); LOGGER.debug("accountEvent.getEventid().intValue(): " + accountEvent.getEventid().intValue()); EventPackage eventPackage = null; for (EventPackage ep : events) { Integer rotation1 = Integer.parseInt(ep.getTeamone().getEventid()); Integer rotation2 = Integer.parseInt(ep.getTeamtwo().getEventid()); final Date aeDate = accountEvent.getEventdatetime(); final Date epDate = ep.getEventdatetime(); final Calendar aeCalendar = Calendar.getInstance(); aeCalendar.setTimeZone(FinalScoresBatch.TIMEZONE); aeCalendar.setTime(aeDate); final Calendar epCalendar = Calendar.getInstance(); epCalendar.setTimeZone(FinalScoresBatch.TIMEZONE); epCalendar.setTime(epDate); int aeday = aeCalendar.get(Calendar.DAY_OF_MONTH); int epday = epCalendar.get(Calendar.DAY_OF_MONTH); int aemonth = aeCalendar.get(Calendar.MONTH); int epmonth = epCalendar.get(Calendar.MONTH); int aeyear = aeCalendar.get(Calendar.YEAR); int epyear = epCalendar.get(Calendar.YEAR); // Check for the correct date if (aemonth == epmonth && aeday == epday && aeyear == epyear) { if (accountEvent.getSport().contains("line")) { if (accountEvent.getEventid().intValue() == rotation1.intValue() || accountEvent.getEventid().intValue() == rotation2.intValue()) { eventPackage = ep; break; } } else if (accountEvent.getSport().contains("first")) { rotation1 = rotation1 + 1000; rotation2 = rotation2 + 1000; if (accountEvent.getEventid().intValue() == rotation1.intValue() || accountEvent.getEventid().intValue() == rotation2.intValue()) { eventPackage = ep; break; } } else if (accountEvent.getSport().contains("second")) { rotation1 = rotation1 + 2000; rotation2 = rotation2 + 2000; if (accountEvent.getEventid().intValue() == rotation1.intValue() || accountEvent.getEventid().intValue() == rotation2.intValue()) { eventPackage = ep; break; } } else if (accountEvent.getSport().contains("third")) { rotation1 = rotation1 + 3000; rotation2 = rotation2 + 3000; if (accountEvent.getEventid().intValue() == rotation1.intValue() || accountEvent.getEventid().intValue() == rotation2.intValue()) { eventPackage = ep; break; } } } } LOGGER.info("Exiting findGameEvent()"); return eventPackage; } /** * * @param accountEvent * @param event * @throws BatchException */ private void updateAndCreateEventFinal(AccountEvent accountEvent, EventPackage event) throws BatchException { LOGGER.info("Entering updateAndCreateEventFinal()"); updateAccountEventResult(accountEvent, event); final String outcome = accountEvent.getEventresult(); createAccountEventFinal(accountEvent, event, outcome.equals("WIN")); LOGGER.info("Exiting updateAndCreateEventFinal()"); } /** * * @param accountEvent * @param event */ private void updateAccountEventResult(AccountEvent accountEvent, EventPackage event) { LOGGER.info("Entering updateAccountEventResult()"); LOGGER.debug("AccountEvent: " + accountEvent); LOGGER.debug("EventPackage: " + event); String result = ""; int type = 0; // Spread? if (accountEvent.getSpreadid() != null && accountEvent.getSpreadid() != 0) { type = 1; if (accountEvent.getSport().contains("lines")) { result = determineSpreadLineResult(event.getTeamone().getGameScore(), event.getTeamtwo().getGameScore(), accountEvent, event); } else if (accountEvent.getSport().contains("first")) { result = determineSpreadLineResult(event.getTeamone().getFirstScore(), event.getTeamtwo().getFirstScore(), accountEvent, event); } else if (accountEvent.getSport().contains("second")) { result = determineSpreadLineResult(event.getTeamone().getSecondScore(), event.getTeamtwo().getSecondScore(), accountEvent, event); } else if (accountEvent.getSport().contains("third")) { result = determineSpreadLineResult(event.getTeamone().getThirdScore(), event.getTeamtwo().getThirdScore(), accountEvent, event); } else if (accountEvent.getSport().contains("live")) { result = determineSpreadLineResult(event.getTeamone().getLiveScore(), event.getTeamtwo().getLiveScore(), accountEvent, event); } // Total? } else if (accountEvent.getTotalid() != null && accountEvent.getTotalid() != 0) { type = 2; if (accountEvent.getSport().contains("lines")) { result = determineTotalResult(event.getTeamone().getGameScore(), event.getTeamtwo().getGameScore(), accountEvent, event); } else if (accountEvent.getSport().contains("first")) { result = determineTotalResult(event.getTeamone().getFirstScore(), event.getTeamtwo().getFirstScore(), accountEvent, event); } else if (accountEvent.getSport().contains("second")) { result = determineTotalResult(event.getTeamone().getSecondScore(), event.getTeamtwo().getSecondScore(), accountEvent, event); } else if (accountEvent.getSport().contains("third")) { result = determineTotalResult(event.getTeamone().getThirdScore(), event.getTeamtwo().getThirdScore(), accountEvent, event); } else if (accountEvent.getSport().contains("live")) { result = determineTotalResult(event.getTeamone().getLiveScore(), event.getTeamtwo().getLiveScore(), accountEvent, event); } // Money Line? } else if (accountEvent.getMlid() != null && accountEvent.getMlid().intValue() != 0) { type = 3; if (accountEvent.getSport().contains("lines")) { result = determineMlResult(event.getTeamone().getGameScore(), event.getTeamtwo().getGameScore(), accountEvent, event); } else if (accountEvent.getSport().contains("first")) { result = determineMlResult(event.getTeamone().getFirstScore(), event.getTeamtwo().getFirstScore(), accountEvent, event); } else if (accountEvent.getSport().contains("second")) { result = determineMlResult(event.getTeamone().getSecondScore(), event.getTeamtwo().getSecondScore(), accountEvent, event); } else if (accountEvent.getSport().contains("third")) { result = determineMlResult(event.getTeamone().getThirdScore(), event.getTeamtwo().getThirdScore(), accountEvent, event); } else if (accountEvent.getSport().contains("live")) { result = determineMlResult(event.getTeamone().getLiveScore(), event.getTeamtwo().getLiveScore(), accountEvent, event); } } LOGGER.debug("type: " + type); // Update the account event with the result accountEvent.setEventresult(result); // Is this a WIN? if (result.equals("WIN")) { final Float actualAmount = Float.parseFloat(accountEvent.getActualamount()); if (type == 1) { // Spread final Float juice = accountEvent.getSpreadjuice(); setupWinEventResultAmount(juice, actualAmount, accountEvent); } else if (type == 2) { // Total final Float juice = accountEvent.getTotaljuice(); setupWinEventResultAmount(juice, actualAmount, accountEvent); } else if (type == 3) { // ML final Float juice = accountEvent.getMljuice(); setupWinEventResultAmount(juice, actualAmount, accountEvent); } else { LOGGER.warn("unknown type"); } } else if (result.equals("LOSS")) { // LOSS? final Float actualAmount = Float.parseFloat(accountEvent.getActualamount()); if (type == 1) { // Spread final Float juice = accountEvent.getSpreadjuice(); setupLossEventResultAmount(juice, actualAmount, accountEvent); } else if (type == 2) { // Total final Float juice = accountEvent.getTotaljuice(); setupLossEventResultAmount(juice, actualAmount, accountEvent); } else if (type == 3) { // ML final Float juice = accountEvent.getMljuice(); setupLossEventResultAmount(juice, actualAmount, accountEvent); } else { LOGGER.warn("unknown type"); } } else if (result.equals("PUSH")) { // PUSH? setupPushEventResultAmount(accountEvent); } entityManager.persist(accountEvent); entityManager.flush(); LOGGER.info("Exiting updateAccountEventResult()"); } /** * * @param juice * @param actualAmount * @param accountEvent */ private void setupWinEventResultAmount(Float juice, Float actualAmount, AccountEvent accountEvent) { LOGGER.info("Entering setupWinEventResultAmount()"); LOGGER.debug("juice: " + juice); LOGGER.debug("actualAmount: " + actualAmount); final DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(2); String eventAmount = ""; // Check for special moneyline case if (accountEvent.getType().equals("ml")) { eventAmount = df.format(actualAmount); } else { if (juice > 0) { eventAmount = df.format(actualAmount * (juice/100)); } else { eventAmount = df.format(actualAmount); } } // Get rid of any , eventAmount = eventAmount.replace(",", ""); // Now set it up as a Float accountEvent.setEventresultamount(Float.parseFloat(eventAmount)); LOGGER.info("Exiting setupWinEventResultAmount()"); } /** * * @param juice * @param actualAmount * @param accountEvent */ private void setupLossEventResultAmount(Float juice, Float actualAmount, AccountEvent accountEvent) { LOGGER.info("Entering setupLossEventResultAmount()"); LOGGER.debug("juice: " + juice); LOGGER.debug("actualAmount: " + actualAmount); final DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(2); String eventAmount = ""; if (juice > 0) { eventAmount = df.format(actualAmount * -1); eventAmount = eventAmount.replace(",", ""); } else { eventAmount = df.format(actualAmount * (juice/100)); eventAmount = eventAmount.replace(",", ""); } // Now set it up as a Float accountEvent.setEventresultamount(Float.parseFloat(eventAmount)); LOGGER.info("Exiting setupLossEventResultAmount()"); } /** * * @param accountEvent */ private void setupPushEventResultAmount(AccountEvent accountEvent) { LOGGER.info("Entering setupPushEventResultAmount()"); final DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(2); final String eventAmount = df.format(new Double(0.00)); // Now set it up as a Float accountEvent.setEventresultamount(Float.parseFloat(eventAmount)); LOGGER.info("Exiting setupPushEventResultAmount()"); } /** * * @param accountEvent * @param event * @param outcomeWin */ private void createAccountEventFinal(AccountEvent accountEvent, EventPackage event, Boolean outcomeWin) throws BatchException { LOGGER.info("Entering updateAccountEventFinal()"); LOGGER.debug("AccountEvent: " + accountEvent); LOGGER.debug("EventPackage: " + event); LOGGER.debug("outcomeWin: " + outcomeWin); // Setup account event finals AccountEventFinal accountEventFinal = new AccountEventFinal(); accountEventFinal.setAccounteventid(accountEvent.getId()); // --- lineType = 1 = Spread // --- lineType = 2 = ML // --- lineType = 3 = Total final Integer gameTypeId = getGameTypeId(accountEvent); final Integer sportId = getSportId(accountEvent); final Integer teamBet = teamBetOn(accountEvent, event); if (teamBet == null) { String aeString = accountEvent.toString(); if (aeString.length() > 4000) { aeString = aeString.substring(0, 4000); } throw new BatchException(BatchErrorCodes.TEAM_BET_ON_EXCEPTION, BatchErrorMessage.TEAM_BET_ON_EXCEPTION, aeString); } // Setup the closing line final ClosingLine spreadClosingLine = processSite.getClosingLine(event.getSportsInsightsEventId(), 1, gameTypeId, sportId); final ClosingLine mlClosingLine = processSite.getClosingLine(event.getSportsInsightsEventId(), 2, gameTypeId, sportId); final ClosingLine totalClosingLine = processSite.getClosingLine(event.getSportsInsightsEventId(), 3, gameTypeId, sportId); LOGGER.debug("spreadClosingLine: " + spreadClosingLine); LOGGER.debug("mlClosingLine: " + mlClosingLine); LOGGER.debug("totalClosingLine: " + totalClosingLine); accountEventFinal.setRotation1(event.getTeamone().getId().toString()); accountEventFinal.setRotation2(event.getTeamtwo().getId().toString()); accountEventFinal.setRotation1team(event.getTeamone().getTeam()); accountEventFinal.setRotation2team(event.getTeamtwo().getTeam()); // Check what type of game it is if (accountEvent.getSport().contains("lines")) { if (event.getTeamone().getGameScore() != null && event.getTeamtwo().getGameScore() != null) { accountEventFinal.setRotation1score(event.getTeamone().getGameScore().toString()); accountEventFinal.setRotation2score(event.getTeamtwo().getGameScore().toString()); } } else if (accountEvent.getSport().contains("first")) { if (event.getTeamone().getFirstScore() != null && event.getTeamtwo().getFirstScore() != null) { accountEventFinal.setRotation1score(event.getTeamone().getFirstScore().toString()); accountEventFinal.setRotation2score(event.getTeamtwo().getFirstScore().toString()); } } else if (accountEvent.getSport().contains("second")) { if (event.getTeamone().getSecondScore() != null && event.getTeamtwo().getSecondScore() != null) { accountEventFinal.setRotation1score(event.getTeamone().getSecondScore().toString()); accountEventFinal.setRotation2score(event.getTeamtwo().getSecondScore().toString()); } } else if (accountEvent.getSport().contains("third")) { if (event.getTeamone().getThirdScore() != null && event.getTeamtwo().getThirdScore() != null) { accountEventFinal.setRotation1score(event.getTeamone().getThirdScore().toString()); accountEventFinal.setRotation2score(event.getTeamtwo().getThirdScore().toString()); } } else if (accountEvent.getSport().contains("live")) { if (event.getTeamone().getLiveScore() != null && event.getTeamtwo().getLiveScore() != null) { accountEventFinal.setRotation1score(event.getTeamone().getLiveScore().toString()); accountEventFinal.setRotation2score(event.getTeamtwo().getLiveScore().toString()); } } // Setup outcome win accountEventFinal.setOutcomewin(outcomeWin); // --- If user bet on Team 1 he/she bet on the Visiting team // --- If user bet on Team 2 he/she bet on the Home team Boolean homeTeamFavored = null; if (spreadClosingLine != null) { if (spreadClosingLine.getHomeTeamFavored() != null) { homeTeamFavored = spreadClosingLine.getHomeTeamFavored(); } // --- Figure out the spread indicator (either "-" or "+") // --- Favored team is always the "-" String spreadIndicator = ""; String spreadClosingLineStr = spreadClosingLine.getLine().toString(); String spreadJuiceStr = ""; String spreadJuiceIndicator = ""; // --- See if the user bet on the favored team and adjust the spreadIndicator if necessary if (teamBet == 1 && !homeTeamFavored) { // --- User bet on Visiting team and Visiting team was favored spreadIndicator = "-"; String money = spreadClosingLine.getMoney1().toString(); if (money.startsWith("-")) { spreadJuiceIndicator = "-"; } else { spreadJuiceIndicator = "+"; } spreadJuiceStr = spreadClosingLine.getMoney1().toString(); // --- User bet on visiting team which is stored in Money1 } else if (teamBet == 2 && homeTeamFavored) { spreadIndicator = "-"; // --- User bet on Home team and Home team was favored String money = spreadClosingLine.getMoney2().toString(); if (money.startsWith("-")) { spreadJuiceIndicator = "-"; } else { spreadJuiceIndicator = "+"; } spreadJuiceStr = spreadClosingLine.getMoney2().toString(); // --- User bet on home team which is stored in Money2 } else if (teamBet == 1 && homeTeamFavored) { spreadIndicator = "+"; // --- User bet on Visiting team and Visiting team was NOT favored String money = spreadClosingLine.getMoney1().toString(); if (money.startsWith("-")) { spreadJuiceIndicator = "-"; } else { spreadJuiceIndicator = "+"; } spreadJuiceStr = spreadClosingLine.getMoney1().toString(); // --- User bet on visiting team which is stored in Money1 } else { spreadIndicator = "+"; // --- User bet on Home team and Home team was NOT favored String money = spreadClosingLine.getMoney2().toString(); if (money.startsWith("-")) { spreadJuiceIndicator = "-"; } else { spreadJuiceIndicator = "+"; } spreadJuiceStr = spreadClosingLine.getMoney2().toString(); // --- User bet on home team which is stored in Money2 } LOGGER.debug("spreadClosingLineStr: " + spreadClosingLineStr); accountEventFinal.setSpreadindicator(spreadIndicator); if (spreadClosingLineStr != null && spreadClosingLineStr.length() > 0) { accountEventFinal.setSpreadnumber(Float.parseFloat(spreadClosingLineStr)); } accountEventFinal.setSpreadjuiceindicator(spreadJuiceIndicator); if (spreadJuiceStr != null && spreadJuiceStr.length() > 0) { accountEventFinal.setSpreadjuicenumber(Float.parseFloat(spreadJuiceStr)); } } if (totalClosingLine != null) { // --- Figure out the total indicator (either "o" or "u") String totalJuiceStr = ""; String totalJuiceIndicator = ""; String totalClosingLineStr = totalClosingLine.getLine().toString(); LOGGER.debug("totalClosingLineStr: " + totalClosingLineStr); accountEventFinal.setTotalindicator(accountEvent.getTotalindicator()); if (totalClosingLineStr != null && totalClosingLineStr.length() > 0) { accountEventFinal.setTotalnumber(Float.parseFloat(totalClosingLineStr)); } // --- See if the user bet on the favored team and adjust the spreadIndicator if necessary if (teamBet == 1) { // --- User bet on Visiting team totalJuiceStr = totalClosingLine.getMoney1().toString(); // --- User bet on visiting team which is stored in Money1 String money = totalClosingLine.getMoney1().toString(); if (money.startsWith("-")) { totalJuiceIndicator = "-"; } else { totalJuiceIndicator = "+"; } } else { totalJuiceStr = totalClosingLine.getMoney2().toString(); // --- User bet on home team which is stored in Money2 String money = totalClosingLine.getMoney2().toString(); if (money.startsWith("-")) { totalJuiceIndicator = "-"; } else { totalJuiceIndicator = "+"; } } // Setup total juice accountEventFinal.setTotaljuiceindicator(totalJuiceIndicator); if (totalJuiceStr != null && totalJuiceStr.length() > 0) { accountEventFinal.setTotaljuicenumber(Float.parseFloat(totalJuiceStr)); } } if (mlClosingLine != null) { String mlJuiceIndicator = ""; String mlJuiceStr = ""; if (teamBet == 1) { if (mlClosingLine != null && mlClosingLine.getMoney1() != null) { // --- User bet on Visiting team mlJuiceStr = mlClosingLine.getMoney1().toString(); // --- User bet on visiting team which is stored in Money1 String money = mlClosingLine.getMoney1().toString(); if (money.startsWith("-")) { mlJuiceIndicator = "-"; } else { mlJuiceIndicator = "+"; } } } else { if (mlClosingLine != null && mlClosingLine.getMoney2() != null) { mlJuiceStr = mlClosingLine.getMoney2().toString(); // --- User bet on home team which is stored in Money2 String money = mlClosingLine.getMoney2().toString(); if (money.startsWith("-")) { mlJuiceIndicator = "-"; } else { mlJuiceIndicator = "+"; } } } accountEventFinal.setMlindicator(mlJuiceIndicator); if (mlJuiceStr != null && mlJuiceStr.length() > 0) { accountEventFinal.setMlnumber(Float.parseFloat(mlJuiceStr)); } } this.accountEventFinalDAO.persist(accountEventFinal); entityManager.persist(accountEventFinal); entityManager.flush(); LOGGER.info("Exiting updateAccountEventFinal()"); } /** * * @param team1Score * @param team2Score * @param accountEvent * @param event * @return */ private String determineSpreadLineResult(Integer team1Score, Integer team2Score, AccountEvent accountEvent, EventPackage event) { LOGGER.info("Entering determineSpreadLineResult()"); LOGGER.debug("team1Score: " + team1Score); LOGGER.debug("team2Score: " + team2Score); LOGGER.debug("AccountEvent: " + accountEvent); LOGGER.debug("EventPackage: " + event); String result = ""; Integer winningTeam = new Integer(0); Boolean gameTied = false; Integer actualSpread = 0; Float spreadBet = null; String spreadIndicator = null; Integer teamBet = null; try { // --- Check to see if the game ended in a tie if (team1Score == team2Score) { gameTied = true; } // --- As long as the game didn't end in a tie, figure out which team won and then figure out the actual spread of the game if (!gameTied) { if (team1Score > team2Score) { winningTeam = 1; } else { winningTeam = 2; } if (winningTeam == 1) { LOGGER.debug("team1Score: " + team1Score); LOGGER.debug("team2Score: " + team2Score); actualSpread = (team1Score - team2Score); LOGGER.debug("actualSpread: " + actualSpread); } else { LOGGER.debug("team1Score: " + team1Score); LOGGER.debug("team2Score: " + team2Score); actualSpread = (team2Score - team1Score); LOGGER.debug("actualSpread: " + actualSpread); } } spreadBet = accountEvent.getSpread(); spreadIndicator = accountEvent.getSpreadindicator(); teamBet = teamBetOn(accountEvent, event); LOGGER.debug("actualSpread: " + actualSpread); LOGGER.debug("spreadBet: " + spreadBet); LOGGER.debug("spreadIndicator: " + spreadIndicator); LOGGER.debug("teamBet: " + teamBet); if ((teamBet == 1) && (gameTied) && (spreadIndicator.equals("+")) && ((actualSpread + spreadBet) == 0 )) { // --- User BET on Team 1 // --- AND the game tied // --- AND it was a pk (+0) result = "PUSH"; } else if ((teamBet == 2) && (gameTied) && (spreadIndicator.equals("+")) && ((actualSpread + spreadBet) == 0 )) { // --- User BET on Team 2 // --- AND the game tied // --- AND it was a pk (+0) result = "PUSH"; } else if ((teamBet == 1) && (winningTeam == 1) && (spreadIndicator.equals("-")) && ((actualSpread + spreadBet) > 0 )) { // --- User BET on Team 1 // --- AND Team 1 WON // --- AND Team 1 was FAVORDED (spreadIndicator = "-") // --- AND the actual spread of the game PLUS the spread that was bet is a POSITIVE number // --- means the user COVERED the spread then the user WINS result = "WIN"; } else if ((teamBet == 1) && (winningTeam == 1 || gameTied) && (spreadIndicator.equals("+"))) { // --- User BET on Team 1 // --- AND Team 1 WON // --- AND Team 1 was NOT FAVORED (spreadIndicator = "+") // --- means the user COVERED the spread then the user WINS result = "WIN"; } else if ((teamBet == 1) && (winningTeam == 2) && (spreadIndicator.equals("+")) && ((actualSpread - spreadBet) < 0 )) { // --- User BET on Team 1 // --- AND Team 1 LOST // --- AND Team 1 was NOT FAVORED (spreadIndicator = "+") // --- AND the actual spread of the game MINUS the spread that was bet is a NEGATIVE number // --- EX: User bets KC +6 and KC loses by 5 (actual spread = 5 minus the spread bet of +6 = -1) // --- means the user COVERED the spread then the user WINS result = "WIN"; } else if ((teamBet == 1) && (winningTeam == 2) && (spreadIndicator.equals("+")) && ((actualSpread - spreadBet) > 0 )) { // --- User BET on Team 1 // --- AND Team 1 LOST // --- AND Team 1 was NOT FAVORED (spreadIndicator = "+") // --- AND the actual spread of the game MINUS the spread that was bet is a NEGATIVE number // --- EX: User bets KC +6 and KC loses by 14 (actual spread = 14 minus the spread bet of +6 = 8) // --- means the user COVERED the spread then the user LOSES result = "LOSS"; } else if ((teamBet == 1) && (winningTeam == 1) && (spreadIndicator.equals("-")) && ((actualSpread + spreadBet) < 0 )) { // --- User BET on Team 1 // --- AND Team 1 WON // --- AND Team 1 was FAVORED (spreadIndicator = "-") // --- AND the actual spread of the game PLUS the spread that was bet is a NEGATIVE number // --- EX: User bets KC -6 and KC wins by 5 (actual spread = 5 plus the spread bet of -6 = -1) // --- means the user DID NOT COVER the spread then the user LOSES result = "LOSS"; } else if ((teamBet == 1) && (winningTeam == 2 || gameTied) && (spreadIndicator.equals("-"))) { // --- User BET on Team 1 // --- AND Team 1 LOST // --- AND Team 1 was FAVORED (spreadIndicator = "-") // --- means the user DID NOT COVER the spread then the user LOSES result = "LOSS"; } else if ((teamBet == 2) && (winningTeam == 2) && (spreadIndicator.equals("-")) && ((actualSpread + spreadBet) > 0 )) { // --- User BET on Team 2 // --- AND Team 2 WON // --- AND Team 2 was FAVORDED (spreadIndicator = "-") // --- AND the actual spread of the game PLUS the spread that was bet is a POSITIVE number // --- means the user COVERED the spread then the user WINS result = "WIN"; } else if ((teamBet == 2) && (winningTeam == 2 || gameTied) && (spreadIndicator.equals("+"))) { // --- User BET on Team 2 // --- AND Team 2 WON // --- AND Team 2 was NOT FAVORED (spreadIndicator = "+") // --- means the user COVERED the spread then the user WINS result = "WIN"; } else if ((teamBet == 2) && (winningTeam == 1) && (spreadIndicator.equals("+")) && ((actualSpread - spreadBet) < 0 )) { // --- User BET on Team 2 // --- AND Team 2 LOST // --- AND Team 2 was NOT FAVORED (spreadIndicator = "+") // --- AND the actual spread of the game MINUS the spread that was bet is a NEGATIVE number // --- EX: User bets KC +6 and KC loses by 5 (actual spread = 5 minus the spread bet of +6 = -1) // --- means the user COVERED the spread then the user WINS result = "WIN"; } else if ((teamBet == 2) && (winningTeam == 1) && (spreadIndicator.equals("+")) && ((actualSpread - spreadBet) > 0 )) { // --- User BET on Team 2 // --- AND Team 2 LOST // --- AND Team 2 was NOT FAVORED (spreadIndicator = "+") // --- AND the actual spread of the game MINUS the spread that was bet is a NEGATIVE number // --- EX: User bets KC +6 and KC loses by 5 (actual spread = 5 minus the spread bet of +6 = -1) // --- means the user COVERED the spread then the user WINS result = "LOSS"; } else if ((teamBet == 2) && (winningTeam == 2) && (spreadIndicator.equals("-")) && ((actualSpread + spreadBet) < 0 )) { // --- User BET on Team 2 // --- AND Team 2 WON // --- AND Team 2 was FAVORED (spreadIndicator = "-") // --- AND the actual spread of the game PLUS the spread that was bet is a NEGATIVE number // --- EX: User bets KC -6 and KC wins by 5 (actual spread = 5 plus the spread bet of -6 = -1) // --- means the user DID NOT COVER the spread then the user LOSES result = "LOSS"; } else if ((teamBet == 2) && (winningTeam == 1 || gameTied) && (spreadIndicator.equals("-"))) { // --- User BET on Team 2 // --- AND Team 2 LOST // --- AND Team 2 was FAVORED (spreadIndicator = "-") // --- means the user DID NOT COVER the spread then the user LOSES result = "LOSS"; } else { // --- The only other scenario would be ones where the actual spread +/- the spread bet = ZERO, which would be a PUSH result = "PUSH"; } } catch (Throwable t) { LOGGER.error("team1Score: " + team1Score); LOGGER.error("team2Score: " + team2Score); LOGGER.error("AccountEvent: " + accountEvent); LOGGER.error("EventPackage: " + event); LOGGER.error("actualSpread: " + actualSpread); LOGGER.error("spreadBet: " + spreadBet); LOGGER.error("spreadIndicator: " + spreadIndicator); LOGGER.error("teamBet: " + teamBet); LOGGER.error(t.getMessage(), t); } LOGGER.info("Exiting determineSpreadLineResult()"); return result; } /** * * @param team1Score * @param team2Score * @param accountEvent * @param event * @return */ private String determineTotalResult(Integer team1Score, Integer team2Score, AccountEvent accountEvent, EventPackage event) { LOGGER.info("Entering determineTotalResult()"); LOGGER.debug("team1Score: " + team1Score); LOGGER.debug("team2Score: " + team2Score); LOGGER.debug("AccountEvent: " + accountEvent); LOGGER.debug("EventPackage: " + event); String result = ""; Integer actualTotal = null; Float totalBet = null; String totalIndicator = null; try { if (team1Score != null && team2Score != null && accountEvent != null) { actualTotal = team1Score + team2Score; totalBet = accountEvent.getTotal(); totalIndicator = accountEvent.getTotalindicator(); LOGGER.debug("actualTotal: " + actualTotal); LOGGER.debug("totalBet: " + totalBet); LOGGER.debug("totalIndicator: " + totalIndicator); // --- Assumption that totalIndicator is either "O" for OVER and "U" for UNDER if (totalIndicator.equals("o") && (totalBet < actualTotal)) { result = "WIN"; // --- User bet the OVER and their total bet was greater than the actualTotal so User wins } else if (totalIndicator.equals("o") && (totalBet > actualTotal)) { result = "LOSS"; // --- User bet the OVER and their total bet was less than the actualTotal so User loses } else if (totalIndicator.equals("u") && (totalBet > actualTotal)) { result = "WIN"; // --- User bet the UNDER and their total bet was greater than the actualTotal so User loses } else if (totalIndicator.equals("u") && (totalBet < actualTotal)) { result = "LOSS"; // --- User bet the UNDER and their total bet was less than the actualTotal so User wins } else { result = "PUSH"; // --- Otherwise bet was a push } } } catch (Throwable t) { LOGGER.error("team1Score: " + team1Score); LOGGER.error("team2Score: " + team2Score); LOGGER.error("AccountEvent: " + accountEvent); LOGGER.error("EventPackage: " + event); LOGGER.error("actualTotal: " + actualTotal); LOGGER.error("totalBet: " + totalBet); LOGGER.error("totalIndicator: " + totalIndicator); LOGGER.error(t.getMessage(), t); } LOGGER.info("Exiting determineTotalResult()"); return result; } /** * * @param team1Score * @param team2Score * @param accountEvent * @param event * @return */ private String determineMlResult(Integer team1Score, Integer team2Score, AccountEvent accountEvent, EventPackage event) { LOGGER.info("Entering determineMlResult()"); LOGGER.debug("team1Score: " + team1Score); LOGGER.debug("team2Score: " + team2Score); LOGGER.debug("AccountEvent: " + accountEvent); LOGGER.debug("EventPackage: " + event); String result = ""; Integer teamBet = null; try { teamBet = teamBetOn(accountEvent, event); LOGGER.debug("teamBet: " + teamBet); if (teamBet.intValue() == 1 && team1Score.intValue() > team2Score.intValue()) { result = "WIN"; // --- User bet on Team 1 and Team 1 scored more than Team 2 so user WINS } else if (teamBet.intValue() == 1 && team1Score.intValue() < team2Score.intValue()) { result = "LOSS"; // --- User bet on Team 1 and Team 1 scored less than Team 2 so user LOSES } else if (teamBet.intValue() == 2 && team2Score.intValue() > team1Score.intValue()) { result = "WIN"; // --- User bet on Team 2 and Team 2 scored more than Team 1 so user WINS } else if (teamBet.intValue() == 2 && team2Score.intValue() < team1Score.intValue()) { result = "LOSS"; // --- User bet on Team 2 and Team 2 scored less than Team 1 so user LOSES } else { result = "PUSH"; } } catch (Throwable t) { LOGGER.error("team1Score: " + team1Score); LOGGER.error("team2Score: " + team2Score); LOGGER.error("AccountEvent: " + accountEvent); LOGGER.error("EventPackage: " + event); LOGGER.error("teamBet: " + teamBet); LOGGER.error(t.getMessage(), t); } LOGGER.info("Exiting determineMlResult()"); return result; } /** * @param accountEvent * @return */ private int getSportId(AccountEvent accountEvent) { // --- sportId = 3 = Baseball // --- sportId = 4 = Hockey // --- sportId = 5 = Golf // --- sportId = 8 = Basketball // --- sportId = 9 = Football // --- sportId = 16 = Soccer int sportId = 0; String sport = accountEvent.getSport(); LOGGER.debug("sport: " + sport); if (sport != null) { if (sport.startsWith("nfl")) { sportId = 9; } else if (sport.startsWith("ncaab")) { sportId = 8; } else if (sport.startsWith("mlb")) { sportId = 3; } else if (sport.startsWith("nba")) { sportId = 8; } else if (sport.startsWith("wnba")) { sportId = 8; } else if (sport.startsWith("ncaaf")) { sportId = 9; } else if (sport.startsWith("nhl")) { sportId = 4; } } return sportId; } /** * @param accountEvent * @return */ private Integer getGameTypeId(AccountEvent accountEvent) { // --- gameType = 0 = FINAL // --- gameType = 1 = 1st Half/Period // --- gameType = 2 = 2nd Half/Period // --- gameType = 3 = 3rd Period Integer gameTypeId = null; String sport = accountEvent.getSport(); if (sport.toLowerCase().indexOf("lines") > 0) { gameTypeId = 0; } else if (sport.toLowerCase().indexOf("first") > 0) { gameTypeId = 1; } else if (sport.toLowerCase().indexOf("second") > 0) { gameTypeId = 2; } else if (sport.toLowerCase().indexOf("third") > 0) { gameTypeId = 3; } return gameTypeId; } /** * * @param accountEvent * @param eventPackage * @return */ private Integer teamBetOn(AccountEvent accountEvent, EventPackage eventPackage) { Integer rotation1 = Integer.parseInt(eventPackage.getTeamone().getEventid()); Integer rotation2 = Integer.parseInt(eventPackage.getTeamtwo().getEventid()); Integer teamBetOn = null; // Check if it's 1H/1P, 2H/2P or 3H/3P if (accountEvent.getSport().contains("first")) { rotation1 = rotation1 + 1000; rotation2 = rotation2 + 1000; } else if (accountEvent.getSport().contains("second")) { rotation1 = rotation1 + 2000; rotation2 = rotation2 + 2000; } else if (accountEvent.getSport().contains("third")) { rotation1 = rotation1 + 3000; rotation2 = rotation2 + 3000; } // Now check which team was bet on if (accountEvent.getEventid().intValue() == rotation1.intValue()) { teamBetOn = 1; } else if (accountEvent.getEventid().intValue() == rotation2.intValue()) { teamBetOn = 2; } else { LOGGER.error("Could not identify team bet on for accountEvent: " + accountEvent); return null; } return teamBetOn; } }
[ "sinceregeneral@outlook.com" ]
sinceregeneral@outlook.com
6885047be1f24d2ecf5c33f8bcb6a521232b781b
427bd36bc98e908b344dfc5ca7e1fca4fa8285cd
/src/main/java/com/spring/boot/angularjs/model/DayResponse.java
ff1f8c55336b5772dced8e709a89d502c3137646
[]
no_license
bonsa/AngularJSSpringBootApp
d328ac75784e06bca1491010824bea929f6cf092
612e846880bdc447ec680b25242db1de91d4aa68
refs/heads/master
2021-01-10T19:22:47.370606
2015-09-12T20:15:48
2015-09-12T20:15:48
42,349,433
0
0
null
null
null
null
UTF-8
Java
false
false
2,673
java
package com.spring.boot.angularjs.model; public class DayResponse { private String text; private Integer year; private Integer number; private Boolean found; private String type; public String getText() { return text; } public void setText(String text) { this.text = text; } public Integer getYear() { return year; } public void setYear(Integer year) { this.year = year; } public Integer getNumber() { return number; } public void setNumber(Integer number) { this.number = number; } public Boolean getFound() { return found; } public void setFound(Boolean found) { this.found = found; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((found == null) ? 0 : found.hashCode()); result = prime * result + ((number == null) ? 0 : number.hashCode()); result = prime * result + ((text == null) ? 0 : text.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((year == null) ? 0 : year.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DayResponse other = (DayResponse) obj; if (found == null) { if (other.found != null) return false; } else if (!found.equals(other.found)) return false; if (number == null) { if (other.number != null) return false; } else if (!number.equals(other.number)) return false; if (text == null) { if (other.text != null) return false; } else if (!text.equals(other.text)) return false; if (type == null) { if (other.type != null) return false; } else if (!type.equals(other.type)) return false; if (year == null) { if (other.year != null) return false; } else if (!year.equals(other.year)) return false; return true; } @Override public String toString() { return "DayResponse [text=" + text + ", year=" + year + ", number=" + number + ", found=" + found + ", type=" + type + "]"; } }
[ "kasia.wasak@gmail.com" ]
kasia.wasak@gmail.com
bd5ac787f993949b84b310a1bf0268130ad20875
57ee871eab4ed5ebc84f81ada66d645541ed0a3b
/app/src/main/java/login/ui/usuario/UpdateDeleteUsuarioFragment.java
300ad4da04e60de7dc73e59483ce3497e5f42660
[]
no_license
wendy-castro/PROYECTO-FINAL-DAUTE-2020-SIS21B
3a6bb8b7de1379e924a399ed21b9863b01251aa4
d698daa3345b5141afb23b0b8f9b3b86504b1860
refs/heads/master
2023-01-15T14:41:34.369207
2020-11-30T12:58:51
2020-11-30T12:58:51
317,223,327
0
0
null
null
null
null
UTF-8
Java
false
false
8,816
java
package login.ui.usuario; import androidx.lifecycle.ViewModelProvider; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import com.example.proyectfinal2020.R; public class UpdateDeleteUsuarioFragment extends Fragment { private Button editarUsuario, eliminarusuario; private EditText campoNombre, campoApe, campoCorreo, campoUser, campoContra, campoRespuesta; private Spinner spinTipo, spinEstado, spinPregunta; private String id, estadoString , estados, tipos, preguntas; private UpdateDeleteUsuarioViewModel mViewModel; public static UpdateDeleteUsuarioFragment newInstance() { return new UpdateDeleteUsuarioFragment(); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View fragemntRoot = inflater.inflate(R.layout.update_delete_usuariofragment, container, false); campoNombre = fragemntRoot.findViewById(R.id.NombreUsuarioUpdate); campoApe = fragemntRoot.findViewById(R.id.ApellidoUsuarioUpdate); campoCorreo = fragemntRoot.findViewById(R.id.CorreoUsuarioUpdate); campoUser = fragemntRoot.findViewById(R.id.UserUsuarioUpdate); campoContra = fragemntRoot.findViewById(R.id.ContrasenaUsuarioUpdate); campoRespuesta = fragemntRoot.findViewById(R.id.RespuestaUsuarioUpdate); spinEstado = fragemntRoot.findViewById(R.id.spinnerEstadoUsuarioUpdate); spinTipo = fragemntRoot.findViewById(R.id.spinnerTipoUsuarioUpdate); spinPregunta = fragemntRoot.findViewById(R.id.spinnerPreguntaUsuarioUpdate); editarUsuario = fragemntRoot.findViewById(R.id.btnActualizarUsuarioUpdate); eliminarusuario = fragemntRoot.findViewById(R.id.btnEliminarUsuarioUpdate); return fragemntRoot; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mViewModel = new ViewModelProvider(this).get(UpdateDeleteUsuarioViewModel.class); // TODO: Use the ViewModel id = String.valueOf(getArguments().getInt("id")); campoNombre.setText(getArguments().getString("nombre")); campoApe.setText(getArguments().getString("apellidos")); campoCorreo.setText(getArguments().getString("correo")); campoUser.setText(getArguments().getString("usuario")); campoContra.setText(getArguments().getString("clave")); campoRespuesta.setText(getArguments().getString("respuesta")); estadoString = ""; estados = String.valueOf(getArguments().getInt("estado")); tipos = String.valueOf(getArguments().getInt("tipo")); preguntas = String.valueOf(getArguments().getString("pregunta")); ArrayAdapter adapter = new ArrayAdapter(getContext(), R.layout.support_simple_spinner_dropdown_item, mViewModel.getEstados()); spinEstado.setAdapter(adapter); spinEstado.setSelection(getArguments().getInt("estado")); spinEstado.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { estadoString = mViewModel.getEstados().get(i); estados = String.valueOf(i); } @Override public void onNothingSelected(AdapterView<?> adapterView) { estados = String.valueOf(getArguments().getInt("estado")); } }); ArrayAdapter adapter1 = new ArrayAdapter(getContext(), R.layout.support_simple_spinner_dropdown_item, mViewModel.getTipos()); spinTipo.setAdapter(adapter1); spinTipo.setSelection(getArguments().getInt("estado")); spinTipo.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { tipos = String.valueOf(i); } @Override public void onNothingSelected(AdapterView<?> adapterView) { tipos = String.valueOf(getArguments().getInt("estado")); } }); ArrayAdapter adapter2 = new ArrayAdapter(getContext(), R.layout.support_simple_spinner_dropdown_item, mViewModel.getPreguntas()); spinPregunta.setAdapter(adapter2); spinPregunta.setSelection(getArguments().getInt("estado")); spinPregunta.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { preguntas = String.valueOf(i); } @Override public void onNothingSelected(AdapterView<?> adapterView) { preguntas = String.valueOf(getArguments().getInt("estado")); } }); editarUsuario.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(campoNombre.getText().toString().length() > 0){ if (campoApe.getText().toString().length() > 0){ if (campoCorreo.getText().toString().length() > 0) { if (campoUser.getText().toString().length()>0){ if (campoContra.getText().toString().length() > 0 && campoContra.getText().toString().length() >= 8 ){ if (spinTipo.getId() != 0){ if (spinEstado.getId() != 0){ if (spinPregunta.getId() != 0){ if (campoApe.getText().toString().length() > 0){ Toast.makeText(getContext(), "Procesando...", Toast.LENGTH_SHORT).show(); mViewModel.actualizaDatosRemotos(getContext(), id, campoNombre.getText().toString(), campoApe.getText().toString(), campoCorreo.getText().toString(), campoUser.getText().toString(), campoContra.getText().toString(), tipos, estados, preguntas, campoRespuesta.getText().toString()); }else { campoRespuesta.setError("Campo obligatorio"); } }else { Toast.makeText(getContext(), "Seleccione una pregunta", Toast.LENGTH_SHORT).show(); } }else { Toast.makeText(getContext(), "Seleccione un estado", Toast.LENGTH_SHORT).show(); } }else { Toast.makeText(getContext(), "Seleccione un tipo de usuario", Toast.LENGTH_SHORT).show(); } }else { campoContra.setError("Campo obligatorio"); } }else { campoUser.setError("Campo obligatorio"); } }else { campoCorreo.setError("Campo obligatorio"); } }else { campoApe.setError("Campo obligatorio"); } }else{ campoNombre.setError("Campo obligatorio"); } if(getActivity() != null){ getActivity().onBackPressed(); } } }); eliminarusuario.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(getContext(), "Procesando...", Toast.LENGTH_SHORT).show(); mViewModel.eliminarDatosRemotos(getContext(), id); if(getActivity() != null){ getActivity().onBackPressed(); } } }); } }
[ "https://github.com/wendy-castro/crud_con_androidestudio_wendy_castro.git" ]
https://github.com/wendy-castro/crud_con_androidestudio_wendy_castro.git
788054f064a3526cd468fdfbc51e0b73d6e0ff85
d640b4d170e31512aa6150fb357393a7b0f35fd8
/src/leetCode/regular/partition/ListNode.java
b99dea0f53033d9252ecf8124ce1d8440bcd350c
[]
no_license
dizent/Dizent-leetCode
8172a37da2f420457e6e8158fb72701f9c5043b5
b4b7adbfa8340c4a04b5c0e93f16b4d134f46a98
refs/heads/master
2023-08-13T03:58:38.931053
2021-10-05T02:26:47
2021-10-05T02:26:47
221,158,805
0
0
null
null
null
null
UTF-8
Java
false
false
211
java
package leetCode.regular.partition; /** * @Auther: 布谷 * @Date: 2021/9/1 17:06 * @Description: */ public class ListNode { int val; ListNode next; ListNode(int x) { val = x; } }
[ "" ]
a6e366e201cb3f189988022f6cc83fe6891be0ed
f409c295d0effaf69d102297a71d886ac1b25f51
/completecorejavacourse/src/main/java/completecorejavacourse/Collections/LinearSearchInArrayList4.java
6de8be558196d953d83afc2212d0192ae76ad22a
[]
no_license
venkateswari05/CompleteCoreJavaPractice
38e6fa00f678939782ce5284afdd185d8d6ad424
64d5d75b37ffc81e9d246ae65085b175373528be
refs/heads/main
2023-06-05T06:26:33.901682
2021-06-13T08:36:55
2021-06-13T08:36:55
365,676,649
0
0
null
null
null
null
UTF-8
Java
false
false
677
java
package completecorejavacourse.Collections; import java.util.ArrayList; import java.util.Scanner; public class LinearSearchInArrayList4 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int key=sc.nextInt(); boolean flag=false; int index=0; ArrayList<Integer> list=new ArrayList<Integer>(); for(int i=0;i<n;i++) { list.add(sc.nextInt()); } for(int i=0;i<list.size();i++) { if(key==list.get(i)) { index=i; flag=true; break; } } if(flag==true) { System.out.println("first index of key is" +index); } else { System.out.println("key index not found"); } } }
[ "parimivenkateswari@gmail.com" ]
parimivenkateswari@gmail.com
4f350930abbb7e4ac74a81e387983085f275dfef
7b3058e0685f1feabba808006520350315bf33c0
/RealmBrowser-Android/realm-browser/src/main/java/com/scand/realmbrowser/EditDialogFragment.java
edf6cffac85b55961e38ec5e07317e32ec06c8c6
[ "Apache-2.0" ]
permissive
Scandltd/realmbrowser
7737bdbf1bf6f34f478d72999aea2d1ada59b189
b9a006469ad1642f886335e8c80e7ec41e858afe
refs/heads/master
2021-01-12T18:14:37.988052
2016-10-19T11:24:23
2016-10-19T11:24:23
71,346,006
2
0
null
null
null
null
UTF-8
Java
false
false
13,898
java
package com.scand.realmbrowser; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.text.InputType; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TabHost; import android.widget.TextView; import android.widget.TimePicker; import java.lang.reflect.Field; import java.util.Calendar; import java.util.Date; import io.realm.Realm; import io.realm.RealmObject; /** * Created by Slabodeniuk on 6/29/15. */ public class EditDialogFragment extends DialogFragment { public interface OnFieldEditDialogInteraction { void onRowWasEdit(int position); } private static final String ARG_POSITION = "ream object position"; private RealmObject mRealmObject; private Field mField; private int mPosition; private OnFieldEditDialogInteraction mListener; // for text edit dialog private EditText mEditText; private TextView mErrorText; // for date edit dialog private TabHost mTabHost; private DatePicker mDatePicker; private TimePicker mTimePicker; // for boolean edit dialog private RadioGroup mRadioGroup; // for byte[] edit dialog private TextView mByteTextView; public static EditDialogFragment createInstance(RealmObject obj, Field field, int position) { RealmObjectHolder realmObjectHolder = RealmObjectHolder.getInstance(); realmObjectHolder.setObject(obj); realmObjectHolder.setField(field); Bundle args = new Bundle(); args.putInt(ARG_POSITION, position); EditDialogFragment fragment = new EditDialogFragment(); fragment.setArguments(args); return fragment; } @Override public void onAttach(Activity activity) { super.onAttach(activity); mListener = (OnFieldEditDialogInteraction) activity; } @Override public void onDetach() { super.onDetach(); mListener = null; } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { mRealmObject = RealmObjectHolder.getInstance().getObject(); mField = RealmObjectHolder.getInstance().getField(); mPosition = getArguments().getInt(ARG_POSITION); if (mRealmObject == null || mField == null) { throw new IllegalArgumentException("Use RealmObjectHolder to store data"); } int layoutId = -1; Class<?> type = mField.getType(); if (type == String.class || type == Short.class || type == short.class || type == Integer.class || type == int.class || type == Long.class || type == long.class || type == Float.class || type == float.class || type == Double.class || type == double.class) { layoutId = R.layout.realm_browser_text_edit_layout; } else if (type == Boolean.class || type == boolean.class) { layoutId = R.layout.realm_browser_boolean_edit_layout; } else if (type == Date.class) { layoutId = R.layout.realm_browser_date_edit_layout; } else if (type == Byte[].class || type == byte[].class) { layoutId = R.layout.realm_browser_byte_array_edit_layout; } LayoutInflater inflater = LayoutInflater.from(getActivity()); View root = inflater.inflate(layoutId, null); findViews(root); initUI(mRealmObject, mField, type); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); if (layoutId == -1) { builder.setMessage("Unknown field type."); } else { builder.setView(root); } builder.setPositiveButton(R.string.realm_browser_ok, null); if (type != Byte[].class && type != byte[].class) { builder.setNegativeButton(R.string.realm_browser_cancel, mCancelClickListener); } if (isTypeNullable(type)) { builder.setNeutralButton(R.string.realm_browser_reset_to_null, null); } AlertDialog dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { Button positiveButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE); positiveButton.setOnClickListener(mOkClickListener); Button resetToNull = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_NEUTRAL); if (resetToNull != null) { resetToNull.setOnClickListener(mResetToNullClickListener); } } }); return dialog; } private void findViews(View root) { mEditText = (EditText) root.findViewById(R.id.text_edit_dialog); mErrorText = (TextView) root.findViewById(R.id.error_message); mRadioGroup = (RadioGroup) root.findViewById(R.id.edit_boolean_group); mTabHost = (TabHost) root.findViewById(R.id.tabHost); mDatePicker = (DatePicker) root.findViewById(R.id.tab_date); mTimePicker = (TimePicker) root.findViewById(R.id.tab_time); mByteTextView = (TextView) root.findViewById(R.id.array); } private void initUI(RealmObject obj, Field field, Class<?> type) { if (type == String.class || type == Short.class || type == short.class || type == Integer.class || type == int.class || type == Long.class || type == long.class || type == Float.class || type == float.class || type == Double.class || type == double.class) { Object valueObj = RealmUtils.getNotParamFieldValue(obj, field); mEditText.setText(valueObj == null ? "" : valueObj.toString()); int inputType; if (type == String.class) { inputType = InputType.TYPE_CLASS_TEXT; } else if (type == Float.class || type == float.class || type == Double.class || type == double.class) { inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED; } else { inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED; } mEditText.setInputType(inputType); } else if (type == Boolean.class || type == boolean.class) { Boolean valueObj = (Boolean) RealmUtils.getNotParamFieldValue(obj, field); int checkedId; if (valueObj == null) { checkedId = -1; } else if (valueObj) { checkedId = R.id.edit_boolean_true; } else { checkedId = R.id.edit_boolean_false; } if (checkedId != -1) ((RadioButton) mRadioGroup.findViewById(checkedId)).setChecked(true); } else if (type == Date.class) { mTabHost.setup(); // create date tab TabHost.TabSpec specDate = mTabHost.newTabSpec("Date"); specDate.setIndicator("Date"); specDate.setContent(R.id.tab_date); mTabHost.addTab(specDate); // create time tab TabHost.TabSpec specTime = mTabHost.newTabSpec("Time"); specTime.setIndicator("Time"); specTime.setContent(R.id.tab_time); mTabHost.addTab(specTime); Date valueObj = (Date) RealmUtils.getNotParamFieldValue(obj, field); Calendar c = Calendar.getInstance(); c.setTime(valueObj != null ? valueObj : new Date()); mDatePicker.updateDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)); mTimePicker.setCurrentHour(c.get(Calendar.HOUR)); mTimePicker.setCurrentMinute(c.get(Calendar.MINUTE)); mTimePicker.setIs24HourView(true); } else if (type == Byte[].class || type == byte[].class) { byte[] valueObj = (byte[]) RealmUtils.getNotParamFieldValue(obj, field); if (valueObj == null) { mByteTextView.setText(R.string.realm_browser_byte_array_is_null); } else { for (byte b : valueObj) { mByteTextView.append(String.format("0x%02X", b) + " "); } } } } private Boolean isTypeNullable(Class type) { return (type == Date.class || type == Boolean.class || type == String.class || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class); } private final View.OnClickListener mResetToNullClickListener = new View.OnClickListener() { @Override public void onClick(View v) { saveNewValue(null); mListener.onRowWasEdit(mPosition); EditDialogFragment.this.dismiss(); } }; private final View.OnClickListener mOkClickListener = new View.OnClickListener() { @Override public void onClick(View view) { Class<?> type = mField.getType(); Object newValue; if (type == String.class) { newValue = mEditText.getText().toString(); } else if (type == Boolean.class || type == boolean.class) { newValue = mRadioGroup.getCheckedRadioButtonId() == R.id.edit_boolean_true; } else if (type == Short.class || type == short.class) { try { newValue = Short.valueOf(mEditText.getText().toString()); } catch (NumberFormatException e) { e.printStackTrace(); newValue = null; } } else if (type == Integer.class || type == int.class) { try { newValue = Integer.valueOf(mEditText.getText().toString()); } catch (NumberFormatException e) { e.printStackTrace(); newValue = null; } } else if (type == Long.class || type == long.class) { try { newValue = Long.valueOf(mEditText.getText().toString()); } catch (NumberFormatException e) { e.printStackTrace(); newValue = null; } } else if (type == Float.class || type == float.class) { try { newValue = Float.valueOf(mEditText.getText().toString()); } catch (NumberFormatException e) { e.printStackTrace(); newValue = null; } } else if (type == Double.class || type == double.class) { try { newValue = Double.valueOf(mEditText.getText().toString()); } catch (NumberFormatException e) { e.printStackTrace(); newValue = null; } } else if (type == Date.class) { Class objClass = mRealmObject.getClass().getSuperclass(); Realm realm = Realm.getInstance(RealmBrowser.getInstance().getRealmConfig(objClass)); Date currentValue = (Date) RealmUtils.getNotParamFieldValue(mRealmObject, mField); realm.close(); Calendar calendar = Calendar.getInstance(); if (currentValue != null) calendar.setTime(currentValue); calendar.set(Calendar.YEAR, mDatePicker.getYear()); calendar.set(Calendar.MONTH, mDatePicker.getMonth()); calendar.set(Calendar.DATE, mDatePicker.getDayOfMonth()); calendar.set(Calendar.HOUR_OF_DAY, mTimePicker.getCurrentHour()); calendar.set(Calendar.MINUTE, mTimePicker.getCurrentMinute()); newValue = calendar.getTime(); } else if (type == Byte[].class || type == byte[].class) { EditDialogFragment.this.dismiss(); return; } else { newValue = null; } if (newValue != null) { saveNewValue(newValue); mListener.onRowWasEdit(mPosition); EditDialogFragment.this.dismiss(); } else { showError(type); } } }; private final DialogInterface.OnClickListener mCancelClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // nothing to do here } }; private void saveNewValue(Object newValue) { Class objClass = mRealmObject.getClass().getSuperclass(); Realm realm = Realm.getInstance(RealmBrowser.getInstance().getRealmConfig(objClass)); realm.beginTransaction(); RealmUtils.setNotParamFieldValue(mRealmObject, mField, newValue); realm.commitTransaction(); realm.close(); } private void showError(Class<?> clazz) { String notFormatted = getString(R.string.realm_browser_value_edit_error); String error = String.format(notFormatted, mEditText.getText().toString(), clazz.getSimpleName()); mErrorText.setText(error); } }
[ "tormanov@mail.scand" ]
tormanov@mail.scand
a82797ebb62ab7d2a2689ea71575f9eede0d6202
7e89a012ae835967c4171dbf7d07e02d7aab886b
/src/project_mgr/Connect.java
4755fe9899bd72fd7582fd9e06665c53538543aa
[]
no_license
saintjk/ANSH
bb3ee26911d53501887ef8709757b249f53e783a
769d9a0b3a3d36fc39859b6d5f747bba732ffcac
refs/heads/master
2020-04-11T07:22:48.022963
2019-01-07T04:42:07
2019-01-07T04:42:07
161,608,237
1
0
null
null
null
null
UTF-8
Java
false
false
668
java
package project_mgr; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Raj */ import java.sql.*; import javax.swing.*; public class Connect { Connection con=null; public static Connection ConnectDB(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://172.31.15.127:3306/ANSH","ansh","admin123"); return con; }catch(ClassNotFoundException | SQLException e){ JOptionPane.showMessageDialog(null, e); return null; } } }
[ "ninslab@node-master" ]
ninslab@node-master
469307d079e81e33c5f7112bf0ca144329ed1aa1
2b7fa7d928a2384f0409741cfb2fa78d20ee4834
/test/com/database/connection/TestConnection.java
419a972862d2afa8ae0b312133fd1d6ad362c522
[]
no_license
KalinaS/DatabaseConnector
d35462747a0ae842cf1693b2e029e09b40d7daaf
6e085e1390eb5792abbc872daa8d003d99dbe24f
refs/heads/master
2021-01-19T00:43:38.047435
2017-06-26T16:03:03
2017-06-26T16:03:03
87,203,800
0
0
null
null
null
null
UTF-8
Java
false
false
520
java
package com.database.connection; import static org.junit.Assert.*; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import org.junit.Test; import com.database.crud.InsertOperation; import com.database.crud.Operation; import com.database.crud.OperationType; public class TestConnection { @Test public void createConnectionTest() throws IOException, SQLException{ CreateConnection create = ConnectionFactory.getConnection(DBType.MYSQLDB); assertNotNull(create); } }
[ "kal_94@abv.bg" ]
kal_94@abv.bg
beed97a52774595a793ba490bd0b21f8756b2ea6
b47038e040e56266454e83a0d34ee58f3b95eb10
/PictureUpload/src/main/java/com/qa/rest/IPictureEndpoints.java
c8456c77a0374042b12eb893ea865abf06f90c78
[]
no_license
GarethClifford/CV
7d930976702a50e46104a00cca5cafa3a8cf0b87
d45114ab17728e84cd8aad9b358d5486412e474e
refs/heads/master
2020-04-15T06:49:22.944165
2019-01-07T18:35:31
2019-01-07T18:35:31
164,474,572
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.qa.rest; import java.io.IOException; import org.springframework.core.io.ByteArrayResource; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; public interface IPictureEndpoints { public String createPicture(Long user_id, MultipartFile picture) throws IOException; public String updatePicture(Long user_id, MultipartFile picture) throws IOException; public String deletePicture(Long user_id); public ResponseEntity<ByteArrayResource> getPicture(Long id); }
[ "gareth.clifford@live.co.uk" ]
gareth.clifford@live.co.uk
9ffcecb42ad0f23c54b2552307c0c791e2c6ecdc
8cdd38dfd700c17d688ac78a05129eb3a34e68c7
/JVXML_HOME/org.jvoicexml/unittests/src/org/jvoicexml/documentserver/schemestrategy/scriptableobjectserializer/TestJSONSerializer.java
8f45fea70795eb33f0d5333b8e7088a4c1e56814
[]
no_license
tymiles003/JvoiceXML-Halef
b7d975dbbd7ca998dc1a4127f0bffa0552ee892e
540ff1ef50530af24be32851c2962a1e6a7c9dbb
refs/heads/master
2021-01-18T18:13:56.781237
2014-05-13T15:56:07
2014-05-13T15:56:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,033
java
/* * File: $HeadURL: https://svn.code.sf.net/p/jvoicexml/code/trunk/org.jvoicexml/unittests/src/org/jvoicexml/documentserver/schemestrategy/scriptableobjectserializer/TestJSONSerializer.java $ * Version: $LastChangedRevision: 2715 $ * Date: $Date: 2011-06-21 19:23:54 +0200 (Tue, 21 Jun 2011) $ * Author: $LastChangedBy: schnelle $ * * JVoiceXML - A free VoiceXML implementation. * * Copyright (C) 2011 JVoiceXML group - http://jvoicexml.sourceforge.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.jvoicexml.documentserver.schemestrategy.scriptableobjectserializer; import java.util.Collection; import java.util.Iterator; import junit.framework.Assert; import org.apache.http.NameValuePair; import org.junit.Test; import org.jvoicexml.documentserver.schemestrategy.ScriptableObjectSerializer; import org.jvoicexml.event.JVoiceXMLEvent; import org.jvoicexml.interpreter.ScriptingEngine; import org.mozilla.javascript.ScriptableObject; /** * Test cases for {@link JSONSerializer}. * @author Dirk Schnelle-Walka * @version $Revision: 2715 $ * @since 0.7.5 */ public final class TestJSONSerializer { /** * Test method for {@link org.jvoicexml.documentserver.schemestrategy.scriptableobjectserializer.JSONSerializer#serialize(org.mozilla.javascript.ScriptableObject)}. * @exception JVoiceXMLEvent * test failed */ @Test public void testSerialize() throws JVoiceXMLEvent { final ScriptingEngine scripting = new ScriptingEngine(null); scripting.eval("var A = new Object();"); scripting.eval("A.B = 'test';"); scripting.eval("A.C = new Object();"); scripting.eval("A.C.D = 42.0;"); scripting.eval("A.C.E = null;"); final ScriptableObjectSerializer serializer = new JSONSerializer(); final ScriptableObject object = (ScriptableObject) scripting.getVariable("A"); final Collection<NameValuePair> pairs = serializer.serialize("A", object); Assert.assertEquals(1, pairs.size()); final Iterator<NameValuePair> iterator = pairs.iterator(); final NameValuePair pair = iterator.next(); Assert.assertEquals("A", pair.getName()); Assert.assertEquals("{\"B\":\"test\",\"C\":{\"D\":42,\"E\":null}}", pair.getValue()); } }
[ "malatawy15@gmail.com" ]
malatawy15@gmail.com
14a4ee858c487da1d811201b702882fbdc4f423a
026a7a1bfa25fd21059bd524225b093e4fc75e95
/src/uk/ac/kcl/dcs/ecarv/Component.java
5d78ac0f26ae90656797331aae18e115074f2512
[]
no_license
vicioushare/JpCap-1
5a3bc0c6d8c997d2432dd57da19cfa04a0bfa2fa
33da941104af4773e33cc73f11a72cf63fa3e5e8
refs/heads/master
2021-01-15T14:02:11.948680
2014-05-20T11:18:58
2014-05-20T11:18:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,814
java
package uk.ac.kcl.dcs.ecarv; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.Observable; import net.sourceforge.jpcap.capture.CapturePacketException; import net.sourceforge.jpcap.capture.PacketListener; import net.sourceforge.jpcap.net.Packet; import net.sourceforge.jpcap.net.TCPPacket; import net.sourceforge.jpcap.simulator.PacketCaptureSimulator; import uk.ac.kcl.dcs.ecaplus.Event; import uk.ac.kcl.dcs.ecaplus.SelfAwareStatement; public class Component { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getQueueSize() { return queueSize; } public void setQueueSize(int queueSize) { this.queueSize = queueSize; } public int getProcessSpeed() { return processSpeed; } public void setProcessSpeed(int processSpeed) { this.processSpeed = processSpeed; } public String getContentOnComponent() { return contentOnComponent; } public void setContentOnComponent(String contentOnComponent) { this.contentOnComponent = contentOnComponent; } public ArrayList<Value> getPreferenceOrdering() { return preferenceOrdering; } public void setPreferenceOrdering(ArrayList<Value> preferenceOrdering) { this.preferenceOrdering = preferenceOrdering; } public ArrayList<Intention> getIntentions() { return knownIntentions; } public void setIntentions(ArrayList<Intention> intentions) { this.knownIntentions = intentions; } private int queueSize; private int processSpeed; private String contentOnComponent; private String state = "ANY"; public String getState() { return state; } public void setState(String state) { this.state = state; } public Component(String name, int queueSize, int processSpeed, String contentOnComponent) { this.name = name; this.queueSize = queueSize; this.processSpeed = processSpeed; this.contentOnComponent = contentOnComponent; } public void go() throws CapturePacketException, DenialOfService { PacketCaptureSimulator sim = new PacketCaptureSimulator(); // TCPPacketQueue queue = new TCPPacketQueue(queueSize); // PacketReceiver packetReceiver = new PacketReceiver(queue); sim.addPacketListener(packetReceiver); // PacketHandler packetHandler = new PacketHandler(queue, processSpeed); packetHandler.start(); // sim.capture(500); // System.out.println(name + ": Failed to service (in good time) " + packetReceiver.unservicableRequestCount() + " requests."); System.out.println("---------------------------------------------------------------------------------"); if (packetReceiver.unservicableRequestCount() > 50) { throw new DenialOfService(name); } } // "Producer" class PacketReceiver implements PacketListener { TCPPacketQueue queue; int unservicableRequestCount = 0; PacketReceiver(TCPPacketQueue queue) { this.queue = queue; } int unservicableRequestCount() { return unservicableRequestCount; } int lastPacketTime; public void packetArrived(Packet packet) { if (queue.size() < queue.length()) { try { TCPPacket tcpPacket = (TCPPacket)packet; queue.putPacket(tcpPacket); System.out.println(name + ":> TCP packet arrived. Time since last packet: " + ((tcpPacket.getTimeval().getMicroSeconds() / 1000) - lastPacketTime) + "ms <"); lastPacketTime = tcpPacket.getTimeval().getMicroSeconds() / 1000; } catch( Exception e ) { System.out.println(name + ": Other packet arrived."); } } else { unservicableRequestCount++; /*System.out.println("------------------------------------------------------------------"); System.out.println(name + ": Packet arrived, queue full. Currently unservicable requests: " + unservicableRequestCount); System.out.println("------------------------------------------------------------------");*/ } } } class TCPPacketQueue { TCPPacket[] queue; int length = 0; int size = 0; TCPPacketQueue(int length) { queue = new TCPPacket[length]; this.length = length; } TCPPacket getPacket() { size--; return queue[size]; } void putPacket(TCPPacket packet) { queue[size] = packet; size++; } int length() { return length; } int size() { return size; } TCPPacket[] queue() { return queue; } public String toString() { return name + ": Queue state: (" + size + "/" + length + ")"; } } // "Consumer" class PacketHandler extends Thread { //implements SelfAwareSyntax TCPPacketQueue queue; // Between 1 - 10 with 10 being fastest int processSpeed; PacketHandler(TCPPacketQueue queue, int processSpeed) { this.queue = queue; this.processSpeed = processSpeed <= 10 ? processSpeed : 5; } @Override public void run() { while(true) { if (queue.size() != 0) { TCPPacket packet = queue.getPacket(); String srcHost = packet.getSourceAddress(); String dstHost = packet.getDestinationAddress(); try { Thread.sleep(100 - (processSpeed * 10)); } catch (InterruptedException e) { e.printStackTrace(); } } else { try { Thread.sleep(0); } catch (InterruptedException e) { e.printStackTrace(); } } } } } /************************************************************************************/ ArrayList<Value> preferenceOrdering = new ArrayList<Value>(); public void addValue(Value v) { preferenceOrdering.add(v); System.out.println(name + "'s new preference ordering is: " + preferenceOrdering); } public void addValue(Value v, int position) { preferenceOrdering.add(position, v); System.out.println(name + "'s new preference ordering is: " + preferenceOrdering); } public void topPriority(Value v) { preferenceOrdering.add(v); System.out.println(name + "'s new preference ordering is: " + preferenceOrdering); } public void lowestPriority(Value v) { preferenceOrdering.add(preferenceOrdering.size(), v); System.out.println(name + "'s new preference ordering is: " + preferenceOrdering); } public Hashtable<Value, Double> act(ArrayList<ValuePromotion> valuePromotion) { // Map each Value to vote Hashtable<Value, Double> votes = new Hashtable<Value, Double>(); // Loop through all the value / promotion pairs from the ECARV rule for (ValuePromotion vp : valuePromotion) { // If the value is in this component's preference ordering (they are concerned about it): if (preferenceOrdering.contains(vp.getValue())) { // Give a score to that value based on its position in the preference ordering. // The score is based on 1 / N with N being the position in the preference // In this way, preferences lower in the ordering have weighting but it is reduced. votes.put(vp.getValue(), (1.0 / (preferenceOrdering.indexOf(vp.getValue()) + 1))); } } return votes; } /************************************************************************************/ ArrayList<Intention> knownIntentions = new ArrayList<Intention>(); public void addIntention(Intention intention) { knownIntentions.add(intention); } public boolean act(ECA eca) { System.out.println(knownIntentions); for (Intention intention : knownIntentions) { System.out.println(intention.getEc().getSummary() +"| |"+ eca.getEvent() + eca.getCondition() + "|"); // If eca contains a known event... if (intention.getEc().getSummary().trim().equals((eca.getEvent() + eca.getCondition()).trim())) { // ...and we are in a particular known context, linked to this event. if(intention.getContext().getSourceLocation().equals(eca.getEvent().getSource()) && // If the event source matches a known source intention.getContext().getTime().equals(eca.getEvent().getTime()) && // and if the event time matches a known time intention.getContext().getContentOnComponent().equals(contentOnComponent)) { // and if the content on the component matches known content // ...the proposal should not proceed. return intention.getPositiveNegative(); // ...towards a component in a particular state, linked to the event. } else if(intention.getCs().getComponent().getName().equals(name) && intention.getCs().getState().equals(state)) { // ...the proposal should not proceed. return intention.getPositiveNegative(); } } } // No known knoweldge of there being anything wrong with this event and its context and affect on components return true; } }
[ "contact@martin-chapman.com" ]
contact@martin-chapman.com
063333d71cdfad82cd3f576b57410d6093795745
9cc40c0fb845f0b048d2b60eed8041d50da0d338
/src/main/java/com/fortune/travels/controller/ExpensesController.java
2c5e4d8128259bdec249d8402594ea9da5b5573a
[]
no_license
vivekkel/fortunett-new
1293d15d8a01e726b3cca0e5ae31c3e03d2ad717
0f2ed5b4ec22392f463ca2ee0b14e45d091bc275
refs/heads/master
2022-07-25T18:48:04.648928
2019-09-12T17:38:19
2019-09-12T17:38:19
208,106,038
0
0
null
2022-06-21T01:51:39
2019-09-12T17:23:58
Java
UTF-8
Java
false
false
2,161
java
package com.fortune.travels.controller; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.fortune.travels.model.ChangeType; import com.fortune.travels.model.Expenses; import com.fortune.travels.model.ExpensesReqRes; import com.fortune.travels.repository.ExpensesDAOService; @RestController @RequestMapping("/fortune") public class ExpensesController { @Autowired ExpensesDAOService expensesDAOService; @PostMapping("/expenses") public ExpensesReqRes expenses(@Valid @RequestBody ExpensesReqRes expensesReqRes) { ExpensesReqRes expensesResponse = new ExpensesReqRes(); expensesResponse.setSucessful(true); try { if(null != expensesReqRes && null != expensesReqRes.getExpenses() && expensesReqRes.getExpenses().size() > 0) { for(Expenses expense : expensesReqRes.getExpenses()) { if(expense.getChangeType() == ChangeType.INSERT) { expensesDAOService.insert(expense); } else if(expense.getChangeType() == ChangeType.UPDATE) { expensesDAOService.update(expense); } else if(expense.getChangeType() == ChangeType.REMOVE) { expensesDAOService.delete(expense); } } } expensesResponse.setFilterCriteria(expensesReqRes.getFilterCriteria()); expensesResponse.setExpenses(expensesDAOService.selectAllExpenseCriteria(expensesReqRes.getFilterCriteria())); } catch(Exception e) { expensesResponse.setSucessful(false); expensesResponse.setErrorMessage(e.getMessage()); return expensesResponse; } return expensesResponse; } @GetMapping("/getExpenses") public ExpensesReqRes getExpenses() { ExpensesReqRes expensesReqRes= new ExpensesReqRes(); expensesReqRes.setExpenses(expensesDAOService.selectAllExpense()); return expensesReqRes; } }
[ "sudhan@dorigintech.com" ]
sudhan@dorigintech.com
0e90674299333ed1d5d2f8e40f38f9d0485c8444
95e944448000c08dd3d6915abb468767c9f29d3c
/sources/com/bytedance/ies/bullet/kit/web/C10629c.java
098f90d8f4eae028e6724bc53f6b2e58c0c005ff
[]
no_license
xrealm/tiktok-src
261b1faaf7b39d64bb7cb4106dc1a35963bd6868
90f305b5f981d39cfb313d75ab231326c9fca597
refs/heads/master
2022-11-12T06:43:07.401661
2020-07-04T20:21:12
2020-07-04T20:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package com.bytedance.ies.bullet.kit.web; /* renamed from: com.bytedance.ies.bullet.kit.web.c */ public interface C10629c { }
[ "65450641+Xyzdesk@users.noreply.github.com" ]
65450641+Xyzdesk@users.noreply.github.com
d9a1891f8867a70ec60473769ad2c1e7608ec1b6
c7fcf838480e140b67d7f1c803b31db95e2b5ae2
/app/src/main/java/ydrasaal/alligregator/adapters/NavigationDrawerAdapter.java
649c7edeade7d7427951034eb5a898ac44ff49cc
[]
no_license
Ydrasaal/Alligregator
398dceb386a864672db76438e3ff0426594dfdbf
74af1b062d375c55ae0f2c6927953ec58e286a3c
refs/heads/master
2021-01-11T19:42:29.567991
2016-04-12T15:24:55
2016-04-12T15:24:55
52,878,401
0
0
null
null
null
null
UTF-8
Java
false
false
5,183
java
package ydrasaal.alligregator.adapters; import android.support.v7.util.SortedList; import android.support.v7.widget.AppCompatButton; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import ydrasaal.alligregator.R; import ydrasaal.alligregator.data.MenuItem; import ydrasaal.alligregator.listeners.OnRecyclerItemClickListener; /** * Created by Léo on 12/03/2016. * * Adapter for the navigationDrawer's Recyclerview. Sort elements with a provided index by this index, else by feed title. */ public class NavigationDrawerAdapter extends RecyclerView.Adapter<NavigationDrawerAdapter.MenuItemViewHolder> { private final int TYPE_HEADER = 0; private final int TYPE_SECTION = 1; private final int TYPE_ITEM = 2; private final SortedList<MenuItem> values; private OnRecyclerItemClickListener itemClickListener; public NavigationDrawerAdapter(OnRecyclerItemClickListener listener) { itemClickListener = listener; values = new SortedList<>(MenuItem.class, new SortedList.Callback<MenuItem>() { @Override public int compare(MenuItem o1, MenuItem o2) { if (o1.getPosition() != o2.getPosition()) return Double.compare(o1.getPosition(), o2.getPosition()); return o1.getTitle().compareTo(o2.getTitle()); } @Override public void onInserted(int position, int count) { notifyItemRangeInserted(position, count); } @Override public void onRemoved(int position, int count) { notifyItemRangeRemoved(position, count); } @Override public void onMoved(int fromPosition, int toPosition) { notifyItemMoved(fromPosition, toPosition); } @Override public void onChanged(int position, int count) { notifyItemRangeChanged(position, count); } @Override public boolean areContentsTheSame(MenuItem oldItem, MenuItem newItem) { return oldItem.getUrl().equals(newItem.getUrl()); } @Override public boolean areItemsTheSame(MenuItem item1, MenuItem item2) { return item1.getTitle().equals(item2.getTitle()); } }); } @Override public MenuItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { int layoutId = R.layout.nav_button_home; switch (viewType) { case TYPE_HEADER: layoutId = R.layout.nav_header_home; break; case TYPE_SECTION: layoutId = R.layout.nav_content_home; } View view = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false); return new MenuItemViewHolder(view, viewType); } @Override public void onBindViewHolder(MenuItemViewHolder holder, final int position) { if (holder.viewType == TYPE_HEADER) return; MenuItem item = values.get(position); if (holder.viewType == TYPE_ITEM) { if (item.getIconId() != 0) holder.button.setCompoundDrawablesWithIntrinsicBounds(item.getIconId(), 0, 0, 0); if (itemClickListener != null) { holder.button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { itemClickListener.onClick(v, position); } }); holder.button.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { itemClickListener.onLongCLick(v, position); return true; } }); } } holder.button.setText(item.getTitle()); } @Override public int getItemCount() { return values.size(); } @Override public int getItemViewType(int position) { if (position == 0) return TYPE_HEADER; return values.get(position).isHeader() ? TYPE_SECTION : TYPE_ITEM; } public void addFixedItem(MenuItem item, int position) { item.setPosition(position); values.add(item); notifyItemInserted(values.size() - 1); } public void addItem(MenuItem item) { values.add(item); notifyItemInserted(values.size() - 1); } public void removeItem(int position) { values.removeItemAt(position); notifyItemRemoved(position); } public MenuItem getItem(int position) { return values.get(position); } public class MenuItemViewHolder extends RecyclerView.ViewHolder { public AppCompatButton button; public final int viewType; public MenuItemViewHolder(View itemView, int viewType) { super(itemView); button = (AppCompatButton) itemView.findViewById(R.id.entry_title); this.viewType = viewType; } } }
[ "ydrasaal@gmail.com" ]
ydrasaal@gmail.com
a454a9271e960d327f501d79beace9b567c30b0e
8f0b40db4efca14f822049fe6ffb0aa28ef86feb
/205-isomorphic-strings/205-isomorphic-strings.java
8aefc7fdeca5ffe73735fd53b036fad1878bbc42
[]
no_license
inderSing/Data-Structure-practise
63a7daa0404e5636a57334ed50a9e51163e08ed4
39867973b1c31efe560d41388610ee408b06f593
refs/heads/master
2022-03-19T21:45:23.244666
2022-02-23T02:01:58
2022-02-23T02:01:58
147,124,780
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
class Solution { public boolean isIsomorphic(String s, String t) { if( s.length() != t.length() ) { return false; } HashMap<Character, Character> map = new HashMap<>(); for(int i = 0; i < s.length(); i++) { if( map.containsKey(s.charAt(i))) { char temp = map.get(s.charAt(i)); if( temp != t.charAt(i)) { return false; } } else { if( map.containsValue(t.charAt(i)) ) { return false; } map.put(s.charAt(i), t.charAt(i)); } } return true; } }
[ "31967757+inderSing@users.noreply.github.com" ]
31967757+inderSing@users.noreply.github.com
a2e7b0d64a5928e17aa1951cbd9aa1fdaf5e7af4
322ac84614bd8d011c79b03d96214d4ceabcf086
/src/main/java/com/oseasy/scr/modules/sco/service/ScoApplyService.java
11886d6c8de497376717994ed537d8e0d61ce3bc
[]
no_license
SchuckBeta/cxcy
f2f953c074be5ab8ab8aeac533ade6600135d759
ed4ceee397fae9d470fb93579bbf6af631965eaa
refs/heads/master
2022-12-25T14:53:58.066476
2019-09-20T12:28:55
2019-09-20T12:28:55
209,783,634
1
0
null
2022-12-16T07:46:52
2019-09-20T12:18:07
Java
UTF-8
Java
false
false
12,442
java
package com.oseasy.scr.modules.sco.service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.oseasy.com.pcore.modules.sys.utils.CoreUtils; import com.oseasy.com.pcore.modules.sys.vo.TenantConfig; import com.oseasy.com.rediserver.common.utils.CacheUtils; import org.activiti.engine.IdentityService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.oseasy.act.modules.act.dao.ActDao; import com.oseasy.act.modules.act.entity.Act; import com.oseasy.act.modules.act.service.ActTaskService; import com.oseasy.act.modules.actyw.entity.ActYw; import com.oseasy.act.modules.actyw.service.ActYwService; import com.oseasy.act.modules.actyw.tool.process.ActYwTool; import com.oseasy.com.fileserver.modules.attachment.dao.SysAttachmentDao; import com.oseasy.com.fileserver.modules.attachment.enums.FileStepEnum; import com.oseasy.com.fileserver.modules.attachment.enums.FileTypeEnum; import com.oseasy.com.fileserver.modules.attachment.service.SysAttachmentService; import com.oseasy.com.mqserver.modules.oa.entity.OaNotify; import com.oseasy.com.mqserver.modules.oa.service.OaNotifyService; import com.oseasy.com.pcore.common.config.CoreIds; import com.oseasy.com.pcore.common.persistence.Page; import com.oseasy.com.pcore.common.service.CrudService; import com.oseasy.com.pcore.modules.sys.entity.Role; import com.oseasy.com.pcore.modules.sys.entity.User; import com.oseasy.com.pcore.modules.sys.service.SystemService; import com.oseasy.com.pcore.modules.sys.service.UserService; import com.oseasy.com.pcore.modules.sys.utils.UserUtils; import com.oseasy.scr.modules.sco.dao.ScoApplyDao; import com.oseasy.scr.modules.sco.dao.ScoCourseDao; import com.oseasy.scr.modules.sco.entity.ScoAffirmConf; import com.oseasy.scr.modules.sco.entity.ScoAffirmCriterionCouse; import com.oseasy.scr.modules.sco.entity.ScoApply; import com.oseasy.scr.modules.sco.entity.ScoAuditing; import com.oseasy.scr.modules.sco.entity.ScoCourse; import com.oseasy.scr.modules.sco.entity.ScoScore; import com.oseasy.scr.modules.scr.vo.ScoRstatus; import com.oseasy.sys.common.config.SysIds; import com.oseasy.com.pcore.common.config.CoreJkey; import com.oseasy.util.common.utils.StringUtil; import net.sf.json.JSONObject; /** * 学分课程申请Service. * @author zhangzheng * @version 2017-07-13 */ @Service @Transactional(readOnly = true) public class ScoApplyService extends CrudService<ScoApplyDao, ScoApply> { @Autowired SysAttachmentDao sysAttachmentDao; @Autowired private ScoAuditingService scoAuditingService; @Autowired private ScoScoreService scoScoreService; @Autowired private ScoAffirmConfService scoAffirmConfService; @Autowired private ScoAffirmCriterionCouseService scoAffirmCriterionCouseService; @Autowired ActTaskService actTaskService; @Autowired ActYwService actYwService; @Autowired UserService userService; @Autowired SystemService systemService; @Autowired private RuntimeService runtimeService; @Autowired IdentityService identityService; @Autowired TaskService taskService; @Autowired ActDao actDao; @Autowired private OaNotifyService oaNotifyService; @Autowired private ScoCourseService scoCourseService; @Autowired private SysAttachmentService sysAttachmentService; @Autowired private ScoCourseDao scoCourseDao; @Transactional(readOnly = false) public Long getCountToAudit() { ScoApply p=new ScoApply(); p.setAuditStatus(ScoApply.auditStatus2); Long c=dao.getCount(p); return c==null?0L:c; } public ScoApply get(String id) { return super.get(id); } public List<ScoApply> findList(ScoApply scoApply) { return super.findList(scoApply); } @Transactional(readOnly = false) public Page<ScoApply> findPage(Page<ScoApply> page, ScoApply scoApply) { //保持原有数据不变,添加未申请的课程 ScoApply entity = new ScoApply(); entity.setUserId(scoApply.getUserId()); List<ScoApply> scoApplyList = dao.findList(entity); List<ScoCourse> scoCourseList = scoCourseDao.findList(new ScoCourse()); if(scoApplyList != null && scoCourseList != null && scoApplyList.size() != scoCourseList.size()){ for(ScoCourse scoCourse : scoCourseList){ ScoApply temp = new ScoApply(); temp.setUserId(scoApply.getUserId()); temp.setCourseId(scoCourse.getId()); List<ScoApply> tempList = dao.findList(temp); if(tempList==null || tempList.size()==0){ temp.setAuditStatus("0"); add(temp); } } } return super.findPage(page, scoApply); } //添加学分认定 @Transactional(readOnly = false) public void add(ScoApply scoApply) { super.save(scoApply); } @Transactional(readOnly = false) public void save(ScoApply scoApply) { super.save(scoApply); //向后台管理员发送申请消息 List<String> roles = new ArrayList<String>(); Role role = systemService.getRole(CoreIds.NSC_SYS_ROLE_ADMIN.getId()); if(role!=null){ roles = userService.findListByRoleId(role.getId()); if(roles!=null && roles.size()>0){ ScoCourse scoCourse = scoCourseService.get(scoApply.getCourseId()); User user=UserUtils.getUser(); oaNotifyService.sendOaNotifyByTypeAndUser(user, roles, "课程学分申请", user.getName()+"申请"+ scoCourse.getName()+"课程的学分", OaNotify.Type_Enum.TYPE21.getValue(), scoApply.getId()); } } //附件 saveCreditResultApply(scoApply); //走工作流 学分类型的0000000127 //User user = UserUtils.getUser(); //ActYw actYw=actYwService.get(scoApply.getActYwId()); delRun(scoApply); startRun(scoApply); } @Transactional(readOnly = false) public void saveCreditResultApply(ScoApply scoRapply){ sysAttachmentService.deleteByUid(scoRapply.getId()); //保存成果物附件 sysAttachmentService.saveBySysAttachmentVo(scoRapply.getSysAttachmentList(), scoRapply.getId(), FileTypeEnum.S5, FileStepEnum.S5); } @Transactional(readOnly = false) public void delRun(ScoApply scoApply) { } //开启新审核流程 @Transactional(readOnly = false) public void startRun(ScoApply scoApply) { ScoAffirmConf scoAffirmConf =scoAffirmConfService.getByItem("0000000127"); // 根据学分配置得到审核节点 ActYw actYw=actYwService.get(scoAffirmConf.getProcId()); //启动工作流 if (actYw!=null) { //得到流程下一步审核角色id String roleId=actTaskService.getProcessStartRoleName(ActYw.getPkey(actYw)); //从工作流中查询 下一步的角色集合 //actTaskService.getNextRoleName() Role role= systemService.getNamebyId(roleId.substring(ActYwTool.FLOW_ROLE_ID_PREFIX.length())); //启动节点 String roleName=role.getName(); List<String> roles=new ArrayList<String>(); if (roleName.contains(SysIds.ISCOLLEGE.getRemark())||roleName.contains(SysIds.ISMS.getRemark())) { roles=userService.findListByRoleIdAndOffice(role.getId(),scoApply.getUserId()); }else{ roles=userService.findListByRoleId(role.getId()); } //根据角色id获得审核人 //List<String> roles=userService.findListByRoleId(roleId); if (roles.size()>0) { //super.save(proModel); Map<String,Object> vars=new HashMap<String,Object>(); vars=scoApply.getVars(); vars.put(roleId+"s",roles); //vars.put(scoAffirmConf.getProcId(),roles); String key=ActYw.getPkey(actYw); String userId = UserUtils.getUser().getLoginName(); identityService.setAuthenticatedUserId(userId); //启动流程节点 //流程加tenant_id ProcessInstance procIns=runtimeService.startProcessInstanceByKeyAndTenantId(key, "score"+":"+scoApply.getId(),vars, TenantConfig.getCacheTenant()); //流程id返写业务表 Act act = new Act(); act.setBusinessTable("sco_apply");// 业务表名 act.setBusinessId(scoApply.getId()); // 业务表ID act.setProcInsId(procIns.getId()); actDao.updateProcInsIdByBusinessId(act); scoApply.setProcInsId(act.getProcInsId()); super.save(scoApply); } } } @Transactional(readOnly = false) public void delete(ScoApply scoApply) { super.delete(scoApply); } @Transactional(readOnly = false) public void saveAudit(ScoApply scoApply,String suggest) { ScoAuditing scoAuditing=new ScoAuditing(); scoAuditing.setApplyId(scoApply.getId()); scoAuditing.setType("1"); scoAuditing.setScoreVal(String.valueOf(scoApply.getScore())); scoAuditing.setUser(UserUtils.getUser()); scoAuditing.setProcInsId(scoApply.getProcInsId()); if (StringUtil.isNotEmpty(suggest)) { scoAuditing.setSuggest(suggest); } scoAuditingService.save(scoAuditing); super.save(scoApply); //向前台发送消息告诉学生已经审核完成。 User user=UserUtils.getUser(); User rec_User=systemService.getUser(scoApply.getUserId()); ScoCourse scoCourse = scoCourseService.get(scoApply.getCourseId()); oaNotifyService.sendOaNotifyByType(user, rec_User, "课程学分审核", rec_User.getName()+"申请"+ scoCourse.getName()+"课程的学分已经被审核", OaNotify.Type_Enum.TYPE32.getValue(), scoApply.getId()); //告诉其他管理员 该申请学分已经审核完成。 List<String> roles = new ArrayList<String>(); Role role = systemService.getRole(CoreIds.NSC_SYS_ROLE_ADMIN.getId()); if(role!=null){ roles = userService.findListByRoleId(role.getId()); roles.remove(user.getId()); if(roles.size()>0){ oaNotifyService.sendOaNotifyByTypeAndUser(user, roles, "课程学分审核", rec_User.getName()+"申请"+ scoCourse.getName()+"课程的学分已经被其他人审核", OaNotify.Type_Enum.TYPE32.getValue(), scoApply.getId()); } } Map<String,Object> vars=new HashMap<String,Object>(); vars=scoApply.getVars(); String taskId=actTaskService.getTaskidByProcInsId(scoApply.getProcInsId()); taskService.complete(taskId, vars); if (scoApply.getAuditStatus().equals(ScoRstatus.SRS_PASS.getKey())) { saveScore(scoApply); }else{ scoApply.setScore(0f); super.save(scoApply); } } @Transactional(readOnly = false) private void saveScore(ScoApply scoApply) { ScoScore scoScore =new ScoScore (); scoScore.setCourseId(scoApply.getCourseId()); String userId=scoApply.getUserId(); scoScore.setUser(userService.findUserById(userId)); float score=scoApply.getScore(); if (score>0&score<0.5) { score = 0.5f; } scoScore.setCourseScore((double)score); scoScoreService.save(scoScore); } @Transactional(readOnly = false) public JSONObject saveAuditPl(String[] idList) { JSONObject js=new JSONObject(); for(int i=0;i<idList.length;i++){ ScoApply scoApply=get(idList[i]); scoApply.setAuditStatus(ScoRstatus.SRS_PASS.getKey()); //查询相应课程课时列表 List<ScoAffirmCriterionCouse> couseNumList = scoAffirmCriterionCouseService.findListByFidCouseNum(scoApply.getCourseId()); if (couseNumList!=null) { String autoScore=null; for(ScoAffirmCriterionCouse index:couseNumList) { int begin=Integer.valueOf(index.getStart()); int end=Integer.valueOf(index.getEnd()); if ((scoApply.getRealTime()<end || scoApply.getRealTime()== end) && (scoApply.getRealTime()>begin||scoApply.getRealTime()==begin)) { List<ScoAffirmCriterionCouse> couseScoreList = scoAffirmCriterionCouseService.findListByParentId(index.getId()); if (couseScoreList!=null) { for(ScoAffirmCriterionCouse indexScore:couseScoreList) { int beginScore=Integer.valueOf(indexScore.getStart()); int endScore=Integer.valueOf(indexScore.getEnd()); if ((scoApply.getRealScore()<endScore || scoApply.getRealScore()== endScore) && (scoApply.getRealScore()>beginScore|| scoApply.getRealScore()== beginScore)) { autoScore=indexScore.getScore(); } if (StringUtil.isNotEmpty(autoScore)) { break; } } } } if (StringUtil.isNotEmpty(autoScore)) { break; } } if(autoScore!=null){ scoApply.setScore(Float.valueOf(autoScore)); }else{ scoApply.setScore(0); } } try { saveAudit(scoApply,""); }catch (Exception e){ logger.error(e.toString()); js.put(CoreJkey.JK_RET,0); js.put(CoreJkey.JK_MSG,"审核失败"); return js; } } js.put(CoreJkey.JK_RET,1); return js; } }
[ "chenhao@os-easy.com" ]
chenhao@os-easy.com
7a070ee144d10f91fc0814f81a955ca6bc4a28da
e566984f0c53ff5a53b40b4d8dbbdc6e2c4d0887
/pm-api-home/pm-api/src/main/java/com/heb/pm/core/service/CostLinkService.java
62f9bedc487d1c8777d9739c276115fabf99025d
[]
no_license
khoale22/pm-api
11a580ba3a82634f3dc7d8a0e7916a461d9d4f84
0f6dddbb78541fb8740185fef5c01ba11239dc83
refs/heads/master
2020-09-26T11:22:57.790522
2019-12-06T04:22:35
2019-12-06T04:22:35
226,244,772
0
0
null
null
null
null
UTF-8
Java
false
false
6,257
java
package com.heb.pm.core.service; import com.heb.pm.core.model.CostLink; import com.heb.pm.core.model.Item; import com.heb.pm.core.model.Supplier; import com.heb.pm.core.repository.CostLinkRepository; import com.heb.pm.core.repository.CostRepository; import com.heb.pm.core.repository.ItemMasterRepository; import com.heb.pm.dao.core.entity.DcmCostLink; import com.heb.pm.dao.core.entity.ItemMaster; import com.heb.pm.dao.core.entity.ItemMasterKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.List; import java.util.Objects; import java.util.Optional; /** * Contains business logic related to cost links. */ @Service public class CostLinkService { private static final Logger logger = LoggerFactory.getLogger(CostLinkService.class); private static final Long NO_COST_LINK = 0L; @Autowired private transient CostLinkRepository costLinkRepository; @Autowired private transient ItemService itemService; @Autowired private transient ItemMasterRepository itemMasterRepository; @Autowired private transient CostRepository costRepository; /** * Returns cost link information for a requested cost link number. Will return empty if that cost link is not found. * * @param costLinkNumber The cost link number to look for. * @return The cost link for a given number. */ public Optional<CostLink> getCostLinkById(Long costLinkNumber) { logger.debug(String.format("Searching for cost link %d", costLinkNumber)); if (Objects.isNull(costLinkNumber)) { return Optional.empty(); } return this.costLinkRepository.findById(costLinkNumber).map(this::dcmCostLinkToCostLink); } /** * Returns cost link information for a requested item code. Will return empty if that item does not exist * or is not part of a cost link or the cost link it is part of is not found. * * @param itemCode The item code to search for. * @return The cost link this item is part of. */ public Optional<CostLink> getCostLinkByItemCode(Long itemCode) { ItemMasterKey itemMasterKey = ItemMasterKey.of().setItemId(itemCode).setItemKeyTypeCode(ItemMasterKey.WAREHOUSE); Optional<ItemMaster> itemMaster = this.itemMasterRepository.findById(itemMasterKey); if (itemMaster.isEmpty()) { return Optional.empty(); } Optional<CostLink> toReturn = this.itemMasterToCostLink(itemMaster.get()); toReturn.ifPresent(costLink -> costLink.setSearchedItemCode(itemCode)); return toReturn; } /** * Converts an ItemMaster to a CostLink if possible. Will return empty if item is not tied to a cost link. * * @param im The ItemMaster to convert. * @return The converted CostLink. */ private Optional<CostLink> itemMasterToCostLink(ItemMaster im) { // Get the cost link number from the warehouse location item records. if (CollectionUtils.isEmpty(im.getWarehouseLocationItems())) { logger.info(String.format("Item %d has not matching warehouse location item records.", im.getKey().getItemId())); return Optional.empty(); } // See what the cost link number is of the item. If 0, then it's not part of a cost link. Long costLinkNumber = im.getWarehouseLocationItems().get(0).getCostLinkNumber(); if (NO_COST_LINK.equals(costLinkNumber)) { logger.info(String.format("Item %d is not part of a cost link.", im.getKey().getItemId())); return Optional.empty(); } // Since we have the number, we can use the other functions, just make sure to pull the info from the // item the user passed in rather than just selecting the first active item. return this.costLinkRepository.findById(costLinkNumber) .map((cl) -> this.overlayItem(cl, im)) .map(this::dcmCostLinkToCostLink); } /** * Adds a passed in item to the front of the list in a DcmCostLink. This is just so when they are searching by * item code so we can try the user's item first before going through the rest of the list.. * * @param dcmCostLink The DcmCostLink to add to. * @param im The item to add. * @return The modified DcmCostLink */ private DcmCostLink overlayItem(DcmCostLink dcmCostLink, ItemMaster im) { dcmCostLink.getItems().add(0, im); return dcmCostLink; } /** * Converts a DcmCostLink to a CostLink. * * @param dcmCostLink The DcmCostLink to convert. * @return The converted DcmCostLink. */ private CostLink dcmCostLinkToCostLink(DcmCostLink dcmCostLink) { Item representativeItem = this.getRepresentativeItem(dcmCostLink.getItems()).orElse(null); Supplier vendor = Supplier.of().setApNumber(dcmCostLink.getApNumber()) .setSupplierType(dcmCostLink.getApType().equalsIgnoreCase("AP") ? Supplier.WAREHOUSE : Supplier.DSD); CostLink costLink = CostLink.of().setCostLinkNumber(dcmCostLink.getCostLinkNumber()) .setDescription(dcmCostLink.getDescription()) .setActive(dcmCostLink.getActive()).setVendor(vendor) .setListCost(BigDecimal.valueOf(this.costRepository.getCurrentListCost(representativeItem.getItemCode(), dcmCostLink.getApNumber()))); if (Objects.nonNull(representativeItem)) { costLink.setCommodity(representativeItem.getCommodity()) .setPack(representativeItem.getContainedUpc().getPack()) .setRepresentativeItemCode(representativeItem.getItemCode()); } else { logger.warn(String.format("Cost link %d has no active items.", dcmCostLink.getCostLinkNumber())); } return costLink; } /** * Takes a list of ItemMasters and tries to find an active item to use to pull cost link information from. * * @param itemMasters The list of ItemMasters to look through. * @return An EntireCostLink if an active warehouse item is found and an empty optional otherwise. */ private Optional<Item> getRepresentativeItem(List<ItemMaster> itemMasters) { for (ItemMaster im : itemMasters) { if (im.getKey().isDsd() || im.isDiscontinued()) { continue; } Item item = this.itemService.itemMasterToItem(im); if (item.getMrt()) { logger.debug(String.format("Link contains MRT %d", im.getKey().getItemId())); } else { return Optional.of(item); } } return Optional.empty(); } }
[ "tran.than@heb.com" ]
tran.than@heb.com
ace413fa5731c4c79f2fdc6ce04125aca6a260f1
281c77b5b06b9f6156453ebc4a4a047cdcbbea2a
/src/main/java/org/raosantosh/algorithms/leetcode/string2/PermutationString.java
31e6b6fc50dea8136b15626e0f19099d16b989c6
[]
no_license
raosantosh/algorithms
ff05a76f5a938772442d1558140711986e60fd6d
3ea7b4b203c4391375023bcf853399654a0133a9
refs/heads/master
2021-01-19T08:39:51.157885
2018-12-06T21:51:30
2018-12-06T21:51:30
87,657,483
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package org.raosantosh.algorithms.leetcode.string2; /** * Created by s.rao on 3/28/18. * Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string. Example 1: Input:s1 = "ab" s2 = "eidbaooo" Output:True Explanation: s2 contains one permutation of s1 ("ba"). Example 2: Input:s1= "ab" s2 = "eidboaoo" Output: False Note: The input strings only contain lower case letters. The length of both given strings is in range [1, 10,000]. */ public class PermutationString { public boolean checkInclusion(String s1, String s2) { return false; } }
[ "s.rao@criteo.com" ]
s.rao@criteo.com
e277de6bb82cb5f01afe430b9ff0fd02b49d052c
6d65ef71f304c3414638714ef981108db4b0766f
/role/shiro/src/main/java/com/xsh/shiro/session/RedisSessionDao.java
3438821c28c971719cd78376e07d3a85d0be89c4
[]
no_license
xiaoshouhua/webtech
a50dbdf71d8af7be68a5319973f265fb9ff04a96
5034a48a27a9512c285820a766ed151a93fbe5db
refs/heads/master
2021-07-25T14:09:03.503338
2018-07-18T15:39:15
2018-07-18T15:39:15
130,066,484
2
0
null
null
null
null
UTF-8
Java
false
false
2,595
java
package com.xsh.shiro.session; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.util.Collection; import java.util.HashSet; import java.util.Set; import javax.annotation.Resource; import org.apache.commons.collections.CollectionUtils; import org.apache.shiro.session.Session; import org.apache.shiro.session.UnknownSessionException; import org.apache.shiro.session.mgt.eis.AbstractSessionDAO; import org.springframework.util.SerializationUtils; import com.xsh.shiro.util.JedisUtil; public class RedisSessionDao extends AbstractSessionDAO { @Resource(name="jedisUtil") private JedisUtil jedisUtil; private static final String SESSION_PREFIX="xsh:session:"; @Override public void update(Session session) throws UnknownSessionException { saveSession(session); } @Override public void delete(Session session) { if(null == session || session.getId() == null) { return; } byte[] sessionIdKey = getKey(session.getId()); jedisUtil.del(sessionIdKey); } @Override public Collection<Session> getActiveSessions() { Set<String> keys = jedisUtil.keys(SESSION_PREFIX); Set<Session> sessions = new HashSet<Session>(1); if(CollectionUtils.isEmpty(keys)) { return sessions; } for (String key : keys) { String sessionValue = jedisUtil.get(key); Session session = (Session) SerializationUtils.deserialize(sessionValue.getBytes()); sessions.add(session); } return sessions; } @Override protected Serializable doCreate(Session session) { Serializable sessionId = generateSessionId(session); assignSessionId(session, sessionId); saveSession(session); return sessionId; } @Override protected Session doReadSession(Serializable sessionId) { System.out.println("do ReadSession..."); if(null == sessionId) { return null; } byte[] sessionIdKey = getKey(sessionId); byte[] sessionValue = jedisUtil.get(sessionIdKey); if(null == sessionValue) { return null; } Session session = null; try { session = (Session) SerializationUtils.deserialize(sessionValue); } catch (Exception e) { e.printStackTrace(); } return session; } private void saveSession(Session session) { if(null != session && null != session.getId()) { byte[] sessionIdKey = getKey(session.getId()); try { jedisUtil.set(sessionIdKey,SerializationUtils.serialize(session)); jedisUtil.expire(sessionIdKey, 3600); } catch (Exception e) { e.printStackTrace(); } } } private byte[] getKey(Serializable sessionId) { return (SESSION_PREFIX + sessionId).getBytes(); } }
[ "xiaosohua@163.com" ]
xiaosohua@163.com
9ceeac38c8f1938358392e1968f4be515164a44a
d1e4f8456fd17025f2ce83ee3f37fc93680e13bd
/src/com/tom/utils/DataBase.java
e6dcb1c06f25ae0283b080f82e9c4c48e0a346d3
[]
no_license
fengruo/StudentBd
b61a0cc359e63704f039705323c49f43a3ab68c2
1104f3a6cf5ae695ec6d51644c83b01138f9204f
refs/heads/master
2021-07-24T09:54:54.572094
2017-11-03T13:49:54
2017-11-03T13:49:54
109,400,774
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.tom.utils; import java.sql.Connection; public class DataBase { public Connection Connection() { Connection conn=null; try { DBConnectionManager dbc=new DBConnectionManager(); conn=dbc.getConnection(); System.out.println("数据库连接成功"); } catch(Exception e) { e.printStackTrace(); System.out.println("数据库连接失败"); } return conn; } }
[ "1223424265@qq.com" ]
1223424265@qq.com
067f6f6bf205c7bf8f2332aabd184e0d0531f261
c8c280759855815c089499c1405a3f87f5f8003b
/src/main/java/com/prowo/config/KafkaTopicConfig.java
f3b8fbcd34ad09608ceafabe62fca01ef5153348
[]
no_license
sprowo/kafka-esper
2a8da4986f22ed81fc66bf9f3ba2ee36afec0d63
559bb8d8cfc1485c935ad769e41c27f127f0e029
refs/heads/master
2021-05-03T22:23:53.833418
2018-02-09T09:40:51
2018-02-09T09:40:51
120,392,969
0
0
null
null
null
null
UTF-8
Java
false
false
1,123
java
package com.prowo.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** * @author prowo * @date 2018/2/7 */ @Component @ConfigurationProperties(prefix = "topic") public class KafkaTopicConfig { private String marketing; private String sms; private String logon; private String register; private String test; public String getTest() { return test; } public void setTest(String test) { this.test = test; } public String getMarketing() { return marketing; } public void setMarketing(String marketing) { this.marketing = marketing; } public String getSms() { return sms; } public void setSms(String sms) { this.sms = sms; } public String getLogon() { return logon; } public void setLogon(String logon) { this.logon = logon; } public String getRegister() { return register; } public void setRegister(String register) { this.register = register; } }
[ "linan@f-road.com.cn" ]
linan@f-road.com.cn
eedeff5d21fc8aaee19c6db1c3884aec0e496dbd
96e9b393a7a214247bc36e1f20d044fbe53dfc1a
/src/com/zlf/imageloader/core/BitmapProcessor.java
f04a027c5d12b18bbe9e041d320a55acdc9ece3a
[]
no_license
yiforintapp/MyApp
1ab3f95d95d251a69b0887b01fdf2df0b2a6a1ba
85a5148162802dac56a2c9f60885b407fd102e1f
refs/heads/master
2020-05-21T20:09:37.017628
2017-04-12T05:54:56
2017-04-12T05:54:56
63,773,563
1
0
null
null
null
null
UTF-8
Java
false
false
1,679
java
/******************************************************************************* * Copyright 2011-2013 Sergey Tarasevich * * 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.zlf.imageloader.core; import android.graphics.Bitmap; import com.zlf.imageloader.DisplayImageOptions; /** * Makes some processing on {@link Bitmap}. Implementations can apply any changes to original {@link Bitmap}.<br /> * Implementations have to be thread-safe. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.8.0 */ public interface BitmapProcessor { /** * Makes some processing of incoming bitmap.<br /> * This method is executing on additional thread (not on UI thread).<br /> * <b>Note:</b> If this processor is used as {@linkplain DisplayImageOptions.Builder#preProcessor(BitmapProcessor) * pre-processor} then don't forget {@linkplain Bitmap#recycle() to recycle} incoming bitmap if you return a new * created one. * * @param bitmap Original {@linkplain Bitmap bitmap} * @return Processed {@linkplain Bitmap bitmap} */ Bitmap process(Bitmap bitmap); }
[ "313740752@qq.com" ]
313740752@qq.com
061d664fc95088b617c2323228eab1f6c4dab2be
1a32d704493deb99d3040646afbd0f6568d2c8e7
/BOOT-INF/lib/com/google/common/collect/AbstractIndexedListIterator.java
45b9823377e5d1447678f562ca2b37592200fc38
[]
no_license
yanrumei/bullet-zone-server-2.0
e748ff40f601792405143ec21d3f77aa4d34ce69
474c4d1a8172a114986d16e00f5752dc019cdcd2
refs/heads/master
2020-05-19T11:16:31.172482
2019-03-25T17:38:31
2019-03-25T17:38:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,584
java
/* */ package com.google.common.collect; /* */ /* */ import com.google.common.annotations.GwtCompatible; /* */ import com.google.common.base.Preconditions; /* */ import java.util.NoSuchElementException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @GwtCompatible /* */ abstract class AbstractIndexedListIterator<E> /* */ extends UnmodifiableListIterator<E> /* */ { /* */ private final int size; /* */ private int position; /* */ /* */ protected abstract E get(int paramInt); /* */ /* */ protected AbstractIndexedListIterator(int size) /* */ { /* 52 */ this(size, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected AbstractIndexedListIterator(int size, int position) /* */ { /* 67 */ Preconditions.checkPositionIndex(position, size); /* 68 */ this.size = size; /* 69 */ this.position = position; /* */ } /* */ /* */ public final boolean hasNext() /* */ { /* 74 */ return this.position < this.size; /* */ } /* */ /* */ public final E next() /* */ { /* 79 */ if (!hasNext()) { /* 80 */ throw new NoSuchElementException(); /* */ } /* 82 */ return (E)get(this.position++); /* */ } /* */ /* */ public final int nextIndex() /* */ { /* 87 */ return this.position; /* */ } /* */ /* */ public final boolean hasPrevious() /* */ { /* 92 */ return this.position > 0; /* */ } /* */ /* */ public final E previous() /* */ { /* 97 */ if (!hasPrevious()) { /* 98 */ throw new NoSuchElementException(); /* */ } /* 100 */ return (E)get(--this.position); /* */ } /* */ /* */ public final int previousIndex() /* */ { /* 105 */ return this.position - 1; /* */ } /* */ } /* Location: C:\Users\ikatwal\Downloads\bullet-zone-server-2.0.jar!\BOOT-INF\lib\guava-22.0.jar!\com\google\common\collect\AbstractIndexedListIterator.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
[ "ishankatwal@gmail.com" ]
ishankatwal@gmail.com
da285e0f4722a21635eae29b880a04067223cb9d
ce91a4dbf588b2648961831e0d54a93830163667
/src/main/java/com/xx/demo/service/HuserService.java
87877bc2ee62a647578b534bb40f04e8e47f2795
[]
no_license
xiaomexiao/-
b92cdc7d652c7564b920a9d185c0f75aabdd9d73
e6fd6c88c4b7b5d6e2f6d49d93a9e645f974fc6a
refs/heads/master
2022-12-14T02:26:39.629928
2019-09-02T00:49:30
2019-09-02T00:49:30
191,342,006
1
0
null
2022-12-06T00:32:07
2019-06-11T09:46:58
CSS
UTF-8
Java
false
false
355
java
package com.xx.demo.service; import com.xx.demo.entity.Huser; import com.baomidou.mybatisplus.service.IService; /** * <p> * 服务类 * </p> * * @author xiaoxiao * @since 2019-03-28 */ public interface HuserService extends IService<Huser> { /** * 后台登录 */ public String getLogin(Huser huser); }
[ "35020410+xiaomexiao@users.noreply.github.com" ]
35020410+xiaomexiao@users.noreply.github.com
6f16631b7e41fa50ff06e8762e3d89df29104311
d64252564d9a3b921f14b336effd11735e0a27ae
/COM220 - Programação Orientada a Objetos 1/Aula 6/exercicio 1/src/exercicio/veiculo/carro/Carro.java
042812c0fe8a0d1662a569eaf7f09180431597c2
[]
no_license
4rchitect/Graduacao
313969d38fc7509ff096718864abb89457a808ce
6e2dd9542b7fad44ffa7195d0d86a47b31cc140b
refs/heads/master
2021-01-13T00:38:16.481790
2015-10-21T16:20:12
2015-10-21T16:20:12
44,645,381
0
0
null
null
null
null
UTF-8
Java
false
false
1,628
java
package exercicio.veiculo.carro; import exercicio.veiculo.Veiculo; /** * * @author architect */ public class Carro extends Veiculo { protected Boolean malasCheio; /** * @param pMarca parametro marca do veículo * @param pCor parametro Cor do veículo * @param pMotorLigado parametro que recebe o estado inicial do motor * @param pMalasCheio parametro que recebe o estado inicial do porta malas */ public Carro(String pMarca, String pCor, Boolean pMotorLigado, Boolean pMalasCheio) { super(pMarca, pCor, pMotorLigado); malasCheio = pMalasCheio; } public void encheMala() { if(malasCheio) System.out.println("O porta malas já está cheio."); else { System.out.println("O porta malas acaba de ser cheio."); malasCheio = true; } } public void esvaziaMala() { if(!malasCheio) System.out.println("O porta malas já está vazia."); else { System.out.println("O porta malas acaba de ser esvaziado."); malasCheio = false; } } @Override public void mostrarAtributos() { System.out.println("Este é um veículo de marca "+marca+" de cor "+cor+"."); if(motorLigado) System.out.println("Seu motor está ligado."); else System.out.println("Seu motor está desligado."); if(malasCheio) System.out.println("Sua mala está cheia."); else System.out.println("Sua mala está vazia."); } }
[ "4rchitect.h@gmail.com" ]
4rchitect.h@gmail.com
22c0c83ed26c12f4c5978f24c27c92012ad23868
213e1c8bb26439e7f7ed7fbcb961a382012ff318
/src/main/java/br/com/CEF/Service/ClienteExternoService.java
f508716b488286e23ef3190c22a28921aa1d9f87
[]
no_license
Javoso/ProjetoCef
09a06084dea27210e63484c4b08dbc50517da1d2
09300834e829fb0ae33cb5ee65c79be23698027e
refs/heads/master
2022-11-08T08:33:20.053232
2022-10-05T03:27:43
2022-10-05T03:27:43
161,582,799
0
0
null
null
null
null
UTF-8
Java
false
false
629
java
package br.com.CEF.Service; import java.util.List; import javax.inject.Inject; import br.com.CEF.Dao.ClienteExternoDao; import br.com.CEF.Model.ClienteExterno; import br.com.CEF.util.jpa.Transacional; public class ClienteExternoService { @Inject private ClienteExternoDao dao; @Transacional public void salvar(ClienteExterno clienteExterno) { dao.salvar(clienteExterno); } @Transacional public void excluir(ClienteExterno clienteExterno) { dao.remover(clienteExterno); } public List<ClienteExterno> listAll() { return dao.listAll(); } public ClienteExterno porId(Long id) { return dao.porId(id); } }
[ "lucasqueirozqxd@gmail.com" ]
lucasqueirozqxd@gmail.com
6f3bcc843bb13374ef9da5fe08a91eee55ab28ae
2adb0d68958c32e40f634ff75c9e233768db54de
/src/main/java/com/hebaohua/netease/controller/ProductController.java
ed23b749fb380506886dc6112ab23b35d21eea29
[]
no_license
Acamy/Easemall
6b0fad5f0d5cbfe06eccd61bccea7759649fe10b
9c1dbdcd9e80d7d133ea433fdcb2e45899a3c5fa
refs/heads/master
2021-05-02T03:45:03.783470
2018-03-23T06:48:06
2018-03-23T06:48:06
120,903,791
0
1
null
null
null
null
UTF-8
Java
false
false
4,194
java
package com.hebaohua.netease.controller; import com.hebaohua.netease.entity.Order; import com.hebaohua.netease.entity.Product; import com.hebaohua.netease.entity.User; import com.hebaohua.netease.service.OrderService; import com.hebaohua.netease.service.ProductService; import com.hebaohua.netease.util.FileUploadUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.List; /** * @author Hebh * @date 2018/2/8 * @description: */ @Controller public class ProductController { @Autowired private ProductService productService; @Autowired private OrderService orderService; @RequestMapping("/public") public String publicProduct(ModelMap map){ return "public"; } @RequestMapping("/publicSubmit") public String publicSubmit(@RequestParam(value = "imgFile", required = false) MultipartFile file, HttpServletRequest request, ModelMap map){ Product product = new Product(); if(file == null || file.isEmpty() || file.getSize() < 1){ product.setProdImgUrl(request.getParameter("image")); }else{ String path = FileUploadUtil.getFileInfo(request, file); product.setProdImgUrl(path); } product.setProdTitle(request.getParameter("title")); product.setProdSummary(request.getParameter("summary")); product.setProdDetail(request.getParameter("detail")); product.setProdPrice(Double.valueOf(request.getParameter("price"))); productService.insertProd(product); List<Product> products= productService.listProducts(); map.addAttribute("productList", products); return "index"; } @RequestMapping("/show") public String showProduct(@RequestParam("id") int prodId, HttpSession session, ModelMap map){ Product product = productService.selectProdById(prodId); map.put("product", product); User user = (User)session.getAttribute("user"); if( user!=null) { List<Order> orders = orderService.listOrdersByUserId(user.getUserId()); for (Order order : orders){ if(order.getProdId() == prodId){ map.put("productBuyPrice", order.getProdPrice()); } } } return "show"; } @RequestMapping("/edit") public String editProduct(@RequestParam("id") int prodId, ModelMap map){ Product product = productService.selectProdById(prodId); map.put("product", product); return "edit"; } @RequestMapping("/editSubmit") public String editSubmitProduct(@RequestParam("id") int prodId, @RequestParam(value = "imgFile", required = false) MultipartFile file, HttpServletRequest request, ModelMap map){ Product product = new Product(); product.setProdId(prodId); if(file == null || file.isEmpty() || file.getSize() < 1){ product.setProdImgUrl(request.getParameter("image")); }else{ String path = FileUploadUtil.getFileInfo(request, file); product.setProdImgUrl(path); } product.setProdTitle(request.getParameter("title")); product.setProdSummary(request.getParameter("summary")); product.setProdDetail(request.getParameter("detail")); product.setProdPrice(Double.valueOf(request.getParameter("price"))); productService.updateProduct(product); map.put("product", product); return "editSubmit"; } @RequestMapping("/delete") public void delete(@RequestParam("id") int id, ModelMap map){ productService.deleteByProdId(id); map.addAttribute("result", true); map.addAttribute("code", 200); } }
[ "hebaohua@hust.edu.cn" ]
hebaohua@hust.edu.cn
95c7a979688fc671b1183ae51758fbbe0b82ceb4
49c7ad51bce9914aba3d1dbc1d888e4e98003c59
/src/main/java/com/company/rabbitmqconfig/MessagingApplication.java
0a2100d1904c403d2bedc83be2b1fe51c2657888
[]
no_license
sac10nikam/spring-boot-amqp-messaging-sample
e53e87772bc3d89494d72567827b9acf341c59f7
a1837d48fb90672c5363bcd2ac5a4aa72a29531f
refs/heads/master
2022-11-24T09:32:19.360175
2019-08-26T07:21:52
2019-08-26T07:21:52
204,417,917
1
0
null
2022-11-16T11:53:58
2019-08-26T07:13:18
Java
UTF-8
Java
false
false
3,582
java
package com.company.rabbitmqconfig; import static com.company.rabbitmqconfig.MessagingConstants.DIRECT_EXCHANGE_NAME; import static com.company.rabbitmqconfig.MessagingConstants.DIRECT_QUEUE_GENERIC_NAME; import static com.company.rabbitmqconfig.MessagingConstants.EXCHANGE_NAME; import static com.company.rabbitmqconfig.MessagingConstants.FANOUT_EXCHANGE_NAME; import static com.company.rabbitmqconfig.MessagingConstants.FANOUT_QUEUE_GENERIC_NAME; import static com.company.rabbitmqconfig.MessagingConstants.QUEUE_GENERIC_NAME; import static com.company.rabbitmqconfig.MessagingConstants.QUEUE_SPECIFIC_NAME; import static com.company.rabbitmqconfig.MessagingConstants.ROUTING_KEY; import org.springframework.amqp.core.Binding; import org.springframework.amqp.core.BindingBuilder; import org.springframework.amqp.core.DirectExchange; import org.springframework.amqp.core.FanoutExchange; import org.springframework.amqp.core.Queue; import org.springframework.amqp.core.TopicExchange; import org.springframework.amqp.rabbit.annotation.EnableRabbit; import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @EnableScheduling @EnableRabbit public class MessagingApplication { public static void main(String[] args) { SpringApplication.run(MessagingApplication.class, args); } @Bean public TopicExchange appExchange() { return new TopicExchange(EXCHANGE_NAME.getValue()); } @Bean public FanoutExchange appFanoutExchange() { return new FanoutExchange(FANOUT_EXCHANGE_NAME.getValue()); } @Bean public DirectExchange appDirectExchange() { return new DirectExchange(DIRECT_EXCHANGE_NAME.getValue()); } @Bean public Queue appQueueGeneric() { return new Queue(QUEUE_GENERIC_NAME.getValue()); } @Bean public Queue appQueueSpecific() { return new Queue(QUEUE_SPECIFIC_NAME.getValue()); } @Bean public Queue appFanoutQueueGeneric() { return new Queue(FANOUT_QUEUE_GENERIC_NAME.getValue()); } @Bean public Queue appDirectQueueGeneric() { return new Queue(DIRECT_QUEUE_GENERIC_NAME.getValue()); } @Bean public Binding declareBindingGeneric() { return BindingBuilder.bind(appQueueGeneric()).to(appExchange()) .with(ROUTING_KEY.getValue()); } @Bean public Binding declareBindingSpecific() { return BindingBuilder.bind(appQueueSpecific()).to(appExchange()) .with(ROUTING_KEY.getValue()); } @Bean public Binding declareDirectBindingGeneric() { return BindingBuilder.bind(appDirectQueueGeneric()).to(appDirectExchange()) .with(ROUTING_KEY.getValue()); } @Bean public Binding declareFanoutBindingGeneric() { return BindingBuilder.bind(appFanoutQueueGeneric()).to(appFanoutExchange()); } // You can comment the two methods below to use the default serialization / // de-serialization (instead of JSON) @Bean public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) { RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory); rabbitTemplate.setMessageConverter(producerJackson2MessageConverter()); return rabbitTemplate; } @Bean public Jackson2JsonMessageConverter producerJackson2MessageConverter() { return new Jackson2JsonMessageConverter(); } }
[ "sac10nikam@gmail.com" ]
sac10nikam@gmail.com
5d5e84daaa2ce7c707ff45cdc0da3430ad80ae0b
b0be4ac4772e286794ad5f5432c30c852a6d07d9
/src/main/java/com/rabbitmq/quickstart/Producer.java
fa9b630dcd155acb839eff9d537e7ebadecb29b4
[]
no_license
zhaizhipeng/rabbitmq-learn
f8214cb82389ad7f7dbfe2633bd73201d46e1d54
da18ea92b97f7a2022dee33567377a9aa3d39c29
refs/heads/master
2020-08-22T19:49:33.056250
2019-10-24T08:28:19
2019-10-24T08:28:19
216,467,678
0
0
null
null
null
null
UTF-8
Java
false
false
1,371
java
package com.rabbitmq.quickstart; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; public class Producer { public static void main(String[] args) throws Exception { //1.创建一个ConnectionFactory并进行配置 ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("localhost"); connectionFactory.setPort(5672); connectionFactory.setVirtualHost("/"); connectionFactory.setHandshakeTimeout(20000); //2.通过连接工厂创建连接 Connection connection = connectionFactory.newConnection(); //3.通过Connection创建一个Channel Channel channel = connection.createChannel(); /** * basicPublish(String exchange, String routingKey, BasicProperties props, byte[] body) * exchange:指定交换机 不指定 则默认(AMQP default交换机) 通过routingkey进行匹配 * props 消息属性 * body 消息体 */ for(int i = 0; i < 5; i++){ String msg = "Hello RabbitMQ" + i; //4.通过Channel发送数据 channel.basicPublish("", "test", null, msg.getBytes()); } //5.记得关闭相关的连接 channel.close(); connection.close(); } }
[ "zhaizhipeng@extracme.com" ]
zhaizhipeng@extracme.com
d773fbecb8784d527af614706cbf436b54eba2dd
70d800f67223f83ec583a6aae64fdb4d8fc157e5
/java/chat/src/main/java/cn/dave/utils/http/HttpServer.java
fe6e2d96dc224b4a5d75c439f00f06b29dec07d5
[]
no_license
DaveZhang1216/share
d480ee906a80f065f93301cf04a352ccd1a86538
b5b5b4fb2608289df5fee9e07a87fa88401cfc42
refs/heads/master
2020-09-04T01:23:54.244217
2019-11-08T02:25:33
2019-11-08T02:25:33
219,481,498
1
0
null
null
null
null
UTF-8
Java
false
false
4,694
java
package cn.dave.utils.http; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.alibaba.fastjson.JSONObject; import cn.dave.chat.manager.Config; import cn.dave.utils.CMD; import cn.zhouyafeng.itchat4j.api.WechatTools; public class HttpServer { private static Logger logger = LoggerFactory.getLogger(HttpServer.class); private static String ip;//自身ip private static int port;//需要配置映射关系 private static HttpServer httpServer = null; public static HttpServer createSingleton(String ip, int port) { if(httpServer == null) { HttpServer.ip = ip; HttpServer.port = port; httpServer = new HttpServer(); } return httpServer; } public static HttpServer getSingleton() { return httpServer; } private HttpServer() { } public String getIp() { return ip; } public int getPort() { return port; } private String getInfoByIp(String ip) { return CMD.runPython("E:\\wechat\\python\\query.py", "ip "+ip); } public void startSimpleHttpServer() { try { /*监听端口号,只要是8888就能接收到*/ ServerSocket ss = new ServerSocket(80); while (true) { /*实例化客户端,固定套路,通过服务端接受的对象,生成相应的客户端实例*/ Socket socket = ss.accept(); /*获取客户端输入流,就是请求过来的基本信息:请求头,换行符,请求体*/ BufferedReader bd = new BufferedReader(new InputStreamReader(socket.getInputStream())); /** * 接受HTTP请求,并解析数据 */ String requestHeader; while ((requestHeader = bd.readLine()) != null && !requestHeader.isEmpty()) { /** * 获得GET参数 */ if (requestHeader.startsWith("GET")) { int begin = requestHeader.indexOf("/toupiao/") + 1; if(begin >0) { int end = requestHeader.indexOf("HTTP/"); String url = requestHeader.substring(begin, end); String[] split = url.split("/"); if(split.length==2) { String userName = split[1]; int indexOf = userName.indexOf("?"); if(indexOf >0) { userName = userName.substring(0,indexOf); } List<JSONObject> contactList = WechatTools.getContactList(); String infor = ""; for(JSONObject jsonObject : contactList) { if(jsonObject.getString("UserName").equals(userName)) { //找到了NickName infor = "nickName = "+ jsonObject.getString("NickName"); WechatTools.sendMsgByUserName("谢谢..... ", userName); } } if(infor.isEmpty()) { infor = "userName = "+userName; } String ipInfo = getInfoByIp(socket.getInetAddress().getHostAddress()); if(ipInfo.equals("None")) { String info = infor + "\r\n"+"ip: "+socket.getInetAddress().getHostAddress(); WechatTools.sendMsgByUserName(info, Config.getSingleton().getSelfUserName()); }else { String info = infor + "\r\n"+"info = "+ ipInfo; WechatTools.sendMsgByUserName(info, Config.getSingleton().getSelfUserName()); } } } } } /*发送回执*/ PrintWriter pw = new PrintWriter(socket.getOutputStream()); pw.println("HTTP/1.1 200 OK"); pw.println("Content-type:text/html;charset=UTF-8"); pw.println(); pw.println("<h1> 感谢您 , 珍贵的一票 </h1>"); pw.flush(); socket.close(); } } catch (IOException e) { e.printStackTrace(); } } }
[ "609377685@qq.com" ]
609377685@qq.com
c58712577d6888105bb67fb02b9b1d5e5e995b75
6ade397a6ef8014d2101dddd1342572593c455c1
/common/src/main/java/edu/jennifer/common/AppUtil.java
f52f4466b743f93ede248b7a969a1b98cc58114e
[]
no_license
JENNIFER-University/IHotel
ea4c676d7ac5fcbe0ebc3068e7f74030aa8a0e8a
47db24fb2b66e8d69682755f01f7663aeb9f9535
refs/heads/master
2022-07-05T07:46:30.488407
2019-07-01T06:32:43
2019-07-01T06:32:43
129,357,576
0
0
null
2022-06-21T01:22:10
2018-04-13T06:21:32
Java
UTF-8
Java
false
false
2,217
java
package edu.jennifer.common; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Random; /** * @author Khalid * @Created 7/24/18 12:08 PM. */ public class AppUtil { private final static Random RANDOM = new Random(); private static final SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); /** * Get Random number * @param low * @param high * @return */ public static int getRandom(int low,int high){ high++; int max = high - low; int value = Math.abs(RANDOM.nextInt()) % max; return value + low; } /** * Get Random Number * @param bound * @return */ public static int getRandomBounded(int bound) { return RANDOM.nextInt(bound); } /** * Add N days to current date and get result as formatted string (MM/dd/yyyy) * @param addedDays additional days to be added to TODAY * @return */ public static String addDaysAndGetDateFormatted(int addedDays) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, addedDays); return sdf.format(calendar.getTime()); } /** * Current Timestamp as string * @return */ public static String getCurrentTimeStamp(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); return sdf.format(new Date()); } /** * Return current date as String (yyyy-MM-dd) * @return */ public static String getCurrentDateAsString(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(new Date()); } /** * Create Random Name * @return */ public static String getRandomName(){ String[] firstName = {"Khalid","David","Alex","Sami","Sally","Dana","Chris","Chalse","Albert"}; String[] lastName = {"Zhang","Robert","Saeed","Andy","Justin","Craig","Grant","Bert","Lester"}; int firstNameIndex = (int) (Math.random() * firstName.length); int lastNameIndex = (int) (Math.random() * lastName.length); return firstName[firstNameIndex] + " " + lastName[lastNameIndex]; } }
[ "abolkog@gmail.com" ]
abolkog@gmail.com
8438ad963b2881a647e5c5e423b8eaac828654b8
6f35d03e61412653b10eb7e5a769fcccb534bdef
/src/H11/Opdracht8.java
2d68532ce168719f80bf4c4c5ca69af2bfeb03d1
[]
no_license
MarkBout/inleiding-java
76060bb50cc55cd7af40022fc9279756121fca75
9ca29d2ff2b24902f07baabc5e6c64ea32ee3d88
refs/heads/master
2020-07-16T13:09:36.301735
2019-10-09T09:05:36
2019-10-09T09:05:36
205,795,108
0
0
null
2019-09-02T06:55:48
2019-09-02T06:55:48
null
UTF-8
Java
false
false
415
java
package H11; import java.awt.*; import java.applet.*; public class Opdracht8 extends Applet{ public void init() { setSize(800,800); } public void paint(Graphics g) { int teller; int lengte, breete; lengte = 20; breete = 20; for (teller = 0; teller < 100; teller++) { g.drawOval(40,10,lengte,breete); lengte += 10; breete += 10; } } }
[ "mbout.roc-dev.com" ]
mbout.roc-dev.com
89ad067b394c5107f885a6d2672491cb3d7c42bc
75950d61f2e7517f3fe4c32f0109b203d41466bf
/modules/tags/fabric3-modules-parent-pom-1.7/extension/implementation/fabric3-web/src/main/java/org/fabric3/implementation/web/runtime/ServletContextInjector.java
776c3a079dbf75eb86856f203a2a1826a5f8fd33
[]
no_license
codehaus/fabric3
3677d558dca066fb58845db5b0ad73d951acf880
491ff9ddaff6cb47cbb4452e4ddbf715314cd340
refs/heads/master
2023-07-20T00:34:33.992727
2012-10-31T16:32:19
2012-10-31T16:32:19
36,338,853
0
0
null
null
null
null
UTF-8
Java
false
false
2,857
java
/* * Fabric3 * Copyright (c) 2009-2011 Metaform Systems * * Fabric3 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version, with the * following exception: * * Linking this software statically or dynamically with other * modules is making a combined work based on this software. * Thus, the terms and conditions of the GNU General Public * License cover the whole combination. * * As a special exception, the copyright holders of this software * give you permission to link this software with independent * modules to produce an executable, regardless of the license * terms of these independent modules, and to copy and distribute * the resulting executable under terms of your choice, provided * that you also meet, for each linked independent module, the * terms and conditions of the license of that module. An * independent module is a module which is not derived from or * based on this software. If you modify this software, you may * extend this exception to your version of the software, but * you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * * Fabric3 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the * GNU General Public License along with Fabric3. * If not, see <http://www.gnu.org/licenses/>. */ package org.fabric3.implementation.web.runtime; import javax.servlet.ServletContext; import org.fabric3.implementation.pojo.injection.MultiplicityObjectFactory; import org.fabric3.spi.objectfactory.Injector; import org.fabric3.spi.objectfactory.ObjectCreationException; import org.fabric3.spi.objectfactory.ObjectFactory; /** * Injects objects (reference proxies, properties, contexts) into a ServletContext. * * @version $Rev$ $Date$ */ public class ServletContextInjector implements Injector<ServletContext> { private ObjectFactory<?> objectFactory; private String key; public void inject(ServletContext context) throws ObjectCreationException { context.setAttribute(key, objectFactory.getInstance()); } public void setObjectFactory(ObjectFactory<?> objectFactory, Object key) { this.objectFactory = objectFactory; this.key = key.toString(); } public void clearObjectFactory() { if (this.objectFactory instanceof MultiplicityObjectFactory<?>) { ((MultiplicityObjectFactory<?>) this.objectFactory).clear(); } else { objectFactory = null; key = null; } } }
[ "jmarino@83866bfc-822f-0410-aa35-bd5043b85eaf" ]
jmarino@83866bfc-822f-0410-aa35-bd5043b85eaf
4ce5ed776aecf7eef55f8bae5498cba22c104852
c2929b641ae2d470bf36bf0948f358e44e1bc60c
/Street_View_Base/lib/metadata-extractor-2.8.0/Tests/com/drew/metadata/icc/IccReaderTest.java
214ea478079c5867bc368e77a42a234a54aa8abf
[ "Apache-2.0" ]
permissive
bhishekarora/streetview
526b0895115079418c4df88f635a065dbab1f26d
3140a94a83fade12853a6a05b965127d50ad8dae
refs/heads/master
2023-01-03T01:25:05.029339
2020-04-25T14:30:01
2020-04-25T14:30:01
31,860,701
0
0
null
2020-10-13T21:29:37
2015-03-08T18:38:13
Java
UTF-8
Java
false
false
1,705
java
/* * Copyright 2002-2015 Drew Noakes * * 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. * * More information about this project is available at: * * https://drewnoakes.com/code/exif/ * https://github.com/drewnoakes/metadata-extractor */ package com.drew.metadata.icc; import com.drew.lang.ByteArrayReader; import com.drew.metadata.Metadata; import com.drew.testing.TestHelper; import com.drew.tools.FileUtil; import org.junit.Test; import static org.junit.Assert.assertNotNull; public class IccReaderTest { @Test public void testExtract() throws Exception { byte[] app2Bytes = FileUtil.readBytes("Tests/Data/iccDataInvalid1.jpg.app2"); // ICC data starts after a 14-byte preamble byte[] icc = TestHelper.skipBytes(app2Bytes, 14); Metadata metadata = new Metadata(); new IccReader().extract(new ByteArrayReader(icc), metadata); IccDirectory directory = metadata.getFirstDirectoryOfType(IccDirectory.class); assertNotNull(directory); // TODO validate expected values // for (Tag tag : directory.getTags()) { // System.out.println(tag); // } } }
[ "faridabad.abhishe@gmail.com" ]
faridabad.abhishe@gmail.com
0e77cf3559342cf1fd22e676070b5ace39fdb869
8b122f1e6d77d316ad8986395dbb8f4cab498270
/TitledBorderHorizontalInsetOfText/src/java/example/TitledBorder2.java
0e6f0daedac00d2d4fd7cf7b8d43361d457b6a09
[ "MIT" ]
permissive
IdelsTak/java-swing-tips
2bc49b526ed9a4d85e54df68e0d010f5a66e5dcf
6276b9b61ee275525a2c94600e6ecdc6abba6ca8
refs/heads/master
2020-07-06T18:07:25.962570
2019-08-18T15:04:50
2019-08-18T15:04:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,967
java
// -*- mode:java; encoding:utf-8 -*- // vim:set fileencoding=utf-8: /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package example; import java.awt.*; import java.awt.geom.Path2D; import java.util.Objects; import javax.swing.*; import javax.swing.border.AbstractBorder; import javax.swing.border.Border; import javax.swing.plaf.basic.BasicHTML; /** * A class which implements an arbitrary border * with the addition of a String title in a * specified position and justification. * * <p>If the border, font, or color property values are not * specified in the constructor or by invoking the appropriate * set methods, the property values will be defined by the current * look and feel, using the following property names in the * Defaults Table: * <ul> * <li>&quot;TitledBorder.border&quot; * <li>&quot;TitledBorder.font&quot; * <li>&quot;TitledBorder.titleColor&quot; * </ul> * * <p><strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author David Kloba * @author Amy Fowler */ @SuppressWarnings({"PMD.GodClass", "PMD.CyclomaticComplexity", "HiddenField"}) public class TitledBorder2 extends AbstractBorder { // @see javax/swing/border/TitledBorder.java private String title; private Border border; private int titlePosition; private int titleJustification; private Font titleFont; private Color titleColor; private final JLabel label; /** * Use the default vertical orientation for the title text. */ public static final int DEFAULT_POSITION = 0; /** Position the title above the border's top line. */ public static final int ABOVE_TOP = 1; /** Position the title in the middle of the border's top line. */ public static final int TOP = 2; /** Position the title below the border's top line. */ public static final int BELOW_TOP = 3; /** Position the title above the border's bottom line. */ public static final int ABOVE_BOTTOM = 4; /** Position the title in the middle of the border's bottom line. */ public static final int BOTTOM = 5; /** Position the title below the border's bottom line. */ public static final int BELOW_BOTTOM = 6; /** * Use the default justification for the title text. */ public static final int DEFAULT_JUSTIFICATION = 0; /** Position title text at the left side of the border line. */ public static final int LEFT = 1; /** Position title text in the center of the border line. */ public static final int CENTER = 2; /** Position title text at the right side of the border line. */ public static final int RIGHT = 3; /** Position title text at the left side of the border line * for left to right orientation, at the right side of the * border line for right to left orientation. */ public static final int LEADING = 4; /** Position title text at the right side of the border line * for left to right orientation, at the left side of the * border line for right to left orientation. */ public static final int TRAILING = 5; // Space between the border and the component's edge protected static final int EDGE_SPACING = 2; // 2; // Space between the border and text protected static final int TEXT_SPACING = 5; // 2; // Horizontal inset of text that is left or right justified protected static final int TEXT_INSET_H = 10; // 5; /** * Creates a TitledBorder instance. * * @param title the title the border should display */ public TitledBorder2(String title) { this(null, title, LEADING, DEFAULT_POSITION, null, null); } /** * Creates a TitledBorder instance with the specified border * and an empty title. * * @param border the border */ public TitledBorder2(Border border) { this(border, "", LEADING, DEFAULT_POSITION, null, null); } /** * Creates a TitledBorder instance with the specified border * and title. * * @param border the border * @param title the title the border should display */ public TitledBorder2(Border border, String title) { this(border, title, LEADING, DEFAULT_POSITION, null, null); } /** * Creates a TitledBorder instance with the specified border, * title, title-justification, and title-position. * * @param border the border * @param title the title the border should display * @param titleJustification the justification for the title * @param titlePosition the position for the title */ public TitledBorder2(Border border, String title, int titleJustification, int titlePosition) { this(border, title, titleJustification, titlePosition, null, null); } /** * Creates a TitledBorder instance with the specified border, * title, title-justification, title-position, and title-font. * * @param border the border * @param title the title the border should display * @param titleJustification the justification for the title * @param titlePosition the position for the title * @param titleFont the font for rendering the title */ public TitledBorder2(Border border, String title, int titleJustification, int titlePosition, Font titleFont) { this(border, title, titleJustification, titlePosition, titleFont, null); } /** * Creates a TitledBorder instance with the specified border, * title, title-justification, title-position, title-font, and * title-color. * * @param border the border * @param title the title the border should display * @param titleJustification the justification for the title * @param titlePosition the position for the title * @param titleFont the font of the title * @param titleColor the color of the title */ // @ConstructorProperties({"border", "title", "titleJustification", "titlePosition", "titleFont", "titleColor"}) @SuppressWarnings("checkstyle:linelength") public TitledBorder2(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor) { super(); this.title = title; this.border = border; this.titleFont = titleFont; this.titleColor = titleColor; setTitleJustification(titleJustification); setTitlePosition(titlePosition); this.label = new JLabel(); this.label.setOpaque(false); this.label.putClientProperty(BasicHTML.propertyKey, null); } /** * Paints the border for the specified component with the * specified position and size. * @param c the component for which this border is being painted * @param g the paint graphics * @param x the x position of the painted border * @param y the y position of the painted border * @param width the width of the painted border * @param height the height of the painted border */ @SuppressWarnings({"PMD.NPathComplexity", "PMD.ExcessiveMethodLength", "PMD.ConfusingTernary", "checkstyle:linelength"}) @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Border border = getBorder(); String title = getTitle(); if (Objects.nonNull(title) && !title.isEmpty()) { int edge = border instanceof TitledBorder2 ? 0 : EDGE_SPACING; JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); Insets insets = makeBorderInsets(border, c, new Insets(0, 0, 0, 0)); int borderX = x + edge; int borderY = y + edge; int borderW = width - edge - edge; int borderH = height - edge - edge; int labelY = y; int labelH = size.height; int position = getPosition(); switch (position) { case ABOVE_TOP: insets.left = 0; insets.right = 0; borderY += labelH - edge; borderH -= labelH - edge; break; case TOP: insets.top = edge + insets.top / 2 - labelH / 2; if (insets.top < edge) { borderY -= insets.top; borderH += insets.top; } else { labelY += insets.top; } break; case BELOW_TOP: labelY += insets.top + edge; break; case ABOVE_BOTTOM: labelY += height - labelH - insets.bottom - edge; break; case BOTTOM: labelY += height - labelH; insets.bottom = edge + (insets.bottom - labelH) / 2; if (insets.bottom < edge) { borderH += insets.bottom; } else { labelY -= insets.bottom; } break; case BELOW_BOTTOM: insets.left = 0; insets.right = 0; labelY += height - labelH; borderH -= labelH - edge; break; default: // will NOT execute because of the line preceding the switch. } insets.left += edge + TEXT_INSET_H; insets.right += edge + TEXT_INSET_H; int labelX = x; int labelW = width - insets.left - insets.right; if (labelW > size.width) { labelW = size.width; } switch (getJustification(c)) { case LEFT: labelX += insets.left; break; case RIGHT: labelX += width - insets.right - labelW; break; case CENTER: labelX += (width - labelW) / 2; break; default: // will NOT execute because of the line preceding the switch. } if (Objects.nonNull(border)) { if (position != TOP && position != BOTTOM) { border.paintBorder(c, g, borderX, borderY, borderW, borderH); } else { Path2D path = new Path2D.Float(); path.append(new Rectangle(borderX, borderY, borderW, labelY - borderY), false); path.append(new Rectangle(borderX, labelY, labelX - borderX - TEXT_SPACING, labelH), false); path.append(new Rectangle(labelX + labelW + TEXT_SPACING, labelY, borderX - labelX + borderW - labelW - TEXT_SPACING, labelH), false); path.append(new Rectangle(borderX, labelY + labelH, borderW, borderY - labelY + borderH - labelH), false); Graphics2D g2 = (Graphics2D) g.create(); g2.clip(path); border.paintBorder(c, g2, borderX, borderY, borderW, borderH); g2.dispose(); } } g.translate(labelX, labelY); label.setSize(labelW, labelH); label.paint(g); g.translate(-labelX, -labelY); } else if (Objects.nonNull(border)) { border.paintBorder(c, g, x, y, width, height); } } /** * Reinitialize the insets parameter with this Border's current Insets. * @param c the component for which this border insets value applies * @param insets the object to be reinitialized */ @SuppressWarnings("PMD.AvoidReassigningParameters") @Override public Insets getBorderInsets(Component c, Insets insets) { Border border = getBorder(); insets = makeBorderInsets(border, c, insets); String title = getTitle(); if (Objects.nonNull(title) && !title.isEmpty()) { int edge = border instanceof TitledBorder2 ? 0 : EDGE_SPACING; JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); switch (getPosition()) { case ABOVE_TOP: insets.top += size.height - edge; break; case TOP: if (insets.top < size.height) { insets.top = size.height - edge; } break; case BELOW_TOP: insets.top += size.height; break; case ABOVE_BOTTOM: insets.bottom += size.height; break; case BOTTOM: if (insets.bottom < size.height) { insets.bottom = size.height - edge; } break; case BELOW_BOTTOM: insets.bottom += size.height - edge; break; default: // will NOT execute because of the line preceding the switch. } insets.top += edge + TEXT_SPACING; insets.left += edge + TEXT_SPACING; insets.right += edge + TEXT_SPACING; insets.bottom += edge + TEXT_SPACING; } return insets; } /** * Returns whether or not the border is opaque. */ @Override public boolean isBorderOpaque() { return false; } /** * Returns the title of the titled border. * * @return the title of the titled border */ public String getTitle() { return title; } /** * Returns the border of the titled border. * * @return the border of the titled border */ public Border getBorder() { return Objects.nonNull(border) ? border : UIManager.getBorder("TitledBorder.border"); } /** * Returns the title-position of the titled border. * * @return the title-position of the titled border */ public int getTitlePosition() { return titlePosition; } /** * Returns the title-justification of the titled border. * * @return the title-justification of the titled border */ public int getTitleJustification() { return titleJustification; } /** * Returns the title-font of the titled border. * * @return the title-font of the titled border */ public Font getTitleFont() { return Objects.isNull(titleFont) ? UIManager.getFont("TitledBorder.font") : titleFont; } /** * Returns the title-color of the titled border. * * @return the title-color of the titled border */ public Color getTitleColor() { return Objects.isNull(titleColor) ? UIManager.getColor("TitledBorder.titleColor") : titleColor; } // REMIND(aim): remove all or some of these set methods? /** * Sets the title of the titled border. * @param title the title for the border */ public void setTitle(String title) { this.title = title; } /** * Sets the border of the titled border. * @param border the border */ public void setBorder(Border border) { this.border = border; } /** * Sets the title-position of the titled border. * @param titlePosition the position for the border */ public void setTitlePosition(int titlePosition) { switch (titlePosition) { case ABOVE_TOP: case TOP: case BELOW_TOP: case ABOVE_BOTTOM: case BOTTOM: case BELOW_BOTTOM: case DEFAULT_POSITION: this.titlePosition = titlePosition; break; default: throw new IllegalArgumentException(titlePosition + " is not a valid title position."); } } /** * Sets the title-justification of the titled border. * @param titleJustification the justification for the border */ public void setTitleJustification(int titleJustification) { switch (titleJustification) { case DEFAULT_JUSTIFICATION: case LEFT: case CENTER: case RIGHT: case LEADING: case TRAILING: this.titleJustification = titleJustification; break; default: throw new IllegalArgumentException(titleJustification + " is not a valid title justification."); } } /** * Sets the title-font of the titled border. * @param titleFont the font for the border title */ public void setTitleFont(Font titleFont) { this.titleFont = titleFont; } /** * Sets the title-color of the titled border. * @param titleColor the color for the border title */ public void setTitleColor(Color titleColor) { this.titleColor = titleColor; } /** * Returns the minimum dimensions this border requires * in order to fully display the border and title. * @param c the component where this border will be drawn * @return the {@code Dimension} object */ @SuppressWarnings("PMD.ConfusingTernary") public Dimension getMinimumSize(Component c) { Insets insets = getBorderInsets(c); Dimension minSize = new Dimension(insets.right + insets.left, insets.top + insets.bottom); String title = getTitle(); if (Objects.nonNull(title) && !title.isEmpty()) { JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); int position = getPosition(); if (position != ABOVE_TOP && position != BELOW_BOTTOM) { minSize.width += size.width; } else if (minSize.width < size.width) { minSize.width += size.width; } } return minSize; } /** * Returns the baseline. * * @throws NullPointerException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc} * @see javax.swing.JComponent#getBaseline(int, int) * @since 1.6 */ @Override public int getBaseline(Component c, int width, int height) { Objects.requireNonNull(c, "Must supply non-null component"); if (width < 0) { throw new IllegalArgumentException("Width must be >= 0"); } if (height < 0) { throw new IllegalArgumentException("Height must be >= 0"); } Border border = getBorder(); String title = getTitle(); if (Objects.nonNull(title) && !title.isEmpty()) { int edge = border instanceof TitledBorder2 ? 0 : EDGE_SPACING; JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); Insets ins = makeBorderInsets(border, c, new Insets(0, 0, 0, 0)); int baseline = label.getBaseline(size.width, size.height); switch (getPosition()) { case ABOVE_TOP: return baseline; case TOP: ins.top = edge + (ins.top - size.height) / 2; return ins.top < edge ? baseline : baseline + ins.top; case BELOW_TOP: return baseline + ins.top + edge; case ABOVE_BOTTOM: return baseline + height - size.height - ins.bottom - edge; case BOTTOM: ins.bottom = edge + (ins.bottom - size.height) / 2; return ins.bottom < edge ? baseline + height - size.height : baseline + height - size.height + ins.bottom; case BELOW_BOTTOM: return baseline + height - size.height; default: // will NOT execute because of the line preceding the switch. } } return -1; } /** * Returns an enum indicating how the baseline of the border * changes as the size changes. * * @throws NullPointerException {@inheritDoc} * @see javax.swing.JComponent#getBaseline(int, int) * @since 1.6 */ @Override public Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c) { super.getBaselineResizeBehavior(c); switch (getPosition()) { case TitledBorder2.ABOVE_TOP: case TitledBorder2.TOP: case TitledBorder2.BELOW_TOP: return Component.BaselineResizeBehavior.CONSTANT_ASCENT; case TitledBorder2.ABOVE_BOTTOM: case TitledBorder2.BOTTOM: case TitledBorder2.BELOW_BOTTOM: return JComponent.BaselineResizeBehavior.CONSTANT_DESCENT; default: return Component.BaselineResizeBehavior.OTHER; } } private int getPosition() { int position = getTitlePosition(); if (position != DEFAULT_POSITION) { return position; } Object value = UIManager.get("TitledBorder.position"); if (value instanceof Integer) { int i = (Integer) value; if (0 < i && i <= 6) { return i; } } else if (value instanceof String) { String s = Objects.toString(value); if ("ABOVE_TOP".equalsIgnoreCase(s)) { return ABOVE_TOP; } if ("TOP".equalsIgnoreCase(s)) { return TOP; } if ("BELOW_TOP".equalsIgnoreCase(s)) { return BELOW_TOP; } if ("ABOVE_BOTTOM".equalsIgnoreCase(s)) { return ABOVE_BOTTOM; } if ("BOTTOM".equalsIgnoreCase(s)) { return BOTTOM; } if ("BELOW_BOTTOM".equalsIgnoreCase(s)) { return BELOW_BOTTOM; } } return TOP; } private int getJustification(Component c) { int justification = getTitleJustification(); if (justification == LEADING || justification == DEFAULT_JUSTIFICATION) { return c.getComponentOrientation().isLeftToRight() ? LEFT : RIGHT; } if (justification == TRAILING) { return c.getComponentOrientation().isLeftToRight() ? RIGHT : LEFT; } return justification; } protected final Font getFont(Component c) { Font font = getTitleFont(); if (Objects.nonNull(font)) { return font; } if (Objects.nonNull(c)) { font = c.getFont(); if (Objects.nonNull(font)) { return font; } } return new Font(Font.DIALOG, Font.PLAIN, 12); } private Color getColor(Component c) { Color color = getTitleColor(); if (Objects.nonNull(color)) { return color; } return Objects.nonNull(c) ? c.getForeground() : null; } private JLabel getLabel(Component c) { this.label.setText(getTitle()); this.label.setFont(getFont(c)); this.label.setForeground(getColor(c)); this.label.setComponentOrientation(c.getComponentOrientation()); this.label.setEnabled(c.isEnabled()); return this.label; } // Checkstyle False Positive: OverloadMethodsDeclarationOrder // private static Insets getBorderInsets(Border border, Component c, Insets insets) { @SuppressWarnings("PMD.AvoidReassigningParameters") private static Insets makeBorderInsets(Border border, Component c, Insets insets) { if (Objects.isNull(border)) { insets.set(0, 0, 0, 0); } else if (border instanceof AbstractBorder) { AbstractBorder ab = (AbstractBorder) border; insets = ab.getBorderInsets(c, insets); } else { Insets i = border.getBorderInsets(c); insets.set(i.top, i.left, i.bottom, i.right); } return insets; } }
[ "aterai@outlook.com" ]
aterai@outlook.com
f45bb894f3d23f7123c84b187a6e027c74f23970
182d0f4acc532472514c1a5f292436866145726a
/src/com/shangde/edu/cus/domain/Experience.java
93b7f9648fd8c8f1a2a66de62918496d5119f556
[]
no_license
fairyhawk/sedu_admin-Deprecated
1c018f17381cd195a1370955b010b3278d893309
eb3d22edc44b2c940942d16ffe2b4b7e41eddbfb
refs/heads/master
2021-01-17T07:08:44.802635
2014-01-25T10:28:03
2014-01-25T10:28:03
8,679,677
0
2
null
null
null
null
UTF-8
Java
false
false
951
java
package com.shangde.edu.cus.domain; import java.io.Serializable; public class Experience implements Serializable{ /** * 当前经验值 */ private int expValue; /** * 下一级的经验值 */ private int nextExpValue; /** * 当前级别名称  */ private String expName; /** * 当前等级 */ private int expLevel; public int getExpValue() { return expValue; } public void setExpValue(int expValue) { this.expValue = expValue; } public int getNextExpValue() { return nextExpValue; } public void setNextExpValue(int nextExpValue) { this.nextExpValue = nextExpValue; } public String getExpName() { return expName; } public void setExpName(String expName) { this.expName = expName; } public int getExpLevel() { return expLevel; } public void setExpLevel(int expLevel) { this.expLevel = expLevel; } }
[ "bis@foxmail.com" ]
bis@foxmail.com
26ca3d3d579808f0d0e964e040ef773628cf0b42
1e135fa7e80921a28ce194981d3f4207ca27cbf3
/src/com/zhigu/model/Result.java
b9edad2b8d6d554656f5e338b8f1b5b61e5fb587
[ "Apache-2.0" ]
permissive
lklong/fuckproject
48286ca21ed4e84dcb2595883997cf10f3d5ec8f
01ce34ecf3ae346de8a9630a6c6f49540f39aca3
refs/heads/master
2021-01-18T23:42:43.439467
2016-06-27T05:52:51
2016-06-27T05:52:51
36,260,555
2
0
null
null
null
null
UTF-8
Java
false
false
1,038
java
/** * @ClassName: Result.java * @Author: liukailong * @Description: * @Date: 2015年4月14日 * */ package com.zhigu.model; /** * @author Administrator * */ public class Result { private boolean status; private String msg; private Object data; public Result(boolean status) { super(); this.status = status; } public Result() { super(); } public Result(boolean status, Object data) { super(); this.status = status; this.data = data; } public Result(boolean status, String msg) { super(); this.status = status; this.msg = msg; } public Result(boolean status, String msg, Object data) { super(); this.status = status; this.msg = msg; this.data = data; } public boolean isStatus() { return status; } public void setStatus(boolean status) { this.status = status; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } }
[ "380312239@qq.com" ]
380312239@qq.com
a7be26136e1e7baf1d72cbe8ca0ee83875440b15
764ce39c1bad590bf7839b4e175539eecbb9584a
/terminator-pubhook-common/src/main/java/com/qlangtech/tis/manage/common/ProcessConfigFile.java
726621de28186b5af50c0d791644289a4b9682a1
[ "MIT" ]
permissive
GSIL-Monitor/tis-neptune
9b758ec5f6e977d353ce66c7c625537dfb1253e2
28f4d1dc3d4ada256457837ead3249e4addac7c2
refs/heads/master
2020-04-17T11:13:35.969979
2019-01-19T09:55:00
2019-01-19T09:55:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,600
java
/* * The MIT License * * Copyright (c) 2018-2022, qinglangtech Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.qlangtech.tis.manage.common; import org.apache.commons.lang.StringUtils; import com.qlangtech.tis.manage.common.ConfigFileContext.ContentProcess; import com.qlangtech.tis.pubhook.common.ConfigConstant; /* * * @author 百岁(baisui@qlangtech.com) * @date 2019年1月17日 */ public class ProcessConfigFile { private final ConfigFileContext.ContentProcess process; private final SnapshotDomain domain; public ProcessConfigFile(ContentProcess process, SnapshotDomain domain) { super(); this.process = process; this.domain = domain; } public void execute() { try { for (PropteryGetter getter : ConfigFileReader.getConfigList()) { if (ConfigConstant.FILE_JAR.equals(getter.getFileName())) { continue; } // 没有属性得到 if (getter.getUploadResource(domain) == null) { continue; } String md5 = getter.getMd5CodeValue(this.domain); if (StringUtils.isBlank(md5)) { continue; } try { Thread.sleep(500); } catch (Throwable e) { } process.execute(getter, getter.getContent(this.domain)); } } catch (Exception e) { throw new RuntimeException(e); } } }
[ "baisui@2dfire.com" ]
baisui@2dfire.com
3f4900d52d5e212601d6055f3a5faf9fbca4b55c
4efd66eae04919addaae948c9a6f93a2f8da46bf
/Coding/src/basicAlgorithm/Comb43.java
5838345db3c49d20a2926bb00c1788add0e2595d
[]
no_license
Mezier/Java-Practice
d23d741cb1fa40fca06e0d242c9014f9e91096d3
12241591a8fd6d7b484557c689badaaa2519a4f2
refs/heads/master
2021-09-12T18:17:27.959208
2018-04-19T20:36:28
2018-04-19T20:36:28
106,926,256
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package basicAlgorithm; public class Comb43 { private static int com(int n){ int sum=0; for(int i=0;i<=n;i++){ for(int j=0;j<=n;j++){ if((i*10+j)%2==0){ sum++; } } } return sum; } public static void main(String[] args) { System.out.println(com(7)); } }
[ "mezier777@gmail.com" ]
mezier777@gmail.com
f9d9b6b1734b5a1a29934c97b9fca3d56eb8dd25
56406bf903df36d2cf29e9c1fac9a872bcab3f3c
/src/memsys/ui/process/ConnApproval.java
1a54a0957ba9b3de3435b1d1af5cf0daf8c43cc5
[]
no_license
lcadiz/MemSys
bee8ba7fdc0a02b1be57f16ecad33cf541a58c33
6f298bb90ae06c61901fe4f277078d9598c4bc66
refs/heads/master
2021-03-17T06:04:28.709499
2020-03-13T02:14:00
2020-03-13T02:14:11
246,968,786
0
0
null
null
null
null
UTF-8
Java
false
false
23,483
java
package memsys.ui.process; import memsys.global.DBConn.MainDBConn; import java.awt.Color; import memsys.global.myDataenvi; import memsys.global.myFunctions; import static memsys.global.myDataenvi.rsAddConnLog; import java.sql.*; import javax.swing.table.DefaultTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.*; import memsys.ui.main.ParentWindow; public class ConnApproval extends javax.swing.JInternalFrame { static Statement stmt; static DefaultTableCellRenderer cellAlignCenterRenderer = new DefaultTableCellRenderer(); static DefaultTableModel model; static DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); static String nowDate = myFunctions.getDate(); public static int i; public ConnApproval() { initComponents(); i = 0; populateTBL(); txtsearch.requestFocus(); tbl.setCellSelectionEnabled(false); tbl.setRowSelectionAllowed(true); tbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tbl.setSelectionBackground(new Color(153, 204, 255)); tbl.setSelectionForeground(Color.BLACK); } public void populateTBL() { Connection conn = MainDBConn.getConnection(); String createString = ""; if (i == 0) { createString = "SELECT AcctNo, MembershipID, AcctName, s.statdesc, CONVERT(char(10), TransDate, 101) ,t.typedesc, ClassCode " + "FROM connTBL c, connTypeTBL t, connStatTBL s " + "WHERE transdate='" + nowDate + "' and c.status=s.status AND c.connType=t.connType AND s.status=1 AND (acctname LIKE '%" + txtsearch.getText() + "%' OR AcctNo like '" + txtsearch.getText() + "%') " + "ORDER BY AcctName"; } else if (i == 1) { createString = "SELECT AcctNo, MembershipID, AcctName, s.statdesc, CONVERT(char(10), TransDate, 101) ,t.typedesc, ClassCode " + "FROM connTBL c, connTypeTBL t, connStatTBL s " + "WHERE transdate<'" + nowDate + "' and c.status=s.status AND c.connType=t.connType AND s.status=1 AND (acctname LIKE '%" + txtsearch.getText() + "%' OR AcctNo like '" + txtsearch.getText() + "%') " + "ORDER BY AcctName"; } try { stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(createString); model = (DefaultTableModel) tbl.getModel(); renderer.setHorizontalAlignment(0); tbl.setRowHeight(29); tbl.getColumnModel().getColumn(0).setCellRenderer(renderer); tbl.getColumnModel().getColumn(1).setCellRenderer(renderer); tbl.getColumnModel().getColumn(4).setCellRenderer(renderer); tbl.getColumnModel().getColumn(6).setCellRenderer(renderer); tbl.setColumnSelectionAllowed(false); model.setNumRows(0); while (rs.next()) { model.addRow(new Object[]{rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7)}); } stmt.close(); conn.close(); } catch (SQLException e) { JOptionPane.showMessageDialog(this, e.getMessage()); } } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { viewOpt = new javax.swing.ButtonGroup(); buttonGroup1 = new javax.swing.ButtonGroup(); jScrollPane2 = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); txtsearch = new org.jdesktop.swingx.JXSearchField(); jPanel2 = new javax.swing.JPanel(); jToolBar1 = new javax.swing.JToolBar(); cmdApproved = new javax.swing.JButton(); cmdRefresh2 = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); jToggleButton1 = new javax.swing.JToggleButton(); jToggleButton2 = new javax.swing.JToggleButton(); jSeparator3 = new javax.swing.JToolBar.Separator(); cmdPreview2 = new javax.swing.JButton(); cmdPreview1 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tbl = new javax.swing.JTable(); setClosable(true); setIconifiable(true); setMaximizable(true); setResizable(true); setTitle("Connection App. Aproval"); addInternalFrameListener(new javax.swing.event.InternalFrameListener() { public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { formInternalFrameOpened(evt); } }); txtsearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtsearchActionPerformed(evt); } }); jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 433, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 28, Short.MAX_VALUE) ); jToolBar1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); jToolBar1.setFloatable(false); jToolBar1.setRollover(true); jToolBar1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); jToolBar1.setInheritsPopupMenu(true); jToolBar1.setMaximumSize(new java.awt.Dimension(500, 63)); jToolBar1.setMinimumSize(new java.awt.Dimension(500, 63)); cmdApproved.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N cmdApproved.setForeground(new java.awt.Color(0, 102, 153)); cmdApproved.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/employer.png"))); // NOI18N cmdApproved.setMnemonic('S'); cmdApproved.setText(" Approved and Send to TSD "); cmdApproved.setFocusable(false); cmdApproved.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); cmdApproved.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdApproved.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cmdApproved.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdApprovedActionPerformed(evt); } }); jToolBar1.add(cmdApproved); cmdRefresh2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N cmdRefresh2.setForeground(new java.awt.Color(0, 51, 153)); cmdRefresh2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/trash.png"))); // NOI18N cmdRefresh2.setMnemonic('R'); cmdRefresh2.setText(" Disapprove "); cmdRefresh2.setFocusable(false); cmdRefresh2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); cmdRefresh2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdRefresh2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cmdRefresh2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdRefresh2ActionPerformed(evt); } }); jToolBar1.add(cmdRefresh2); jToolBar1.add(jSeparator1); buttonGroup1.add(jToggleButton1); jToggleButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jToggleButton1.setForeground(new java.awt.Color(0, 102, 0)); jToggleButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/download.png"))); // NOI18N jToggleButton1.setMnemonic('y'); jToggleButton1.setSelected(true); jToggleButton1.setText(" Today "); jToggleButton1.setActionCommand(" Today "); jToggleButton1.setFocusable(false); jToggleButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jToggleButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToggleButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton1ActionPerformed(evt); } }); jToolBar1.add(jToggleButton1); buttonGroup1.add(jToggleButton2); jToggleButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jToggleButton2.setForeground(new java.awt.Color(153, 0, 0)); jToggleButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/summary.png"))); // NOI18N jToggleButton2.setText(" Previous "); jToggleButton2.setFocusable(false); jToggleButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jToggleButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToggleButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton2ActionPerformed(evt); } }); jToolBar1.add(jToggleButton2); jToolBar1.add(jSeparator3); cmdPreview2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N cmdPreview2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/refresh.png"))); // NOI18N cmdPreview2.setMnemonic('w'); cmdPreview2.setText(" Refresh "); cmdPreview2.setContentAreaFilled(false); cmdPreview2.setFocusable(false); cmdPreview2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); cmdPreview2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdPreview2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cmdPreview2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdPreview2ActionPerformed(evt); } }); jToolBar1.add(cmdPreview2); cmdPreview1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N cmdPreview1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/exit.png"))); // NOI18N cmdPreview1.setMnemonic('w'); cmdPreview1.setText(" Exit "); cmdPreview1.setFocusable(false); cmdPreview1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); cmdPreview1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdPreview1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cmdPreview1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdPreview1ActionPerformed(evt); } }); jToolBar1.add(cmdPreview1); tbl.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Account No", "MemberID", "Account Name", "Status", "AppDate", "Type", "Class" } ) { Class[] types = new Class [] { java.lang.Integer.class, java.lang.Object.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); tbl.setToolTipText(""); tbl.getTableHeader().setReorderingAllowed(false); tbl.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { tblMouseMoved(evt); } }); jScrollPane1.setViewportView(tbl); //set column width tbl.getColumnModel().getColumn(0).setMaxWidth(80); tbl.getColumnModel().getColumn(1).setMaxWidth(80); tbl.getColumnModel().getColumn(4).setMaxWidth(100); tbl.getColumnModel().getColumn(6).setMaxWidth(50); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 981, Short.MAX_VALUE) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(144, 144, 144)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(txtsearch, javax.swing.GroupLayout.PREFERRED_SIZE, 386, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txtsearch, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 373, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jScrollPane2.setViewportView(jPanel1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 991, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 525, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void tblMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblMouseMoved }//GEN-LAST:event_tblMouseMoved private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened // viewAll(); populateTBL(); }//GEN-LAST:event_formInternalFrameOpened private void cmdApprovedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdApprovedActionPerformed int col = 0; //set column value to 0 int row = tbl.getSelectedRow(); //get value of selected value //trap user incase if no row selected if (tbl.isRowSelected(row) != true) { JOptionPane.showMessageDialog(this, "No record selected! Please select a record from the list!"); return; } else { String id = tbl.getValueAt(row, col).toString(); int i = myFunctions.msgboxYesNo("This Record will now transfer to Costing Section!" + "\n" + "It will not be available here in approval section unless the Costing Section sends back this record "); switch (i) { case 0: int uid = ParentWindow.getUserID(); rsAddConnLog(Integer.parseInt(id), "Connection approved", 2, uid, nowDate,""); myDataenvi.rsUpdateConnStat(Integer.parseInt(id), 2); populateTBL(); JOptionPane.showMessageDialog(this, "Record has been successfully sent!"); break; case 1: return; //do nothing case 2: this.dispose(); //exit window default: } } }//GEN-LAST:event_cmdApprovedActionPerformed private void cmdRefresh2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdRefresh2ActionPerformed int col = 0; //set column value to 0 int row = tbl.getSelectedRow(); //get value of selected value //trap user incase if no row selected if (tbl.isRowSelected(row) != true) { JOptionPane.showMessageDialog(this, "No record selected! Please select a record from the list!"); return; } else { String id = tbl.getValueAt(row, col).toString(); int i = myFunctions.msgboxYesNo("Are you sure you want to disapprove this current application?" + "\n" + "NOTE: This will permanently delete the application!"); if (i == 0) { rsDisapprove(id); populateTBL(); JOptionPane.showMessageDialog(this, "Record has been successfully deleted!"); } else if (i == 1) { return; //do nothing } else if (i == 2) { this.dispose(); //exit window return; } } }//GEN-LAST:event_cmdRefresh2ActionPerformed private void cmdPreview1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdPreview1ActionPerformed this.dispose(); }//GEN-LAST:event_cmdPreview1ActionPerformed private void cmdPreview2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdPreview2ActionPerformed populateTBL(); }//GEN-LAST:event_cmdPreview2ActionPerformed private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed i = 0; populateTBL(); txtsearch.requestFocus(); }//GEN-LAST:event_jToggleButton1ActionPerformed private void jToggleButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton2ActionPerformed i = 1; txtsearch.requestFocus(); }//GEN-LAST:event_jToggleButton2ActionPerformed private void txtsearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtsearchActionPerformed populateTBL(); }//GEN-LAST:event_txtsearchActionPerformed public static void rsUpdateStat(int AcctNo, int Stat) { Connection conn = MainDBConn.getConnection(); String createString; createString = "UPDATE connTBL SET " + "status='" + Stat + "' WHERE AcctNo=" + AcctNo; try { stmt = conn.createStatement(); stmt.executeUpdate(createString); stmt.close(); conn.close(); } catch (SQLException e) { JOptionPane.showMessageDialog(null, e.getMessage()); } } public static void rsDisapprove(String acctno) { Connection conn = MainDBConn.getConnection(); String createString; createString = "DELETE FROM connTBL WHERE AcctNo='" + acctno + "'"; try { stmt = conn.createStatement(); stmt.executeUpdate(createString); stmt.close(); conn.close(); } catch (SQLException e) { JOptionPane.showMessageDialog(null, e.getMessage()); } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton cmdApproved; private javax.swing.JButton cmdPreview1; private javax.swing.JButton cmdPreview2; private javax.swing.JButton cmdRefresh2; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JToolBar.Separator jSeparator1; private javax.swing.JToolBar.Separator jSeparator3; private javax.swing.JToggleButton jToggleButton1; private javax.swing.JToggleButton jToggleButton2; private javax.swing.JToolBar jToolBar1; private javax.swing.JTable tbl; private org.jdesktop.swingx.JXSearchField txtsearch; private javax.swing.ButtonGroup viewOpt; // End of variables declaration//GEN-END:variables }
[ "cadizlester@gmail.com" ]
cadizlester@gmail.com
35f4e8177343166d74d3744e03be0bd898cd2adb
2c4ababd5a35ee6e0aecba98ef66ec72709b2cc5
/src/main/java/Operation_allocator/Statistics/UDFprofilers/PolynomialProfile.java
c9350a80b71183d806361d0f1ea33c409ffe2e15
[ "Apache-2.0" ]
permissive
mosaicrown/query-opt
da9c6aa233cdec0efda49e30b2d424f4b2ba1ecc
6b6f4a615734c5de2e3c4247c82d73ce767c3527
refs/heads/master
2023-06-26T06:42:48.129710
2021-04-13T12:34:15
2021-04-13T12:34:15
119,245,644
1
0
Apache-2.0
2023-06-14T22:34:10
2018-01-28T09:42:39
Java
UTF-8
Java
false
false
890
java
package Operation_allocator.Statistics.UDFprofilers; import java.io.Serializable; import java.util.List; public class PolynomialProfile implements Profiler, Serializable { /** * This class provide CPU polynomial profile function * It could be used to build test */ private Double[] k = null; public PolynomialProfile(List<Double> kvect) throws RuntimeException { if (kvect.size() < 1) throw new RuntimeException("Missing profile parameters"); k = new Double[1]; int i = 0; for (double p : kvect ) { k[i] = p; i++; } } @Override public double cpuComplexityProfile(double inputSize) { return Math.pow(inputSize, k[0]); } @Override public double ioComplexityProfile(double inputSize) { return Math.pow(inputSize, k[0]) / k[0]; } }
[ "enrico.bacis@gmail.com" ]
enrico.bacis@gmail.com
4391f072e017d7156a6f72d073e00fde2b9ba1b8
e15468bb77b48ebc9e50606a5af82d0c1fb52614
/src/main/java/com/yong/service/BetService.java
674e57ffca86673529dff0ef9cbf298e18af37c9
[]
no_license
yongliu2001/bets-app
e9d6b96e5cea6c3dc12ba9ec38d183f10ce4a79d
0d92d7f2baf4c2bfd7e8ef68a800da21cfd6954e
refs/heads/master
2020-03-21T17:01:49.327306
2018-06-27T00:32:10
2018-06-27T00:32:10
138,808,586
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
package com.yong.service; import com.yong.domain.BetRecord; import java.util.List; /** * Created by yongliu on 25/6/18. */ public interface BetService { /** * save bet records to db * @param records * @return */ boolean placeBets(List<BetRecord> records); List<Object[]> getTotalInvestmentPerType(); List<Object[]> getTotalInvestmentPerCustomer(); List<Object[]> getTotalBetsPerType(); List<Object[]> getTotalBetsPerHour(); }
[ "yongliu@yongs-mbp.lan" ]
yongliu@yongs-mbp.lan
8736475e5401f85973835b708d28530f52cb272f
7cf13f4216dd828482b6d7e03392f445f77a21bd
/src/com/delivery.java
e794859dbf696b2ba3007218c19d05567dfabf67
[]
no_license
ThilineTissera/PAF---06---2021
32d5e759ddfc49e758a94b1e8b0e0f8f8fa25b8e
ca66523aeebc302d899d9965c44d575b7454ea1e
refs/heads/master
2023-04-14T09:48:12.988166
2021-04-25T11:29:45
2021-04-25T11:29:45
360,420,175
0
0
null
null
null
null
UTF-8
Java
false
false
2,224
java
package com; import model.deliveryInfo; //For REST Service import javax.ws.rs.*; import javax.ws.rs.core.MediaType; //For JSON import com.google.gson.*; //For XML import org.jsoup.*; import org.jsoup.parser.*; import org.jsoup.nodes.Document; @Path("/delivery") public class delivery { deliveryInfo api=new deliveryInfo(); @GET @Path("/") @Produces(MediaType.TEXT_HTML) public String readItems() { return api.readDeliveryInfo(); } @POST @Path("/") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.TEXT_PLAIN) public String insertDeliveryInfo ( @FormParam("deliveName") String deliveName, @FormParam("deliveAddress") String deliveAddress, @FormParam("deliveContact") String delivecontact, @FormParam("deliveDate") String delivedate ) { String output =api.insertDeliveryInfo(deliveName,deliveAddress,delivecontact,delivedate); return output; } //Update API JSON @PUT @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String updateDelivery(String deliveryData) { //Convert the input string to a JSON object JsonObject DeliveryObject = new JsonParser().parse(deliveryData).getAsJsonObject(); //Read the values from the JSON object String deliveID = DeliveryObject.get("delivID").getAsString(); String deliveName = DeliveryObject.get("deliveName").getAsString(); String deliveAddress = DeliveryObject.get("deliveAddress").getAsString(); int deliveContact = DeliveryObject.get("deliveContact").getAsInt(); String deliveDate = DeliveryObject.get("deliveDate").getAsString(); String output = api.updateDeliveryInfo(deliveID, deliveName, deliveAddress, deliveContact, deliveDate); return output; } @DELETE @Path("/") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.TEXT_PLAIN) public String deleteDeliveryInfo(String deliverydata) { //Convert the input string to an XML document Document doc = Jsoup.parse( deliverydata, "", Parser.xmlParser()); //Read the value from the element String deliveryID = doc.select("delivID").text(); String output = api.deleteDeliveryInfo(deliveryID); return output; } }
[ "thilinasknight2000kitt@gmail.com" ]
thilinasknight2000kitt@gmail.com
fab37214e6ca81f2bc6d0f6ce648b86c111a5f5b
3d3bc0f4c2b97c7a6c921afe0fbeca2232db8a93
/src/com/luv2code/hibernate/demo/DeleteDemo.java
c1b19ab69c7f462061f763953ae7b77e42f4d469
[]
no_license
VitorGCS/hibernate-advanced
26461901f1d7c24bc81b1da0695f7d6592d4e6e6
647408368dd8785a138ad9c189c51ebf9d8f77e5
refs/heads/master
2020-11-30T05:12:26.917212
2019-12-28T17:23:58
2019-12-28T17:23:58
230,312,792
0
0
null
null
null
null
UTF-8
Java
false
false
1,356
java
package com.luv2code.hibernate.demo; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.luv2code.hibernate.demo.entity.Instructor; import com.luv2code.hibernate.demo.entity.InstructorDetail; public class DeleteDemo { public static void main(String[] args) { //create session factory SessionFactory factory = new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(Instructor.class) .addAnnotatedClass(InstructorDetail.class) .buildSessionFactory(); //create session Session session = factory.getCurrentSession(); //use the session object to save Java object try { //start a transaction session.beginTransaction(); //get instructor by primary key / id int theId = 1; Instructor tempInstructor = session.get(Instructor.class, theId); System.out.println("Found instructor: "+ tempInstructor); //delete the instructors if(tempInstructor != null) { System.out.println("Deleting :"+ tempInstructor); //Note: will ALSO delete associated "details" object because of CascadeType.ALL session.delete(tempInstructor); } //commit transaction session.getTransaction().commit(); System.out.println("Done!"); } finally{ factory.close(); } } }
[ "vitorgilcs@gmail.com" ]
vitorgilcs@gmail.com
bdfa4cc5ce8dfc0f03ec6aaead29d1e0f1374726
9d0077e84592196697152921dfce5b3d0262ff7a
/Cloud69/rank_grab/build/app/generated/not_namespaced_r_class_sources/debug/r/androidx/webkit/R.java
7d56d60485f7ef0c644aa2eb3f77aad09bffaddf
[ "MIT" ]
permissive
ShijinMohammed/Code-Innovation-Series-ModelEngineeringCollege
8cd1eafd9c5d53be193a10eb6de6630f1d5477be
1ecbc3883c97f87165216cdc39e92383e7a79f82
refs/heads/main
2023-02-03T21:17:41.979294
2020-12-26T09:03:27
2020-12-26T09:03:27
324,193,702
0
0
MIT
2020-12-24T16:15:38
2020-12-24T16:15:37
null
UTF-8
Java
false
false
255
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.webkit; public final class R { private R() {} }
[ "gorrers@gmail.com" ]
gorrers@gmail.com
515cc1a4059ae2efc806e2d619e9754afd70944d
56c556cfff804c428dcdbc80934f3b335a4d4c7f
/Core/src/main/java/jokatu/game/input/InputDeserialiser.java
4dc0b087a1f6c66d2d2baa901e60107da117842f
[]
no_license
rasayana/Jokatu
4c067983d32f3239ac8ad0216115ee0e6bcf40fa
b90513d9871d24c6976f1cd6d35f3cebcf685f47
refs/heads/master
2020-12-28T20:54:05.866493
2016-05-24T22:22:57
2016-05-24T22:22:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package jokatu.game.input; import org.jetbrains.annotations.NotNull; import java.util.Map; /** * This takes JSON from the client and turns it into input. * @param <I> */ public interface InputDeserialiser<I extends Input> { @NotNull I deserialise(@NotNull Map<String, Object> json) throws DeserialisationException; }
[ "echogene.alpha@gmail.com" ]
echogene.alpha@gmail.com
b92d5349bbe891cd8905e1094dbf05d1f3b587cc
c3758cca231a1e3f38db1390bb4d251cd40b9ec9
/app/src/main/java/com/example/rays/apinewsfeed/WebViewPage.java
f2becff24f351f271f7404ab844f5d9213c52d1a
[]
no_license
coolyansh/myNewsAppetite
8945992f881f7142487c12eaa1a571e6df0d0436
429319646302a9c2988b01fd824c24ae09103b05
refs/heads/master
2021-07-23T03:22:02.491148
2017-11-02T15:18:56
2017-11-02T15:18:56
109,103,598
1
0
null
null
null
null
UTF-8
Java
false
false
4,324
java
package com.example.rays.apinewsfeed; import android.app.ProgressDialog; import android.content.ContentValues; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; /** * Created by rays on 8/27/2017. */ public class WebViewPage extends AppCompatActivity { WebView wbView; Intent shareIntent = new Intent(); String url,url_img,tt,des; boolean flag; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); url = getIntent().getExtras().getString("URL"); url_img=getIntent().getExtras().getString("URL_IMG"); tt= getIntent().getExtras().getString("TITLE"); des = getIntent().getExtras().getString("DESCRIPTION"); flag=true; if("Bookmark".equals(des)) flag=false; shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT,url); shareIntent.setType("text/plain"); ActionBar actionBar=getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); setContentView(R.layout.webviewpage); final ProgressDialog pd =ProgressDialog.show(this,"","Loading..... Please Wait"); pd.setCancelable(true); wbView = (WebView) findViewById(R.id.web_view); wbView.getSettings().setJavaScriptEnabled(true); wbView.setWebChromeClient(new WebChromeClient()); wbView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { if(pd!=null&&pd.isShowing()){ pd.dismiss(); } } @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { view.loadUrl(request.getUrl().toString()); return true; } }); wbView.loadUrl(url); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && wbView.canGoBack()) { wbView.goBack(); // Go to previous page return true; } // Use this as else part return super.onKeyDown(keyCode, event); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_share,menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()){ case R.id.share: startActivity(shareIntent); return true; case R.id.bookmark: if(flag==true){ ContentValues contentValues=new ContentValues(); contentValues.put(NewsContract.COLUMN_TITLE,tt); contentValues.put(NewsContract.COLUMN_DESCRIPTION,des); contentValues.put(NewsContract.COLUMN_URL,url); contentValues.put(NewsContract.COLUMN_IMG_URL,url_img); Uri newUri=getContentResolver().insert(NewsContract.CONTENT_URI,contentValues); flag=false; Toast.makeText(this,"News Item added to Bookmarks ",Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(this,"News Item has already been bookmarked ",Toast.LENGTH_SHORT).show(); } return true; case android.R.id.home: Intent intent=null; if("Bookmark".equals(des)) intent=new Intent(this,bookmark_activity.class); else intent=new Intent(this,MainActivity.class); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); } } }
[ "coolyansh@gmail.com" ]
coolyansh@gmail.com
7452c28edb38d54472651a443a976429e9a4136c
dea6c027f80bbc7416bab8de0837846144fd569a
/StarNubServer/src/main/java/starnubserver/connections/player/StarNubConnection.java
098aa0e33f07e44cbe744d4b8d47a3d5009a920c
[]
no_license
r00t-s/StarNubMain-1
d129d30ccbf44ea3d7049f41f8d27c7b24788a69
0883218ec3970bbe78f5bed9df452530649a9706
refs/heads/master
2020-05-17T19:21:17.517711
2015-01-02T18:34:18
2015-01-02T18:34:18
28,726,712
0
0
null
2015-01-02T21:22:53
2015-01-02T21:22:52
null
UTF-8
Java
false
false
3,775
java
/* * Copyright (C) 2014 www.StarNub.org - Underbalanced * * This file is part of org.starnub a Java Wrapper for Starbound. * * This above mentioned StarNub software is free software: * you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free * Software Foundation, either version 3 of the License, or * any later version. This above mentioned CodeHome software * is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. You should * have received a copy of the GNU General Public License in * this StarNub Software. If not, see <http://www.gnu.org/licenses/>. */ package starnubserver.connections.player; import io.netty.channel.ChannelHandlerContext; import starnubserver.StarNub; import starnubserver.events.events.StarNubEvent; import utilities.connectivity.connection.Connection; import utilities.events.EventRouter; import utilities.events.types.StringEvent; import java.io.IOException; public class StarNubConnection extends Connection { public enum ConnectionProcessingType { PLAYER, PLAYER_NO_DECODING } private final ConnectionProcessingType CONNECTION_TYPE; //TODO CLEAN UP public StarNubConnection(EventRouter EVENT_ROUTER, ConnectionProcessingType CONNECTION_TYPE, ChannelHandlerContext CLIENT_CTX, ChannelHandlerContext SERVER_CTX) { super(EVENT_ROUTER, CLIENT_CTX); this.CONNECTION_TYPE = CONNECTION_TYPE; StarNub.getConnections().getOPEN_SOCKETS().remove(SERVER_CTX); StarNub.getConnections().getOPEN_SOCKETS().remove(CLIENT_CTX); boolean limitedWrapper = !(boolean) StarNub.getConfiguration().getNestedValue("advanced_settings", "packet_decoding") && CONNECTION_TYPE == ConnectionProcessingType.PLAYER_NO_DECODING; if (limitedWrapper) { try { boolean uuidIp = (boolean) StarNub.getConfiguration().getNestedValue("starnub_settings", "whitelisted") && StarNub.getConnections().getWHITELIST().collectionContains(getClientIP(), "uuid_ip"); if (!uuidIp) { new StarNubEvent("Player_Connection_Success_No_Decoding", this); } else { new StarNubEvent("Player_Connection_Failure_Whitelist_No_Decoding", this); this.disconnect(); } } catch (IOException e) { e.printStackTrace(); } } else if (CONNECTION_TYPE == ConnectionProcessingType.PLAYER) { StarNub.getConnections().getOPEN_CONNECTIONS().remove(CLIENT_CTX); } else { StarNub.getConnections().getOPEN_CONNECTIONS().put(CLIENT_CTX, this); } } public ConnectionProcessingType getCONNECTION_TYPE() { return CONNECTION_TYPE; } public boolean disconnectReason(String reason) { boolean isConnectedCheck = super.disconnect(); new StringEvent("Player_Disconnect_" + reason, this); return isConnectedCheck; } /** * Recommended: For connections use with StarNub. * <p> * Uses: This will automatically schedule a one time task and it can be canceled by calling removeTask() */ @Override public void removeConnection() { StarNub.getConnections().getOPEN_CONNECTIONS().remove(CLIENT_CTX); StarNub.getConnections().getPROXY_CONNECTION().remove(CLIENT_CTX); } @Override public String toString() { return "StarNubProxyConnection{} " + super.toString(); } }
[ "admin@myfu.net" ]
admin@myfu.net
9d6ff270b07c4a5020786548174d2822036971b1
f56031965527943f3ec9d3d44d217f2d97720bc7
/eureka/src/test/java/com/myp/eureka/eureka/EurekaApplicationTests.java
9898d44a0206a80db54661989ca9af993785836f
[]
no_license
xiaohanxing/springcloudStudy
0356f58e256c5962c2657536b2bd831a13fe3e68
5b5fee71f6c4281535638e530478c3fdc304ec5d
refs/heads/master
2022-11-30T05:42:12.555220
2020-07-25T16:54:35
2020-07-25T16:54:35
281,145,788
0
0
null
null
null
null
UTF-8
Java
false
false
222
java
package com.myp.eureka.eureka; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class EurekaApplicationTests { @Test void contextLoads() { } }
[ "18235111810@163.com" ]
18235111810@163.com
11b641fe399a5f38765e694008c2046197ffee8f
09cf01fce647dbc12101952fd4da8a301e6c6166
/NameServerFrame/src/nameServerFrame/SearchServers.java
2de451ff6218fd464709e21ef90890e72c8731e5
[]
no_license
penghao1023/NameServer
c0b50199d5375ceec6ad3af3b045a1018cf70e92
27510666638e37ea0cf0cd86f5ceb6c36bce0592
refs/heads/master
2021-06-12T17:32:37.811445
2017-03-01T16:48:00
2017-03-01T16:48:00
null
0
0
null
null
null
null
GB18030
Java
false
false
1,155
java
/** * 文件名:SearchServers.java * * 版本信息: * 日期:2017年2月18日 * Copyright 足下 Corporation 2017 * 版权所有 * */ package nameServerFrame; import ISearchInfo.ISearchPrxoy; /** * * 项目名称:NameServerFrame * 类名称:SearchServers * 类描述: * 创建人:jinyu * 创建时间:2017年2月18日 下午2:06:11 * 修改人:jinyu * 修改时间:2017年2月18日 下午2:06:11 * 修改备注: * @version * */ public class SearchServers implements ISearchPrxoy{ /* * Title: SendData *Description: * @param infokey * @param addr * @param data */ @Override public void SendData(String infokey, String addr, byte[] data) { ServerInfo server=ServerInstances.servers.getOrDefault(infokey, null); if(server!=null) { try { int num=10; //发送10次 String[]address=addr.split(":"); while(num>1) { server.porxy.SendTCPNatPackage(address[0], Integer.valueOf(address[1])); num--; } } catch(Exception ex) { } } } }
[ "jinyuttt@sina.com" ]
jinyuttt@sina.com
d58eacbc2e2a89eae840a30d265b70e88d12fbcd
c99839ed46e23c52e8ed060f820b7faa20f06205
/kasper-common/src/main/java/com/viadeo/kasper/query/exposition/query/BeanConstructor.java
8bdf65203746bf25a6cbffb7cf54c235a804ea02
[]
no_license
mglcel/kasper-framework-1
f434fddd427d46a99d9d32ffd5cd6d7b0aeaf711
35300a96e9e53bacd2f4c94a589f4e1ee2f51f9a
refs/heads/master
2021-01-22T16:38:53.439514
2015-02-20T20:00:46
2015-02-20T20:00:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,078
java
// ============================================================================ // KASPER - Kasper is the treasure keeper // www.viadeo.com - mobile.viadeo.com - api.viadeo.com - dev.viadeo.com // // Viadeo Framework for effective CQRS/DDD architecture // ============================================================================ package com.viadeo.kasper.query.exposition.query; import com.viadeo.kasper.query.exposition.exception.KasperQueryAdapterException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; import static com.google.common.base.Preconditions.checkNotNull; class BeanConstructor { private final Constructor<Object> ctr; private final Map<String, BeanConstructorProperty> parameters; // ------------------------------------------------------------------------ public BeanConstructor(final Constructor<Object> ctr, final Map<String, BeanConstructorProperty> parameters) { this.ctr = checkNotNull(ctr); this.parameters = checkNotNull(parameters); } // ------------------------------------------------------------------------ public Object create(final Object[] params) { try { return ctr.newInstance(params); } catch (final IllegalArgumentException e) { throw couldNotInstantiateQuery(e); } catch (final InstantiationException e) { throw couldNotInstantiateQuery(e); } catch (final IllegalAccessException e) { throw couldNotInstantiateQuery(e); } catch (final InvocationTargetException e) { throw couldNotInstantiateQuery(e); } } private KasperQueryAdapterException couldNotInstantiateQuery(final Exception e) { return new KasperQueryAdapterException( "Failed to instantiate query of type " + ctr.getDeclaringClass(), e ); } public Map<String, BeanConstructorProperty> parameters() { return parameters; } }
[ "mglcel@mglcel.fr" ]
mglcel@mglcel.fr
71bc86fa1e1e06ddb32e09b4d8e4c52478b282f7
0332d414a77b6337b89bbcd9feda2ba7b977dfa4
/security/src/main/java/com/amlzq/android/util/Manufacturer.java
369d34256fb94ebd488b1ad6cb88e023499e10b4
[]
no_license
android-support-base/security
665dd89a00eaf52d18b42124800c25085d41e704
56a50d7e4519290e90bc61c57ea0a597afcef66c
refs/heads/master
2021-10-27T01:28:26.683696
2021-10-17T13:53:37
2021-10-17T13:53:37
213,309,110
0
0
null
null
null
null
UTF-8
Java
false
false
1,142
java
package com.amlzq.android.util; /** * Created by amlzq on 2018/6/27. * <p> * 制造商 * From Build.MANUFACTURER */ public class Manufacturer { public static final String HTC = "HTC"; //宏达 public static final String SAMSUNG = "samsung";//三星 public static final String HUAWEI = "Huawei";//华为 public static final String MEIZU = "Meizu";//魅族 public static final String XIAOMI = "Xiaomi";//小米 public static final String SONY = "Sony";//索尼 public static final String OPPO = "OPPO"; public static final String VIVO = "vivo"; public static final String LG = "LG"; public static final String LETV = "Letv";//乐视 public static final String ZTE = "ZTE";//中兴 public static final String YULONG = "YuLong";//酷派 public static final String LENOVO = "LENOVO";//联想 /** * ROM MIUI */ public class Miui { public static final String V5 = "V5"; public static final String V6 = "V6"; public static final String V7 = "V7"; public static final String V8 = "V8"; public static final String V9 = "V9"; } }
[ "lzqjiujiang@gmail.com" ]
lzqjiujiang@gmail.com
5b2da5454352f3bc4767e55e5805afc30751eb7e
6a141727fa0978a1d80b42802f2ec4a484ac0933
/src/org/rayworks/network/download/DownloadRequest.java
53533a59aae0812f2135f53b1b098c4d617ba600
[]
no_license
rayworks/downloader-lite
c1da4488b427a577fcad258d3f6570c433b2a7ab
bd67b58fd9c04f53ac6b4cce550525c9664693ce
refs/heads/master
2021-05-15T01:34:32.596573
2019-03-08T03:56:08
2019-03-08T03:56:08
34,265,092
1
0
null
null
null
null
UTF-8
Java
false
false
1,336
java
/* * Copyright (c) 2015 rayworks * 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.rayworks.network.download; import org.rayworks.network.download.listener.DownloadListener; public class DownloadRequest { private boolean compoundRequest = false; public DownloadRequest(String url, String localStoragePath, DownloadListener downloadListener) { this.url = url; this.localStoragePath = url; this.downloadListener = downloadListener; } private String url; private String localStoragePath; private DownloadListener downloadListener; private int tagId = -1; public int getTagId() { return tagId; } public String getUrl() { return url; } public String getLocalStoragePath() { return localStoragePath; } public DownloadListener getDownloadListener() { return downloadListener; } }
[ "cray_bond@hotmail.com" ]
cray_bond@hotmail.com
1cf082f2a6e88769e340e494f0da16aecacff3ac
85659db6cd40fcbd0d4eca9654a018d3ac4d0925
/packages/apps/APR/APR_Brasil/src/com/motorola/motoapr/service/APRScanFileDropBox.java
f3a7f006bdb4ec0932d201491b15b9ff8889e929
[]
no_license
qwe00921/switchui
28e6e9e7da559c27a3a6663495a5f75593f48fb8
6d859b67402fb0cd9f7e7a9808428df108357e4d
refs/heads/master
2021-01-17T06:34:05.414076
2014-01-15T15:40:35
2014-01-15T15:40:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,962
java
// ********************************************************** // // PROJECT: APR (Automatic Panic Recording) // DESCRIPTION: // The purpose of APR is to gather the panics in the device // and record statics about those panics to a centralized // server, for automated tracking of the quality of a program. // To achieve this, several types of messages are required to // be sent at particular intervals. This package is responsible // for sending the data in the correct format, at the right // intervals. // ********************************************************** // // Change History // ********************************************************** // // Author Date Tracking Description // ************** ********** ******** ********************** // // Stephen Dickey 03/01/2009 1.0 Initial Version // // ********************************************************** // package com.motorola.motoapr.service; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import android.util.Log; import com.motorola.motoapr.service.PanicType.PANIC_ID; public class APRScanFileDropBox extends APRScanFile { static String TAG = "APRScanFileDropBox"; static String FORCE_CLOSE = "system_app_crash"; APRScanFileDropBox(APRManager apr_manager) { super(apr_manager); } static String Process_name = "Process: "; static String Package_name = "Package: "; static String Exception_name = "Exception: "; static String Unknown_name = "com.unknown.Unknown"; // Scan 50 bytes from the input file, and store it as a crash. public void ScanFile( PANIC_ID panic_id, String FileToScan ) { File file_ptr = new File( FileToScan ); long current_last_mod = 0; try { // Is a Dropbox force close file? if(!FileToScan.contains(FORCE_CLOSE)) { // APRDebug.APRLog( TAG, FileToScan + " is not a force close, pass!"); return; } // can we read the file? if ( file_ptr.canRead() ) { APRDebug.APRLog( TAG, "File Found:" + FileToScan ); current_last_mod = file_ptr.lastModified(); // keep track of the last time this file was modified. if the modification // date of the file is older than what we have stored, or we have nothing stored, // then send the file and keep track of what was sent. if ( current_last_mod > APRPreferences.APRPrefsGetEntryLastModified( FileToScan ) ) { if ( FileToScan.contains( FORCE_CLOSE )) { // the file has been modified. We don't know if it is a new instance of the file // (destroyed and rewritten) or an existing instance that's been appended. // therefore we must back it up in its entirety. APRScanBackupFile( FileToScan ); // Rules for finding crashes. // If two entries in the log have the same timestamp then neither entry // is a valid crash in-itself. those entries are part of an ANR, and we // must continue to scan all entries that are part of the ANR, until we // find a unique timestamp. For that ANR, we must record a single crash. // Otherwise, if the entry has its own unique timestamp, we do not have // to record an ANR. We can simply record a crash, and note the app name // and timestamp. try { BufferedReader inReader = new BufferedReader(new FileReader( FileToScan ), 1024); // read a line from the file, see if it has a new // crash. String process_info = null; String process_name = null; String package_name = null; String exception_name = null; String app_name_str = null; String crash_string = null; // Retrieve creation timestamp from filename String filename = file_ptr.getName(); int time_created_start = filename.lastIndexOf("@") + 1; int time_created_end = filename.lastIndexOf("."); String time_created = filename.substring(time_created_start, time_created_end); APRDebug.APRLog( TAG, "time_created:" + time_created ); // Calculate timestamp long inTimeInMillis = Long.parseLong(time_created); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); String time_only = formatter.format(new Date(inTimeInMillis)); APRDebug.APRLog( TAG, "time_only:" + time_only ); crash_string = new String(time_only); while( ( process_info = inReader.readLine() ) != null ) { if ( process_info.contains( Process_name ) ) { int process_name_start = process_info.lastIndexOf( Process_name ) + Process_name.length(); process_name = process_info.substring(process_name_start); APRDebug.APRLog( TAG, "process_name:" + process_name ); } else if ( process_info.contains( Package_name ) ) { int package_name_start = process_info.lastIndexOf( Package_name ) + Package_name.length(); package_name = process_info.substring( package_name_start ); APRDebug.APRLog( TAG, "package_name:" + package_name ); } else if ( process_info.contains( Exception_name ) ) { int exception_name_end = process_info.indexOf(":"); exception_name = process_info.substring(0, exception_name_end); APRDebug.APRLog( TAG, "exception_name:" + exception_name ); /** * int package_name_start = process_info.lastIndexOf( "/" ); int package_name_end = process_info.indexOf(")"); if(package_name_start != -1 && package_name_end != -1) { full_app_name_str = process_info.substring(package_name_start, package_name_end); } APRDebug.APRLog( TAG, "full_app_name_str:" + full_app_name_str ); */ break; } } /** * Our DropBox report policy: * Package name sometimes contains extra characters, * So when process name is available, we use process name * instead of package name. * Use package name when process name is absent */ if(process_name == null) { APRDebug.APRLog( TAG, "process_name is null, use package name"); app_name_str = package_name; } else { app_name_str = process_name; } // If we still don't know which process crashed, we need to // give it a dummy name if(app_name_str == null) { Log.e(TAG, "app_name_str still has no name, use unknown"); app_name_str = Unknown_name; } APRDebug.APRLog( TAG, "app_name_str:" + app_name_str); // Reverse the app name. app_name_str = ReverseName( app_name_str, '.' ); // take the new app name, and force it to 24 chars. app_name_str = ForceStringLength( app_name_str, 24 ); APRDebug.APRLog( TAG, "ReverseName and ForceLength:" + app_name_str); crash_string = new String( app_name_str + " " + crash_string ); // ok, well we know we have a tombstone, so we must send some data. // determine if app_name has been identified, and start building the // byte array. APRScanRecordAndSend( filename, panic_id, app_name_str, inTimeInMillis, crash_string, "(app_name)" + app_name_str ); } catch ( IOException e ) { APRDebug.APRLog( TAG, "Can't read data from: " + FileToScan ); // log the crash anyways. just because we cannot // read the file, we know at this point that the // timestamp has been updated, and we should be // indicating a failure. But in this case the // data sent will be blank. } catch ( Exception e ) { APRDebug.APRLog( TAG, "Failure Scanning: " + FileToScan ); Log.e( TAG, "Failure Scanning: " + FileToScan ); APRDebug.APRDebugStack(e); } finally { APRDebug.APRLog( TAG, "DropBox Scanned:" + FileToScan ); } } // end if this is actually a tombstone file. APRPreferences.APRPrefsSetEntryLastModified( FileToScan, current_last_mod ); } // end if the file has a newer timestamp than what was recorded. } // end if we can read the file. } catch ( Exception e ) { APRDebug.APRLog( TAG, "Failed to Scan File " + FileToScan ); } finally { //APRDebug.APRLog( TAG, "APRScanFileDropBox. ScanFile Done." ); } } // end ScanFile. } // end APRScanFileDropBox class.
[ "cheng.carmark@gmail.com" ]
cheng.carmark@gmail.com
02583298ae9f3e7bf6930c26c87239a430f3d071
2278022ad2621f7d4e4d734fd97707ae91fe518a
/worckspace_servlet/reboard/src/kr/main/action/MainAction.java
9c0c5326cde6a18a8a15e8863f95c2ad92cb5a13
[]
no_license
TaeHyungK/KH_Academy
6506199d1222a7d4d51e2a650769fd565e5d802c
d014b7bf25d6fc282d856696b5da0e8997900fc5
refs/heads/master
2021-09-09T01:46:25.995181
2018-03-13T06:48:06
2018-03-13T06:48:06
106,348,733
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package kr.main.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import kr.controller.Action; public class MainAction implements Action{ @Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { return "/views/main/main.jsp"; } }
[ "rlaxogud555@gmail.com" ]
rlaxogud555@gmail.com
32b97b519c758e32836bd74e7737301ffa40cce5
1ca8207218786f99f808ff82e68065b34bf64ae3
/src/main/java/br/com/ivanfsilva/editora/web/validator/FuncionarioValidator.java
b8c97d514c8d7ca7b448ac13ac5b1b1974423c12
[]
no_license
ivanfsilva/editora-spring-jdbc
eef0b88956b5f16f2bd27bb7edc998c985a452f7
663f4006f81cb28633031db153188250c44ee45b
refs/heads/master
2023-01-24T14:37:27.922421
2020-11-24T16:48:56
2020-11-24T16:48:56
312,687,497
0
0
null
null
null
null
UTF-8
Java
false
false
2,187
java
package br.com.ivanfsilva.editora.web.validator; import br.com.ivanfsilva.editora.entity.Funcionario; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; import java.time.LocalDate; public class FuncionarioValidator implements Validator { private EnderecoValidator enderecoValidator; public FuncionarioValidator(EnderecoValidator enderecoValidator) { this.enderecoValidator = enderecoValidator; } @Override public boolean supports(Class<?> clazz) { return Funcionario.class.equals(clazz); } @Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "nome", "error.nome", "O campo nome é obrigatório"); Funcionario f = (Funcionario) target; if (f.getSalario() != null) { if (f.getSalario() < 0 ) { errors.rejectValue("nome", "error.salario", "O salário não deve ser negativo"); } } else { errors.rejectValue("nome", "error.salario", "O campo salário é obrigatório"); } if (f.getDataEntrada() != null) { LocalDate atual = LocalDate.now(); if (f.getDataEntrada().isAfter(atual) ) { errors.rejectValue("dataEntrada", "error.dataEntrara", "A data de entrada deve ser anterior ou igual a data atual"); } } else { errors.rejectValue("dataEntrada", "error.dataEntrada", "O campo data de entrada é obrigatório"); } if (f.getDataSaida() != null) { if (f.getDataSaida().isBefore(f.getDataEntrada())) { errors.rejectValue("dataSaida", "error.dataSaida", "A data de saída deve ser posterior ou igual a data de entrada"); } } if (f.getCargo() == null) { errors.rejectValue("cargo", "erroer.cargo", "O campo cargo é obrigatório"); } ValidationUtils.invokeValidator(enderecoValidator, f.getEndereco(), errors); } }
[ "ivanfs27@gmail.com" ]
ivanfs27@gmail.com
ac124ae74f8c05b28a372c9eb62129033ceae1f6
414be5b664ba24b8d5b1e2f41fbb9e2b22251644
/JPA Modeler Core/src/org/netbeans/jpa/modeler/properties/classmember/ConstructorPanel.java
95671e4844c3071fdefaee5e7abedef69c0f70c8
[ "Apache-2.0" ]
permissive
subaochen/JPAModeler
919a130e08f133eff32f43f8420198ac41091e1b
6935e4450487d2b666987fc4c9ca8b4396365812
refs/heads/master
2020-06-20T06:40:54.778472
2016-11-20T15:24:38
2016-11-20T15:24:38
74,874,179
0
1
null
2016-11-27T07:41:30
2016-11-27T07:41:30
null
UTF-8
Java
false
false
14,860
java
/** * Copyright [2016] Gaurav Gupta * * 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.netbeans.jpa.modeler.properties.classmember; import java.awt.event.ItemEvent; import java.util.List; import javax.swing.JOptionPane; import org.netbeans.jpa.modeler.core.widget.PersistenceClassWidget; import org.netbeans.jpa.modeler.spec.ManagedClass; import org.netbeans.jpa.modeler.spec.extend.AccessModifierType; import org.netbeans.jpa.modeler.spec.extend.Constructor; import org.netbeans.modeler.properties.entity.custom.editor.combobox.client.entity.ComboBoxValue; import org.netbeans.modeler.properties.entity.custom.editor.combobox.client.entity.Entity; import org.netbeans.modeler.properties.entity.custom.editor.combobox.client.entity.RowValue; import org.netbeans.modeler.properties.entity.custom.editor.combobox.internal.EntityComponent; import static org.openide.util.NbBundle.getMessage; public class ConstructorPanel extends EntityComponent<Constructor> { private Constructor constructor; private final List<Constructor> constructors; private final PersistenceClassWidget<? extends ManagedClass> persistenceClassWidget; public ConstructorPanel(PersistenceClassWidget<? extends ManagedClass> persistenceClassWidget) { this.persistenceClassWidget = persistenceClassWidget; constructors = persistenceClassWidget.getBaseElementSpec().getConstructors(); } @Override public void postConstruct() { initComponents(); } @Override public void init() { ((ClassMemberPanel) classMemberPanel).init(); accessModifierComboInit(); pack(); } private void accessModifierComboInit() { accessModifierComboBox.removeAllItems(); for (AccessModifierType accessModifierType : AccessModifierType.values()) { accessModifierComboBox.addItem(new ComboBoxValue(accessModifierType, accessModifierType.getValue())); } } @Override public void createEntity(Class<? extends Entity> entityWrapperType) { this.setTitle("Create Constructor"); if (entityWrapperType == RowValue.class) { this.setEntity(new RowValue(new Object[3])); } constructor = new Constructor(); setAccessModifierType(AccessModifierType.PUBLIC); ((ClassMemberPanel)classMemberPanel).setPersistenceClassWidget(persistenceClassWidget); ((ClassMemberPanel) classMemberPanel).setValue(constructor); } @Override public void updateEntity(Entity<Constructor> entityValue) { this.setTitle("Update Constructor"); if (entityValue.getClass() == RowValue.class) { this.setEntity(entityValue); Object[] row = ((RowValue) entityValue).getRow(); constructor = (Constructor) row[0]; ((ClassMemberPanel)classMemberPanel).setPersistenceClassWidget(persistenceClassWidget); ((ClassMemberPanel) classMemberPanel).setValue(constructor); setAccessModifierType(constructor.getAccessModifier()); } } private void setAccessModifierType(AccessModifierType accessModifier) { if (accessModifier == null) { accessModifierComboBox.setSelectedIndex(0); } else { for (int i = 0; i < accessModifierComboBox.getItemCount(); i++) { if (((ComboBoxValue<AccessModifierType>) accessModifierComboBox.getItemAt(i)).getValue() == accessModifier) { accessModifierComboBox.setSelectedIndex(i); } } } } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { rootLayeredPane = new javax.swing.JLayeredPane(); jLayeredPane1 = new javax.swing.JLayeredPane(); classMemberPanel = new ClassMemberPanel(org.openide.util.NbBundle.getMessage(ClassMemberPanel.class, "LBL_constructor_select")); jLayeredPane2 = new javax.swing.JLayeredPane(); action_jLayeredPane = new javax.swing.JLayeredPane(); save_Button = new javax.swing.JButton(); cancel_Button = new javax.swing.JButton(); accessModifierLayeredPane = new javax.swing.JLayeredPane(); accessModifierComboBox = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); rootLayeredPane.setLayout(new java.awt.BorderLayout()); jLayeredPane1.setLayout(new java.awt.BorderLayout()); javax.swing.GroupLayout classMemberPanelLayout = new javax.swing.GroupLayout(classMemberPanel); classMemberPanel.setLayout(classMemberPanelLayout); classMemberPanelLayout.setHorizontalGroup( classMemberPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); classMemberPanelLayout.setVerticalGroup( classMemberPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 367, Short.MAX_VALUE) ); jLayeredPane1.add(classMemberPanel, java.awt.BorderLayout.CENTER); rootLayeredPane.add(jLayeredPane1, java.awt.BorderLayout.CENTER); jLayeredPane2.setPreferredSize(new java.awt.Dimension(472, 45)); org.openide.awt.Mnemonics.setLocalizedText(save_Button, org.openide.util.NbBundle.getMessage(ConstructorPanel.class, "ConstructorPanel.save_Button.text")); // NOI18N save_Button.setToolTipText(org.openide.util.NbBundle.getMessage(ConstructorPanel.class, "ConstructorPanel.save_Button.toolTipText")); // NOI18N save_Button.setPreferredSize(new java.awt.Dimension(50, 25)); save_Button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { save_ButtonActionPerformed(evt); } }); org.openide.awt.Mnemonics.setLocalizedText(cancel_Button, org.openide.util.NbBundle.getMessage(ConstructorPanel.class, "ConstructorPanel.cancel_Button.text")); // NOI18N cancel_Button.setToolTipText(org.openide.util.NbBundle.getMessage(ConstructorPanel.class, "ConstructorPanel.cancel_Button.toolTipText")); // NOI18N cancel_Button.setPreferredSize(new java.awt.Dimension(50, 23)); cancel_Button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancel_ButtonActionPerformed(evt); } }); action_jLayeredPane.setLayer(save_Button, javax.swing.JLayeredPane.DEFAULT_LAYER); action_jLayeredPane.setLayer(cancel_Button, javax.swing.JLayeredPane.DEFAULT_LAYER); javax.swing.GroupLayout action_jLayeredPaneLayout = new javax.swing.GroupLayout(action_jLayeredPane); action_jLayeredPane.setLayout(action_jLayeredPaneLayout); action_jLayeredPaneLayout.setHorizontalGroup( action_jLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(action_jLayeredPaneLayout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(save_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cancel_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); action_jLayeredPaneLayout.setVerticalGroup( action_jLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(action_jLayeredPaneLayout.createSequentialGroup() .addGroup(action_jLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(save_Button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cancel_Button, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); jLayeredPane2.add(action_jLayeredPane); action_jLayeredPane.setBounds(280, 10, 170, 30); accessModifierComboBox.setToolTipText(org.openide.util.NbBundle.getMessage(ConstructorPanel.class, "ConstructorPanel.accessModifierComboBox.toolTipText")); // NOI18N accessModifierComboBox.setPreferredSize(new java.awt.Dimension(28, 23)); org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ConstructorPanel.class, "ConstructorPanel.jLabel1.text")); // NOI18N accessModifierLayeredPane.setLayer(accessModifierComboBox, javax.swing.JLayeredPane.DEFAULT_LAYER); accessModifierLayeredPane.setLayer(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER); javax.swing.GroupLayout accessModifierLayeredPaneLayout = new javax.swing.GroupLayout(accessModifierLayeredPane); accessModifierLayeredPane.setLayout(accessModifierLayeredPaneLayout); accessModifierLayeredPaneLayout.setHorizontalGroup( accessModifierLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(accessModifierLayeredPaneLayout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(accessModifierComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)) ); accessModifierLayeredPaneLayout.setVerticalGroup( accessModifierLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(accessModifierLayeredPaneLayout.createSequentialGroup() .addGroup(accessModifierLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE) .addComponent(accessModifierComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addGap(10, 10, 10)) ); jLayeredPane2.add(accessModifierLayeredPane); accessModifierLayeredPane.setBounds(0, 10, 270, 30); rootLayeredPane.add(jLayeredPane2, java.awt.BorderLayout.SOUTH); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rootLayeredPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rootLayeredPane, javax.swing.GroupLayout.Alignment.TRAILING) ); }// </editor-fold>//GEN-END:initComponents private boolean validateField() { // if (constructors.contains(constructor)){// bug : will only work for existing entry // JOptionPane.showMessageDialog(this, "Constructor with same signature already exist : " + constructor.getSignature(), "Duplicate Constructor", javax.swing.JOptionPane.WARNING_MESSAGE); // return false; // } if(constructor.getAttributes().isEmpty() && (constructor.getAccessModifier()==AccessModifierType.DEFAULT || constructor.getAccessModifier()==AccessModifierType.PRIVATE)){ JOptionPane.showMessageDialog(this, getMessage(ConstructorPanel.class, "NO_ARG_ACCESS_MODIFIER.text"), getMessage(ConstructorPanel.class, "NO_ARG_ACCESS_MODIFIER.title"), javax.swing.JOptionPane.WARNING_MESSAGE); return false; } return true; } private void save_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_ButtonActionPerformed constructor = (Constructor) ((ClassMemberPanel) classMemberPanel).getValue(); constructor.setAccessModifier(((ComboBoxValue<AccessModifierType>) accessModifierComboBox.getSelectedItem()).getValue()); if (!validateField()) { return; } if (this.getEntity().getClass() == RowValue.class) { Object[] row = ((RowValue) this.getEntity()).getRow(); row[0] = constructor; row[1] = constructor.isEnable(); row[2] = constructor.toString(); } saveActionPerformed(evt); }//GEN-LAST:event_save_ButtonActionPerformed private void cancel_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_ButtonActionPerformed cancelActionPerformed(evt); }//GEN-LAST:event_cancel_ButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox accessModifierComboBox; private javax.swing.JLayeredPane accessModifierLayeredPane; private javax.swing.JLayeredPane action_jLayeredPane; private javax.swing.JButton cancel_Button; private javax.swing.JPanel classMemberPanel; private javax.swing.JLabel jLabel1; private javax.swing.JLayeredPane jLayeredPane1; private javax.swing.JLayeredPane jLayeredPane2; private javax.swing.JLayeredPane rootLayeredPane; private javax.swing.JButton save_Button; // End of variables declaration//GEN-END:variables }
[ "gaurav.gupta.jc@gmail.com" ]
gaurav.gupta.jc@gmail.com
0a391128355a75058d2443083dd50a8895a58417
8019cbbf79d2023058f09df6f520b2aa499b3462
/eureka-client/src/main/java/com/eurekaClient/ServletInitializer.java
ea8f2ae2dbdafc7a8acea07fb8dfe93924ef106c
[]
no_license
minghaozhi/springCloud
f01b8408923f9d8047e87082f2575d1ffcf5bb3a
3e60fbd822467142cae548a834354dffce54970d
refs/heads/master
2020-03-17T09:18:44.238656
2018-05-15T09:47:37
2018-05-15T09:47:37
133,469,327
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package com.eurekaClient; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(EurekaClientApplication.class); } }
[ "597575122@qq.com" ]
597575122@qq.com
9f4eb7235aebf4fea794f4315f3d819b8e6386f6
44e7bd0a3c2ec91bf175cce8061b913c53213be1
/src/main/java/com/urban/app/Application.java
da76943d0a86ed046e53ba942d8cec64dd7f4593
[]
no_license
darchambault/urban
71fbabcecfd95d331535002bffc5d368fbf204be
3605c891715b4acf46a8db781dbe89e55ab78a0f
refs/heads/master
2016-09-09T18:29:45.082631
2012-05-18T22:22:49
2012-05-18T22:22:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package com.urban.app; import com.urban.app.loaders.Loader; import com.urban.app.loaders.XmlLoader; import com.urban.app.renderers.ConsoleLogRenderer; import com.urban.app.renderers.Renderer; import com.urban.simengine.ModelRunner; import com.urban.simengine.models.Model; public class Application { public static void main(String [] args) { try { Loader loader = new XmlLoader("resources/scenario1.xml"); Model model = loader.getModel(); Renderer renderer = new ConsoleLogRenderer(model); renderer.start(); ModelRunner modelRunner = new ModelRunner(model); modelRunner.run(); } catch (Exception exc) { exc.printStackTrace(); System.exit(1); } } }
[ "--global" ]
--global
7b71b21d438addd20293917a180beec66200f34a
490b785ad2d51935eda3cf34eea293e073bd5e1f
/app/src/main/java/org/muganga/activities/NotificationActivity.java
a8b5250d8da98729a238f45ce73e865c79da0d4c
[]
no_license
ngaruko/Muganga
2e8d7517ed610a6c4cfc6da5f8b3ffc1b14cb07b
6fd899078511a56c33234c1424675d129182de08
refs/heads/master
2021-01-15T09:41:54.007522
2016-10-07T04:08:03
2016-10-07T04:08:03
68,344,807
0
0
null
null
null
null
UTF-8
Java
false
false
1,361
java
package org.muganga.activities; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import org.muganga.MainActivity; import org.muganga.R; public class NotificationActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notification); Intent intent = new Intent(getApplicationContext(), MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 1, intent, 0); Notification notification = new Notification.Builder(getApplicationContext()) .setContentTitle("Lunch is ready!") .setContentText("It's getting cold...") .setContentIntent(pendingIntent) .addAction(android.R.drawable.sym_action_chat, "Chat", pendingIntent) .setSmallIcon(android.R.drawable.sym_def_app_icon) .setAutoCancel(true) .build(); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(1, notification); } }
[ "ngarukob@yahoo.com" ]
ngarukob@yahoo.com
983da703132e3b6b2a72080542340687ed21e573
f855001df5a2ae2fb79525beefa213733fc22a49
/siif-data-migrator/src/main/java/ar/gob/mpf/siif/datamigrator/model/entities/kiwi/OcmarcMediacionesEventoPK.java
e0a3ff2a6722c807a305a8bc78089760f3b5fa33
[]
no_license
abelluque/siif-parent
170d5758dcd974b20eb4b328092ef1cf11e4e58e
e8810dd49381f64f78ae7f589f813e81eaffbfc8
refs/heads/master
2021-01-12T09:18:21.900899
2016-12-19T02:30:33
2016-12-19T02:30:33
76,819,890
0
0
null
null
null
null
UTF-8
Java
false
false
1,365
java
package ar.gob.mpf.siif.datamigrator.model.entities.kiwi; import java.io.Serializable; import javax.persistence.*; /** * The primary key class for the ocmarc_mediaciones_eventos database table. * */ @Embeddable public class OcmarcMediacionesEventoPK implements Serializable { //default serial version id, required for serializable classes. private static final long serialVersionUID = 1L; @Column(name="ocm_code") private int ocmCode; @Temporal(TemporalType.TIMESTAMP) @Column(name="ome_fecha") private java.util.Date omeFecha; public OcmarcMediacionesEventoPK() { } public int getOcmCode() { return this.ocmCode; } public void setOcmCode(int ocmCode) { this.ocmCode = ocmCode; } public java.util.Date getOmeFecha() { return this.omeFecha; } public void setOmeFecha(java.util.Date omeFecha) { this.omeFecha = omeFecha; } public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof OcmarcMediacionesEventoPK)) { return false; } OcmarcMediacionesEventoPK castOther = (OcmarcMediacionesEventoPK)other; return (this.ocmCode == castOther.ocmCode) && this.omeFecha.equals(castOther.omeFecha); } public int hashCode() { final int prime = 31; int hash = 17; hash = hash * prime + this.ocmCode; hash = hash * prime + this.omeFecha.hashCode(); return hash; } }
[ "aluque@technisys.com" ]
aluque@technisys.com
7d3abfdd9fe58fe22d29d038ea3ae491e96613f1
6401cb1efd9154e1b7e6c988bab42b1f939c514f
/app/src/androidTest/java/my/mimos/mitujusdk/v2/ExampleInstrumentedTest.java
a1b6868f3f0b6e15ba837b434c13480abd5d3767
[]
no_license
faizjim/mituju2-sdk-sample
c929371bba3e72b80cfd4dde77fff6e7e61df275
4bd3dece26345d6401bd754a8824e37d0b6f2405
refs/heads/master
2020-04-18T17:30:11.055891
2018-09-03T02:08:02
2018-09-03T02:08:02
167,656,330
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package my.mimos.mitujusdk.v2; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("my.mimos.mituju.v2", appContext.getPackageName()); } }
[ "joeel1@gmail.com" ]
joeel1@gmail.com
01814e09e4c504d8fda000d404709cd29abc8b8b
280d1fe24e21aa8c60462efb2897975265430ee3
/src/lt/swedbank/itacademy/lecture2task/task4/CompoundInterestCalculator.java
c92f8d096fb2cd1af6af9b33b2459467aa816372
[]
no_license
augustinasrce/Lecture2Task
c449b77c8eacd9882dddd23b9bb60ece8bad93d9
cddd58241a650885c09cc7142f4a5af8b58eedc1
refs/heads/master
2021-01-24T01:59:19.017283
2018-02-25T19:42:53
2018-02-25T19:42:53
122,829,932
0
0
null
null
null
null
UTF-8
Java
false
false
2,724
java
package lt.swedbank.itacademy.lecture2task.task4; import java.util.Arrays; import java.util.Scanner; public class CompoundInterestCalculator { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Amount: "); double amount = scanner.nextDouble(); System.out.print("Period length (years): "); int periodInYears = scanner.nextInt(); System.out.print("Compound frequency: "); int compoundFrequency = findCompoundFrequency(scanner.next()); double interestRate; double[] interestRateArray = new double[0]; int elements = 0; do { System.out.print("Interest rate (%): "); interestRate = scanner.nextDouble(); if (interestRate != 0) { interestRateArray = Arrays.copyOf(interestRateArray, elements + 1); interestRateArray[elements] = interestRate; elements++; } } while (interestRate != 0); for (int i = 0; i < elements; i++) { for (double calculatedValue : calculateIntermediateInterestAmount(amount, interestRateArray[i], periodInYears, compoundFrequency)) { System.out.printf("%.2f ", calculatedValue); } System.out.println(); } } private static double[] calculateIntermediateInterestAmount(double amount, double rate, int periodInYears, int compoundFrequency) { double[] intermediateInterests = new double[compoundFrequency * periodInYears]; double intermediateTotalAmount; for (int i = 0; i < compoundFrequency * periodInYears; i++) { intermediateTotalAmount = calculateIntermediateTotalAmount(amount, rate); intermediateInterests[i] = calculateInterestAmount(amount, intermediateTotalAmount); amount = intermediateTotalAmount; } return intermediateInterests; } private static double calculateInterestAmount(double amount, double totalAmount) { return totalAmount - amount; } private static double calculateIntermediateTotalAmount(double amount, double interestRate) { return amount * (1 + interestRate / 100); } private static int findCompoundFrequency(String compountFrequencyCode) { switch (compountFrequencyCode) { case "D": return 365; case "W": return 52; case "M": return 12; case "Q": return 4; case "H": return 2; case "Y": return 1; default: return 1; } } }
[ "augustinas.sueris@gmail.com" ]
augustinas.sueris@gmail.com
011b722fdbf5007d251cdb2d9e3bf7ebb977efe2
ad52debc9b29bcda0bd3e0d8f77bf9f42162cd84
/src/A06_Tiefensuche/Tiefensuche.java
85bafaeec1b89190c34470d1d7a0a3962b3f7a33
[]
no_license
milli133/ALDUEUebungen
146cd259f5d5c48f10b18a0233b5f73ec83981e4
7a64d91f85503f2121fa3d64fac5739ef65e657b
refs/heads/master
2023-04-25T16:13:52.610567
2021-05-17T12:28:25
2021-05-17T12:28:25
362,909,902
0
0
null
null
null
null
MacCentralEurope
Java
false
false
1,093
java
package A06_Tiefensuche; import java.util.List; import A05_Breitensuche.BaseTree; import A05_Breitensuche.Node; public class Tiefensuche extends BaseTree<Film> { @Override /** * Sortierkriterium im Baum: Lšnge des Films */ protected int compare(Film a, Film b) { if (a.getLšnge() > b.getLšnge()) return -1; if (a.getLšnge() < b.getLšnge()) return 1; return 0; } /** * Retourniert die Titelliste der Film-Knoten des Teilbaums in symmetrischer Folge (engl. in-order, d.h. links-Knoten-rechts) * @param node Wurzelknoten des Teilbaums * @return Liste der Titel in symmetrischer Reihenfolge */ public List<String> getNodesInOrder(Node<Film> node) { return null; } /** * Retourniert Titelliste jener Filme, deren Lšnge zwischen min und max liegt, in Hauptreihenfolge (engl. pre-order, d.h. Knoten-links-rechts) * @param min Minimale Lšnge des Spielfilms * @param max Maximale Lšnge des Spielfilms * @return Liste der Filmtitel in Hauptreihenfolge */ public List<String> getMinMaxPreOrder(double min, double max) { return null; } }
[ "you@example.com" ]
you@example.com
735811b5b526123bd179de65f7fefac92aee882f
69deaeab671a97cf1d26eeaff7e5fdbdff4d5fcc
/src/main/java/Start.java
0d82857605b63b992d4dc2056a0a96f0c8c76213
[]
no_license
DenzelHopkins/ma-preprocessing
43ff884e6002c70f55fc248cbe1591bf405bd60b
17671aff0656bbbfb8ecfdd7c065f0309499aa60
refs/heads/master
2022-09-19T22:13:00.427290
2020-05-22T10:14:35
2020-05-22T10:14:35
233,227,417
0
0
null
null
null
null
UTF-8
Java
false
false
1,890
java
import org.json.JSONObject; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Start { public static void main(String[] args) throws IOException { /* Parameter */ String system = args[0]; boolean otherClass = Boolean.parseBoolean(args[1]); // Include Other-Class or not int windowSize = Integer.parseInt(args[2]); // WindowsSize Sensor based int trainingDuration = 30; // TrainingDuration in days int amountOfMotionSensors = 32; // Amount of the Motion Sensors int amountOfDoorSensors = 4; // Amount of the Door Sensors /* Get startTime of the first dataSegment */ LocalDateTime startTime = LocalDateTime.parse( "2010-11-04 00:03:50.209589", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS")); /* Build processing class */ Processing pre = new Processing( otherClass, windowSize, trainingDuration, amountOfMotionSensors, amountOfDoorSensors, startTime); /* HTTP request to initialize the server */ RequestHandler requestHandler = new RequestHandler(); JSONObject jsonRequest = new JSONObject(); JSONObject answer; jsonRequest.put("system", system); answer = requestHandler.initializeServer(jsonRequest); System.out.println(answer.getString("answer")); /* Iterate over data */ BufferedReader br = new BufferedReader(new FileReader("datenerfassung/src/main/data/arubaTest.json")); String line; JSONObject message; while ((line = br.readLine()) != null) { message = new JSONObject(line); pre.run(message); } requestHandler.getSolutions(); } }
[ "lz56wobe@studserv.uni-leipzig.de" ]
lz56wobe@studserv.uni-leipzig.de
0b0375525d51f28417020ba4e009374e9246aca3
8c9be073690049cc85c2218e46d0147a1b81e543
/ProjetLuna/src/main/java/com/formation/vue/PAjoutModif.java
122c3e728f912c09eba79137ab5e19540609044b
[]
no_license
Alievin/ProjetLuna
1fee637fab001afe3ebd37ce746e3b6846cfd13d
1d29d9c535bb2a93ea223e1cb622d98b1c538077
refs/heads/master
2021-08-23T19:52:09.781029
2017-12-06T09:04:30
2017-12-06T09:04:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,806
java
package com.formation.vue; import javax.swing.JPanel; import java.awt.Panel; import java.awt.Color; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JLabel; import java.awt.Font; import javax.swing.JButton; import javax.swing.border.EmptyBorder; import javax.swing.SwingConstants; import javax.swing.JTextField; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.ImageIcon; import javax.swing.border.TitledBorder; import com.global.singleton.GlobalConnection; import luna_Class.Client; import luna_DAO.ClientDAO; import luna_DAO.ClientDAOMysql; import javax.swing.border.MatteBorder; import javax.swing.JCheckBox; import java.awt.event.ActionListener; import java.util.List; import java.awt.event.ActionEvent; import javax.swing.JTextPane; public class PAjoutModif extends JPanel { private JTextField textField_Code; private JTextField textField_Name; private JTextField textField_Address; private JTextField textField_Zip; private JTextField textField_Firstname; private JTextField textField_Phone; private JTextField textField_Mobile; private JTextField textField_Email; private JTextPane textPane; private JCheckBox chckbx_Fidelitycard; private JTextField textField_Date; /** * Create the panel. */ public PAjoutModif(Accueil parent, boolean ajoutOuModif) { setBorder(null); Panel panel = new Panel(); panel.setBackground(new Color(0, 153, 153)); JLabel label = new JLabel("Clients"); label.setIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/client/User-Add-64.png"))); label.setFont(new Font("Tahoma", Font.BOLD, 20)); JButton btnSauvegarder = new JButton("Sauvegarder"); btnSauvegarder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Client client=new Client(textField_Date.getText(), (chckbx_Fidelitycard.isSelected())? 1 : 0, textField_Firstname.getText(), textField_Name.getText(), textField_Address.getText(), Integer.parseInt(textField_Zip.getText()), Integer.parseInt(textField_Phone.getText()), Integer.parseInt(textField_Mobile.getText()), textField_Email.getText(), textPane.getText()); ClientDAO clientDAO=new ClientDAOMysql(GlobalConnection.getInstance()); if(ajoutOuModif==false) { clientDAO.insertClient(client); } else { clientDAO.updateClient(client); } } }); btnSauvegarder.setPressedIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Save-48-actif.png"))); btnSauvegarder.setIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Save-48.png"))); btnSauvegarder.setOpaque(false); btnSauvegarder.setHorizontalAlignment(SwingConstants.LEFT); btnSauvegarder.setForeground(Color.WHITE); btnSauvegarder.setFocusPainted(false); btnSauvegarder.setContentAreaFilled(false); btnSauvegarder.setBorder(new EmptyBorder(0, 0, 0, 0)); JButton button_4 = new JButton("Exporter"); button_4.setIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Data-Export-48.png"))); button_4.setPressedIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Data-Export-48-actif.png"))); button_4.setOpaque(false); button_4.setHorizontalAlignment(SwingConstants.LEFT); button_4.setForeground(Color.WHITE); button_4.setFocusPainted(false); button_4.setContentAreaFilled(false); button_4.setBorder(new EmptyBorder(0, 0, 0, 0)); JButton button_5 = new JButton("Imprimer"); button_5.setPressedIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Printer-48-actif.png"))); button_5.setIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Printer-48.png"))); button_5.setOpaque(false); button_5.setHorizontalAlignment(SwingConstants.LEFT); button_5.setForeground(Color.WHITE); button_5.setFocusPainted(false); button_5.setContentAreaFilled(false); button_5.setBorder(new EmptyBorder(0, 0, 0, 0)); JButton button_6 = new JButton("Apercu"); button_6.setIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Preview-48.png"))); button_6.setPressedIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Preview-48-actif.png"))); button_6.setOpaque(false); button_6.setHorizontalAlignment(SwingConstants.LEFT); button_6.setForeground(Color.WHITE); button_6.setFocusPainted(false); button_6.setContentAreaFilled(false); button_6.setBorder(new EmptyBorder(0, 0, 0, 0)); JButton button_7 = new JButton("Accueil"); button_7.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { parent.afficherFenetre(1); } }); button_7.setPressedIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Home-48-actif.png"))); button_7.setIcon(new ImageIcon(PAjoutModif.class.getResource("/images/gestion/Home-48.png"))); button_7.setOpaque(false); button_7.setHorizontalAlignment(SwingConstants.LEFT); button_7.setForeground(Color.WHITE); button_7.setFocusPainted(false); button_7.setContentAreaFilled(false); button_7.setBorder(new EmptyBorder(0, 0, 0, 0)); Panel panel_Menu = new Panel(); panel_Menu.setBackground(new Color(230, 230, 250)); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup( gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup() .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addComponent(label, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panel.createSequentialGroup() .addGap(10) .addComponent(button_6, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel.createSequentialGroup() .addContainerGap() .addComponent(btnSauvegarder, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel.createSequentialGroup() .addContainerGap() .addComponent(button_5, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel.createSequentialGroup() .addContainerGap() .addComponent(button_4, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE))) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup() .addContainerGap(20, Short.MAX_VALUE) .addComponent(button_7, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); gl_panel.setVerticalGroup( gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup() .addComponent(label, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(btnSauvegarder) .addGap(124) .addComponent(button_6) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(button_5) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(button_4) .addGap(68) .addComponent(button_7) .addContainerGap()) ); panel.setLayout(gl_panel); JPanel panel_Client = new JPanel(); panel_Client.setOpaque(false); panel_Client.setBorder(new TitledBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)), "Client", TitledBorder.LEFT, TitledBorder.TOP, null, Color.GRAY)); JPanel panel_Civil_State = new JPanel(); panel_Civil_State.setOpaque(false); panel_Civil_State.setBorder(new TitledBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)), "Etats civils", TitledBorder.LEFT, TitledBorder.TOP, null, new Color(128, 128, 128))); JPanel panel_Contact_Info = new JPanel(); panel_Contact_Info.setOpaque(false); panel_Contact_Info.setBorder(new TitledBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)), "Coordon\u00E9es", TitledBorder.LEFT, TitledBorder.TOP, null, new Color(128, 128, 128))); JPanel panel_Note = new JPanel(); panel_Note.setOpaque(false); panel_Note.setBorder(new TitledBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)), "Remarques", TitledBorder.LEFT, TitledBorder.TOP, null, new Color(128, 128, 128))); GroupLayout gl_panel_Menu = new GroupLayout(panel_Menu); gl_panel_Menu.setHorizontalGroup( gl_panel_Menu.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_Menu.createSequentialGroup() .addContainerGap() .addGroup(gl_panel_Menu.createParallelGroup(Alignment.LEADING) .addComponent(panel_Civil_State, GroupLayout.PREFERRED_SIZE, 467, Short.MAX_VALUE) .addComponent(panel_Note, GroupLayout.DEFAULT_SIZE, 467, Short.MAX_VALUE) .addComponent(panel_Client, GroupLayout.PREFERRED_SIZE, 467, Short.MAX_VALUE) .addComponent(panel_Contact_Info, GroupLayout.DEFAULT_SIZE, 467, Short.MAX_VALUE)) .addContainerGap()) ); gl_panel_Menu.setVerticalGroup( gl_panel_Menu.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Menu.createSequentialGroup() .addContainerGap() .addComponent(panel_Client, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) .addGap(11) .addComponent(panel_Civil_State, GroupLayout.PREFERRED_SIZE, 99, GroupLayout.PREFERRED_SIZE) .addGap(30) .addComponent(panel_Contact_Info, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(panel_Note, GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE) .addContainerGap()) ); textPane = new JTextPane(); GroupLayout gl_panel_Note = new GroupLayout(panel_Note); gl_panel_Note.setHorizontalGroup( gl_panel_Note.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Note.createSequentialGroup() .addContainerGap() .addComponent(textPane, GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE) .addContainerGap()) ); gl_panel_Note.setVerticalGroup( gl_panel_Note.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Note.createSequentialGroup() .addComponent(textPane, GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE) .addContainerGap()) ); panel_Note.setLayout(gl_panel_Note); JLabel lbl_Phone = new JLabel("Fixe"); textField_Phone = new JTextField(); textField_Phone.setColumns(10); JLabel lbl_Mobile = new JLabel("Mobile"); textField_Mobile = new JTextField(); textField_Mobile.setColumns(10); JLabel lbl_Email = new JLabel("Email"); textField_Email = new JTextField(); textField_Email.setColumns(10); GroupLayout gl_panel_Contact_Info = new GroupLayout(panel_Contact_Info); gl_panel_Contact_Info.setHorizontalGroup( gl_panel_Contact_Info.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Contact_Info.createSequentialGroup() .addContainerGap() .addGroup(gl_panel_Contact_Info.createParallelGroup(Alignment.TRAILING) .addComponent(lbl_Email) .addComponent(lbl_Phone)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panel_Contact_Info.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Contact_Info.createSequentialGroup() .addComponent(textField_Phone, GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE) .addGap(10) .addComponent(lbl_Mobile, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(textField_Mobile, GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE) .addGap(1)) .addComponent(textField_Email, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)) .addContainerGap()) ); gl_panel_Contact_Info.setVerticalGroup( gl_panel_Contact_Info.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Contact_Info.createSequentialGroup() .addContainerGap() .addGroup(gl_panel_Contact_Info.createParallelGroup(Alignment.BASELINE) .addComponent(lbl_Phone) .addComponent(textField_Phone, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) .addComponent(lbl_Mobile) .addComponent(textField_Mobile, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(gl_panel_Contact_Info.createParallelGroup(Alignment.BASELINE) .addComponent(lbl_Email) .addComponent(textField_Email, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); panel_Contact_Info.setLayout(gl_panel_Contact_Info); JLabel lbl_Firstname = new JLabel("Pr\u00E9nom"); textField_Name = new JTextField(); textField_Name.setColumns(10); JLabel lbl_Address = new JLabel("Adresse"); textField_Address = new JTextField(); textField_Address.setColumns(10); JLabel lbl_Zip = new JLabel("Code postal"); textField_Zip = new JTextField(); textField_Zip.setColumns(10); textField_Firstname = new JTextField(); textField_Firstname.setColumns(10); JLabel lbl_Name = new JLabel("Nom"); GroupLayout gl_panel_Civil_State = new GroupLayout(panel_Civil_State); gl_panel_Civil_State.setHorizontalGroup( gl_panel_Civil_State.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Civil_State.createSequentialGroup() .addContainerGap() .addGroup(gl_panel_Civil_State.createParallelGroup(Alignment.LEADING, false) .addComponent(lbl_Firstname, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_Address, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(28) .addGroup(gl_panel_Civil_State.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Civil_State.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Civil_State.createSequentialGroup() .addComponent(textField_Firstname, GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE) .addGap(9) .addComponent(lbl_Name, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(textField_Name, GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE) .addGap(10)) .addGroup(gl_panel_Civil_State.createSequentialGroup() .addComponent(textField_Address, GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE) .addContainerGap())) .addGroup(Alignment.TRAILING, gl_panel_Civil_State.createSequentialGroup() .addComponent(lbl_Zip, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textField_Zip, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE) .addGap(94)))) ); gl_panel_Civil_State.setVerticalGroup( gl_panel_Civil_State.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Civil_State.createSequentialGroup() .addContainerGap() .addGroup(gl_panel_Civil_State.createParallelGroup(Alignment.BASELINE) .addComponent(lbl_Firstname) .addComponent(textField_Name, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE) .addComponent(lbl_Name) .addComponent(textField_Firstname, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_Civil_State.createParallelGroup(Alignment.BASELINE) .addComponent(lbl_Address) .addComponent(textField_Address, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_Civil_State.createParallelGroup(Alignment.BASELINE) .addComponent(textField_Zip, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE) .addComponent(lbl_Zip)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); panel_Civil_State.setLayout(gl_panel_Civil_State); JLabel lbl_Code = new JLabel("Code"); textField_Code = new JTextField(); textField_Code.setColumns(10); JLabel lbl_Create = new JLabel("Cr\u00E9e le"); chckbx_Fidelitycard = new JCheckBox("Carte de fid\u00E9lit\u00E9"); chckbx_Fidelitycard.setOpaque(false); textField_Date = new JTextField(); textField_Date.setColumns(10); GroupLayout gl_panel_Client = new GroupLayout(panel_Client); gl_panel_Client.setHorizontalGroup( gl_panel_Client.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Client.createSequentialGroup() .addGap(20) .addComponent(lbl_Code) .addGap(10) .addComponent(textField_Code, GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE) .addGap(18) .addComponent(lbl_Create) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textField_Date, GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE) .addGap(5) .addComponent(chckbx_Fidelitycard)) ); gl_panel_Client.setVerticalGroup( gl_panel_Client.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_Client.createSequentialGroup() .addGap(4) .addComponent(lbl_Code)) .addGroup(gl_panel_Client.createSequentialGroup() .addGap(1) .addComponent(textField_Code, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_Client.createSequentialGroup() .addGap(4) .addComponent(lbl_Create)) .addGroup(gl_panel_Client.createParallelGroup(Alignment.BASELINE) .addComponent(chckbx_Fidelitycard) .addComponent(textField_Date, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ); panel_Client.setLayout(gl_panel_Client); panel_Menu.setLayout(gl_panel_Menu); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addComponent(panel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(1) .addComponent(panel_Menu, GroupLayout.PREFERRED_SIZE, 487, Short.MAX_VALUE) .addContainerGap()) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE) .addGroup(groupLayout.createSequentialGroup() .addComponent(panel_Menu, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(10)) ); setLayout(groupLayout); } public void doubleClicked(int numClients) { ClientDAO clientDAO=new ClientDAOMysql(GlobalConnection.getInstance()); List<Client> clients = clientDAO.getAllClient(); textField_Code.setText(String.valueOf(clients.get(numClients).getId())); textField_Firstname.setText(clients.get(numClients).getPrenom()); textField_Name.setText(clients.get(numClients).getNom()); textField_Mobile.setText(String.valueOf(clients.get(numClients).getMobile())); textField_Address.setText(clients.get(numClients).getAdresse()); textField_Phone.setText(String.valueOf(clients.get(numClients).getFixe())); textField_Email.setText(clients.get(numClients).getEmail()); textPane.setText(clients.get(numClients).getRemarques()); textField_Date.setText(String.valueOf(clients.get(numClients).getDateCreation())); textField_Zip.setText(String.valueOf(clients.get(numClients).getCodePostal())); chckbx_Fidelitycard.setSelected((clients.get(numClients).getCartedefidelite()) != 0); } }
[ "lucien.grimonpont@gmail.com" ]
lucien.grimonpont@gmail.com
1d94d4ad71e1991b17d75156fc481dd8e66252f2
318b813ad38900bf63c6d7978dc5e0f674d1f847
/Chapter 4 - Example 16/src/main/java/br/com/acaosistemas/amazonwrapped/BrowseNodeLookup.java
9ea53e432b13c117ebc48e20eda49f8132697b1d
[]
no_license
MarceloLeite2604/JWSUR2E
9f14ef3ade90549b7c3d55890a317d23e93fdf6b
d77d595ed98cd11059376eae00a40954dcd157c1
refs/heads/master
2021-01-10T17:01:25.254898
2019-07-02T18:41:54
2019-07-02T18:41:54
43,815,334
0
0
null
2020-06-30T23:15:32
2015-10-07T12:49:16
Java
ISO-8859-1
Java
false
false
6,471
java
package br.com.acaosistemas.amazonwrapped; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java de anonymous complex type. * * <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="MarketplaceDomain" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="AWSAccessKeyId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="AssociateTag" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="Validate" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="XMLEscaping" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="Shared" type="{http://webservices.amazon.com/AWSECommerceService/2011-08-01}BrowseNodeLookupRequest" minOccurs="0"/> * &lt;element name="Request" type="{http://webservices.amazon.com/AWSECommerceService/2011-08-01}BrowseNodeLookupRequest" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "marketplaceDomain", "awsAccessKeyId", "associateTag", "validate", "xmlEscaping", "shared", "request" }) @XmlRootElement(name = "BrowseNodeLookup") public class BrowseNodeLookup { @XmlElement(name = "MarketplaceDomain") protected String marketplaceDomain; @XmlElement(name = "AWSAccessKeyId") protected String awsAccessKeyId; @XmlElement(name = "AssociateTag") protected String associateTag; @XmlElement(name = "Validate") protected String validate; @XmlElement(name = "XMLEscaping") protected String xmlEscaping; @XmlElement(name = "Shared") protected BrowseNodeLookupRequest shared; @XmlElement(name = "Request") protected List<BrowseNodeLookupRequest> request; /** * Obtém o valor da propriedade marketplaceDomain. * * @return * possible object is * {@link String } * */ public String getMarketplaceDomain() { return marketplaceDomain; } /** * Define o valor da propriedade marketplaceDomain. * * @param value * allowed object is * {@link String } * */ public void setMarketplaceDomain(String value) { this.marketplaceDomain = value; } /** * Obtém o valor da propriedade awsAccessKeyId. * * @return * possible object is * {@link String } * */ public String getAWSAccessKeyId() { return awsAccessKeyId; } /** * Define o valor da propriedade awsAccessKeyId. * * @param value * allowed object is * {@link String } * */ public void setAWSAccessKeyId(String value) { this.awsAccessKeyId = value; } /** * Obtém o valor da propriedade associateTag. * * @return * possible object is * {@link String } * */ public String getAssociateTag() { return associateTag; } /** * Define o valor da propriedade associateTag. * * @param value * allowed object is * {@link String } * */ public void setAssociateTag(String value) { this.associateTag = value; } /** * Obtém o valor da propriedade validate. * * @return * possible object is * {@link String } * */ public String getValidate() { return validate; } /** * Define o valor da propriedade validate. * * @param value * allowed object is * {@link String } * */ public void setValidate(String value) { this.validate = value; } /** * Obtém o valor da propriedade xmlEscaping. * * @return * possible object is * {@link String } * */ public String getXMLEscaping() { return xmlEscaping; } /** * Define o valor da propriedade xmlEscaping. * * @param value * allowed object is * {@link String } * */ public void setXMLEscaping(String value) { this.xmlEscaping = value; } /** * Obtém o valor da propriedade shared. * * @return * possible object is * {@link BrowseNodeLookupRequest } * */ public BrowseNodeLookupRequest getShared() { return shared; } /** * Define o valor da propriedade shared. * * @param value * allowed object is * {@link BrowseNodeLookupRequest } * */ public void setShared(BrowseNodeLookupRequest value) { this.shared = value; } /** * Gets the value of the request property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the request property. * * <p> * For example, to add a new item, do as follows: * <pre> * getRequest().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link BrowseNodeLookupRequest } * * */ public List<BrowseNodeLookupRequest> getRequest() { if (request == null) { request = new ArrayList<BrowseNodeLookupRequest>(); } return this.request; } }
[ "marceloleite2604@gmail.com" ]
marceloleite2604@gmail.com
baefe63b73b08e28a480e58c8d445bdb4f39e8a9
c82f89b0e6d1547c2829422e7de7664b378c1039
/src/com/hongyu/service/impl/ReceiptDetailBranchServiceImpl.java
dae8c02d89fbf97f5885df796f2d001cc3ed8687
[]
no_license
chenxiaoyin3/shetuan_backend
1bab5327cafd42c8086c25ade7e8ce08fda6a1ac
e21a0b14a2427c9ad52ed00f68d5cce2689fdaeb
refs/heads/master
2022-05-15T14:52:07.137000
2022-04-07T03:30:57
2022-04-07T03:30:57
250,762,749
1
2
null
null
null
null
UTF-8
Java
false
false
700
java
package com.hongyu.service.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.grain.service.impl.BaseServiceImpl; import com.hongyu.dao.ReceiptDetailBranchDao; import com.hongyu.entity.ReceiptDetailBranch; import com.hongyu.service.ReceiptDetailBranchService; @Service("receiptDetailBranchServiceImpl") public class ReceiptDetailBranchServiceImpl extends BaseServiceImpl<ReceiptDetailBranch, Long> implements ReceiptDetailBranchService { @Resource(name = "receiptDetailBranchDaoImpl") ReceiptDetailBranchDao dao; @Resource(name = "receiptDetailBranchDaoImpl") public void setBaseDao(ReceiptDetailBranchDao dao) { super.setBaseDao(dao); } }
[ "925544714@qq.com" ]
925544714@qq.com
a8805b7b28a94384b80e312ba8f4bed14ca993e7
17c7cc174a4212674a83206b08d43893b0c5c822
/src/main/java/gutenberg/pegdown/plugin/AttributeListNode.java
9b33e1afe2f19d3b3bcf656c1b12f698a78e0bb0
[ "MIT" ]
permissive
Arnauld/gutenberg
b321bb34dedd371820f359b0ca8c052d72c09767
18d761ddba378ee58a3f3dc6316f66742df8d985
refs/heads/master
2021-05-15T01:47:02.146235
2019-02-12T21:50:43
2019-02-12T21:50:43
22,622,311
3
3
MIT
2019-02-12T21:44:20
2014-08-04T22:36:02
Java
UTF-8
Java
false
false
933
java
package gutenberg.pegdown.plugin; import org.parboiled.common.ImmutableList; import org.pegdown.ast.AbstractNode; import org.pegdown.ast.Node; import org.pegdown.ast.Visitor; import java.util.ArrayList; import java.util.List; /** * @author <a href="http://twitter.com/aloyer">@aloyer</a> */ public class AttributeListNode extends AbstractNode { private List<AttributeNode> nodes = new ArrayList<AttributeNode>(); public AttributeListNode() { } @Override public void accept(Visitor visitor) { visitor.visit(this); } @Override public List<Node> getChildren() { return ImmutableList.of(); } @Override public String toString() { return "AttributeListNode{" + nodes + '}'; } public boolean append(AttributeNode node) { nodes.add(node); return true; } public List<AttributeNode> getAttributes() { return nodes; } }
[ "arnauld.loyer@gmail.com" ]
arnauld.loyer@gmail.com
7d36b9671bba432829c308dadcc91884cba69f2c
f0cbf526b7c4c871eb55c08231e1391308e83f8c
/2к2с/MyOwnProject1/src/main/java/project/models/devices/motherboard/MotherBoard.java
c55949b8b837a2c243ee10a2b88b481096ac591e
[]
no_license
DieMass/JavaLab
fef58479a5a3f1b1ef8dfd21f0d569949648aff9
fca656e64482b1dcb9f09482e582bc84e02235db
refs/heads/master
2022-12-22T01:36:08.658890
2021-01-08T09:25:56
2021-01-08T09:25:56
219,543,639
0
0
null
2022-12-16T15:28:33
2019-11-04T16:15:31
Java
UTF-8
Java
false
false
702
java
package project.models.devices.motherboard; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import project.models.devices.adapters.PCIe; import project.models.devices.adapters.Socket; import project.models.devices.general.Company; import javax.persistence.*; @NoArgsConstructor @AllArgsConstructor @Builder @Data @Entity public class MotherBoard { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; @ManyToOne private Company company; @ManyToOne private Socket socket; @ManyToOne private Chipset chipset; @ManyToOne private FormFactor formFactor; @ManyToOne private PCIe pcie; }
[ "diemass1908@gmail.com" ]
diemass1908@gmail.com
eb2b82f0023774129f2be13227c97858be68e1d2
8ee10e0c5f2b7b67dc916da5630a4a637f052b78
/src/com/hungry/handler/UserHandler.java
36fd3048fee7bf76c492d89d9937c550d68c3797
[]
no_license
dengyouquan/Hungry
b59b6f94d5b0b7182c82231639e5b8c1916e345b
0dfa93b4335cc0e8ab3943de72dfe78cb8a3cba7
refs/heads/master
2021-09-09T01:07:21.013338
2018-03-13T05:31:42
2018-03-13T05:31:42
124,997,342
0
0
null
null
null
null
UTF-8
Java
false
false
3,862
java
package com.hungry.handler; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.Date; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.hungry.dao.OrderDao; import com.hungry.dao.UserDao; import com.hungry.entities.User; @Controller public class UserHandler { @Autowired private UserDao userDao; //show all users @RequestMapping(value="/users") public String userList(Map<String,Object> map){ List<User> users = userDao.getAll(); map.put("users", users); System.out.println("userList"); return "userList"; } @RequestMapping(value="/user",method=RequestMethod.GET) public String userInput(Map<String,Object> map){ System.out.println("userInput"); map.put("user", new User()); return "userInput"; } //add user @RequestMapping(value="/user",method=RequestMethod.POST) public String save(@Valid User user,BindingResult result,Map<String, Object> map, @RequestParam("name") String name,@RequestParam("address") String address, @RequestParam("memo") String memo){ try { name = new String(name.getBytes("ISO-8859-1"),"UTF-8"); System.out.println(name); user.setName(name); address = new String(address.getBytes("ISO-8859-1"),"UTF-8"); System.out.println(address); user.setAddress(address); memo = new String(memo.getBytes("ISO-8859-1"),"UTF-8"); System.out.println(memo); user.setMemo(memo); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Date d = new Date(System.currentTimeMillis()); user.setCreateTime(d); if(result.getErrorCount()>0){ for(FieldError error : result.getFieldErrors()){ System.out.println(error.getField()+":"+error.getDefaultMessage()); } return "userInput"; }else{ System.out.println("save user:"+user); userDao.saveOrUpdate(user); } return "redirect:/users"; } @RequestMapping(value="/user/{id}",method=RequestMethod.DELETE) public String delete(@PathVariable("id") Integer id){ userDao.delete(id); return "redirect:/users"; } @RequestMapping(value="/user/{id}",method=RequestMethod.GET) public String input(@PathVariable("id") Integer id,Map<String, Object> map){ map.put("user", userDao.get(id)); System.out.println("edit userInput"); return "userInput"; } @ModelAttribute public void getUser(@RequestParam(value="id",required=false) Integer id, Map<String, Object> map){ if(id!=null){ map.put("user", userDao.get(id)); System.out.println("@ModelAttribute+DB:"+userDao.get(id)); } } @RequestMapping(value="/user",method=RequestMethod.PUT) public String update(@Valid User user, @RequestParam("address") String address,@RequestParam("memo") String memo){ try { address = new String(address.getBytes("ISO-8859-1"),"UTF-8"); System.out.println(address); user.setAddress(address); memo = new String(memo.getBytes("ISO-8859-1"),"UTF-8"); System.out.println(memo); user.setMemo(memo); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } System.out.println("update:"+user); userDao.saveOrUpdate(user); return "redirect:/users"; } }
[ "1257207999@qq.com" ]
1257207999@qq.com
dc4df99339b1a00e91a14936e5cdb76ed13d76d2
8e0b8f80546cae3f0d315dbced7586b46f4dbc66
/springboot/src/main/java/com/ac/springboot/SpringbootApplication.java
3b8524665bf3caea57751594a7dbd488aa432eb0
[]
no_license
AngryCow1111/exercises
6584bd379015ba7f1500e13a1a24535453ee61df
14482a383f2be72b07740ee8f7a1e40846cc58c8
refs/heads/master
2023-02-22T20:55:15.666900
2023-02-08T07:36:08
2023-02-08T07:36:08
206,609,918
1
0
null
2021-03-31T21:33:25
2019-09-05T16:30:55
Java
UTF-8
Java
false
false
2,280
java
package com.ac.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.web.context.WebServerInitializedEvent; import org.springframework.context.event.EventListener; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.ServerResponse; import reactor.core.publisher.Mono; import static org.springframework.web.reactive.function.server.RequestPredicates.GET; import static org.springframework.web.reactive.function.server.RouterFunctions.route; import static org.springframework.web.reactive.function.server.ServerResponse.ok; @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) //@Component public class SpringbootApplication { public static void main(String[] args) { SpringApplication.run(SpringbootApplication.class, args); // SpringApplication.run(WebConfiguration.class, args); } // @Bean public RouterFunction<ServerResponse> helloword() { return route(GET("/helloworld"), request -> ok().body(Mono.just("helloworld"), String.class)); } /*** * ApplicationRunner#run方法的特性在springboot启动后会回调。 * @param context * @return */ // @Bean // public ApplicationRunner runner(WebServerApplicationContext context) { //// return new ApplicationRunner() { //// @Override //// public void run(ApplicationArguments args) throws Exception { //// System.out.println("当前webserver的实现类为:"+ //// context.getWebServer().getClass().getName()); //// } //// }; // // return args -> { // System.out.println("当前webserver的实现类为:" + // context.getWebServer().getClass().getName()); // }; // } @EventListener(value = WebServerInitializedEvent.class) public void onWebServerReady(WebServerInitializedEvent event) { System.out.println("当前webserver的实现类为:" + event.getWebServer().getClass().getName()); } }
[ "angrycow1111@gmail.com" ]
angrycow1111@gmail.com
218a4b6f2467f1d3cda7bbfb663491abd7291d21
446d682a06969b04ff637f83fa71b2448fda423f
/tinker/common/IActiveLogic.java
6c1e60d6bf769c34ce47828a200a40ec7f82f68b
[]
no_license
agaricusb/TinkersConstruct
21ad2db01f867a1397788e80be334c7b5bab9213
2f5d798753d1642eb5ee5f15270b6fe73bfdce3c
refs/heads/master
2021-01-16T00:17:33.310208
2013-03-09T11:49:04
2013-03-09T11:49:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
124
java
package tinker.common; public interface IActiveLogic { public boolean getActive(); public void setActive(boolean flag); }
[ "miellekyunni@gmail.com" ]
miellekyunni@gmail.com