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
5d82d44b8f1b99f07429fcc8ddbcf0046f598eff
6e181b57cefca44439eb7f1ca0e4a23cc8365e8c
/java2/src/geekbrains/java_2/lesson_5/Threads.java
26d6c53f256c6fa2645dde9041e796f11125d5a9
[]
no_license
hantarex/java2
fded824a835c362a96f67040a9b069a92a79c791
54cbf2a1cf9ba5e7e34b1ea3261143821fcff8a9
refs/heads/master
2021-01-16T21:36:05.050527
2016-12-17T12:17:33
2016-12-17T12:17:33
68,280,025
0
0
null
null
null
null
UTF-8
Java
false
false
5,338
java
package geekbrains.java_2.lesson_5; public class Threads { private static final int size = 10000000; private static final int h = size / 2; private float[] arr = new float[size]; private float[] arr1 = new float[size]; Threads() { for (int i = 0; i < arr.length; i++) { arr[i] = 1; arr1[i] = 1; } } public void OneThread() { new Thread(new Runnable() { @Override public void run() { long start_time = System.currentTimeMillis(); for (int i = 0; i < arr1.length; i++) { arr1[i] = (float) (arr1[i] * Math.sin(0.2f + i / 5) * Math.cos(0.2f + i / 5) * Math.cos(0.4f + i / 2)); } long stop_time = System.currentTimeMillis(); System.err.println(Thread.currentThread().getName()+" Выполнение в один поток "+Thread.currentThread().getName()+":"); System.err.println(Thread.currentThread().getName()+" Старт в " + start_time); System.err.println(Thread.currentThread().getName()+" Окончание в " + stop_time); System.err.println(Thread.currentThread().getName()+" Время выполнения: " + (double) (stop_time - start_time) / 1000 + " сек."); } }).start(); } public void TwoThreads() { float[] a1=new float[h]; float[] a2=new float[h]; long start_time = System.currentTimeMillis(); System.err.println("Выполнение в два потока:"); System.err.println("Старт в " + start_time); Thread mass_split = new Thread(new Runnable() { @Override public void run() { long start_time = System.currentTimeMillis(); System.arraycopy(arr,0,a1,0,h); System.arraycopy(arr,h,a2,0,h); long stop_time = System.currentTimeMillis(); System.err.println("Время разбивки на два массива: " + (double) (stop_time - start_time) / 1000 + " сек."); } }); mass_split.start(); try { mass_split.join(); } catch (InterruptedException e) { e.printStackTrace(); } Thread first_t=new Thread(new Runnable() { @Override public void run() { long start_time = System.currentTimeMillis(); for (int i = 0; i < a1.length; i++) { a1[i] = (float) (a1[i] * Math.sin(0.2f + i / 5) * Math.cos(0.2f + i / 5) * Math.cos(0.4f + i / 2)); } long stop_time = System.currentTimeMillis(); System.err.println(Thread.currentThread().getName()+" Выполнение в первом потоке:"); System.err.println(Thread.currentThread().getName()+" Старт в " + start_time); System.err.println(Thread.currentThread().getName()+" Окончание в " + stop_time); System.err.println(Thread.currentThread().getName()+" Время выполнения: " + (double) (stop_time - start_time) / 1000 + " сек."); } }); Thread second_t=new Thread(new Runnable() { @Override public void run() { long start_time = System.currentTimeMillis(); for (int i = 0; i < a2.length; i++) { a2[i] = (float) (a2[i] * Math.sin(0.2f + i / 5) * Math.cos(0.2f + i / 5) * Math.cos(0.4f + i / 2)); } long stop_time = System.currentTimeMillis(); System.err.println(Thread.currentThread().getName()+" Выполнение во втором потоке:"); System.err.println(Thread.currentThread().getName()+" Старт в " + start_time); System.err.println(Thread.currentThread().getName()+" Окончание в " + stop_time); System.err.println(Thread.currentThread().getName()+" Время выполнения: " + (double) (stop_time - start_time) / 1000 + " сек."); } }); first_t.start(); second_t.start(); try { first_t.join(); second_t.join(); } catch (InterruptedException e) { e.printStackTrace(); } Thread mass_merge = new Thread(new Runnable() { @Override public void run() { long start_time = System.currentTimeMillis(); System.arraycopy(a1,0,arr,0,h); System.arraycopy(a2,0,arr,h,h); long stop_time = System.currentTimeMillis(); System.err.println("Время склейки двух массивов: " + (double) (stop_time - start_time) / 1000 + " сек."); } }); mass_merge.start(); try { mass_merge.join(); } catch (InterruptedException e) { e.printStackTrace(); } long stop_time = System.currentTimeMillis(); System.err.println("Выполнение в два потока закончено.\nЗатраченное время: " + (double) (stop_time - start_time) / 1000 + " сек."); } }
[ "6546@mail.ru" ]
6546@mail.ru
341270c3bd570832f6f340886ec397742cce34d9
b83cb38c105ee521d9738c50f1daed274c99f1cb
/minecraft/info/spicyclient/ui/Jello/RenderSystem.java
59eee5591d89bb4f11755c8260b7f735e4f4ebc1
[ "MIT" ]
permissive
SuperS123/SpicyClient
3e7141c2245ed4d3fb7d0f63fc25779082531eeb
1c78bd372220754911a8cdfd67e7a434533980f5
refs/heads/master
2023-07-23T11:39:57.368099
2021-09-08T06:55:56
2021-09-08T06:55:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
30,142
java
package info.spicyclient.ui.Jello; import java.awt.Color; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; public class RenderSystem { public static void enableGL2D() { GL11.glDisable(2929); GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glDepthMask(true); GL11.glEnable(2848); GL11.glHint(3154, 4354); GL11.glHint(3155, 4354); } public static void disableGL2D() { GL11.glEnable(3553); GL11.glDisable(3042); GL11.glEnable(2929); GL11.glDisable(2848); GL11.glHint(3154, 4352); GL11.glHint(3155, 4352); } public static void drawBorderedRectReliant(float x2, float y2, float x1, float y1, float lineWidth, int inside, int border) { enableGL2D(); drawRect(x2, y2, x1, y1, inside); glColor(border); GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glLineWidth(lineWidth); GL11.glBegin(3); GL11.glVertex2f(x2, y2); GL11.glVertex2f(x2, y1); GL11.glVertex2f(x1, y1); GL11.glVertex2f(x1, y2); GL11.glVertex2f(x2, y2); GL11.glEnd(); GL11.glEnable(3553); GL11.glDisable(3042); disableGL2D(); } public static void drawGradientBorderedRectReliant(float x2, float y2, float x1, float y1, float lineWidth, int border, int bottom, int top) { enableGL2D(); drawGradientRect(x2, y2, x1, y1, top, bottom); glColor(border); GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glLineWidth(lineWidth); GL11.glBegin(3); GL11.glVertex2f(x2, y2); GL11.glVertex2f(x2, y1); GL11.glVertex2f(x1, y1); GL11.glVertex2f(x1, y2); GL11.glVertex2f(x2, y2); GL11.glEnd(); GL11.glEnable(3553); GL11.glDisable(3042); disableGL2D(); } public static void drawRoundedRect(float x2, float y2, float x1, float y1, int borderC, int insideC) { enableGL2D(); GL11.glScalef(0.5F, 0.5F, 0.5F); drawVLine(x2 *= 2.0F, y2 *= 2.0F + 1.0F, y1 *= 2.0F - 2.0F, borderC); drawVLine(x1 *= 2.0F - 1.0F, y2 + 1.0F, y1 - 2.0F, borderC); drawHLine(x2 + 2.0F, x1 - 3.0F, y2, borderC); drawHLine(x2 + 2.0F, x1 - 3.0F, y1 - 1.0F, borderC); drawHLine(x2 + 1.0F, x2 + 1.0F, y2 + 1.0F, borderC); drawHLine(x1 - 2.0F, x1 - 2.0F, y2 + 1.0F, borderC); drawHLine(x1 - 2.0F, x1 - 2.0F, y1 - 2.0F, borderC); drawHLine(x2 + 1.0F, x2 + 1.0F, y1 - 2.0F, borderC); drawRect(x2 + 1.0F, y2 + 1.0F, x1 - 1.0F, y1 - 1.0F, insideC); GL11.glScalef(2.0F, 2.0F, 2.0F); disableGL2D(); } public static void drawStrip(int x2, int y2, float width, double angle, float points, float radius, int color) { float f1 = (color >> 24 & 0xFF) / 255.0F; float f2 = (color >> 16 & 0xFF) / 255.0F; float f3 = (color >> 8 & 0xFF) / 255.0F; float f4 = (color & 0xFF) / 255.0F; GL11.glPushMatrix(); GL11.glTranslated(x2, y2, 0.0D); GL11.glColor4f(f2, f3, f4, f1); GL11.glLineWidth(width); if (angle > 0.0D) { GL11.glBegin(3); int i2 = 0; while (i2 < angle) { float a2 = (float)(i2 * (angle * 3.141592653589793D / points)); float xc2 = (float)(Math.cos(a2) * radius); float yc2 = (float)(Math.sin(a2) * radius); GL11.glVertex2f(xc2, yc2); i2++; } GL11.glEnd(); } if (angle < 0.0D) { GL11.glBegin(3); int i2 = 0; while (i2 > angle) { float a2 = (float)(i2 * (angle * 3.141592653589793D / points)); float xc2 = (float)(Math.cos(a2) * -radius); float yc2 = (float)(Math.sin(a2) * -radius); GL11.glVertex2f(xc2, yc2); i2--; } GL11.glEnd(); } disableGL2D(); GL11.glDisable(3479); GL11.glPopMatrix(); } public static void drawRect(int x, int y, int x2, int y2, int color) { GuiScreen.drawRect(x, y, x2, y2, color); } /* public static void drawOutlinedBoundingBox(AxisAlignedBB aabb) { WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); Tessellator tessellator = Tessellator.getInstance(); worldRenderer.startDrawing(3); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); tessellator.draw(); worldRenderer.startDrawing(3); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); tessellator.draw(); worldRenderer.startDrawing(1); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); tessellator.draw(); } public static void drawBoundingBox(AxisAlignedBB aabb) { WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); Tessellator tessellator = Tessellator.getInstance(); worldRenderer.startDrawingQuads(); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); tessellator.draw(); worldRenderer.startDrawingQuads(); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); tessellator.draw(); worldRenderer.startDrawingQuads(); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); tessellator.draw(); worldRenderer.startDrawingQuads(); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); tessellator.draw(); worldRenderer.startDrawingQuads(); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); tessellator.draw(); worldRenderer.startDrawingQuads(); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.maxZ); worldRenderer.addVertex(aabb.minX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.minX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.minZ); worldRenderer.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ); worldRenderer.addVertex(aabb.maxX, aabb.minY, aabb.maxZ); tessellator.draw(); } */ public static void glColor(int hex) { float alpha = (hex >> 24 & 0xFF) / 255.0F; float red = (hex >> 16 & 0xFF) / 255.0F; float green = (hex >> 8 & 0xFF) / 255.0F; float blue = (hex & 0xFF) / 255.0F; GL11.glColor4f(red, green, blue, alpha); } public static void glColor(float alpha, int redRGB, int greenRGB, int blueRGB) { float red = 0.003921569F * redRGB; float green = 0.003921569F * greenRGB; float blue = 0.003921569F * blueRGB; GL11.glColor4f(red, green, blue, alpha); } /* public static void drawESP(double x, double y, double z, double offsetX, double offsetY, double offsetZ, float r, float g, float b, float a) { GL11.glPushMatrix(); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); GL11.glLineWidth(1.0F); GL11.glDisable(2896); GL11.glDisable(3553); GL11.glEnable(2848); GL11.glDisable(2929); GL11.glDepthMask(false); GL11.glColor4f(r, g, b, a); drawBoundingBox(new AxisAlignedBB(x, y, z, x + offsetX, y + offsetY, z + offsetZ)); GL11.glColor4f(r, g, b, 1.0F); drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + offsetX, y + offsetY, z + offsetZ)); GL11.glLineWidth(1.0F); GL11.glDisable(2848); GL11.glEnable(3553); GL11.glEnable(2896); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); GL11.glPopMatrix(); } */ public static void drawRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, int paramColor) { float alpha = (paramColor >> 24 & 0xFF) / 255.0F; float red = (paramColor >> 16 & 0xFF) / 255.0F; float green = (paramColor >> 8 & 0xFF) / 255.0F; float blue = (paramColor & 0xFF) / 255.0F; GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glEnable(2848); GL11.glPushMatrix(); GL11.glColor4f(red, green, blue, alpha); GL11.glBegin(7); GL11.glVertex2d(paramXEnd, paramYStart); GL11.glVertex2d(paramXStart, paramYStart); GL11.glVertex2d(paramXStart, paramYEnd); GL11.glVertex2d(paramXEnd, paramYEnd); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDisable(2848); } public static void drawPoint(int x, int y, int color) { drawRect(x, y, x + 1, y + 1, color); } public static void drawVerticalLine(int x, int y, int height, int color) { drawRect(x, y, x + 1, height, color); } public static void drawHorizontalLine(int x, int y, int width, int color) { drawRect(x, y, width, y + 1, color); } public static void drawBorderedRect(int x, int y, int x1, int y1, int bord, int color) { drawRect(x + 1, y + 1, x1, y1, color); drawVerticalLine(x, y, y1, bord); drawVerticalLine(x1, y, y1, bord); drawHorizontalLine(x + 1, y, x1, bord); drawHorizontalLine(x, y1, x1 + 1, bord); } public static void drawFineBorderedRect(int x, int y, int x1, int y1, int bord, int color) { GL11.glScaled(0.5D, 0.5D, 0.5D); x *= 2; y *= 2; x1 *= 2; y1 *= 2; drawRect(x + 1, y + 1, x1, y1, color); drawVerticalLine(x, y, y1, bord); drawVerticalLine(x1, y, y1, bord); drawHorizontalLine(x + 1, y, x1, bord); drawHorizontalLine(x, y1, x1 + 1, bord); GL11.glScaled(2.0D, 2.0D, 2.0D); } public static void drawBorderRectNoCorners(int x, int y, int x2, int y2, int bord, int color) { x *= 2; y *= 2; x2 *= 2; y2 *= 2; GL11.glScaled(0.5D, 0.5D, 0.5D); drawRect(x + 1, y + 1, x2, y2, color); drawVerticalLine(x, y + 1, y2, bord); drawVerticalLine(x2, y + 1, y2, bord); drawHorizontalLine(x + 1, y, x2, bord); drawHorizontalLine(x + 1, y2, x2, bord); GL11.glScaled(2.0D, 2.0D, 2.0D); } public static void drawBorderedGradient(int x, int y, int x1, int y1, int bord, int gradTop, int gradBot) { GL11.glScaled(0.5D, 0.5D, 0.5D); x *= 2; y *= 2; x1 *= 2; y1 *= 2; float f = (gradTop >> 24 & 0xFF) / 255.0F; float f2 = (gradTop >> 16 & 0xFF) / 255.0F; float f3 = (gradTop >> 8 & 0xFF) / 255.0F; float f4 = (gradTop & 0xFF) / 255.0F; float f5 = (gradBot >> 24 & 0xFF) / 255.0F; float f6 = (gradBot >> 16 & 0xFF) / 255.0F; float f7 = (gradBot >> 8 & 0xFF) / 255.0F; float f8 = (gradBot & 0xFF) / 255.0F; GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glEnable(2848); GL11.glShadeModel(7425); GL11.glPushMatrix(); GL11.glBegin(7); GL11.glColor4f(f2, f3, f4, f); GL11.glVertex2d(x1, y + 1); GL11.glVertex2d(x + 1, y + 1); GL11.glColor4f(f6, f7, f8, f5); GL11.glVertex2d(x + 1, y1); GL11.glVertex2d(x1, y1); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDisable(2848); GL11.glShadeModel(7424); drawVLine(x, y, y1 - 1, bord); drawVLine(x1 - 1, y, y1 - 1, bord); drawHLine(x, x1 - 1, y, bord); drawHLine(x, x1 - 1, y1 - 1, bord); GL11.glScaled(2.0D, 2.0D, 2.0D); } /* public static void framelessBlockESP(BlockPos blockPos, Color color) { Minecraft.getMinecraft().getRenderManager(); double x2 = blockPos.getX() - RenderManager.renderPosX; Minecraft.getMinecraft().getRenderManager(); double y2 = blockPos.getY() - RenderManager.renderPosY; Minecraft.getMinecraft().getRenderManager(); double z2 = blockPos.getZ() - RenderManager.renderPosZ; GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glLineWidth(2.0F); GL11.glColor4d(color.getRed() / 255, color.getGreen() / 255, color.getBlue() / 255, 0.15D); GL11.glDisable(3553); GL11.glDisable(2929); GL11.glDepthMask(false); drawColorBox(new AxisAlignedBB(x2, y2, z2, x2 + 1.0D, y2 + 1.0D, z2 + 1.0D)); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); } public static void drawColorBox(AxisAlignedBB axisalignedbb) { Tessellator ts2 = Tessellator.getInstance(); WorldRenderer wr = ts2.getWorldRenderer(); wr.startDrawingQuads(); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ); ts2.draw(); wr.startDrawingQuads(); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); ts2.draw(); wr.startDrawingQuads(); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ); ts2.draw(); wr.startDrawingQuads(); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ); ts2.draw(); wr.startDrawingQuads(); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ); ts2.draw(); wr.startDrawingQuads(); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); wr.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); ts2.draw(); } public static void tracerLine(Entity entity, int mode) { Minecraft.getMinecraft().getRenderManager(); double x2 = entity.posX - RenderManager.renderPosX; Minecraft.getMinecraft().getRenderManager(); double y2 = entity.posY + entity.height / 2.0F - RenderManager.renderPosY; Minecraft.getMinecraft().getRenderManager(); double z2 = entity.posZ - RenderManager.renderPosZ; GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glLineWidth(2.0F); GL11.glDisable(3553); GL11.glDisable(2929); GL11.glDepthMask(false); if (mode == 0) { Minecraft.getMinecraft(); Minecraft.getMinecraft(); Minecraft.getMinecraft();Minecraft.getMinecraft();GL11.glColor4d(1.0F - Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) / 40.0F, Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) / 40.0F, 0.0D, 0.5D); } else if (mode == 1) { GL11.glColor4d(0.0D, 0.0D, 1.0D, 0.5D); } else if (mode == 2) { GL11.glColor4d(1.0D, 1.0D, 0.0D, 0.5D); } else if (mode == 3) { GL11.glColor4d(1.0D, 0.0D, 0.0D, 0.5D); } else if (mode == 4) { GL11.glColor4d(0.0D, 1.0D, 0.0D, 0.5D); } GL11.glBegin(1); Minecraft.getMinecraft(); Minecraft.getMinecraft();GL11.glVertex3d(0.0D, Minecraft.getMinecraft().thePlayer.getEyeHeight(), 0.0D); GL11.glVertex3d(x2, y2, z2); GL11.glEnd(); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); } public static void tracerLine(Entity entity, Color color) { Minecraft.getMinecraft().getRenderManager(); double x2 = entity.posX - RenderManager.renderPosX; Minecraft.getMinecraft().getRenderManager(); double y2 = entity.posY + entity.height / 2.0F - RenderManager.renderPosY; Minecraft.getMinecraft().getRenderManager(); double z2 = entity.posZ - RenderManager.renderPosZ; GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glLineWidth(2.0F); GL11.glDisable(3553); GL11.glDisable(2929); GL11.glDepthMask(false); setColor(color); GL11.glBegin(1); Minecraft.getMinecraft(); Minecraft.getMinecraft();GL11.glVertex3d(0.0D, Minecraft.getMinecraft().thePlayer.getEyeHeight(), 0.0D); GL11.glVertex3d(x2, y2, z2); GL11.glEnd(); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); } public static void tracerLine(int x2, int y2, int z2, Color color) { Minecraft.getMinecraft().getRenderManager(); x2 = (int)(x2 + (0.5D - RenderManager.renderPosX)); Minecraft.getMinecraft().getRenderManager(); y2 = (int)(y2 + (0.5D - RenderManager.renderPosY)); Minecraft.getMinecraft().getRenderManager(); z2 = (int)(z2 + (0.5D - RenderManager.renderPosZ)); GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glLineWidth(2.0F); GL11.glDisable(3553); GL11.glDisable(2929); GL11.glDepthMask(false); setColor(color); GL11.glBegin(1); Minecraft.getMinecraft(); Minecraft.getMinecraft();GL11.glVertex3d(0.0D, Minecraft.getMinecraft().thePlayer.getEyeHeight(), 0.0D); GL11.glVertex3d(x2, y2, z2); GL11.glEnd(); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); } */ public static void drawHLine(float par1, float par2, float par3, int par4) { if (par2 < par1) { float var5 = par1; par1 = par2; par2 = var5; } drawRect(par1, par3, par2 + 1.0F, par3 + 1.0F, par4); } public static void drawVLine(float par1, float par2, float par3, int par4) { if (par3 < par2) { float var5 = par2; par2 = par3; par3 = var5; } drawRect(par1, par2 + 1.0F, par1 + 1.0F, par3, par4); } public static void drawGradientBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2, int col3) { float f = (col1 >> 24 & 0xFF) / 255.0F; float f2 = (col1 >> 16 & 0xFF) / 255.0F; float f3 = (col1 >> 8 & 0xFF) / 255.0F; float f4 = (col1 & 0xFF) / 255.0F; GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glEnable(2848); GL11.glDisable(3042); GL11.glPushMatrix(); GL11.glColor4f(f2, f3, f4, f); GL11.glLineWidth(1.0F); GL11.glBegin(1); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); drawGradientRect(x, y, x2, y2, col2, col3); GL11.glEnable(3042); GL11.glEnable(3553); GL11.glDisable(2848); } public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) { float f = (col1 >> 24 & 0xFF) / 255.0F; float f2 = (col1 >> 16 & 0xFF) / 255.0F; float f3 = (col1 >> 8 & 0xFF) / 255.0F; float f4 = (col1 & 0xFF) / 255.0F; float f5 = (col2 >> 24 & 0xFF) / 255.0F; float f6 = (col2 >> 16 & 0xFF) / 255.0F; float f7 = (col2 >> 8 & 0xFF) / 255.0F; float f8 = (col2 & 0xFF) / 255.0F; GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glEnable(2848); GL11.glShadeModel(7425); GL11.glPushMatrix(); GL11.glBegin(7); GL11.glColor4f(f2, f3, f4, f); GL11.glVertex2d(x2, y); GL11.glVertex2d(x, y); GL11.glColor4f(f6, f7, f8, f5); GL11.glVertex2d(x, y2); GL11.glVertex2d(x2, y2); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDisable(2848); GL11.glShadeModel(7424); } public static void drawSidewaysGradientRect(double x, double y, double x2, double y2, int col1, int col2) { float f = (col1 >> 24 & 0xFF) / 255.0F; float f2 = (col1 >> 16 & 0xFF) / 255.0F; float f3 = (col1 >> 8 & 0xFF) / 255.0F; float f4 = (col1 & 0xFF) / 255.0F; float f5 = (col2 >> 24 & 0xFF) / 255.0F; float f6 = (col2 >> 16 & 0xFF) / 255.0F; float f7 = (col2 >> 8 & 0xFF) / 255.0F; float f8 = (col2 & 0xFF) / 255.0F; GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glEnable(2848); GL11.glShadeModel(7425); GL11.glPushMatrix(); GL11.glBegin(7); GL11.glColor4f(f2, f3, f4, f); GL11.glVertex2d(x, y); GL11.glVertex2d(x, y2); GL11.glColor4f(f6, f7, f8, f5); GL11.glVertex2d(x2, y2); GL11.glVertex2d(x2, y); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDisable(2848); GL11.glShadeModel(7424); } public static void drawBorderedCircle(int x, int y, float radius, int outsideC, int insideC) { GL11.glEnable(3042); GL11.glDisable(3553); GL11.glBlendFunc(770, 771); GL11.glEnable(2848); GL11.glPushMatrix(); float scale = 0.1F; GL11.glScalef(0.1F, 0.1F, 0.1F); x *= 10; y *= 10; radius *= 10.0F; drawCircle(x, y, radius, insideC); drawUnfilledCircle(x, y, radius, 1.0F, outsideC); GL11.glScalef(10.0F, 10.0F, 10.0F); GL11.glPopMatrix(); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDisable(2848); } public static void drawUnfilledCircle(int x, int y, float radius, float lineWidth, int color) { float alpha = (color >> 24 & 0xFF) / 255.0F; float red = (color >> 16 & 0xFF) / 255.0F; float green = (color >> 8 & 0xFF) / 255.0F; float blue = (color & 0xFF) / 255.0F; GL11.glColor4f(red, green, blue, alpha); GL11.glLineWidth(lineWidth); GL11.glEnable(2848); GL11.glBegin(2); for (int i = 0; i <= 360; i++) { GL11.glVertex2d(x + Math.sin(i * 3.141526D / 180.0D) * radius, y + Math.cos(i * 3.141526D / 180.0D) * radius); } GL11.glEnd(); GL11.glDisable(2848); } public static void drawCircle(int x, int y, float radius, int color) { float alpha = (color >> 24 & 0xFF) / 255.0F; float red = (color >> 16 & 0xFF) / 255.0F; float green = (color >> 8 & 0xFF) / 255.0F; float blue = (color & 0xFF) / 255.0F; GL11.glColor4f(red, green, blue, alpha); GL11.glBegin(9); for (int i = 0; i <= 360; i++) { GL11.glVertex2d(x + Math.sin(i * 3.141526D / 180.0D) * radius, y + Math.cos(i * 3.141526D / 180.0D) * radius); } GL11.glEnd(); } public static void drawCircle(float cx, float cy2, float r2, int num_segments, int c2) { cx *= 2.0F; cy2 *= 2.0F; float f2 = (c2 >> 24 & 0xFF) / 255.0F; float f1 = (c2 >> 16 & 0xFF) / 255.0F; float f22 = (c2 >> 8 & 0xFF) / 255.0F; float f3 = (c2 & 0xFF) / 255.0F; float theta = (float)(6.2831852D / num_segments); float p2 = (float)Math.cos(theta); float s = (float)Math.sin(theta); float x2 = r2 *= 2.0F; float y2 = 0.0F; enableGL2D(); GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glColor4f(f1, f22, f3, f2); GL11.glBegin(2); for (int ii2 = 0; ii2 < num_segments; ii2++) { GL11.glVertex2f(x2 + cx, y2 + cy2); float t = x2; x2 = p2 * x2 - s * y2; y2 = s * t + p2 * y2; } GL11.glEnd(); GL11.glScalef(2.0F, 2.0F, 2.0F); disableGL2D(); } public static void drawFullCircle(int cx, int cy2, double r2, int c2) { r2 *= 2.0D; cx *= 2; cy2 *= 2; float f2 = (c2 >> 24 & 0xFF) / 255.0F; float f1 = (c2 >> 16 & 0xFF) / 255.0F; float f22 = (c2 >> 8 & 0xFF) / 255.0F; float f3 = (c2 & 0xFF) / 255.0F; enableGL2D(); GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glColor4f(f1, f22, f3, f2); GL11.glBegin(6); for (int i2 = 0; i2 <= 360; i2++) { double x2 = Math.sin(i2 * 3.141592653589793D / 180.0D) * r2; double y2 = Math.cos(i2 * 3.141592653589793D / 180.0D) * r2; GL11.glVertex2d(cx + x2, cy2 + y2); } GL11.glEnd(); GL11.glScalef(2.0F, 2.0F, 2.0F); disableGL2D(); } public static void setColor(Color c2) { GL11.glColor4f(c2.getRed() / 255.0F, c2.getGreen() / 255.0F, c2.getBlue() / 255.0F, c2.getAlpha() / 255.0F); } public static double getAlphaFromHex(int color) { return (color >> 24 & 0xFF) / 255.0F; } public static double getRedFromHex(int color) { return (color >> 16 & 0xFF) / 255.0F; } public static double getGreenFromHex(int color) { return (color >> 8 & 0xFF) / 255.0F; } public static double getBlueFromHex(int color) { return (color & 0xFF) / 255.0F; } }
[ "46613166+NathanKassab@users.noreply.github.com" ]
46613166+NathanKassab@users.noreply.github.com
b0f57e329768b2e2852520d4127af78f0a5ead0a
64e6a623a5e7342ff4ed435025935727e3164705
/src/main/java/com/mrbysco/morecauldrons/blocks/BaseCauldronBlock.java
cdb1f2c29f8e5f4a77eb33d7077562a61f4f07c1
[ "MIT" ]
permissive
Mrbysco/MoreCauldrons
e086a508b55897bd45216d956294ca6a1e82f58a
d8029d76a6a0bfbd4dd15ba9f8d1e78c4aff20f8
refs/heads/1.16.5
2022-11-03T08:56:56.906902
2022-10-25T02:18:57
2022-10-25T02:18:57
126,231,323
4
5
MIT
2022-10-25T02:17:45
2018-03-21T19:38:42
Java
UTF-8
Java
false
false
3,351
java
package com.mrbysco.morecauldrons.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.CauldronBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemStack; import net.minecraft.stats.Stats; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.World; import net.minecraftforge.common.ToolType; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.IFluidHandlerItem; import java.util.Optional; import java.util.function.Supplier; public class BaseCauldronBlock extends CauldronBlock { public BaseCauldronBlock(Block.Properties properties) { super(properties.harvestTool(ToolType.PICKAXE).strength(2.0F)); } @Override public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { ItemStack stack = player.getItemInHand(handIn); if (stack.isEmpty()) { return ActionResultType.PASS; } else { int i = state.getValue(LEVEL); if (stack.getCount() == 1 && FluidUtil.getFluidHandler(stack).isPresent()) { IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(stack).orElse(null); Optional<FluidStack> containedFluid = FluidUtil.getFluidContained(stack); Supplier<FluidStack> waterStackSupplier = () -> new FluidStack(Fluids.WATER, 1000); if (containedFluid.isPresent() && i < 3) { //Container has liquid FluidStack fluidStack = containedFluid.get(); if (fluidStack.getFluid() == Fluids.WATER && fluidStack.getAmount() >= 1000) { FluidStack drainedStack = fluidHandler.drain(waterStackSupplier.get(), FluidAction.SIMULATE); if (drainedStack.getAmount() == 1000) { fluidHandler.drain(waterStackSupplier.get(), FluidAction.EXECUTE); player.setItemInHand(handIn, fluidHandler.getContainer()); player.awardStat(Stats.FILL_CAULDRON); if (!worldIn.isClientSide) { this.setWaterLevel(worldIn, pos, state, 3); } worldIn.playSound((PlayerEntity) null, pos, SoundEvents.BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); } } } else { //Container is empty if (i == 3) { if (!player.abilities.instabuild) { if (fluidHandler.isFluidValid(0, waterStackSupplier.get()) && fluidHandler.fill(waterStackSupplier.get(), FluidAction.SIMULATE) == 1000) { fluidHandler.fill(waterStackSupplier.get(), FluidAction.EXECUTE); player.setItemInHand(handIn, fluidHandler.getContainer()); } else { return ActionResultType.PASS; } } player.awardStat(Stats.USE_CAULDRON); if (!worldIn.isClientSide) { this.setWaterLevel(worldIn, pos, state, 0); } worldIn.playSound((PlayerEntity) null, pos, SoundEvents.BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); } } return ActionResultType.SUCCESS; } } return super.use(state, worldIn, pos, player, handIn, hit); } }
[ "Mrbysco@users.noreply.github.com" ]
Mrbysco@users.noreply.github.com
d1814463301a718277d2a5352da7f13b9b694063
daab099e44da619b97a7a6009e9dee0d507930f3
/rt/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlMTOM.java
d65213bf4172f3cacac14727d8bfd5e342539db0
[]
no_license
xknower/source-code-jdk-8u211
01c233d4f498d6a61af9b4c34dc26bb0963d6ce1
208b3b26625f62ff0d1ff6ee7c2b7ee91f6c9063
refs/heads/master
2022-12-28T17:08:25.751594
2020-10-09T03:24:14
2020-10-09T03:24:14
278,289,426
0
0
null
null
null
null
UTF-8
Java
false
false
3,082
java
/* */ package com.oracle.xmlns.internal.webservices.jaxws_databinding; /* */ /* */ import java.lang.annotation.Annotation; /* */ import javax.xml.bind.annotation.XmlAccessType; /* */ import javax.xml.bind.annotation.XmlAccessorType; /* */ import javax.xml.bind.annotation.XmlAttribute; /* */ import javax.xml.bind.annotation.XmlRootElement; /* */ import javax.xml.bind.annotation.XmlType; /* */ import javax.xml.ws.soap.MTOM; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @XmlAccessorType(XmlAccessType.FIELD) /* */ @XmlType(name = "") /* */ @XmlRootElement(name = "mtom") /* */ public class XmlMTOM /* */ implements MTOM /* */ { /* */ @XmlAttribute(name = "enabled") /* */ protected Boolean enabled; /* */ @XmlAttribute(name = "threshold") /* */ protected Integer threshold; /* */ /* */ public boolean isEnabled() { /* 78 */ if (this.enabled == null) { /* 79 */ return true; /* */ } /* 81 */ return this.enabled.booleanValue(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void setEnabled(Boolean value) { /* 94 */ this.enabled = value; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public int getThreshold() { /* 106 */ if (this.threshold == null) { /* 107 */ return 0; /* */ } /* 109 */ return this.threshold.intValue(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void setThreshold(Integer value) { /* 122 */ this.threshold = value; /* */ } /* */ /* */ /* */ public boolean enabled() { /* 127 */ return ((Boolean)Util.<Boolean>nullSafe(this.enabled, Boolean.TRUE)).booleanValue(); /* */ } /* */ /* */ /* */ public int threshold() { /* 132 */ return ((Integer)Util.<Integer>nullSafe(this.threshold, Integer.valueOf(0))).intValue(); /* */ } /* */ /* */ /* */ public Class<? extends Annotation> annotationType() { /* 137 */ return (Class)MTOM.class; /* */ } /* */ } /* Location: D:\tools\env\Java\jdk1.8.0_211\rt.jar!\com\oracle\xmlns\internal\webservices\jaxws_databinding\XmlMTOM.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
[ "xknower@126.com" ]
xknower@126.com
eb5d95095c8d21d2684e253f1d01aad2d42fb909
9cd23e3198ae067a711bbc514d96afc4a15c8cde
/turin-compiler/src/main/java/me/tomassetti/turin/compiler/bytecode/returnop/ReturnTrueBS.java
cc5bfb5d4af524833718a2f9cdc83d4f428080e0
[ "Apache-2.0" ]
permissive
ledkk/turin-programming-language
fcebc4c5a50f59a7619b65d695d59c9ec197e565
8e983a4e00977aaf95480d32a7fa91828a805b40
refs/heads/master
2021-01-19T05:19:15.388987
2015-09-09T21:37:31
2015-09-09T21:37:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
445
java
package me.tomassetti.turin.compiler.bytecode.returnop; import me.tomassetti.turin.compiler.bytecode.BytecodeSequence; import org.objectweb.asm.MethodVisitor; import static org.objectweb.asm.Opcodes.ICONST_1; import static org.objectweb.asm.Opcodes.IRETURN; public class ReturnTrueBS extends BytecodeSequence { @Override public void operate(MethodVisitor mv) { mv.visitInsn(ICONST_1); mv.visitInsn(IRETURN); } }
[ "federico@tomassetti.me" ]
federico@tomassetti.me
5bd1fdbf98511b0fe0182ffc8d937135f69b3d17
279e6bfbf60fe58ca1e1a345ff5ff20b3162ce94
/app/src/main/java/com/mulengabwalyajeff/theassistant/uploadstock/samsung/sam_charger.java
6ccdea99d59f4f22608ff3b764e3df5ca9063cb8
[]
no_license
BLACKAFROROSE/TheAssistant
ca5350243d0cbd2dff43d241263d9996845e51f0
3ebd20dd7e153f5536e3cb87041615db9a3efe57
refs/heads/master
2022-11-23T19:57:16.704152
2020-07-26T20:37:28
2020-07-26T20:37:28
256,383,518
0
0
null
null
null
null
UTF-8
Java
false
false
2,738
java
package com.mulengabwalyajeff.theassistant.uploadstock.samsung; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.firestore.FirebaseFirestore; import com.mulengabwalyajeff.theassistant.R; import java.util.HashMap; import java.util.Map; public class sam_charger extends AppCompatActivity { public static final String TAG = "sam_charger"; public static final String KEY_TITLE="title"; public static final String KEY_DESCRIPTION="description"; public static final String KEY_INFORMATION="information"; public static final String KEY_PRICE="price"; EditText chargertitle; EditText chargerdescription; EditText chargerinfomation; EditText chargerprice; private FirebaseFirestore samchargerdb = FirebaseFirestore.getInstance(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sam_charger); chargertitle=findViewById(R.id.samchargername); chargerdescription=findViewById(R.id.samchargerdescription); chargerinfomation=findViewById(R.id.samchargerinfomation); chargerprice=findViewById(R.id.samchargerprice); } public void saveNote(View view) { String title = chargertitle.getText().toString(); String description = chargerdescription.getText().toString(); String information = chargerinfomation.getText().toString(); String price = chargerprice.getText().toString(); Map<String, Object> samcharger = new HashMap<>(); samcharger.put(KEY_TITLE,title); samcharger.put(KEY_DESCRIPTION,description); samcharger.put(KEY_INFORMATION,information); samcharger.put(KEY_PRICE,price); samchargerdb.collection("SAMSUNG").document("CHARGER") .set(samcharger) .addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { Toast.makeText(sam_charger.this, "ADDED PROPERLY", Toast.LENGTH_SHORT).show(); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Toast.makeText(sam_charger.this, " DIDNT ADD", Toast.LENGTH_SHORT).show(); } }); } }
[ "55460989+BLACKAFROROSE@users.noreply.github.com" ]
55460989+BLACKAFROROSE@users.noreply.github.com
85aebf18cc53da300b23f524ee746d0a38784d2a
fb80ff2007022b8be0a2cd5d89a87fbad94f57bb
/src/application/Program.java
428581ff1be6ca3b426d37e223d7701fca41e7a9
[]
no_license
ribeirojunior/chessSystem-java
ef846e513a9632af215e269740a5036e3dac14d1
6164a212a6d9f5123fa5f64f5abc6a1ed721af63
refs/heads/master
2022-11-17T01:21:51.287121
2020-07-16T22:14:22
2020-07-16T22:14:22
265,316,808
0
0
null
null
null
null
UTF-8
Java
false
false
1,850
java
package application; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.List; import java.util.Scanner; import chess.ChessException; import chess.ChessMatch; import chess.ChessPiece; import chess.ChessPosition; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Chess Aplication"); ChessMatch chessMatch = new ChessMatch(); List<ChessPiece> captured = new ArrayList<>(); while (!chessMatch.getCheckMate()) { try { UI.clearScreen(); UI.printMatch(chessMatch, captured); System.out.println(); System.out.print("Source: "); ChessPosition source = UI.readChessPosition(sc); boolean[][] possibleMoves = chessMatch.possibleMoves(source); UI.clearScreen(); UI.printBoard(chessMatch.getPieces(), possibleMoves); System.out.println(); System.out.print("Target: "); ChessPosition target = UI.readChessPosition(sc); ChessPiece capturedPiece = chessMatch.performChessMove(source, target); if(capturedPiece != null) { captured.add(capturedPiece); } if (chessMatch.getPromoted() != null) { System.out.print("Enter Piece For Promotion (B|N|R|Q): "); String type = sc.nextLine().toUpperCase(); while (!type.equals("B") && !type.equals("N") && !type.equals("R") && !type.equals("Q")) { System.out.print("Invalid Value! Enter Piece For Promotion (B|N|R|Q): "); type = sc.nextLine().toUpperCase(); } chessMatch.replacePromotedPiece(type); } } catch (ChessException e){ System.out.println(e.getMessage()); sc.nextLine(); } catch (InputMismatchException e) { System.out.println(e.getMessage()); sc.nextLine(); } } UI.clearScreen(); UI.printMatch(chessMatch, captured); } }
[ "sergio.rivusjr@gmail.com" ]
sergio.rivusjr@gmail.com
8650cd9d6c05b271eacdcb08ac019ba2175ac212
0da173a27bf0ac6a79d841c754496c8e8549fad1
/app/src/main/java/pithynews/pithy/MainActivity.java
e2534a931cdad0df2e65b1126866c0ffed79d1ac
[]
no_license
aniketr1/Pithy
291df2d8b58b75ed6705737771a3a02e08aa6fee
b936796f1530eaac831752349906f9aeb386e660
refs/heads/master
2021-09-01T23:22:35.284923
2017-12-29T05:18:53
2017-12-29T05:18:53
115,689,610
0
0
null
null
null
null
UTF-8
Java
false
false
1,521
java
package pithynews.pithy; import android.content.Intent; import android.graphics.Bitmap; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private EditText username; private EditText password; private Button login_button; @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext()); LoginButton(); } public void LoginButton() { username = (EditText) findViewById(R.id.editText); password = (EditText) findViewById(R.id.editText2); login_button = (Button) findViewById(R.id.button); login_button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if ((username.getText().toString().equals("user"))&&(password.getText().toString().equals("pass"))) { Intent intent = new Intent("club.pithynews.iitbhilai_pithy.User"); startActivity(intent); } } } ); } }
[ "aniket.raj1947@gmail.com" ]
aniket.raj1947@gmail.com
91b96fb804ac7c27e606d396ec60c692c75453f9
76cdc66c0634b6d1472d5ffd27ff8c4b34fec6c1
/ParseStarterProject/src/main/java/com/parse/starter/UserListActivity.java
d2f3f7e4d5e77196a01e94b68960063694f2499c
[]
no_license
doubleRRAO/LastJuneChatApps
8add98815742d6edefe7338f70c84738f2d0f035
a8e315ba2982672ca3ee558ddd01d0faf1533eda
refs/heads/master
2020-06-10T14:55:55.534449
2019-06-25T07:43:08
2019-06-25T07:43:08
193,659,423
0
0
null
2019-06-25T07:41:57
2019-06-25T07:41:55
null
UTF-8
Java
false
false
2,138
java
package com.parse.starter; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseQuery; import com.parse.ParseUser; import junit.framework.Test; import java.util.ArrayList; import java.util.List; public class UserListActivity extends AppCompatActivity { ArrayList<String>users; ArrayAdapter arrayAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_list); users = new ArrayList<String>(); setTitle("User List"); ListView userListView = (ListView) findViewById(R.id.userListView); userListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Intent intent = new Intent(getApplicationContext(), ChatActivity.class); intent.putExtra("username", users.get(i)); startActivity(intent); } }); users.clear(); arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, users); userListView.setAdapter(arrayAdapter); ParseQuery<ParseUser> query = ParseUser.getQuery(); query.whereNotEqualTo("username", ParseUser.getCurrentUser().getUsername()); query.findInBackground(new FindCallback<ParseUser>() { @Override public void done(List<ParseUser> objects, ParseException e) { if(e==null){ if(objects.size() > 0){ for(ParseUser user:objects){ users.add(user.getUsername()); } arrayAdapter.notifyDataSetChanged(); } } } }); } }
[ "thedabezt@gmail.com" ]
thedabezt@gmail.com
8058223fa62d98db6ed904feb6d458e46be0d647
fa2d693223c4c0f30c7e829f68c909623fffc019
/app/src/androidTest/java/org/joshbowen/helloworld/ApplicationTest.java
3f7a9b7e873e8fc7ef816d455da90001a9f089a1
[]
no_license
jbowen93/Hello_World
890047b784154cd6eb7e32b3d21ccac8925d4149
996503f432c57a9eb7ba3ca86d1a9aa9d8d2affe
refs/heads/master
2021-01-10T10:36:06.003157
2015-05-21T04:15:36
2015-05-21T04:15:36
35,990,553
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package org.joshbowen.helloworld; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "jish.bowen@gmail.com" ]
jish.bowen@gmail.com
b4d25745987a371b884bf9a8925462821b4326e3
3d87169e68f67584ee7ca4763008ccf1ec7cd77d
/src/main/java/com/github/stepankalensky/mojeAdventura/logika/Prostor.java
1c41c914cde896ca92d2fe56f6441a9ad2011aea
[]
no_license
stepankalensky/mojeAdventura
7fe4cfd42b39bbcd36230c60958f57da6fe76a82
2285c39a5a4f7524dc555f98de4cdf283495e640
refs/heads/master
2021-04-06T00:49:51.527463
2018-04-02T15:35:08
2018-04-02T15:35:08
124,397,740
0
0
null
null
null
null
UTF-8
Java
false
false
8,597
java
package com.github.stepankalensky.mojeAdventura.logika; import java.util.*; import java.util.stream.Collectors; /** * Trida Prostor - popisuje jednotlivé prostory (místnosti) hry * * Tato třída je součástí jednoduché textové hry. * * "Prostor" reprezentuje jedno místo (místnost, prostor, ..) ve scénáři hry. * Prostor může mít sousední prostory připojené přes východy. Pro každý východ * si prostor ukládá odkaz na sousedící prostor. * * @author Michael Kolling, Lubos Pavlicek, Jarmila Pavlickova, Štěpán Kalenský * @version 1.0 */ public class Prostor extends Observable{ private String nazev; private String popis; private Set<Prostor> vychody;// obsahuje sousední místnosti private Map<String, Vec> veci; //obsahuje seznam věcí private Map<String, Postava> postavy; //obsahuje seznam postav private double hodnotaX; private double hodnotaY; /** * Vytvoření prostoru se zadaným popisem, např. "kuchyň", "hala", "trávník * před domem" * * @param nazev nazev prostoru, jednoznačný identifikátor, jedno slovo nebo * víceslovný název bez mezer. * @param popis Popis prostoru. */ public Prostor(String nazev, String popis,double hodnotaX, double hodnotaY) { this.nazev = nazev; this.popis = popis; vychody = new HashSet<>(); veci = new HashMap<>(); postavy = new HashMap<>(); this.hodnotaX = hodnotaX; this.hodnotaY = hodnotaY; } /** * Definuje východ z prostoru (sousední/vedlejsi prostor). Vzhledem k tomu, * že je použit Set pro uložení východů, může být sousední prostor uveden * pouze jednou (tj. nelze mít dvoje dveře do stejné sousední místnosti). * Druhé zadání stejného prostoru tiše přepíše předchozí zadání (neobjeví se * žádné chybové hlášení). Lze zadat též cestu ze do sebe sama. * * @param vedlejsi prostor, který sousedi s aktualnim prostorem. * */ public void setVychod(Prostor vedlejsi) { vychody.add(vedlejsi); } /** * Metoda equals pro porovnání dvou prostorů. Překrývá se metoda equals ze * třídy Object. Dva prostory jsou shodné, pokud mají stejný název. Tato * metoda je důležitá z hlediska správného fungování seznamu východů (Set). * * Bližší popis metody equals je u třídy Object. * * @param o object, který se má porovnávat s aktuálním * @return hodnotu true, pokud má zadaný prostor stejný název, jinak false */ @Override public boolean equals(Object o) { // porovnáváme zda se nejedná o dva odkazy na stejnou instanci if (this == o) { return true; } // porovnáváme jakého typu je parametr if (!(o instanceof Prostor)) { return false; // pokud parametr není typu Prostor, vrátíme false } // přetypujeme parametr na typ Prostor Prostor druhy = (Prostor) o; //metoda equals třídy java.util.Objects porovná hodnoty obou názvů. //Vrátí true pro stejné názvy a i v případě, že jsou oba názvy null, //jinak vrátí false. return (java.util.Objects.equals(this.nazev, druhy.nazev)); } /** * metoda hashCode vraci ciselny identifikator instance, ktery se pouziva * pro optimalizaci ukladani v dynamickych datovych strukturach. Pri * prekryti metody equals je potreba prekryt i metodu hashCode. Podrobny * popis pravidel pro vytvareni metody hashCode je u metody hashCode ve * tride Object */ @Override public int hashCode() { int vysledek = 3; int hashNazvu = java.util.Objects.hashCode(this.nazev); vysledek = 37 * vysledek + hashNazvu; return vysledek; } /** * Vrací název prostoru (byl zadán při vytváření prostoru jako parametr * konstruktoru) * * @return název prostoru */ public String getNazev() { return nazev; } /** * Vrací "dlouhý" popis prostoru, který může vypadat následovně: Jsi v * mistnosti/prostoru vstupni hala budovy VSE na Jiznim meste. vychody: * chodba bufet ucebna * * @return Dlouhý popis prostoru */ public String dlouhyPopis() { return "Jsi v mistnosti/prostoru " + popis + ".\n" + popisVychodu()+ "\n" +popisVeci()+"\n" +popisPostav(); } /** * Vrací textový řetězec, který popisuje sousední východy, například: * "vychody: hala ". * * @return Popis východů - názvů sousedních prostorů */ private String popisVychodu() { String vracenyText = "východy:"; for (Prostor sousedni : vychody) { vracenyText += " " + sousedni.getNazev(); } return vracenyText; } /** * Vrací prostor, který sousedí s aktuálním prostorem a jehož název je zadán * jako parametr. Pokud prostor s udaným jménem nesousedí s aktuálním * prostorem, vrací se hodnota null. * * @param nazevSouseda Jméno sousedního prostoru (východu) * @return Prostor, který se nachází za příslušným východem, nebo hodnota * null, pokud prostor zadaného jména není sousedem. */ public Prostor vratSousedniProstor(String nazevSouseda) { List<Prostor>hledaneProstory = vychody.stream() .filter(sousedni -> sousedni.getNazev().equals(nazevSouseda)) .collect(Collectors.toList()); if(hledaneProstory.isEmpty()){ return null; } else { return hledaneProstory.get(0); } } /** * Vrací kolekci obsahující prostory, se kterými tento prostor sousedí. * Takto získaný seznam sousedních prostor nelze upravovat (přidávat, * odebírat východy) protože z hlediska správného návrhu je to plně * záležitostí třídy Prostor. * * @return Nemodifikovatelná kolekce prostorů (východů), se kterými tento * prostor sousedí. */ public Collection<Prostor> getVychody() { return Collections.unmodifiableCollection(vychody); } /** * Metoda vloží věc do prostoru v herním plánu. */ public void vlozVec(Vec neco){ veci.put(neco.getNazev(), neco); } /** * Metoda odebere věc z prostoru. */ public Vec odeberVec(String nazev){ return veci.remove(nazev); } /** * Metoda sloužící k vypsání věcí v místnosti. */ private String popisVeci(){ String vracenyText = "věci:"; for (String nazev : veci.keySet()) { vracenyText += " " + nazev; } return vracenyText; } /** * Metoda sloužící k vypsání přítomných postav v dané mísnosti. */ public String popisPostav(){ String popis = "postavy:"; for (String nazev : postavy.keySet()) { popis += " " + nazev; } return popis; } /** * Metoda vloží postavu do místnosti/prostoru. */ public void vlozPostavu(Postava vkladana) { postavy.put(vkladana.getJmeno(), vkladana); } /** * Metoda, ve které se ptáme, je-li postava v daném prostoru. */ public boolean jePostavaVProstoru(String nazevPostavy){ return postavy.containsKey(nazevPostavy); } /** * Metoda, která nám vybere postavu. * */ public Postava najdiPostavu(String jmeno) { return postavy.get(jmeno); } /** * Metoda, ve které se ptáme, je-li věc v daném prostoru. */ public boolean jeVecVProstoru(String nazevVeci){ return veci.containsKey(nazevVeci); } /** * Getter pro hodnotu souřadnice X * @return hodnota souřadnice X */ public double getHodnotaX() { return hodnotaX; } /** * Setter pro hodnotu souřadnice X */ public void setHodnotaX(double hodnotaX) { this.hodnotaX = hodnotaX; } /** * Getter pro hodnotu souřadnice Y * @return hodnota souřadnice Y */ public double getHodnotaY() { return hodnotaY; } /** * Setter pro hodnotu souřadnice Y * @return hodnota souřadnice Y */ public void setHodnotaY(double hodnotaY) { this.hodnotaY = hodnotaY; } @Override public String toString() { return getNazev(); } }
[ "skalensky@gmail.com" ]
skalensky@gmail.com
4afbabcdea63a165e08598a8c7360f3a89b1de79
7399818011f311317d30abef5f614167fdefd871
/EnWords/app/src/main/java/com/jwstudio/enwords/exercise/bean/ArticleInfo.java
8679b614fbf70ce04c32773af8325ce04f69d3c8
[]
no_license
sine233/EnWords
fef572a6f0b57ee81b9c187715b77b56b085e51e
9527c3f048b9dd38baea67c2056197aceee4cbe6
refs/heads/master
2023-03-18T02:18:19.311221
2019-07-09T02:38:31
2019-07-09T02:38:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package com.jwstudio.enwords.exercise.bean; public class ArticleInfo { private String name; private String music; private String article; public ArticleInfo() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getMusic() { return music; } public void setMusic(String music) { this.music = music; } public String getArticle() { return article; } public void setArticle(String article) { this.article = article; } @Override public String toString() { return "ArticleInfo{" + "name='" + name + '\'' + ", music='" + music + '\'' + ", article='" + article + '\'' + '}'; } }
[ "limingbang841@gmail.com" ]
limingbang841@gmail.com
3471da9d6191d0ad304c9ade1198255034c5f868
7f0346923445ffb4fb05aefa52c886701e0d008a
/petclinic/petclinic-core/src/be/heh/petclinic/domain/Pet.java
cfcac1da7ba256b75a936204fcc5bf500cdde256
[]
no_license
xorob0/AdvancedWebDevProject
815ea00e2e6d425306b622430429023221173778
fe8ee6d39c3203ea98d8a604fc00c16a63f75b7e
refs/heads/master
2020-04-07T05:12:47.673091
2018-11-18T13:38:57
2018-11-18T13:38:57
158,087,630
1
0
null
2018-11-18T13:39:07
2018-11-18T13:39:07
null
UTF-8
Java
false
false
1,352
java
package be.heh.petclinic.domain; import java.time.LocalDate; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class Pet extends NamedEntity { private String birthDate; private String type; private int ownerId; private Set<Visit> visits; public void setBirthDate(String birthDate) { this.birthDate = birthDate; } public String getBirthDate() { return this.birthDate; } public String getType() { return this.type; } public void setType(String type) { this.type = type; } public int getOwnerId() { return this.ownerId; } public void setOwnerId(int ownerId) { this.ownerId = ownerId; } protected Set<Visit> getVisitsInternal() { if (this.visits == null) { this.visits = new HashSet<>(); } return this.visits; } protected void setVisitsInternal(Set<Visit> visits) { this.visits = visits; } public List<Visit> getVisits() { List<Visit> sortedVisits = new ArrayList<>(getVisitsInternal()); return Collections.unmodifiableList(sortedVisits); } public void addVisit(Visit visit) { getVisitsInternal().add(visit); visit.setPet(this); } }
[ "samahaux98@gmail.com" ]
samahaux98@gmail.com
381d5ba24e57d64aeb94a81bb8bed6c871e23c4f
72f0814b372e38ed0a440acfb3a65794ee8bc041
/src/java/SergeantCohort/CohortInfo.java
fe9a3e98531f2d269427e7cc79d3a0c0049a6948
[]
no_license
bmistree/sergeant_cohort
ea1be4200da3ccbca4c9d1509137c855661252b2
93072c55b9361f42833bb40f115ee9abfdc53a18
refs/heads/master
2016-09-05T16:40:33.038118
2015-01-14T00:11:33
2015-01-14T00:11:33
26,978,263
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
package SergeantCohort; public class CohortInfo { public final String ip_addr_or_hostname; public final int port; public final long cohort_id; public CohortInfo ( String ip_addr_or_hostname, int port, long cohort_id) { this.ip_addr_or_hostname = ip_addr_or_hostname; this.port = port; this.cohort_id = cohort_id; } public static class CohortInfoPair { public final CohortInfo remote_cohort_info; public final CohortInfo local_cohort_info; public CohortInfoPair( CohortInfo remote_cohort_info, CohortInfo local_cohort_info) { this.remote_cohort_info = remote_cohort_info; this.local_cohort_info = local_cohort_info; } } }
[ "bmistree@gmail.com" ]
bmistree@gmail.com
53dc892d2d1ae7944c8aae6f75393ac462e3021b
f80f9cae4bbfd6c13d506662ed2b20d6ee702b9c
/LeetCode2nd/src/复杂BFS/ShortestPathVisitingAllNodes.java
34726b9b0a765c07fea0d2760c95e34b5c144aaa
[]
no_license
yangcao522/Algorithms
a33c3a03530d5a68b648b20a4562e3e8b9f58469
8f7b69d8ee8530c01656f1f6968a8d51fb5c5f72
refs/heads/master
2021-06-20T16:56:42.237136
2019-08-16T20:11:00
2019-08-16T20:11:00
143,560,822
0
0
null
null
null
null
UTF-8
Java
false
false
1,283
java
package 复杂BFS; import java.util.LinkedList; import java.util.Queue; public class ShortestPathVisitingAllNodes { class State{ int path; int head; public State(int path, int head) { this.path = path; this.head = head; } public int shortestPathLength(int[][] graph) { int N = graph.length; boolean[][] visited = new boolean[1 << N][N]; Queue<State> q = new LinkedList<>(); for (int i = 0; i < N; i++) { q.offer(new State(1 << i, i)); visited[1 << i][i] = true; } int ans = 0; while (!q.isEmpty()) { int size = q.size(); for (int i = 0; i < size; i++) { State curState = q.poll(); if (curState.path == ((1 << N) - 1)) return ans; for (int e : graph[curState.head]) { if (visited[curState.path | (1 << e)][e]) continue; visited[curState.path | (1 << e)][e] = true; q.offer(new State(curState.path | (1 << e), e)); } } ans ++; } return -1; } } }
[ "yangcao522@gmail.com" ]
yangcao522@gmail.com
b1bb53e8e7eeae09f03845ffca804def93ab0918
473b76b1043df2f09214f8c335d4359d3a8151e0
/benchmark/bigclonebenchdata_completed/15734479.java
9986aee27473ec41bae8042e21b2c573ebaffa63
[]
no_license
whatafree/JCoffee
08dc47f79f8369af32e755de01c52d9a8479d44c
fa7194635a5bd48259d325e5b0a190780a53c55f
refs/heads/master
2022-11-16T01:58:04.254688
2020-07-13T20:11:17
2020-07-13T20:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,097
java
import java.io.UncheckedIOException; class c15734479 { private List retrieveData(String query) { List data =(List)(Object) new Vector(); query = query.replaceAll("\\s", "+"); String q = "http://www.uniprot.org/uniprot/?query=" + query + "&format=tab&columns=id,protein%20names,organism"; try { URL url = new URL(q); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line = ""; reader.readLine(); while ((line =(String)(Object) reader.readLine()) != null) { String[] st = line.split("\t"); String[] d = new String[] { st[0], st[1], st[2] }; data.add(d); } reader.close(); if ((int)(Object)data.size() == 0) { MyHelperClass JOptionPane = new MyHelperClass(); JOptionPane.showMessageDialog(this, "No data found for query"); } } catch (UncheckedIOException e) { System.err.println("Query " + q + " caused exception: "); e.printStackTrace(); } catch (Exception e) { System.err.println("Query " + q + " caused exception: "); e.printStackTrace(); } return data; } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass showMessageDialog(c15734479 o0, String o1){ return null; }} class List { public MyHelperClass add(String[] o0){ return null; } public MyHelperClass size(){ return null; }} class Vector { } class URL { URL(String o0){} URL(){} public MyHelperClass openStream(){ return null; }} class BufferedReader { BufferedReader(){} BufferedReader(InputStreamReader o0){} public MyHelperClass readLine(){ return null; } public MyHelperClass close(){ return null; }} class InputStreamReader { InputStreamReader(MyHelperClass o0){} InputStreamReader(){}} class MalformedURLException extends Exception{ public MalformedURLException(String errorMessage) { super(errorMessage); } }
[ "piyush16066@iiitd.ac.in" ]
piyush16066@iiitd.ac.in
132c338b1e10633173e76856be585e1dd19febe6
2b94842389d46a838b739853ad3e9236455a9ba0
/src/studystuff_interview_questions_all/Array_Example.java
51d3f032ecfd727eabe697c6cfc4effdf08c4740
[]
no_license
aroragaurav2810/Java-Interview-Programs-New
329ed486dee977ec83e3a3ab4ea00c9f221283ad
e43fbaebd32baf16031342b2b341d46501e0551f
refs/heads/master
2020-05-26T15:32:59.542316
2020-02-20T04:26:17
2020-02-20T04:26:17
188,287,272
0
0
null
null
null
null
UTF-8
Java
false
false
1,494
java
package studystuff_interview_questions_all; interface Sports { Sports []sp1=new Sports[5]; } public class Array_Example { public static void main(String[] args) { } } class Array_Example2 extends Array_Example { Array_Example []ar1=new Array_Example2[5]; // Allowed assignment of array object of sub class in super class array reference //Array_Example2 []ar2=new Array_Example[5]; // compilation error in assigning array object of super class in sub class array reference Array_Example2 []ar2=(Array_Example2[]) new Array_Example[5]; // no compilation error in assigning array object of super class in sub class array reference after casting // Object []ar3=new int[5]; // seems like parent -child relation but compilation error as no relation between int primitive type and Object class Object []ar4=new Integer[5]; // same as statement 1, allowed as there is parent child relation // Integer []ar5=new Byte[5]; // compilation error because no parent -child relation Array_Example []ar5=new Array_Example[]{new Array_Example(), new Array_Example2()}; } class Array_Example3 implements Sports { Sports []sp1=new Sports[5]; // very important // As per interface logic means as we know, interface relates only with reference but has no relation with object // but you can see here, array of interface type has reference and object of interface type. That's an important certification logic/question }
[ "Gaurav Arora@DESKTOP-3TDB8FM" ]
Gaurav Arora@DESKTOP-3TDB8FM
7c443116ec8b44fc21a91324e08ffa256d76a736
b3e8bde15e6388d388ab6eae117146f403f4e4ea
/src/program1/Q13.java
334f06ab68a02113eaf3fc7a99ccfced4358b43e
[]
no_license
Nagaraj-Acharya/NIIT_Programs
98e524415d1ea9d538307ed30d7b4a027ce1ea95
999ff0be9366e596ceea0c1a651c28bd6606de3f
refs/heads/master
2020-03-10T21:08:32.438447
2018-04-18T08:26:41
2018-04-18T08:26:41
129,586,423
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package program1; import java.util.Scanner; public class Q13 { public static void main(String[] args) { int rev=0,sum=0; int op[]=new int[10]; int k=0; Scanner sc=new Scanner(System.in); System.out.println("Enter the first number :"); int n1=sc.nextInt(); System.out.println("Enter the second number :"); int limit=sc.nextInt(); for(int i=n1;i<=limit;i++){ n1=i; while(n1>0){ int b=n1%10; rev=rev*10+b; n1=n1/10; } if(rev==i){ System.out.println(i+""); op[k]=i; k++; } rev=0; } for(int s:op){ sum=sum+s; } System.out.println("Addition :"+sum); } }
[ "MRuser@BLR-MSM-MR09-10.NIITEDUCATION.COM" ]
MRuser@BLR-MSM-MR09-10.NIITEDUCATION.COM
610e202e59a8811d23c41b18147e1db45665b493
8c517c2db3019bec94175a12677adf3c7c2c2a60
/ad-service/ad-sponsor/src/main/java/com/sunny/search/ad/utils/CommonUtils.java
c53c945d87674cb2b8916ff9a6c3d5b267fc3e02
[]
no_license
zlkjzxj/ad-spring-cloud
8198eab991aa87e24ae96f371284a774033bb280
63d70b5396f81c1bdee03ef5e89d7e7e91070492
refs/heads/master
2020-04-23T20:29:00.971324
2019-03-01T10:05:27
2019-03-01T10:05:27
171,441,484
0
0
null
null
null
null
UTF-8
Java
false
false
836
java
package com.sunny.search.ad.utils; import com.sunny.ad.exception.AdException; import com.sunny.search.ad.exception.AdException; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.time.DateUtils; import java.util.Date; /** * Created by Qinyi. */ public class CommonUtils { private static String[] parsePatterns = { "yyyy-MM-dd", "yyyy/MM/dd", "yyyy.MM.dd" }; public static String md5(String value) { return DigestUtils.md5Hex(value).toUpperCase(); } public static Date parseStringDate(String dateString) throws AdException { try { return DateUtils.parseDate( dateString, parsePatterns ); } catch (Exception ex) { throw new AdException(ex.getMessage()); } } }
[ "zlkjzxj@163.com" ]
zlkjzxj@163.com
574b4902dac74f0d10286d77fe6296e0d8b49ed5
254fdb8729b639fd0fb9896364d0e89186521b6a
/src/main/java/com/fishercoder/solutions/_655.java
7e51aff5d62691cc30ad06731a81d4648ff79da1
[ "Apache-2.0" ]
permissive
jiangxf/java_interview
99e9601aefa058a2465946803ad348ffb91f804e
1a1794689d7a977464e7e47a994140de67cf56be
refs/heads/master
2020-04-08T14:54:06.386481
2018-12-04T06:03:31
2018-12-04T06:03:31
159,456,451
0
0
null
null
null
null
UTF-8
Java
false
false
3,339
java
package com.fishercoder.solutions; import com.fishercoder.common.TreeNode; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /** * 655. Print Binary Tree * <p> * Print a binary tree in an m*n 2D string array following these rules: * 1. The row number m should be equal to the height of the given binary tree. * 2. The column number n should always be an odd number. * 3. The root node's value (in string format) should be put in the exactly middle of the first row it can be put. * The column and the row where the root node belongs MySolution separate the rest space into two parts (left-bottom part and right-bottom part). * You should print the left subtree in the left-bottom part and print the right subtree in the right-bottom part. * The left-bottom part and the right-bottom part should have the same size. * Even if one subtree is none while the other is not, * you don't need to print anything for the none subtree but * still need to leave the space as large as that for the other subtree. * However, if two subtrees are none, then you don't need to leave space for both of them. * 4. Each unused space should contain an empty string "". * 5. Print the subtrees following the same rules. * <p> * Example 1: * Input: * 1 * / * 2 * Output: * [["", "1", ""], * ["2", "", ""]] * <p> * Example 2: * Input: * 1 * / \ * 2 3 * \ * 4 * Output: * [["", "", "", "1", "", "", ""], * ["", "2", "", "", "", "3", ""], * ["", "", "4", "", "", "", ""]] * <p> * Example 3: * Input: * 1 * / \ * 2 5 * / * 3 * / * 4 * Output: * <p> * [["", "", "", "", "", "", "", "1", "", "", "", "", "", "", ""] * ["", "", "", "2", "", "", "", "", "", "", "", "5", "", "", ""] * ["", "3", "", "", "", "", "", "", "", "", "", "", "", "", ""] * ["4", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]] * <p> * Note: The height of binary tree is in the range of [1, 10] */ public class _655 { /** * Reference: https://discuss.leetcode.com/topic/98381/java-recursive-solution * and https://leetcode.com/articles/print-binary-tree/ */ public List<List<String>> printTree(TreeNode root) { List<List<String>> result = new LinkedList<>(); int height = root == null ? 1 : getHeight(root); int rows = height; int columns = (int) (Math.pow(2, height) - 1); List<String> row = new ArrayList<>(); for (int i = 0; i < columns; i++) { row.add(""); } for (int i = 0; i < rows; i++) { result.add(new ArrayList<>(row)); } populateResult(root, result, 0, rows, 0, columns - 1); return result; } private void populateResult(TreeNode root, List<List<String>> result, int row, int totalRows, int i, int j) { if (row == totalRows || root == null) { return; } result.get(row).set((i + j) / 2, Integer.toString(root.val)); populateResult(root.left, result, row + 1, totalRows, i, (i + j) / 2 - 1); populateResult(root.right, result, row + 1, totalRows, (i + j) / 2 + 1, j); } private int getHeight(TreeNode root) { if (root == null) { return 0; } return 1 + Math.max(getHeight(root.left), getHeight(root.right)); } }
[ "jiangxiaofeng@simuyun.com" ]
jiangxiaofeng@simuyun.com
5f23566f53ba2c65993d3a6c122846c88900a303
258c8a752208c3c58bd027476ce8acccc2c6656e
/src/test/java/com/atguigu/day1/Day1ApplicationTests.java
d7acc5e48265496434c83e90399ca206487a40b2
[]
no_license
atguigu201808/day1
919c9d441502c4c75036b28805d455bd660923d3
a96da79b5934c9a4a1ac099b2cf5cd77c86f3283
refs/heads/master
2020-05-14T14:08:40.468630
2019-04-17T06:03:00
2019-04-17T06:03:00
181,826,895
1
0
null
null
null
null
UTF-8
Java
false
false
331
java
package com.atguigu.day1; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class Day1ApplicationTests { @Test public void contextLoads() { } }
[ "tom@git.com" ]
tom@git.com
55653cccb90c6eee3f77e94de8b677d71abb0480
a6a22479d657a89c46ea186bef4949f347f285d9
/app/models/Station.java
d5639df2c9b3b68d94342c6ab96d969038803a4a
[]
no_license
diarmuidoriordan/amon-sul-Release-3
11404a50fc5ee3d70bf68f7e33173338f5fc4993
68f076ad52f344456c8895eda3f561db9a683245
refs/heads/main
2023-05-06T14:41:10.463007
2021-05-23T18:50:15
2021-05-23T18:50:15
369,339,450
0
0
null
null
null
null
UTF-8
Java
false
false
3,630
java
/** * @author Dermot O'Riordan */ package models; import play.db.jpa.Model; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.OneToMany; /** * This class creates a Station and includes a constructor to * initialise some, but not all, of the class variable fields. * @author Dermot O'Riordan */ @Entity public class Station extends Model { /** * Station Name from user input or read from file. */ public String name; /** * GPS Latitude co-ordinates in Decimal Decrees, from user input or read from file. */ public double latitude; /** * GPS Longitude co-ordinates in Decimal Decrees from user input or read from file. */ public double longitude; /** * Current weather conditions from code. */ public String weatherFromCode; /** * String that contains Fomantic UI semantic code to set the appropriate current weather icon. */ public String weatherIcon; /** * Temperature in degrees Celcius. */ public double tempC; /** * Most recent temperature reading in degrees Fahrenheit. */ public double tempF; /** * Highest temperature ever recorded for this Station. */ public double maxTempC; /** * Lowest temperature ever recorded for this Station. */ public double minTempC; /** * Are the three most recent temperature readings RISING or FALLING? */ public String tempTrends; /** * Wind speed as a reading converted from Km/h to the Beaufort Scale (Bft). */ public int windBft; /** * Direction the wind is blowing in, measured in degrees. */ public int windDirection; /** * A destription in words of the direction the wind is blowing in. */ public String windDirectionOutput; /** * The wind chill factor ("feels like") in degrees Celcius. */ public double windChill; /** * Highest wind speed ever recorded for this Station. */ public double maxWindSpeed; /** * Lowest wind speed ever recorded for this Station. */ public double minWindSpeed; /** * Are the three most recent wind speed readings RISING or FALLING? */ public String windTrends; /** * Pressure in hPa. */ public int pressureHPA; /** * Highest pressure ever recorded for this Station. */ public int maxPressure; /** * Lowest temperature ever recorded for this Station. */ public int minPressure; /** * Are the three most recent pressure readings RISING or FALLING? */ public String pressureTrends; /** * A List of all the Readings for this Station. */ @OneToMany(cascade = CascadeType.ALL) public List<Reading> readings = new ArrayList<Reading>(); /** * Constructor for the Station object. Accepts the name, latitude and longitude * information and initialises these class variable fields. Other fields are * initialised from another method in the utils.LatestWeather class. * @param name Station Name from user input or read from file. * @param latitude GPS Latitude co-ordinates in Decimal Decrees, from user input or read from file. * @param longitude GPS Longitude co-ordinates in Decimal Decrees from user input or read from file. */ public Station(String name, double latitude, double longitude) { this.name = name; this.latitude = latitude; this.longitude = longitude; } /** * This method returns the name of the Station. Used to list the Stations alphabetically. * @return Returns the name of the Station. */ public String getName() { return this.name; } }
[ "diarmuidoriordan@gmail.com" ]
diarmuidoriordan@gmail.com
44a4817de045ca205212b38178a4541d7ea0d114
7e4906f42c1818387d6d176650b8499f6ffd4c1f
/src/main/java/com/example/restfulapi/form/ProductForm.java
2157160346574a8df7fc375f634f2930f4cf9e2b
[]
no_license
na2me/RESTfulAPI
ea7e7e97058e718489113c8f0dccfdc51e3063a3
d028524074c0b3ca9e0b98a9adcf7a3aff2a03b1
refs/heads/master
2022-06-26T06:23:54.680738
2020-01-06T07:11:15
2020-01-06T07:11:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package com.example.restfulapi.form; import lombok.Data; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Size; /** * ProductFormクラス * * @author Natsume Takuya */ @Data public class ProductForm { @NotEmpty(message = "{error.products.title.empty}") @Size(max = 100, message = "{error.products.title.size}") String title; @NotEmpty(message = "{error.products.description.empty}") @Size(max = 500, message = "{error.products.description.size}") String description; @Min(value = 1, message = "{error.products.price}") @Max(value = 1000000, message = "{error.products.price}") int price; String imagePath; }
[ "natsumetakuya@team-lab.com" ]
natsumetakuya@team-lab.com
3eb05d5ba9a57718eb3ad01f30b5258859f1ceb1
9a36c015e6bf4bbb9ae0a6809a4be2ff5118ebd1
/src/com/company/MyQueue.java
e915567334ffd0c02cdec65bb53e62679031f562
[]
no_license
orifjon9/MPP-preparing-examples
e46eed679d9152408f6ea3273f52db553d13bfe8
17a71ca57ea1e43b6c814436d0bd9c1feb1d7a8b
refs/heads/master
2021-01-09T06:01:08.916799
2017-02-04T22:39:54
2017-02-04T22:39:54
80,892,352
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
package com.company; import java.util.Arrays; /** * Created by orifjon9 on 2/3/2017. */ public class MyQueue<T> { private Object[] store; private int lastIndex; private final int DEFAULT_COUNT = 4; public MyQueue(){ store = new Object[DEFAULT_COUNT]; } public boolean add(T value) { if(lastIndex == store.length){ ensureCapacity(); } store[lastIndex++] = value; return true; } private void ensureCapacity() { int newSize = store.length * 2; store = Arrays.copyOf(store, newSize); } public T poll(){ if(store[0] != null) { T value = (T) store[0]; removeFirst(); return value; } return null; } public T peek(){ if(store[0] != null) return (T)store[0]; return null; } private void removeFirst() { for (int i = 0; i < store.length; i++) { if(i == (store.length - 1)) return; store[i] = store[i+1]; store[i+1] = null; } } }
[ "orifjon9@gmail.com" ]
orifjon9@gmail.com
88a44df827302c35f22045252c709ffeb979b116
da40e7002f5d6a2b0aa81d7754155c88bd4d5847
/src/main/java/com/ymatou/datamonitor/exception/MySimpleMappingExceptionResolver.java
48c53d112082c88f124f05eca57feaa2c4704e13
[]
no_license
xie-summer/datamonitor
7543545f326415f9d1f815da2be1a69498d0d6fa
1d001254e2f6d39765c4373a83d89e372a86cbec
refs/heads/master
2021-06-16T07:54:00.248869
2017-03-09T09:39:39
2017-03-09T09:39:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,306
java
/* * * (C) Copyright 2016 Ymatou (http://www.ymatou.com/). * All rights reserved. * */ package com.ymatou.datamonitor.exception; import com.alibaba.fastjson.JSON; import com.ymatou.datamonitor.util.ResponseStatusEnum; import com.ymatou.datamonitor.util.WapperUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class MySimpleMappingExceptionResolver extends SimpleMappingExceptionResolver { private final static String HEADER_STRING = "X-Requested-With"; private final static String AJAX_HEADER = "XMLHttpRequest"; private final static String JSON_CONTENT_TYPE = "application/json;charset=UTF-8"; private final static int HTTP_STATUS_OK = 200; private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Override protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { boolean isAjax = AJAX_HEADER.equals(request.getHeader(HEADER_STRING)); logger.error("exception :",ex); if (isAjax) { // if (ex instanceof BaseException) { // responseString(response, JSON.toJSONString(WapperUtil.error(ResponseStatusEnum.ERROR, ex.getMessage()))); // } else if (ex instanceof BaseRunTimeException) { // responseString(response, JSON.toJSONString(WapperUtil.error(ResponseStatusEnum.ERROR, ex.getMessage()))); // } else { responseString(response, JSON.toJSONString(WapperUtil.error(ResponseStatusEnum.ERROR, ex.getMessage()))); // } return new ModelAndView(); } return super.doResolveException(request, response, handler, ex); } private void responseString(HttpServletResponse response, String jsonpInfo) { try { response.getWriter().write(jsonpInfo); response.setContentType(JSON_CONTENT_TYPE); response.setStatus(HTTP_STATUS_OK); } catch (IOException e) { e.printStackTrace(); } } }
[ "luoshiqian@ymatou.com" ]
luoshiqian@ymatou.com
2a5c8efcdae99c336e4b652db153038158bb5979
f92e0fe9e4bea2fd61572fde7477c7ec1e58099c
/host/shiver/src/main/java/dk/osaa/psaw/job/rasterizer/RasterGroup.java
1e1fd06607dedfbad0533ff8023699f9f3668551
[ "Apache-2.0" ]
permissive
openspaceaarhus/PhotonSaw
ad86d3e849c2afa1d211a11f8841d2c14e0ffe90
2d10985f5c600d3bb17b7038ec281d5847f48757
refs/heads/master
2023-01-24T16:01:43.113481
2023-01-17T17:52:01
2023-01-17T17:52:01
2,430,813
7
5
NOASSERTION
2022-02-01T00:55:43
2011-09-21T15:59:08
C
UTF-8
Java
false
false
3,109
java
package dk.osaa.psaw.job.rasterizer; import dk.osaa.psaw.job.JobNodeGroup; import dk.osaa.psaw.job.JobRenderTarget; import dk.osaa.psaw.job.LaserNodeSettings; import dk.osaa.psaw.job.RasterNode; import lombok.extern.java.Log; import lombok.val; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * Created by ff on 7/9/16. */ @Log class RasterGroup { Rectangle2D bb; ArrayList<RasterNode> nodes; LaserNodeSettings settings; RasterGroup(RasterNode rn) { bb = rn.getBoundingBox(); nodes = new ArrayList<RasterNode>(); nodes.add(rn); settings = rn.getSettings(); } boolean canAdd(RasterNode rn, JobRenderTarget target) { if (!rn.getSettings().equalsRaster(settings)) { return false; // The laser settings aren't the same, so we can't add the raster to this group. } Rectangle2D obb = rn.getBoundingBox(); if (obb.getMinY() > bb.getMaxY() || obb.getMaxY() < bb.getMinY()) { return false; // The new raster is entirely outside the y-span of this group, so it might as well be in another group. } /* * TODO: calculate the cost of engraving this raster as part of this group or separately and only allow * adding if the total cost is lower when added */ return true; } void add(RasterNode rn) { nodes.add(rn); bb.add(rn.getBoundingBox()); } static List<RasterGroup> getRasterGroups(JobNodeGroup root, JobRenderTarget target) { val rasters = root.getRasters(); // Sort by height, so the tallest rasters get to form groups. Collections.sort(rasters, new Comparator<RasterNode>() { public int compare(RasterNode c1, RasterNode c2) { int r1 = (int)Math.round(c2.getBoundingBox().getHeight() - c1.getBoundingBox().getHeight()); if (r1 != 0) { return r1; } return c1.getId().compareTo(c2.getId()); } }); val merged = new ArrayList<RasterGroup>(); for (val rn : rasters) { log.info("Adding raster: "+rn.getId()+" with height: "+rn.getBoundingBox().getHeight()); boolean added = false; for (val eg : merged) { if (eg.canAdd(rn, target)) { added = true; eg.add(rn); break; } } if (!added) { merged.add(new RasterGroup(rn)); } } // We now have all the rasters merged into groups of similar parameters // We sort the merged groups, so we start with the top one, this is to minimize travel. Collections.sort(merged, new Comparator<RasterGroup>() { public int compare(RasterGroup c1, RasterGroup c2) { return (int)Math.round(c1.bb.getMinY() - c2.bb.getMinY()); } }); return merged; } }
[ "dren.dk@gmail.com" ]
dren.dk@gmail.com
57cc0cbbba02e344ead6f6a8bd73312c592cd451
f5cc60472d1f301a8c3942d1b7e65fb7b993c2bc
/src/masterclient/CLI/MasterCLI.java
fac6b5e875839a12abb0d74d2fa7c02030150a88
[ "MIT" ]
permissive
rubenwo/Chunk-Based-Distributed-Transcoding
2155f621630a72d0996a5ff7467f3f7bea996bb3
7b8517c08e870100b4e10ed61b9ab7e4d3ecf8ae
refs/heads/master
2020-03-23T17:05:17.661290
2018-07-21T20:01:21
2018-07-21T20:01:21
141,842,288
1
1
null
null
null
null
UTF-8
Java
false
false
54
java
package masterclient.CLI; public class MasterCLI { }
[ "rwoldhui@avans.nl" ]
rwoldhui@avans.nl
e519e4c439588d62fa491c46ae58a7e28d1bb19c
62911049b9c91003da4bd293eaf52791d1984346
/chat-system-wang-soufi/src/chatsystemTDa2/FileRequest.java
bf1d3a2f44d862930eab1b7f7e16ed8f894ca391
[]
no_license
yuanbo07/chat-system-wang-soufi
d25e4468e29432d8700a89b6e52639be8af513bc
a33362f362e5c6b957b6900a77a74a05d64c0644
refs/heads/master
2021-01-10T01:09:20.205774
2014-12-27T01:30:35
2014-12-27T01:30:35
47,387,702
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package chatsystemTDa2; public class FileRequest extends Message { private static final long serialVersionUID = 4L; private String name; public FileRequest(String name){ this.name=name; } public String getName(){ return name; } public void setName(String name){ this.name=name; } public String toString(){ return "FileRequest [name=" + name + "]"; } }
[ "yuanbo.wang07@gmail.com" ]
yuanbo.wang07@gmail.com
e073946833ec99a1f7ba9d30877e1270c869d8c7
76852b1b29410436817bafa34c6dedaedd0786cd
/sources-2020-11-04-tempmail/sources/androidx/customview/view/AbsSavedState.java
6795dfa5ea049290b8f696f3a1d5ec3356f835d2
[]
no_license
zteeed/tempmail-apks
040e64e07beadd8f5e48cd7bea8b47233e99611c
19f8da1993c2f783b8847234afb52d94b9d1aa4c
refs/heads/master
2023-01-09T06:43:40.830942
2020-11-04T18:55:05
2020-11-04T18:55:05
310,075,224
0
0
null
null
null
null
UTF-8
Java
false
false
2,004
java
package androidx.customview.view; import android.os.Parcel; import android.os.Parcelable; public abstract class AbsSavedState implements Parcelable { public static final Parcelable.Creator<AbsSavedState> CREATOR = new a(); /* renamed from: c reason: collision with root package name */ public static final AbsSavedState f1421c = new AbsSavedState() { }; /* renamed from: b reason: collision with root package name */ private final Parcelable f1422b; static class a implements Parcelable.ClassLoaderCreator<AbsSavedState> { a() { } /* renamed from: a */ public AbsSavedState createFromParcel(Parcel parcel) { return createFromParcel(parcel, (ClassLoader) null); } /* renamed from: b */ public AbsSavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { if (parcel.readParcelable(classLoader) == null) { return AbsSavedState.f1421c; } throw new IllegalStateException("superState must be null"); } /* renamed from: c */ public AbsSavedState[] newArray(int i) { return new AbsSavedState[i]; } } public final Parcelable a() { return this.f1422b; } public int describeContents() { return 0; } public void writeToParcel(Parcel parcel, int i) { parcel.writeParcelable(this.f1422b, i); } private AbsSavedState() { this.f1422b = null; } protected AbsSavedState(Parcelable parcelable) { if (parcelable != null) { this.f1422b = parcelable == f1421c ? null : parcelable; return; } throw new IllegalArgumentException("superState must not be null"); } protected AbsSavedState(Parcel parcel, ClassLoader classLoader) { Parcelable readParcelable = parcel.readParcelable(classLoader); this.f1422b = readParcelable == null ? f1421c : readParcelable; } }
[ "zteeed@minet.net" ]
zteeed@minet.net
0ea5ba758d4de6d19900026277c861592c0a490f
b97bc0706448623a59a7f11d07e4a151173b7378
/src/main/java/com/tcmis/internal/supply/factory/ChangeDlaShipToViewBeanFactory.java
1bf2ec3ef538649998c71c7d01cd0344d752c4a2
[]
no_license
zafrul-ust/tcmISDev
576a93e2cbb35a8ffd275fdbdd73c1f9161040b5
71418732e5465bb52a0079c7e7e7cec423a1d3ed
refs/heads/master
2022-12-21T15:46:19.801950
2020-02-07T21:22:50
2020-02-07T21:22:50
241,601,201
0
0
null
2022-12-13T19:29:34
2020-02-19T11:08:43
Java
UTF-8
Java
false
false
17,325
java
package com.tcmis.internal.supply.factory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.sql.Connection; import java.text.ParseException; import java.util.Collection; import java.util.Iterator; import java.util.Vector; import com.tcmis.common.framework.BaseDataBean; import com.tcmis.common.exceptions.BaseException; import com.tcmis.common.exceptions.DataBeanCreationException; import com.tcmis.common.framework.BaseBeanFactory; import com.tcmis.common.db.SqlManager; import com.tcmis.common.util.*; import com.tcmis.common.db.DbManager; import com.tcmis.common.db.SqlManager; import com.tcmis.internal.supply.beans.ChangeDlaShipToViewBean; /****************************************************************************** * CLASSNAME: ChangeDlaShipToViewBeanFactory <br> * @version: 1.0, Feb 26, 2009 <br> *****************************************************************************/ public class ChangeDlaShipToViewBeanFactory extends BaseBeanFactory { Log log = LogFactory.getLog(this.getClass()); //column names public String ATTRIBUTE_PR_NUMBER = "PR_NUMBER"; public String ATTRIBUTE_LINE_ITEM = "LINE_ITEM"; public String ATTRIBUTE_SHIP_TO_DODAAC = "SHIP_TO_DODAAC"; public String ATTRIBUTE_SHIP_TO_LOCATION_ID = "SHIP_TO_LOCATION_ID"; public String ATTRIBUTE_SHIP_VIA_DODAAC = "SHIP_VIA_DODAAC"; public String ATTRIBUTE_SHIP_VIA_LOCATION_ID = "SHIP_VIA_LOCATION_ID"; public String ATTRIBUTE_NOTES = "NOTES"; public String ATTRIBUTE_MILSTRIP_CODE = "MILSTRIP_CODE"; public String ATTRIBUTE_PORT_OF_EMBARKATION = "PORT_OF_EMBARKATION"; public String ATTRIBUTE_PORT_OF_DEBARKATION = "PORT_OF_DEBARKATION"; public String ATTRIBUTE_ST_COUNTRY_ABBREV = "ST_COUNTRY_ABBREV"; public String ATTRIBUTE_ST_STATE_ABBREV = "ST_STATE_ABBREV"; public String ATTRIBUTE_ST_CITY = "ST_CITY"; public String ATTRIBUTE_ST_ZIP = "ST_ZIP"; public String ATTRIBUTE_ST_ADDRESS_LINE_1_DISPLAY = "ST_ADDRESS_LINE_1_DISPLAY"; public String ATTRIBUTE_ST_ADDRESS_LINE_2_DISPLAY = "ST_ADDRESS_LINE_2_DISPLAY"; public String ATTRIBUTE_ST_ADDRESS_LINE_3_DISPLAY = "ST_ADDRESS_LINE_3_DISPLAY"; public String ATTRIBUTE_ST_ADDRESS_LINE_4_DISPLAY = "ST_ADDRESS_LINE_4_DISPLAY"; public String ATTRIBUTE_MF_COUNTRY_ABBREV = "MF_COUNTRY_ABBREV"; public String ATTRIBUTE_MF_STATE_ABBREV = "MF_STATE_ABBREV"; public String ATTRIBUTE_MF_CITY = "MF_CITY"; public String ATTRIBUTE_MF_ZIP = "MF_ZIP"; public String ATTRIBUTE_MF_ADDRESS_LINE_1_DISPLAY = "MF_ADDRESS_LINE_1_DISPLAY"; public String ATTRIBUTE_MF_ADDRESS_LINE_2_DISPLAY = "MF_ADDRESS_LINE_2_DISPLAY"; public String ATTRIBUTE_MF_ADDRESS_LINE_3_DISPLAY = "MF_ADDRESS_LINE_3_DISPLAY"; public String ATTRIBUTE_MF_ADDRESS_LINE_4_DISPLAY = "MF_ADDRESS_LINE_4_DISPLAY"; public String ATTRIBUTE_FAC_PART_NO = "FAC_PART_NO"; public String ATTRIBUTE_DESIRED_SHIP_DATE = "DESIRED_SHIP_DATE"; //table name public String TABLE = "CHANGE_DLA_SHIP_TO_VIEW"; //constructor public ChangeDlaShipToViewBeanFactory(DbManager dbManager) { super(dbManager); } //get column names public String getColumnName(String attributeName) { if(attributeName.equals("prNumber")) { return ATTRIBUTE_PR_NUMBER; } else if(attributeName.equals("lineItem")) { return ATTRIBUTE_LINE_ITEM; } else if(attributeName.equals("shipToDodaac")) { return ATTRIBUTE_SHIP_TO_DODAAC; } else if(attributeName.equals("shipToLocationId")) { return ATTRIBUTE_SHIP_TO_LOCATION_ID; } else if(attributeName.equals("shipViaDodaac")) { return ATTRIBUTE_SHIP_VIA_DODAAC; } else if(attributeName.equals("shipViaLocationId")) { return ATTRIBUTE_SHIP_VIA_LOCATION_ID; } else if(attributeName.equals("notes")) { return ATTRIBUTE_NOTES; } else if(attributeName.equals("milstripCode")) { return ATTRIBUTE_MILSTRIP_CODE; } else if(attributeName.equals("portOfEmbarkation")) { return ATTRIBUTE_PORT_OF_EMBARKATION; } else if(attributeName.equals("portOfDebarkation")) { return ATTRIBUTE_PORT_OF_DEBARKATION; } else if(attributeName.equals("stCountryAbbrev")) { return ATTRIBUTE_ST_COUNTRY_ABBREV; } else if(attributeName.equals("stStateAbbrev")) { return ATTRIBUTE_ST_STATE_ABBREV; } else if(attributeName.equals("stCity")) { return ATTRIBUTE_ST_CITY; } else if(attributeName.equals("stZip")) { return ATTRIBUTE_ST_ZIP; } else if(attributeName.equals("stAddressLine1Display")) { return ATTRIBUTE_ST_ADDRESS_LINE_1_DISPLAY; } else if(attributeName.equals("stAddressLine2Display")) { return ATTRIBUTE_ST_ADDRESS_LINE_2_DISPLAY; } else if(attributeName.equals("stAddressLine3Display")) { return ATTRIBUTE_ST_ADDRESS_LINE_3_DISPLAY; } else if(attributeName.equals("stAddressLine4Display")) { return ATTRIBUTE_ST_ADDRESS_LINE_4_DISPLAY; } else if(attributeName.equals("mfCountryAbbrev")) { return ATTRIBUTE_MF_COUNTRY_ABBREV; } else if(attributeName.equals("mfStateAbbrev")) { return ATTRIBUTE_MF_STATE_ABBREV; } else if(attributeName.equals("mfCity")) { return ATTRIBUTE_MF_CITY; } else if(attributeName.equals("mfZip")) { return ATTRIBUTE_MF_ZIP; } else if(attributeName.equals("mfAddressLine1Display")) { return ATTRIBUTE_MF_ADDRESS_LINE_1_DISPLAY; } else if(attributeName.equals("mfAddressLine2Display")) { return ATTRIBUTE_MF_ADDRESS_LINE_2_DISPLAY; } else if(attributeName.equals("mfAddressLine3Display")) { return ATTRIBUTE_MF_ADDRESS_LINE_3_DISPLAY; } else if(attributeName.equals("mfAddressLine4Display")) { return ATTRIBUTE_MF_ADDRESS_LINE_4_DISPLAY; } else if(attributeName.equals("facPartNo")) { return ATTRIBUTE_FAC_PART_NO; } else if(attributeName.equals("desiredShipDate")) { return ATTRIBUTE_DESIRED_SHIP_DATE; } else { return super.getColumnName(attributeName); } } //get column types public int getType(String attributeName) { return super.getType(attributeName, ChangeDlaShipToViewBean.class); } //you need to verify the primary key(s) before uncommenting this /* //delete public int delete(ChangeDlaShipToViewBean changeDlaShipToViewBean) throws BaseException { SearchCriteria criteria = new SearchCriteria("prNumber", "SearchCriterion.EQUALS", "" + changeDlaShipToViewBean.getPrNumber()); Connection connection = null; int result = 0; try { connection = this.getDbManager().getConnection(); result = this.delete(criteria, connection); } finally { this.getDbManager().returnConnection(connection); } return result; } public int delete(ChangeDlaShipToViewBean changeDlaShipToViewBean, Connection conn) throws BaseException { SearchCriteria criteria = new SearchCriteria("prNumber", "SearchCriterion.EQUALS", "" + changeDlaShipToViewBean.getPrNumber()); return delete(criteria, conn); } */ public int delete(SearchCriteria criteria) throws BaseException { Connection connection = null; int result = 0; try { connection = getDbManager().getConnection(); result = delete(criteria, connection); } finally { this.getDbManager().returnConnection(connection); } return result; } public int delete(SearchCriteria criteria, Connection conn) throws BaseException { String sqlQuery = " delete from " + TABLE + " " + getWhereClause(criteria); return new SqlManager().update(conn, sqlQuery); } //you need to verify the primary key(s) before uncommenting this /* //insert public int insert(ChangeDlaShipToViewBean changeDlaShipToViewBean) throws BaseException { Connection connection = null; int result = 0; try { connection = getDbManager().getConnection(); result = insert(changeDlaShipToViewBean, connection); } finally { this.getDbManager().returnConnection(connection); } return result; } public int insert(ChangeDlaShipToViewBean changeDlaShipToViewBean, Connection conn) throws BaseException { SqlManager sqlManager = new SqlManager(); String query = "insert into " + TABLE + " (" + ATTRIBUTE_PR_NUMBER + "," + ATTRIBUTE_LINE_ITEM + "," + ATTRIBUTE_SHIP_TO_DODAAC + "," + ATTRIBUTE_SHIP_TO_LOCATION_ID + "," + ATTRIBUTE_SHIP_VIA_DODAAC + "," + ATTRIBUTE_SHIP_VIA_LOCATION_ID + "," + ATTRIBUTE_NOTES + "," + ATTRIBUTE_MILSTRIP_CODE + "," + ATTRIBUTE_PORT_OF_EMBARKATION + "," + ATTRIBUTE_PORT_OF_DEBARKATION + "," + ATTRIBUTE_ST_COUNTRY_ABBREV + "," + ATTRIBUTE_ST_STATE_ABBREV + "," + ATTRIBUTE_ST_CITY + "," + ATTRIBUTE_ST_ZIP + "," + ATTRIBUTE_ST_ADDRESS_LINE_1_DISPLAY + "," + ATTRIBUTE_ST_ADDRESS_LINE_2_DISPLAY + "," + ATTRIBUTE_ST_ADDRESS_LINE_3_DISPLAY + "," + ATTRIBUTE_ST_ADDRESS_LINE_4_DISPLAY + "," + ATTRIBUTE_MF_COUNTRY_ABBREV + "," + ATTRIBUTE_MF_STATE_ABBREV + "," + ATTRIBUTE_MF_CITY + "," + ATTRIBUTE_MF_ZIP + "," + ATTRIBUTE_MF_ADDRESS_LINE_1_DISPLAY + "," + ATTRIBUTE_MF_ADDRESS_LINE_2_DISPLAY + "," + ATTRIBUTE_MF_ADDRESS_LINE_3_DISPLAY + "," + ATTRIBUTE_MF_ADDRESS_LINE_4_DISPLAY + "," + ATTRIBUTE_FAC_PART_NO + ")" + " values (" + changeDlaShipToViewBean.getPrNumber() + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getLineItem()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getShipToDodaac()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getShipToLocationId()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getShipViaDodaac()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getShipViaLocationId()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getNotes()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMilstripCode()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getPortOfEmbarkation()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getPortOfDebarkation()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStCountryAbbrev()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStStateAbbrev()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStCity()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStZip()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine1Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine2Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine3Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine4Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfCountryAbbrev()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfStateAbbrev()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfCity()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfZip()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine1Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine2Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine3Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine4Display()) + "," + SqlHandler.delimitString(changeDlaShipToViewBean.getFacPartNo()) + ")"; return sqlManager.update(conn, query); } //update public int update(ChangeDlaShipToViewBean changeDlaShipToViewBean) throws BaseException { Connection connection = null; int result = 0; try { connection = getDbManager().getConnection(); result = update(changeDlaShipToViewBean, connection); } finally { this.getDbManager().returnConnection(connection); } return result; } public int update(ChangeDlaShipToViewBean changeDlaShipToViewBean, Connection conn) throws BaseException { String query = "update " + TABLE + " set " + ATTRIBUTE_PR_NUMBER + "=" + StringHandler.nullIfZero(changeDlaShipToViewBean.getPrNumber()) + "," + ATTRIBUTE_LINE_ITEM + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getLineItem()) + "," + ATTRIBUTE_SHIP_TO_DODAAC + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getShipToDodaac()) + "," + ATTRIBUTE_SHIP_TO_LOCATION_ID + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getShipToLocationId()) + "," + ATTRIBUTE_SHIP_VIA_DODAAC + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getShipViaDodaac()) + "," + ATTRIBUTE_SHIP_VIA_LOCATION_ID + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getShipViaLocationId()) + "," + ATTRIBUTE_NOTES + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getNotes()) + "," + ATTRIBUTE_MILSTRIP_CODE + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMilstripCode()) + "," + ATTRIBUTE_PORT_OF_EMBARKATION + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getPortOfEmbarkation()) + "," + ATTRIBUTE_PORT_OF_DEBARKATION + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getPortOfDebarkation()) + "," + ATTRIBUTE_ST_COUNTRY_ABBREV + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStCountryAbbrev()) + "," + ATTRIBUTE_ST_STATE_ABBREV + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStStateAbbrev()) + "," + ATTRIBUTE_ST_CITY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStCity()) + "," + ATTRIBUTE_ST_ZIP + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStZip()) + "," + ATTRIBUTE_ST_ADDRESS_LINE_1_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine1Display()) + "," + ATTRIBUTE_ST_ADDRESS_LINE_2_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine2Display()) + "," + ATTRIBUTE_ST_ADDRESS_LINE_3_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine3Display()) + "," + ATTRIBUTE_ST_ADDRESS_LINE_4_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getStAddressLine4Display()) + "," + ATTRIBUTE_MF_COUNTRY_ABBREV + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfCountryAbbrev()) + "," + ATTRIBUTE_MF_STATE_ABBREV + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfStateAbbrev()) + "," + ATTRIBUTE_MF_CITY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfCity()) + "," + ATTRIBUTE_MF_ZIP + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfZip()) + "," + ATTRIBUTE_MF_ADDRESS_LINE_1_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine1Display()) + "," + ATTRIBUTE_MF_ADDRESS_LINE_2_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine2Display()) + "," + ATTRIBUTE_MF_ADDRESS_LINE_3_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine3Display()) + "," + ATTRIBUTE_MF_ADDRESS_LINE_4_DISPLAY + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getMfAddressLine4Display()) + "," + ATTRIBUTE_FAC_PART_NO + "=" + SqlHandler.delimitString(changeDlaShipToViewBean.getFacPartNo()) + " " + "where " + ATTRIBUTE_PR_NUMBER + "=" + changeDlaShipToViewBean.getPrNumber(); return new SqlManager().update(conn, query); } */ //select public Collection select(SearchCriteria criteria) throws BaseException { return select(criteria,null); } public Collection select(SearchCriteria criteria, SortCriteria sortCriteria) throws BaseException { Connection connection = null; Collection c = null; try { connection = this.getDbManager().getConnection(); c = select(criteria,sortCriteria, connection); } finally { this.getDbManager().returnConnection(connection); } return c; } public Collection select(SearchCriteria criteria, SortCriteria sortCriteria, Connection conn) throws BaseException { Collection changeDlaShipToViewBeanColl = new Vector(); String query = "select * from " + TABLE + " " + getWhereClause(criteria)+ getOrderByClause(sortCriteria); DataSet dataSet = new SqlManager().select(conn, query); Iterator dataIter = dataSet.iterator(); while (dataIter.hasNext()) { DataSetRow dataSetRow = (DataSetRow)dataIter.next(); ChangeDlaShipToViewBean changeDlaShipToViewBean = new ChangeDlaShipToViewBean(); load(dataSetRow, changeDlaShipToViewBean); changeDlaShipToViewBeanColl.add(changeDlaShipToViewBean); } return changeDlaShipToViewBeanColl; } public Collection doProcedure(String procedure, Collection inParameters, Collection outParameters) throws BaseException { Connection connection = null; Collection c = null; try { connection = getDbManager().getConnection(); c = this.doProcedure(connection, procedure, inParameters, outParameters); } finally { try { getDbManager().returnConnection(connection); } catch (Exception e) { // ignore } } return c; } public Collection doProcedure(Connection connection, String procedure, Collection inParameters, Collection outParameters) throws BaseException { return new SqlManager().doProcedure(connection, procedure, inParameters, outParameters); } }
[ "julio.rivero@wescoair.com" ]
julio.rivero@wescoair.com
97f954c6a3ebe69982a33034df494491dd57dd0f
0e67135a0cec33bb53bf5403ca1f4c85673d20d8
/logss/axelor-core-342save/src/main/java/com/axelor/meta/service/MetaService.java
a507cc4aa7c248609242b1800e1ea49b73624f22
[]
no_license
zuloloxi/adk3_demo3
6743e6e0b153507c0c87ea9b40d568151ee67d06
083ed630a909eb49d2d41ad327f1596b33bbd401
refs/heads/master
2020-03-14T23:38:40.669916
2018-05-02T13:02:34
2018-05-02T13:02:34
131,849,659
0
0
null
null
null
null
UTF-8
Java
false
false
14,621
java
/** * Axelor Business Solutions * * Copyright (C) 2005-2017 Axelor (<http://axelor.com>). * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.axelor.meta.service; import java.io.File; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.inject.Inject; import javax.persistence.Query; import javax.persistence.TypedQuery; import org.hibernate.transform.AliasToEntityMapResultTransformer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.axelor.auth.AuthUtils; import com.axelor.auth.db.Role; import com.axelor.auth.db.User; import com.axelor.common.FileUtils; import com.axelor.common.StringUtils; import com.axelor.db.JPA; import com.axelor.db.Model; import com.axelor.db.QueryBinder; import com.axelor.db.mapper.Mapper; import com.axelor.inject.Beans; import com.axelor.meta.ActionHandler; import com.axelor.meta.db.MetaActionMenu; import com.axelor.meta.db.MetaAttachment; import com.axelor.meta.db.MetaFile; import com.axelor.meta.db.MetaMenu; import com.axelor.meta.db.MetaView; import com.axelor.meta.db.repo.MetaAttachmentRepository; import com.axelor.meta.db.repo.MetaFileRepository; import com.axelor.meta.db.repo.MetaViewRepository; import com.axelor.meta.loader.XMLViews; import com.axelor.meta.schema.actions.Action; import com.axelor.meta.schema.views.AbstractView; import com.axelor.meta.schema.views.ChartView; import com.axelor.meta.schema.views.ChartView.ChartConfig; import com.axelor.meta.schema.views.ChartView.ChartSeries; import com.axelor.meta.schema.views.MenuItem; import com.axelor.meta.schema.views.Search; import com.axelor.rpc.ActionRequest; import com.axelor.rpc.ActionResponse; import com.axelor.rpc.Request; import com.axelor.rpc.Response; import com.axelor.script.ScriptBindings; import com.axelor.script.ScriptHelper; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.inject.persist.Transactional; public class MetaService { private static final Logger LOG = LoggerFactory.getLogger(MetaService.class); @Inject private MetaViewRepository views; @Inject private MetaFileRepository files; @Inject private MetaAttachmentRepository attachments; @SuppressWarnings("unchecked") private List<MenuItem> findMenus(Query query) { QueryBinder.of(query).setCacheable(); List<MenuItem> menus = Lists.newArrayList(); List<Object[]> all = query.getResultList(); final Set<Role> roles = new HashSet<>(); final User user = AuthUtils.getUser(); if (user != null && user.getRoles() != null) { roles.addAll(user.getRoles()); } if (user != null && user.getGroup() != null && user.getGroup().getRoles() != null) { roles.addAll(user.getGroup().getRoles()); } for(Object[] items : all) { final MetaMenu menu = (MetaMenu) items[0]; boolean hasGroup = menu.getGroups() != null && menu.getGroups().contains(user.getGroup()); // if no group access, check for roles if (!hasGroup && !AuthUtils.isAdmin(user) && menu.getRoles() != null && menu.getRoles().size() > 0) { boolean hasRole = false; for (final Role role : roles) { if (menu.getRoles().contains(role)) { hasRole = true; break; } } if (!hasRole) { continue; } } final MenuItem item = new MenuItem(); item.setName(menu.getName()); item.setPriority(menu.getPriority()); item.setTitle(menu.getTitle()); item.setIcon(menu.getIcon()); item.setTop(menu.getTop()); item.setLeft(menu.getLeft()); item.setMobile(menu.getMobile()); if (menu.getParent() != null) { item.setParent(menu.getParent().getName()); } if (menu.getAction() != null) { item.setAction(menu.getAction().getName()); } menus.add(item); } return menus; } public List<MenuItem> getMenus() { User user = AuthUtils.getUser(); String q1 = "SELECT self, COALESCE(self.priority, 0) AS priority FROM MetaMenu self LEFT JOIN self.groups g WHERE "; Object p1 = null; if (user != null && user.getGroup() != null) { p1 = user.getGroup().getCode(); } if (p1 != null) { q1 += "(g.code = ?1 OR self.groups IS EMPTY)"; } else { q1 += "self.groups IS EMPTY"; } q1 += " ORDER BY priority DESC, self.id"; Query query = JPA.em().createQuery(q1); if (p1 != null) query.setParameter(1, p1); return findMenus(query); } public List<MenuItem> getMenus(String parent) { User user = AuthUtils.getUser(); String q1 = "SELECT self, COALESCE(self.priority, 0) AS priority FROM MetaMenu self LEFT JOIN self.groups g WHERE "; String q2 = "self.parent IS NULL"; Object p1 = null; Object p2 = null; if (user != null && user.getGroup() != null) { p2 = user.getGroup().getCode(); } if (Strings.isNullOrEmpty(parent) || "null".endsWith(parent)) { q1 += q2; } else { q1 += "self.parent.name = ?1"; p1 = parent; } if (p2 != null) { q1 += " AND (g.code = ?2 OR self.groups IS EMPTY)"; } else { q1 += " AND self.groups IS EMPTY"; } q1 += " ORDER BY priority DESC, self.id"; Query query = JPA.em().createQuery(q1); if (p1 != null) query.setParameter(1, p1); if (p2 != null) query.setParameter(2, p2); return findMenus(query); } public List<MenuItem> getActionMenus(String parent, String category) { if ("null".equals(parent)) parent = null; if ("null".equals(category)) category = null; String str = "SELECT self FROM MetaActionMenu self WHERE self.parent.name = ?1"; if (Strings.isNullOrEmpty(parent)) { str = "SELECT self FROM MetaActionMenu self WHERE self.parent IS NULL"; } if (!Strings.isNullOrEmpty(category)) { str += " AND self.category = ?2"; } str += " ORDER BY self.name"; TypedQuery<MetaActionMenu> query = JPA.em().createQuery(str, MetaActionMenu.class); if (!Strings.isNullOrEmpty(parent)) { query.setParameter(1, parent); } if (!Strings.isNullOrEmpty(category)) { query.setParameter(2, category); } QueryBinder.of(query).setCacheable(); List<MenuItem> menus = Lists.newArrayList(); List<MetaActionMenu> all = query.getResultList(); for(MetaActionMenu menu : all) { MenuItem item = new MenuItem(); item.setName(menu.getName()); item.setTitle(menu.getTitle()); if (menu.getParent() != null) { item.setParent(menu.getParent().getName()); } if (menu.getAction() != null) { item.setAction(menu.getAction().getName()); } if (menu.getCategory() != null) { item.setCategory(menu.getCategory()); } menus.add(item); } return menus; } public Action getAction(String name) { return XMLViews.findAction(name); } public Response findViews(Class<?> model, Map<String, String> views) { Response response = new Response(); Map<String, Object> data = XMLViews.findViews(model.getName(), views); response.setData(data); response.setStatus(Response.STATUS_SUCCESS); return response; } public Response findView(String model, String name, String type) { Response response = new Response(); AbstractView data = XMLViews.findView(model, name, type); response.setData(data); response.setStatus(Response.STATUS_SUCCESS); return response; } @SuppressWarnings("all") public Response runSearch(Request request) { Response response = new Response(); Map<String, Object> context = request.getData(); String name = (String) context.get("__name"); List<String> selected = (List) context.get("__selected"); LOG.debug("Search : {}", name); Search search = (Search) XMLViews.findView(null, name, "search"); ScriptHelper helper = search.scriptHandler(context); List<Object> data = Lists.newArrayList(); for(Search.SearchSelect select : search.getSelects()) { if (selected != null && !selected.contains(select.getModel())) { continue; } LOG.debug("Model : {}", select.getModel()); LOG.debug("Param : {}", context); Query query; try { query = select.toQuery(search, helper); } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e); } List<?> items = Lists.newArrayList(); LOG.debug("Query : {}", select.getQueryString()); if (query != null) { query.setFirstResult(request.getOffset()); query.setMaxResults(search.getLimit()); items = query.getResultList(); } LOG.debug("Found : {}", items.size()); for(Object item : items) { if (item instanceof Map) { ((Map) item).put("_model", select.getModel()); ((Map) item).put("_modelTitle", select.getLocalizedTitle()); ((Map) item).put("_form", select.getFormView()); ((Map) item).put("_grid", select.getGridView()); } } data.addAll(items); } LOG.debug("Total : {}", data.size()); response.setData(data); response.setStatus(Response.STATUS_SUCCESS); return response; } public Response getAttachment(long id, String model, Request request){ Response response = new Response(); List<String> fields = request.getFields(); com.axelor.db.Query<MetaFile> query = JPA.all(MetaFile.class).filter( "self.id IN (SELECT a.metaFile FROM MetaAttachment a WHERE a.objectName = :model AND a.objectId = :id)"); query.bind("model", model); query.bind("id", id); Object data = query.select(fields.toArray(new String[]{})).fetch(-1, -1); response.setData(data); response.setStatus(Response.STATUS_SUCCESS); return response; } @Transactional public Response removeAttachment(Request request, String uploadPath) { Response response = new Response(); List<Object> result = Lists.newArrayList(); List<Object> records = request.getRecords(); if (records == null || records.isEmpty()) { response.setException(new IllegalArgumentException("No records provides.")); return response; } for(Object record : records) { @SuppressWarnings("all") Long fileId = Long.valueOf(((Map) record).get("id").toString()); if (fileId != null) { MetaFile obj = files.find(fileId); if (uploadPath != null) { File file = FileUtils.getFile(uploadPath, obj.getFilePath()); if (file.exists() && !file.delete()) { continue; } } attachments.all().filter("self.metaFile.id = ?1", fileId).delete(); files.remove(obj); result.add(record); } } response.setData(result); response.setStatus(Response.STATUS_SUCCESS); return response; } @Transactional public Response addAttachment(long id, Request request) { Response response = new Response(); Map<String, Object> data = request.getData(); Map<String, Object> map = Maps.newHashMap(); Model fileBean = (Model) JPA.find(MetaFile.class, Long.valueOf(data.get("id").toString())); map.put("metaFile", fileBean); map.put("objectId", id); map.put("objectName", request.getModel()); Object attBean = Mapper.toBean(MetaAttachment.class, map); JPA.manage( (Model) attBean); response.setData(attBean); response.setStatus(Response.STATUS_SUCCESS); return response; } public Response getChart(final String name, final Request request) { final Response response = new Response(); final MetaView view = views.findByName(name); if (view == null) { return response; } ChartView chart = (ChartView) XMLViews.findView(null, name, "chart"); if (chart == null) { return response; } final Map<String, Object> data = Maps.newHashMap(); response.setData(data); response.setStatus(Response.STATUS_SUCCESS); boolean hasOnInit = !StringUtils.isBlank(chart.getOnInit()); boolean hasDataSet = request.getFields() != null && request.getFields().contains("dataset"); if (hasDataSet || !hasOnInit) { final String string = chart.getDataset().getText(); final Map<String, Object> context = Maps.newHashMap(); if (request.getData() != null) { context.putAll(request.getData()); } if (AuthUtils.getUser() != null) { context.put("__user__", AuthUtils.getUser()); context.put("__userId__", AuthUtils.getUser().getId()); context.put("__userCode__", AuthUtils.getSubject()); } if ("rpc".equals(chart.getDataset().getType())) { ActionHandler handler = Beans.get(ActionHandler.class); ActionRequest req = new ActionRequest(); ActionResponse res = new ActionResponse(); req.setModel(request.getModel()); req.setData(request.getData()); req.setAction(string); if (req.getModel() == null) { req.setModel(ScriptBindings.class.getName()); } handler = handler.forRequest(req); res = handler.execute(); data.put("dataset", res.getData()); } else { Query query = "sql".equals(chart.getDataset().getType()) ? JPA.em().createNativeQuery(string) : JPA.em().createQuery(string); // return result as list of map ((org.hibernate.ejb.QueryImpl<?>) query).getHibernateQuery() .setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); if (request.getData() != null) { QueryBinder.of(query).bind(context); } data.put("dataset", query.getResultList()); } } if (hasDataSet) { return response; } data.put("title", chart.getLocalizedTitle()); data.put("stacked", chart.getStacked()); data.put("xAxis", chart.getCategory().getKey()); data.put("xType", chart.getCategory().getType()); data.put("xTitle", chart.getCategory().getLocalizedTitle()); List<Object> series = Lists.newArrayList(); Map<String, Object> config = Maps.newHashMap(); for(ChartSeries cs : chart.getSeries()) { Map<String, Object> map = Maps.newHashMap(); map.put("key", cs.getKey()); map.put("type", cs.getType()); map.put("groupBy", cs.getGroupBy()); map.put("aggregate", cs.getAggregate()); map.put("title", cs.getLocalizedTitle()); series.add(map); } if (chart.getConfig() != null) { for(ChartConfig c : chart.getConfig()) { config.put(c.getName(), c.getValue()); } } data.put("series", series); data.put("config", config); data.put("search", chart.getSearchFields()); data.put("onInit", chart.getOnInit()); return response; } }
[ "zuloloxi@github.org.com" ]
zuloloxi@github.org.com
628d17240331634afdb2ded64ba7263e91140bfd
6504352f86c2e4f7ef16cea3f5b7cc00bba96a33
/XFAWealth/WebService/XFAWealthWebService/src/com/fsll/common/web/DataSourceHolder.java
a179d4a72caf945e7d77d0327311f882339d1277
[]
no_license
jedyang/XFAWealth
1a20c7b4d16c72883b27c4d8aa72d67df4291b9a
029d45620b3375a86fec8bb1161492325f9f2c6c
refs/heads/master
2021-05-07T04:53:24.628018
2017-08-03T15:25:59
2017-08-03T15:25:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
/* * Copyright (c) 2016-2019 by fsll * All rights reserved. */ package com.fsll.common.web; /** * 数据源操作 * * @author 黄模建 E-mail:mjhuang@fsll.cn * @version 1.0.0 Created On: 2016-8-26 */ public class DataSourceHolder { //线程本地环境 private static ThreadLocal<String> contextHolder = new ThreadLocal<String>(); public static final String DB_TYPE_W = "wDataSource"; public static final String DB_TYPE_R = "rDataSource"; // 设置数据源 public static void setDataSource(String dbKey) { clearDataSource(); contextHolder.set(dbKey); } // 获取数据源 public static String getDataSource() { String db = contextHolder.get(); if (db == null) { db = DB_TYPE_W;//默认是写库 } return db; } // 清除数据源 public static void clearDataSource() { contextHolder.remove(); } }
[ "549592047@qq.com" ]
549592047@qq.com
09d1cf6118b11a46925543fd0291ff644455a656
82faeb6c90f4d97a8c422e4f517ebd2c330bd646
/webapi/src/test/java/com/mealtracker/utils/matchers/CommonMatchers.java
4a220eb732ca7e7f0bc23524e7f6acfcaf079277
[]
no_license
tmhung88/mealtracker
67fae6e6f0e58061ebf8aad99746f1de45b3d8fe
df511f58538d158e2a5eff320a3da4e72611c0b8
refs/heads/master
2021-06-20T09:20:57.385521
2021-05-04T09:13:32
2021-05-04T09:13:32
209,909,516
1
0
null
null
null
null
UTF-8
Java
false
false
1,179
java
package com.mealtracker.utils.matchers; import com.mealtracker.security.CurrentUser; import org.mockito.ArgumentMatcher; import java.util.Optional; import static org.mockito.ArgumentMatchers.argThat; public class CommonMatchers { public static OptionalCurrentUser fields() { return new OptionalCurrentUser(); } public static CurrentUser eq(OptionalCurrentUser optionalCurrentUser) { return argThat(new OptionalCurrentUserMatcher(optionalCurrentUser)); } public static class OptionalCurrentUserMatcher implements ArgumentMatcher<CurrentUser> { private final OptionalCurrentUser expectation; OptionalCurrentUserMatcher(OptionalCurrentUser expectation) { this.expectation = expectation; } @Override public boolean matches(CurrentUser actual) { return expectation.id.map(i -> i.equals(actual.getId())).orElse(true); } } public static class OptionalCurrentUser { private Optional<Long> id = Optional.empty(); public OptionalCurrentUser id(Long id) { this.id = Optional.ofNullable(id); return this; } } }
[ "tmhung88@outlook.com" ]
tmhung88@outlook.com
3f85a0737bc919faf41b163058de2b8801dfc3e0
3749312f8e0aeec943af824c2dab17d1a8c9cd71
/app/src/main/java/com/ckmcknight/android/menufi/model/accountvalidation/AccountValidator.java
d5909d47a7734ea5652e325e49b000ebee217e27
[]
no_license
MenuFi/MenuFiAndroidApp
5f228df79021b4a2532ddf2a4f7ef40012b9e17c
af210b48f11d93e3ae4e4f0b45ed383005bc9880
refs/heads/master
2021-05-05T10:33:31.239717
2018-04-23T16:37:55
2018-04-23T16:37:55
118,033,968
0
0
null
null
null
null
UTF-8
Java
false
false
503
java
package com.ckmcknight.android.menufi.model.accountvalidation; import com.android.volley.Response; import org.json.JSONObject; public interface AccountValidator { String JSON_EMAIL_KEY = "email"; String JSON_PASSWORD_KEY = "password"; void login(Response.Listener<JSONObject> listener, Response.ErrorListener errorListener, String email, String password); void register(Response.Listener<JSONObject> listener, Response.ErrorListener errorListener, String email, String password); }
[ "ckmcknight@gmail.com" ]
ckmcknight@gmail.com
86e6341a1c5235953bc290eddac40ab05f6666d3
57295163d985242da389afda32b93ac3ac8fc023
/src/main/java/org/lotzy/sample/multidb/service/HelloWorldService.java
d7a3a04afd647910ce10ce359f5f92f8082298ea
[]
no_license
Lotzy/springboot-multi-db
a5e44968123332608e6b09034127399b8c1abd06
b72d3db7231fe69f2d9b457e38aa5f73a4692182
refs/heads/master
2020-10-01T01:28:47.899760
2019-12-11T17:45:03
2019-12-11T17:45:03
227,421,420
0
0
null
null
null
null
UTF-8
Java
false
false
1,854
java
/* * Copyright 2012-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.lotzy.sample.multidb.service; import java.util.Date; import org.lotzy.sample.multidb.db1.dao.UserRepository; import org.lotzy.sample.multidb.db1.entity.User; import org.lotzy.sample.multidb.db2.dao.VideoRepository; import org.lotzy.sample.multidb.db2.entity.Video; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * <pre> * Title: HelloWorldService class * Description: Service class that will use JPA repositories to do some DB operations * </pre> * * @author Lotzy * @version 1.0 */ @Service public class HelloWorldService { @Autowired private UserRepository userRepo; @Autowired private VideoRepository videoRepo; public String getHelloMessage() { User user = new User(); user.setUserId(1L); user.setName("TestName"); user.setSurname("TestSurname"); user.setCreatedAt(new Date()); user.setUpdatedAt(new Date()); User savedUser = userRepo.save(user); Video video = new Video(); video.setVideoId(1L); video.setBitrate(128); video.setLength(120); video.setTitle("Test"); Video savedVideo = videoRepo.save(video); return "Hello world video " + savedVideo.getTitle() + " from " + savedUser.getName(); } }
[ "dl.laczko@almaviva.it" ]
dl.laczko@almaviva.it
5de4fb487138e0cd7559fe2b13f7c702559b4278
8e8c7d50803f98cca7272bfba210729e95518656
/server/src/com/cloud/vm/UserVmStateListener.java
44fcef7fe3c1ee902e3c5982582d81541babe840
[]
no_license
pigxiang/CloudStack
4479f84b34e9f4cce57513ca05d0e75b7c70dd75
6caa3c853733d4d576f12154103e6ef1c1c78da1
refs/heads/master
2021-01-21T01:12:34.919355
2011-09-01T02:29:32
2011-09-01T02:29:32
2,306,219
1
0
null
null
null
null
UTF-8
Java
false
false
4,075
java
/** * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. * * This software is licensed under the GNU General Public License v3 or later. * * It 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 program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package com.cloud.vm; import java.util.List; import com.cloud.event.EventTypes; import com.cloud.event.UsageEventVO; import com.cloud.event.dao.UsageEventDao; import com.cloud.network.NetworkVO; import com.cloud.network.dao.NetworkDao; import com.cloud.utils.fsm.StateListener; import com.cloud.vm.VirtualMachine.Event; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.dao.NicDao; public class UserVmStateListener implements StateListener<State, VirtualMachine.Event, VirtualMachine> { protected UsageEventDao _usageEventDao; protected NetworkDao _networkDao; protected NicDao _nicDao; public UserVmStateListener(UsageEventDao usageEventDao, NetworkDao networkDao, NicDao nicDao) { this._usageEventDao = usageEventDao; this._networkDao = networkDao; this._nicDao = nicDao; } @Override public boolean preStateTransitionEvent(State oldState, Event event, State newState, VirtualMachine vo, boolean status, Long id) { return true; } @Override public boolean postStateTransitionEvent(State oldState, Event event, State newState, VirtualMachine vo, boolean status, Long id) { if(!status){ return false; } if(vo.getType() != VirtualMachine.Type.User){ return true; } if (VirtualMachine.State.isVmCreated(oldState, event, newState)) { UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_CREATE, vo.getAccountId(), vo.getDataCenterIdToDeployIn(), vo.getId(), vo.getHostName(), vo.getServiceOfferingId(), vo.getTemplateId(), vo.getHypervisorType().toString()); _usageEventDao.persist(usageEvent); } else if (VirtualMachine.State.isVmStarted(oldState, event, newState)) { UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_START, vo.getAccountId(), vo.getDataCenterIdToDeployIn(), vo.getId(), vo.getHostName(), vo.getServiceOfferingId(), vo.getTemplateId(), vo.getHypervisorType().toString()); _usageEventDao.persist(usageEvent); } else if (VirtualMachine.State.isVmStopped(oldState, event, newState)) { UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_STOP, vo.getAccountId(), vo.getDataCenterIdToDeployIn(), vo.getId(), vo.getHostName()); _usageEventDao.persist(usageEvent); List<NicVO> nics = _nicDao.listByVmId(vo.getId()); for (NicVO nic : nics) { NetworkVO network = _networkDao.findById(nic.getNetworkId()); usageEvent = new UsageEventVO(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vo.getAccountId(), vo.getDataCenterIdToDeployIn(), vo.getId(), null, network.getNetworkOfferingId(), null, 0L); _usageEventDao.persist(usageEvent); } } else if (VirtualMachine.State.isVmDestroyed(oldState, event, newState)) { UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_DESTROY, vo.getAccountId(), vo.getDataCenterIdToDeployIn(), vo.getId(), vo.getHostName(), vo.getServiceOfferingId(), vo.getTemplateId(), vo.getHypervisorType().toString()); _usageEventDao.persist(usageEvent); } return true; } }
[ "kishan@cloud.com" ]
kishan@cloud.com
c534696055721dd791a8e72ef25fdcf614790826
d8b0d50f3cadaafd8c2acd3002274291f6cdeb0a
/src/kr/co/atis/uiutil/ButtonTabComponent.java
f7e6a7ba107389d7833d59e3dcebf8f0648d8cdd
[]
no_license
okskblug/sols
1623edd7b0f8dcd969004ddca47ee7bf0299ddb0
7152b647dd95ef2c1ce8e0074593b0e68644e075
refs/heads/master
2020-09-21T11:19:32.351625
2020-08-11T22:53:22
2020-08-11T22:53:22
224,772,790
0
0
null
null
null
null
UTF-8
Java
false
false
5,625
java
package kr.co.atis.uiutil; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Map; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.plaf.basic.BasicButtonUI; import kr.co.atis.main.BusinessViewMain; import kr.co.atis.util.SchemaConstants; import matrix.util.StringList; /** * Component to be used as tabComponent; * Contains a JLabel to show the text and * a JButton to close the tab it belongs to */ public class ButtonTabComponent extends JPanel { private final JTabbedPane pane; private final String type; private final Map<String, StringList> mTitleMap; public ButtonTabComponent(final JTabbedPane pane, String sType, boolean isViewButton, Map mTitleMap) { //unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (pane == null) { throw new NullPointerException("TabbedPane is null"); } this.pane = pane; this.type = sType; this.mTitleMap = mTitleMap; setOpaque(false); //make JLabel read titles from JTabbedPane JLabel label = new JLabel() { public String getText() { int i = pane.indexOfTabComponent(ButtonTabComponent.this); if (i != -1) { return pane.getTitleAt(i); } return null; } }; if(!BusinessViewMain.slMQLTypeList.contains(sType)) { label.setIcon(BusinessViewMain.icons.get(SchemaConstants.OBJECT)); } else { label.setIcon(BusinessViewMain.icons.get(sType)); } add(label); //add more space between the label and the button label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); if(isViewButton) { //tab button JButton button = new TabButton(); add(button); } //add more space to the top of the component setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); } public String getType() { return type; } private class TabButton extends JButton implements ActionListener { public TabButton() { int size = 17; setPreferredSize(new Dimension(size, size)); setToolTipText("close this tab"); //Make the button looks the same for all Laf's setUI(new BasicButtonUI()); //Make it transparent setContentAreaFilled(false); //No need to be focusable setFocusable(false); // setBorder(BorderFactory.createEtchedBorder()); // setBorderPainted(false); //Making nice rollover effect //we use the same listener for all buttons addMouseListener(buttonMouseListener); setRolloverEnabled(true); //Close the proper tab by clicking the button addActionListener(this); setBorder(null); } public void actionPerformed(ActionEvent e) { int i = pane.indexOfTabComponent(ButtonTabComponent.this); if (i != -1) { ButtonTabComponent btc = (ButtonTabComponent) pane.getTabComponentAt(pane.getSelectedIndex()); String sName = pane.getTitleAt(pane.getSelectedIndex()); String sType = btc.getType(); StringList slList = (StringList) mTitleMap.get(sName); if(slList.contains(sType)) { slList.remove(sType); mTitleMap.put(sName, slList); } pane.remove(i); } } //we don't want to update UI for this button public void updateUI() { } //paint the cross protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g.create(); //shift the image for pressed buttons if (getModel().isPressed()) { g2.translate(1, 1); } g2.setStroke(new BasicStroke(3)); g2.setColor(new Color(220, 220, 220)); if (getModel().isRollover()) { g2.setColor(new Color(255, 0, 0, 80)); } int delta = 5; g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1); g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1); g2.dispose(); } } private final static MouseListener buttonMouseListener = new MouseAdapter() { public void mouseEntered(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(false); } } public void mouseExited(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(false); } } }; }
[ "okskblug@google.com" ]
okskblug@google.com
050732d6187006cf2a6278131698aa05a27dbb7e
c738c635c8337f31f53ca1350e751dd76d9e3401
/src/main/java/com/mailslurp/models/InboxForwarderTestResult.java
33b48d28ee70d57a8a0d27b107971bde46e38c0f
[ "MIT" ]
permissive
mailslurp/mailslurp-client-java
e1f8fa9e3d91092825dfc6566a577d1be3dd5c8b
5fff8afabd783c94c7e99c4ce8fcb8cb8058982c
refs/heads/master
2023-06-24T02:46:29.757016
2023-06-12T23:35:46
2023-06-12T23:35:46
204,670,215
3
2
MIT
2022-05-29T01:44:33
2019-08-27T09:38:50
Java
UTF-8
Java
false
false
8,533
java
/* * MailSlurp API * MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository * * The version of the OpenAPI document: 6.5.2 * Contact: contact@mailslurp.dev * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package com.mailslurp.models; import java.util.Objects; import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.HashMap; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import com.mailslurp.clients.JSON; /** * Results of inbox forwarder test */ @ApiModel(description = "Results of inbox forwarder test") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-06-12T23:33:57.654989Z[Etc/UTC]") public class InboxForwarderTestResult { public static final String SERIALIZED_NAME_MATCHES = "matches"; @SerializedName(SERIALIZED_NAME_MATCHES) private Map<String, Boolean> matches = new HashMap<>(); public static final String SERIALIZED_NAME_DOES_MATCH = "doesMatch"; @SerializedName(SERIALIZED_NAME_DOES_MATCH) private Boolean doesMatch; public InboxForwarderTestResult() { } public InboxForwarderTestResult matches(Map<String, Boolean> matches) { this.matches = matches; return this; } public InboxForwarderTestResult putMatchesItem(String key, Boolean matchesItem) { this.matches.put(key, matchesItem); return this; } /** * Get matches * @return matches **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") public Map<String, Boolean> getMatches() { return matches; } public void setMatches(Map<String, Boolean> matches) { this.matches = matches; } public InboxForwarderTestResult doesMatch(Boolean doesMatch) { this.doesMatch = doesMatch; return this; } /** * Get doesMatch * @return doesMatch **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") public Boolean getDoesMatch() { return doesMatch; } public void setDoesMatch(Boolean doesMatch) { this.doesMatch = doesMatch; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InboxForwarderTestResult inboxForwarderTestResult = (InboxForwarderTestResult) o; return Objects.equals(this.matches, inboxForwarderTestResult.matches) && Objects.equals(this.doesMatch, inboxForwarderTestResult.doesMatch); } @Override public int hashCode() { return Objects.hash(matches, doesMatch); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InboxForwarderTestResult {\n"); sb.append(" matches: ").append(toIndentedString(matches)).append("\n"); sb.append(" doesMatch: ").append(toIndentedString(doesMatch)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } public static HashSet<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(); openapiFields.add("matches"); openapiFields.add("doesMatch"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(); openapiRequiredFields.add("matches"); openapiRequiredFields.add("doesMatch"); } /** * Validates the JSON Object and throws an exception if issues found * * @param jsonObj JSON Object * @throws IOException if the JSON Object is invalid with respect to InboxForwarderTestResult */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { if (!InboxForwarderTestResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in InboxForwarderTestResult is not found in the empty JSON string", InboxForwarderTestResult.openapiRequiredFields.toString())); } } Set<Entry<String, JsonElement>> entries = jsonObj.entrySet(); // check to see if the JSON string contains additional fields for (Entry<String, JsonElement> entry : entries) { if (!InboxForwarderTestResult.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InboxForwarderTestResult` properties. JSON: %s", entry.getKey(), jsonObj.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : InboxForwarderTestResult.openapiRequiredFields) { if (jsonObj.get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!InboxForwarderTestResult.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'InboxForwarderTestResult' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<InboxForwarderTestResult> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(InboxForwarderTestResult.class)); return (TypeAdapter<T>) new TypeAdapter<InboxForwarderTestResult>() { @Override public void write(JsonWriter out, InboxForwarderTestResult value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public InboxForwarderTestResult read(JsonReader in) throws IOException { JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); validateJsonObject(jsonObj); return thisAdapter.fromJsonTree(jsonObj); } }.nullSafe(); } } /** * Create an instance of InboxForwarderTestResult given an JSON string * * @param jsonString JSON string * @return An instance of InboxForwarderTestResult * @throws IOException if the JSON string is invalid with respect to InboxForwarderTestResult */ public static InboxForwarderTestResult fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, InboxForwarderTestResult.class); } /** * Convert an instance of InboxForwarderTestResult to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
[ "contact@mailslurp.dev" ]
contact@mailslurp.dev
2f8c8c5b5d15df5a3e092510826e45fe4990458e
6f030a1c9ed29e53c48d5082d93093f37edbcbea
/src/test/java/com/moneyroomba/web/rest/TransactionResourceIT.java
8d4bce3397d2a256d3ebabcb10ddc8e777376e77
[]
no_license
Jukebox-Projects/Money-Roomba
4733de788e4dfa3ab91e49fc257a6497a3d5d8a6
0b1fa3be9cc1268dd9cc66e7b6f209601f512b0c
refs/heads/main
2023-07-12T10:43:54.547416
2021-08-19T01:45:34
2021-08-19T01:45:34
382,984,869
0
0
null
null
null
null
UTF-8
Java
false
false
70,053
java
package com.moneyroomba.web.rest; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import com.moneyroomba.IntegrationTest; import com.moneyroomba.domain.Attachment; import com.moneyroomba.domain.Category; import com.moneyroomba.domain.Currency; import com.moneyroomba.domain.Transaction; import com.moneyroomba.domain.UserDetails; import com.moneyroomba.domain.Wallet; import com.moneyroomba.domain.enumeration.MovementType; import com.moneyroomba.domain.enumeration.TransactionType; import com.moneyroomba.repository.TransactionRepository; import com.moneyroomba.service.criteria.TransactionCriteria; import java.time.LocalDate; import java.time.ZoneId; import java.util.List; import java.util.Random; import java.util.concurrent.atomic.AtomicLong; import javax.persistence.EntityManager; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.servlet.MockMvc; import org.springframework.transaction.annotation.Transactional; /** * Integration tests for the {@link TransactionResource} REST controller. */ @IntegrationTest @AutoConfigureMockMvc @WithMockUser class TransactionResourceIT { private static final String DEFAULT_NAME = "AAAAAAAAAA"; private static final String UPDATED_NAME = "BBBBBBBBBB"; private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA"; private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB"; private static final LocalDate DEFAULT_DATE_ADDED = LocalDate.ofEpochDay(0L); private static final LocalDate UPDATED_DATE_ADDED = LocalDate.now(ZoneId.systemDefault()); private static final LocalDate SMALLER_DATE_ADDED = LocalDate.ofEpochDay(-1L); private static final Double DEFAULT_AMOUNT = 0D; private static final Double UPDATED_AMOUNT = 1D; private static final Double SMALLER_AMOUNT = 0D - 1D; private static final Double DEFAULT_ORIGINAL_AMOUNT = 0D; private static final Double UPDATED_ORIGINAL_AMOUNT = 1D; private static final Double SMALLER_ORIGINAL_AMOUNT = 0D - 1D; private static final MovementType DEFAULT_MOVEMENT_TYPE = MovementType.INCOME; private static final MovementType UPDATED_MOVEMENT_TYPE = MovementType.EXPENSE; private static final Boolean DEFAULT_SCHEDULED = false; private static final Boolean UPDATED_SCHEDULED = true; private static final Boolean DEFAULT_ADD_TO_REPORTS = false; private static final Boolean UPDATED_ADD_TO_REPORTS = true; private static final Boolean DEFAULT_INCOMING_TRANSACTION = false; private static final Boolean UPDATED_INCOMING_TRANSACTION = true; private static final TransactionType DEFAULT_TRANSACTION_TYPE = TransactionType.MANUAL; private static final TransactionType UPDATED_TRANSACTION_TYPE = TransactionType.SCHEDULED; private static final String ENTITY_API_URL = "/api/transactions"; private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; private static Random random = new Random(); private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); @Autowired private TransactionRepository transactionRepository; @Autowired private EntityManager em; @Autowired private MockMvc restTransactionMockMvc; private Transaction transaction; /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Transaction createEntity(EntityManager em) { Transaction transaction = new Transaction() .name(DEFAULT_NAME) .description(DEFAULT_DESCRIPTION) .dateAdded(DEFAULT_DATE_ADDED) .amount(DEFAULT_AMOUNT) .originalAmount(DEFAULT_ORIGINAL_AMOUNT) .movementType(DEFAULT_MOVEMENT_TYPE) .scheduled(DEFAULT_SCHEDULED) .addToReports(DEFAULT_ADD_TO_REPORTS) .incomingTransaction(DEFAULT_INCOMING_TRANSACTION) .transactionType(DEFAULT_TRANSACTION_TYPE); // Add required entity Wallet wallet; if (TestUtil.findAll(em, Wallet.class).isEmpty()) { wallet = WalletResourceIT.createEntity(em); em.persist(wallet); em.flush(); } else { wallet = TestUtil.findAll(em, Wallet.class).get(0); } transaction.setWallet(wallet); return transaction; } /** * Create an updated entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Transaction createUpdatedEntity(EntityManager em) { Transaction transaction = new Transaction() .name(UPDATED_NAME) .description(UPDATED_DESCRIPTION) .dateAdded(UPDATED_DATE_ADDED) .amount(UPDATED_AMOUNT) .originalAmount(UPDATED_ORIGINAL_AMOUNT) .movementType(UPDATED_MOVEMENT_TYPE) .scheduled(UPDATED_SCHEDULED) .addToReports(UPDATED_ADD_TO_REPORTS) .incomingTransaction(UPDATED_INCOMING_TRANSACTION) .transactionType(UPDATED_TRANSACTION_TYPE); // Add required entity Wallet wallet; if (TestUtil.findAll(em, Wallet.class).isEmpty()) { wallet = WalletResourceIT.createUpdatedEntity(em); em.persist(wallet); em.flush(); } else { wallet = TestUtil.findAll(em, Wallet.class).get(0); } transaction.setWallet(wallet); return transaction; } @BeforeEach public void initTest() { transaction = createEntity(em); } @Test @Transactional void createTransaction() throws Exception { int databaseSizeBeforeCreate = transactionRepository.findAll().size(); // Create the Transaction restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isCreated()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeCreate + 1); Transaction testTransaction = transactionList.get(transactionList.size() - 1); assertThat(testTransaction.getName()).isEqualTo(DEFAULT_NAME); assertThat(testTransaction.getDescription()).isEqualTo(DEFAULT_DESCRIPTION); assertThat(testTransaction.getDateAdded()).isEqualTo(DEFAULT_DATE_ADDED); assertThat(testTransaction.getAmount()).isEqualTo(DEFAULT_AMOUNT); assertThat(testTransaction.getOriginalAmount()).isEqualTo(DEFAULT_ORIGINAL_AMOUNT); assertThat(testTransaction.getMovementType()).isEqualTo(DEFAULT_MOVEMENT_TYPE); assertThat(testTransaction.getScheduled()).isEqualTo(DEFAULT_SCHEDULED); assertThat(testTransaction.getAddToReports()).isEqualTo(DEFAULT_ADD_TO_REPORTS); assertThat(testTransaction.getIncomingTransaction()).isEqualTo(DEFAULT_INCOMING_TRANSACTION); assertThat(testTransaction.getTransactionType()).isEqualTo(DEFAULT_TRANSACTION_TYPE); } @Test @Transactional void createTransactionWithExistingId() throws Exception { // Create the Transaction with an existing ID transaction.setId(1L); int databaseSizeBeforeCreate = transactionRepository.findAll().size(); // An entity with an existing ID cannot be created, so this API call must fail restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional void checkNameIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setName(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void checkDateAddedIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setDateAdded(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void checkOriginalAmountIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setOriginalAmount(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void checkMovementTypeIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setMovementType(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void checkScheduledIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setScheduled(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void checkAddToReportsIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setAddToReports(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void checkIncomingTransactionIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setIncomingTransaction(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void checkTransactionTypeIsRequired() throws Exception { int databaseSizeBeforeTest = transactionRepository.findAll().size(); // set the field null transaction.setTransactionType(null); // Create the Transaction, which fails. restTransactionMockMvc .perform( post(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeTest); } @Test @Transactional void getAllTransactions() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList restTransactionMockMvc .perform(get(ENTITY_API_URL + "?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(transaction.getId().intValue()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME))) .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION))) .andExpect(jsonPath("$.[*].dateAdded").value(hasItem(DEFAULT_DATE_ADDED.toString()))) .andExpect(jsonPath("$.[*].amount").value(hasItem(DEFAULT_AMOUNT.doubleValue()))) .andExpect(jsonPath("$.[*].originalAmount").value(hasItem(DEFAULT_ORIGINAL_AMOUNT.doubleValue()))) .andExpect(jsonPath("$.[*].movementType").value(hasItem(DEFAULT_MOVEMENT_TYPE.toString()))) .andExpect(jsonPath("$.[*].scheduled").value(hasItem(DEFAULT_SCHEDULED.booleanValue()))) .andExpect(jsonPath("$.[*].addToReports").value(hasItem(DEFAULT_ADD_TO_REPORTS.booleanValue()))) .andExpect(jsonPath("$.[*].incomingTransaction").value(hasItem(DEFAULT_INCOMING_TRANSACTION.booleanValue()))) .andExpect(jsonPath("$.[*].transactionType").value(hasItem(DEFAULT_TRANSACTION_TYPE.toString()))); } @Test @Transactional void getTransaction() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get the transaction restTransactionMockMvc .perform(get(ENTITY_API_URL_ID, transaction.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id").value(transaction.getId().intValue())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME)) .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION)) .andExpect(jsonPath("$.dateAdded").value(DEFAULT_DATE_ADDED.toString())) .andExpect(jsonPath("$.amount").value(DEFAULT_AMOUNT.doubleValue())) .andExpect(jsonPath("$.originalAmount").value(DEFAULT_ORIGINAL_AMOUNT.doubleValue())) .andExpect(jsonPath("$.movementType").value(DEFAULT_MOVEMENT_TYPE.toString())) .andExpect(jsonPath("$.scheduled").value(DEFAULT_SCHEDULED.booleanValue())) .andExpect(jsonPath("$.addToReports").value(DEFAULT_ADD_TO_REPORTS.booleanValue())) .andExpect(jsonPath("$.incomingTransaction").value(DEFAULT_INCOMING_TRANSACTION.booleanValue())) .andExpect(jsonPath("$.transactionType").value(DEFAULT_TRANSACTION_TYPE.toString())); } @Test @Transactional void getTransactionsByIdFiltering() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); Long id = transaction.getId(); defaultTransactionShouldBeFound("id.equals=" + id); defaultTransactionShouldNotBeFound("id.notEquals=" + id); defaultTransactionShouldBeFound("id.greaterThanOrEqual=" + id); defaultTransactionShouldNotBeFound("id.greaterThan=" + id); defaultTransactionShouldBeFound("id.lessThanOrEqual=" + id); defaultTransactionShouldNotBeFound("id.lessThan=" + id); } @Test @Transactional void getAllTransactionsByNameIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where name equals to DEFAULT_NAME defaultTransactionShouldBeFound("name.equals=" + DEFAULT_NAME); // Get all the transactionList where name equals to UPDATED_NAME defaultTransactionShouldNotBeFound("name.equals=" + UPDATED_NAME); } @Test @Transactional void getAllTransactionsByNameIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where name not equals to DEFAULT_NAME defaultTransactionShouldNotBeFound("name.notEquals=" + DEFAULT_NAME); // Get all the transactionList where name not equals to UPDATED_NAME defaultTransactionShouldBeFound("name.notEquals=" + UPDATED_NAME); } @Test @Transactional void getAllTransactionsByNameIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where name in DEFAULT_NAME or UPDATED_NAME defaultTransactionShouldBeFound("name.in=" + DEFAULT_NAME + "," + UPDATED_NAME); // Get all the transactionList where name equals to UPDATED_NAME defaultTransactionShouldNotBeFound("name.in=" + UPDATED_NAME); } @Test @Transactional void getAllTransactionsByNameIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where name is not null defaultTransactionShouldBeFound("name.specified=true"); // Get all the transactionList where name is null defaultTransactionShouldNotBeFound("name.specified=false"); } @Test @Transactional void getAllTransactionsByNameContainsSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where name contains DEFAULT_NAME defaultTransactionShouldBeFound("name.contains=" + DEFAULT_NAME); // Get all the transactionList where name contains UPDATED_NAME defaultTransactionShouldNotBeFound("name.contains=" + UPDATED_NAME); } @Test @Transactional void getAllTransactionsByNameNotContainsSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where name does not contain DEFAULT_NAME defaultTransactionShouldNotBeFound("name.doesNotContain=" + DEFAULT_NAME); // Get all the transactionList where name does not contain UPDATED_NAME defaultTransactionShouldBeFound("name.doesNotContain=" + UPDATED_NAME); } @Test @Transactional void getAllTransactionsByDescriptionIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where description equals to DEFAULT_DESCRIPTION defaultTransactionShouldBeFound("description.equals=" + DEFAULT_DESCRIPTION); // Get all the transactionList where description equals to UPDATED_DESCRIPTION defaultTransactionShouldNotBeFound("description.equals=" + UPDATED_DESCRIPTION); } @Test @Transactional void getAllTransactionsByDescriptionIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where description not equals to DEFAULT_DESCRIPTION defaultTransactionShouldNotBeFound("description.notEquals=" + DEFAULT_DESCRIPTION); // Get all the transactionList where description not equals to UPDATED_DESCRIPTION defaultTransactionShouldBeFound("description.notEquals=" + UPDATED_DESCRIPTION); } @Test @Transactional void getAllTransactionsByDescriptionIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where description in DEFAULT_DESCRIPTION or UPDATED_DESCRIPTION defaultTransactionShouldBeFound("description.in=" + DEFAULT_DESCRIPTION + "," + UPDATED_DESCRIPTION); // Get all the transactionList where description equals to UPDATED_DESCRIPTION defaultTransactionShouldNotBeFound("description.in=" + UPDATED_DESCRIPTION); } @Test @Transactional void getAllTransactionsByDescriptionIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where description is not null defaultTransactionShouldBeFound("description.specified=true"); // Get all the transactionList where description is null defaultTransactionShouldNotBeFound("description.specified=false"); } @Test @Transactional void getAllTransactionsByDescriptionContainsSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where description contains DEFAULT_DESCRIPTION defaultTransactionShouldBeFound("description.contains=" + DEFAULT_DESCRIPTION); // Get all the transactionList where description contains UPDATED_DESCRIPTION defaultTransactionShouldNotBeFound("description.contains=" + UPDATED_DESCRIPTION); } @Test @Transactional void getAllTransactionsByDescriptionNotContainsSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where description does not contain DEFAULT_DESCRIPTION defaultTransactionShouldNotBeFound("description.doesNotContain=" + DEFAULT_DESCRIPTION); // Get all the transactionList where description does not contain UPDATED_DESCRIPTION defaultTransactionShouldBeFound("description.doesNotContain=" + UPDATED_DESCRIPTION); } @Test @Transactional void getAllTransactionsByDateAddedIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded equals to DEFAULT_DATE_ADDED defaultTransactionShouldBeFound("dateAdded.equals=" + DEFAULT_DATE_ADDED); // Get all the transactionList where dateAdded equals to UPDATED_DATE_ADDED defaultTransactionShouldNotBeFound("dateAdded.equals=" + UPDATED_DATE_ADDED); } @Test @Transactional void getAllTransactionsByDateAddedIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded not equals to DEFAULT_DATE_ADDED defaultTransactionShouldNotBeFound("dateAdded.notEquals=" + DEFAULT_DATE_ADDED); // Get all the transactionList where dateAdded not equals to UPDATED_DATE_ADDED defaultTransactionShouldBeFound("dateAdded.notEquals=" + UPDATED_DATE_ADDED); } @Test @Transactional void getAllTransactionsByDateAddedIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded in DEFAULT_DATE_ADDED or UPDATED_DATE_ADDED defaultTransactionShouldBeFound("dateAdded.in=" + DEFAULT_DATE_ADDED + "," + UPDATED_DATE_ADDED); // Get all the transactionList where dateAdded equals to UPDATED_DATE_ADDED defaultTransactionShouldNotBeFound("dateAdded.in=" + UPDATED_DATE_ADDED); } @Test @Transactional void getAllTransactionsByDateAddedIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded is not null defaultTransactionShouldBeFound("dateAdded.specified=true"); // Get all the transactionList where dateAdded is null defaultTransactionShouldNotBeFound("dateAdded.specified=false"); } @Test @Transactional void getAllTransactionsByDateAddedIsGreaterThanOrEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded is greater than or equal to DEFAULT_DATE_ADDED defaultTransactionShouldBeFound("dateAdded.greaterThanOrEqual=" + DEFAULT_DATE_ADDED); // Get all the transactionList where dateAdded is greater than or equal to UPDATED_DATE_ADDED defaultTransactionShouldNotBeFound("dateAdded.greaterThanOrEqual=" + UPDATED_DATE_ADDED); } @Test @Transactional void getAllTransactionsByDateAddedIsLessThanOrEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded is less than or equal to DEFAULT_DATE_ADDED defaultTransactionShouldBeFound("dateAdded.lessThanOrEqual=" + DEFAULT_DATE_ADDED); // Get all the transactionList where dateAdded is less than or equal to SMALLER_DATE_ADDED defaultTransactionShouldNotBeFound("dateAdded.lessThanOrEqual=" + SMALLER_DATE_ADDED); } @Test @Transactional void getAllTransactionsByDateAddedIsLessThanSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded is less than DEFAULT_DATE_ADDED defaultTransactionShouldNotBeFound("dateAdded.lessThan=" + DEFAULT_DATE_ADDED); // Get all the transactionList where dateAdded is less than UPDATED_DATE_ADDED defaultTransactionShouldBeFound("dateAdded.lessThan=" + UPDATED_DATE_ADDED); } @Test @Transactional void getAllTransactionsByDateAddedIsGreaterThanSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where dateAdded is greater than DEFAULT_DATE_ADDED defaultTransactionShouldNotBeFound("dateAdded.greaterThan=" + DEFAULT_DATE_ADDED); // Get all the transactionList where dateAdded is greater than SMALLER_DATE_ADDED defaultTransactionShouldBeFound("dateAdded.greaterThan=" + SMALLER_DATE_ADDED); } @Test @Transactional void getAllTransactionsByAmountIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount equals to DEFAULT_AMOUNT defaultTransactionShouldBeFound("amount.equals=" + DEFAULT_AMOUNT); // Get all the transactionList where amount equals to UPDATED_AMOUNT defaultTransactionShouldNotBeFound("amount.equals=" + UPDATED_AMOUNT); } @Test @Transactional void getAllTransactionsByAmountIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount not equals to DEFAULT_AMOUNT defaultTransactionShouldNotBeFound("amount.notEquals=" + DEFAULT_AMOUNT); // Get all the transactionList where amount not equals to UPDATED_AMOUNT defaultTransactionShouldBeFound("amount.notEquals=" + UPDATED_AMOUNT); } @Test @Transactional void getAllTransactionsByAmountIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount in DEFAULT_AMOUNT or UPDATED_AMOUNT defaultTransactionShouldBeFound("amount.in=" + DEFAULT_AMOUNT + "," + UPDATED_AMOUNT); // Get all the transactionList where amount equals to UPDATED_AMOUNT defaultTransactionShouldNotBeFound("amount.in=" + UPDATED_AMOUNT); } @Test @Transactional void getAllTransactionsByAmountIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount is not null defaultTransactionShouldBeFound("amount.specified=true"); // Get all the transactionList where amount is null defaultTransactionShouldNotBeFound("amount.specified=false"); } @Test @Transactional void getAllTransactionsByAmountIsGreaterThanOrEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount is greater than or equal to DEFAULT_AMOUNT defaultTransactionShouldBeFound("amount.greaterThanOrEqual=" + DEFAULT_AMOUNT); // Get all the transactionList where amount is greater than or equal to UPDATED_AMOUNT defaultTransactionShouldNotBeFound("amount.greaterThanOrEqual=" + UPDATED_AMOUNT); } @Test @Transactional void getAllTransactionsByAmountIsLessThanOrEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount is less than or equal to DEFAULT_AMOUNT defaultTransactionShouldBeFound("amount.lessThanOrEqual=" + DEFAULT_AMOUNT); // Get all the transactionList where amount is less than or equal to SMALLER_AMOUNT defaultTransactionShouldNotBeFound("amount.lessThanOrEqual=" + SMALLER_AMOUNT); } @Test @Transactional void getAllTransactionsByAmountIsLessThanSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount is less than DEFAULT_AMOUNT defaultTransactionShouldNotBeFound("amount.lessThan=" + DEFAULT_AMOUNT); // Get all the transactionList where amount is less than UPDATED_AMOUNT defaultTransactionShouldBeFound("amount.lessThan=" + UPDATED_AMOUNT); } @Test @Transactional void getAllTransactionsByAmountIsGreaterThanSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where amount is greater than DEFAULT_AMOUNT defaultTransactionShouldNotBeFound("amount.greaterThan=" + DEFAULT_AMOUNT); // Get all the transactionList where amount is greater than SMALLER_AMOUNT defaultTransactionShouldBeFound("amount.greaterThan=" + SMALLER_AMOUNT); } @Test @Transactional void getAllTransactionsByOriginalAmountIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount equals to DEFAULT_ORIGINAL_AMOUNT defaultTransactionShouldBeFound("originalAmount.equals=" + DEFAULT_ORIGINAL_AMOUNT); // Get all the transactionList where originalAmount equals to UPDATED_ORIGINAL_AMOUNT defaultTransactionShouldNotBeFound("originalAmount.equals=" + UPDATED_ORIGINAL_AMOUNT); } @Test @Transactional void getAllTransactionsByOriginalAmountIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount not equals to DEFAULT_ORIGINAL_AMOUNT defaultTransactionShouldNotBeFound("originalAmount.notEquals=" + DEFAULT_ORIGINAL_AMOUNT); // Get all the transactionList where originalAmount not equals to UPDATED_ORIGINAL_AMOUNT defaultTransactionShouldBeFound("originalAmount.notEquals=" + UPDATED_ORIGINAL_AMOUNT); } @Test @Transactional void getAllTransactionsByOriginalAmountIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount in DEFAULT_ORIGINAL_AMOUNT or UPDATED_ORIGINAL_AMOUNT defaultTransactionShouldBeFound("originalAmount.in=" + DEFAULT_ORIGINAL_AMOUNT + "," + UPDATED_ORIGINAL_AMOUNT); // Get all the transactionList where originalAmount equals to UPDATED_ORIGINAL_AMOUNT defaultTransactionShouldNotBeFound("originalAmount.in=" + UPDATED_ORIGINAL_AMOUNT); } @Test @Transactional void getAllTransactionsByOriginalAmountIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount is not null defaultTransactionShouldBeFound("originalAmount.specified=true"); // Get all the transactionList where originalAmount is null defaultTransactionShouldNotBeFound("originalAmount.specified=false"); } @Test @Transactional void getAllTransactionsByOriginalAmountIsGreaterThanOrEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount is greater than or equal to DEFAULT_ORIGINAL_AMOUNT defaultTransactionShouldBeFound("originalAmount.greaterThanOrEqual=" + DEFAULT_ORIGINAL_AMOUNT); // Get all the transactionList where originalAmount is greater than or equal to UPDATED_ORIGINAL_AMOUNT defaultTransactionShouldNotBeFound("originalAmount.greaterThanOrEqual=" + UPDATED_ORIGINAL_AMOUNT); } @Test @Transactional void getAllTransactionsByOriginalAmountIsLessThanOrEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount is less than or equal to DEFAULT_ORIGINAL_AMOUNT defaultTransactionShouldBeFound("originalAmount.lessThanOrEqual=" + DEFAULT_ORIGINAL_AMOUNT); // Get all the transactionList where originalAmount is less than or equal to SMALLER_ORIGINAL_AMOUNT defaultTransactionShouldNotBeFound("originalAmount.lessThanOrEqual=" + SMALLER_ORIGINAL_AMOUNT); } @Test @Transactional void getAllTransactionsByOriginalAmountIsLessThanSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount is less than DEFAULT_ORIGINAL_AMOUNT defaultTransactionShouldNotBeFound("originalAmount.lessThan=" + DEFAULT_ORIGINAL_AMOUNT); // Get all the transactionList where originalAmount is less than UPDATED_ORIGINAL_AMOUNT defaultTransactionShouldBeFound("originalAmount.lessThan=" + UPDATED_ORIGINAL_AMOUNT); } @Test @Transactional void getAllTransactionsByOriginalAmountIsGreaterThanSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where originalAmount is greater than DEFAULT_ORIGINAL_AMOUNT defaultTransactionShouldNotBeFound("originalAmount.greaterThan=" + DEFAULT_ORIGINAL_AMOUNT); // Get all the transactionList where originalAmount is greater than SMALLER_ORIGINAL_AMOUNT defaultTransactionShouldBeFound("originalAmount.greaterThan=" + SMALLER_ORIGINAL_AMOUNT); } @Test @Transactional void getAllTransactionsByMovementTypeIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where movementType equals to DEFAULT_MOVEMENT_TYPE defaultTransactionShouldBeFound("movementType.equals=" + DEFAULT_MOVEMENT_TYPE); // Get all the transactionList where movementType equals to UPDATED_MOVEMENT_TYPE defaultTransactionShouldNotBeFound("movementType.equals=" + UPDATED_MOVEMENT_TYPE); } @Test @Transactional void getAllTransactionsByMovementTypeIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where movementType not equals to DEFAULT_MOVEMENT_TYPE defaultTransactionShouldNotBeFound("movementType.notEquals=" + DEFAULT_MOVEMENT_TYPE); // Get all the transactionList where movementType not equals to UPDATED_MOVEMENT_TYPE defaultTransactionShouldBeFound("movementType.notEquals=" + UPDATED_MOVEMENT_TYPE); } @Test @Transactional void getAllTransactionsByMovementTypeIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where movementType in DEFAULT_MOVEMENT_TYPE or UPDATED_MOVEMENT_TYPE defaultTransactionShouldBeFound("movementType.in=" + DEFAULT_MOVEMENT_TYPE + "," + UPDATED_MOVEMENT_TYPE); // Get all the transactionList where movementType equals to UPDATED_MOVEMENT_TYPE defaultTransactionShouldNotBeFound("movementType.in=" + UPDATED_MOVEMENT_TYPE); } @Test @Transactional void getAllTransactionsByMovementTypeIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where movementType is not null defaultTransactionShouldBeFound("movementType.specified=true"); // Get all the transactionList where movementType is null defaultTransactionShouldNotBeFound("movementType.specified=false"); } @Test @Transactional void getAllTransactionsByScheduledIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where scheduled equals to DEFAULT_SCHEDULED defaultTransactionShouldBeFound("scheduled.equals=" + DEFAULT_SCHEDULED); // Get all the transactionList where scheduled equals to UPDATED_SCHEDULED defaultTransactionShouldNotBeFound("scheduled.equals=" + UPDATED_SCHEDULED); } @Test @Transactional void getAllTransactionsByScheduledIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where scheduled not equals to DEFAULT_SCHEDULED defaultTransactionShouldNotBeFound("scheduled.notEquals=" + DEFAULT_SCHEDULED); // Get all the transactionList where scheduled not equals to UPDATED_SCHEDULED defaultTransactionShouldBeFound("scheduled.notEquals=" + UPDATED_SCHEDULED); } @Test @Transactional void getAllTransactionsByScheduledIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where scheduled in DEFAULT_SCHEDULED or UPDATED_SCHEDULED defaultTransactionShouldBeFound("scheduled.in=" + DEFAULT_SCHEDULED + "," + UPDATED_SCHEDULED); // Get all the transactionList where scheduled equals to UPDATED_SCHEDULED defaultTransactionShouldNotBeFound("scheduled.in=" + UPDATED_SCHEDULED); } @Test @Transactional void getAllTransactionsByScheduledIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where scheduled is not null defaultTransactionShouldBeFound("scheduled.specified=true"); // Get all the transactionList where scheduled is null defaultTransactionShouldNotBeFound("scheduled.specified=false"); } @Test @Transactional void getAllTransactionsByAddToReportsIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where addToReports equals to DEFAULT_ADD_TO_REPORTS defaultTransactionShouldBeFound("addToReports.equals=" + DEFAULT_ADD_TO_REPORTS); // Get all the transactionList where addToReports equals to UPDATED_ADD_TO_REPORTS defaultTransactionShouldNotBeFound("addToReports.equals=" + UPDATED_ADD_TO_REPORTS); } @Test @Transactional void getAllTransactionsByAddToReportsIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where addToReports not equals to DEFAULT_ADD_TO_REPORTS defaultTransactionShouldNotBeFound("addToReports.notEquals=" + DEFAULT_ADD_TO_REPORTS); // Get all the transactionList where addToReports not equals to UPDATED_ADD_TO_REPORTS defaultTransactionShouldBeFound("addToReports.notEquals=" + UPDATED_ADD_TO_REPORTS); } @Test @Transactional void getAllTransactionsByAddToReportsIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where addToReports in DEFAULT_ADD_TO_REPORTS or UPDATED_ADD_TO_REPORTS defaultTransactionShouldBeFound("addToReports.in=" + DEFAULT_ADD_TO_REPORTS + "," + UPDATED_ADD_TO_REPORTS); // Get all the transactionList where addToReports equals to UPDATED_ADD_TO_REPORTS defaultTransactionShouldNotBeFound("addToReports.in=" + UPDATED_ADD_TO_REPORTS); } @Test @Transactional void getAllTransactionsByAddToReportsIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where addToReports is not null defaultTransactionShouldBeFound("addToReports.specified=true"); // Get all the transactionList where addToReports is null defaultTransactionShouldNotBeFound("addToReports.specified=false"); } @Test @Transactional void getAllTransactionsByIncomingTransactionIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where incomingTransaction equals to DEFAULT_INCOMING_TRANSACTION defaultTransactionShouldBeFound("incomingTransaction.equals=" + DEFAULT_INCOMING_TRANSACTION); // Get all the transactionList where incomingTransaction equals to UPDATED_INCOMING_TRANSACTION defaultTransactionShouldNotBeFound("incomingTransaction.equals=" + UPDATED_INCOMING_TRANSACTION); } @Test @Transactional void getAllTransactionsByIncomingTransactionIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where incomingTransaction not equals to DEFAULT_INCOMING_TRANSACTION defaultTransactionShouldNotBeFound("incomingTransaction.notEquals=" + DEFAULT_INCOMING_TRANSACTION); // Get all the transactionList where incomingTransaction not equals to UPDATED_INCOMING_TRANSACTION defaultTransactionShouldBeFound("incomingTransaction.notEquals=" + UPDATED_INCOMING_TRANSACTION); } @Test @Transactional void getAllTransactionsByIncomingTransactionIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where incomingTransaction in DEFAULT_INCOMING_TRANSACTION or UPDATED_INCOMING_TRANSACTION defaultTransactionShouldBeFound("incomingTransaction.in=" + DEFAULT_INCOMING_TRANSACTION + "," + UPDATED_INCOMING_TRANSACTION); // Get all the transactionList where incomingTransaction equals to UPDATED_INCOMING_TRANSACTION defaultTransactionShouldNotBeFound("incomingTransaction.in=" + UPDATED_INCOMING_TRANSACTION); } @Test @Transactional void getAllTransactionsByIncomingTransactionIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where incomingTransaction is not null defaultTransactionShouldBeFound("incomingTransaction.specified=true"); // Get all the transactionList where incomingTransaction is null defaultTransactionShouldNotBeFound("incomingTransaction.specified=false"); } @Test @Transactional void getAllTransactionsByTransactionTypeIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where transactionType equals to DEFAULT_TRANSACTION_TYPE defaultTransactionShouldBeFound("transactionType.equals=" + DEFAULT_TRANSACTION_TYPE); // Get all the transactionList where transactionType equals to UPDATED_TRANSACTION_TYPE defaultTransactionShouldNotBeFound("transactionType.equals=" + UPDATED_TRANSACTION_TYPE); } @Test @Transactional void getAllTransactionsByTransactionTypeIsNotEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where transactionType not equals to DEFAULT_TRANSACTION_TYPE defaultTransactionShouldNotBeFound("transactionType.notEquals=" + DEFAULT_TRANSACTION_TYPE); // Get all the transactionList where transactionType not equals to UPDATED_TRANSACTION_TYPE defaultTransactionShouldBeFound("transactionType.notEquals=" + UPDATED_TRANSACTION_TYPE); } @Test @Transactional void getAllTransactionsByTransactionTypeIsInShouldWork() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where transactionType in DEFAULT_TRANSACTION_TYPE or UPDATED_TRANSACTION_TYPE defaultTransactionShouldBeFound("transactionType.in=" + DEFAULT_TRANSACTION_TYPE + "," + UPDATED_TRANSACTION_TYPE); // Get all the transactionList where transactionType equals to UPDATED_TRANSACTION_TYPE defaultTransactionShouldNotBeFound("transactionType.in=" + UPDATED_TRANSACTION_TYPE); } @Test @Transactional void getAllTransactionsByTransactionTypeIsNullOrNotNull() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); // Get all the transactionList where transactionType is not null defaultTransactionShouldBeFound("transactionType.specified=true"); // Get all the transactionList where transactionType is null defaultTransactionShouldNotBeFound("transactionType.specified=false"); } @Test @Transactional void getAllTransactionsByAttachmentIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); Attachment attachment = AttachmentResourceIT.createEntity(em); em.persist(attachment); em.flush(); transaction.setAttachment(attachment); transactionRepository.saveAndFlush(transaction); Long attachmentId = attachment.getId(); // Get all the transactionList where attachment equals to attachmentId defaultTransactionShouldBeFound("attachmentId.equals=" + attachmentId); // Get all the transactionList where attachment equals to (attachmentId + 1) defaultTransactionShouldNotBeFound("attachmentId.equals=" + (attachmentId + 1)); } @Test @Transactional void getAllTransactionsByWalletIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); Wallet wallet = WalletResourceIT.createEntity(em); em.persist(wallet); em.flush(); transaction.setWallet(wallet); transactionRepository.saveAndFlush(transaction); Long walletId = wallet.getId(); // Get all the transactionList where wallet equals to walletId defaultTransactionShouldBeFound("walletId.equals=" + walletId); // Get all the transactionList where wallet equals to (walletId + 1) defaultTransactionShouldNotBeFound("walletId.equals=" + (walletId + 1)); } @Test @Transactional void getAllTransactionsByCurrencyIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); Currency currency = CurrencyResourceIT.createEntity(em); em.persist(currency); em.flush(); transaction.setCurrency(currency); transactionRepository.saveAndFlush(transaction); Long currencyId = currency.getId(); // Get all the transactionList where currency equals to currencyId defaultTransactionShouldBeFound("currencyId.equals=" + currencyId); // Get all the transactionList where currency equals to (currencyId + 1) defaultTransactionShouldNotBeFound("currencyId.equals=" + (currencyId + 1)); } @Test @Transactional void getAllTransactionsByCategoryIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); Category category = CategoryResourceIT.createEntity(em); em.persist(category); em.flush(); transaction.setCategory(category); transactionRepository.saveAndFlush(transaction); Long categoryId = category.getId(); // Get all the transactionList where category equals to categoryId defaultTransactionShouldBeFound("categoryId.equals=" + categoryId); // Get all the transactionList where category equals to (categoryId + 1) defaultTransactionShouldNotBeFound("categoryId.equals=" + (categoryId + 1)); } @Test @Transactional void getAllTransactionsBySourceUserIsEqualToSomething() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); UserDetails sourceUser = UserDetailsResourceIT.createEntity(em); em.persist(sourceUser); em.flush(); transaction.setSourceUser(sourceUser); transactionRepository.saveAndFlush(transaction); Long sourceUserId = sourceUser.getId(); // Get all the transactionList where sourceUser equals to sourceUserId defaultTransactionShouldBeFound("sourceUserId.equals=" + sourceUserId); // Get all the transactionList where sourceUser equals to (sourceUserId + 1) defaultTransactionShouldNotBeFound("sourceUserId.equals=" + (sourceUserId + 1)); } /** * Executes the search, and checks that the default entity is returned. */ private void defaultTransactionShouldBeFound(String filter) throws Exception { restTransactionMockMvc .perform(get(ENTITY_API_URL + "?sort=id,desc&" + filter)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(transaction.getId().intValue()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME))) .andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION))) .andExpect(jsonPath("$.[*].dateAdded").value(hasItem(DEFAULT_DATE_ADDED.toString()))) .andExpect(jsonPath("$.[*].amount").value(hasItem(DEFAULT_AMOUNT.doubleValue()))) .andExpect(jsonPath("$.[*].originalAmount").value(hasItem(DEFAULT_ORIGINAL_AMOUNT.doubleValue()))) .andExpect(jsonPath("$.[*].movementType").value(hasItem(DEFAULT_MOVEMENT_TYPE.toString()))) .andExpect(jsonPath("$.[*].scheduled").value(hasItem(DEFAULT_SCHEDULED.booleanValue()))) .andExpect(jsonPath("$.[*].addToReports").value(hasItem(DEFAULT_ADD_TO_REPORTS.booleanValue()))) .andExpect(jsonPath("$.[*].incomingTransaction").value(hasItem(DEFAULT_INCOMING_TRANSACTION.booleanValue()))) .andExpect(jsonPath("$.[*].transactionType").value(hasItem(DEFAULT_TRANSACTION_TYPE.toString()))); // Check, that the count call also returns 1 restTransactionMockMvc .perform(get(ENTITY_API_URL + "/count?sort=id,desc&" + filter)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(content().string("1")); } /** * Executes the search, and checks that the default entity is not returned. */ private void defaultTransactionShouldNotBeFound(String filter) throws Exception { restTransactionMockMvc .perform(get(ENTITY_API_URL + "?sort=id,desc&" + filter)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$").isArray()) .andExpect(jsonPath("$").isEmpty()); // Check, that the count call also returns 0 restTransactionMockMvc .perform(get(ENTITY_API_URL + "/count?sort=id,desc&" + filter)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(content().string("0")); } @Test @Transactional void getNonExistingTransaction() throws Exception { // Get the transaction restTransactionMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); } @Test @Transactional void putNewTransaction() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); // Update the transaction Transaction updatedTransaction = transactionRepository.findById(transaction.getId()).get(); // Disconnect from session so that the updates on updatedTransaction are not directly saved in db em.detach(updatedTransaction); updatedTransaction .name(UPDATED_NAME) .description(UPDATED_DESCRIPTION) .dateAdded(UPDATED_DATE_ADDED) .amount(UPDATED_AMOUNT) .originalAmount(UPDATED_ORIGINAL_AMOUNT) .movementType(UPDATED_MOVEMENT_TYPE) .scheduled(UPDATED_SCHEDULED) .addToReports(UPDATED_ADD_TO_REPORTS) .incomingTransaction(UPDATED_INCOMING_TRANSACTION) .transactionType(UPDATED_TRANSACTION_TYPE); restTransactionMockMvc .perform( put(ENTITY_API_URL_ID, updatedTransaction.getId()) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(updatedTransaction)) ) .andExpect(status().isOk()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); Transaction testTransaction = transactionList.get(transactionList.size() - 1); assertThat(testTransaction.getName()).isEqualTo(UPDATED_NAME); assertThat(testTransaction.getDescription()).isEqualTo(UPDATED_DESCRIPTION); assertThat(testTransaction.getDateAdded()).isEqualTo(UPDATED_DATE_ADDED); assertThat(testTransaction.getAmount()).isEqualTo(UPDATED_AMOUNT); assertThat(testTransaction.getOriginalAmount()).isEqualTo(UPDATED_ORIGINAL_AMOUNT); assertThat(testTransaction.getMovementType()).isEqualTo(UPDATED_MOVEMENT_TYPE); assertThat(testTransaction.getScheduled()).isEqualTo(UPDATED_SCHEDULED); assertThat(testTransaction.getAddToReports()).isEqualTo(UPDATED_ADD_TO_REPORTS); assertThat(testTransaction.getIncomingTransaction()).isEqualTo(UPDATED_INCOMING_TRANSACTION); assertThat(testTransaction.getTransactionType()).isEqualTo(UPDATED_TRANSACTION_TYPE); } @Test @Transactional void putNonExistingTransaction() throws Exception { int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); transaction.setId(count.incrementAndGet()); // If the entity doesn't have an ID, it will throw BadRequestAlertException restTransactionMockMvc .perform( put(ENTITY_API_URL_ID, transaction.getId()) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional void putWithIdMismatchTransaction() throws Exception { int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); transaction.setId(count.incrementAndGet()); // If url ID doesn't match entity ID, it will throw BadRequestAlertException restTransactionMockMvc .perform( put(ENTITY_API_URL_ID, count.incrementAndGet()) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional void putWithMissingIdPathParamTransaction() throws Exception { int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); transaction.setId(count.incrementAndGet()); // If url ID doesn't match entity ID, it will throw BadRequestAlertException restTransactionMockMvc .perform( put(ENTITY_API_URL) .with(csrf()) .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isMethodNotAllowed()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional void partialUpdateTransactionWithPatch() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); // Update the transaction using partial update Transaction partialUpdatedTransaction = new Transaction(); partialUpdatedTransaction.setId(transaction.getId()); partialUpdatedTransaction .description(UPDATED_DESCRIPTION) .incomingTransaction(UPDATED_INCOMING_TRANSACTION) .transactionType(UPDATED_TRANSACTION_TYPE); restTransactionMockMvc .perform( patch(ENTITY_API_URL_ID, partialUpdatedTransaction.getId()) .with(csrf()) .contentType("application/merge-patch+json") .content(TestUtil.convertObjectToJsonBytes(partialUpdatedTransaction)) ) .andExpect(status().isOk()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); Transaction testTransaction = transactionList.get(transactionList.size() - 1); assertThat(testTransaction.getName()).isEqualTo(DEFAULT_NAME); assertThat(testTransaction.getDescription()).isEqualTo(UPDATED_DESCRIPTION); assertThat(testTransaction.getDateAdded()).isEqualTo(DEFAULT_DATE_ADDED); assertThat(testTransaction.getAmount()).isEqualTo(DEFAULT_AMOUNT); assertThat(testTransaction.getOriginalAmount()).isEqualTo(DEFAULT_ORIGINAL_AMOUNT); assertThat(testTransaction.getMovementType()).isEqualTo(DEFAULT_MOVEMENT_TYPE); assertThat(testTransaction.getScheduled()).isEqualTo(DEFAULT_SCHEDULED); assertThat(testTransaction.getAddToReports()).isEqualTo(DEFAULT_ADD_TO_REPORTS); assertThat(testTransaction.getIncomingTransaction()).isEqualTo(UPDATED_INCOMING_TRANSACTION); assertThat(testTransaction.getTransactionType()).isEqualTo(UPDATED_TRANSACTION_TYPE); } @Test @Transactional void fullUpdateTransactionWithPatch() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); // Update the transaction using partial update Transaction partialUpdatedTransaction = new Transaction(); partialUpdatedTransaction.setId(transaction.getId()); partialUpdatedTransaction .name(UPDATED_NAME) .description(UPDATED_DESCRIPTION) .dateAdded(UPDATED_DATE_ADDED) .amount(UPDATED_AMOUNT) .originalAmount(UPDATED_ORIGINAL_AMOUNT) .movementType(UPDATED_MOVEMENT_TYPE) .scheduled(UPDATED_SCHEDULED) .addToReports(UPDATED_ADD_TO_REPORTS) .incomingTransaction(UPDATED_INCOMING_TRANSACTION) .transactionType(UPDATED_TRANSACTION_TYPE); restTransactionMockMvc .perform( patch(ENTITY_API_URL_ID, partialUpdatedTransaction.getId()) .with(csrf()) .contentType("application/merge-patch+json") .content(TestUtil.convertObjectToJsonBytes(partialUpdatedTransaction)) ) .andExpect(status().isOk()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); Transaction testTransaction = transactionList.get(transactionList.size() - 1); assertThat(testTransaction.getName()).isEqualTo(UPDATED_NAME); assertThat(testTransaction.getDescription()).isEqualTo(UPDATED_DESCRIPTION); assertThat(testTransaction.getDateAdded()).isEqualTo(UPDATED_DATE_ADDED); assertThat(testTransaction.getAmount()).isEqualTo(UPDATED_AMOUNT); assertThat(testTransaction.getOriginalAmount()).isEqualTo(UPDATED_ORIGINAL_AMOUNT); assertThat(testTransaction.getMovementType()).isEqualTo(UPDATED_MOVEMENT_TYPE); assertThat(testTransaction.getScheduled()).isEqualTo(UPDATED_SCHEDULED); assertThat(testTransaction.getAddToReports()).isEqualTo(UPDATED_ADD_TO_REPORTS); assertThat(testTransaction.getIncomingTransaction()).isEqualTo(UPDATED_INCOMING_TRANSACTION); assertThat(testTransaction.getTransactionType()).isEqualTo(UPDATED_TRANSACTION_TYPE); } @Test @Transactional void patchNonExistingTransaction() throws Exception { int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); transaction.setId(count.incrementAndGet()); // If the entity doesn't have an ID, it will throw BadRequestAlertException restTransactionMockMvc .perform( patch(ENTITY_API_URL_ID, transaction.getId()) .with(csrf()) .contentType("application/merge-patch+json") .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional void patchWithIdMismatchTransaction() throws Exception { int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); transaction.setId(count.incrementAndGet()); // If url ID doesn't match entity ID, it will throw BadRequestAlertException restTransactionMockMvc .perform( patch(ENTITY_API_URL_ID, count.incrementAndGet()) .with(csrf()) .contentType("application/merge-patch+json") .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isBadRequest()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional void patchWithMissingIdPathParamTransaction() throws Exception { int databaseSizeBeforeUpdate = transactionRepository.findAll().size(); transaction.setId(count.incrementAndGet()); // If url ID doesn't match entity ID, it will throw BadRequestAlertException restTransactionMockMvc .perform( patch(ENTITY_API_URL) .with(csrf()) .contentType("application/merge-patch+json") .content(TestUtil.convertObjectToJsonBytes(transaction)) ) .andExpect(status().isMethodNotAllowed()); // Validate the Transaction in the database List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional void deleteTransaction() throws Exception { // Initialize the database transactionRepository.saveAndFlush(transaction); int databaseSizeBeforeDelete = transactionRepository.findAll().size(); // Delete the transaction restTransactionMockMvc .perform(delete(ENTITY_API_URL_ID, transaction.getId()).with(csrf()).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNoContent()); // Validate the database contains one less item List<Transaction> transactionList = transactionRepository.findAll(); assertThat(transactionList).hasSize(databaseSizeBeforeDelete - 1); } }
[ "andres.bonilla1298@gmail.com" ]
andres.bonilla1298@gmail.com
0babe27a6b521b03da82d39db742265d41b8c291
0ba8daef628386849db36d3b69ec76bb83e76729
/lottery-biz/src/main/java/me/zohar/lottery/agent/domain/RebateAndOddsSituation.java
af0036935c0fa10d573c1eeba1633c50dc0f492f
[]
no_license
lxy826076/spring-cloud-lottery
4e6fcaeb787cfcd26b67a9557bf455d424122cbc
c1598c32e7fe0e4ebc6c4e3ba08f2dac52938936
refs/heads/master
2022-09-09T04:01:59.173965
2020-04-08T08:52:16
2020-04-08T08:52:16
254,022,380
2
0
null
2022-09-01T23:23:07
2020-04-08T07:57:53
Java
UTF-8
Java
false
false
879
java
package me.zohar.lottery.agent.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import lombok.Getter; import lombok.Setter; @Getter @Setter @Entity @Table(name = "v_rebate_and_odds_situation") @DynamicInsert(true) @DynamicUpdate(true) public class RebateAndOddsSituation implements Serializable { /** * */ private static final long serialVersionUID = 1L; /** * 主键id */ @Id @Column(name = "id", length = 32) private String id; /** * 返点 */ private Double rebate; /** * 赔率 */ private Double odds; /** * 关联账号数量 */ private Integer associatedAccountNum; private Date createTime; }
[ "xyliu@easipay.net" ]
xyliu@easipay.net
bfe5efdd48e860886fd39fa899f1018398223285
f3a3dcec8409adb99a9003967b9b5b4fa4887708
/src/main/java/com/logfiles/entrypoint/LogFileResource.java
851fc1c8ba49e7c030e185b45fd4731bc430d8c9
[]
no_license
tecalex01/logfiles
39b53003130a48c74668186c0917a2870a0830dc
89269a1b318a17cb56aaad56d7f5515ec029dcc6
refs/heads/main
2023-04-05T19:49:19.305775
2021-04-28T18:55:56
2021-04-28T18:55:56
361,823,988
0
0
null
null
null
null
UTF-8
Java
false
false
15,436
java
package com.logfiles.entrypoint; import java.io.File; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; import javax.validation.constraints.NotNull; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.ProcessingException; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.client.Client; import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import com.codahale.metrics.annotation.Timed; import com.google.common.base.Optional; import com.logfiles.api.Host; import com.logfiles.api.LogFile; import com.logfiles.backend.FilterKeyword; import com.logfiles.backend.LogFileDirectory; import com.logfiles.backend.LogFileReader; import com.logfiles.backend.ReadOrder; /** * Class that is the entry point to handle REST-API request over * 1. http://[domain]/logfiles/api/v1/files/ * 2. http://[domain]/logfiles/api/v1/files/{filename} * @author alexdel * */ @Path("logfiles/api/v1/files") @Produces(MediaType.APPLICATION_JSON) public class LogFileResource { /** Default log directory */ private String defaultDir; /** File cursor position since the reading will start */ private Long startPos; /** Number of lines to be read */ private Integer nLines; /** Filter keyword to be apply over the lines selected */ private String keyword; /** File read on ascendant or descendant way */ private Integer orderBy; /** Hosts list separate by commas to be reached by a REST-API request * to query a single file or all files in its local log directory */ private String hosts; /** Controller reference to backend for a single file */ LogFileReader logFileReader; /** Controller reference to backend for a directory */ LogFileDirectory logFileDirectory; /** Jersey client to makes REST-API requests */ Client jerseyClient; /** * Constructor * @param jerseyClient Jersey client * @param defaultDir Default log directory * @param startPos Files read from cursor position * @param nLines Number of lines to be read * @param orderBy File read on ascendant(0) or descendant way(1). Default descendant * @param hosts Host list separated by commas to be query. */ public LogFileResource(Client jerseyClient, String defaultDir, Long startPos, Integer nLines, Integer orderBy, String hosts) { this.jerseyClient = jerseyClient; this.defaultDir = defaultDir; this.startPos = startPos; this.nLines = nLines; this.orderBy = orderBy; this.hosts = hosts; this.logFileReader = new LogFileReader(); this.logFileDirectory = new LogFileDirectory(logFileReader); } /** * Entry point for http://[domain]/logfiles/api/v1/files/ * Allows the following usage: * 1. Header host parameter to specify another host to be query. * 2. http://[domain]/logfiles/api/v1/files/ * 3. http://[domain]/logfiles/api/v1/files[?n_lines={#lines}[{@literal &}keyword={keyword}[{@literal &}orderBy={0|1}]]] * @param nLines Number of lines to be read * @param keyword keyword filter over the lines read. * @param orderBy Reading on ascendant (0) and descendant(1) * @param hosts Host list separate by comma to be query by REST-API request * @return */ @GET @Timed public List<Host> getAllLogFiles(@QueryParam("n_lines") Optional<Integer> nLines, @QueryParam("keyword") Optional<String> keyword, @QueryParam("order_by") Optional<Integer> orderBy, @HeaderParam("X-hosts") Optional<String> hosts) { this.nLines = nLines.or(-1); /* By default number of lines not specified */ this.keyword = keyword.or(""); /* By default no keyword specified */ this.orderBy = orderBy.or(1); /* By default desc ordering */ this.startPos = -1L; this.hosts = hosts.or("localhost"); /* By default no hosts specified */ validParameters(); String[] hostsArr = this.hosts.split(","); List<String> hostsList = Arrays.asList(hostsArr); String myIpAux; final String myIp; List<LogFile> myLocalFiles = null; List<Host> logFilesAllServers = new LinkedList<>(); /* Get current host ip */ try { InetAddress ip = InetAddress.getLocalHost(); myIpAux = ip.getHostAddress(); } catch (UnknownHostException ue) { myIpAux = "localhost"; } myIp = myIpAux; /* If current host is specified in host header param, * then look for all files in current machine */ if (hostsList.contains("localhost") || hostsList.contains("127.0.0.1") || hostsList.contains(myIp)) { myLocalFiles = getAllFilesInDirectory(logFileDirectory, new File(defaultDir)); } /* Execute in parallel way a filter to remove current host from host list */ hostsList = hostsList.parallelStream().filter(str -> {return !str.equals("localhost") && !str.equals("127.0.0.1") && !str.equals(myIp);}) .collect(Collectors.toList()); /* If after remove current host, there are more host to query */ if (hostsList.size() > 0) { /* Execute on a parallel way a REST-API call for each host specified in hosts header param. * The function requestFileToOtherServers handle and parse the response and create a representation for * each host with the files queried in case of status code 200. * * NOTE: For remote request only params: n_lines, order_by and keyword are enable, * start_pos is unable */ logFilesAllServers = hostsList.parallelStream().map(host -> requestFileToOtherServers(host, "")) .collect(Collectors.toList()); } /* If local files were queried */ if(myLocalFiles != null) { /* Set a representation for current host */ Host host = new Host(); host.setHost(myIp); host.setCode(Status.OK.getStatusCode()); host.setMessage(Status.OK.getReasonPhrase()); host.setLogfiles(myLocalFiles); /* Add host to the response */ logFilesAllServers.add(host); } return logFilesAllServers; } /** * Entry point for http://[domain]/logfiles/api/v1/files/{filename} * Allows the following usage: * 1. Header host parameter to specify another host to be query. * 2. http://[domain]/logfiles/api/v1/files/{filename} * 3. http://[domain]/logfiles/api/v1/files[?n_lines={#lines}[{@literal &}keyword={keyword}[{@literal &}orderBy={0|1}[{@literal &}start_pos={long_number}]]]] * @param fileName Filename looked * @param startPos File cursor reference since the reading will start * @param nLines Number of lines to be read * @param keyword Keyword filter to filter lines read. * @param orderBy Reading on ascendant(0) or descendant(1) * @param hosts Hosts list header parameter separated by comma to look the file through a REST-API request * @return */ @GET @Path("/{fileName}") @Timed public List<Host> getLogFile(@NotNull @PathParam("fileName") String fileName, @QueryParam("start_pos") Optional<Long> startPos, @QueryParam("n_lines") Optional<Integer> nLines, @QueryParam("keyword") Optional<String> keyword, @QueryParam("order_by") Optional<Integer> orderBy, @HeaderParam("X-hosts") Optional<String> hosts) { this.nLines = nLines.or(-1); /* By default number of lines not specified */ this.keyword = keyword.or(""); /* By default no keyword specified */ this.orderBy = orderBy.or(1); /* By default desc ordering */ this.startPos = startPos.or(-1L); /* By default no startPos specified */ this.hosts = hosts.or("localhost"); /* By default no hosts specified */ validParameters(); String[] hostsArr = this.hosts.split(","); List<String> hostsList = Arrays.asList(hostsArr); File file = new File(defaultDir + fileName); LogFile myLogFile = null; String myIpAux; final String myIp; List<Host> logFilesAllServers = new LinkedList<>(); /* Get current host ip */ try { InetAddress ip = InetAddress.getLocalHost(); myIpAux = ip.getHostAddress(); } catch (UnknownHostException ue) { myIpAux = "localhost"; } myIp = myIpAux; /* If current host is specified in host header param, * then look for all files in current machine */ if (hostsList.contains("localhost") || hostsList.contains("127.0.0.1") || hostsList.contains(myIp)) { myLogFile = getFile(logFileReader, file); } /* Execute in parallel way a filter to remove current host from host list */ hostsList = hostsList.parallelStream().filter(str -> {return !str.equals("localhost") && !str.equals("127.0.0.1") && !str.equals(myIp);}) .collect(Collectors.toList()); /* If after remove current host, there are more host to query */ if (hostsList.size() > 0) { /* Execute on a parallel way a REST-API call for each host specified in hosts header param. * The function requestFileToOtherServers handle and parse the response and create a representation for * each host with the files queried in case of status code 200. * * NOTE: For remote request only params: n_lines, order_by and keyword are enable, * start_pos is unable */ logFilesAllServers = hostsList.parallelStream().map(host -> requestFileToOtherServers(host, fileName)) .collect(Collectors.toList()); } /* If local file were queried */ if(myLogFile != null) { /* Set a representation for current host */ Host host = new Host(); List<LogFile> logFileList = new LinkedList<>(); host.setHost(myIp); host.setCode(Status.OK.getStatusCode()); host.setMessage(Status.OK.getReasonPhrase()); logFileList.add(myLogFile); host.setLogfiles(logFileList); /* Add host to the response */ logFilesAllServers.add(host); } return logFilesAllServers; } /** * Look for all the files in log directory for current host. * @param logFileDir Log file directory controller backend reference * @param path Log file directory * @return */ private List<LogFile> getAllFilesInDirectory(LogFileDirectory logFileDir, File path) { ReadOrder order = ReadOrder.DESC; FilterKeyword filterKeyword = new FilterKeyword(keyword); List<LogFile> logFileList; if (orderBy == 0) { order = ReadOrder.ASC; } /* If number of lines specified */ if (nLines > 0) { /* Filter all files by number of lines, ordering and keyword if were specified */ logFileList = logFileDir.getAllFiles(path, nLines, order, filterKeyword); } else { /* Filter all files by order (default descendant) and keyword if were specified */ logFileList = logFileDir.getAllFiles(path, order, filterKeyword); } return logFileList; } /** * Look for a specific file in current host. * @param logFileReader Log file controller backend reference * @param file File looked in log directory * @return */ private LogFile getFile(LogFileReader logFileReader, File file) { LogFile logFile = null; ReadOrder order = ReadOrder.DESC; String msg = ""; FilterKeyword filterKeyword = new FilterKeyword(keyword); /* Processing query params and header params */ if (orderBy == 0) { order = ReadOrder.ASC; } try { if (startPos >= 0) { logFile = logFileReader.readLines(file, startPos, nLines, order, filterKeyword); } else if (nLines > 0) { logFile = logFileReader.readLines(file, nLines, order, filterKeyword); } else { logFile = logFileReader.readLines(file, order, filterKeyword); } } catch (IOException ioe) { ioe.printStackTrace(); if (!Files.isReadable((Paths.get(defaultDir)))) { msg = "Path " + defaultDir + " permission denied"; throw new WebApplicationException(msg, Status.FORBIDDEN); } else { msg = "File " + defaultDir + file.getName() + " not found"; throw new WebApplicationException(msg, Status.NOT_FOUND); } } catch (Exception e) { e.printStackTrace(); throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); } return logFile; } /** * Handles REST-API request for every host name * @param hostName host name * @param fileName file looked if apply * @return */ private Host requestFileToOtherServers(String hostName, String fileName) { String url = "http://" + hostName + "/"; Host host = new Host(); try { /* Target http server and set query params */ WebTarget target = jerseyClient.target(url).path("logfiles/api/v1/files") .queryParam("n_lines", this.nLines) .queryParam("keyword", this.keyword) .queryParam("order_by", this.orderBy); /* If an specific file were specified */ if (!fileName.equals("")) { target.path("/"+fileName); } /* Execute REST-API request for host */ Invocation.Builder invBuilder = target.request(MediaType.APPLICATION_JSON); Response response = invBuilder.get(Response.class); /* Handle and manage REST-API response */ List<Host> hostsWithLogFile = response.readEntity(List.class); /* We are expecting a single response with the file or error reporting */ host = hostsWithLogFile.get(0); } catch(ProcessingException e) { /* In case the host can not be reachable */ host.setHost(hostName); host.setCode(Status.GATEWAY_TIMEOUT.getStatusCode()); host.setMessage(Status.GATEWAY_TIMEOUT.getReasonPhrase()); host.setLogfiles(new LinkedList<>()); System.out.print(e.getMessage()); } return host; } /** * Validate REST-API parameters */ private void validParameters() { boolean valid = true; String msg = ""; if (startPos < 0 && startPos != -1) { msg = "start_pos must be as minimum 0"; valid = false; } if (nLines <= 0 && nLines != -1) { msg = "n_lines must be as minimum 1"; valid = false; } if (orderBy != 0 && orderBy != 1) { msg = "order_by allowed values are 0 to ASC and 1 to DESC"; valid = false; } if (!valid) { throw new WebApplicationException(msg, Status.BAD_REQUEST); } } }
[ "alexdel@ALEXDEL-LAP.oradev.oraclecorp.com" ]
alexdel@ALEXDEL-LAP.oradev.oraclecorp.com
eb78d94927abb080ae04f6a0c2728d9bd3c0902f
8ec78e6ae1b611fd6e7d795fb0234f8c282d593e
/Toolkit/src/main/java/ru/simplgroupp/toolkit/common/Range.java
5f9915c852e57b175e08a9298201ed9b5d5783c3
[]
no_license
vo0doO/microcredit
96678f7afddd2899ea127281168202e36ee739c0
5d16e73674685d32196af33982d922ba0c9a8a59
refs/heads/master
2021-01-18T22:23:25.182233
2016-11-25T09:04:36
2016-11-25T09:04:36
87,050,783
0
2
null
2017-04-03T07:55:10
2017-04-03T07:55:10
null
UTF-8
Java
false
false
156
java
package ru.simplgroupp.toolkit.common; public interface Range { public boolean between(Object value); public Object getFrom(); public Object getTo(); }
[ "juhnowski@gmail.com" ]
juhnowski@gmail.com
d74b4f2c7db9e5eb78547d8399d9c0ad0bb91cea
ca4798d07495ba10a6aea05ccf7998a14ca937a2
/src/simulations/Simulator.java
f57370ac5b78197be34ac02ccb02cf3777597719
[]
no_license
Benybodipo/avaj-launcher
38c4af1ebf5d7e07fc10ffbc2519e37c7f913ace
39c3b63a5574698b52bca57649654f941795aa30
refs/heads/master
2020-06-09T21:35:06.011252
2019-06-24T13:36:56
2019-06-24T13:36:56
193,510,425
0
0
null
null
null
null
UTF-8
Java
false
false
139
java
package simulations; public class Simulator { public static void main(String[] args) { System.out.println(1234); } }
[ "benybodipo@gmail.com" ]
benybodipo@gmail.com
1a5fed7048b662e668096274df43c1d72afb2d22
f6cd746fea3a9978fa8fa1a3d175356f319b4a9f
/A1_grpc_client/target/generated-sources/protobuf/java/com/aufgabe/grpc/InvoiceOrBuilder.java
9b6482649e69c99dde1061c7e1c6dcf1181afa50
[]
no_license
Lisella/grpc
a00e8a0a611fcb571789ce62fb8ad6a594cf6bec
48c48897918aef3afeca03afad19dfb8aaeea7a4
refs/heads/master
2022-11-05T06:11:59.303333
2019-10-29T08:06:18
2019-10-29T08:06:18
218,233,275
0
0
null
2022-10-04T23:54:47
2019-10-29T07:59:13
Java
UTF-8
Java
false
true
811
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: InvoiceService.proto package com.aufgabe.grpc; public interface InvoiceOrBuilder extends // @@protoc_insertion_point(interface_extends:Invoice) com.google.protobuf.MessageOrBuilder { /** * <code>string clientId = 1;</code> */ java.lang.String getClientId(); /** * <code>string clientId = 1;</code> */ com.google.protobuf.ByteString getClientIdBytes(); /** * <code>.Product product = 2;</code> */ boolean hasProduct(); /** * <code>.Product product = 2;</code> */ com.aufgabe.grpc.Product getProduct(); /** * <code>.Product product = 2;</code> */ com.aufgabe.grpc.ProductOrBuilder getProductOrBuilder(); /** * <code>int32 number = 3;</code> */ int getNumber(); }
[ "maus.lisa@gmx.de" ]
maus.lisa@gmx.de
ffe70d2f75daa09c68ee8867908b61e849313472
86bba0d4d0c1a761727b6294e6e0e0b7d57e376e
/Week02/src/main/java/com/fzw/week02/question05/Solution.java
b559338a3912490eb8edb281cd431c3218dd9dd6
[]
no_license
CarlaX/JavaAlgorithm
59bc04d0819c9ef02b21cf6e455cd64c2f10e084
a4c6c92cebcbdc6f005060dbc31984e9503166bb
refs/heads/main
2023-06-30T02:04:31.570803
2021-08-04T02:45:17
2021-08-04T02:45:17
380,125,365
0
0
null
null
null
null
UTF-8
Java
false
false
1,619
java
package com.fzw.week02.question05; import com.fzw.week02.common.ListNode; /** * @author fzw * @description 23. 合并K个升序链表 * @date 2021-06-30 **/ public class Solution { public ListNode mergeKLists(ListNode[] lists) { int length = lists.length; int newLength = 0; if (length == 0) { return null; } if (length == 1) { return lists[0]; } if (length % 2 == 0) { newLength = length / 2; } else { newLength = length / 2 + 1; } ListNode[] newListNodes = new ListNode[newLength]; for (int i = 0; i < length; i = i + 2) { if (i == length - 1) { newListNodes[i / 2] = lists[i]; } else { newListNodes[i / 2] = this.mergeNode(lists[i], lists[i + 1]); } } return this.mergeKLists(newListNodes); } public ListNode mergeNode(ListNode l1, ListNode l2) { if (l1 == null) { return l2; } if (l2 == null) { return l1; } ListNode temp = new ListNode(); ListNode head = temp; while (l1 != null && l2 != null) { if (l1.val < l2.val) { temp.next = l1; l1 = l1.next; } else { temp.next = l2; l2 = l2.next; } temp = temp.next; } if (l1 == null) { temp.next = l2; } if (l2 == null) { temp.next = l1; } return head.next; } }
[ "idea@idea.com" ]
idea@idea.com
dea4a08186eff5fc58a6f600cdfe1d16496dd33c
f959f0ddea0579455fd63efd73f68796ca3c89a3
/thinkis-core/src/main/java/com/thinkis/common/utils/Exceptions.java
6a9cf9cc80f2dd45f793b833e2f56515f8f5d92e
[ "MIT" ]
permissive
chocoai/firsthinkis
951e48acd86c4e8eb69d3a4b7bdcf2489828f813
63920660440c8b08ab6f81bccdd948f3464ac6f2
refs/heads/master
2022-04-06T12:37:57.431079
2019-12-22T03:37:52
2019-12-22T03:37:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,692
java
/** * Copyright (c) 2005-2012 springside.org.cn */ package com.thinkis.common.utils; import java.io.PrintWriter; import java.io.StringWriter; import javax.servlet.http.HttpServletRequest; /** * 关于异常的工具类. * @author calvin * @version 2013-01-15 */ public class Exceptions { /** * 将CheckedException转换为UncheckedException. */ public static RuntimeException unchecked(Exception e) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new RuntimeException(e); } } /** * 将ErrorStack转化为String. */ public static String getStackTraceAsString(Throwable e) { if (e == null){ return ""; } StringWriter stringWriter = new StringWriter(); e.printStackTrace(new PrintWriter(stringWriter)); return stringWriter.toString(); } /** * 判断异常是否由某些底层的异常引起. */ public static boolean isCausedBy(Exception ex, Class<? extends Exception>... causeExceptionClasses) { Throwable cause = ex.getCause(); while (cause != null) { for (Class<? extends Exception> causeClass : causeExceptionClasses) { if (causeClass.isInstance(cause)) { return true; } } cause = cause.getCause(); } return false; } /** * 在request中获取异常类 * @param request * @return */ public static Throwable getThrowable(HttpServletRequest request){ Throwable ex = null; if (request.getAttribute("exception") != null) { ex = (Throwable) request.getAttribute("exception"); } else if (request.getAttribute("javax.servlet.error.exception") != null) { ex = (Throwable) request.getAttribute("javax.servlet.error.exception"); } return ex; } }
[ "18229712137@189.cn" ]
18229712137@189.cn
f48088f3a13c59b77079c02574a6452e58ee002b
7d0fcc466f8d3533b920527d6421e8510c6a4bef
/app/src/main/java/com/example/phompang/lib2/model/Borrow.java
1a9a611dc9f576df5d0ce509176fa9efa483be87
[]
no_license
PhompAng/Lib2
e47f02c633ceb3bdbd5ff6cc7e65a471211530ae
316ac7fbbed5f354e07e9be647341bd615ed74a9
refs/heads/master
2020-06-16T15:10:14.338351
2016-11-29T14:35:13
2016-11-29T14:35:13
75,089,301
0
0
null
null
null
null
UTF-8
Java
false
false
1,623
java
package com.example.phompang.lib2.model; import java.io.Serializable; import java.util.Date; /** * Created by phompang on 11/29/2016 AD. */ public class Borrow implements Serializable { private int id; private Book book; private Staff staff; private Member member; private Date start; private Date end; private String status; public int getId() { return id; } public void setId(int id) { this.id = id; } public Book getBook() { return book; } public void setBook(Book book) { this.book = book; } public Staff getStaff() { return staff; } public void setStaff(Staff staff) { this.staff = staff; } public Member getMember() { return member; } public void setMember(Member member) { this.member = member; } public Date getStart() { return start; } public void setStart(Date start) { this.start = start; } public Date getEnd() { return end; } public void setEnd(Date end) { this.end = end; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } @Override public String toString() { return getId() + ". Book: " + getBook().getName() + "\n" + "Member: " + getMember().getFirstname() + "\n" + "Staff: " + getStaff().getUsername() + "\n" + "Borrow: " + getStart().toString() + "\n" + "Due: " + getEnd().toString(); } }
[ "tingtong003tomy@gmail.com" ]
tingtong003tomy@gmail.com
d664b7a16b4bd1b1abd2784e392d4653ec444801
1f3beaa052725c1ba296d4ca64ada2c0cb68c4fa
/app/src/main/java/com/xyd/susong/store/StorePresenter.java
759d81dd64299292fe2e4c6e0940a617eb0f99b8
[]
no_license
zhengyiheng123/susong_special
adad056047f1b6d3a13d14c4c246aa4480648cb4
fc9095d984f6903a6d574d0ce52ba039dc65d924
refs/heads/master
2021-05-05T20:37:21.070922
2018-01-05T03:53:43
2018-01-05T03:53:43
114,829,843
0
0
null
null
null
null
UTF-8
Java
false
false
1,540
java
package com.xyd.susong.store; import com.xyd.susong.api.StoreApi; import com.xyd.susong.base.BaseApi; import com.xyd.susong.base.BaseModel; import com.xyd.susong.base.BaseObserver; import com.xyd.susong.base.RxSchedulers; /** * @author: zhaoxiaolei * @date: 2017/7/20 * @time: 15:45 * @description: */ public class StorePresenter implements StoreContract.Presenter { private StoreContract.View view; public StorePresenter(StoreContract.View view) { this.view = view; } @Override public void subscribe() { } @Override public void unSubscribe() { } @Override public void getData(final int page, int type) { BaseApi.getRetrofit() .create(StoreApi.class) .goodsList(page, type) .compose(RxSchedulers.<BaseModel<StoreModel>>compose()) .subscribe(new BaseObserver<StoreModel>() { @Override protected void onHandleSuccess(StoreModel model, String msg, int code) { if (page == 1) view.refreshData(model); else if (model.getData().size()>0) view.loadMoreData(model,1); else view.loadMoreData(model,2); } @Override protected void onHandleError(String msg) { view.error(msg); } }); } }
[ "15621599930@163.com" ]
15621599930@163.com
5e8990846cdf67199dd53d60f184e61b9de85230
04db3b27f799634a7a32ceb689cd836612d296de
/src/main/java/com/aws/samples/cdk/stacktypes/gradle/GradleSupport.java
82eea93718d5bc6bb2c6b98ffdba4626330506dd
[ "Apache-2.0" ]
permissive
PartTimeHackerman/aws-cdk-constructs-for-java
3d52a985c64d154c49d724cd0f24968ac32de82e
4cb771d2425353cc082d40f9213098d46be07f70
refs/heads/main
2023-07-27T22:44:42.739082
2021-09-09T20:23:14
2021-09-09T20:39:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
package com.aws.samples.cdk.stacktypes.gradle; import io.vavr.control.Try; import org.gradle.tooling.BuildLauncher; import org.gradle.tooling.GradleConnector; import org.gradle.tooling.ProjectConnection; import java.io.File; public class GradleSupport { public static void buildJar(File projectDirectoryFile) { ProjectConnection projectConnection = GradleConnector.newConnector() .forProjectDirectory(projectDirectoryFile) .connect(); Try.withResources(() -> projectConnection) .of(GradleSupport::runBuild) .get(); } public static Void runBuild(ProjectConnection projectConnection) { // Build with gradle and send the output to stderr BuildLauncher build = projectConnection.newBuild(); build.forTasks("build"); build.setStandardOutput(System.err); build.run(); return null; } }
[ "tim@mattison.org" ]
tim@mattison.org
38dbc613e8b0613df29a09756ca032ae9ab179da
db9457d801fa144fd75bfc6f026a1bcfb2e1472a
/src/main/java/com/rationaleemotions/annotations/internal/XmlRun.java
033c7c58126e99db86677a8bd284d087aa5d4037
[ "Apache-2.0" ]
permissive
gyyfifafans/sangrahah
b35dfb1986c5a43d704c79699c196dd32643bdb1
a461cb02b65cd63d77426193318760d4f64928ae
refs/heads/master
2022-11-21T07:01:51.762353
2020-07-26T17:09:34
2020-07-26T17:09:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.rationaleemotions.annotations.internal; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.ANNOTATION_TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface XmlRun { String[] include() default {}; String[] exclude() default {}; }
[ "krishnan.mahadevan1978@gmail.com" ]
krishnan.mahadevan1978@gmail.com
7bf0d02a9322e920dec0493b1dfce3bc375a8a32
420e0cd076d07fb4ec85571099679444c9e7a507
/second_hand_car/src/com/ywb/adapter/CategoryAdapter.java
1d436d9e826fa6def67d9ce91c6482b3c1ccdcf1
[]
no_license
xywyyyyy/second_hand_car
8414106f549cf2615e17d563ece6c3fe49e482f1
90b1d2f0689190357d37e927d79901c5ab3ca3d8
refs/heads/master
2021-04-28T22:48:02.958429
2016-12-31T17:13:51
2016-12-31T17:13:51
77,745,085
0
0
null
null
null
null
GB18030
Java
false
false
4,373
java
package com.ywb.adapter; import java.util.List; import java.util.Map; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.ImageView; import android.widget.TextView; import com.ywb.dao.BrandDAO; import com.ywb.ui.R; public class CategoryAdapter extends BaseExpandableListAdapter { private BrandDAO brandDAO; private Context context; // 品牌表 Brand private List ar; private LayoutInflater inflater; // 填充品牌表的数据 private String bnames[]; private int bids[]; private int bimages[]; private TextView bname; private ImageView bimage; // 车系表(serial)的二维数组 private String snames[][];// 存放的是每一个总类下子类的名称 private int sids[][]; private int simages[][]; public CategoryAdapter(Context context, List ar) { this.context = context; // 实例化brandDAO brandDAO = new BrandDAO(context); this.ar = ar; inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // 实例化品牌名称和品牌编号数组 bnames = new String[ar.size()]; bids = new int[ar.size()]; bimages = new int[ar.size()]; // 实例化车系数组 snames = new String[ar.size()][]; sids = new int[ar.size()][]; simages = new int[ar.size()][]; // 获取品牌名称和编号 for (int i = 0; i < ar.size(); i++) { Map map = (Map) ar.get(i); bnames[i] = map.get("bname").toString(); bids[i] = Integer.parseInt(map.get("bid").toString()); bimages[i] = Integer.parseInt(map.get("bimage").toString()); } // 获得车系名称和编号 for (int i = 0; i < bids.length; i++) { int id = bids[i]; List data = brandDAO.getAllSerial(id); snames[i] = new String[data.size()]; sids[i] = new int[data.size()]; simages[i] = new int[data.size()]; for (int j = 0; j < data.size(); j++) { Map map = (Map) data.get(j); snames[i][j] = map.get("sname").toString(); sids[i][j] = Integer.parseInt(map.get("sid").toString()); simages[i][j] = Integer.parseInt(map.get("simage").toString()); } } } @Override public Object getChild(int arg0, int arg1) { // TODO Auto-generated method stub return null; } @Override public long getChildId(int arg0, int arg1) { // TODO Auto-generated method stub return 0; } /** * 1、 获得品牌的数量 */ @Override public int getGroupCount() { // TODO Auto-generated method stub return bnames.length; } /** * 2、填充品牌 */ @Override public View getGroupView(int arg0, boolean arg1, View arg2, ViewGroup arg3) { if (arg2 == null) { arg2 = inflater.inflate(R.layout.brand_names, null); bname = (TextView) arg2.findViewById(R.id.tv_bname); bimage = (ImageView) arg2.findViewById(R.id.iv_bimage); arg2.setTag(bname); } else { bname = (TextView) arg2.getTag(); } bname.setText(bnames[arg0]); bimage.setImageResource(bimages[arg0]); return arg2; } /** * 3、获得车系的数量 */ @Override public int getChildrenCount(int arg0) { return snames[arg0].length; } /** * 4、 填充车系 */ @Override public View getChildView(int arg0, int arg1, boolean arg2, View arg3, ViewGroup arg4) { ViewHolder viewHolder; if (arg3 == null) { arg3 = inflater.inflate(R.layout.serial_names, null); viewHolder = new ViewHolder(); viewHolder.mTvSname = (TextView) arg3.findViewById(R.id.tv_sname); viewHolder.mIvSimage = (ImageView) arg3 .findViewById(R.id.iv_simage); arg3.setTag(viewHolder); } else { viewHolder = (ViewHolder) arg3.getTag(); } viewHolder.mTvSname.setText(snames[arg0][arg1]); viewHolder.mTvSname.setTag(sids[arg0][arg1]); viewHolder.mIvSimage.setImageResource(simages[arg0][arg1]); return arg3; } public class ViewHolder { private TextView mTvSname; private ImageView mIvSimage; } @Override public Object getGroup(int arg0) { // TODO Auto-generated method stub return null; } @Override public long getGroupId(int arg0) { // TODO Auto-generated method stub return 0; } @Override public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Override public boolean isChildSelectable(int arg0, int arg1) { // TODO Auto-generated method stub return true; } }
[ "yy@163.com" ]
yy@163.com
4af8c151504d9734f411e8fdab44d5391312901f
90852fbe536b74706046fa90cdac4cf70ebccc20
/app/src/main/java/de/hawlandshut/pluto21_gkw/ManageAccountActivity.java
1c5478aed025de6550683eed866c5cf23fedaed2
[]
no_license
ajblendo/Pluto21_gKW
98e2a119e8da45b2eee09fa91e46cbf48b051cb3
c40caca0016a5b2656eab5495b4853a7866311a0
refs/heads/master
2023-02-22T01:45:46.232761
2021-01-13T12:07:34
2021-01-13T12:11:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,682
java
package de.hawlandshut.pluto21_gkw; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class ManageAccountActivity extends AppCompatActivity implements View.OnClickListener{ private static final String TAG = "xx ManageActivity"; TextView mEmail, mAccountState, mTechnicalId; EditText mPassword; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_manage_account); mEmail = (TextView) findViewById(R.id.manageAccountEmail); mAccountState = (TextView) findViewById(R.id.manageAccountVerificationState); mTechnicalId = (TextView) findViewById(R.id.manageAccountTechnicalId); mPassword = (EditText) findViewById(R.id.manageAccountPassword); ((Button) findViewById( R.id.manageAccountButtonSignOut)).setOnClickListener( this ); ((Button) findViewById( R.id.manageAccountButtonSendActivationMail)).setOnClickListener( this ); ((Button) findViewById( R.id.manageAccountButtonDeleteAccount)).setOnClickListener( this ); //TODO: Nur zum Testen - später löschen! mEmail.setText("dietergreipl@gmail.com"); mPassword.setText("123456"); } @Override protected void onStart() { super.onStart(); // Disable Send Activation, if already verifiednot yet enabled FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) { return; // This should never happen } if (user.isEmailVerified()) { ((Button) findViewById(R.id.manageAccountButtonSendActivationMail)).setVisibility(View.GONE); } // Display status lines mTechnicalId.setText("UID : "+user.getUid()); mAccountState.setText("Verified : "+ user.isEmailVerified() ); mEmail.setText("E-Mail : " + user.getEmail()); } @Override public void onClick( View v){ switch( v.getId() ){ case R.id.manageAccountButtonDeleteAccount: doDeleteAccount(); return; case R.id.manageAccountButtonSendActivationMail: doSendActivationMail(); return; case R.id.manageAccountButtonSignOut: doSignOut(); return; default: return; } } private void doSignOut() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) { Log.e(TAG, "Schwerer Fehler: Nicht angmeldeter User in SignOut"); } else { FirebaseAuth.getInstance().signOut(); Toast.makeText(getApplicationContext(), "Your are signed out.", Toast.LENGTH_SHORT).show(); finish(); } } private void doSendActivationMail() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) { Log.e(TAG, "Schwerer Fehler: Nicht angmeldeter User in SendActivationMail"); } else { user.sendEmailVerification() .addOnCompleteListener( new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Toast.makeText(getApplicationContext(), "We sent you a link to your e-mail account.", Toast.LENGTH_LONG).show(); Log.d(TAG, "Email sent."); } else { Toast.makeText(getApplicationContext(), "Could not send mail. Correct e-mail?", Toast.LENGTH_LONG).show(); } } }); } } private void doDeleteAccount() { // TODO: Test: was passiert, wenn user vor dem Delete-Call am Server gelöscht wird. FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) { Log.e(TAG, "Schwerer Fehler: Nicht angmeldeter User in DeleteAccount"); } else { user.delete() .addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Toast.makeText(getApplicationContext(), "Account deleted.", Toast.LENGTH_SHORT).show(); finish(); } else { Toast.makeText(getApplicationContext(), "Account deletion failed.", Toast.LENGTH_SHORT).show(); Log.w(TAG, "deleteUser:failure", task.getException()); } } }); } } }
[ "dgreipl@hawlandshutde.onmicrosoft.com" ]
dgreipl@hawlandshutde.onmicrosoft.com
26ea047f008bc7e9d7c57514beff12511a27bdb7
d7a5a187fbc799fcbefb7c439e906182c1031abd
/Week_02/FizzBuzz_412.java
4e26c96a360d0d1d5f0c53c61f401947733dbe95
[]
no_license
ToBeABetterMan-H/algorithm009-class02
ab8de74d3e131869d9ef662931b9d7164044b3e5
f3d7a07bf691270911a150e1f49bcb1eedc0406f
refs/heads/master
2022-11-20T09:00:39.032361
2020-07-17T13:30:47
2020-07-17T13:30:47
266,490,162
0
0
null
2020-05-24T07:20:36
2020-05-24T07:20:36
null
UTF-8
Java
false
false
1,563
java
package com.wxh.algorithm; import java.util.ArrayList; import java.util.List; /** * 写一个程序,输出从 1 到 n 数字的字符串表示。 * 1. 如果 n 是3的倍数,输出“Fizz”; * 2. 如果 n 是5的倍数,输出“Buzz”; * 3.如果 n 同时是3和5的倍数,输出 “FizzBuzz”。 * * 示例: * n = 15, * 返回: * [ * "1", * "2", * "Fizz", * "4", * "Buzz", * "Fizz", * "7", * "8", * "Fizz", * "Buzz", * "11", * "Fizz", * "13", * "14", * "FizzBuzz" * ] * * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/fizz-buzz * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 * * 2020-05-28 08:09:00 */ public class FizzBuzz_412 { public List<String> fizzBuzz(int n) { List<String> res = new ArrayList<>(); for (int i = 1; i < n + 1; i++) { if (i % 3 == 0 && i % 5 == 0) res.add("FizzBuzz"); else if (i % 3 == 0) res.add("Fizz"); else if (i % 5 == 0) res.add("Buzz"); else res.add(String.valueOf(i)); } return res; } public List<String> fizzBuzz_(int n) { List<String> res = new ArrayList<>(); for (int i = 0; i < n; i++) { if (i % 15 == 0) res.add("FizzBuzz"); else if (i % 3 == 0) res.add("Fizz"); else if (i % 5 == 0) res.add("Buzz"); else res.add(String.valueOf(i)); } return res; } }
[ "47262976+ToBeABetterMan-H@users.noreply.github.com" ]
47262976+ToBeABetterMan-H@users.noreply.github.com
74df3091e4586097fd1d117b38672d7a3b35f83b
eedb673c07a00bf09c7f472b877b3d2326934674
/AuctionClient.java
c9fc47103c124fa9a68ea96347fe0bf51922ccb4
[]
no_license
psalmon/AuctionSystem
43b456a134f8cfb12f56746b3c309ea2b5bb24da
add9f921b005092f6533bcbf216219cd0cf9e46a
refs/heads/master
2020-05-18T12:40:19.225408
2014-11-17T12:55:09
2014-11-17T12:55:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,605
java
/** * AuctionClient Client for making auction bids and offers on AuctionServer. As is, assigns 1 random offer and bid. * @author Paul Salmon */ public class AuctionClient implements Runnable{ private String name; private Thread t; /** * Constructor * AuctionServer is local for testing purposes. Starts thread immediately. * @param name: a string to name your thread and the identity of the user (used in AuctionServer bid lookups) */ AuctionClient(String name){ if(AuctionServer.RegClient(name)){ this.name = name; t = new Thread(this, name); t.start(); }else{System.out.println("Name in use!");} } /** * Thread starts call run, and this will (for testing purposes) add an random offer and a bid in the cliets name. * @override * @return No return value. */ public void run() { //initialize with randoms for testing if(!AuctionServer.AddOffer(new Option(name, (int)(Math.random()*100), (int)(Math.random()*50)))){ System.out.println("Auction over");} if(!AuctionServer.AddBid(new Option(name, (int)(Math.random()*100), (int)(Math.random()*75)))){ System.out.println("Auction over");} } /** * Start the thread as long as we had no errors with names (or if the thread is somehow already running). * @return No return value. */ public void start(){ if(name.equals("")) return; else{ if (t == null){ t = new Thread(this, name); t.start(); } } } /** * * @return The instantiated objects thread instance. Useful for synchronization (such as a join...) */ public Thread getThread(){ return t; } }
[ "psalmon88@gmail.com" ]
psalmon88@gmail.com
ca2fe8f522c30efb5327f203c24ad79a0a1df1c5
db5a408be2f78b9ea4f04d2f55d568957e1d14e1
/src/main/java/com/mcbadgercraft/installer/config/json/ArtifactIdAdapter.java
edf2404838c4726f9d6a9163878efd7401946a5d
[]
no_license
CodingBadgers/ModPack-Installer
16638e9596b7d9a84d8b702ebe46104494b56117
64e5fee2bd61daef1cec04503ede558b3b55d0cc
refs/heads/master
2021-01-01T16:26:22.839349
2014-07-25T14:39:40
2014-07-25T14:39:40
17,683,830
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package com.mcbadgercraft.installer.config.json; import com.google.gson.*; import com.mcbadgercraft.installer.config.ArtifactId; import java.lang.reflect.Type; public class ArtifactIdAdapter implements JsonSerializer<ArtifactId>, JsonDeserializer<ArtifactId> { @Override public ArtifactId deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return new ArtifactId(json.getAsString()); } @Override public JsonElement serialize(ArtifactId src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(String.format("%1$s:%2$s:%3$s", src.getGroup(), src.getName(), src.getVersion())); } }
[ "thefishlive@hotmail.com" ]
thefishlive@hotmail.com
3e8b5128add794416bea1e443938173b033d4c6e
b32ad27693eb9d6c43736d3f872e673bb1b9126e
/src/main/java/com/thinkcms/listenner/initnPostProcessor.java
5cf94581db1b5b137546d4db4a1c7d46792ce7d8
[]
no_license
Yingingbinn/cms
ba3372bb6765b328b45bdf6ed258a6a8ee1cfc09
74fa68448ff53ac205e7aef2cc928648a0ad46ef
refs/heads/master
2020-05-27T19:00:19.487162
2017-02-20T15:12:37
2017-02-20T15:12:37
82,569,438
1
0
null
null
null
null
UTF-8
Java
false
false
314
java
package com.thinkcms.listenner; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; public class initnPostProcessor implements ApplicationListener<ContextRefreshedEvent> { public void onApplicationEvent(ContextRefreshedEvent event) { } }
[ "935168511@qq.com" ]
935168511@qq.com
b6f6c3b162c70c760e5902456dd23d321e4af7bf
27725131bce9f08862ef7e1385c862bcf0149f14
/tsnackbar/src/test/java/com/huiwu/tsnackbar/ExampleUnitTest.java
0d32434696562a84536c6bef1ff08d48a283b2e2
[]
no_license
Perity2015/TSnackBar
7f3291524cbb63e90c70915751ae0b5a3dbd2879
b28124c3fd5eadfbdf409919d0d19e9b35901755
refs/heads/master
2021-01-20T18:27:51.425784
2016-07-08T08:15:14
2016-07-08T08:15:14
62,870,999
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.huiwu.tsnackbar; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "757345733@qq.com" ]
757345733@qq.com
abbbe948d32d798cf526ac2183abec56ebaca79e
8671dca9aaaa19b7508a08a1a9907b6e175d0421
/spring-cloud-consumer/src/test/java/com/lei/springcloudconsumer/SpringCloudConsumerApplicationTests.java
9861e10d26926f3fc229cc88e795216716075bba
[]
no_license
heshuting520/caolldemo
0b155318e0c371fc246c81dd8294e468d02abd0a
2560f2a020845c1506f37af11bad7d171b41ad80
refs/heads/master
2021-01-07T12:14:19.232438
2020-02-21T19:43:13
2020-02-21T19:43:13
241,688,614
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package com.lei.springcloudconsumer; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class SpringCloudConsumerApplicationTests { @Test void contextLoads() { } }
[ "276148155@qq.com" ]
276148155@qq.com
9a38e43def9eebbadac930095530da00cf6d7309
46d628f8181dd809cb4dc76c6ec64266d4421390
/core/src/com/mygdx/game/InputHandler.java
6b1ba19ff7e054b493026c75e637746dcafcc281
[]
no_license
mmunson2/Leaf
23dfc1a6dfc712695b399b73d6924177e2a6d68c
d85f4e6f9f2464f05af26663d508b42f1ab44d9f
refs/heads/master
2021-04-18T17:14:44.709163
2020-08-19T01:50:43
2020-08-19T01:50:43
249,565,886
0
1
null
null
null
null
UTF-8
Java
false
false
3,258
java
package com.mygdx.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; public class InputHandler { public static final int MOVE_PLAYER_UP = Input.Keys.UP; public static final int MOVE_PLAYER_DOWN = Input.Keys.DOWN; public static final int MOVE_PLAYER_LEFT = Input.Keys.LEFT; public static final int MOVE_PLAYER_RIGHT = Input.Keys.RIGHT; public static final int DETACH_CAMERA = Input.Keys.C; public static final int TALK_TO_NPC = Input.Keys.SPACE; public static final int MOVE_CAMERA_UP = Input.Keys.W; public static final int MOVE_CAMERA_DOWN = Input.Keys.S; public static final int MOVE_CAMERA_LEFT = Input.Keys.A; public static final int MOVE_CAMERA_RIGHT = Input.Keys.D; public static Direction getPlayerMovementDirection() { if(Gdx.input.isKeyPressed(MOVE_PLAYER_UP) && Gdx.input.isKeyPressed(MOVE_PLAYER_LEFT)) { return Direction.UP_LEFT; } if(Gdx.input.isKeyPressed(MOVE_PLAYER_UP) && Gdx.input.isKeyPressed(MOVE_PLAYER_RIGHT)) { return Direction.UP_RIGHT; } if(Gdx.input.isKeyPressed(MOVE_PLAYER_DOWN) && Gdx.input.isKeyPressed(MOVE_PLAYER_LEFT)) { return Direction.DOWN_LEFT; } if(Gdx.input.isKeyPressed(MOVE_PLAYER_DOWN) && Gdx.input.isKeyPressed(MOVE_PLAYER_RIGHT)) { return Direction.DOWN_RIGHT; } if(Gdx.input.isKeyPressed(MOVE_PLAYER_UP)) { return Direction.UP; } if(Gdx.input.isKeyPressed(MOVE_PLAYER_DOWN)) { return Direction.DOWN; } if(Gdx.input.isKeyPressed(MOVE_PLAYER_LEFT)) { return Direction.LEFT; } if(Gdx.input.isKeyPressed(MOVE_PLAYER_RIGHT)) { return Direction.RIGHT; } return null; } public static boolean detachCameraToggle() { return Gdx.input.isKeyJustPressed(DETACH_CAMERA); } public static boolean talkToNPC() { return Gdx.input.isKeyJustPressed(TALK_TO_NPC); } public static Direction getCameraMovementDirection() { if(Gdx.input.isKeyPressed(MOVE_CAMERA_UP) && Gdx.input.isKeyPressed(MOVE_CAMERA_LEFT)) { return Direction.UP_LEFT; } if(Gdx.input.isKeyPressed(MOVE_CAMERA_UP) && Gdx.input.isKeyPressed(MOVE_CAMERA_RIGHT)) { return Direction.UP_RIGHT; } if(Gdx.input.isKeyPressed(MOVE_CAMERA_DOWN) && Gdx.input.isKeyPressed(MOVE_CAMERA_LEFT)) { return Direction.DOWN_LEFT; } if(Gdx.input.isKeyPressed(MOVE_CAMERA_DOWN) && Gdx.input.isKeyPressed(MOVE_CAMERA_RIGHT)) { return Direction.DOWN_RIGHT; } if(Gdx.input.isKeyPressed(MOVE_CAMERA_UP)) { return Direction.UP; } if(Gdx.input.isKeyPressed(MOVE_CAMERA_DOWN)) { return Direction.DOWN; } if(Gdx.input.isKeyPressed(MOVE_CAMERA_LEFT)) { return Direction.LEFT; } if(Gdx.input.isKeyPressed(MOVE_CAMERA_RIGHT)) { return Direction.RIGHT; } return null; } }
[ "mmunson11@gmail.com" ]
mmunson11@gmail.com
4036c57a530487d9ca741c19dc73e9abaa60eaa6
93b75c000c411e591dfe2a6ee124bd2ba74c9295
/SimpleAsyncTask/app/src/main/java/com/example/simpleasynctask/MainActivity.java
2cf2cb5ecae60551c5dc5b5b2b855f6d6d22352c
[]
no_license
DennAC99/CS3742021
35875057490a76b589cec11753574505343eb44d
8e393dd9fb30c5fac5f57b2c7adeb049e02d0992
refs/heads/main
2023-06-19T02:35:15.889348
2021-07-12T17:32:07
2021-07-12T17:32:07
374,243,098
0
1
null
null
null
null
UTF-8
Java
false
false
1,022
java
package com.example.simpleasynctask; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity { private TextView mTextView; private static final String TEXT_STATE = "currentText"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTextView = findViewById(R.id.textView1); if (savedInstanceState != null) { mTextView.setText(savedInstanceState.getString(TEXT_STATE)); } } public void startTask(View view) { mTextView.setText(R.string.napping); new SimpleAsyncTask(mTextView).execute(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(TEXT_STATE, mTextView.getText().toString()); } }
[ "dencastel69@gmail.com" ]
dencastel69@gmail.com
b43fc016b30ca200ea3f4eef8a5f74c5cb0ca490
168fcbef49dbe96e6052fbb531e9a2002bacdef1
/Factorial of a number/Main.java
60328f655a6afc936c9bfeb117af9a55ac835df1
[]
no_license
monishaisha/Playground
c8fb5ffa09f8b488f3834f8f3224262530738774
20841ac9d249971a22cfc02b9157fb571705a47f
refs/heads/master
2020-05-18T13:19:45.063517
2019-09-22T12:54:57
2019-09-22T12:54:57
184,435,612
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
import java.util.Scanner; class Main{ public static void main (String[] args){ // Type your code here Scanner sc = new Scanner(System.in); int num = sc.nextInt(); int fact = 1; while(num > 0) { fact = fact * num; num--; } System.out.println(fact); } }
[ "45688414+monishaisha@users.noreply.github.com" ]
45688414+monishaisha@users.noreply.github.com
575623fc4e47f87e1e09e2a1a1007bfb35988657
a5ba7e9f351aeec5de18974f6110ab2bcaa3b868
/KINTO/Kinto_France_Italy/src/test/java/e2eTests/stepdefinitions/milesRia/GlobalMrSteps.java
c7d8913ad01942f613a2cd8150d50934ac075257
[ "Apache-2.0" ]
permissive
ambasonic/KINTO
0481a46907deb9809287e505f18a3ea0d58833eb
63b77476621ab531a9e01e27903f797a427e9c55
refs/heads/master
2022-12-16T16:56:59.827137
2020-09-01T15:05:01
2020-09-01T15:05:01
292,026,730
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
package e2eTests.stepdefinitions.milesRia; import Pages.milesRiaTabs.TopBarTabs; import net.thucydides.core.annotations.Step; public class GlobalMrSteps { TopBarTabs topBarTabs; @Step("The dealer click on save") public void clickOnSaved() { topBarTabs.clickOnSaved(); } @Step("The dealer click on validate") public void clickOnValidate() { topBarTabs.clickOnValidate(); } @Step("The dealer click on approve") public void clickOnApprove() { topBarTabs.clickOnApprove(); } @Step("The dealer click on new invoice") public void clickOnNewInvoice() { topBarTabs.clickOnNewInvoice(); } }
[ "tfred@live.de" ]
tfred@live.de
415d9215a05f9087accbcdd8ff8f53edc20e7bdd
40af9ba91631cf62bafc5e9b453c914a6ca199bc
/src/main/java/team1/deal/service/CreatQuotedPriceService.java
af7a48a1827fc3230ac528ab3d7be431056d093a
[]
no_license
juzi214032/zeus-spring-boot
a321eef8fcd53c06625f393352206d68f513a7b9
edb1ebe4c3f8d38e0b28cc1b39fe7e1ac024e213
refs/heads/master
2022-12-13T02:03:02.335426
2020-08-24T02:29:55
2020-08-24T02:29:55
284,157,184
0
0
null
null
null
null
UTF-8
Java
false
false
464
java
package team1.deal.service; import team1.deal.model.po.QuotedPriceInfoPO; import team1.deal.model.po.SaveQuotedPriceInfoPO; import javax.servlet.http.HttpServletRequest; public interface CreatQuotedPriceService { //创建报价 public void CreatQuotedPrice(HttpServletRequest request, QuotedPriceInfoPO quotedPriceInfoPO); //保存报价 public void SaveQuotedPrice(HttpServletRequest request,SaveQuotedPriceInfoPO saveQuotedPriceInfoPO); }
[ "2413013267@qq.com" ]
2413013267@qq.com
f472acf80172ad4ae51909cbf8f778045baba2ba
6129d63e4db470deb2258c538b3da7068976f0c2
/src/sample/Genetic/Population.java
60c312731469bc39b360835b3c3c81a00e3365f2
[]
no_license
infokomes/smart-forklift
7403dc7f547db53af9a1009fd010ed5a7d7de06c
544aed46fcb134d089d4723c0b4c472e27d45490
refs/heads/master
2021-06-04T23:03:26.975850
2016-09-30T09:17:28
2016-09-30T09:17:28
52,802,606
0
0
null
null
null
null
UTF-8
Java
false
false
1,949
java
package sample.Genetic; public class Population { Individual[] individuals; public Population(int populationSize, boolean initialise) { individuals = new Individual[populationSize]; // Stwórz populację if (initialise) { // Stwórz nowe osobniki for (int i = 0; i < size(); i++) { Individual newIndividual = new Individual(); newIndividual.generateIndividual(); saveIndividual(i, newIndividual); /* newIndividual.generateIndividual("110101101011010"); saveIndividual(0, newIndividual); newIndividual = new Individual(); newIndividual.generateIndividual("101010010100101"); saveIndividual(1, newIndividual); newIndividual = new Individual(); newIndividual.generateIndividual("110010101100100"); saveIndividual(2, newIndividual); newIndividual = new Individual(); newIndividual.generateIndividual("100001100010011"); saveIndividual(3, newIndividual); newIndividual = new Individual(); newIndividual.generateIndividual("001010101100100"); saveIndividual(4, newIndividual);*/ } } } public Individual getIndividual(int index) { return individuals[index]; } public Individual getFittest() { Individual fittest = individuals[0]; // Znajdź najlepiej dopasowane osobniki for (int i = 0; i < size(); i++) { if (fittest.getFitness() <= getIndividual(i).getFitness()) { fittest = getIndividual(i); } } return fittest; } public int size() { return individuals.length; } public void saveIndividual(int index, Individual indiv) { individuals[index] = indiv; } }
[ "ac93912@st.amu.ede.pl" ]
ac93912@st.amu.ede.pl
08fbb8390aa8766d80beba9687810d9d152fff83
60731924123756cca04b8d12441c546e92de6424
/validate2log/src/main/java/com/practice/e2021/validate2log/config/PulsarConfig.java
be75b155e7cc2d3571119aa3962ad8c1b23d4a3c
[ "Apache-2.0" ]
permissive
zero9102/practice
54fad072c9e156fc9af3e7694f26adf408f657f1
5bc13c941c1837b65e6fce950cceeb282ae5c9e4
refs/heads/master
2023-08-11T21:59:00.681542
2021-09-19T19:08:38
2021-09-19T19:08:38
395,160,909
0
0
null
null
null
null
UTF-8
Java
false
false
724
java
package com.practice.e2021.validate2log.config; import com.practice.e2021.validate2log.bean.MessageDTO; import io.github.majusko.pulsar.producer.ProducerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * https://www.jianshu.com/p/6d6fcfff43f0 */ @Configuration public class PulsarConfig { public static final String bootObjTopic = "bootTopic"; public static final String myStringTopic = "myTopic"; // @Bean // public ProducerFactory producerFactory() { // return new ProducerFactory() // .addProducer(bootObjTopic, MessageDTO.class) // .addProducer(myStringTopic, String.class); // } }
[ "chloesnow2019@gmail.com" ]
chloesnow2019@gmail.com
c80f0ff789dcfcfe51b6f4419a37d9e80a30555c
53cf991e92ab6606c89d2c0712286575fa03e70f
/Springworkspace/test44444/src/main/java/kkk/ddd/sdfsdf/HomeController.java
2ee0f47354a371ac711b8b8fed4255f5cf57c3c2
[]
no_license
gwagwagwak/SpringMVCFinalProject
93bbf86ee652e7b5e755400447f2404c4db44a7d
8020d6f2d2f97b9ec1f3c0c9931ae611b570bb53
refs/heads/master
2022-12-22T05:56:28.581249
2019-09-11T02:33:23
2019-09-11T02:33:23
203,471,681
0
0
null
2022-12-16T06:04:43
2019-08-20T23:49:49
Java
UTF-8
Java
false
false
1,076
java
package kkk.ddd.sdfsdf; import java.text.DateFormat; import java.util.Date; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Handles requests for the application home page. */ @Controller public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); /** * Simply selects the home view to render by returning its name. */ @RequestMapping(value = "/", method = RequestMethod.GET) public String home(Locale locale, Model model) { logger.info("Welcome home! The client locale is {}.", locale); Date date = new Date(); DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate ); return "home"; } }
[ "52301302+gwagwagwak@users.noreply.github.com" ]
52301302+gwagwagwak@users.noreply.github.com
c29781ed8c70bdf84024b32a429902672577e832
713fc948f6f96cd107751715f1396200258afdd1
/openbravopos_2.30.2_src/src-appengine-nordpos/src/main/java/mobi/nordpos/retail/action/CategoryImageActionBean.java
f2515c72e3a9915070419da6b3f604d51f4b4d0c
[]
no_license
cclafuente/openbravo-appengine-maven
5464625c4b9fcbc1bd94ad30fcf21a5d6380835c
f6a368d4ba39286df4fcfcfa237507ddeedf99d1
refs/heads/master
2022-12-20T20:53:48.632393
2019-10-08T11:56:56
2019-10-08T11:56:56
68,410,250
1
0
null
2022-12-16T08:16:01
2016-09-16T19:48:36
Java
UTF-8
Java
false
false
2,485
java
/** * Copyright (c) 2012-2015 Nord Trading Network. * * 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 mobi.nordpos.retail.action; import java.sql.SQLException; import javax.servlet.http.HttpServletResponse; import mobi.nordpos.retail.ext.Public; import mobi.nordpos.dao.model.ProductCategory; import net.sourceforge.stripes.action.StreamingResolution; import net.sourceforge.stripes.validation.SimpleError; import net.sourceforge.stripes.validation.ValidationErrors; import net.sourceforge.stripes.validation.ValidationMethod; /** * @author Andrey Svininykh <svininykh@gmail.com> */ @Public public class CategoryImageActionBean extends CategoryBaseActionBean { private int thumbnailSize = 256; public StreamingResolution preview() { return new StreamingResolution("image/jpeg") { @Override public void stream(HttpServletResponse response) throws Exception { if (getCategory().getImage() != null) { response.getOutputStream().write(getCategory().getImageThumbnail(thumbnailSize)); response.flushBuffer(); } } }.setFilename("category-".concat(getCategory().getCode() != null ? getCategory().getCode() : "0000").concat(".jpeg")); } @ValidationMethod(on = "preview") public void validateCategoryIdIsAvalaible(ValidationErrors errors) { try { pcPersist.init(getDataBaseConnection()); ProductCategory category = pcPersist.read(getCategory().getId()); if (category != null) { setCategory(category); } } catch (SQLException ex) { getContext().getValidationErrors().addGlobalError( new SimpleError(ex.getMessage())); } } public int getThumbnailSize() { return thumbnailSize; } public void setThumbnailSize(int thumbnailSize) { this.thumbnailSize = thumbnailSize; } }
[ "carlos.cotelo@lstkco14552.softtek.com" ]
carlos.cotelo@lstkco14552.softtek.com
5a9a0092c1d7fa73bc0ff074072f1661d0da285d
c38671e4959911c35065da60abe8d3ae48b273d5
/app/src/main/java/com/company/android_2/Furniture.java
a5ac62a3ef96efe7aa18330449815bd6b21c38bb
[]
no_license
jenekL/android_2
1096e159ccc2c49535cd2bc979736a6889655aef
dbf820f6322a24b17fe75d038389c31b7ec6562c
refs/heads/master
2020-04-04T20:01:48.744492
2018-11-05T14:36:35
2018-11-05T14:36:35
156,230,953
0
0
null
null
null
null
UTF-8
Java
false
false
1,172
java
package com.company.android_2; public class Furniture { private String name; private String manufacturer; private String material; private String color; private int cost; public Furniture(String name, String manufacturer, String material, String color, int cost) { this.name = name; this.manufacturer = manufacturer; this.material = material; this.color = color; this.cost = cost; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getManufacturer() { return manufacturer; } public void setManufacturer(String manufacturer) { this.manufacturer = manufacturer; } public String getMaterial() { return material; } public void setMaterial(String material) { this.material = material; } public String getColor() { return color; } public void setColor(String color) { color = color; } public int getCost() { return cost; } public void setCost(int cost) { this.cost = cost; } }
[ "jeklom@gmail.com" ]
jeklom@gmail.com
c9b380d27f3c25fe3601b703d65d541e74eaf5b9
37183c5b978cc28004514542b622e3e90be58a95
/Blocks/BlockDeadMachine.java
3bdac9c7176ad65bf0245d7287fc291f6e6d02d4
[]
no_license
ruki260/RotaryCraft
4ae81ce65396965fbab641f054d2f275fb1f0e68
9fa1cbd03bbe2a0793d8a28d8d41de77b1b16fb4
refs/heads/master
2021-01-22T01:50:55.229160
2013-11-16T07:07:01
2013-11-16T07:07:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,189
java
/******************************************************************************* * @author Reika Kalseki * * Copyright 2013 * * All rights reserved. * Distribution of the software in any form is only allowed with * explicit, prior permission from the owner. ******************************************************************************/ package Reika.RotaryCraft.Blocks; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import Reika.DragonAPI.Libraries.ReikaEnchantmentHelper; import Reika.DragonAPI.Libraries.Registry.ReikaItemHelper; import Reika.RotaryCraft.TileEntities.TileEntityDeadMachine; public class BlockDeadMachine extends BlockContainer { public BlockDeadMachine(int ID, Material mat) { super(ID, mat); } @Override public TileEntity createNewTileEntity(World world) { return new TileEntityDeadMachine(); } /* @Override public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int meta, int fortune) { TileEntityDeadMachine te = ((TileEntityDeadMachine)world.getBlockTileEntity(x, y, z)); if (te != null) return te.getDrops(fortune); else { ReikaJavaLibrary.pConsole("NULL on "+FMLCommonHandler.instance().getEffectiveSide()); return null; } }*/ @Override public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) { if (!player.capabilities.isCreativeMode) this.harvestBlock(world, player, x, y, z, 0); return world.setBlock(x, y, z, 0); } @Override public void harvestBlock(World world, EntityPlayer ep, int x, int y, int z, int meta) { TileEntityDeadMachine dead = (TileEntityDeadMachine)world.getBlockTileEntity(x, y, z); ItemStack is = ep.getHeldItem(); int fortune; if (is == null) fortune = 0; else fortune = ReikaEnchantmentHelper.getEnchantmentLevel(Enchantment.fortune, is); if (dead != null) { ReikaItemHelper.dropItems(world, x+0.5, y+0.5, z+0.5, dead.getDrops(fortune)); } } }
[ "reikasminecraft@gmail.com" ]
reikasminecraft@gmail.com
a2ee62ef9814df9e11268b3682af921aa7f9233e
35c8eec665c0b34871024b58c5dba0f00b4e2830
/program/src/test/java/dk/au/cs/dash/test/dash/examples/DartPage214Simplified.java
22cddfbe4e500747895eece823c77a0b82af272d
[ "CC-BY-4.0" ]
permissive
foens/dash
24ee374df51ee22e2bcc8deaa9714d7b7f95991d
d45a044c2854ee6636c1f0a1fab556e56cf185a7
refs/heads/master
2021-01-25T04:52:53.692761
2015-05-02T13:16:50
2015-05-02T13:16:50
12,943,347
2
0
null
null
null
null
UTF-8
Java
false
false
260
java
package dk.au.cs.dash.test.dash.examples; import dk.au.cs.dash.Dash; public class DartPage214Simplified { public static int test(int x, int y) { if (x != y) if (2 * x == x + 10) Dash.error(); return 0; } }
[ "kfoens@gmail.com" ]
kfoens@gmail.com
0c6b667297c8a2c61bf1bf7635046578eefd45c9
17e8438486cb3e3073966ca2c14956d3ba9209ea
/cargo-core-0.9/api/util/src/main/java/org/codehaus/cargo/util/log/FileLogger.java
d3234b8eed89738927431f92747c77ec795c5c6c
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
2,858
java
/* * ======================================================================== * * Copyright 2004-2006 Vincent Massol. * * 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.codehaus.cargo.util.log; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import org.codehaus.cargo.util.CargoException; import org.codehaus.cargo.util.internal.log.AbstractLogger; /** * File implementation which sends logged messages to a file. * * @version $Id$ */ public class FileLogger extends AbstractLogger { /** * The file to log to. */ private FileOutputStream output; /** * Date format used when logging to the file. */ private final DateFormat format = new SimpleDateFormat("HH:mm:ss.SSS"); /** * @param file the file to log to * @param append if true the file is appended to insted of being erased */ public FileLogger(File file, boolean append) { try { this.output = new FileOutputStream(file, append); } catch (FileNotFoundException e) { throw new CargoException("Failed to create file [" + file + "]", e); } } /** * @param file the file to log to * @param append if true the file is appended to insted of being erased */ public FileLogger(String file, boolean append) { this(new File(file), append); } /** * {@inheritDoc} * @see AbstractLogger#doLog(LogLevel, String, String) */ protected void doLog(LogLevel level, String message, String category) { final String formattedCategory = category.length() > 20 ? category.substring(category.length() - 20) : category; final String msg = "[" + this.format.format(new Date()) + "]" + "[" + level.getLevel() + "][" + formattedCategory + "] " + message + "\n"; try { this.output.write(msg.getBytes()); } catch (IOException e) { throw new CargoException("Failed to write log message [" + msg + "]", e); } } }
[ "hhuynh@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
hhuynh@7fc7bbf3-cf45-46d4-be06-341739edd864
fae5c57f1308d7ad79cb087e89ff10c92e58d502
18d447e8e708eb490eff5b9b22881500dc196f66
/lcompil/node/Switch.java
ae2b684cafa14776b93651b4781ead986bb85bbd
[]
no_license
SimonCrouzet/compilationl3-public
2a25604daa36f49ded87c9ed8617d2c352cac926
4fa69aeef16f502b07ace906201f3d5ed13adc72
refs/heads/master
2020-12-20T09:34:20.191202
2020-04-10T20:01:28
2020-04-10T20:01:28
236,029,740
0
0
null
2020-04-10T19:58:47
2020-01-24T15:37:36
Java
UTF-8
Java
false
false
142
java
/* This file was generated by SableCC (http://www.sablecc.org/). */ package lcompil.node; public interface Switch { // Empty body }
[ "simon.crouzet@laposte.net" ]
simon.crouzet@laposte.net
d66aa75f04fcab0c018c463d61f84a66880fe2a1
fe49198469b938a320692bd4be82134541e5e8eb
/scenarios/web/large/gradle/ClassLib050/src/main/java/ClassLib050/Class015.java
1749c0219a2dc710cf8e9a323dcb7679a98b3b66
[]
no_license
mikeharder/dotnet-cli-perf
6207594ded2d860fe699fd7ef2ca2ae2ac822d55
2c0468cb4de9a5124ef958b315eade7e8d533410
refs/heads/master
2022-12-10T17:35:02.223404
2018-09-18T01:00:26
2018-09-18T01:00:26
105,824,840
2
6
null
2022-12-07T19:28:44
2017-10-04T22:21:19
C#
UTF-8
Java
false
false
122
java
package ClassLib050; public class Class015 { public static String property() { return "ClassLib050"; } }
[ "mharder@microsoft.com" ]
mharder@microsoft.com
f8284de513b6798a8174192fb7790c39be4ed76c
028cbe18b4e5c347f664c592cbc7f56729b74060
/v2/admin/mbeanapi-impl/src/java/com/sun/enterprise/management/j2ee/DASJ2EEServerImpl.java
20d39d567595ce40687303427fae8a49815c1981
[]
no_license
dmatej/Glassfish-SVN-Patched
8d355ff753b23a9a1bd9d7475fa4b2cfd3b40f9e
269e29ba90db6d9c38271f7acd2affcacf2416f1
refs/heads/master
2021-05-28T12:55:06.267463
2014-11-11T04:21:44
2014-11-11T04:21:44
23,610,469
1
0
null
null
null
null
UTF-8
Java
false
false
19,373
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can obtain * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt. * Sun designates this particular file as subject to the "Classpath" exception * as provided by Sun in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the License * Header, with the fields enclosed by brackets [] replaced by your own * identifying information: "Portions Copyrighted [year] * [name of copyright owner]" * * Contributor(s): * * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package com.sun.enterprise.management.j2ee; import java.util.Set; import java.util.Map; import javax.management.ObjectName; import javax.management.Notification; import javax.management.NotificationListener; import javax.management.MBeanServer; import javax.management.MBeanInfo; import javax.management.MBeanAttributeInfo; import javax.management.MBeanOperationInfo; import javax.management.MBeanServerConnection; import javax.management.MBeanException; import javax.management.AttributeNotFoundException; import javax.management.InstanceNotFoundException; import javax.management.ReflectionException; import javax.management.MBeanServerInvocationHandler; import com.sun.appserv.management.base.Util; import com.sun.appserv.management.util.misc.GSetUtil; import com.sun.appserv.management.util.jmx.JMXUtil; import com.sun.appserv.management.util.misc.ExceptionUtil; import com.sun.appserv.management.client.ProxyFactory; import com.sun.appserv.management.j2ee.J2EEServer; import com.sun.appserv.management.j2ee.J2EETypes; import com.sun.appserv.management.j2ee.StateManageable; import static com.sun.appserv.management.j2ee.StateManageable.*; import com.sun.appserv.management.j2ee.J2EEServer; import com.sun.enterprise.management.support.Delegate; import com.sun.enterprise.management.support.DummyDelegate; import com.sun.enterprise.management.support.LoaderMBean; import com.sun.enterprise.management.support.QueryMgrImpl; import com.sun.enterprise.management.support.DelegateToMBeanDelegate; import com.sun.enterprise.management.support.oldconfig.OldConfigProxies; import com.sun.enterprise.management.support.oldconfig.OldServersMBean; import com.sun.enterprise.admin.mbeans.DomainStatusMBean; import com.sun.enterprise.admin.mbeans.DomainStatus; import com.sun.enterprise.admin.mbeans.DomainStatusHelper; import com.sun.enterprise.ManagementObjectManager; import com.sun.appserv.management.j2ee.J2EETypes; import com.sun.enterprise.admin.servermgmt.RuntimeStatus; import com.sun.enterprise.admin.common.Status; /** JSR 77 extension representing an Appserver standalone server (non-clustered) Server MBean which will reside on DAS for enabling state management including start() and stop() */ public class DASJ2EEServerImpl extends J2EEServerImpl implements NotificationListener { public DASJ2EEServerImpl( ) { super( J2EETypes.J2EE_SERVER, DummyDelegate.INSTANCE ); } static private final Class[] DOMAIN_STATUS_INTERFACES = new Class[] { DomainStatusMBean.class }; protected DomainStatusMBean getDomainStatus() { DomainStatusMBean domainStatus = null; try { final MBeanServer mbeanServer = getMBeanServer(); final Set<ObjectName> candidates = QueryMgrImpl.queryPatternObjectNameSet( mbeanServer, JMXUtil.newObjectNamePattern( "*", DomainStatusMBean.DOMAIN_STATUS_PROPS ) ); final ObjectName on = GSetUtil.getSingleton( candidates ); domainStatus = (DomainStatusMBean)MBeanServerInvocationHandler. newProxyInstance( mbeanServer, on, DomainStatusMBean.class, false ); } catch (Exception e) { final Throwable rootCause = ExceptionUtil.getRootCause( e ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); } return( domainStatus ); } private boolean remoteServerIsRunning() { return (STATE_RUNNING == getstate()); } private boolean remoteServerIsStartable() { final int cState = getstate(); return (STATE_STOPPED == cState) || (STATE_FAILED == cState); } private boolean remoteServerIsStoppable() { int cState = getstate(); if ((STATE_STARTING == cState) || (STATE_RUNNING == cState) || (STATE_FAILED == cState)) { return true; } else { return false; } } public void handleNotification( final Notification notif , final Object ignore) { final String notifType = notif.getType(); if ( notifType.equals( DomainStatusMBean.SERVER_STATUS_NOTIFICATION_TYPE ) ) { final String serverName = (String) Util.getAMXNotificationValue( notif, DomainStatusMBean.SERVER_NAME_KEY ); //System.out.println( "########## DASJ2EEServerImpl.handleNotification: serverName = " + serverName + ", state = " + getstate() + ": " + com.sun.appserv.management.util.jmx.stringifier.NotificationStringifier.toString(notif) ); if ( serverName.equals( getServerName() ) ) { setDelegate(); } } } private synchronized void setDelegate() { if ( remoteServerIsRunning() ) { //System.out.println( "########## DASJ2EEServerImpl.setDelegate(): remoteServerIsRunning=true"); try { // get the object name for the old jsr77 server mBean com.sun.enterprise.ManagementObjectManager mgmtObjManager = com.sun.enterprise.Switch.getSwitch().getManagementObjectManager(); final String strON = mgmtObjManager.getServerBaseON(false, getServerName()); final MBeanServerConnection remoteConn = getDomainStatus().getServerMBeanServerConnection( getServerName() ); final ObjectName onPattern = new ObjectName(strON + ",*"); final Set<ObjectName> names = JMXUtil.queryNames( remoteConn, onPattern, null); assert( names.size() == 1 ); final ObjectName serverON = GSetUtil.getSingleton( names ); final Delegate delegate = new DelegateToMBeanDelegate( remoteConn, serverON ); setDelegate( delegate ); setstartTime(System.currentTimeMillis()); //System.out.println( "########## DASJ2EEServerImpl.setDelegate(): set delegate to " + serverON); } catch (Exception e) { final Throwable rootCause = ExceptionUtil.getRootCause( e ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); if ( getDelegate() == null ) { setDelegate( DummyDelegate.INSTANCE ); setstartTime(0); } } } else { //System.out.println( "########## DASJ2EEServerImpl.setDelegate(): setting DummyDelegate" ); setDelegate( DummyDelegate.INSTANCE ); setstartTime(0); } } public void preRegisterDone() throws Exception { super.preRegisterDone( ); setstartTime( 0 ); setDelegate(); } protected String getServerName() { return( getSelfName() ); } public boolean isstateManageable() { return true; } final RuntimeStatus getRuntimeStatus(final String serverName ) { final MBeanServer mbeanServer = getMBeanServer(); final OldServersMBean oldServers = OldConfigProxies.getInstance( mbeanServer ).getOldServersMBean( ); final RuntimeStatus status = oldServers.getRuntimeStatus( serverName ); return status; } /** Convert an internal status code to JSR 77 StateManageable state. */ private static int serverStatusCodeToStateManageableState( final int statusCode ) { int state = STATE_FAILED; switch( statusCode ) { default: throw new IllegalArgumentException( "Uknown status code: " + statusCode ); case Status.kInstanceStartingCode: state = STATE_STARTING; break; case Status.kInstanceRunningCode: state = STATE_RUNNING; break; case Status.kInstanceStoppingCode: state = STATE_STOPPING; break; case Status.kInstanceNotRunningCode: state = STATE_STOPPED; break; } return state; } public int getstate() { int state = STATE_STOPPED; try { final int internalStatus = getRuntimeStatus(getServerName()).getStatus().getStatusCode(); state = serverStatusCodeToStateManageableState( internalStatus ); } catch ( final Exception e ) { // not available, must not be running } return state; } public void start() { if ( remoteServerIsStartable() ) { startRemoteServer(); } else { throw new RuntimeException("server is not in a startable state"); } } public void startRecursive() { start(); } /** The DAS is always named "server", or so inquiries suggest */ static final String DAS_SERVER_NAME = "server"; /** Does this particular J2EEServer represent the DAS? */ private boolean isDASJ2EEServer() { return DAS_SERVER_NAME.equals( getName() ); } public void stop() { if ( isDASJ2EEServer() ) { getDelegate().invoke( "stop", (Object[])null, (String[])null); } else if ( remoteServerIsStoppable() ) { stopRemoteServer(); } else { throw new RuntimeException("server is not in a stoppable state"); } } private MBeanInfo mMBeanInfo = null; public synchronized MBeanInfo getMBeanInfo() { // compute the MBeanInfo only once! if ( mMBeanInfo == null ) { final MBeanInfo superMBeanInfo = super.getMBeanInfo(); mMBeanInfo = new MBeanInfo( superMBeanInfo.getClassName(), superMBeanInfo.getDescription(), mergeAttributeInfos(superMBeanInfo.getAttributes(), getMBeanAttributeInfo()), superMBeanInfo.getConstructors(), mergeOperationInfos(superMBeanInfo.getOperations(), getMBeanOperationInfo()), superMBeanInfo.getNotifications() ); } return mMBeanInfo; } // attribute info private MBeanAttributeInfo[] mergeAttributeInfos( MBeanAttributeInfo[] infos1, MBeanAttributeInfo[] infos2 ) { final MBeanAttributeInfo[] infos = new MBeanAttributeInfo[ infos1.length + infos2.length ]; System.arraycopy( infos1, 0, infos, 0, infos1.length ); System.arraycopy( infos2, 0, infos, infos1.length, infos2.length ); return( infos ); } private MBeanAttributeInfo[] getMBeanAttributeInfo() { MBeanAttributeInfo[] dAttributes = new MBeanAttributeInfo[1]; dAttributes[0] = new MBeanAttributeInfo("state", "java.lang.Integer", "server state", true, false, false); return dAttributes; } // operation info private MBeanOperationInfo[] mergeOperationInfos( MBeanOperationInfo[] infos1, MBeanOperationInfo[] infos2 ) { final MBeanOperationInfo[] infos = new MBeanOperationInfo[ infos1.length + infos2.length ]; System.arraycopy( infos1, 0, infos, 0, infos1.length ); System.arraycopy( infos2, 0, infos, infos1.length, infos2.length ); return( infos ); } private MBeanOperationInfo[] getMBeanOperationInfo() { MBeanOperationInfo[] dOperations = new MBeanOperationInfo[3]; dOperations[0] = new MBeanOperationInfo("start", "start server instance", null, "void", MBeanOperationInfo.ACTION); dOperations[1] = new MBeanOperationInfo("stop", "stop server instance", null, "void", MBeanOperationInfo.ACTION); dOperations[2] = new MBeanOperationInfo("startRecursive", "start server instance", null, "void", MBeanOperationInfo.ACTION); return dOperations; } private void startRemoteServer() { try { // get the object name for servers config mBean ObjectName on = DomainStatusHelper.getServersConfigObjectName(); // invoke start method on servers config mBean // get mBean server final MBeanServer server = getMBeanServer(); // form the parameters Object[] params = new Object[1]; params[0] = getServerName(); String[] signature = {"java.lang.String"}; // invoke the start method server.invoke(on, "startServerInstance", params, signature); } catch (javax.management.MalformedObjectNameException mfone) { final Throwable rootCause = ExceptionUtil.getRootCause( mfone ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(mfone); } catch (javax.management.InstanceNotFoundException infe) { final Throwable rootCause = ExceptionUtil.getRootCause( infe ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(infe); } catch (javax.management.MBeanException mbe) { final Throwable rootCause = ExceptionUtil.getRootCause( mbe ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(mbe); } catch (javax.management.ReflectionException rfe) { final Throwable rootCause = ExceptionUtil.getRootCause( rfe ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(rfe); } } private void stopRemoteServer() { try { // get the object name for servers config mBean ObjectName on = DomainStatusHelper.getServersConfigObjectName(); // invoke stop method on servers config mBean // get mBean server final MBeanServer server = getMBeanServer(); // form the parameters Object[] params = new Object[1]; params[0] = getServerName(); String[] signature = {"java.lang.String"}; // invoke the start method server.invoke(on, "stopServerInstance", params, signature); } catch (javax.management.MalformedObjectNameException mfone) { final Throwable rootCause = ExceptionUtil.getRootCause( mfone ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(mfone); } catch (javax.management.InstanceNotFoundException infe) { // in case of PE and DAS // it is desit]rable that the instance be not stopped // hence the log level is fine final Throwable rootCause = ExceptionUtil.getRootCause( infe ); getMBeanLogger().fine( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(infe); } catch (javax.management.MBeanException mbe) { final Throwable rootCause = ExceptionUtil.getRootCause( mbe ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(mbe); } catch (javax.management.ReflectionException rfe) { final Throwable rootCause = ExceptionUtil.getRootCause( rfe ); getMBeanLogger().warning( rootCause.toString() + "\n" + ExceptionUtil.getStackTrace( rootCause ) ); throw new RuntimeException(rfe); } } public boolean getRestartRequired() { // Notification mechanism is broken (reason unknown). Just set it explicitly if not // already set. //System.out.println( "########## DASJ2EEServerImpl.getRestartRequired:" + getServerName() ); if ( getDelegate() == null || getDelegate() == DummyDelegate.INSTANCE ) { setDelegate(); } // there might not be a Delegate. Default to 'true', since a non-running server // must be restarted! boolean required = true; final int state = getstate(); // ensure that these states always return 'true' if ( state == STATE_STOPPED || state == STATE_FAILED || state == STATE_STOPPING ) { required = true; } else { try { final Object result = getDelegate().getAttribute( "restartRequired" ); required = Boolean.valueOf( "" + result ); } catch( AttributeNotFoundException e ) { logWarning( ExceptionUtil.toString(e) ); required = true; } } return required; } }
[ "kohsuke@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5" ]
kohsuke@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5
600f157ef059d9c3d1c1f02dfe81e2011f061277
cead01bdd8316e17d7e99be7b586ed30460a2241
/src/main/java/com/gdin/dzzwsyb/swzzbdbxt/web/model/SubmissionExample.java
ee4d907ff35b9674ce5fccc9d2db114677649ecd
[]
no_license
hegangfeng/swzzbdbxt
070215f84e687d58582fa78db5de8ffce13ece88
90cebdc262841f7d8a953a5492d0ba7e377235e1
refs/heads/master
2020-03-11T18:57:50.792543
2018-04-19T07:51:08
2018-04-19T07:51:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
30,514
java
package com.gdin.dzzwsyb.swzzbdbxt.web.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class SubmissionExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public SubmissionExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(String value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(String value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(String value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(String value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(String value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(String value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdLike(String value) { addCriterion("id like", value, "id"); return (Criteria) this; } public Criteria andIdNotLike(String value) { addCriterion("id not like", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<String> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<String> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(String value1, String value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(String value1, String value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andMsgIdIsNull() { addCriterion("msg_id is null"); return (Criteria) this; } public Criteria andMsgIdIsNotNull() { addCriterion("msg_id is not null"); return (Criteria) this; } public Criteria andMsgIdEqualTo(String value) { addCriterion("msg_id =", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdNotEqualTo(String value) { addCriterion("msg_id <>", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdGreaterThan(String value) { addCriterion("msg_id >", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdGreaterThanOrEqualTo(String value) { addCriterion("msg_id >=", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdLessThan(String value) { addCriterion("msg_id <", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdLessThanOrEqualTo(String value) { addCriterion("msg_id <=", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdLike(String value) { addCriterion("msg_id like", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdNotLike(String value) { addCriterion("msg_id not like", value, "msgId"); return (Criteria) this; } public Criteria andMsgIdIn(List<String> values) { addCriterion("msg_id in", values, "msgId"); return (Criteria) this; } public Criteria andMsgIdNotIn(List<String> values) { addCriterion("msg_id not in", values, "msgId"); return (Criteria) this; } public Criteria andMsgIdBetween(String value1, String value2) { addCriterion("msg_id between", value1, value2, "msgId"); return (Criteria) this; } public Criteria andMsgIdNotBetween(String value1, String value2) { addCriterion("msg_id not between", value1, value2, "msgId"); return (Criteria) this; } public Criteria andTypeIsNull() { addCriterion("type is null"); return (Criteria) this; } public Criteria andTypeIsNotNull() { addCriterion("type is not null"); return (Criteria) this; } public Criteria andTypeEqualTo(Integer value) { addCriterion("type =", value, "type"); return (Criteria) this; } public Criteria andTypeNotEqualTo(Integer value) { addCriterion("type <>", value, "type"); return (Criteria) this; } public Criteria andTypeGreaterThan(Integer value) { addCriterion("type >", value, "type"); return (Criteria) this; } public Criteria andTypeGreaterThanOrEqualTo(Integer value) { addCriterion("type >=", value, "type"); return (Criteria) this; } public Criteria andTypeLessThan(Integer value) { addCriterion("type <", value, "type"); return (Criteria) this; } public Criteria andTypeLessThanOrEqualTo(Integer value) { addCriterion("type <=", value, "type"); return (Criteria) this; } public Criteria andTypeIn(List<Integer> values) { addCriterion("type in", values, "type"); return (Criteria) this; } public Criteria andTypeNotIn(List<Integer> values) { addCriterion("type not in", values, "type"); return (Criteria) this; } public Criteria andTypeBetween(Integer value1, Integer value2) { addCriterion("type between", value1, value2, "type"); return (Criteria) this; } public Criteria andTypeNotBetween(Integer value1, Integer value2) { addCriterion("type not between", value1, value2, "type"); return (Criteria) this; } public Criteria andSituationIsNull() { addCriterion("situation is null"); return (Criteria) this; } public Criteria andSituationIsNotNull() { addCriterion("situation is not null"); return (Criteria) this; } public Criteria andSituationEqualTo(String value) { addCriterion("situation =", value, "situation"); return (Criteria) this; } public Criteria andSituationNotEqualTo(String value) { addCriterion("situation <>", value, "situation"); return (Criteria) this; } public Criteria andSituationGreaterThan(String value) { addCriterion("situation >", value, "situation"); return (Criteria) this; } public Criteria andSituationGreaterThanOrEqualTo(String value) { addCriterion("situation >=", value, "situation"); return (Criteria) this; } public Criteria andSituationLessThan(String value) { addCriterion("situation <", value, "situation"); return (Criteria) this; } public Criteria andSituationLessThanOrEqualTo(String value) { addCriterion("situation <=", value, "situation"); return (Criteria) this; } public Criteria andSituationLike(String value) { addCriterion("situation like", value, "situation"); return (Criteria) this; } public Criteria andSituationNotLike(String value) { addCriterion("situation not like", value, "situation"); return (Criteria) this; } public Criteria andSituationIn(List<String> values) { addCriterion("situation in", values, "situation"); return (Criteria) this; } public Criteria andSituationNotIn(List<String> values) { addCriterion("situation not in", values, "situation"); return (Criteria) this; } public Criteria andSituationBetween(String value1, String value2) { addCriterion("situation between", value1, value2, "situation"); return (Criteria) this; } public Criteria andSituationNotBetween(String value1, String value2) { addCriterion("situation not between", value1, value2, "situation"); return (Criteria) this; } public Criteria andReasonIsNull() { addCriterion("reason is null"); return (Criteria) this; } public Criteria andReasonIsNotNull() { addCriterion("reason is not null"); return (Criteria) this; } public Criteria andReasonEqualTo(String value) { addCriterion("reason =", value, "reason"); return (Criteria) this; } public Criteria andReasonNotEqualTo(String value) { addCriterion("reason <>", value, "reason"); return (Criteria) this; } public Criteria andReasonGreaterThan(String value) { addCriterion("reason >", value, "reason"); return (Criteria) this; } public Criteria andReasonGreaterThanOrEqualTo(String value) { addCriterion("reason >=", value, "reason"); return (Criteria) this; } public Criteria andReasonLessThan(String value) { addCriterion("reason <", value, "reason"); return (Criteria) this; } public Criteria andReasonLessThanOrEqualTo(String value) { addCriterion("reason <=", value, "reason"); return (Criteria) this; } public Criteria andReasonLike(String value) { addCriterion("reason like", value, "reason"); return (Criteria) this; } public Criteria andReasonNotLike(String value) { addCriterion("reason not like", value, "reason"); return (Criteria) this; } public Criteria andReasonIn(List<String> values) { addCriterion("reason in", values, "reason"); return (Criteria) this; } public Criteria andReasonNotIn(List<String> values) { addCriterion("reason not in", values, "reason"); return (Criteria) this; } public Criteria andReasonBetween(String value1, String value2) { addCriterion("reason between", value1, value2, "reason"); return (Criteria) this; } public Criteria andReasonNotBetween(String value1, String value2) { addCriterion("reason not between", value1, value2, "reason"); return (Criteria) this; } public Criteria andMeasureIsNull() { addCriterion("measure is null"); return (Criteria) this; } public Criteria andMeasureIsNotNull() { addCriterion("measure is not null"); return (Criteria) this; } public Criteria andMeasureEqualTo(String value) { addCriterion("measure =", value, "measure"); return (Criteria) this; } public Criteria andMeasureNotEqualTo(String value) { addCriterion("measure <>", value, "measure"); return (Criteria) this; } public Criteria andMeasureGreaterThan(String value) { addCriterion("measure >", value, "measure"); return (Criteria) this; } public Criteria andMeasureGreaterThanOrEqualTo(String value) { addCriterion("measure >=", value, "measure"); return (Criteria) this; } public Criteria andMeasureLessThan(String value) { addCriterion("measure <", value, "measure"); return (Criteria) this; } public Criteria andMeasureLessThanOrEqualTo(String value) { addCriterion("measure <=", value, "measure"); return (Criteria) this; } public Criteria andMeasureLike(String value) { addCriterion("measure like", value, "measure"); return (Criteria) this; } public Criteria andMeasureNotLike(String value) { addCriterion("measure not like", value, "measure"); return (Criteria) this; } public Criteria andMeasureIn(List<String> values) { addCriterion("measure in", values, "measure"); return (Criteria) this; } public Criteria andMeasureNotIn(List<String> values) { addCriterion("measure not in", values, "measure"); return (Criteria) this; } public Criteria andMeasureBetween(String value1, String value2) { addCriterion("measure between", value1, value2, "measure"); return (Criteria) this; } public Criteria andMeasureNotBetween(String value1, String value2) { addCriterion("measure not between", value1, value2, "measure"); return (Criteria) this; } public Criteria andOwnerIdIsNull() { addCriterion("owner_id is null"); return (Criteria) this; } public Criteria andOwnerIdIsNotNull() { addCriterion("owner_id is not null"); return (Criteria) this; } public Criteria andOwnerIdEqualTo(Long value) { addCriterion("owner_id =", value, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdNotEqualTo(Long value) { addCriterion("owner_id <>", value, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdGreaterThan(Long value) { addCriterion("owner_id >", value, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdGreaterThanOrEqualTo(Long value) { addCriterion("owner_id >=", value, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdLessThan(Long value) { addCriterion("owner_id <", value, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdLessThanOrEqualTo(Long value) { addCriterion("owner_id <=", value, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdIn(List<Long> values) { addCriterion("owner_id in", values, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdNotIn(List<Long> values) { addCriterion("owner_id not in", values, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdBetween(Long value1, Long value2) { addCriterion("owner_id between", value1, value2, "ownerId"); return (Criteria) this; } public Criteria andOwnerIdNotBetween(Long value1, Long value2) { addCriterion("owner_id not between", value1, value2, "ownerId"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedIsNull() { addCriterion("superior_verify_passed is null"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedIsNotNull() { addCriterion("superior_verify_passed is not null"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedEqualTo(Integer value) { addCriterion("superior_verify_passed =", value, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedNotEqualTo(Integer value) { addCriterion("superior_verify_passed <>", value, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedGreaterThan(Integer value) { addCriterion("superior_verify_passed >", value, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedGreaterThanOrEqualTo(Integer value) { addCriterion("superior_verify_passed >=", value, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedLessThan(Integer value) { addCriterion("superior_verify_passed <", value, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedLessThanOrEqualTo(Integer value) { addCriterion("superior_verify_passed <=", value, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedIn(List<Integer> values) { addCriterion("superior_verify_passed in", values, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedNotIn(List<Integer> values) { addCriterion("superior_verify_passed not in", values, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedBetween(Integer value1, Integer value2) { addCriterion("superior_verify_passed between", value1, value2, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifyPassedNotBetween(Integer value1, Integer value2) { addCriterion("superior_verify_passed not between", value1, value2, "superiorVerifyPassed"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdIsNull() { addCriterion("superior_verifi_user_id is null"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdIsNotNull() { addCriterion("superior_verifi_user_id is not null"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdEqualTo(Long value) { addCriterion("superior_verifi_user_id =", value, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdNotEqualTo(Long value) { addCriterion("superior_verifi_user_id <>", value, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdGreaterThan(Long value) { addCriterion("superior_verifi_user_id >", value, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdGreaterThanOrEqualTo(Long value) { addCriterion("superior_verifi_user_id >=", value, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdLessThan(Long value) { addCriterion("superior_verifi_user_id <", value, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdLessThanOrEqualTo(Long value) { addCriterion("superior_verifi_user_id <=", value, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdIn(List<Long> values) { addCriterion("superior_verifi_user_id in", values, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdNotIn(List<Long> values) { addCriterion("superior_verifi_user_id not in", values, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdBetween(Long value1, Long value2) { addCriterion("superior_verifi_user_id between", value1, value2, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andSuperiorVerifiUserIdNotBetween(Long value1, Long value2) { addCriterion("superior_verifi_user_id not between", value1, value2, "superiorVerifiUserId"); return (Criteria) this; } public Criteria andStatusIsNull() { addCriterion("status is null"); return (Criteria) this; } public Criteria andStatusIsNotNull() { addCriterion("status is not null"); return (Criteria) this; } public Criteria andStatusEqualTo(Integer value) { addCriterion("status =", value, "status"); return (Criteria) this; } public Criteria andStatusNotEqualTo(Integer value) { addCriterion("status <>", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThan(Integer value) { addCriterion("status >", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThanOrEqualTo(Integer value) { addCriterion("status >=", value, "status"); return (Criteria) this; } public Criteria andStatusLessThan(Integer value) { addCriterion("status <", value, "status"); return (Criteria) this; } public Criteria andStatusLessThanOrEqualTo(Integer value) { addCriterion("status <=", value, "status"); return (Criteria) this; } public Criteria andStatusIn(List<Integer> values) { addCriterion("status in", values, "status"); return (Criteria) this; } public Criteria andStatusNotIn(List<Integer> values) { addCriterion("status not in", values, "status"); return (Criteria) this; } public Criteria andStatusBetween(Integer value1, Integer value2) { addCriterion("status between", value1, value2, "status"); return (Criteria) this; } public Criteria andStatusNotBetween(Integer value1, Integer value2) { addCriterion("status not between", value1, value2, "status"); return (Criteria) this; } public Criteria andSendTimeIsNull() { addCriterion("send_time is null"); return (Criteria) this; } public Criteria andSendTimeIsNotNull() { addCriterion("send_time is not null"); return (Criteria) this; } public Criteria andSendTimeEqualTo(Date value) { addCriterion("send_time =", value, "sendTime"); return (Criteria) this; } public Criteria andSendTimeNotEqualTo(Date value) { addCriterion("send_time <>", value, "sendTime"); return (Criteria) this; } public Criteria andSendTimeGreaterThan(Date value) { addCriterion("send_time >", value, "sendTime"); return (Criteria) this; } public Criteria andSendTimeGreaterThanOrEqualTo(Date value) { addCriterion("send_time >=", value, "sendTime"); return (Criteria) this; } public Criteria andSendTimeLessThan(Date value) { addCriterion("send_time <", value, "sendTime"); return (Criteria) this; } public Criteria andSendTimeLessThanOrEqualTo(Date value) { addCriterion("send_time <=", value, "sendTime"); return (Criteria) this; } public Criteria andSendTimeIn(List<Date> values) { addCriterion("send_time in", values, "sendTime"); return (Criteria) this; } public Criteria andSendTimeNotIn(List<Date> values) { addCriterion("send_time not in", values, "sendTime"); return (Criteria) this; } public Criteria andSendTimeBetween(Date value1, Date value2) { addCriterion("send_time between", value1, value2, "sendTime"); return (Criteria) this; } public Criteria andSendTimeNotBetween(Date value1, Date value2) { addCriterion("send_time not between", value1, value2, "sendTime"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "hp@hp-PC" ]
hp@hp-PC
5f448d2b9f0ab89d46f6ffa61f9a5271ddc9d7c1
c12acdb374d2261c3f2b2d25f3baea59fc6ebcfb
/pagingtest/src/main/java/com/example/pagingtest/Api.java
39302d221b37aa7620ed60065703de02f9071322
[]
no_license
Zzy2016/AndroidStudy
082d4080a36aa8e5dfe1a4d708987ef5fa330038
afb2182b49d6a11ecc17a7afa3bd45486958697f
refs/heads/master
2023-02-11T23:54:29.358128
2021-01-13T11:00:18
2021-01-13T11:00:18
309,599,080
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package com.example.pagingtest; import retrofit2.Call; import retrofit2.http.GET; public interface Api { @GET("users?page=1&pagesize=6&site=stackoverflow") Call<ListBean> getList(); }
[ "906922090@qq.com" ]
906922090@qq.com
7255503a879f2b50d9bf8b7cb3d755a3f621465e
63ff181da51f6cfccc04d48c7070debff8d70982
/Pptips/app/src/main/java/com/ppamy/pptips/util/DataUtils.java
71a91acac8700009287a7736c6e88481b64e169e
[]
no_license
hefrank/pptips
fc5999097ab3073d11151ea8a6c4687d4b9086bb
a7a6b46309bba09e97a7d2c1df5f6d5e99800bdd
refs/heads/master
2021-01-01T03:48:01.334313
2016-10-03T02:21:42
2016-10-03T02:21:42
59,349,846
0
0
null
null
null
null
UTF-8
Java
false
false
5,104
java
package com.ppamy.pptips.util; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.List; import java.util.Set; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; /** * 数据备份和用户信息存储工具类 * * @author caizhiping */ public class DataUtils { static final String TAG = "DataUtils"; public static String CHARSET = "utf-8"; // for locale backup file name public static final int DEFAULT_BUFFER_SIZE = 8192; /** * 判断是否为空字符串 * * @param str * @return */ public static boolean isEmpty(CharSequence str) { return str == null || str.length() == 0 || "null".equalsIgnoreCase(str.toString()); } /** * 判断List是否为空 * * @param list * @return */ public static boolean isEmpty(List<?> list) { if (list != null && list.size() > 0) { return false; } return true; } public static boolean isEmpty(Set<?> set) { if (set != null && set.size() > 0) { return false; } return true; } public static boolean isEmpty(Iterable<?> iterable) { if (iterable != null && iterable.iterator().hasNext()) { return false; } return true; } public static byte[] Zip(byte[] input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream zipOutputSteam = null; InputStream inputStream = null; try { zipOutputSteam = new GZIPOutputStream(baos); inputStream = new BufferedInputStream(new ByteArrayInputStream(input), DEFAULT_BUFFER_SIZE); int len; byte[] buffer = new byte[4096]; while ((len = inputStream.read(buffer)) != -1) { zipOutputSteam.write(buffer, 0, len); } } catch (Exception ex) { ex.printStackTrace(); return null; } finally { try { if (inputStream != null) { inputStream.close(); } if (zipOutputSteam != null) { zipOutputSteam.close(); } baos.close(); } catch (Exception ex) { } } return baos.toByteArray(); } public static byte[] UnZip(byte[] input) { GZIPInputStream zis = null; ByteArrayOutputStream baos = null; try { zis = new GZIPInputStream(new ByteArrayInputStream(input)); baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count; while ((count = zis.read(buffer)) != -1) { baos.write(buffer, 0, count); } } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (zis != null) { zis.close(); } if (baos != null) { baos.close(); } } catch (Exception ex) { } } byte[] outData = null; if (baos != null) { outData = baos.toByteArray(); } return outData; } /** * 对关键字符串进行简单的异或加密,避免被反编译后出现大量明文字符串 * * @param content 待加密的字符串 * @param key 加密密钥 * @return 加密后的字符串 */ public static String xorDecrypt(String content, String key) { if (content == null || key == null) { return ""; } char[] contents = content.toCharArray(); char[] keys = key.toCharArray(); StringBuilder result = new StringBuilder(); char xorKey = 0; char xorResult = 0; for (int i = 0, j = 0; i < contents.length; i++) { if (j < keys.length - 1) { xorKey = keys[j]; j++; } else { xorKey = (char) (keys[0] + (char) i); } xorResult = (char) (contents[i] ^ xorKey); result.append(xorResult); } return result.toString(); } /** * 解密 * * @param content * @param key * @return */ public static char[] xorEncrypt(String content, String key) { if (content == null || key == null) { return "".toCharArray(); } char[] contents = content.toCharArray(); char[] keys = key.toCharArray(); char[] result = new char[contents.length]; char xorKey = 0; for (int i = 0, j = 0; i < contents.length; i++) { if (j < keys.length - 1) { xorKey = keys[j]; j++; } else { xorKey = (char) (keys[0] + (char) i); } result[i] = (char) (contents[i] ^ xorKey); } return result; } }
[ "he_frank@163.com" ]
he_frank@163.com
1f781d245d905081850ec4dabf05d112169fad72
64c39387d690bc3061d4cf8db2f2334cd1c5beeb
/src/main/java/com/namespace/security/jwt/HeaderTokenClient.java
bca837938673e253c1e589556676f25a093a7971
[ "Apache-2.0" ]
permissive
aerovulpe/Spring4-MYSQL-boilerplate
41bd747d95d907744b63563e8ae8699b3797ac7c
ccf168d94fec949dedd960377c422483dea0e221
refs/heads/master
2020-12-24T19:37:00.300518
2016-06-10T09:51:46
2016-06-10T09:51:46
56,647,003
0
0
null
2016-04-29T10:24:18
2016-04-20T01:59:21
Java
UTF-8
Java
false
false
951
java
package com.namespace.security.jwt; import org.pac4j.core.client.DirectClientV2; import org.pac4j.core.context.WebContext; import org.pac4j.core.credentials.TokenCredentials; import org.pac4j.core.credentials.authenticator.TokenAuthenticator; import org.pac4j.core.profile.CommonProfile; import org.pac4j.core.util.CommonHelper; /** * Created by Aaron on 22/04/2016. */ public class HeaderTokenClient extends DirectClientV2<TokenCredentials, CommonProfile> { private String tokenName; public HeaderTokenClient(final String tokenName, final TokenAuthenticator tokenAuthenticator) { this.tokenName = tokenName; setAuthenticator(tokenAuthenticator); } @Override protected void internalInit(final WebContext context) { CommonHelper.assertNotBlank("tokenName", this.tokenName); setCredentialsExtractor(new HeaderTokenExtractor(tokenName, getName())); super.internalInit(context); } }
[ "aerisvulpe@gmail.com" ]
aerisvulpe@gmail.com
ddbb482c6331bb555ed50eba6217f3e443d81d35
64557b31271afdc9511bff7799d178e9ae40410d
/emperor/src/main/java/com/wktx/www/emperor/apiresult/mine/store/StoreData.java
597998b29171fcfa073e923c2f7550f08c789988
[]
no_license
yyj1204/junchenlun
d62e79f7e7773301b2798fc28eada3660ef0ee03
d4670b1c0702f25817bfe86649f199de3e0e8845
refs/heads/master
2020-04-08T01:24:13.675127
2018-11-24T01:34:56
2018-11-24T01:36:49
158,893,389
0
0
null
null
null
null
UTF-8
Java
false
false
1,074
java
package com.wktx.www.emperor.apiresult.mine.store; /** * Created by yyj on 2018/2/8. * 店铺信息 * { * "ret": 200,"msg": "", * "data": { * "code":0,"msg":"", * "info":{"id": "4","bgap": "1","bgat": "1","shop_logo":"","shop_name": "编辑2", * "shop_url": "1","tow_name": "美工","bgat_name": "服装内衣"} * } * } */ public class StoreData { private int code; private String msg; private StoreInfoData info; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public StoreInfoData getInfo() { return info; } public void setInfo(StoreInfoData info) { this.info = info; } @Override public String toString() { return "StoreData{" + "code=" + code + ", msg='" + msg + '\'' + ", info=" + info + '}'; } }
[ "1036303629@qq.com" ]
1036303629@qq.com
bb3fa5ac2b66d8cf2ee4cec44d6c61876f5bac4e
facaa5dfcdb29d4aa24f8a8eb3955fad9edcc2d4
/src/main/java/com/apap/tugas1/service/JabatanServiceImpl.java
09573fdfaf0c5300c18822b4f8f5c35fa2396714
[]
no_license
Apap-2018/tugas1_1606874570
e38d6dfe9d84809321575f82a9a21814a1407931
c524974309ba4d5b72e685bc3f3475cce1a77ef5
refs/heads/master
2020-04-01T13:30:07.320030
2018-10-19T16:19:40
2018-10-19T16:19:40
153,255,188
0
0
null
null
null
null
UTF-8
Java
false
false
1,234
java
package com.apap.tugas1.service; import java.util.List; import java.util.Optional; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.apap.tugas1.model.JabatanModel; import com.apap.tugas1.repository.JabatanDb; @Service @Transactional public class JabatanServiceImpl implements JabatanService { @Autowired private JabatanDb jabatanDb; @Override public void addJabatan(JabatanModel jabatan) { jabatanDb.save(jabatan); } @Override public void deleteJabatan(JabatanModel jabatan) { jabatanDb.delete(jabatan); } @Override public void updateJabatan(JabatanModel jabatan) { jabatanDb.save(jabatan); } @Override public JabatanModel getJabatanDetailById(Long id) { return jabatanDb.findJabatanById(id); } @Override public List<JabatanModel> findAllJabatan() { return jabatanDb.findAll(); } @Override public void updateJabatan(Long id_jabatan, JabatanModel jabatan) { JabatanModel oldJabatan = this.getJabatanDetailById(id_jabatan); oldJabatan.setDeskripsi(jabatan.getDeskripsi()); oldJabatan.setNama(jabatan.getNama()); oldJabatan.setGajiPokok(jabatan.getGajiPokok()); } }
[ "deboradian09@gmail.com" ]
deboradian09@gmail.com
631f948b80a6f11b90a8c6637b76af9be69f64dc
70977638a2a3f6860e7887be32bb58adea71f2f2
/kalkulator/src/kalkulator/Parser.java
15c32ac972adc243a99400d2c304a19dd653a294
[]
no_license
MonikaDjordjevic/Calculator
77e4d21927d99e671892e9baaee3f6d7e1520915
43613e3fc07d9e5b1f6cb9ebdb98bf1dc4fb3b00
refs/heads/master
2021-01-22T21:45:02.919951
2017-03-19T16:12:15
2017-03-19T16:12:15
85,468,355
0
1
null
null
null
null
UTF-8
Java
false
false
857
java
package kalkulator; import java.lang.String; public class Parser{ public static Evaluable parse(String napis){ napis = napis.replaceAll("\\s+", ""); napis = napis.replaceAll("\\s+", ""); String[] parts = napis.split("(?<=\\+)|(?=\\+)|(?<=-)|(?=-)|(?<=\\*)|(?=\\*)|(?<=/)|(?=/)"); if(parts.length == 1) return new Singleton(parts[0]); Evaluable result = Factory.createEquotation(parts[1], parts[0], parts[2]); for(int i = 3; i < parts.length; i+=2){ String op = parts[i]; String number = parts[i+1]; result = result.addRightOperation(op, number); } return result; } public static Problem[] parseArray(String[] arr){ Problem[] result = new Problem[arr.length]; for(int i = 0; i < arr.length; i++){ result[i] = new Problem(arr[i]); } return result; } }
[ "Monika@calculator" ]
Monika@calculator
48e143ad6acd5d0030119a55ac75c9a221022f03
6659df4dc8a47571b450547ffaaa14f2cf45d418
/src/com/example/onemap/TaskDataBaseToMap.java
44abe4f4ab139f47b01e6291cc662fd73e77379e
[]
no_license
yanlang13/oneMap
5074e6ecb0aa05dfbef95d7e4750e2eb9c2924ed
3c030eaa952a79bf668bebcdff98f6dcbb20bec8
refs/heads/master
2021-01-12T15:08:10.737528
2014-08-12T08:52:44
2014-08-12T08:52:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,538
java
package com.example.onemap; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import org.apache.commons.io.FileUtils; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.PolygonOptions; import android.R.plurals; import android.content.Context; import android.os.AsyncTask; import android.util.Log; public class TaskDataBaseToMap extends AsyncTask<Context, Void, HashMap<String, PolygonOptions>> { private final static String LINE_WIDTH = "lineWidth"; private final static String COLOR_MODE = "colorMode"; private final static String POLY_COLOR = "polyColor"; private final static String LINE_COLOR = "lineColor"; private final static String COORDINATES = "coordinates"; private DBHelper dbHelper; private HashMap<String, PolygonOptions> pos; @Override protected HashMap<String, PolygonOptions> doInBackground(Context... params) { Context context = params[0]; dbHelper = new DBHelper(context); pos = new HashMap<String, PolygonOptions>(); // 抓database裡面的layers // List<Layer> layers = dbHelper.getAllLayer(); List<PlaceMark> placeMarks = dbHelper.getDisplayPlaceMark(); for (PlaceMark pm : placeMarks) { String styleLink = pm.getStyleLink(); try { URL url = new URL(styleLink); File file = new File(url.toURI()); String jsonString = FileUtils.readFileToString(file); JSONObject json = new JSONObject(jsonString); json.getString(COLOR_MODE); String coordinates = json.getString(COORDINATES); ArrayList<LatLng> latLngs = OtherTools .transCoorStringToLatLngs(coordinates); PolygonOptions po = new PolygonOptions(); po.addAll(latLngs); po.fillColor(json.getInt(POLY_COLOR)); po.strokeColor(json.getInt(LINE_COLOR)); po.strokeWidth(json.getInt(LINE_WIDTH)); String key = pm.getPlaceMarkName(); pos.put(key, po); } catch (MalformedURLException e) { Log.d("mdb", "DataBaseToMap.class: " + e.toString()); } catch (IOException e) { Log.d("mdb", "DataBaseToMap.class: " + e.toString()); } catch (URISyntaxException e) { Log.d("mdb", "DataBaseToMap.class: " + e.toString()); }// end of try }// end of for if (dbHelper != null) { dbHelper.close(); } Log.d("mdb", "=====end of databaseToMap"); return pos; }// end of doInBackground }// end of DataBaseToMap
[ "@" ]
@
8f639784cd8c826e915510fe312ef8370dac3bd2
4659c2c3e7d8f5e85d1b1248134fc9cf802a2a14
/flink-1.12.0-Demo/src/main/java/com/shangbaishuyao/demo/FlinkDemo06/Flink08_State_Backend.java
b48a4619f960dcac522e0712bc9707426c630db6
[ "Apache-2.0" ]
permissive
corersky/flink-learning-from-zhisheng
e68dfad1f91196d8cfeaaa0014fce7c55cb66847
9765eaee0e2cf49d2a925d8d55ebc069f9bdcda1
refs/heads/main
2023-05-14T07:12:49.610363
2021-06-06T15:21:17
2021-06-06T15:21:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,025
java
package com.shangbaishuyao.demo.FlinkDemo06; import org.apache.flink.contrib.streaming.state.RocksDBStateBackend; import org.apache.flink.runtime.state.filesystem.FsStateBackend; import org.apache.flink.runtime.state.memory.MemoryStateBackend; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import java.io.IOException; /** * Author: shangbaishuyao * Date: 0:23 2021/4/23 * Desc: 状态后端保存的位置 */ public class Flink08_State_Backend { public static void main(String[] args) throws IOException { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); //定义状态后端,保存状态的位置 env.setStateBackend(new MemoryStateBackend()); env.setStateBackend(new FsStateBackend("hdfs:hadoop102:8020/shangbaishuyao/ck")); env.setStateBackend(new RocksDBStateBackend("hdfs:hadoop102:8020/shangbaishuyao/ck")); //开启CK env.getCheckpointConfig().enableUnalignedCheckpoints(); } }
[ "shangbaishuyao@163.com" ]
shangbaishuyao@163.com
10b414e6b430d1dcb7e8a80c2a1e276ba8adf5a4
83a29d9d1324d0768d587c12aab8e278d0e89400
/app/src/interview/java/aron/demo/ndk/NDKActivity.java
08affed706101c9217f8d2fc924f56a17b800584
[]
no_license
liuwenrong/Demo4Roger
b2fc9080c44bad1d9a28a4d9a40262b65e91c928
a771c64e9d7311191e6469e039692a6eafb1386e
refs/heads/master
2020-03-16T21:40:16.388847
2019-04-24T06:37:54
2019-04-24T06:39:20
133,009,326
0
0
null
null
null
null
UTF-8
Java
false
false
4,530
java
package aron.demo.ndk; import android.content.Context; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; import android.view.SurfaceHolder; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import com.roger.demo4roger.R; import aron.demo.IPC.Demo; import aron.demo.binary.BinaryLogicFunction; import aron.demo.memoryOpt.FinalizeCase; import aron.demo.safeThread.SafeThreadDemo; import aron.demo.surfaceview.SurfaceViewTemplate; public class NDKActivity extends AppCompatActivity { private Context mContext; private static final String TAG = "Main"; private View.OnClickListener mOnClickErase = new View.OnClickListener() { @Override public void onClick(View v) { if (mSurfaceView != null) { mSurfaceView.setEraser(); mBtnErase.setText(mSurfaceView.isEraser() ? "橡皮擦" : "画笔"); } try { FinalizeCase.testGc(null); } catch (Exception e) { e.printStackTrace(); } // Demo.testServicePrint(); // createSurfaceView(); } }; public SurfaceViewTemplate mSurfaceView; private View.OnClickListener mClear = new View.OnClickListener() { @Override public void onClick(View v) { if (mSurfaceView != null) { mSurfaceView.reDraw(); } } }; public Button mBtnErase; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; setContentView(R.layout.activity_main); EditText editCopy = findViewById(R.id.edit_copy); String strFromNDK = NDKTools.getStringFromNDK(); editCopy.setText(strFromNDK); BinaryLogicFunction.test(); mSurfaceView = findViewById(R.id.surface_view); mBtnErase = findViewById(R.id.btn_erase); mBtnErase.setOnClickListener(mOnClickErase); Button btnClear = findViewById(R.id.btn_clear); btnClear.setOnClickListener(mClear); Demo.testBindService(this); } public void onClickCopy(View view) { // SafeThreadDemo.testInteger(); SafeThreadDemo.testIntegerVolatile(); // SafeThreadDemo.testIntegerAtomic(); // SafeThreadDemo.testIntegerSynchronized(); } /** * 新建一个surfaceView */ private void createSurfaceView() { //生成一个新的surface view mSurfaceView = new SurfaceViewTemplate(mContext); mSurfaceView.getHolder().addCallback(new LmnSurfaceCallback()); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT , 800/*LinearLayout.LayoutParams.MATCH_PARENT*/, Gravity.TOP); mSurfaceView.setLayoutParams(layoutParams); this.addContentView(mSurfaceView, layoutParams); /* WindowManager windowManager =(WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; layoutParams.format = PixelFormat.TRANSLUCENT; int screenWidth = Device.getScreenMinSize(); int screenHeight = Device.getScreenMaxSize(); layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; layoutParams.height = 600; layoutParams.gravity = Gravity.LEFT | Gravity.TOP; layoutParams.x = (int) (22f/1072*screenWidth); layoutParams.y = (int) (140f/1448*screenHeight); windowManager.addView(surfaceView, layoutParams); // permission denied for this window type*/ } /** * surfaceView的监听器 */ private class LmnSurfaceCallback implements SurfaceHolder.Callback { @Override public void surfaceCreated(SurfaceHolder holder) { } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { //surfaceview创建成功后,加载视频 } @Override public void surfaceDestroyed(SurfaceHolder holder) { } } }
[ "liuwenrong@zhangyue.com" ]
liuwenrong@zhangyue.com
c28ddd8a109bc1ea3fb4e61c7bcc1ebb0e3bdcce
40f8a37bbe8dd567106c90f13300bce75ea6c6fc
/AORMS/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/loader/R.java
ab6206c9ef1ca31edad88a53fd382c375ff31475
[]
no_license
m-abdullah-aziz/Kitchen-Module
d0ed900023af04232a3791ce1122a0d9f592620d
cc9ae748c2df24369bca1eb909aebf6dc6c789df
refs/heads/master
2023-09-04T04:30:32.173326
2019-11-30T19:57:15
2019-11-30T19:57:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,446
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.loader; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f040027; public static final int font = 0x7f0400e3; public static final int fontProviderAuthority = 0x7f0400e5; public static final int fontProviderCerts = 0x7f0400e6; public static final int fontProviderFetchStrategy = 0x7f0400e7; public static final int fontProviderFetchTimeout = 0x7f0400e8; public static final int fontProviderPackage = 0x7f0400e9; public static final int fontProviderQuery = 0x7f0400ea; public static final int fontStyle = 0x7f0400eb; public static final int fontVariationSettings = 0x7f0400ec; public static final int fontWeight = 0x7f0400ed; public static final int ttcIndex = 0x7f04021c; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f060076; public static final int notification_icon_bg_color = 0x7f060077; public static final int ripple_material_light = 0x7f060082; public static final int secondary_text_default_material_light = 0x7f060084; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f070056; public static final int compat_button_inset_vertical_material = 0x7f070057; public static final int compat_button_padding_horizontal_material = 0x7f070058; public static final int compat_button_padding_vertical_material = 0x7f070059; public static final int compat_control_corner_material = 0x7f07005a; public static final int compat_notification_large_icon_max_height = 0x7f07005b; public static final int compat_notification_large_icon_max_width = 0x7f07005c; public static final int notification_action_icon_size = 0x7f0700c9; public static final int notification_action_text_size = 0x7f0700ca; public static final int notification_big_circle_margin = 0x7f0700cb; public static final int notification_content_margin_start = 0x7f0700cc; public static final int notification_large_icon_height = 0x7f0700cd; public static final int notification_large_icon_width = 0x7f0700ce; public static final int notification_main_column_padding_top = 0x7f0700cf; public static final int notification_media_narrow_margin = 0x7f0700d0; public static final int notification_right_icon_size = 0x7f0700d1; public static final int notification_right_side_padding_top = 0x7f0700d2; public static final int notification_small_icon_background_padding = 0x7f0700d3; public static final int notification_small_icon_size_as_large = 0x7f0700d4; public static final int notification_subtext_size = 0x7f0700d5; public static final int notification_top_pad = 0x7f0700d6; public static final int notification_top_pad_large_text = 0x7f0700d7; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f08008c; public static final int notification_bg = 0x7f08008d; public static final int notification_bg_low = 0x7f08008e; public static final int notification_bg_low_normal = 0x7f08008f; public static final int notification_bg_low_pressed = 0x7f080090; public static final int notification_bg_normal = 0x7f080091; public static final int notification_bg_normal_pressed = 0x7f080092; public static final int notification_icon_background = 0x7f080093; public static final int notification_template_icon_bg = 0x7f080094; public static final int notification_template_icon_low_bg = 0x7f080095; public static final int notification_tile_bg = 0x7f080096; public static final int notify_panel_notification_icon_bg = 0x7f080097; } public static final class id { private id() {} public static final int action_container = 0x7f09002e; public static final int action_divider = 0x7f090030; public static final int action_image = 0x7f090031; public static final int action_text = 0x7f090037; public static final int actions = 0x7f090038; public static final int async = 0x7f090040; public static final int blocking = 0x7f090044; public static final int chronometer = 0x7f090059; public static final int forever = 0x7f090083; public static final int icon = 0x7f09008a; public static final int icon_group = 0x7f09008b; public static final int info = 0x7f09008f; public static final int italic = 0x7f090091; public static final int line1 = 0x7f090098; public static final int line3 = 0x7f090099; public static final int normal = 0x7f0900aa; public static final int notification_background = 0x7f0900ab; public static final int notification_main_column = 0x7f0900ac; public static final int notification_main_column_container = 0x7f0900ad; public static final int right_icon = 0x7f0900c1; public static final int right_side = 0x7f0900c2; public static final int tag_transition_group = 0x7f0900f5; public static final int tag_unhandled_key_event_manager = 0x7f0900f6; public static final int tag_unhandled_key_listeners = 0x7f0900f7; public static final int text = 0x7f0900f8; public static final int text2 = 0x7f0900f9; public static final int time = 0x7f090101; public static final int title = 0x7f090102; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f0a000f; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0c003d; public static final int notification_action_tombstone = 0x7f0c003e; public static final int notification_template_custom_big = 0x7f0c003f; public static final int notification_template_icon_group = 0x7f0c0040; public static final int notification_template_part_chronometer = 0x7f0c0041; public static final int notification_template_part_time = 0x7f0c0042; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0e0044; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0f0119; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f011a; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f011b; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f011c; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f011d; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01c6; public static final int Widget_Compat_NotificationActionText = 0x7f0f01c7; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f040027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0400e5, 0x7f0400e6, 0x7f0400e7, 0x7f0400e8, 0x7f0400e9, 0x7f0400ea }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400e3, 0x7f0400eb, 0x7f0400ec, 0x7f0400ed, 0x7f04021c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "abdullahaziz1998@gmail.com" ]
abdullahaziz1998@gmail.com
4d81e1ffe59f370328a14403e7c93fc150880502
4921d45f6a1eadfe71eb23d3a7c7de41c8df8fb5
/src/com/company/ISortAlgorithm.java
dda0dc916689b60319f6b898c4ecfc396d9ea1ff
[]
no_license
gargVader/Algo-Viz
41c7bc4789f39862fcc9b9bf4298f924b0a97fa9
148292ce6a8dc8ef611b5901e7cb4111ccfc933e
refs/heads/main
2023-04-16T18:23:48.698576
2021-05-04T14:10:36
2021-05-04T14:10:36
364,242,924
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.company; /** * Base Interface for sorting algorithms */ public interface ISortAlgorithm { public void runSort(SortArray array); }
[ "girishgargcool@gmail.com" ]
girishgargcool@gmail.com
6a976bed1bcfcb85d828f5199ccbd1fe81feda2b
c23543bbd3e45c648f4fccac38dc8474e755065e
/src/codingpark/net/cheesecloud/view/photoview/PageIndicator.java
125e85bf56a691a2ebdd3ff3744d8474d48a93ff
[]
no_license
fangjingfeng/cheese
2bc1b3cef0ce255f432ae64a85fa160419ce0087
922a06c2e90c3ed49c34e3fca9829c372370b858
refs/heads/master
2021-01-20T12:10:38.031824
2015-06-10T08:43:17
2015-06-10T08:43:17
35,271,114
0
0
null
null
null
null
UTF-8
Java
false
false
1,892
java
/* * Copyright (C) 2011 Patrik Akerfeldt * Copyright (C) 2011 Jake Wharton * * 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 codingpark.net.cheesecloud.view.photoview; /** * A PageIndicator is responsible to show an visual indicator on the total views * number and the current visible view. */ public interface PageIndicator extends HackyViewPager.OnPageChangeListener { /** * Bind the indicator to a ViewPager. * * @param view */ void setViewPager(HackyViewPager view); /** * Bind the indicator to a ViewPager. * * @param view * @param initialPosition */ void setViewPager(HackyViewPager view, int initialPosition); /** * <p>Set the current page of both the ViewPager and indicator.</p> * * <p>This <strong>must</strong> be used if you need to set the page before * the views are drawn on screen (e.g., default start page).</p> * * @param item */ void setCurrentItem(int item); /** * Set a page change listener which will receive forwarded events. * * @param listener */ void setOnPageChangeListener(HackyViewPager.OnPageChangeListener listener); /** * Notify the indicator that the fragment list has changed. */ void notifyDataSetChanged(); }
[ "123@computer" ]
123@computer
80f0edfcb5db1a9b5b0f19544eb98c1b34a311f9
e947cf88ce73c8d0db01d170539e989f631728f3
/framework.uwt.swing/src/org/plazmaforge/framework/uwt/swing/adapter/SwingTableItemAdapter.java
f08d6a87c30249e712da85e27608335631bc6ec7
[]
no_license
codeclimate-testing/java-plazma
8537f572229253c6a28f0bc58b32d8ad619b9929
d2f343564cd59882e43b1a1efede7a3b403e2bdb
refs/heads/master
2021-01-21T05:36:14.105653
2017-09-05T21:38:32
2017-09-05T21:38:32
101,927,837
0
1
null
2017-10-19T13:15:00
2017-08-30T20:53:58
Java
UTF-8
Java
false
false
1,690
java
/* * Copyright (C) 2012-2013 Oleh Hapon ohapon@users.sourceforge.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Oleh Hapon * Kyiv, UKRAINE * ohapon@users.sourceforge.net */ package org.plazmaforge.framework.uwt.swing.adapter; import org.plazmaforge.framework.uwt.UIObject; import org.plazmaforge.framework.uwt.swing.adapter.viewer.SwingTableModel; import org.plazmaforge.framework.uwt.widget.table.TableItem; @Deprecated public class SwingTableItemAdapter extends SwingWidgetAdapter { @Override public Object createDelegate(UIObject parent, UIObject element) { /* javax.swing.JTable xParent = getJTable(parent.getDelegate()); TableItem tableItem = (TableItem) element; // We use DefaultTableModel only SwingTableModel tableModel = (SwingTableModel) xParent.getModel(); tableModel.addRow(tableItem.getItemText()); // Return null because JTable has not implementation of row/item */ return null; } }
[ "abaldwinhunter@codeclimate.com" ]
abaldwinhunter@codeclimate.com
11fe305aed1007029602e18ea2df4c675cb42ef6
80fb9045832155daf17894aab6620f5d9cb991d6
/crm/src/main/java/com/yang/crm/workbench/domain/ClueRemark.java
748aa9a5b0ac127aea63ba9907ca557a9d615e60
[]
no_license
Poeticyang/CRM
387a983a68439cc2df6f2999d5c40a2af4c82eae
95556540abcf032623c6b8c47e2d9c4276d26719
refs/heads/master
2023-04-19T22:10:29.874659
2021-05-02T13:39:51
2021-05-02T13:39:51
363,659,182
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package com.yang.crm.workbench.domain; public class ClueRemark { private String id; private String noteContent; private String createBy; private String createTime; private String editBy; private String editTime; private String editFlag; private String clueId; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNoteContent() { return noteContent; } public void setNoteContent(String noteContent) { this.noteContent = noteContent; } public String getCreateBy() { return createBy; } public void setCreateBy(String createBy) { this.createBy = createBy; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getEditBy() { return editBy; } public void setEditBy(String editBy) { this.editBy = editBy; } public String getEditTime() { return editTime; } public void setEditTime(String editTime) { this.editTime = editTime; } public String getEditFlag() { return editFlag; } public void setEditFlag(String editFlag) { this.editFlag = editFlag; } public String getClueId() { return clueId; } public void setClueId(String clueId) { this.clueId = clueId; } }
[ "yang@poetic.com" ]
yang@poetic.com
b4b5ff91068992fb0a9cbe3b6d31c6ea48ff5bb0
7bfaf06a90d9b72b8b26c396c36a1b896693150f
/java/src/NBIAExample1.java
e302baaf32aefb004f057811b97b872803758f0c
[]
no_license
cpatrick/NBIA-Exploration
c3ae589ab4013b438ed10a80762323087a6802db
8ba6cb56feaf25758a40108c9e8831117dc08143
refs/heads/master
2016-09-11T07:27:14.823833
2010-11-24T15:49:55
2010-11-24T15:49:55
1,103,781
0
0
null
null
null
null
UTF-8
Java
false
false
2,898
java
import gov.nih.nci.ivi.utils.ZipEntryInputStream; import gov.nih.nci.cagrid.ncia.client.NCIACoreServiceClient; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.EOFException; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.rmi.RemoteException; import java.util.zip.ZipInputStream; import org.apache.axis.types.URI.MalformedURIException; import org.cagrid.transfer.context.client.TransferServiceContextClient; import org.cagrid.transfer.context.client.helper.TransferClientHelper; import org.cagrid.transfer.context.stubs.types.TransferServiceContextReference; public class NBIAExample1 { static final String gridServiceUrl = "http://imaging.nci.nih.gov/wsrf/services/cagrid/NCIACoreService"; static final String clientDownLoadLocation = "NBIAGridClientDownload"; public static void main( String args[] ) throws Exception { String seriesInstanceUID = "1.3.6.1.4.1.9328.50.1.8862"; NCIACoreServiceClient client = new NCIACoreServiceClient( gridServiceUrl ); TransferServiceContextReference tscr = client.retrieveDicomDataBySeriesUID( seriesInstanceUID ); TransferServiceContextClient tclient = new TransferServiceContextClient( tscr.getEndpointReference() ); InputStream istream = TransferClientHelper.getData( tclient.getDataTransferDescriptor() ); if( istream == null ) { System.out.println( "istream is null" ); return; } ZipInputStream zis = new ZipInputStream(istream); ZipEntryInputStream zeis = null; BufferedInputStream bis = null; String unzzipedFile = downloadLocation(); while(true) { try { zeis = new ZipEntryInputStream( zis ); } catch( EOFException e ) { break; } bis = new BufferedInputStream(zeis); byte[] data = new byte[8192]; int bytesRead = 0; BufferedOutputStream bos = new BufferedOutputStream( new FileOutputStream( unzzipedFile + File.separator + zeis.getName() ) ); while( ( bytesRead = ( bis.read( data, 0, data.length ) ) ) > 0 ) { bos.write( data, 0, bytesRead ); } bos.flush(); bos.close(); } zis.close(); tclient.destroy(); } private static String downloadLocation() { String localClient= System.getProperty( "java.io.tmpdir" ) + File.separator + clientDownLoadLocation; if( !new File( localClient ).exists() ) { new File( localClient ).mkdir(); } System.out.println( "Local download location: " + localClient ); return localClient; } }
[ "cpreynolds@gmail.com" ]
cpreynolds@gmail.com
e366395412c0b20411899a48971c75f9eb479399
a6e2cd9ea01bdc5cfe58acce25627786fdfe76e9
/src/main/java/com/alipay/api/domain/AlipayOpenAppLingbalingliuQueryModel.java
87cc97ccd14b05aecefa6328204cee44bc97c395
[ "Apache-2.0" ]
permissive
cc-shifo/alipay-sdk-java-all
38b23cf946b73768981fdeee792e3dae568da48c
938d6850e63160e867d35317a4a00ed7ba078257
refs/heads/master
2022-12-22T14:06:26.961978
2020-09-23T04:00:10
2020-09-23T04:00:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * yufayanzheng * * @author auto create * @since 1.0, 2018-08-16 12:02:08 */ public class AlipayOpenAppLingbalingliuQueryModel extends AlipayObject { private static final long serialVersionUID = 1311134529664893534L; /** * 12 */ @ApiField("canshu") private String canshu; public String getCanshu() { return this.canshu; } public void setCanshu(String canshu) { this.canshu = canshu; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
8f3990aa68f7141adbc31a9b1b827e6150a0fb61
19f08b5c8ca37fa86714effcba1822e9bbe8b99c
/src/main/java/edu/bu/met/cs665/hardware/PowerBrew5000.java
79495f9acf019759a438ad783b584e38079c5012
[]
no_license
jeffreydalby/PowerBrew
c68a80715e38a4c4104c43a0e5602f756860cdfa
eb6fb7bcb8c941b91c559ae7a095a4e70188f328
refs/heads/master
2020-04-05T04:46:01.377151
2018-07-13T19:07:37
2018-07-13T19:09:08
156,565,796
0
0
null
null
null
null
UTF-8
Java
false
false
5,048
java
package edu.bu.met.cs665.hardware; import edu.bu.met.cs665.brew.Beverages.BeverageChoices; import edu.bu.met.cs665.condiments.Condiments; import java.util.Map; //hardware controller for the PowerBrew5000 public class PowerBrew5000 implements Runnable { //The PowerBrew5000 consists of three major hardware components private final ConcentrateInjector concentrateInjector = new ConcentrateInjector(); private final CondimentInjector condimentInjector = new CondimentInjector(); private final Heater heater = new Heater(); //flag to let us know that either a condiment or concentrate is out. //not super user friendly cause if anything is out we shut the whole machine down. public static boolean isNeedsToBeServiced() { return needsToBeServiced; } private static boolean needsToBeServiced; //we want external resourse to access hardware componenets via the PowerBrew5000 public double getWaterTankCurrentTemp() { return heater.getWaterTankCurrentTemp(); } //target temp and min temp taken from ideal temps to serve hot beverages found at //https://www.littlecoffeeplace.com/coffee-ideal-temperature //this is just here to simulate a heating light on the machine, at the moment it is just //running in the background. Let's other packages check if the heater is on public boolean isHeating() { return heater.isHeating(); } public void setHeating(boolean heating) { heater.setHeating(heating); } public PowerBrew5000() { //initialize concentrate levels concentrateInjector.initializeConcentrateLevels(); //initialize the Condiment levels condimentInjector.initializeCondimentLevels(); } /** * Turn on the machine and heat up the water */ public void powerOn() { System.out.println("Initialize PowerBrew5000....please wait (CTRL-C to Power Down)"); heater.initialHeat(); } /** * allows outside object to add concentrate * * @param beverageChoice - which beverage concentrate to add * @param percentToAdd - percentage concentrate to add */ public void addConcentrate(BeverageChoices beverageChoice, double percentToAdd) { concentrateInjector.addConcentrate(beverageChoice, percentToAdd); } /** * allows external object to add condiments (sugar, milk) * * @param condimentChoice- type of condiment to add * @param quantityToAdd- quantity of condiment to add */ public void addCondiment(Condiments.CondimentChoices condimentChoice, int quantityToAdd) { condimentInjector.addCondiment(condimentChoice, quantityToAdd); } //background process that keeps the PowerBrew5000 running @Override public void run() { //maps to trak low beverages and condiments Map<BeverageChoices, Double> lowConcentrate; Map<Condiments.CondimentChoices, Integer> lowCondiments; //loop that is running continuously to keep water heated and check concentrate levels while (true) { //exit if our thread gets shut down if (Thread.currentThread().isInterrupted()) break; //check concentrate levels and warn if low lowConcentrate = concentrateInjector.getLowConcentrateLevels(); if (!lowConcentrate.isEmpty()) { lowConcentrate.forEach((concentrate, level) -> System.out.println(concentrate.toString() + " concentrate is at " + level.toString() + "%, Shutting down to be refilled.")); needsToBeServiced = true; break; } //check condiment levels and warn if low lowCondiments = condimentInjector.getLowCondimentLevels(); if (!lowCondiments.isEmpty()) { lowCondiments.forEach((condiment, level) -> System.out.println("There are only " + level.toString() + condiment.toString() + " left, Shutting down to be refilled.")); needsToBeServiced = true; break; } //check heat levels and heat until at ideal temp if (heater.getWaterTankCurrentTemp() <= Heater.WATER_MIN_TEMP) { while (heater.getWaterTankCurrentTemp() < Heater.WATER_TARGET_TEMP) { //no need to keep heating...exit if our thread gets shut down if (Thread.currentThread().isInterrupted()) break; this.heater.setHeating(true); DelayTimer.sleeper(300); heater.heatWaterTank(3); } } //set heating to false unless we are actually in the heating loop this.heater.setHeating(false); //each time through this loop the water temp drops by .1 degrees which essentially will turn the heater on every minute and 15 seconds. heater.decreaseWaterTemp(.1); //sleep for half a second DelayTimer.sleeper(500); } } }
[ "jdalby@dalbydigital.com" ]
jdalby@dalbydigital.com
bb4159415d2f1e9cd401569911f4026f8e74e667
75342c43fc9861145cf5130fee581c434b331a94
/java_agent/agent-framework/agent-internal/src/main/java/io/agent/internal/jmx/Metric.java
30f47424a2edea2486606893601ed194b2dae526
[ "Apache-2.0" ]
permissive
sushantanshu/syscop
bafd41e4489df67edc1a3515eaa32106c93f4df8
fde76073d56865b2027ecdbdee15c290fffe5594
refs/heads/master
2020-04-30T21:25:22.307797
2019-03-22T07:34:46
2019-03-22T07:34:46
177,092,704
1
0
null
null
null
null
UTF-8
Java
false
false
959
java
package io.agent.internal.jmx; import io.prometheus.client.Collector; import java.util.HashMap; import java.util.Map; public class Metric implements MetricMBean { private final Collector metric; Metric(Collector metric) { this.metric = metric; } /** * @see MetricMBean#getValues() */ @Override public Map<Map<String, String>, Double> getValues() { Map<Map<String, String>, Double> result = new HashMap<>(); for (Collector.MetricFamilySamples samples : metric.collect()) { for (Collector.MetricFamilySamples.Sample sample : samples.samples) { Map<String, String> labels = new HashMap<>(); for (int i = 0; i < sample.labelNames.size(); i++) { labels.put(sample.labelNames.get(i), sample.labelValues.get(i)); } result.put(labels, sample.value); } } return result; } }
[ "anshu.sushant@gmail.com" ]
anshu.sushant@gmail.com
bf15437ba9166b77553c14798914aac441b9aedf
b90f4957583485b9b3ab3a315b00fda1ebc83854
/src/main/java/stdlib/StdArrayIO.java
15b82410448f526a629c83084fa8aecc1005dc4e
[ "MIT" ]
permissive
gjgj821/fortress
c7b54b100544f5ae66281eb394c467541b36c1ce
aa498347826fbf2f9c5b357d115574ac5296bada
refs/heads/master
2020-05-22T08:05:18.503891
2016-09-28T03:35:25
2016-09-28T03:35:25
62,225,694
0
0
null
null
null
null
UTF-8
Java
false
false
7,100
java
package stdlib; /****************************************************************************** * Compilation: javac StdArrayIO.java * Execution: java StdArrayIO < input.txt * Dependencies: StdOut.java * * A library for reading in 1D and 2D arrays of integers, doubles, * and booleans from standard input and printing them out to * standard output. * * % more tinyDouble1D.txt * 4 * .000 .246 .222 -.032 * * % more tinyDouble2D.txt * 4 3 * .000 .270 .000 * .246 .224 -.036 * .222 .176 .0893 * -.032 .739 .270 * * % more tinyBoolean2D.txt * 4 3 * 1 1 0 * 0 0 0 * 0 1 1 * 1 1 1 * * % cat tinyDouble1D.txt tinyDouble2D.txt tinyBoolean2D.txt | java StdArrayIO * 4 * 0.00000 0.24600 0.22200 -0.03200 * * 4 3 * 0.00000 0.27000 0.00000 * 0.24600 0.22400 -0.03600 * 0.22200 0.17600 0.08930 * 0.03200 0.73900 0.27000 * * 4 3 * 1 1 0 * 0 0 0 * 0 1 1 * 1 1 1 * ******************************************************************************/ /** * <i>Standard array IO</i>. This class provides methods for reading * in 1D and 2D arrays from standard input and printing out to * standard output. * <p> * For additional documentation, see * <a href="http://introcs.cs.princeton.edu/22libary">Section 2.2</a> of * <i>Introduction to Programming in Java: An Interdisciplinary Approach</i> * by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class StdArrayIO { // it doesn't make sense to instantiate this class private StdArrayIO() { } /** * Reads a 1D array of doubles from standard input and returns it. * * @return the 1D array of doubles */ public static double[] readDouble1D() { int n = StdIn.readInt(); double[] a = new double[n]; for (int i = 0; i < n; i++) { a[i] = StdIn.readDouble(); } return a; } /** * Prints an array of doubles to standard output. * * @param a the 1D array of doubles */ public static void print(double[] a) { int n = a.length; StdOut.println(n); for (int i = 0; i < n; i++) { StdOut.printf("%9.5f ", a[i]); } StdOut.println(); } /** * Reads a 2D array of doubles from standard input and returns it. * * @return the 2D array of doubles */ public static double[][] readDouble2D() { int m = StdIn.readInt(); int n = StdIn.readInt(); double[][] a = new double[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { a[i][j] = StdIn.readDouble(); } } return a; } /** * Prints the 2D array of doubles to standard output. * * @param a the 2D array of doubles */ public static void print(double[][] a) { int m = a.length; int n = a[0].length; StdOut.println(m + " " + n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { StdOut.printf("%9.5f ", a[i][j]); } StdOut.println(); } } /** * Reads a 1D array of integers from standard input and returns it. * * @return the 1D array of integers */ public static int[] readInt1D() { int n = StdIn.readInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = StdIn.readInt(); } return a; } /** * Prints an array of integers to standard output. * * @param a the 1D array of integers */ public static void print(int[] a) { int n = a.length; StdOut.println(n); for (int i = 0; i < n; i++) { StdOut.printf("%9d ", a[i]); } StdOut.println(); } /** * Reads a 2D array of integers from standard input and returns it. * * @return the 2D array of integers */ public static int[][] readInt2D() { int m = StdIn.readInt(); int n = StdIn.readInt(); int[][] a = new int[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { a[i][j] = StdIn.readInt(); } } return a; } /** * Print a 2D array of integers to standard output. * * @param a the 2D array of integers */ public static void print(int[][] a) { int m = a.length; int n = a[0].length; StdOut.println(m + " " + n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { StdOut.printf("%9d ", a[i][j]); } StdOut.println(); } } /** * Reads a 1D array of booleans from standard input and returns it. * * @return the 1D array of booleans */ public static boolean[] readBoolean1D() { int n = StdIn.readInt(); boolean[] a = new boolean[n]; for (int i = 0; i < n; i++) { a[i] = StdIn.readBoolean(); } return a; } /** * Prints a 1D array of booleans to standard output. * * @param a the 1D array of booleans */ public static void print(boolean[] a) { int n = a.length; StdOut.println(n); for (int i = 0; i < n; i++) { if (a[i]) StdOut.print("1 "); else StdOut.print("0 "); } StdOut.println(); } /** * Reads a 2D array of booleans from standard input and returns it. * * @return the 2D array of booleans */ public static boolean[][] readBoolean2D() { int m = StdIn.readInt(); int n = StdIn.readInt(); boolean[][] a = new boolean[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { a[i][j] = StdIn.readBoolean(); } } return a; } /** * Prints a 2D array of booleans to standard output. * * @param a the 2D array of booleans */ public static void print(boolean[][] a) { int m = a.length; int n = a[0].length; StdOut.println(m + " " + n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (a[i][j]) StdOut.print("1 "); else StdOut.print("0 "); } StdOut.println(); } } /** * Unit tests <tt>StdArrayIO</tt>. */ public static void main(String[] args) { // read and print an array of doubles double[] a = StdArrayIO.readDouble1D(); StdArrayIO.print(a); StdOut.println(); // read and print a matrix of doubles double[][] b = StdArrayIO.readDouble2D(); StdArrayIO.print(b); StdOut.println(); // read and print a matrix of doubles boolean[][] d = StdArrayIO.readBoolean2D(); StdArrayIO.print(d); StdOut.println(); } }
[ "372290258@qq.com" ]
372290258@qq.com
a5383f8c0bf4c2e388348a820fca9a67eee46089
87a6b0ce9b1b4f1e4214201094af189f7ed22a09
/src/main/java/seedu/address/logic/parser/DeleteGroupCommandParser.java
cfeb0c822fec0c33865fabc71588fd368f8adc15
[ "MIT" ]
permissive
CS2103JAN2018-W15-B3/main
817082009f743f3f6d914e13aa66a875092a3a7e
f32f34190f6f32080e5f25f1a7f1ad19f7b25c20
refs/heads/master
2021-01-24T16:51:47.538569
2018-04-15T15:04:21
2018-04-15T15:04:21
123,213,098
0
10
null
2018-04-15T14:55:51
2018-02-28T01:48:04
Java
UTF-8
Java
false
false
1,203
java
//@@author jas5469 package seedu.address.logic.parser; import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import seedu.address.commons.exceptions.IllegalValueException; import seedu.address.logic.commands.DeleteGroupCommand; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.group.Information; /** * Parses input arguments and creates a new DeleteGroupCommand object */ public class DeleteGroupCommandParser implements Parser<DeleteGroupCommand> { /** * Parses the given {@code String} of arguments in the context of the DeleteGroupCommand * and returns an DeleteGroupCommand object for execution. * @throws ParseException if the user input does not conform the expected format */ public DeleteGroupCommand parse(String args) throws ParseException { try { Information information = ParserUtil.parseInformation(args); return new DeleteGroupCommand(information); } catch (IllegalValueException ive) { throw new ParseException( String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteGroupCommand.MESSAGE_USAGE)); } } }
[ "jas_p90@hotmail.com" ]
jas_p90@hotmail.com
ba9d988d82b349560be67af822b7ae684077477b
74cc54d86698511e4b2441acfa39f998cedf22ec
/src/main/java/guru/springframework/spring5webapp/bootstrap/BootStrapData.java
0e580dfc4ad0d399798872b0f257590d6dcab8e0
[]
no_license
DisterDE/spring5webapp
4d206d7e9b24f3255617aff0b35ebb32f695f20a
a6af32c4489e547ade78949b5fdd3c39bf961aac
refs/heads/master
2023-05-26T17:30:20.515537
2021-06-17T21:58:24
2021-06-17T21:58:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,465
java
package guru.springframework.spring5webapp.bootstrap; import guru.springframework.spring5webapp.domain.Author; import guru.springframework.spring5webapp.domain.Book; import guru.springframework.spring5webapp.domain.Publisher; import guru.springframework.spring5webapp.repositories.AuthorRepository; import guru.springframework.spring5webapp.repositories.BookRepository; import guru.springframework.spring5webapp.repositories.PublisherRepository; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @Component public class BootStrapData implements CommandLineRunner { private final AuthorRepository authorRepository; private final BookRepository bookRepository; private final PublisherRepository publisherRepository; public BootStrapData( AuthorRepository authorRepository, BookRepository bookRepository, PublisherRepository publisherRepository ) { this.authorRepository = authorRepository; this.bookRepository = bookRepository; this.publisherRepository = publisherRepository; } @Override public void run(String... args) { System.out.println("Started in Bootstrap"); Publisher publisher = new Publisher(); publisher.setName("SFG Publishing"); publisher.setCity("St Petersburg"); publisher.setState("FL"); publisherRepository.save(publisher); System.out.println("Publisher Count: " + publisherRepository.count()); Author eric = new Author("Eric", "Evans"); Book ddd = new Book("Domain Driven Design", "123123"); eric.getBooks().add(ddd); ddd.getAuthors().add(eric); publisher.getBooks().add(ddd); ddd.setPublisher(publisher); authorRepository.save(eric); bookRepository.save(ddd); publisherRepository.save(publisher); Author rod = new Author("Rod", "Johnson"); Book noEJB = new Book("J2EE Development without EJB", "3939459459"); rod.getBooks().add(noEJB); noEJB.getAuthors().add(rod); publisher.getBooks().add(noEJB); noEJB.setPublisher(publisher); authorRepository.save(rod); bookRepository.save(noEJB); publisherRepository.save(publisher); System.out.println("Number of Books: " + bookRepository.count()); System.out.println("Publisher Number of Books: " + publisher.getBooks().size()); } }
[ "disterko@gmail.com" ]
disterko@gmail.com
81e24d20d64b08bc4a75a6c2ecda87f90e4739ff
baec75be6af4d0401693e82e1f5535235ed3cc87
/src/leetcode/_0070_ClimbingStairs.java
756a301ae78c748710d454a8fea939cc3490d04b
[]
no_license
dadnotorc/orgrammar
50afc792cb34084a52c8392388c0160b5ad3696c
a83d807c8c3d4fc1a4b8ec3c8456e500f7da8908
refs/heads/master
2023-04-27T19:24:15.779140
2023-04-20T20:22:12
2023-04-20T20:22:12
199,028,816
0
0
null
null
null
null
UTF-8
Java
false
false
3,246
java
package leetcode; import org.junit.Test; /** * 70. Climbing Stairs * Easy * #DP * * You are climbing a staircase. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. * In how many distinct ways can you climb to the top? * * Note: Given n will be a positive integer. * * Example 1: * Input: 2 * Output: 2 * Explanation: There are two ways to climb to the top. * 1. 1 step + 1 step (方法1 - 每次走 1 步, 共走两 2 次) * 2. 2 steps (方法2 - 每次走 2 步, 只走 1 次) * * Example 2: * Input: 3 * Output: 3 * Explanation: There are three ways to climb to the top. * 1. 1 step + 1 step + 1 step * 2. 1 step + 2 steps * 3. 2 steps + 1 step */ public class _0070_ClimbingStairs { /* 这里要搞清楚题意, 问的是到达每格有多少种不同的走法, 而不是最少用多少步 0 层 -> 1种方法, 就是不走 1 层 -> 1种方法, 走一步 2 层 -> 2种办法: - 从第 0 层, 走两格 - 从第 1 层, 走一格 所以 dp[2] = dp[0] + dp[1] 3 层 -> dp[1] + dp[2] = 1 + 2 = 3 n 层 -> dp[n - 2] + dp[n - 1] 因为是从 0 层 到 n 层, 所以 dp array 长度 为 n + 1 */ /** * 简化 - 因为 dp[n] = dp[n - 2] + dp[n - 1] * 我们只需要记录 3 个临时函数, t2, t1 和 t0 对应上面的 3 个值 * 时间 O(n), 空间 O(1) */ public int climbStairs(int n) { /* 可以省略 if (n < 2) { return 1; }*/ int t0 = 1; int t1 = 1; int t2 = 0; // 这里不能不赋值, 否则会报错, t2 未被初始化 for (int i = 2; i <= n; i++) { // 注意 这里是 <= n, 而不是 < 0, 因为是 从 0 到 n , 共 n + 1 层 t2 = t0 + t1; t0 = t1; t1 = t2; } return t1; // 如果省略了开头的特判, 这里就不能返回 t2, 而必须返回 t1 } /** * 使用 array - 每格表示到达当前格, 共有多少种办法 , 长度为 n + 1, * * 时间 O(n) * 空间 O(n) */ public int climbStairs_array(int n) { if (n < 2) { return 1; } int[] dp = new int[n+1]; dp[0] = 1; dp[1] = 1; for (int i = 2; i <= n; i++) { dp[i] = dp[i-1] + dp[i-2]; } return dp[n]; } @Test public void test0() { org.junit.Assert.assertEquals(1, climbStairs(0)); org.junit.Assert.assertEquals(1, climbStairs(1)); org.junit.Assert.assertEquals(2, climbStairs(2)); org.junit.Assert.assertEquals(3, climbStairs(3)); org.junit.Assert.assertEquals(5, climbStairs(4)); org.junit.Assert.assertEquals(1, climbStairs_array(0)); org.junit.Assert.assertEquals(1, climbStairs_array(1)); org.junit.Assert.assertEquals(2, climbStairs_array(2)); org.junit.Assert.assertEquals(3, climbStairs_array(3)); org.junit.Assert.assertEquals(5, climbStairs_array(4)); } @Test public void test1() { org.junit.Assert.assertEquals(14930352, climbStairs(35)); org.junit.Assert.assertEquals(14930352, climbStairs_array(35)); } }
[ "dadnotorc@gmail.com" ]
dadnotorc@gmail.com
26246b688cf17009e8bae5a8eeb3073d31dd9090
affdf69805beea5efcfed609ca451f05e3ec1eed
/alian-mall/src/main/java/com/alian/pms/service/IBrandService.java
482d34dcc3e99e70f61f8cb2546b99bc083efec7
[]
no_license
Alian-zz/Alian-ds
e1560b07596d0844dbc09f637cbcce32e7c16469
49fafb867db1d57bf8d225dfc7be585f37d9f89f
refs/heads/master
2023-02-10T04:49:33.026705
2020-12-29T10:53:02
2020-12-29T10:53:02
324,361,533
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package com.alian.pms.service; import com.alian.pms.entity.Brand; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 品牌表 服务类 * </p> * * @author zhangzhilian * @since 2020-12-09 */ public interface IBrandService extends IService<Brand> { }
[ "583670397@qq.com" ]
583670397@qq.com
9b2d54fc457d48d32ca8eae4aef9d09fdb4bf641
751256f30936275238b91b48a4f402dfc9248fd0
/PickerForDate/app/src/main/java/com/example/liliyuan/pickerfordate/DatePickerFragment.java
7be3662cac2c0e626d09b62a2f078d5a0f3a61d1
[]
no_license
liyuanl123/AndroidPractice
2c0530d0cf63dd2a171edcd518e7390e196f7a2a
91c007b28ad61699b34d6477fa17dae0dcfda653
refs/heads/master
2020-04-10T15:36:22.508504
2018-12-10T04:34:56
2018-12-10T04:34:56
161,115,490
0
0
null
null
null
null
UTF-8
Java
false
false
1,330
java
package com.example.liliyuan.pickerfordate; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.widget.DatePicker; import java.util.Calendar; /** * A simple {@link Fragment} subclass. */ public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker. final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it. return new DatePickerDialog(getActivity(), this, year, month, day); } @Override public void onDateSet(DatePicker view, int year, int month, int day) { // You use getActivity() which, when used in a Fragment, returns the Activity the Fragment // is currently associated with. MainActivity activity = (MainActivity) getActivity(); activity.processDatePickerResult(year, month, day); } }
[ "liyuanlsp@gmail.com" ]
liyuanlsp@gmail.com
7fb18e145fe61612d1896c92c97135e47a355b9a
9633324216599db0cf1146770c62da8123dc1702
/src/fractalzoomer/functions/root_finding_methods/bairstow/Bairstow4.java
e265bcc1763405849fce9a5a9a31fd4101a8d90e
[]
no_license
avachon100501/Fractal-Zoomer
fe3287371fd8716aa3239dd6955239f2c5d161cd
d21c173b8b12f11108bf844b53e09bc0d55ebeb5
refs/heads/master
2022-10-05T21:42:07.433545
2020-06-05T11:19:17
2020-06-05T11:19:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,053
java
/* * Copyright (C) 2020 hrkalona2 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package fractalzoomer.functions.root_finding_methods.bairstow; import fractalzoomer.core.Complex; import fractalzoomer.main.MainWindow; import fractalzoomer.main.app_settings.OrbitTrapSettings; import fractalzoomer.main.app_settings.StatisticsSettings; import java.util.ArrayList; /** * * @author hrkalona2 */ public class Bairstow4 extends BairstowRootFindingMethod { public Bairstow4(double xCenter, double yCenter, double size, int max_iterations, int out_coloring_algorithm, int user_out_coloring_algorithm, String outcoloring_formula, String[] user_outcoloring_conditions, String[] user_outcoloring_condition_formula, int in_coloring_algorithm, int user_in_coloring_algorithm, String incoloring_formula, String[] user_incoloring_conditions, String[] user_incoloring_condition_formula, boolean smoothing, int plane_type, double[] rotation_vals, double[] rotation_center, String user_plane, int user_plane_algorithm, String[] user_plane_conditions, String[] user_plane_condition_formula, double[] plane_transform_center, double plane_transform_angle, double plane_transform_radius, double[] plane_transform_scales, double[] plane_transform_wavelength, int waveType, double plane_transform_angle2, int plane_transform_sides, double plane_transform_amount, int converging_smooth_algorithm, OrbitTrapSettings ots, StatisticsSettings sts) { super(xCenter, yCenter, size, max_iterations, plane_type, rotation_vals, rotation_center, user_plane, user_plane_algorithm, user_plane_conditions, user_plane_condition_formula, plane_transform_center, plane_transform_angle, plane_transform_radius, plane_transform_scales, plane_transform_wavelength, waveType, plane_transform_angle2, plane_transform_sides, plane_transform_amount, ots); switch (out_coloring_algorithm) { case MainWindow.BINARY_DECOMPOSITION: convergent_bailout = 1E-9; break; case MainWindow.BINARY_DECOMPOSITION2: convergent_bailout = 1E-9; break; case MainWindow.USER_OUTCOLORING_ALGORITHM: convergent_bailout = 1E-7; break; } OutColoringAlgorithmFactory(out_coloring_algorithm, smoothing, converging_smooth_algorithm, user_out_coloring_algorithm, outcoloring_formula, user_outcoloring_conditions, user_outcoloring_condition_formula, plane_transform_center); InColoringAlgorithmFactory(in_coloring_algorithm, user_in_coloring_algorithm, incoloring_formula, user_incoloring_conditions, user_incoloring_condition_formula, plane_transform_center); if (sts.statistic) { StatisticFactory(sts, plane_transform_center); } n = 4; a = new double[n + 1]; //z^4 - 1 a[0] = -1; a[1] = 0; a[2] = 0; a[3] = 0; a[4] = 1; b = new double[n + 1]; b[n] = b[n - 1] = 0; f = new double[n + 1]; f[n] = f[n - 1] = 0; } //orbit public Bairstow4(double xCenter, double yCenter, double size, int max_iterations, ArrayList<Complex> complex_orbit, int plane_type, double[] rotation_vals, double[] rotation_center, String user_plane, int user_plane_algorithm, String[] user_plane_conditions, String[] user_plane_condition_formula, double[] plane_transform_center, double plane_transform_angle, double plane_transform_radius, double[] plane_transform_scales, double[] plane_transform_wavelength, int waveType, double plane_transform_angle2, int plane_transform_sides, double plane_transform_amount) { super(xCenter, yCenter, size, max_iterations, complex_orbit, plane_type, rotation_vals, rotation_center, user_plane, user_plane_algorithm, user_plane_conditions, user_plane_condition_formula, plane_transform_center, plane_transform_angle, plane_transform_radius, plane_transform_scales, plane_transform_wavelength, waveType, plane_transform_angle2, plane_transform_sides, plane_transform_amount); n = 4; a = new double[n + 1]; //z^4 - 1 a[0] = -1; a[1] = 0; a[2] = 0; a[3] = 0; a[4] = 1; b = new double[n + 1]; b[n] = b[n - 1] = 0; f = new double[n + 1]; f[n] = f[n - 1] = 0; } @Override protected void function(Complex[] complex) { bairstowMethod(complex[0]); } }
[ "hrkalona@gmail.com" ]
hrkalona@gmail.com