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
57d0ae02b00dbe7304895333e4affc2641a4ee60
176bea464e9fbf6b1b29e0104b13985f38784d95
/by-language/java/java-basics/1-installing-basics/workshop/Workshop05.java
c27a91f73a84f7ab4d4a2576874eebc16f78363b
[]
no_license
Manuel1426/my-teaching-materials
f9accd21d7545168b5f91a7d11ec40a78e78b109
c3ccf92160b711c4e1754426a7df93f966a27f74
refs/heads/master
2023-03-18T21:51:14.046956
2017-10-03T20:12:09
2017-10-03T20:12:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
public class Workshop05{ public static void main(String[] args) { int e = 8; // please cube of e's value System.out.println(e); } }
[ "gyulavari.adam@gmail.com" ]
gyulavari.adam@gmail.com
6a6628a10cdef8922a84fe7b8dd9b681cf0b81b8
f5f779a1ec8d003ad7ccdb287659c1af97dbb1b5
/common_utils/src/main/java/com/nobodyhub/transcendence/common/domain/DataExcerpt.java
fcdd6ce9c4910a8d0eb354250ba6df0084d3de48
[]
no_license
yan-hai/transcendence
38b4d6e932e28b914ce1a5e3f1a0c733c9c28949
b48d7994b6027fb7b578008c3837df5a4a00830e
refs/heads/master
2020-04-15T12:17:26.413217
2019-02-06T04:41:19
2019-02-06T04:41:19
164,667,783
0
1
null
null
null
null
UTF-8
Java
false
false
558
java
package com.nobodyhub.transcendence.common.domain; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; /** * An excerpt of data that used for retrieving from database * * @param <T> the type enumeration of target data */ @Data @EqualsAndHashCode @AllArgsConstructor(access = AccessLevel.PROTECTED) public abstract class DataExcerpt<T> { /** * type of data */ protected T type; /** * the unique for data of given {@link #type} */ protected String id; }
[ "yan_h@hotmail.com" ]
yan_h@hotmail.com
c24246e0887a43e87d871f883852bbadf0094c67
d121774d5f6c1baccf1cd580746b8c5da863d9a7
/src/com/LHS/digitalimagebasics/ColorSwapper.java
3a8c2809f6ef1f8a2275ba210aa15da7b52f4ab8
[]
no_license
GlobalSystemsScience/Digital-Image-Basics-Applet
4bf4a7fe331c8cdcc7c7fab4dc599d8cf65ec0ce
acddab3613d0c89d1553ce8fa233580bcc69ed0e
refs/heads/master
2020-04-17T00:59:07.105554
2013-04-26T20:13:36
2013-04-26T20:13:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,416
java
package com.LHS.digitalimagebasics; import java.awt.image.RGBImageFilter; public class ColorSwapper extends RGBImageFilter { private static int RED = 0xFF0000; private static int GREEN = 0x00FF00; private static int BLUE = 0x0000FF; private int redDisplayColor; private int greenDisplayColor; private int blueDisplayColor; private int[] redColorShift; private int[] greenColorShift; private int[] blueColorShift; private boolean[] hideRed; private boolean[] hideGreen; private boolean[] hideBlue; private int count = 0; private boolean[] greenLeftShift; @Override public int filterRGB(int x, int y, int rgb) { int red=0, green = 0, blue=0; for (int i=0; i < greenColorShift.length; i++) { if (!hideGreen[i]) { if (greenColorShift[i] != -1) { if (greenLeftShift[i]) { green += (rgb & GREEN) << greenColorShift[i]; } else { green += (rgb & GREEN) >> greenColorShift[i]; } } } } for (int i=0; i < redColorShift.length; i++) { if (!hideRed[i]) { if (redColorShift[i] != -1) red += ((rgb & RED) >> redColorShift[i]); } } for (int i=0; i < blueColorShift.length; i++) { if (!hideBlue[i]) { if (blueColorShift[i] != -1) blue += ((rgb & BLUE) << blueColorShift[i]); } } if (count % 1000 == 0) { System.out.println(red + " " + green + " " + blue); } count++; return ( red | green | blue | (rgb & 0xFF000000)); } public void setRedDisplayColor(int redDisplayColor) { this.redDisplayColor = redDisplayColor; } public void setGreenDisplayColor(int greenDisplayColor) { this.greenDisplayColor = greenDisplayColor; } public void setBlueDisplayColor(int blueDisplayColor) { this.blueDisplayColor = blueDisplayColor; } public void setRedColorShift(int[] redColorShift) { this.redColorShift = redColorShift; } public void setGreenColorShift(int[] greenColorShift) { this.greenColorShift = greenColorShift; } public void setBlueColorShift(int[] blueColorShift) { this.blueColorShift = blueColorShift; } public void setGreenLeftShift(boolean[] greenLeftShift) { this.greenLeftShift = greenLeftShift; } public void setHideRed(boolean[] hideRed) { this.hideRed = hideRed; } public void setHideGreen(boolean[] hideGreen) { this.hideGreen = hideGreen; } public void setHideBlue(boolean[] hideBlue) { this.hideBlue = hideBlue; } }
[ "jordangbull@gmail.com" ]
jordangbull@gmail.com
387b39022f5702b482005bbc325675b96e3821c5
7aa02f902ad330c70b0b34ec2d4eb3454c7a3fc1
/com/google/api/client/googleapis/auth/oauth2/GoogleClientSecrets.java
a164bf1a4b20ad996f1545f34e54c3696cae70cc
[]
no_license
hisabimbola/andexpensecal
5e42c7e687296fae478dfd39abee45fae362bc5b
c47e6f0a1a6e24fe1377d35381b7e7e37f1730ee
refs/heads/master
2021-01-19T15:20:25.262893
2016-08-11T16:00:49
2016-08-11T16:00:49
100,962,347
1
0
null
2017-08-21T14:48:33
2017-08-21T14:48:33
null
UTF-8
Java
false
false
3,062
java
package com.google.api.client.googleapis.auth.oauth2; import com.google.api.client.json.C0657b; import com.google.api.client.json.C0771d; import com.google.api.client.p050d.ab; import com.google.api.client.p050d.am; import java.io.InputStream; import java.util.List; public final class GoogleClientSecrets extends C0657b { @ab private Details installed; @ab private Details web; public final class Details extends C0657b { @ab(a = "auth_uri") private String authUri; @ab(a = "client_id") private String clientId; @ab(a = "client_secret") private String clientSecret; @ab(a = "redirect_uris") private List<String> redirectUris; @ab(a = "token_uri") private String tokenUri; public Details clone() { return (Details) super.clone(); } public String getAuthUri() { return this.authUri; } public String getClientId() { return this.clientId; } public String getClientSecret() { return this.clientSecret; } public List<String> getRedirectUris() { return this.redirectUris; } public String getTokenUri() { return this.tokenUri; } public Details set(String str, Object obj) { return (Details) super.set(str, obj); } public Details setAuthUri(String str) { this.authUri = str; return this; } public Details setClientId(String str) { this.clientId = str; return this; } public Details setClientSecret(String str) { this.clientSecret = str; return this; } public Details setRedirectUris(List<String> list) { this.redirectUris = list; return this; } public Details setTokenUri(String str) { this.tokenUri = str; return this; } } public static GoogleClientSecrets load(C0771d c0771d, InputStream inputStream) { return (GoogleClientSecrets) c0771d.m7056a(inputStream, GoogleClientSecrets.class); } public GoogleClientSecrets clone() { return (GoogleClientSecrets) super.clone(); } public Details getDetails() { boolean z = true; if ((this.web == null) == (this.installed == null)) { z = false; } am.m6914a(z); return this.web == null ? this.installed : this.web; } public Details getInstalled() { return this.installed; } public Details getWeb() { return this.web; } public GoogleClientSecrets set(String str, Object obj) { return (GoogleClientSecrets) super.set(str, obj); } public GoogleClientSecrets setInstalled(Details details) { this.installed = details; return this; } public GoogleClientSecrets setWeb(Details details) { this.web = details; return this; } }
[ "m.ravinther@yahoo.com" ]
m.ravinther@yahoo.com
e5d8d7da4dcb9b95d666a9ad34e8c7c4a9ee1d41
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/javax_swing_plaf_metal_MetalScrollBarUI_wait_long.java
1cac61d9fd71d4ac14c1dacc25c627384d78ba98
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
213
java
class javax_swing_plaf_metal_MetalScrollBarUI_wait_long{ public static void function() {javax.swing.plaf.metal.MetalScrollBarUI obj = new javax.swing.plaf.metal.MetalScrollBarUI();obj.wait(-2155073088023908753);}}
[ "peter2008.ok@163.com" ]
peter2008.ok@163.com
145583f342e251ac64509d20458e5c322e59e2d1
a65190d4900ec5404023879089d00bd81f86b2c6
/src/main/java/com/hmt/carga/config/locale/package-info.java
c8edb3b5641bb7ce47562fe30af501680f057cfe
[]
no_license
Darguelles/hmt-carga
f3f8edf8c1915d6ce1466cdac61615b03753edee
a73f353851ee549b748c3b1edb3e69862d7d7f6e
refs/heads/master
2020-11-24T21:30:00.732499
2017-09-05T06:23:51
2017-09-05T06:23:51
73,507,643
1
0
null
null
null
null
UTF-8
Java
false
false
70
java
/** * Locale specific code. */ package com.hmt.carga.config.locale;
[ "darguelles.rojas91@gmail.com" ]
darguelles.rojas91@gmail.com
40506012083347b5dd488ff574ba1f87e7d8867a
9e8ede50afd012f36ada2d8af9ccc16357223b2b
/app/src/main/java/com/openxu/libdemo/view/bean/PieBean.java
784491cf0a660e40f91390db50f8cb3336f00725
[]
no_license
openXu/OXAndroid
92e796e630cabeae11c411948f0496f16df9d2f1
87870d74ed18edcdd3c9a4661ef673d6a2508629
refs/heads/master
2021-01-17T12:05:30.237610
2019-03-20T10:09:43
2019-03-20T10:09:43
84,056,482
0
1
null
null
null
null
UTF-8
Java
false
false
644
java
package com.openxu.libdemo.view.bean; /** * autour : openXu * date : 2018/6/8 9:40 * className : PieBean * version : 1.0 * description : 请添加类说明 */ public class PieBean { private float Numner; private String Name; public PieBean() { } public PieBean(float Numner, String Name) { this.Numner = Numner; this.Name = Name; } public float getNumner() { return Numner; } public void setNumner(float numner) { Numner = numner; } public String getName() { return Name; } public void setName(String name) { Name = name; } }
[ "openXu@yeah.net" ]
openXu@yeah.net
a0e36934b9d14f30bc84f88e2b76e0f5c35bf8c4
13c3f8328e5da34c1c906e78a71037dd6c5ae03e
/Mslawin-notes-Server/src/main/java/pl/mslawin/notes/domain/notes/Task.java
971c98c3f578417f05f281ccb1bde89d0729735b
[]
no_license
mslawin/Notes
06f10784c8c67ac143f9fb7977fb0f32be81f7fe
5fabfad9fde65c7c90c7984c25ac306047951b32
refs/heads/master
2021-01-19T03:55:10.380832
2016-07-19T13:14:29
2016-07-19T13:14:29
43,203,813
0
0
null
null
null
null
UTF-8
Java
false
false
1,917
java
package pl.mslawin.notes.domain.notes; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import org.joda.time.LocalDateTime; @Entity public class Task { @Id @GeneratedValue private Long id; @Column(name = "text", nullable = false) private String text; @Column(name = "author", nullable = false) private String author; @Column(name = "creation_time", nullable = false) private LocalDateTime creationTime; @Column(name = "completed") private boolean completed = false; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "list_id") private TasksList tasksList; public Task() { } public Task(String text, String author) { this.text = text; this.author = author; this.creationTime = LocalDateTime.now(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public LocalDateTime getCreationTime() { return creationTime; } public void setCreationTime(LocalDateTime creationTime) { this.creationTime = creationTime; } public boolean isCompleted() { return completed; } public void setCompleted(boolean completed) { this.completed = completed; } public TasksList getTasksList() { return tasksList; } public void setTasksList(TasksList tasksList) { this.tasksList = tasksList; } }
[ "m.slawinski1@ocado.com" ]
m.slawinski1@ocado.com
a56839f4499df8d510b52f4c68947b5f6b88d164
b70d13cba15e185ad0c67807b3bac83dc711debf
/app/src/main/java/com/mylaneza/jamarte/entities/Secuencia.java
ae14dfb9efd49819c0a8a1673d9d53669ec4a31e
[]
no_license
mylaneza/jamenarte
60b716719f2c5286a59a59d854888e7066a1d5f4
740dbb8b3d3a9b0271afcb66d5449bb2a9c8ad1e
refs/heads/master
2023-04-02T05:13:33.793267
2021-04-16T02:59:19
2021-04-16T02:59:19
358,452,410
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package com.mylaneza.jamarte.entities; import java.util.Vector; /** * Created by mylaneza on 08/08/2018. */ public class Secuencia { public long leccion; public long id; public String name; }
[ "mylaneza@gmail.com" ]
mylaneza@gmail.com
9bd832a3ab11ee74334d664d1449c29d5aefc3ee
0772d207e53d266659ae337893d2840b05b2babe
/src/main/java/com/thundermoose/bio/controllers/ExceptionAdvice.java
bc60ac8538dfc22c58c2b0f4a4028c5ef7458575
[]
no_license
monitorjbl/brbbio
839ee5bb34f53e8a19e78c67bb05dfbfb97f50a0
72e3f23c01421d42d4a91fef5792309cf69d7842
refs/heads/master
2023-06-09T05:57:32.837159
2015-01-27T23:08:20
2015-01-27T23:11:56
10,519,619
0
0
null
null
null
null
UTF-8
Java
false
false
1,249
java
package com.thundermoose.bio.controllers; import com.thundermoose.bio.exceptions.UserNotFoundException; import com.thundermoose.bio.model.ExceptionResponse; import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.log4j.Logger; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; /** * Created by tayjones on 3/10/14. */ @ControllerAdvice public class ExceptionAdvice { private static final Logger logger = Logger.getLogger(ExceptionAdvice.class); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody public ExceptionResponse handleAllException(Exception ex) { if (ex instanceof UserNotFoundException) { logger.debug(ex.getMessage(), ex); } else { logger.error(ex.getMessage(), ex); } ExceptionResponse r = new ExceptionResponse(); r.setMessage(ex.getMessage()); r.setType(ex.getClass().getCanonicalName()); r.setStacktrace(ExceptionUtils.getFullStackTrace(ex)); return r; } }
[ "tayjones@cisco.com" ]
tayjones@cisco.com
1c62a5926d3074c9125cf8f8a82f1560a3395621
6a6f252b726ef92f67657875104b0993113017eb
/ms-gestion-alumno/src/main/java/pe/edu/galaxy/training/java/sb/ms/gestion/alumnos/controller/commons/ObjectResponse.java
f03711875a218d336eca64bf93b07067557e07b8
[]
no_license
renzoku147/ms-spring-cloud
3d62bc8f2180b64d4784e5102fc1027613c4a32f
215036628f24d8e90f0adec6486d7e40bdb1c94e
refs/heads/master
2023-06-12T04:38:30.828174
2021-07-09T02:12:29
2021-07-09T02:12:29
383,461,635
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
package pe.edu.galaxy.training.java.sb.ms.gestion.alumnos.controller.commons; import lombok.Builder; import lombok.Data; @Data @Builder public class ObjectResponse { private ObjectMessage message; private Object data; }
[ "renzoku147@gmail.com" ]
renzoku147@gmail.com
1002c4e118a7201f7feb1d70e24bbc13c7856920
65bd4bee5777fcd9cb1cbebcdc6ece29228c936a
/src/main/java/io/github/cottonmc/witchcraft/block/SpellCircleBlock.java
169f857e80c18d339b7f6cf9642d2b7ba9b26daf
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-other-permissive" ]
permissive
CottonMC/PracticalWitchcraft
3fb0c2c4d881bb351ca6c72ab673b4da454a05a2
c8b663ed44bd7176da78bfa2b107417f3a5e038c
refs/heads/master
2020-05-07T12:30:44.368747
2020-03-02T00:44:41
2020-03-02T00:44:41
180,507,474
1
1
null
null
null
null
UTF-8
Java
false
false
3,660
java
package io.github.cottonmc.witchcraft.block; import io.github.cottonmc.witchcraft.block.entity.SpellCircleEntity; import io.github.cottonmc.witchcraft.effect.WitchcraftEffects; import io.github.cottonmc.witchcraft.item.WitchcraftItems; import io.github.cottonmc.witchcraft.spell.Spell; import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.util.NbtType; import net.minecraft.block.Block; import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockState; import net.minecraft.block.Material; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.explosion.Explosion; import java.util.Random; public class SpellCircleBlock extends Block implements BlockEntityProvider { public SpellCircleBlock() { super(FabricBlockSettings.of(Material.CARPET).noCollision().build()); } @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!world.isClient && (world.getBlockEntity(pos) instanceof SpellCircleEntity)) { if (world.getBlockTickScheduler().isScheduled(pos, WitchcraftBlocks.SPELL_CIRCLE) || world.getBlockTickScheduler().isTicking(pos, WitchcraftBlocks.SPELL_CIRCLE)) return ActionResult.SUCCESS; ItemStack stack = player.getStackInHand(hand); SpellCircleEntity be = (SpellCircleEntity) world.getBlockEntity(pos); if (be.hasPixie() && stack.getItem() == WitchcraftItems.BROOMSTICK) { if (player.hasStatusEffect(WitchcraftEffects.FIZZLE)) { int level = player.getStatusEffect(WitchcraftEffects.FIZZLE).getAmplifier() + 1; if (world.getRandom().nextInt(20) <= level) { world.createExplosion(null, DamageSource.MAGIC, pos.getX(), pos.getY(), pos.getZ(), 3f, true, Explosion.DestructionType.NONE); world.breakBlock(pos, false); return ActionResult.SUCCESS; } } be.beginSpell(player); } else if (stack.getItem() == WitchcraftItems.BOTTLED_PIXIE) { ItemStack bottle = new ItemStack(Items.GLASS_BOTTLE); if (!player.isCreative()) { if (stack.getCount() == 1) player.setStackInHand(hand, bottle); else if (!player.inventory.insertStack(bottle)) { ItemEntity entity = player.dropItem(bottle, false); world.spawnEntity(entity); } } be.addPixie(); } } return ActionResult.SUCCESS; } @Override public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rad) { if (world.getBlockEntity(pos) instanceof SpellCircleEntity) { ((SpellCircleEntity)world.getBlockEntity(pos)).performSpell(); } } @Override public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { BlockEntity be = world.getBlockEntity(pos); if (be instanceof SpellCircleEntity && stack.getOrCreateTag().contains("Spell", NbtType.COMPOUND)) { SpellCircleEntity circle = (SpellCircleEntity)be; Spell spell = Spell.fromTag(stack.getTag().getCompound("Spell")); circle.setSpell(spell); } } @Override public BlockEntity createBlockEntity(BlockView view) { return new SpellCircleEntity(); } }
[ "goclonefilms@gmail.com" ]
goclonefilms@gmail.com
7af16953871ba1c844dae58c3d9146b5891dc5ba
ed53c4d93e851d46e963cafb26cb6a3f468dd47c
/extensions/ecs/ecs-weaver/src/arc/ecs/weaver/impl/template/UniEntityLink.java
c53251767e6a14407a428416c7e4f7d5b89e3d8c
[]
no_license
zonesgame/Arc
0a4ea8cf1c44066e85ffd95cfe52eb1ece1488e7
ea8a0be1642befa535fba717e94c4fc03bd6f8a0
refs/heads/main
2023-06-28T04:21:06.146553
2021-07-26T14:02:35
2021-07-26T14:02:35
384,278,749
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package arc.ecs.weaver.impl.template; import arc.ecs.*; import arc.ecs.link.*; import java.lang.reflect.*; public class UniEntityLink extends Component{ public Entity field; public static class Mutator implements UniFieldMutator{ private Base base; @Override public int read(Component c, Field f){ Entity e = ((UniEntityLink)c).field; return (e != null) ? e.getId() : -1; } @Override public void write(int value, Component c, Field f){ Entity e = (value != -1) ? base.getEntity(value) : null; ((UniEntityLink)c).field = e; } @Override public void setBase(Base base){ this.base = base; } } }
[ "32406374+zonesgame@users.noreply.github.com" ]
32406374+zonesgame@users.noreply.github.com
95e32d96423bb3c174a31c459d1da499aa1c8e67
bdef6ed9107028902af5b4dfd02fa141ea3cb8ee
/src/main/java/lesson04/locks/LockDemo.java
9ad311c5d4854f8d61e86001f2d80436d24366bb
[]
no_license
yunzhongfan/corejava
02b7520ec8c266068f9f9f0f93e7a57cf100ce0a
bed86dcffb69e1b8fe9402ad824f26968b467656
refs/heads/master
2020-04-18T11:42:26.413093
2019-01-25T11:57:37
2019-01-25T11:57:37
167,510,434
0
0
null
null
null
null
UTF-8
Java
false
false
1,109
java
package lesson04.locks; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class LockDemo { public static int count; public static Lock countLock = new ReentrantLock(); public static void main(String[] args) throws InterruptedException { ExecutorService executor = Executors.newCachedThreadPool(); for (int i = 1; i <= 100; i++) { Runnable task = () -> { for (int k = 1; k <= 1000; k++) { countLock.lock(); try { count++; // Critical section } finally { countLock.unlock(); // Make sure the lock is unlocked } } }; executor.execute(task); } executor.shutdown(); executor.awaitTermination(10, TimeUnit.MINUTES); System.out.println("Final value: " + count); } }
[ "caijingk@yonyou.com" ]
caijingk@yonyou.com
82f19f04f360144456008e28d4a4754ffb2f3d84
873c15976805f3296d9e3d7d8861edab5593f676
/src/integration-test/java/io/jay/tddspringbootorderinsideout/authentication/EndpointAccessTests.java
f5026331cb30069337e72795ce5fcb636b760cca
[]
no_license
shub8968/tdd-spring-boot-order
85e22f1ee8c678c1b788b8f86587f849437e0728
0bf610fdc12bd2e84403bd6214241e8cbe0d2954
refs/heads/master
2023-06-05T10:40:56.538678
2021-06-20T23:54:02
2021-06-20T23:54:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,697
java
package io.jay.tddspringbootorderinsideout.authentication; import io.jay.tddspringbootorderinsideout.authentication.rest.dto.TokenResponse; 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.boot.test.context.SpringBootTest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.web.servlet.MockMvc; import javax.transaction.Transactional; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest @AutoConfigureMockMvc @DirtiesContext public class EndpointAccessTests { @Autowired private MockMvc mockMvc; private AuthenticationTestHelper testHelper; @BeforeEach void setUp() { testHelper = new AuthenticationTestHelper(mockMvc); } @Test @Transactional void test_signup_isAccessible() throws Exception { testHelper.signUp("user@email.com", "password") .andExpect(status().isOk()); } @Test @Transactional void test_login_isAccessible() throws Exception { testHelper.signUp("user@email.com", "password"); testHelper.login("user@email.com", "password") .andExpect(status().isOk()); } @Test void test_getOrders_returnsForbidden() throws Exception { mockMvc.perform(get("/orders")) .andExpect(status().isForbidden()); } @Test void test_getUsers_returnsForbidden() throws Exception { mockMvc.perform(get("/users")) .andExpect(status().isForbidden()); } @Test @Transactional void test_getOrdersWithAccessToken_returnsOk() throws Exception { testHelper.signUp("user@email.com", "password"); TokenResponse tokenResponse = testHelper.loginAndReturnToken("user@email.com", "password"); mockMvc.perform(get("/orders") .header("Authorization", "Bearer " + tokenResponse.getAccessToken())) .andExpect(status().isOk()); } @Test @Transactional void test_getOrdersWithRefreshToken_returnsOk() throws Exception { testHelper.signUp("user@email.com", "password"); TokenResponse tokenResponse = testHelper.loginAndReturnToken("user@email.com", "password"); mockMvc.perform(get("/orders") .header("Authorization", "Bearer " + tokenResponse.getRefreshToken())) .andExpect(status().isOk()); } }
[ "tensaijskim1991@gmail.com" ]
tensaijskim1991@gmail.com
53d07c3516f2164d5729115045d21c2ad1075d93
e6cc873e4fc15f819fccb3dd9a37edc07691fb6f
/E-com/src/main/java/com/comtrade/entiteti/Stavke.java
3f40c892accf47b1c8c88d66ee097e2620ba43e3
[]
no_license
ztrampic/E-comm
d98cbd4e84e09988fde9a83a22779561965e0c7d
3714170db1dc8dcd3e642bd30e29aee1930d9e63
refs/heads/master
2021-11-13T04:48:30.749820
2021-10-30T12:59:06
2021-10-30T12:59:06
196,863,000
0
0
null
null
null
null
UTF-8
Java
false
false
1,203
java
package com.comtrade.entiteti; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class Stavke { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private int kolicina; private int brStavke; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "id_racun") private Racun racun; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "id_proizvoda") private Proizvod proizvod; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getKolicina() { return kolicina; } public void setKolicina(int kolicina) { this.kolicina = kolicina; } public int getBrStavke() { return brStavke; } public void setBrStavke(int brStavke) { this.brStavke = brStavke; } public Racun getRacun() { return racun; } public void setRacun(Racun racun) { this.racun = racun; } public Proizvod getProizvod() { return proizvod; } public void setProizvod(Proizvod proizvod) { this.proizvod = proizvod; } }
[ "ztrampic@yahoo.com" ]
ztrampic@yahoo.com
b79f481d9d45b989f2ec0affa9a0f7f73f5a73cd
8b41fc644c8716ff9634927fadf15a8f20dcec01
/src/main/java/util/ListIterator.java
9eb7a1a71dd3e926e02e742ce790ca81c99f56cd
[]
no_license
frametianhe/java-1.8
c1791a6a3e460b1f2f1a9f974947f1413a8c5869
e4ccc5ec38f0c70b8fbe979bc49cbef9cdb2327f
refs/heads/master
2021-08-06T01:05:24.756325
2019-12-04T10:38:04
2019-12-04T10:38:04
225,837,910
0
0
null
2020-10-13T17:57:47
2019-12-04T10:15:24
Java
UTF-8
Java
false
false
10,098
java
/* * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.util; /** * An iterator for lists that allows the programmer * to traverse the list in either direction, modify * the list during iteration, and obtain the iterator's * current position in the list. A {@code ListIterator} * has no current element; its <I>cursor position</I> always * lies between the element that would be returned by a call * to {@code previous()} and the element that would be * returned by a call to {@code next()}. * An iterator for a list of length {@code n} has {@code n+1} possible * cursor positions, as illustrated by the carets ({@code ^}) below: * <PRE> * Element(0) Element(1) Element(2) ... Element(n-1) * cursor positions: ^ ^ ^ ^ ^ * </PRE> * Note that the {@link #remove} and {@link #set(Object)} methods are * <i>not</i> defined in terms of the cursor position; they are defined to * operate on the last element returned by a call to {@link #next} or * {@link #previous()}. * * <p>This interface is a member of the * <a href="{@docRoot}/../technotes/guides/collections/index.html"> * Java Collections Framework</a>. * * @author Josh Bloch * @see Collection * @see List * @see Iterator * @see Enumeration * @see List#listIterator() * @since 1.2 * 用于列表的迭代器,它允许程序员向任意方向遍历列表,在迭代期间修改列表,并获取列表中的迭代器当前位置。ListIterator无当前元素;它的光标位置总是位于调用previous()返回的元素和调用next()返回的元素之间。迭代器的长度n n + 1可能光标位置,在图中以克拉(^)如下: 元素元素(0)(1)(2)……元素(n - 1) 光标位置:^ ^ ^ ^ ^ 注意,删除和设置(对象)方法没有根据光标位置定义;它们被定义为对通过调用next或previous()返回的最后一个元素进行操作。 这个接口是Java集合框架的一个成员。 */ public interface ListIterator<E> extends Iterator<E> { // Query Operations /** * Returns {@code true} if this list iterator has more elements when * traversing the list in the forward direction. (In other words, * returns {@code true} if {@link #next} would return an element rather * than throwing an exception.)如果此列表迭代器在正向遍历列表时具有更多元素,则返回true。(换句话说,如果next返回一个元素而不是抛出一个异常,则返回true。) * * @return {@code true} if the list iterator has more elements when * traversing the list in the forward direction */ boolean hasNext(); /** * Returns the next element in the list and advances the cursor position. * This method may be called repeatedly to iterate through the list, * or intermixed with calls to {@link #previous} to go back and forth. * (Note that alternating calls to {@code next} and {@code previous} * will return the same element repeatedly.)返回列表中的下一个元素并推进光标位置。这个方法可以被反复调用以遍历列表,或者与前一个方法的调用混合,以便来回执行。(注意,对next和previous的交替调用将重复返回相同的元素。) * * @return the next element in the list * @throws NoSuchElementException if the iteration has no next element */ E next(); /** * Returns {@code true} if this list iterator has more elements when * traversing the list in the reverse direction. (In other words, * returns {@code true} if {@link #previous} would return an element * rather than throwing an exception.)如果这个列表迭代器在反方向遍历列表时具有更多元素,则返回true。(换句话说,如果先前返回的是元素而不是抛出异常,则返回true。) * * @return {@code true} if the list iterator has more elements when * traversing the list in the reverse direction */ boolean hasPrevious(); /** * Returns the previous element in the list and moves the cursor * position backwards. This method may be called repeatedly to * iterate through the list backwards, or intermixed with calls to * {@link #next} to go back and forth. (Note that alternating calls * to {@code next} and {@code previous} will return the same * element repeatedly.)返回列表中的前一个元素并将光标位置向后移动。可以反复调用此方法以向后遍历列表,或与相邻的调用相互混合。(注意,对next和previous的交替调用将重复返回相同的元素。) * * @return the previous element in the list * @throws NoSuchElementException if the iteration has no previous * element */ E previous(); /** * Returns the index of the element that would be returned by a * subsequent call to {@link #next}. (Returns list size if the list * iterator is at the end of the list.)返回元素的索引,该索引将由后续对next的调用返回。(如果列表迭代器位于列表末尾,则返回列表大小。) * * @return the index of the element that would be returned by a * subsequent call to {@code next}, or list size if the list * iterator is at the end of the list */ int nextIndex(); /** * Returns the index of the element that would be returned by a * subsequent call to {@link #previous}. (Returns -1 if the list * iterator is at the beginning of the list.)返回元素的索引,该索引将由后续对previous的调用返回。(如果列表迭代器位于列表的开头,则返回-1。) * * @return the index of the element that would be returned by a * subsequent call to {@code previous}, or -1 if the list * iterator is at the beginning of the list */ int previousIndex(); // Modification Operations /** * Removes from the list the last element that was returned by {@link * #next} or {@link #previous} (optional operation). This call can * only be made once per call to {@code next} or {@code previous}. * It can be made only if {@link #add} has not been * called after the last call to {@code next} or {@code previous}.从列表中移除下一个或之前返回的元素(可选操作)。这个调用只能在下一次调用或之前调用一次。只有在对next或previous的最后一次调用之后没有调用add时,才可以进行此操作。 * * @throws UnsupportedOperationException if the {@code remove} * operation is not supported by this list iterator * @throws IllegalStateException if neither {@code next} nor * {@code previous} have been called, or {@code remove} or * {@code add} have been called after the last call to * {@code next} or {@code previous} */ void remove(); /** * Replaces the last element returned by {@link #next} or * {@link #previous} with the specified element (optional operation). * This call can be made only if neither {@link #remove} nor {@link * #add} have been called after the last call to {@code next} or * {@code previous}.用指定的元素(可选操作)替换next或previous返回的最后一个元素。只有在对next或previous的最后一次调用之后没有调用remove或add,才可以进行此调用。 * * @param e the element with which to replace the last element returned by * {@code next} or {@code previous} * @throws UnsupportedOperationException if the {@code set} operation * is not supported by this list iterator * @throws ClassCastException if the class of the specified element * prevents it from being added to this list * @throws IllegalArgumentException if some aspect of the specified * element prevents it from being added to this list * @throws IllegalStateException if neither {@code next} nor * {@code previous} have been called, or {@code remove} or * {@code add} have been called after the last call to * {@code next} or {@code previous} */ void set(E e); /** * Inserts the specified element into the list (optional operation). * The element is inserted immediately before the element that * would be returned by {@link #next}, if any, and after the element * that would be returned by {@link #previous}, if any. (If the * list contains no elements, the new element becomes the sole element * on the list.) The new element is inserted before the implicit * cursor: a subsequent call to {@code next} would be unaffected, and a * subsequent call to {@code previous} would return the new element. * (This call increases by one the value that would be returned by a * call to {@code nextIndex} or {@code previousIndex}.) * * @param e the element to insert * @throws UnsupportedOperationException if the {@code add} method is * not supported by this list iterator * @throws ClassCastException if the class of the specified element * prevents it from being added to this list * @throws IllegalArgumentException if some aspect of this element * prevents it from being added to this list * 将指定的元素插入到列表中(可选操作)。元素会在next(如果有的话)返回的元素之前以及之前(如果有的话)返回的元素之后插入。(如果列表不包含元素,则新元素将成为列表中的唯一元素。)在隐式游标之前插入新元素:对next的后续调用不受影响,随后调用之前的调用将返回新元素。(这个调用增加了一个调用nextIndex或previousIndex的值。) */ void add(E e); }
[ "tianheframe@163.com" ]
tianheframe@163.com
7ee336d62f40ec1365c01050e51c08d5ed6a25b7
12b24632ef98ca6bd68f1e85a9b1ffdeff24022d
/SunFlowerJava/app/src/main/java/com/example/sunflower_java/adapters/BindingAdapters.java
e0cdceff58587b00324b4049500f6c6c5f996d49
[]
no_license
han1254/Sunflower-Java
04f4a6a575b0bb71bc0350aac6f15cd31ce550ee
1c61a806f097be003747d2b13fff730fb75a666a
refs/heads/master
2020-12-14T12:39:49.833591
2020-01-18T14:33:51
2020-01-18T14:33:51
234,746,936
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package com.example.sunflower_java.adapters; import android.view.View; import androidx.databinding.BindingAdapter; /** * Time:2020/1/14 21:42 * Author: han1254 * Email: 1254763408@qq.com * Function: */ public class BindingAdapters { @BindingAdapter("isGone") public static void bindIsGone(View view, boolean isGone) { view.setVisibility(isGone ? View.GONE : View.VISIBLE); } }
[ "you@example.com" ]
you@example.com
bd83ad04990fb3acd5df36ec183575e32bc7894e
689e8a3ccd884c4c9c92975b24c637d2d55b9b1a
/src/main/java/br/com/caelum/ingresso/dao/SessaoDao.java
ecc858a22eda4ffdd946f34298645673266bd2e2
[]
no_license
GIDSC/fj22-ingressos
6e9ed9854b3265e30a27977a6d5988cba56f4e11
5ddf2cc8c8aef905854405a3ff28c22cc0d9dd9b
refs/heads/master
2020-09-04T00:47:07.651323
2019-11-14T00:50:59
2019-11-14T00:50:59
219,621,557
0
0
null
2019-11-05T00:16:55
2019-11-05T00:16:54
null
UTF-8
Java
false
false
971
java
package br.com.caelum.ingresso.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.stereotype.Repository; import br.com.caelum.ingresso.model.Filme; import br.com.caelum.ingresso.model.Sala; import br.com.caelum.ingresso.model.Sessao; @Repository public class SessaoDao { @PersistenceContext private EntityManager manager; public void save(Sessao sessao) { manager.persist(sessao); } public List<Sessao> buscaSessoesDaSala(Sala sala) { return manager.createQuery("select s from Sessao s where s.sala = :sala", Sessao.class) .setParameter("sala", sala).getResultList(); } public List<Sessao> buscaSessoesDoFilme(Filme filme) { return manager.createQuery("select s from Sessao s where s.filme = :filme", Sessao.class) .setParameter("filme", filme).getResultList(); } public Sessao findOne(Integer id) { return manager.find(Sessao.class, id); } }
[ "dsousa106@gmail.com" ]
dsousa106@gmail.com
d884de91ea597ef3c43a598735f48941d30a6f05
efa72336b8246b53b0469ee338ac8c96901c8e5b
/zookeeper/src/main/java/com/kaka/jtest/zookeeper/zkclient/ZooKeeperTest.java
8cdc951045f1c17c094b21b4b0a15b03f9263af7
[]
no_license
jkaka/jtest
3b31cfc8c6fd170963d07ba72a759c2d76429d1f
07e901b2a7814ed62164f3dd61d398c42c60677d
refs/heads/master
2022-12-22T11:27:41.536904
2020-04-13T06:33:01
2020-04-13T06:33:01
133,806,729
1
0
null
2022-12-16T00:42:41
2018-05-17T11:57:15
Java
UTF-8
Java
false
false
1,518
java
package com.kaka.jtest.zookeeper.zkclient; import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.ZooKeeper; import org.junit.Before; import org.junit.Test; import java.util.List; /** * zookeeper原生api * 只能监听一次 * * @author jsk * @Date 2019/3/1 15:55 */ public class ZooKeeperTest { private String zkUrl = "localhost:2181"; private int sessionTimeout = 20000; private int connectTimeout = 20000; ZooKeeper zkClient = null; @Before public void init() throws Exception { zkClient = new ZooKeeper(zkUrl, sessionTimeout, new Watcher() { @Override public void process(WatchedEvent event) { //收到事件通知后的回调函数(应该是我们自己的事件处理逻辑) System.out.println(event.getType() + "----" + event.getPath()); try { zkClient.getChildren("/", true);//再次触发监听 } catch (Exception e) { } } }); } /** * 获取子节点 * * @throwsException */ @Test public void getChildren() throws Exception { List<String> children = zkClient.getChildren("/", true); for (String child : children) { System.out.println(child); } // Thread.sleep(Long.MAX_VALUE);//让程序一直运行,在CRT终端里 ls / watch ;create /appe www ;观察控制台打印情况 } }
[ "395159947@qq.com" ]
395159947@qq.com
528028043bad879cf6d6c5e58eff1a6107599d3f
3df27b037c878b7d980b5c068d3663682c09b0b3
/src/com/jbf/workflow/dao/SysWorkflowTaskPageUrlDao.java
6cd8c099d7080baeb715a7fe354c5541d22567ae
[]
no_license
shinow/tjec
82fbd67886bc1f60c63af3e6054d1e4c16df2a0d
0b2f4de2eda13acf351dfc04faceea508c9dd4b0
refs/heads/master
2021-09-24T15:45:42.212349
2018-10-11T06:13:55
2018-10-11T06:13:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
797
java
/************************************************************ * 类名:SysWorkflowTaskPageUrl * * 类别:Dao * 功能:任务对应的处理页面Dao * * Ver 変更日 部门 担当者 変更内容 * ────────────────────────────────────────────── * V1.00 2014-07-23 CFIT-PG HYF 初版 * * Copyright (c) 2014 CFIT-Weifang Company All Rights Reserved. ************************************************************/ package com.jbf.workflow.dao; import com.jbf.common.dao.IGenericDao; import com.jbf.workflow.po.SysWorkflowTaskPageUrl; public interface SysWorkflowTaskPageUrlDao extends IGenericDao<SysWorkflowTaskPageUrl, Long> { }
[ "lin521lh" ]
lin521lh
28d39c6d5b15717af14ed183465013ae97fccd0e
0270874c82ae338d279f62b83692acddd38dc554
/src/main/java/com/lzk/spring/boot/config/MyBatisConfig.java
c109ff3063c55c70374e0a210fddb84753c66c3e
[]
no_license
TheHelloWorld/SpringBootDemo
0a4ed5a7c9de716c2963c19a81b89f64c90c98f2
33d1ee2b600b37db0af67173209ef4aa96cdb99b
refs/heads/master
2021-08-28T05:31:09.937838
2017-12-11T09:23:08
2017-12-11T09:23:08
113,833,767
0
0
null
null
null
null
UTF-8
Java
false
false
1,917
java
package com.lzk.spring.boot.config; import javax.sql.DataSource; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.TransactionManagementConfigurer; /** * @author lzk * */ @Configuration //加上这个注解,使得支持事务 @EnableTransactionManagement public class MyBatisConfig implements TransactionManagementConfigurer { @Autowired private DataSource dataSource; @Override public PlatformTransactionManager annotationDrivenTransactionManager() { return new DataSourceTransactionManager(dataSource); } @Bean(name = "sqlSessionFactory") public SqlSessionFactory sqlSessionFactoryBean() { try { SqlSessionFactoryBean bean = new SqlSessionFactoryBean(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); bean.setDataSource(dataSource); bean.setMapperLocations(resolver.getResources("classpath:mybatis-contexts/*.xml")); return bean.getObject(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } @Bean public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) { return new SqlSessionTemplate(sqlSessionFactory); } }
[ "hundunhou@126.com" ]
hundunhou@126.com
8df4cf2b363b99deca23a0cfce79dda16e7cc7b9
2e84c611a7443189d2225d6edb77ca8a7c1f2854
/src/main/java/ua/lviv/lgs/utils/ConnectionUtils.java
d8f30cdcbe067901de984838decbcdfeaa706475
[]
no_license
pavlivmykola/Java_Advanced_lesson10
f4c78a52e0367d963451f30cd9fadd69ee341ae2
ab029116b76de87f5380c6212dd59a6a1f979c18
refs/heads/master
2020-04-29T05:53:18.923168
2019-03-15T22:23:55
2019-03-15T22:23:55
175,897,959
0
0
null
null
null
null
UTF-8
Java
false
false
901
java
package ua.lviv.lgs.utils; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import org.apache.log4j.xml.DOMConfigurator; import ua.lviv.lgs.service.UsersService; public class ConnectionUtils { private static String USER_NAME = "root"; private static String USER_PASSWORD = "gfhfdjp"; private static String URL = "jdbc:mysql://localhost:3306/project1?useLegacyDatetimeCode=false&serverTimezone=UTC"; public static Connection openConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { java.net.URL u = UsersService.class.getClassLoader().getResource("ua/lviv/lgs/logger/loggerConfig.xml"); DOMConfigurator.configure("loggerConfig.xml"); Class.forName("com.mysql.cj.jdbc.Driver").newInstance(); return DriverManager.getConnection(URL, USER_NAME, USER_PASSWORD); } }
[ "mpavliv@ukr.net" ]
mpavliv@ukr.net
d38435a150d77c0183ea38c21db5814b3913f50c
a965c716243baeb9f23b320e7107c7c421ee4f53
/src/com/quiz0121/Ex004_Hap.java
ab50c9059e8e681b807c9b2d6173d451ec29e9ad
[]
no_license
EnuShalisha/coding-preJAVA
dbcb97f2794dbf8d1764e87d2c107946a741e072
405826ad782ffb378d4921c5adbf2c07e5164a77
refs/heads/main
2023-03-21T23:45:58.282363
2021-02-13T04:14:26
2021-02-13T04:14:26
331,312,458
0
0
null
null
null
null
UHC
Java
false
false
485
java
package com.quiz0121; public class Ex004_Hap { public static void main(String[] args) { /* 1~100 까지 정수의 합을 계산하여 출력하는 프로그램 */ int s, n; s=0; n=0; while(n<100) { n++; s+=n; } System.out.println("결과 : "+s); // 5050 /* int s, n; s=n=0; while(n++<100) { s+=n; } System.out.println("결과 : "+s); */ /* int s, n; s=n=0; while(++n<=100) { s+=n; } System.out.println("결과 : "+s); */ } }
[ "enushailsha352@gmail.com" ]
enushailsha352@gmail.com
bf75b1ef1554a13a8cdb1585891262ace5a2a264
416ba65d73e1da2a46963235c5c945ad172168f3
/web/src/main/java/com/zrlog/web/controller/BaseController.java
bf1c52bd3046822d54628435631c678569b7e534
[ "Apache-2.0" ]
permissive
dragcszh/java
b2cf76c6bec8f02c17884c5a81ed114163320d11
a43374b00a64173abc7f4eedde75a083bca31f44
refs/heads/main
2022-12-27T13:49:10.992372
2020-10-04T07:15:17
2020-10-04T07:15:17
301,061,785
0
0
null
null
null
null
UTF-8
Java
false
false
3,577
java
package com.zrlog.web.controller; import com.google.gson.Gson; import com.jfinal.core.Controller; import com.jfinal.kit.PathKit; import com.zrlog.common.Constants; import com.zrlog.common.request.PageableRequest; import com.zrlog.web.interceptor.TemplateHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.Map; /** * 提供一些基础的工具类,方便其子类调用 */ public class BaseController extends Controller { private static final Logger LOGGER = LoggerFactory.getLogger(BaseController.class); /** * 获取主题的相对于程序的路径,当Cookie中有值的情况下,优先使用Cookie里面的数据(仅当主题存在的情况下,否则返回默认的主题), * * @return */ public String getTemplatePath() { String templatePath = Constants.WEB_SITE.get("template").toString(); templatePath = templatePath == null ? Constants.DEFAULT_TEMPLATE_PATH : templatePath; String previewTheme = TemplateHelper.getTemplatePathByCookie(getRequest().getCookies()); if (previewTheme != null) { templatePath = previewTheme; } if (!new File(PathKit.getWebRootPath() + templatePath).exists()) { templatePath = Constants.DEFAULT_TEMPLATE_PATH; } return templatePath; } public Integer getDefaultRows() { return Integer.valueOf(Constants.WEB_SITE.get("rows").toString()); } public boolean isNotNullOrNotEmptyStr(Object... args) { for (Object arg : args) { if (arg == null || "".equals(arg)) { return false; } } return true; } /** * 用于转化 GET 的中文乱码 * * @param param * @return */ public String convertRequestParam(String param) { if (param != null) { //如果可以正常读取到中文的情况,直接跳过转换 if (containsHanScript(param)) { return param; } try { return URLDecoder.decode(new String(param.getBytes(StandardCharsets.ISO_8859_1)), "UTF-8"); } catch (UnsupportedEncodingException e) { LOGGER.error("request convert to UTF-8 error ", e); } } return ""; } private static boolean containsHanScript(String s) { return s.codePoints().anyMatch( codepoint -> Character.UnicodeScript.of(codepoint) == Character.UnicodeScript.HAN); } public void fullTemplateSetting(Object jsonStr) { if (isNotNullOrNotEmptyStr(jsonStr)) { Map<String, Object> res = getAttr("_res"); res.putAll(new Gson().fromJson(jsonStr.toString(), Map.class)); } } public void fullTemplateSetting() { Object jsonStr = Constants.WEB_SITE.get(getTemplatePath() + Constants.TEMPLATE_CONFIG_SUFFIX); fullTemplateSetting(jsonStr); } /** * 封装Jqgrid的分页参数 * * @return */ public PageableRequest getPageable() { PageableRequest pageableRequest = new PageableRequest(); pageableRequest.setRows(getParaToInt("rows", 10)); pageableRequest.setSort(getPara("sidx")); pageableRequest.setOrder(getPara("sord")); pageableRequest.setPage(getParaToInt("page", 1)); return pageableRequest; } }
[ "dragcszh@qq.com" ]
dragcszh@qq.com
efe7fa9c72e8eab7c5e74423ae76b5597e36bcdb
eeda52b0903a6a9884171fd6efd92b01aba25058
/etl-kettle-mbg/src/main/java/com/caixin/data/middle/etl/kettle/mbg/model/RJobExample.java
60df97c72ad9c9d630328b9373c16f2413685411
[]
no_license
v5coder/etl-kettle-web
485ec69e0af7796d1b77a3da8fb22f04893a3d52
c9814c37d0f2fb079342fbcc9a081259764a2b4b
refs/heads/master
2023-05-28T00:27:24.438832
2020-03-03T01:13:07
2020-03-03T01:13:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
40,363
java
package com.caixin.data.middle.etl.kettle.mbg.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class RJobExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public RJobExample() { 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 andIdJobIsNull() { addCriterion("ID_JOB is null"); return (Criteria) this; } public Criteria andIdJobIsNotNull() { addCriterion("ID_JOB is not null"); return (Criteria) this; } public Criteria andIdJobEqualTo(Long value) { addCriterion("ID_JOB =", value, "idJob"); return (Criteria) this; } public Criteria andIdJobNotEqualTo(Long value) { addCriterion("ID_JOB <>", value, "idJob"); return (Criteria) this; } public Criteria andIdJobGreaterThan(Long value) { addCriterion("ID_JOB >", value, "idJob"); return (Criteria) this; } public Criteria andIdJobGreaterThanOrEqualTo(Long value) { addCriterion("ID_JOB >=", value, "idJob"); return (Criteria) this; } public Criteria andIdJobLessThan(Long value) { addCriterion("ID_JOB <", value, "idJob"); return (Criteria) this; } public Criteria andIdJobLessThanOrEqualTo(Long value) { addCriterion("ID_JOB <=", value, "idJob"); return (Criteria) this; } public Criteria andIdJobIn(List<Long> values) { addCriterion("ID_JOB in", values, "idJob"); return (Criteria) this; } public Criteria andIdJobNotIn(List<Long> values) { addCriterion("ID_JOB not in", values, "idJob"); return (Criteria) this; } public Criteria andIdJobBetween(Long value1, Long value2) { addCriterion("ID_JOB between", value1, value2, "idJob"); return (Criteria) this; } public Criteria andIdJobNotBetween(Long value1, Long value2) { addCriterion("ID_JOB not between", value1, value2, "idJob"); return (Criteria) this; } public Criteria andIdDirectoryIsNull() { addCriterion("ID_DIRECTORY is null"); return (Criteria) this; } public Criteria andIdDirectoryIsNotNull() { addCriterion("ID_DIRECTORY is not null"); return (Criteria) this; } public Criteria andIdDirectoryEqualTo(Integer value) { addCriterion("ID_DIRECTORY =", value, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryNotEqualTo(Integer value) { addCriterion("ID_DIRECTORY <>", value, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryGreaterThan(Integer value) { addCriterion("ID_DIRECTORY >", value, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryGreaterThanOrEqualTo(Integer value) { addCriterion("ID_DIRECTORY >=", value, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryLessThan(Integer value) { addCriterion("ID_DIRECTORY <", value, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryLessThanOrEqualTo(Integer value) { addCriterion("ID_DIRECTORY <=", value, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryIn(List<Integer> values) { addCriterion("ID_DIRECTORY in", values, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryNotIn(List<Integer> values) { addCriterion("ID_DIRECTORY not in", values, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryBetween(Integer value1, Integer value2) { addCriterion("ID_DIRECTORY between", value1, value2, "idDirectory"); return (Criteria) this; } public Criteria andIdDirectoryNotBetween(Integer value1, Integer value2) { addCriterion("ID_DIRECTORY not between", value1, value2, "idDirectory"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("NAME is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("NAME is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("NAME =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("NAME <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("NAME >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("NAME >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("NAME <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("NAME <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("NAME like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("NAME not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("NAME in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("NAME not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("NAME between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("NAME not between", value1, value2, "name"); return (Criteria) this; } public Criteria andJobVersionIsNull() { addCriterion("JOB_VERSION is null"); return (Criteria) this; } public Criteria andJobVersionIsNotNull() { addCriterion("JOB_VERSION is not null"); return (Criteria) this; } public Criteria andJobVersionEqualTo(String value) { addCriterion("JOB_VERSION =", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionNotEqualTo(String value) { addCriterion("JOB_VERSION <>", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionGreaterThan(String value) { addCriterion("JOB_VERSION >", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionGreaterThanOrEqualTo(String value) { addCriterion("JOB_VERSION >=", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionLessThan(String value) { addCriterion("JOB_VERSION <", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionLessThanOrEqualTo(String value) { addCriterion("JOB_VERSION <=", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionLike(String value) { addCriterion("JOB_VERSION like", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionNotLike(String value) { addCriterion("JOB_VERSION not like", value, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionIn(List<String> values) { addCriterion("JOB_VERSION in", values, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionNotIn(List<String> values) { addCriterion("JOB_VERSION not in", values, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionBetween(String value1, String value2) { addCriterion("JOB_VERSION between", value1, value2, "jobVersion"); return (Criteria) this; } public Criteria andJobVersionNotBetween(String value1, String value2) { addCriterion("JOB_VERSION not between", value1, value2, "jobVersion"); return (Criteria) this; } public Criteria andJobStatusIsNull() { addCriterion("JOB_STATUS is null"); return (Criteria) this; } public Criteria andJobStatusIsNotNull() { addCriterion("JOB_STATUS is not null"); return (Criteria) this; } public Criteria andJobStatusEqualTo(Integer value) { addCriterion("JOB_STATUS =", value, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusNotEqualTo(Integer value) { addCriterion("JOB_STATUS <>", value, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusGreaterThan(Integer value) { addCriterion("JOB_STATUS >", value, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusGreaterThanOrEqualTo(Integer value) { addCriterion("JOB_STATUS >=", value, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusLessThan(Integer value) { addCriterion("JOB_STATUS <", value, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusLessThanOrEqualTo(Integer value) { addCriterion("JOB_STATUS <=", value, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusIn(List<Integer> values) { addCriterion("JOB_STATUS in", values, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusNotIn(List<Integer> values) { addCriterion("JOB_STATUS not in", values, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusBetween(Integer value1, Integer value2) { addCriterion("JOB_STATUS between", value1, value2, "jobStatus"); return (Criteria) this; } public Criteria andJobStatusNotBetween(Integer value1, Integer value2) { addCriterion("JOB_STATUS not between", value1, value2, "jobStatus"); return (Criteria) this; } public Criteria andIdDatabaseLogIsNull() { addCriterion("ID_DATABASE_LOG is null"); return (Criteria) this; } public Criteria andIdDatabaseLogIsNotNull() { addCriterion("ID_DATABASE_LOG is not null"); return (Criteria) this; } public Criteria andIdDatabaseLogEqualTo(Integer value) { addCriterion("ID_DATABASE_LOG =", value, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogNotEqualTo(Integer value) { addCriterion("ID_DATABASE_LOG <>", value, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogGreaterThan(Integer value) { addCriterion("ID_DATABASE_LOG >", value, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogGreaterThanOrEqualTo(Integer value) { addCriterion("ID_DATABASE_LOG >=", value, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogLessThan(Integer value) { addCriterion("ID_DATABASE_LOG <", value, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogLessThanOrEqualTo(Integer value) { addCriterion("ID_DATABASE_LOG <=", value, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogIn(List<Integer> values) { addCriterion("ID_DATABASE_LOG in", values, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogNotIn(List<Integer> values) { addCriterion("ID_DATABASE_LOG not in", values, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogBetween(Integer value1, Integer value2) { addCriterion("ID_DATABASE_LOG between", value1, value2, "idDatabaseLog"); return (Criteria) this; } public Criteria andIdDatabaseLogNotBetween(Integer value1, Integer value2) { addCriterion("ID_DATABASE_LOG not between", value1, value2, "idDatabaseLog"); return (Criteria) this; } public Criteria andTableNameLogIsNull() { addCriterion("TABLE_NAME_LOG is null"); return (Criteria) this; } public Criteria andTableNameLogIsNotNull() { addCriterion("TABLE_NAME_LOG is not null"); return (Criteria) this; } public Criteria andTableNameLogEqualTo(String value) { addCriterion("TABLE_NAME_LOG =", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogNotEqualTo(String value) { addCriterion("TABLE_NAME_LOG <>", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogGreaterThan(String value) { addCriterion("TABLE_NAME_LOG >", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogGreaterThanOrEqualTo(String value) { addCriterion("TABLE_NAME_LOG >=", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogLessThan(String value) { addCriterion("TABLE_NAME_LOG <", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogLessThanOrEqualTo(String value) { addCriterion("TABLE_NAME_LOG <=", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogLike(String value) { addCriterion("TABLE_NAME_LOG like", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogNotLike(String value) { addCriterion("TABLE_NAME_LOG not like", value, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogIn(List<String> values) { addCriterion("TABLE_NAME_LOG in", values, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogNotIn(List<String> values) { addCriterion("TABLE_NAME_LOG not in", values, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogBetween(String value1, String value2) { addCriterion("TABLE_NAME_LOG between", value1, value2, "tableNameLog"); return (Criteria) this; } public Criteria andTableNameLogNotBetween(String value1, String value2) { addCriterion("TABLE_NAME_LOG not between", value1, value2, "tableNameLog"); return (Criteria) this; } public Criteria andCreatedUserIsNull() { addCriterion("CREATED_USER is null"); return (Criteria) this; } public Criteria andCreatedUserIsNotNull() { addCriterion("CREATED_USER is not null"); return (Criteria) this; } public Criteria andCreatedUserEqualTo(String value) { addCriterion("CREATED_USER =", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserNotEqualTo(String value) { addCriterion("CREATED_USER <>", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserGreaterThan(String value) { addCriterion("CREATED_USER >", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserGreaterThanOrEqualTo(String value) { addCriterion("CREATED_USER >=", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserLessThan(String value) { addCriterion("CREATED_USER <", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserLessThanOrEqualTo(String value) { addCriterion("CREATED_USER <=", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserLike(String value) { addCriterion("CREATED_USER like", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserNotLike(String value) { addCriterion("CREATED_USER not like", value, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserIn(List<String> values) { addCriterion("CREATED_USER in", values, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserNotIn(List<String> values) { addCriterion("CREATED_USER not in", values, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserBetween(String value1, String value2) { addCriterion("CREATED_USER between", value1, value2, "createdUser"); return (Criteria) this; } public Criteria andCreatedUserNotBetween(String value1, String value2) { addCriterion("CREATED_USER not between", value1, value2, "createdUser"); return (Criteria) this; } public Criteria andCreatedDateIsNull() { addCriterion("CREATED_DATE is null"); return (Criteria) this; } public Criteria andCreatedDateIsNotNull() { addCriterion("CREATED_DATE is not null"); return (Criteria) this; } public Criteria andCreatedDateEqualTo(Date value) { addCriterion("CREATED_DATE =", value, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateNotEqualTo(Date value) { addCriterion("CREATED_DATE <>", value, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateGreaterThan(Date value) { addCriterion("CREATED_DATE >", value, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateGreaterThanOrEqualTo(Date value) { addCriterion("CREATED_DATE >=", value, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateLessThan(Date value) { addCriterion("CREATED_DATE <", value, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateLessThanOrEqualTo(Date value) { addCriterion("CREATED_DATE <=", value, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateIn(List<Date> values) { addCriterion("CREATED_DATE in", values, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateNotIn(List<Date> values) { addCriterion("CREATED_DATE not in", values, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateBetween(Date value1, Date value2) { addCriterion("CREATED_DATE between", value1, value2, "createdDate"); return (Criteria) this; } public Criteria andCreatedDateNotBetween(Date value1, Date value2) { addCriterion("CREATED_DATE not between", value1, value2, "createdDate"); return (Criteria) this; } public Criteria andModifiedUserIsNull() { addCriterion("MODIFIED_USER is null"); return (Criteria) this; } public Criteria andModifiedUserIsNotNull() { addCriterion("MODIFIED_USER is not null"); return (Criteria) this; } public Criteria andModifiedUserEqualTo(String value) { addCriterion("MODIFIED_USER =", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserNotEqualTo(String value) { addCriterion("MODIFIED_USER <>", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserGreaterThan(String value) { addCriterion("MODIFIED_USER >", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserGreaterThanOrEqualTo(String value) { addCriterion("MODIFIED_USER >=", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserLessThan(String value) { addCriterion("MODIFIED_USER <", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserLessThanOrEqualTo(String value) { addCriterion("MODIFIED_USER <=", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserLike(String value) { addCriterion("MODIFIED_USER like", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserNotLike(String value) { addCriterion("MODIFIED_USER not like", value, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserIn(List<String> values) { addCriterion("MODIFIED_USER in", values, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserNotIn(List<String> values) { addCriterion("MODIFIED_USER not in", values, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserBetween(String value1, String value2) { addCriterion("MODIFIED_USER between", value1, value2, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedUserNotBetween(String value1, String value2) { addCriterion("MODIFIED_USER not between", value1, value2, "modifiedUser"); return (Criteria) this; } public Criteria andModifiedDateIsNull() { addCriterion("MODIFIED_DATE is null"); return (Criteria) this; } public Criteria andModifiedDateIsNotNull() { addCriterion("MODIFIED_DATE is not null"); return (Criteria) this; } public Criteria andModifiedDateEqualTo(Date value) { addCriterion("MODIFIED_DATE =", value, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateNotEqualTo(Date value) { addCriterion("MODIFIED_DATE <>", value, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateGreaterThan(Date value) { addCriterion("MODIFIED_DATE >", value, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateGreaterThanOrEqualTo(Date value) { addCriterion("MODIFIED_DATE >=", value, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateLessThan(Date value) { addCriterion("MODIFIED_DATE <", value, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateLessThanOrEqualTo(Date value) { addCriterion("MODIFIED_DATE <=", value, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateIn(List<Date> values) { addCriterion("MODIFIED_DATE in", values, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateNotIn(List<Date> values) { addCriterion("MODIFIED_DATE not in", values, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateBetween(Date value1, Date value2) { addCriterion("MODIFIED_DATE between", value1, value2, "modifiedDate"); return (Criteria) this; } public Criteria andModifiedDateNotBetween(Date value1, Date value2) { addCriterion("MODIFIED_DATE not between", value1, value2, "modifiedDate"); return (Criteria) this; } public Criteria andUseBatchIdIsNull() { addCriterion("USE_BATCH_ID is null"); return (Criteria) this; } public Criteria andUseBatchIdIsNotNull() { addCriterion("USE_BATCH_ID is not null"); return (Criteria) this; } public Criteria andUseBatchIdEqualTo(String value) { addCriterion("USE_BATCH_ID =", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdNotEqualTo(String value) { addCriterion("USE_BATCH_ID <>", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdGreaterThan(String value) { addCriterion("USE_BATCH_ID >", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdGreaterThanOrEqualTo(String value) { addCriterion("USE_BATCH_ID >=", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdLessThan(String value) { addCriterion("USE_BATCH_ID <", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdLessThanOrEqualTo(String value) { addCriterion("USE_BATCH_ID <=", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdLike(String value) { addCriterion("USE_BATCH_ID like", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdNotLike(String value) { addCriterion("USE_BATCH_ID not like", value, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdIn(List<String> values) { addCriterion("USE_BATCH_ID in", values, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdNotIn(List<String> values) { addCriterion("USE_BATCH_ID not in", values, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdBetween(String value1, String value2) { addCriterion("USE_BATCH_ID between", value1, value2, "useBatchId"); return (Criteria) this; } public Criteria andUseBatchIdNotBetween(String value1, String value2) { addCriterion("USE_BATCH_ID not between", value1, value2, "useBatchId"); return (Criteria) this; } public Criteria andPassBatchIdIsNull() { addCriterion("PASS_BATCH_ID is null"); return (Criteria) this; } public Criteria andPassBatchIdIsNotNull() { addCriterion("PASS_BATCH_ID is not null"); return (Criteria) this; } public Criteria andPassBatchIdEqualTo(String value) { addCriterion("PASS_BATCH_ID =", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdNotEqualTo(String value) { addCriterion("PASS_BATCH_ID <>", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdGreaterThan(String value) { addCriterion("PASS_BATCH_ID >", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdGreaterThanOrEqualTo(String value) { addCriterion("PASS_BATCH_ID >=", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdLessThan(String value) { addCriterion("PASS_BATCH_ID <", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdLessThanOrEqualTo(String value) { addCriterion("PASS_BATCH_ID <=", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdLike(String value) { addCriterion("PASS_BATCH_ID like", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdNotLike(String value) { addCriterion("PASS_BATCH_ID not like", value, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdIn(List<String> values) { addCriterion("PASS_BATCH_ID in", values, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdNotIn(List<String> values) { addCriterion("PASS_BATCH_ID not in", values, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdBetween(String value1, String value2) { addCriterion("PASS_BATCH_ID between", value1, value2, "passBatchId"); return (Criteria) this; } public Criteria andPassBatchIdNotBetween(String value1, String value2) { addCriterion("PASS_BATCH_ID not between", value1, value2, "passBatchId"); return (Criteria) this; } public Criteria andUseLogfieldIsNull() { addCriterion("USE_LOGFIELD is null"); return (Criteria) this; } public Criteria andUseLogfieldIsNotNull() { addCriterion("USE_LOGFIELD is not null"); return (Criteria) this; } public Criteria andUseLogfieldEqualTo(String value) { addCriterion("USE_LOGFIELD =", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldNotEqualTo(String value) { addCriterion("USE_LOGFIELD <>", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldGreaterThan(String value) { addCriterion("USE_LOGFIELD >", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldGreaterThanOrEqualTo(String value) { addCriterion("USE_LOGFIELD >=", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldLessThan(String value) { addCriterion("USE_LOGFIELD <", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldLessThanOrEqualTo(String value) { addCriterion("USE_LOGFIELD <=", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldLike(String value) { addCriterion("USE_LOGFIELD like", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldNotLike(String value) { addCriterion("USE_LOGFIELD not like", value, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldIn(List<String> values) { addCriterion("USE_LOGFIELD in", values, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldNotIn(List<String> values) { addCriterion("USE_LOGFIELD not in", values, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldBetween(String value1, String value2) { addCriterion("USE_LOGFIELD between", value1, value2, "useLogfield"); return (Criteria) this; } public Criteria andUseLogfieldNotBetween(String value1, String value2) { addCriterion("USE_LOGFIELD not between", value1, value2, "useLogfield"); return (Criteria) this; } public Criteria andSharedFileIsNull() { addCriterion("SHARED_FILE is null"); return (Criteria) this; } public Criteria andSharedFileIsNotNull() { addCriterion("SHARED_FILE is not null"); return (Criteria) this; } public Criteria andSharedFileEqualTo(String value) { addCriterion("SHARED_FILE =", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileNotEqualTo(String value) { addCriterion("SHARED_FILE <>", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileGreaterThan(String value) { addCriterion("SHARED_FILE >", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileGreaterThanOrEqualTo(String value) { addCriterion("SHARED_FILE >=", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileLessThan(String value) { addCriterion("SHARED_FILE <", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileLessThanOrEqualTo(String value) { addCriterion("SHARED_FILE <=", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileLike(String value) { addCriterion("SHARED_FILE like", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileNotLike(String value) { addCriterion("SHARED_FILE not like", value, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileIn(List<String> values) { addCriterion("SHARED_FILE in", values, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileNotIn(List<String> values) { addCriterion("SHARED_FILE not in", values, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileBetween(String value1, String value2) { addCriterion("SHARED_FILE between", value1, value2, "sharedFile"); return (Criteria) this; } public Criteria andSharedFileNotBetween(String value1, String value2) { addCriterion("SHARED_FILE not between", value1, value2, "sharedFile"); 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); } } }
[ "zhuzj29042@hundsun.com" ]
zhuzj29042@hundsun.com
fddf32e57cb10d44c68a2dab458d6fda297e8238
a4696b3db18e3ed943fe00c1ba7fb38086c28b30
/app/src/main/java/br/com/aluras/algum/data/AlgumContract.java
16f2226a40c64a10a66e7a0d11385548d08331b9
[]
no_license
aluras/Algum
2a0da310bd1cf429406a00cf6a009968ff6fbf68
e6e691e543c3c7ff30502b625a70218fbdc5be47
refs/heads/master
2016-08-12T05:51:04.363839
2015-12-30T14:44:36
2015-12-30T14:44:36
35,623,334
0
0
null
null
null
null
UTF-8
Java
false
false
2,788
java
package br.com.aluras.algum.data; import android.content.ContentResolver; import android.content.ContentUris; import android.net.Uri; import android.provider.BaseColumns; import android.text.format.Time; public class AlgumContract { // The "Content authority" is a name for the entire content provider, similar to the // relationship between a domain name and its website. A convenient string to use for the // content authority is the package name for the app, which is guaranteed to be unique on the // device. public static final String CONTENT_AUTHORITY = "br.com.aluras.algum"; // Use CONTENT_AUTHORITY to create the base of all URI's which apps will use to contact // the content provider. public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); // Possible paths (appended to base content URI for possible URI's) // For instance, content://com.example.android.sunshine.app/weather/ is a valid path for // looking at weather data. content://com.example.android.sunshine.app/givemeroot/ will fail, // as the ContentProvider hasn't been given any information on what to do with "givemeroot". // At least, let's hope not. Don't be that dev, reader. Don't be that dev. public static final String PATH_CONTA = "conta"; public static final String PATH_LANCAMENTOS = "lancamentos"; // To make it easy to query for the exact date, we normalize all dates that go into // the database to the start of the the Julian day at UTC. public static long normalizeDate(long startDate) { // normalize the start date to the beginning of the (UTC) day Time time = new Time(); time.set(startDate); int julianDay = Time.getJulianDay(startDate, time.gmtoff); return time.setJulianDay(julianDay); } /* Inner class that defines the table contents of the location table Students: This is where you will add the strings. (Similar to what has been done for WeatherEntry) */ public static final class ContaEntry implements BaseColumns{ public static final String TABLE_NAME = "contas"; public static final String COLUMN_NOME = "nome"; public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_CONTA).build(); public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_CONTA; public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_CONTA; public static Uri buildContaUri(long id) { return ContentUris.withAppendedId(CONTENT_URI, id); } } }
[ "andrelrs80@gmail.com" ]
andrelrs80@gmail.com
4f1e248e7b756e7625fbd9732a679851834cc14a
0d8225751dd9e1396c9018fc33189efa1bac89d2
/Java & Scala/java/superkeyword/SA.java
638ae2e8b0c3f0cfc55eec15a03e715a3922b4f5
[]
no_license
potato17/Java-Scala
682cc961edd0be709dc7c35ebb41defed34acb44
888c2ca4e381f394755971b0f77cca547c1f69d6
refs/heads/master
2020-06-27T14:22:50.046527
2019-08-01T05:59:51
2019-08-01T05:59:51
199,975,479
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package superkeyword; public class SA { public static void main(String[] args) { SC d=new SC(); d.printColor(); // TODO Auto-generated method stub } }
[ "yuklin17@icloud.com" ]
yuklin17@icloud.com
e403a2b66ac3dfd4575cfff288651fa0965da5a5
21a5ab10a4309922346a4cbef108e88efa331efd
/Coursera Java 1/StringSecondAssignment/part1.java
c961b016c59011b77f9a175d78ae9b69e88735ce
[]
no_license
roypj/Coursera-OOP-1
4b37d7c76d19bc16b0ca7ee4eca2d4fd889e1bea
83be721be93734a92ae922d8014700be8477232d
refs/heads/master
2021-01-20T15:57:48.137822
2017-12-30T19:11:23
2017-12-30T19:11:23
90,803,405
0
0
null
2017-12-30T19:11:25
2017-05-10T00:18:44
Java
UTF-8
Java
false
false
2,429
java
/** * Write a description of part1 here. * * @author (your name) * @version (a version number or a date) */ public class part1 { public int findStopCodon(String dna, int startIdx, String stopCodon){ int currIdx = dna.indexOf(stopCodon,startIdx+3); while(currIdx!=-1){ if((currIdx-startIdx)%3==0){ return currIdx; } else{ currIdx = dna.indexOf(stopCodon,currIdx+1); } } return dna.length(); } public String findGene(String dna){ int startIdx = dna.indexOf("ATG"); //System.out.println(dna); //System.out.println(startIdx); if (startIdx==-1){ return ""; } int atgIdx = findStopCodon(dna,startIdx,"TAA"); //System.out.println(atgIdx); int tagIdx = findStopCodon(dna,startIdx,"TAG"); //System.out.println(tagIdx); int tgaIdx = findStopCodon(dna,startIdx,"TGA"); //System.out.println(tagIdx); int minIdx = Math.min(Math.max(0,atgIdx),Math.min(Math.max(0,tagIdx),Math.max(0,tgaIdx))); //System.out.println(minIdx); if (minIdx==0||minIdx==dna.length()){ return ""; }else{ return dna.substring(startIdx,minIdx+3); } } public void printAllGenes(String dna){ int ocur =0; while (true){ String Gene = findGene(dna); if(!Gene.isEmpty()){ System.out.println(Gene); dna = dna.substring(dna.indexOf(Gene)+Gene.length()); //System.out.println("new dna"+dna); ocur+=1; } if(Gene.isEmpty()){ break; } } System.out.println("The number of Genes found is : "+ocur); } public void testStopCodon(){ System.out.println(findStopCodon("ATGGGSAAATAA",0,"TAA")); System.out.println(findStopCodon("ATGGGAAATAA",0,"TAA")); } public void testFindGene(){ System.out.println(findGene("xxxATGXXXXXXTAA")); System.out.println(findGene("xxxATGYYYTAG")); System.out.println(findGene("xxxATGZZZTGA")); System.out.println(findGene("xxxATGZZGA")); System.out.println(findGene("xxxTGZZGA")); System.out.println(findGene("xxxATGSSSTGAZZZTAGAAAAAATGA")); } public void testPrintallGenes(){ printAllGenes("xxxATGXXXXXXTAAxxxATGYYYYYYTAGxxxATGZZZZZZTGAxxxATZZZZZZTAAxxxATZZZZZZTAxxxATGZZZTAA"); printAllGenes("ATGTAAGATGCCCTAGT"); } }
[ "roy.p.joseph@gmail.com" ]
roy.p.joseph@gmail.com
11a7c51104297f5de600ca9718be27e34087e280
b3127d54bfc2cb4e4e4ebe7d6b547f0fb36cf852
/src/main/java/us/kochlabs/tools/life360/Life360Client.java
b9a0bd8774fc6d7e1ebab318159cf46251faa786
[]
no_license
denniskoch/java-life360
e407e6d26346e66569e63bf3b2fc4d02789778b6
f56ec2318cb45d01847c6d784714bcc5607ab3ce
refs/heads/master
2023-04-11T12:02:41.477858
2021-04-24T14:32:28
2021-04-24T14:32:28
359,970,469
0
0
null
null
null
null
UTF-8
Java
false
false
5,974
java
package us.kochlabs.tools.life360; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.ParseException; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import us.kochlabs.tools.life360.auth.Bearer; import us.kochlabs.tools.life360.circles.Circle; import us.kochlabs.tools.life360.circles.Circles; import java.io.IOException; import java.util.ArrayList; /** * Life360 Client class */ public class Life360Client { static final String AUTH_CONSTANT = "cFJFcXVnYWJSZXRyZTRFc3RldGhlcnVmcmVQdW1hbUV4dWNyRUh1YzptM2ZydXBSZXRSZXN3ZXJFQ2hBUHJFOTZxYWtFZHI0Vg=="; static final String API_BASE_URL = "https://api.life360.com/v3/"; static final String TOKEN_PATH = "oauth2/token.json"; static final String CIRCLES_PATH = "circles.json"; static final String CIRCLE_PATH = "circles/"; private String username; private String password; private String bearerToken; private HttpClient httpClient; private ObjectMapper objectMapper; /** * * @param username Life360 username * @param password Life 360 password */ public Life360Client(String username, String password) { this.username = username; this.password = password; this.bearerToken = null; this.httpClient = HttpClientBuilder.create().build(); this.objectMapper = new ObjectMapper(); } /** * Authenticates to Life360's API and obtains the bearer token for all future API calls. * * @return The result of the logon process */ public boolean authenticate() { String uri = API_BASE_URL + TOKEN_PATH; HttpPost httpPost = new HttpPost(uri); String authorization = "Basic " + AUTH_CONSTANT; httpPost.addHeader("Authorization",authorization); ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>(); postParameters.add(new BasicNameValuePair("grant_type", "password")); postParameters.add(new BasicNameValuePair("username", username)); postParameters.add(new BasicNameValuePair("password", password)); try { httpPost.setEntity(new UrlEncodedFormEntity(postParameters, "UTF-8")); HttpResponse response = httpClient.execute(httpPost); HttpEntity responseEntity = response.getEntity(); String responseString = EntityUtils.toString(responseEntity, "UTF-8"); if (response.getStatusLine().getStatusCode() == 200) { Bearer bearer = objectMapper.readValue(responseString, Bearer.class); this.bearerToken = "Bearer " + bearer.access_token; return true; } } catch (ClientProtocolException cpe) { System.out.println(cpe.getMessage()); } catch (ParseException pe) { System.out.println(pe.getMessage()); } catch (JsonProcessingException jpe) { System.out.println(jpe.getMessage()); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } return false; } /** * Performs the HTTP request with given URI, constructs headers for Life360 authentication * * @param uri URI to send the the request to * @return JSON respons string from the request */ public String apiHttpGet(String uri) { try { HttpGet httpGet = new HttpGet(uri); httpGet.addHeader("Authorization", this.bearerToken); HttpResponse response = httpClient.execute(httpGet); HttpEntity responseEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() == 200) { String responseString = EntityUtils.toString(responseEntity, "UTF-8"); return responseString; } else { return null; } } catch (ClientProtocolException cpe) { System.out.println(cpe.getMessage()); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } return null; } /** * Get all Life360 Circles for the account * * @return All circles the subscription is a member/owner of */ public Circles getAllCircles() { String uri = API_BASE_URL + CIRCLES_PATH; String responseString = apiHttpGet(uri); Circles circles = null; if (responseString != null) { //System.out.println(responseString); try { circles = objectMapper.readValue(responseString, Circles.class); } catch (Exception e) { System.out.println(e.getMessage()); } } return circles; } /** * Retrieve a Life360 from the API * * @param circleId * @return Requested Life360 circle */ public Circle getCircleById(String circleId) { String uri = API_BASE_URL + CIRCLE_PATH + circleId; String responseString = apiHttpGet(uri); Circle circle = null; if (responseString != null) { //System.out.println(responseString); try { circle = objectMapper.readValue(responseString, Circle.class); } catch (Exception e) { System.out.println(e.getMessage()); } } return circle; } }
[ "drkoch@gmail.com" ]
drkoch@gmail.com
c5de0130dc9cb5ff0fd8d6e0e8dfe2630e3646df
e6d4afa67078b9040fb6c302d2712314da9c9fd3
/rx/src/test/java/com/github/sioncheng/springs/rx/FluxTests.java
2b9bf0e1174525c090c5cf800c23a87544a917e1
[]
no_license
sioncheng/springs
56a94c310a6905bc0b1031a9c87fe7c4a26736ae
08e4a5e4bdd8fcc9f6387697cd06b09556bf45ab
refs/heads/master
2020-05-22T05:45:44.857841
2019-05-15T16:16:08
2019-05-15T16:16:08
186,241,015
0
0
null
null
null
null
UTF-8
Java
false
false
2,071
java
package com.github.sioncheng.springs.rx; import org.junit.Assert; import org.junit.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import java.util.Arrays; import java.util.List; public class FluxTests { @Test public void testCreateFlux() { Flux<String> stringFlux = Flux.just("a", "b", "c", "d", "e"); Assert.assertNotNull(stringFlux); StepVerifier.create(stringFlux) .expectNext("a") .expectNext("b") .expectNext("c") .expectNext("d") .expectNext("e") .verifyComplete(); } @Test public void testMergeFlux() { Flux<String> stringFlux1 = Flux.just("a", "b"); Flux<String> stringFlux2 = Flux.just("c", "d", "e"); StepVerifier.create(stringFlux1.mergeWith(stringFlux2)) .expectNext("a") .expectNext("b") .expectNext("c") .expectNext("d") .expectNext("e") .verifyComplete(); } @Test public void collectList() { Flux<String> fruitFlux = Flux.just( "apple", "orange", "banana", "kiwi", "strawberry"); Mono<List<String>> fruitListMono = fruitFlux.collectList(); StepVerifier .create(fruitListMono) .expectNext(Arrays.asList( "apple", "orange", "banana", "kiwi", "strawberry")) .verifyComplete(); } @Test public void all() { Flux<String> animalFlux = Flux.just( "aardvark", "elephant", "koala", "eagle", "kangaroo"); Mono<Boolean> hasAMono = animalFlux.all(a -> a.contains("a")); StepVerifier.create(hasAMono) .expectNext(true) .verifyComplete(); Mono<Boolean> hasKMono = animalFlux.all(a -> a.contains("k")); StepVerifier.create(hasKMono) .expectNext(false) .verifyComplete(); } }
[ "sion@SionMacBookPro.local" ]
sion@SionMacBookPro.local
93573561e32c9c5b26906b5dbfd3914fad6c22e6
f0ad7e39af29fcf69d233ff12436dc8b49174840
/test/trinaglePuzzle/model/TestModelType.java
9746047ed9f26bc7d9ce81796ba9cb253d6f84b6
[]
no_license
sameermalikjmi/puzzle
338a3df6af62a3afb86ecac0a33d9339095b0369
a88248a697c810fab233b5f3b6a7bcf8b2e92e0f
refs/heads/main
2023-08-12T05:04:23.808812
2021-10-09T00:59:53
2021-10-09T00:59:53
415,160,242
0
0
null
null
null
null
UTF-8
Java
false
false
2,274
java
package trinaglePuzzle.model; import org.junit.Before; import org.junit.jupiter.api.BeforeEach; import trianglePuzzle.model.Edge; import trianglePuzzle.model.Model; import trianglePuzzle.model.Node; import trianglePuzzle.model.TrianglePuzzle; public abstract class TestModelType { protected Model model; @BeforeEach public void setUp() { model = new Model(); TrianglePuzzle p = new TrianglePuzzle(); p.addNode(new Node(155, 34, 0, false)); p.addNode(new Node(115, 112, 1, false)); p.addNode(new Node( 200, 112, 2, false)); p.addNode(new Node(78, 180, 3, false)); p.addNode(new Node(162, 180, 4, false)); p.addNode(new Node(250, 180, 5, false)); p.addNode(new Node(40, 240, 6, false)); p.addNode(new Node(115, 240, 7, false)); p.addNode(new Node(200, 240, 8, false)); p.addNode(new Node(290, 240, 9, false)); p.addEdge(new Edge("red",1,p.getNodes().get(0),p.getNodes().get(1))); p.addEdge(new Edge("green",2,p.getNodes().get(1),p.getNodes().get(2))); p.addEdge(new Edge("red",3,p.getNodes().get(0),p.getNodes().get(2))); p.addEdge(new Edge("red",4,p.getNodes().get(1),p.getNodes().get(3))); p.addEdge(new Edge("green",5,p.getNodes().get(3),p.getNodes().get(4))); p.addEdge(new Edge("blue",6,p.getNodes().get(1),p.getNodes().get(4))); p.addEdge(new Edge("blue",7,p.getNodes().get(2),p.getNodes().get(4))); p.addEdge(new Edge("green",8,p.getNodes().get(4),p.getNodes().get(5))); p.addEdge(new Edge("red",9,p.getNodes().get(2),p.getNodes().get(5))); p.addEdge(new Edge("red",10,p.getNodes().get(3),p.getNodes().get(6))); p.addEdge(new Edge("green",11,p.getNodes().get(6),p.getNodes().get(7))); p.addEdge(new Edge("blue",12,p.getNodes().get(3),p.getNodes().get(7))); p.addEdge(new Edge("blue",13,p.getNodes().get(7),p.getNodes().get(4))); p.addEdge(new Edge("green",14,p.getNodes().get(7),p.getNodes().get(8))); p.addEdge(new Edge("blue",15,p.getNodes().get(4),p.getNodes().get(8))); p.addEdge(new Edge("blue",16,p.getNodes().get(5),p.getNodes().get(8))); p.addEdge(new Edge("green",17,p.getNodes().get(8),p.getNodes().get(9))); p.addEdge(new Edge("red",18,p.getNodes().get(5),p.getNodes().get(9))); p.setTriangle(p.getEdges()); model.setPuzzle(p); } }
[ "smalik@wpi.edu" ]
smalik@wpi.edu
9b66ac1aaa101f3c8cb9d92d6520505f107892b2
7467dc2c8aaa82caa88a817b19786566cddf0e48
/src/org/driver/util/CoachUtil.java
69ba8d5804fe1cacbc8269eb9421532c34bf7618
[]
no_license
Nightcxd/DriverManagerSystem
018b6c240d8e6f47edaaa22e9bc2d729bc88956b
792759ef5c2cffc7c67df959ddb93398efb6a33b
refs/heads/master
2020-06-25T05:25:57.862505
2017-07-12T03:34:37
2017-07-12T03:34:37
96,960,612
1
0
null
null
null
null
UTF-8
Java
false
false
4,156
java
package org.driver.util; import java.util.List; import org.apache.log4j.Logger; import org.driver.bean.Coach; import org.driver.bean.Trainee; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class CoachUtil { private static final Logger logger = Logger.getLogger(CoachUtil.class); private static SessionFactory sessionFactory; static { Configuration cfg = new Configuration(); cfg.configure("org/driver/util/hibernate.cfg.xml"); sessionFactory = cfg.buildSessionFactory(); } /* *保存教练 */ public void save(Coach m) { Session session = sessionFactory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); session.save(m);//保存 tx.commit(); } catch (RuntimeException e) { tx.rollback(); throw e; } finally { session.close(); } } /* 删除指定id的教练 */ public void delete(int c_id) { Session session = sessionFactory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); Coach st = (Coach) session.get(Coach.class, c_id); session.delete(st); tx.commit(); } catch (RuntimeException e) { tx.rollback(); throw e; } finally { session.close(); } } /* 更新教练 */ public void update(Coach m) { Session session = sessionFactory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); session.update(m);//保存 tx.commit(); } catch (RuntimeException e) { tx.rollback(); throw e; } finally { session.close(); } } /* 通过id获取一个教练 */ public Coach getById(String c_id) { Session session = sessionFactory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); Coach m = (Coach) session.get(Coach.class, c_id);//获取 tx.commit(); return m; } catch (RuntimeException e) { tx.rollback(); throw e; } finally { session.close(); } } /* 查询全部教练 */ public List<Coach> findAll() { Session session = sessionFactory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); List<Coach> list = session.createQuery("From Coach").list(); tx.commit(); return list; } catch (RuntimeException e) { tx.rollback(); throw e; } finally { session.close(); } } /* 分页的查询 */ public QueryResult<Coach> getCoachList(int firstResult, int maxResult) { Session session = sessionFactory.openSession(); Transaction tx = null; try { tx = session.beginTransaction(); //查询总记录数量 Long count = (Long) session.createQuery( "select count(*) from Coach") .uniqueResult();//执行查询 //查询一段数据 Query query = session.createQuery("From Coach"); query.setFirstResult(firstResult); query.setMaxResults(maxResult); List<Coach> list = query.list(); tx.commit(); return new QueryResult<Coach>(list, count); } catch (RuntimeException e) { tx.rollback(); throw e; } finally { session.close(); } } public static void main(String[] args) { } }
[ "root@hadoop1.(none)" ]
root@hadoop1.(none)
a0b5c877db0d0df78cd8bfcc810c6866601f6798
16d92a044f4ad63c6ac0c0d1f4d279abf161e607
/SummerWinter Coding(2019)/멀쩡한 사각형/Solution.java
a8ae5b2e00db2a63d458d6ebdc1f2d7148d54616
[]
no_license
nh0317/Programers
6c94e9e32c1217e5f092c4b5f6e1f67d42bae0c5
c6dccc879a8b70c77278d6be1d3c31b00fa16253
refs/heads/main
2023-03-16T22:59:08.206584
2021-03-05T15:21:21
2021-03-05T15:21:21
325,028,973
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
import java.util.*; class Solution { public long solution(int w, int h) { long total=(long)w*h; int n=0; //최대 공약수 n 구하기 for(int i=1;i<=Math.min(w,h);i++){ if(w%i==0 && h%i==0){ n=i; } } //w*h을 같은 비율로 최대한 축소한 직사각형에서 //대각선이 지나는 블록의 수 long minRemove= w/n + h/n -1; return total-(long)minRemove*n; } } /* COMMENT 동일한 폴더의 COMEMNT.hwp 참고 (표를 첨부하기 위해 한글로 작성함) */
[ "nh2004@naver.com" ]
nh2004@naver.com
3d59bde8a7c164a9113ec92ba9bbcab9c45ca192
eb79d9558896f4d144a5acf98de4f7571d8ae673
/app/src/main/java/com/jc/model/CalModel.java
2396536f67b94a6b3d1edda06580f936f5272759
[]
no_license
strangerjj/calculator
f7a4abb796f3eb30d1db6300e7274116a1f1048a
e1a7837fd1ae771ebe32c2a868e37c9eca7a3c0e
refs/heads/master
2021-01-10T03:26:55.251551
2016-02-26T09:16:35
2016-02-26T09:16:35
52,514,126
0
0
null
null
null
null
UTF-8
Java
false
false
2,764
java
package com.jc.model; import com.jc.interfaces.ICalculator; import java.util.Stack; /** * Created by YJZJB0051 on 2016-02-26. */ public class CalModel implements ICalculator { //计算器算法 public static double popOpOffStack(Stack<String> stack) { double result = 0; //从栈中获取运算数,由于运算数以字符串的形式储存 //在用作计算时需转型为可计算类型,这里用double //pop()函数为移除栈顶的元素,并返回此元素 double operand = Double.valueOf(stack.pop()); //从栈中移除元素后如果栈已为空,则直接返回operand if (stack.isEmpty()) { return operand; } //继续从栈中获取操作符,根据操作符类型继续递归调用 String operate = stack.pop(); if (operate.equals("+")) { result = CalModel.popOpOffStack(stack) + operand; } else if (operate.equals("-")) { result = CalModel.popOpOffStack(stack) - operand; } else if (operate.equals("*")) { result = CalModel.popOpOffStack(stack) * operand; } else if (operate.equals("/")) { result = CalModel.popOpOffStack(stack) / operand; } return result; } //记录输入的运算数和操作符的栈 private Stack<String> dataStack = new Stack<>(); //是否在输入操作符,对连续输入操作符的情况则视为操作符的替换 private boolean isOperate = false; @Override public void pushOperand(String operand) { //当输入运算数时直接压入stack,不会触发计算 dataStack.add(operand); isOperate = false; } @Override public double pushOperate(String operate) { //当操作符时"+-*/"时,输入会继续 //所以copy一份当前栈的数据作为参数传入进行计算并返回 //当操作符时"="号时,则直接使用当前栈作为参数 //因为"="是意味之后需要重新开始 double result; if (isOperate) { dataStack.pop();//如果前一个是操作符,则将它替换 } if (operate.equals("=")) { result = CalModel.popOpOffStack(dataStack); } else { @SuppressWarnings("unchecked") Stack<String> tmpStack = (Stack<String>) dataStack.clone(); result = CalModel.popOpOffStack(tmpStack); //计算完前面结果后把输入的运算符压入栈 dataStack.add(operate); isOperate = true; } return result; } @Override public void reset() { dataStack.removeAllElements(); isOperate = false; } }
[ "strangerjj@outlook.com" ]
strangerjj@outlook.com
ce19032a9b746f8383af9d14bae8477cb55a2540
adb073a93ec2ceae65756d9e6f2f04478d6c74aa
/advance-java/week5/23.Behavioral-design-pattern/exercise/test-module-2/src/UI.java
847ed219f0a3d541197e5b7c8c1855e5647d14ab
[]
no_license
nhlong9697/codegym
0ae20f19360a337448e206137d703c5c2056a17b
38e105272fca0aecc0e737277b3a0a47b8cc0702
refs/heads/master
2023-05-12T17:18:14.570378
2022-07-13T09:07:52
2022-07-13T09:07:52
250,012,451
0
0
null
2023-05-09T05:40:08
2020-03-25T15:12:34
JavaScript
UTF-8
Java
false
false
544
java
public class UI { public void initialize() { System.out.println("---- CHUONG TRINH QUAN LY DANH BA ----"); System.out.println("Chon chuc nang theo so (de tiep tuc):"); System.out.println("1. Xem danh sach"); System.out.println("2. Them moi"); System.out.println("3. Cap nhat"); System.out.println("4. Xoa"); System.out.println("5. Tim kiem"); System.out.println("6. Doc tu file"); System.out.println("7. Ghi vao file"); System.out.println("8. Thoat"); } }
[ "n.h.long.9697@gmail.com" ]
n.h.long.9697@gmail.com
83b5f8f9c36c8eddd347d22051cadf8e56327e54
083de3b2cea03af63bbe31f5318be34fb08fa559
/src/factory_pattern/RiffleFactory.java
2b2b0b2e5cb0d6dc4a218f8ea65d78e0b47a72b4
[ "MIT" ]
permissive
anibalfuentesjara/design-patterns
54a99d36cde53bacd255944a1459d8b53e77f866
0dca27cc5ac45a3b2e5c04c4f6070144fa3d84e2
refs/heads/main
2023-06-16T19:12:15.013865
2021-07-04T19:48:32
2021-07-04T19:48:32
379,041,984
0
0
null
null
null
null
UTF-8
Java
false
false
156
java
package factory_pattern; public class RiffleFactory implements ShellFactory { @Override public Shell createShell() { return new RiffleShell(); } }
[ "anibal.fuentes@impresee.com" ]
anibal.fuentes@impresee.com
a8a4f8245b2450d1688d882bcb522597ec864c6b
3ec181de57f014603bb36b8d667a8223875f5ee8
/jcommon/prometheus/prometheus-client/src/main/java/com/xiaomi/youpin/prometheus/client/PrometheusGauge.java
ce7ac3becb5b79bcff47f0881056d047b9af5d7e
[ "Apache-2.0" ]
permissive
XiaoMi/mone
41af3b636ecabd7134b53a54c782ed59cec09b9e
576cea4e6cb54e5bb7c37328f1cb452cda32f953
refs/heads/master
2023-08-31T08:47:40.632419
2023-08-31T08:09:35
2023-08-31T08:09:35
331,844,632
1,148
152
Apache-2.0
2023-09-14T07:33:13
2021-01-22T05:20:18
Java
UTF-8
Java
false
false
2,158
java
package com.xiaomi.youpin.prometheus.client; import io.prometheus.client.Gauge; import lombok.extern.slf4j.Slf4j; import org.slf4j.MDC; import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @author zhangxiaowei */ @Slf4j public class PrometheusGauge implements XmGauge { public Gauge myGauge; public String[] labelNames; public String[] labelValues; public PrometheusGauge() { } @Override public void set(double delta,String ...labelValues) { try { List<String> mylist = new ArrayList<>(Arrays.asList(labelValues)); mylist.add(Prometheus.constLabels.get(Metrics.SERVICE)); String[] finalValue = mylist.toArray(new String[mylist.size()]); this.myGauge.labels(finalValue).set(delta); } catch (Throwable throwable) { //log.warn(throwable.getMessage()); } } public PrometheusGauge(Gauge cb, String[] lns, String[] lvs) { this.myGauge = cb; this.labelNames = lns; this.labelValues = lvs; } @Override public XmGauge with(String... labelValue) { /*String traceId = MDC.get("tid"); if (StringUtils.isEmpty(traceId)) { traceId = "no traceId"; }*/ try { if (this.labelNames.length != labelValue.length) { log.warn("Incorrect numbers of labels : " + myGauge.describe().get(0).name); return new PrometheusGauge(); } return this; } catch (Throwable throwable) { log.warn(throwable.getMessage()); return null; } } @Override public void add(double delta,String... labelValue) { List<String> mylist = new ArrayList<>(Arrays.asList(labelValues)); mylist.add(Prometheus.constLabels.get(Metrics.SERVICE)); String[] finalValue = mylist.toArray(new String[mylist.size()]); try { this.myGauge.labels(finalValue).inc(delta); } catch (Throwable throwable) { //log.warn(throwable.getMessage()); } } }
[ "shanwenbang@xiaomi.com" ]
shanwenbang@xiaomi.com
721f5a5fb90c1e99214fee86ac1c3d9504f33f20
23749b673ff50cfb3bd09eb9662715e09da17dc8
/src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cacheobject_args.java
e2bfc0dbb6d3852ec25dda277a01cd23013d8e8a
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
netscaler/nitro
20f0499200478b971f6c11a8f77ab44113bfe1a5
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
refs/heads/master
2016-08-04T20:02:53.344531
2013-11-22T04:04:18
2013-11-22T04:04:18
8,279,932
0
0
null
null
null
null
UTF-8
Java
false
false
6,555
java
/* * Copyright (c) 2008-2015 Citrix Systems, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.citrix.netscaler.nitro.resource.config.cache; /** * Provides additional arguments required for fetching the cacheobject resource. */ public class cacheobject_args { private String url; private Long locator; private Long httpstatus; private String host; private Integer port; private String groupname; private String httpmethod; private String group; private String ignoremarkerobjects; private String includenotreadyobjects; /** * <pre> * URL of the particular object whose details is required. Parameter "host" must be specified along with the URL.<br> Minimum length = 1 * </pre> */ public void set_url(String url) throws Exception{ this.url = url; } /** * <pre> * URL of the particular object whose details is required. Parameter "host" must be specified along with the URL.<br> Minimum length = 1 * </pre> */ public String get_url() throws Exception { return this.url; } /** * <pre> * ID of the cached object. * </pre> */ public void set_locator(long locator) throws Exception { this.locator = new Long(locator); } /** * <pre> * ID of the cached object. * </pre> */ public void set_locator(Long locator) throws Exception{ this.locator = locator; } /** * <pre> * ID of the cached object. * </pre> */ public Long get_locator() throws Exception { return this.locator; } /** * <pre> * HTTP status of the object. * </pre> */ public void set_httpstatus(long httpstatus) throws Exception { this.httpstatus = new Long(httpstatus); } /** * <pre> * HTTP status of the object. * </pre> */ public void set_httpstatus(Long httpstatus) throws Exception{ this.httpstatus = httpstatus; } /** * <pre> * HTTP status of the object. * </pre> */ public Long get_httpstatus() throws Exception { return this.httpstatus; } /** * <pre> * Host name of the object. Parameter "url" must be specified.<br> Minimum length = 1 * </pre> */ public void set_host(String host) throws Exception{ this.host = host; } /** * <pre> * Host name of the object. Parameter "url" must be specified.<br> Minimum length = 1 * </pre> */ public String get_host() throws Exception { return this.host; } /** * <pre> * Host port of the object. You must also set the Host parameter.<br> Default value: 80<br> Minimum value = 1 * </pre> */ public void set_port(int port) throws Exception { this.port = new Integer(port); } /** * <pre> * Host port of the object. You must also set the Host parameter.<br> Default value: 80<br> Minimum value = 1 * </pre> */ public void set_port(Integer port) throws Exception{ this.port = port; } /** * <pre> * Host port of the object. You must also set the Host parameter.<br> Default value: 80<br> Minimum value = 1 * </pre> */ public Integer get_port() throws Exception { return this.port; } /** * <pre> * Name of the content group to which the object belongs. It will display only the objects belonging to the specified content group. You must also set the Host parameter. * </pre> */ public void set_groupname(String groupname) throws Exception{ this.groupname = groupname; } /** * <pre> * Name of the content group to which the object belongs. It will display only the objects belonging to the specified content group. You must also set the Host parameter. * </pre> */ public String get_groupname() throws Exception { return this.groupname; } /** * <pre> * HTTP request method that caused the object to be stored.<br> Default value: GET<br> Possible values = GET, POST * </pre> */ public void set_httpmethod(String httpmethod) throws Exception{ this.httpmethod = httpmethod; } /** * <pre> * HTTP request method that caused the object to be stored.<br> Default value: GET<br> Possible values = GET, POST * </pre> */ public String get_httpmethod() throws Exception { return this.httpmethod; } /** * <pre> * Name of the content group whose objects should be listed. * </pre> */ public void set_group(String group) throws Exception{ this.group = group; } /** * <pre> * Name of the content group whose objects should be listed. * </pre> */ public String get_group() throws Exception { return this.group; } /** * <pre> * Ignore marker objects. Marker objects are created when a response exceeds the maximum or minimum response size for the content group or has not yet received the minimum number of hits for the content group.<br> Possible values = ON, OFF * </pre> */ public void set_ignoremarkerobjects(String ignoremarkerobjects) throws Exception{ this.ignoremarkerobjects = ignoremarkerobjects; } /** * <pre> * Ignore marker objects. Marker objects are created when a response exceeds the maximum or minimum response size for the content group or has not yet received the minimum number of hits for the content group.<br> Possible values = ON, OFF * </pre> */ public String get_ignoremarkerobjects() throws Exception { return this.ignoremarkerobjects; } /** * <pre> * Include responses that have not yet reached a minimum number of hits before being cached.<br> Possible values = ON, OFF * </pre> */ public void set_includenotreadyobjects(String includenotreadyobjects) throws Exception{ this.includenotreadyobjects = includenotreadyobjects; } /** * <pre> * Include responses that have not yet reached a minimum number of hits before being cached.<br> Possible values = ON, OFF * </pre> */ public String get_includenotreadyobjects() throws Exception { return this.includenotreadyobjects; } public static class includenotreadyobjectsEnum { public static final String ON = "ON"; public static final String OFF = "OFF"; } public static class httpmethodEnum { public static final String GET = "GET"; public static final String POST = "POST"; } public static class ignoremarkerobjectsEnum { public static final String ON = "ON"; public static final String OFF = "OFF"; } }
[ "vijay.venkatachalam@citrix.com" ]
vijay.venkatachalam@citrix.com
bbd4d6b927a0a7d65909a4a54fb5383841e1725b
4c6adf0ce6ef3f02dcef9c345e0e5e4ff139d886
/Common/FO/fo-jar/fo-order/src/main/java/com/pay/fo/order/dto/batchpayment/BatchPaymentReqBaseInfoDTO.java
732efd4f68724ebd1af6a488419db32d125b946c
[]
no_license
happyjianguo/pay-1
8631906be62707316f0ed3eb6b2337c90d213bc0
40ae79738cfe4e5d199ca66468f3a33e9d8f2007
refs/heads/master
2020-07-27T19:51:54.958859
2016-12-19T07:34:24
2016-12-19T07:34:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,288
java
package com.pay.fo.order.dto.batchpayment; import java.util.Date; import java.util.List; public class BatchPaymentReqBaseInfoDTO { /** * 请求流水号 */ private Long requestSeq; /** * 请求类型 */ private Integer requestType; /** * 业务批次号 */ private String businessBatchNo; /** * 付款方名称 */ private String payerName; /** * 付款方登录标识 */ private String payerLoginName; /** * 付款方会员号 */ private Long payerMemberCode; /** * 付款方会员类型 */ private Integer payerMemberType; /** * 付款方账号 */ private String payerAcctCode; /** * 付款方账号类型 */ private Integer payerAcctType; /** * 创建者 */ private String creator; /** * 创建日期 */ private Date createDate; /** * 更新日期 */ private Date updateDate; /** * 审核状态 */ private Integer status; /** * 审核员 */ private String auditor; /** * 请求付款金额 */ private Long requestAmount; /** * 请求付款次数 */ private Integer requestCount; /** * 有效金额 */ private Long validAmount; /** * 有效笔数 */ private Integer validCount; /** * 是否是付款方付手续费 */ private Integer isPayerPayFee; /** * 手续费 */ private Long fee; /** * 总手续费 */ private Long totalFee; /** * 收款方手续费 */ private Long payeeFee; /** * 付款方手续费 */ private Long payerFee; /** * 实际付款金额 */ private Long realpayAmount; /** * 实际出款金额 */ private Long realoutAmount; /** * 请求来源 */ private String requestSrc; /** * 审核备注 */ private String auditRemark; /** * 请求明细信息 */ private List<RequestDetail> requestDetails; /** * 错误信息 */ private String errorMsg; /** * 处理类型 0 默认 1 定期 */ private Integer processType; /** * 执行时间 */ private Date excuteDate; private String payerCurrencyCode; public Long getTotalFee() { return totalFee; } public void setTotalFee(Long totalFee) { this.totalFee = totalFee; } public Long getPayeeFee() { return payeeFee; } public void setPayeeFee(Long payeeFee) { this.payeeFee = payeeFee; } public Long getPayerFee() { return payerFee; } public void setPayerFee(Long payerFee) { this.payerFee = payerFee; } private Integer payeeAcctType ; private String payeeCurrencyCode ; /** * @return the requestSeq */ public Long getRequestSeq() { return requestSeq; } /** * @param requestSeq * the requestSeq to set */ public void setRequestSeq(Long requestSeq) { this.requestSeq = requestSeq; } /** * @return the requestType */ public Integer getRequestType() { return requestType; } /** * @param requestType * the requestType to set */ public void setRequestType(Integer requestType) { this.requestType = requestType; } /** * @return the businessBatchNo */ public String getBusinessBatchNo() { return businessBatchNo; } /** * @param businessBatchNo * the businessBatchNo to set */ public void setBusinessBatchNo(String businessBatchNo) { this.businessBatchNo = businessBatchNo; } /** * @return the payerName */ public String getPayerName() { return payerName; } /** * @param payerName * the payerName to set */ public void setPayerName(String payerName) { this.payerName = payerName; } /** * @return the payerLoginName */ public String getPayerLoginName() { return payerLoginName; } /** * @param payerLoginName * the payerLoginName to set */ public void setPayerLoginName(String payerLoginName) { this.payerLoginName = payerLoginName; } /** * @return the payerMemberCode */ public Long getPayerMemberCode() { return payerMemberCode; } /** * @param payerMemberCode * the payerMemberCode to set */ public void setPayerMemberCode(Long payerMemberCode) { this.payerMemberCode = payerMemberCode; } /** * @return the payerMemberType */ public Integer getPayerMemberType() { return payerMemberType; } /** * @param payerMemberType * the payerMemberType to set */ public void setPayerMemberType(Integer payerMemberType) { this.payerMemberType = payerMemberType; } /** * @return the payerAcctCode */ public String getPayerAcctCode() { return payerAcctCode; } /** * @param payerAcctCode * the payerAcctCode to set */ public void setPayerAcctCode(String payerAcctCode) { this.payerAcctCode = payerAcctCode; } /** * @return the payerAcctType */ public Integer getPayerAcctType() { return payerAcctType; } /** * @param payerAcctType * the payerAcctType to set */ public void setPayerAcctType(Integer payerAcctType) { this.payerAcctType = payerAcctType; } /** * @return the creator */ public String getCreator() { return creator; } /** * @param creator * the creator to set */ public void setCreator(String creator) { this.creator = creator; } /** * @return the createDate */ public Date getCreateDate() { return createDate; } /** * @param createDate * the createDate to set */ public void setCreateDate(Date createDate) { this.createDate = createDate; } /** * @return the updateDate */ public Date getUpdateDate() { return updateDate; } /** * @param updateDate * the updateDate to set */ public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } /** * @return the status */ public Integer getStatus() { return status; } /** * @param status * the status to set */ public void setStatus(Integer status) { this.status = status; } /** * @return the auditor */ public String getAuditor() { return auditor; } /** * @param auditor * the auditor to set */ public void setAuditor(String auditor) { this.auditor = auditor; } /** * @return the requestAmount */ public Long getRequestAmount() { return requestAmount; } /** * @param requestAmount * the requestAmount to set */ public void setRequestAmount(Long requestAmount) { this.requestAmount = requestAmount; } /** * @return the requestCount */ public Integer getRequestCount() { return requestCount; } /** * @param requestCount * the requestCount to set */ public void setRequestCount(Integer requestCount) { this.requestCount = requestCount; } /** * @return the validAmount */ public Long getValidAmount() { return validAmount; } /** * @param validAmount * the validAmount to set */ public void setValidAmount(Long validAmount) { this.validAmount = validAmount; } /** * @return the validCount */ public Integer getValidCount() { return validCount; } /** * @param validCount * the validCount to set */ public void setValidCount(Integer validCount) { this.validCount = validCount; } /** * @return the isPayerPayFee */ public Integer getIsPayerPayFee() { return isPayerPayFee; } /** * @param isPayerPayFee * the isPayerPayFee to set */ public void setIsPayerPayFee(Integer isPayerPayFee) { this.isPayerPayFee = isPayerPayFee; } /** * @return the fee */ public Long getFee() { return fee; } /** * @param fee * the fee to set */ public void setFee(Long fee) { this.fee = fee; } /** * @return the realpayAmount */ public Long getRealpayAmount() { return realpayAmount; } /** * @param realpayAmount * the realpayAmount to set */ public void setRealpayAmount(Long realpayAmount) { this.realpayAmount = realpayAmount; } /** * @return the realoutAmount */ public Long getRealoutAmount() { return realoutAmount; } /** * @param realoutAmount * the realoutAmount to set */ public void setRealoutAmount(Long realoutAmount) { this.realoutAmount = realoutAmount; } /** * @return the requestSrc */ public String getRequestSrc() { return requestSrc; } /** * @param requestSrc * the requestSrc to set */ public void setRequestSrc(String requestSrc) { this.requestSrc = requestSrc; } /** * @return the auditRemark */ public String getAuditRemark() { return auditRemark; } /** * @param auditRemark * the auditRemark to set */ public void setAuditRemark(String auditRemark) { this.auditRemark = auditRemark; } /** * @return the requestDetails */ public List<RequestDetail> getRequestDetails() { return requestDetails; } /** * @param requestDetails * the requestDetails to set */ public void setRequestDetails(List<RequestDetail> requestDetails) { this.requestDetails = requestDetails; } /** * @return the errorMsg */ public String getErrorMsg() { return errorMsg; } /** * @param errorMsg * the errorMsg to set */ public void setErrorMsg(String errorMsg) { this.errorMsg = errorMsg; } public Integer getProcessType() { return processType; } public void setProcessType(Integer processType) { this.processType = processType; } public Date getExcuteDate() { return excuteDate; } public void setExcuteDate(Date excuteDate) { this.excuteDate = excuteDate; } public String getPayeeCurrencyCode() { return payeeCurrencyCode; } public void setPayeeCurrencyCode(String payeeCurrencyCode) { this.payeeCurrencyCode = payeeCurrencyCode; } public Integer getPayeeAcctType() { return payeeAcctType; } public void setPayeeAcctType(Integer payeeAcctType) { this.payeeAcctType = payeeAcctType; } public String getPayerCurrencyCode() { return payerCurrencyCode; } public void setPayerCurrencyCode(String payerCurrencyCode) { this.payerCurrencyCode = payerCurrencyCode; } @Override public String toString() { return "BatchPaymentReqBaseInfoDTO [requestSeq=" + requestSeq + ", requestType=" + requestType + ", businessBatchNo=" + businessBatchNo + ", payerName=" + payerName + ", payerLoginName=" + payerLoginName + ", payerMemberCode=" + payerMemberCode + ", payerMemberType=" + payerMemberType + ", payerAcctCode=" + payerAcctCode + ", payerAcctType=" + payerAcctType + ", creator=" + creator + ", createDate=" + createDate + ", updateDate=" + updateDate + ", status=" + status + ", auditor=" + auditor + ", requestAmount=" + requestAmount + ", requestCount=" + requestCount + ", validAmount=" + validAmount + ", validCount=" + validCount + ", isPayerPayFee=" + isPayerPayFee + ", fee=" + fee + ", totalFee=" + totalFee + ", payeeFee=" + payeeFee + ", payerFee=" + payerFee + ", realpayAmount=" + realpayAmount + ", realoutAmount=" + realoutAmount + ", requestSrc=" + requestSrc + ", auditRemark=" + auditRemark + ", requestDetails=" + requestDetails + ", errorMsg=" + errorMsg + ", processType=" + processType + ", excuteDate=" + excuteDate + ", payerCurrencyCode=" + payerCurrencyCode + ", payeeAcctType=" + payeeAcctType + ", payeeCurrencyCode=" + payeeCurrencyCode + "]"; } }
[ "stanley.zou@hrocloud.com" ]
stanley.zou@hrocloud.com
5bbb3d950ddff48773fd4225c4d713d86f6d096e
ffcff378e55c917dfaea88b5ee953fb3d9b71665
/gdxtokryo/src/test/java/com/cyphercove/gdx/gdxtokryo/tests/UtilsTest.java
902e136c3cd38e053c52b001b6260dae3b580178
[ "Apache-2.0" ]
permissive
BlueCP/gdx-cclibs
3460313b84f0c006165bed6f5cafb910a3e0dd85
63c03a9fef6be5c60e727b97c1d65c8da3cbc811
refs/heads/master
2020-04-23T16:22:25.021440
2018-03-02T02:05:18
2018-03-02T02:05:18
171,296,171
0
0
Apache-2.0
2019-02-18T14:12:05
2019-02-18T14:12:04
null
UTF-8
Java
false
false
8,450
java
package com.cyphercove.gdx.gdxtokryo.tests; import com.badlogic.gdx.math.*; import com.badlogic.gdx.math.collision.Sphere; import com.badlogic.gdx.utils.*; import com.badlogic.gdx.utils.StringBuilder; public class UtilsTest extends GdxToKryoTest { public static void main(String[] args) { UtilsTest test = new UtilsTest(); try { test.setUp(); } catch (Exception e) { e.printStackTrace(); } test.testCollections(); test.testIdentityMap(); test.testUtils(); } public void testCollections (){ Array topLevel = new Array(); ArrayMap<GridPoint2, Vector2> arrayMap = new ArrayMap<GridPoint2, Vector2>(); for (int i = 0, size = randSize(); i < size; i++) { arrayMap.put(new GridPoint2(randInt(), randInt()), new Vector2(randFloat(), randFloat())); } topLevel.add(arrayMap); Array<GridPoint3> array = new Array<GridPoint3>(); for (int i = 0, size = randSize(); i < size; i++) { array.add(new GridPoint3(randInt(), randInt(), randInt())); } topLevel.add(array); Bits bits = new Bits(); for (int i = 0, size = randSize(); i < size; i++) { if (randBool()) bits.set(i); } topLevel.add(bits); BooleanArray booleanArray = new BooleanArray(); booleanArray.setSize(randSize()); for (int i = 0; i < booleanArray.size; i++) { booleanArray.set(i, randBool()); } topLevel.add(booleanArray); ByteArray byteArray = new ByteArray(); for (int i = 0, size = randSize(); i < size; i++) { byteArray.add((byte)random.nextInt()); } topLevel.add(byteArray); CharArray charArray = new CharArray(); for (int i = 0, size = randSize(); i < size; i++) { charArray.add((char)random.nextInt()); } topLevel.add(charArray); DelayedRemovalArray<Plane> delayedRemovalArray = new DelayedRemovalArray<Plane>(); for (int i = 0, size = randSize(); i < size; i++) { delayedRemovalArray.add(new Plane(new Vector3(randFloat(), randFloat(), randFloat()), randFloat())); } topLevel.add(delayedRemovalArray); FloatArray floatArray = new FloatArray(); for (int i = 0, size = randSize(); i < size; i++) { floatArray.add(randFloat()); } topLevel.add(floatArray); IntArray intArray = new IntArray(); for (int i = 0, size = randSize(); i < size; i++) { intArray.add(random.nextInt()); } topLevel.add(intArray); IntFloatMap intFloatMap = new IntFloatMap(); for (int i = 0, size = randSize(); i < size; i++) { intFloatMap.put(randInt(), randFloat()); } topLevel.add(intFloatMap); IntIntMap intIntMap = new IntIntMap(); for (int i = 0, size = randSize(); i < size; i++) { intIntMap.put(randInt(), randInt()); } topLevel.add(intIntMap); IntMap<Rectangle> intMap = new IntMap<Rectangle>(); for (int i = 0, size = randSize(); i < size; i++) { intMap.put(randInt(), new Rectangle(randFloat(), randFloat(), randFloat(), randFloat())); } topLevel.add(intMap); IntSet intSet = new IntSet(); for (int i = 0, size = randSize(); i < size; i++) { intSet.add(random.nextInt()); } topLevel.add(intSet); LongArray longArray = new LongArray(); for (int i = 0, size = randSize(); i < size; i++) { longArray.add(random.nextLong()); } topLevel.add(longArray); LongMap<Sphere> longMap = new LongMap<Sphere>(); for (int i = 0, size = randSize(); i < size; i++) { longMap.put(random.nextLong(), new Sphere(new Vector3(randFloat(), randFloat(), randFloat()), randFloat())); } topLevel.add(longMap); ObjectFloatMap<GridPoint2> objectFloatMap = new ObjectFloatMap<GridPoint2>(); for (int i = 0, size = randSize(); i < size; i++) { objectFloatMap.put(new GridPoint2(randInt(), randInt()), randFloat()); } topLevel.add(objectFloatMap); ObjectIntMap<Vector2> objectIntMap = new ObjectIntMap<Vector2>(); for (int i = 0, size = randSize(); i < size; i++) { objectIntMap.put(new Vector2(randFloat(), randFloat()), randInt()); } topLevel.add(objectIntMap); ObjectMap<Quaternion, Matrix3> objectMap = new ObjectMap<Quaternion, Matrix3>(); for (int i = 0, size = randSize(); i < size; i++) { objectMap.put(new Quaternion(randFloat(), randFloat(), randFloat(), 1f), new Matrix3().rotate(randFloat()).scl(randFloat()).translate(randFloat(), randFloat())); } topLevel.add(objectMap); ObjectSet<Ellipse> objectSet = new ObjectSet<Ellipse>(); for (int i = 0, size = randSize(); i < size; i++) { objectSet.add(new Ellipse(randFloat(), randFloat(), randFloat(), randFloat())); } topLevel.add(objectSet); OrderedMap<Circle, Affine2> orderedMap = new OrderedMap<Circle, Affine2>(); for (int i = 0, size = randSize(); i < size; i++) { orderedMap.put(new Circle(randFloat(), randFloat(), randFloat()), new Affine2().translate(randFloat(), randFloat()).scale(randFloat(), randFloat()).rotate(randFloat())); } topLevel.add(orderedMap); OrderedSet<Vector2> orderedSet = new OrderedSet<Vector2>(); for (int i = 0, size = randSize(); i < size; i++) { orderedSet.add(new Vector2(randFloat(), randFloat())); } topLevel.add(orderedSet); Queue<GridPoint2> queue = new Queue<GridPoint2>(); for (int i = 0, size = randSize(); i < size; i++) { queue.addLast(new GridPoint2(randInt(), randInt())); } topLevel.add(queue); ShortArray shortArray = new ShortArray(); for (int i = 0, size = randSize(); i < size; i++) { shortArray.add((short)random.nextInt()); } topLevel.add(shortArray); SnapshotArray<Matrix3> snapshotArray = new SnapshotArray<Matrix3>(); for (int i = 0, size = randSize(); i < size; i++) { snapshotArray.add(new Matrix3().rotate(randFloat()).scale(randFloat(), randFloat()).translate(randFloat(), randFloat())); } topLevel.add(snapshotArray); SortedIntList<Vector3> sortedIntList = new SortedIntList<Vector3>(); int size = randSize(); IntArray indices = new IntArray(); for (int i = 0; i < size; i++) { indices.add(i); } indices.shuffle(); for (int i = 0; i < size; i++) { sortedIntList.insert(indices.get(i), new Vector3(randFloat(), randFloat(), randFloat())); } topLevel.add(sortedIntList); simpleRoundTrip(topLevel); } public void testIdentityMap (){ Array topLevel = new Array(); Circle valueCircle = new Circle(randFloat(), randFloat(), randFloat()); topLevel.add(valueCircle); Circle keyCircle = new Circle(randFloat(), randFloat(), randFloat()); topLevel.add(keyCircle); IdentityMap<Circle, Circle> identityMap = new IdentityMap<Circle, Circle>(); for (int i = 0, size = randSize() + 5; i < size; i++) { if (i == 5){ identityMap.put(keyCircle, valueCircle); continue; } identityMap.put(new Circle(randFloat(), randFloat(), randFloat()), new Circle(randFloat(), randFloat(), randFloat())); } topLevel.add(identityMap); Array returnedArray = simpleRoundTrip(topLevel); Circle returnedValueCircle = (Circle) returnedArray.get(0); Circle returnedKeyCircle = (Circle) returnedArray.get(1); IdentityMap<Circle, Circle> returnedMap = (IdentityMap<Circle, Circle>)returnedArray.get(2); assertTrue(returnedValueCircle == returnedMap.get(returnedKeyCircle)); } public void testUtils (){ StringBuilder stringBuilder = new StringBuilder(); for (int i = 0, size = randSize(); i < size; i++) { stringBuilder.append((char)randInt()); } simpleRoundTrip(stringBuilder); } }
[ "dakeese@gmail.com" ]
dakeese@gmail.com
2a74df8b914420623ee0489ea6ffd23578f42475
3a165d9594c3fdeb4b7b8bc54a478ad453cfe180
/app/src/main/java/com/android/frkrny/teamworkpro/custom/RoundedDrawable.java
7055f84e21246efa5b5d6b154485a52ab66deeac
[]
no_license
frank-rooney/teamworkpro
bcd63064c750bfdc93257a53e685ff204d7a652f
6c585bf4293d40dfd256e0c8171949bdbaf1aa88
refs/heads/master
2021-01-16T00:03:16.889333
2017-08-13T20:15:05
2017-08-13T20:15:05
99,951,114
0
0
null
null
null
null
UTF-8
Java
false
false
12,332
java
package com.android.frkrny.teamworkpro.custom; import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.Log; import android.widget.ImageView; /** * Credit below: * https://github.com/vinc3m1/RoundedImageView */ class RoundedDrawable extends Drawable { private static final String TAG = "RoundedDrawable"; static final int DEFAULT_BORDER_COLOR = Color.BLACK; private final RectF mBounds = new RectF(); private final RectF mDrawableRect = new RectF(); private final RectF mBitmapRect = new RectF(); private final BitmapShader mBitmapShader; private final Paint mBitmapPaint; private final int mBitmapWidth; private final int mBitmapHeight; private final RectF mBorderRect = new RectF(); private final Paint mBorderPaint; private final Matrix mShaderMatrix = new Matrix(); private float mCornerRadius = 0; private boolean mOval = false; private float mBorderWidth = 0; private ColorStateList mBorderColor = ColorStateList.valueOf(DEFAULT_BORDER_COLOR); private ImageView.ScaleType mScaleType = ImageView.ScaleType.FIT_CENTER; private RoundedDrawable(Bitmap bitmap) { mBitmapWidth = bitmap.getWidth(); mBitmapHeight = bitmap.getHeight(); mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight); mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapShader.setLocalMatrix(mShaderMatrix); mBitmapPaint = new Paint(); mBitmapPaint.setStyle(Paint.Style.FILL); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint = new Paint(); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); mBorderPaint.setStrokeWidth(mBorderWidth); } @Nullable static RoundedDrawable fromBitmap(Bitmap bitmap) { if (bitmap != null) { return new RoundedDrawable(bitmap); } else { return null; } } private static Drawable fromDrawable(Drawable drawable) { if (drawable != null) { if (drawable instanceof RoundedDrawable) { // just return if it's already a RoundedDrawable return drawable; } else if (drawable instanceof LayerDrawable) { LayerDrawable ld = (LayerDrawable) drawable; int num = ld.getNumberOfLayers(); // loop through layers to and change to RoundedDrawables if possible for (int i = 0; i < num; i++) { Drawable d = ld.getDrawable(i); ld.setDrawableByLayerId(ld.getId(i), fromDrawable(d)); } return ld; } // try to get a bitmap from the drawable and Bitmap bm = drawableToBitmap(drawable); if (bm != null) { return new RoundedDrawable(bm); } else { Log.w(TAG, "Failed to create bitmap from drawable!"); } } return drawable; } private static Bitmap drawableToBitmap(Drawable drawable) { if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable) drawable).getBitmap(); } Bitmap bitmap; int width = Math.max(drawable.getIntrinsicWidth(), 1); int height = Math.max(drawable.getIntrinsicHeight(), 1); try { bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); } catch (Exception e) { e.printStackTrace(); bitmap = null; } return bitmap; } @Override public boolean isStateful() { return mBorderColor.isStateful(); } @Override protected boolean onStateChange(int[] state) { int newColor = mBorderColor.getColorForState(state, 0); if (mBorderPaint.getColor() != newColor) { mBorderPaint.setColor(newColor); return true; } else { return super.onStateChange(state); } } private void updateShaderMatrix() { float scale; float dx; float dy; switch (mScaleType) { case CENTER: mBorderRect.set(mBounds); mBorderRect.inset((mBorderWidth) / 2, (mBorderWidth) / 2); mShaderMatrix.set(null); mShaderMatrix.setTranslate((int) ((mBorderRect.width() - mBitmapWidth) * 0.5f + 0.5f), (int) ((mBorderRect.height() - mBitmapHeight) * 0.5f + 0.5f)); break; case CENTER_CROP: mBorderRect.set(mBounds); mBorderRect.inset((mBorderWidth) / 2, (mBorderWidth) / 2); mShaderMatrix.set(null); dx = 0; dy = 0; if (mBitmapWidth * mBorderRect.height() > mBorderRect.width() * mBitmapHeight) { scale = mBorderRect.height() / (float) mBitmapHeight; dx = (mBorderRect.width() - mBitmapWidth * scale) * 0.5f; } else { scale = mBorderRect.width() / (float) mBitmapWidth; dy = (mBorderRect.height() - mBitmapHeight * scale) * 0.5f; } mShaderMatrix.setScale(scale, scale); mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, (int) (dy + 0.5f) + mBorderWidth); break; case CENTER_INSIDE: mShaderMatrix.set(null); if (mBitmapWidth <= mBounds.width() && mBitmapHeight <= mBounds.height()) { scale = 1.0f; } else { scale = Math.min(mBounds.width() / (float) mBitmapWidth, mBounds.height() / (float) mBitmapHeight); } dx = (int) ((mBounds.width() - mBitmapWidth * scale) * 0.5f + 0.5f); dy = (int) ((mBounds.height() - mBitmapHeight * scale) * 0.5f + 0.5f); mShaderMatrix.setScale(scale, scale); mShaderMatrix.postTranslate(dx, dy); mBorderRect.set(mBitmapRect); mShaderMatrix.mapRect(mBorderRect); mBorderRect.inset((mBorderWidth) / 2, (mBorderWidth) / 2); mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); break; default: case FIT_CENTER: mBorderRect.set(mBitmapRect); mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.CENTER); mShaderMatrix.mapRect(mBorderRect); mBorderRect.inset((mBorderWidth) / 2, (mBorderWidth) / 2); mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); break; case FIT_END: mBorderRect.set(mBitmapRect); mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.END); mShaderMatrix.mapRect(mBorderRect); mBorderRect.inset((mBorderWidth) / 2, (mBorderWidth) / 2); mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); break; case FIT_START: mBorderRect.set(mBitmapRect); mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.START); mShaderMatrix.mapRect(mBorderRect); mBorderRect.inset((mBorderWidth) / 2, (mBorderWidth) / 2); mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); break; case FIT_XY: mBorderRect.set(mBounds); mBorderRect.inset((mBorderWidth) / 2, (mBorderWidth) / 2); mShaderMatrix.set(null); mShaderMatrix.setRectToRect(mBitmapRect, mBorderRect, Matrix.ScaleToFit.FILL); break; } mDrawableRect.set(mBorderRect); mBitmapShader.setLocalMatrix(mShaderMatrix); } @Override protected void onBoundsChange(Rect bounds) { super.onBoundsChange(bounds); mBounds.set(bounds); updateShaderMatrix(); } @Override public void draw(@NonNull Canvas canvas) { if (mOval) { if (mBorderWidth > 0) { canvas.drawOval(mDrawableRect, mBitmapPaint); canvas.drawOval(mBorderRect, mBorderPaint); } else { canvas.drawOval(mDrawableRect, mBitmapPaint); } } else { if (mBorderWidth > 0) { canvas.drawRoundRect(mDrawableRect, Math.max(mCornerRadius, 0), Math.max(mCornerRadius, 0), mBitmapPaint); canvas.drawRoundRect(mBorderRect, mCornerRadius, mCornerRadius, mBorderPaint); } else { canvas.drawRoundRect(mDrawableRect, mCornerRadius, mCornerRadius, mBitmapPaint); } } } @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; } @Override public void setAlpha(int alpha) { mBitmapPaint.setAlpha(alpha); invalidateSelf(); } @Override public void setColorFilter(ColorFilter cf) { mBitmapPaint.setColorFilter(cf); invalidateSelf(); } @Override public void setDither(boolean dither) { mBitmapPaint.setDither(dither); invalidateSelf(); } @Override public void setFilterBitmap(boolean filter) { mBitmapPaint.setFilterBitmap(filter); invalidateSelf(); } @Override public int getIntrinsicWidth() { return mBitmapWidth; } @Override public int getIntrinsicHeight() { return mBitmapHeight; } public float getCornerRadius() { return mCornerRadius; } RoundedDrawable setCornerRadius(float radius) { mCornerRadius = radius; return this; } public float getBorderWidth() { return mBorderWidth; } RoundedDrawable setBorderWidth(float width) { mBorderWidth = width; mBorderPaint.setStrokeWidth(mBorderWidth); return this; } public int getBorderColor() { return mBorderColor.getDefaultColor(); } RoundedDrawable setBorderColor(ColorStateList colors) { mBorderColor = colors != null ? colors : ColorStateList.valueOf(0); mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR)); return this; } public RoundedDrawable setBorderColor(int color) { return setBorderColor(ColorStateList.valueOf(color)); } public ColorStateList getBorderColors() { return mBorderColor; } public boolean isOval() { return mOval; } RoundedDrawable setOval(boolean oval) { mOval = oval; return this; } public ImageView.ScaleType getScaleType() { return mScaleType; } public RoundedDrawable setScaleType(ImageView.ScaleType scaleType) { if (scaleType == null) { scaleType = ImageView.ScaleType.FIT_CENTER; } if (mScaleType != scaleType) { mScaleType = scaleType; updateShaderMatrix(); } return this; } Bitmap toBitmap() { return drawableToBitmap(this); } }
[ "frk.rny@gmail.com" ]
frk.rny@gmail.com
b7ad3d648d9fe6f6b6211ce9b1a54c24f60fd5c5
96a7161f31fb3e2b309006c3e0ba914bb3d93216
/src/main/java/org/mattrr78/passwordgenenv/GeneratePasswordRequest.java
05ae00ec24183e748734d589c4b92c4da2af6d2b
[]
no_license
mattrr78/passwordgenenv
c36626d5806ae32d03d9073606082cfff8f29987
cef7c8c3d26fb90d3774add62dee3cc9ccd7e5b3
refs/heads/master
2023-02-21T10:11:07.872203
2021-01-08T01:46:12
2021-01-08T01:46:12
324,277,030
0
0
null
null
null
null
UTF-8
Java
false
false
1,460
java
package org.mattrr78.passwordgenenv; public class GeneratePasswordRequest { private int count = 1; private int minimumLength = 6; private int maximumLength = 50; private CharacterType[] allowedTypes = CharacterType.values(); private CharacterType[] atLeastOneTypes = { CharacterType.LOWER, CharacterType.UPPER, CharacterType.NUMBER }; private int hogCpuValue = 0; public int getCount() { return count; } public void setCount(int count) { this.count = count; } public int getMinimumLength() { return minimumLength; } public void setMinimumLength(int minimumLength) { this.minimumLength = minimumLength; } public int getMaximumLength() { return maximumLength; } public void setMaximumLength(int maximumLength) { this.maximumLength = maximumLength; } public CharacterType[] getAllowedTypes() { return allowedTypes; } public void setAllowedTypes(CharacterType[] allowedTypes) { this.allowedTypes = allowedTypes; } public CharacterType[] getAtLeastOneTypes() { return atLeastOneTypes; } public void setAtLeastOneTypes(CharacterType[] atLeastOneTypes) { this.atLeastOneTypes = atLeastOneTypes; } public int getHogCpuValue() { return hogCpuValue; } public void setHogCpuValue(int hogCpuValue) { this.hogCpuValue = hogCpuValue; } }
[ "mattrr78@gmail.com" ]
mattrr78@gmail.com
359d506a1eda4d70ea85b6696dd5871a479a82e0
c2227ab39a41107646e1048a6fa5e3cc30c7e8df
/DataStructure/Graph/WeightedQuickUnionUF.java
2b346e5ceee1d0647592baf5def31d1b1136e4af
[]
no_license
TylerYang/algorithm
56d0ae35e34710ec472c0cbbd8cc1efa586346be
742a40abf0eca3014218bcfa2589affe524ca077
refs/heads/master
2020-05-16T13:42:23.716529
2016-02-15T11:19:50
2016-02-15T11:19:50
33,816,520
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
public class WeightedQuickUnionUF{ int count; int[] sz, id; public WeightedQuickUnionUF(int N) { count = N; sz = new int[N]; id = new int[N]; for(int i = 0; i < id.length; i++) { id[i] = i; } } private int count() { return count; } private boolean connected(int p, int q) { return find(p) == find(q); } private int find(int p) { while(p != id[p]) p = id[p]; return p; } private void union(int p, int q){ int pId = id[p], qId = id[q]; if(pId == qId) return; if(sz[pId] < sz[qId]) { id[pId] = qId; sz[qId] += sz[pId]; } else { id[qId] = pId; sz[pId] += sz[qId]; } count--; } }
[ "tyler.z.yang@gmail.com" ]
tyler.z.yang@gmail.com
01e718bce28e6d78bbba8084348af100e767913f
a0fe0337f1c7534dc58d77e44b716a85eb0f1fd2
/src/test/java/org/hsqldb/TestOdbcTypes.java
3a702a461305871785c255ce1442084fa0437136
[]
no_license
sluk3r/hsqldbSrc
124f7c0b6d88fc5e0b65adcae5bfe1f80cbe8fc5
541d8933fdf616c49e52112ab42ec7bc6f0259de
refs/heads/master
2016-09-06T16:24:51.902115
2014-07-15T01:11:38
2014-07-15T01:11:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
64,326
java
/* Copyright (c) 2001-2011, The HSQL Development Group * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the HSQL Development Group nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.hsqldb; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.Time; import java.sql.Timestamp; /** * See AbstractTestOdbc for more general ODBC hsqldb information. * * @see AbstractTestOdbc */ public class TestOdbcTypes extends AbstractTestOdbc { /* HyperSQL types to be tested: * * Exact Numeric * TINYINT * SMALLINT * INTEGER * BIGINT * NUMERIC(p?,s?) = DECIMAL() (default for decimal literals) * Approximate Numeric * FLOAT(p?) * DOUBLE = REAL (default for literals with exponent) * BOOLEAN * Character Strings * CHARACTER(1l)* = CHAR() * CHARACTER VARYING(1l) = VARCHAR() = LONGVARCHAR() * CLOB(1l) = CHARACTER LARGE OBJECT(1) * Binary Strings * BINARY(1l)* * BINARY VARYING(1l) = VARBINARY() * BLOB(1l) = BINARY LARGE OBJECT() * Bits * BIT(1l) * BIT VARYING(1l) * OTHER (for holding serialized Java objects) * Date/Times * DATE * TIME(p?,p?) * TIMESTAMP(p?,p?) * INTERVAL...(p2,p0) */ public TestOdbcTypes() {} /** * Accommodate JUnit's hsqldb-runner conventions. */ public TestOdbcTypes(String s) { super(s); } protected void populate(Statement st) throws SQLException { st.executeUpdate("DROP TABLE alltypes IF EXISTS"); st.executeUpdate("CREATE TABLE alltypes (\n" + " id INTEGER,\n" + " ti TINYINT,\n" + " si SMALLINT,\n" + " i INTEGER,\n" + " bi BIGINT,\n" + " n NUMERIC(5,2),\n" + " f FLOAT(5),\n" + " r DOUBLE,\n" + " b BOOLEAN,\n" + " c CHARACTER(3),\n" + " cv CHARACTER VARYING(3),\n" + " bt BIT(9),\n" + " btv BIT VARYING(3),\n" + " d DATE,\n" + " t TIME(2),\n" + " tw TIME(2) WITH TIME ZONE,\n" + " ts TIMESTAMP(2),\n" + " tsw TIMESTAMP(2) WITH TIME ZONE,\n" + " bin BINARY(4),\n" + " vb VARBINARY(4),\n" + " dsival INTERVAL DAY(5) TO SECOND(6),\n" + " sival INTERVAL SECOND(6,4)\n" + ')'); /** TODO: This hsqldb class can't handle testing unlmited VARCHAR, since * we set up with strict size setting, which prohibits unlimited * VARCHARs. Need to write a standalone hsqldb class to hsqldb that. */ // Would be more elegant and efficient to use a prepared statement // here, but our we want this setup to be as simple as possible, and // leave feature testing for the actual unit tests. st.executeUpdate("INSERT INTO alltypes VALUES (\n" + " 1, 3, 4, 5, 6, 7.8, 8.9, 9.7, true, 'ab', 'cd',\n" + " b'10', b'10', current_date, '13:14:00',\n" + " '15:16:00', '2009-02-09 16:17:18', '2009-02-09 17:18:19',\n" + " x'A103', x'A103', " + "INTERVAL '145 23:12:19.345' DAY TO SECOND,\n" + " INTERVAL '1000.345' SECOND\n" + ')' ); st.executeUpdate("INSERT INTO alltypes VALUES (\n" + " 2, 3, 4, 5, 6, 7.8, 8.9, 9.7, true, 'ab', 'cd',\n" + " b'10', b'10', current_date, '13:14:00',\n" + " '15:16:00', '2009-02-09 16:17:18', '2009-02-09 17:18:19',\n" + " x'A103', x'A103', " + " INTERVAL '145 23:12:19.345' DAY TO SECOND,\n" + " INTERVAL '1000.345' SECOND\n" + ')' ); } public void testIntegerSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Integer.class, rs.getObject("i").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(5, rs.getInt("i")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testTinyIntSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Integer.class, rs.getObject("ti").getClass()); // Nb. HyperSQL purposefully returns an Integer for this type assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals((byte) 3, rs.getByte("ti")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testSmallIntSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Integer.class, rs.getObject("si").getClass()); // Nb. HyperSQL purposefully returns an Integer for this type assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals((short) 4, rs.getShort("si")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBigIntSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Long.class, rs.getObject("bi").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(6, rs.getLong("bi")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } /* public void testNumericSimpleRead() { // This is failing. // Looks like we inherited a real bug with numerics from psqlodbc, // because the problem exists with Postresql-supplied psqlodbc // connecting to a Postgresql server. ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(BigDecimal.class, rs.getObject("n").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(new BigDecimal(7.8), rs.getBigDecimal("n")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } */ public void testFloatSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Double.class, rs.getObject("f").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(8.9D, rs.getDouble("f"), 0D); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testDoubleSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Double.class, rs.getObject("r").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(9.7D, rs.getDouble("r"), 0D); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBooleanSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Boolean.class, rs.getObject("b").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertTrue(rs.getBoolean("b")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testCharSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("c").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("ab ", rs.getString("c")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testVarCharSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("cv").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("cd", rs.getString("cv")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testFixedStringSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT i, 'fixed str' fs, cv\n" + "FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("fs").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("fixed str", rs.getString("fs")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testDerivedStringSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT i, cv || 'appendage' app, 4\n" + "FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("app").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("cdappendage", rs.getString("app")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testDateSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(java.sql.Date.class, rs.getObject("d").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals( new java.sql.Date(new java.util.Date().getTime()).toString(), rs.getDate("d").toString()); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testTimeSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(java.sql.Time.class, rs.getObject("t").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Time.valueOf("13:14:00"), rs.getTime("t")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } /* public void testTimeWSimpleRead() { // This hsqldb is failing because the JDBC Driver is returning a // String instead of a Time oject for rs.getTime(). ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(java.sql.Time.class, rs.getObject("tw").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Time.valueOf("15:16:00"), rs.getTime("tw")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } */ public void testTimestampSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Timestamp.class, rs.getObject("ts").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Timestamp.valueOf("2009-02-09 16:17:18"), rs.getTimestamp("ts")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testTimestampWSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Timestamp.class, rs.getObject("tsw").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Timestamp.valueOf("2009-02-09 17:18:19"), rs.getTimestamp("tsw")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBitSimpleRead() { // This hsqldb is failing because of a BIT padding bug in the engine. ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("100000000", rs.getString("bt")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBitVaryingSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("10", rs.getString("btv")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBinarySimpleRead() { ResultSet rs = null; Statement st = null; byte[] expectedBytes = new byte[] { (byte) 0xa1, (byte) 0x03, (byte) 0, (byte) 0 }; byte[] ba; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("A1030000", rs.getString("bin")); assertTrue("Got only one row with id in (1, 2)", rs.next()); ba = rs.getBytes("bin"); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong", expectedBytes.length, ba.length); for (int i = 0; i < ba.length; i++) { assertEquals("Byte " + i + " wrong", expectedBytes[i], ba[i]); } } public void testVarBinarySimpleRead() { ResultSet rs = null; Statement st = null; byte[] expectedBytes = new byte[] { (byte) 0xa1, (byte) 0x03 }; byte[] ba; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("A103", rs.getString("vb")); assertTrue("Got only one row with id in (1, 2)", rs.next()); ba = rs.getBytes("vb"); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong", expectedBytes.length, ba.length); for (int i = 0; i < ba.length; i++) { assertEquals("Byte " + i + " wrong", expectedBytes[i], ba[i]); } } public void testDaySecIntervalSimpleRead() { /* Since our client does not support the INTERVAL precision * constraints, the returned value will always be toString()'d to * precision of microseconds. */ ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("145 23:12:19.345000", rs.getString("dsival")); assertTrue("Got only one row with id in (1, 2)", rs.next()); // Can't hsqldb the class, because jdbc:odbc or the driver returns // a String for getObject() for interval values. assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testSecIntervalSimpleRead() { /* Since our client does not support the INTERVAL precision * constraints, the returned value will always be toString()'d to * precision of microseconds. */ ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("1000.345000", rs.getString("sival")); assertTrue("Got only one row with id in (1, 2)", rs.next()); // Can't hsqldb the class, because jdbc:odbc or the driver returns // a String for getObject() for interval values. assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testIntegerComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, i) VALUES(?, ?)"); ps.setInt(1, 3); ps.setInt(2, 495); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE i = ?"); ps.setInt(1, 495); rs = ps.executeQuery(); assertTrue("Got no rows with i = 495", rs.next()); assertEquals(Integer.class, rs.getObject("i").getClass()); assertTrue("Got only one row with i = 495", rs.next()); assertEquals(495, rs.getInt("i")); assertFalse("Got too many rows with i = 495", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testTinyIntComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, ti) VALUES(?, ?)"); ps.setInt(1, 3); ps.setByte(2, (byte) 200); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE ti = ?"); ps.setByte(1, (byte) 200); rs = ps.executeQuery(); assertTrue("Got no rows with ti = 200", rs.next()); assertEquals(Integer.class, rs.getObject("ti").getClass()); assertTrue("Got only one row with ti = 200", rs.next()); assertEquals((byte) 200, rs.getByte("ti")); assertFalse("Got too many rows with ti = 200", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testSmallIntComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, si) VALUES(?, ?)"); ps.setInt(1, 3); ps.setShort(2, (short) 395); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE si = ?"); ps.setShort(1, (short) 395); rs = ps.executeQuery(); assertTrue("Got no rows with si = 395", rs.next()); assertEquals(Integer.class, rs.getObject("si").getClass()); // Nb. HyperSQL purposefully returns an Integer for this type assertTrue("Got only one row with si = 395", rs.next()); assertEquals((short) 395, rs.getShort("si")); assertFalse("Got too many rows with si = 395", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testBigIntComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, bi) VALUES(?, ?)"); ps.setInt(1, 3); ps.setLong(2, 295L); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE bi = ?"); ps.setLong(1, 295L); rs = ps.executeQuery(); assertTrue("Got no rows with bi = 295L", rs.next()); assertEquals(Long.class, rs.getObject("bi").getClass()); assertTrue("Got only one row with bi = 295L", rs.next()); assertEquals(295L, rs.getLong("bi")); assertFalse("Got too many rows with bi = 295L", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /* TODO: Implement this hsqldb after get testNumericSimpleRead() working. * See that method above. public void testNumericComplex() { */ public void testFloatComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, f) VALUES(?, ?)"); ps.setInt(1, 3); ps.setFloat(2, 98.765F); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE f = ?"); ps.setFloat(1, 98.765F); rs = ps.executeQuery(); assertTrue("Got no rows with f = 98.765F", rs.next()); assertEquals(Double.class, rs.getObject("f").getClass()); assertTrue("Got only one row with f = 98.765F", rs.next()); assertEquals(98.765D, rs.getDouble("f"), .01D); assertFalse("Got too many rows with f = 98.765F", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testDoubleComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, r) VALUES(?, ?)"); ps.setInt(1, 3); ps.setDouble(2, 876.54D); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE r = ?"); ps.setDouble(1, 876.54D); rs = ps.executeQuery(); assertTrue("Got no rows with r = 876.54D", rs.next()); assertEquals(Double.class, rs.getObject("r").getClass()); assertTrue("Got only one row with r = 876.54D", rs.next()); assertEquals(876.54D, rs.getDouble("r"), 0D); assertFalse("Got too many rows with r = 876.54D", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testBooleanComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, b) VALUES(?, ?)"); ps.setInt(1, 3); ps.setBoolean(2, false); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE b = ?"); ps.setBoolean(1, false); rs = ps.executeQuery(); assertTrue("Got no rows with b = false", rs.next()); assertEquals(Boolean.class, rs.getObject("b").getClass()); assertTrue("Got only one row with b = false", rs.next()); assertEquals(false, rs.getBoolean("b")); assertFalse("Got too many rows with b = false", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testCharComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, c) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "xy"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE c = ?"); ps.setString(1, "xy "); rs = ps.executeQuery(); assertTrue("Got no rows with c = 'xy '", rs.next()); assertEquals(String.class, rs.getObject("c").getClass()); assertTrue("Got only one row with c = 'xy '", rs.next()); assertEquals("xy ", rs.getString("c")); assertFalse("Got too many rows with c = 'xy '", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testVarCharComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, cv) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "xy"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE cv = ?"); ps.setString(1, "xy"); rs = ps.executeQuery(); assertTrue("Got no rows with cv = 'xy'", rs.next()); assertEquals(String.class, rs.getObject("cv").getClass()); assertTrue("Got only one row with cv = 'xy'", rs.next()); assertEquals("xy", rs.getString("cv")); assertFalse("Got too many rows with cv = 'xy'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /** * TODO: Find out if there is a way to select based on an expression * using a named derived pseudo-column. public void testDerivedComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "SELECT id, cv || 'app' appendage FROM alltypes\n" + "WHERE appendage = ?"); ps.setString(1, "cvapp"); rs = ps.executeQuery(); assertTrue("Got no rows appendage = 'cvapp'", rs.next()); assertEquals(String.class, rs.getObject("r").getClass()); assertTrue("Got only one row with appendage = 'cvapp'", rs.next()); assertEquals("cvapp", rs.getString("r")); assertFalse("Got too many rows with appendage = 'cvapp'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } */ public void testDateComplex() { PreparedStatement ps = null; ResultSet rs = null; java.sql.Date tomorrow = new java.sql.Date(new java.util.Date().getTime() + 1000 * 60 * 60 * 24); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, d) VALUES(?, ?)"); ps.setInt(1, 3); ps.setDate(2, tomorrow); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE d = ?"); ps.setDate(1, tomorrow); rs = ps.executeQuery(); assertTrue("Got no rows with d = tomorrow", rs.next()); assertEquals(java.sql.Date.class, rs.getObject("d").getClass()); assertTrue("Got only one row with d = tomorrow", rs.next()); assertEquals(tomorrow.toString(), rs.getDate("d").toString()); // Compare the Strings since "tomorrow" has resolution to // millisecond, but getDate() is probably to the day. assertFalse("Got too many rows with d = tomorrow", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testTimeComplex() { PreparedStatement ps = null; ResultSet rs = null; Time aTime = Time.valueOf("21:19:27"); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, t) VALUES(?, ?)"); ps.setInt(1, 3); ps.setTime(2, aTime); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE t = ?"); ps.setTime(1, aTime); rs = ps.executeQuery(); assertTrue("Got no rows with t = aTime", rs.next()); assertEquals(Time.class, rs.getObject("t").getClass()); assertTrue("Got only one row with t = aTime", rs.next()); assertEquals(aTime, rs.getTime("t")); assertFalse("Got too many rows with t = aTime", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /* TODO: Implement this hsqldb after get testTimeWSimpleRead() working. * See that method above. public void testTimeWComplex() { */ public void testTimestampComplex() { PreparedStatement ps = null; ResultSet rs = null; Timestamp aTimestamp = Timestamp.valueOf("2009-03-27 17:18:19"); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, ts) VALUES(?, ?)"); ps.setInt(1, 3); ps.setTimestamp(2, aTimestamp); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE ts = ?"); ps.setTimestamp(1, aTimestamp); rs = ps.executeQuery(); assertTrue("Got no rows with ts = aTimestamp", rs.next()); assertEquals(Timestamp.class, rs.getObject("ts").getClass()); assertTrue("Got only one row with ts = aTimestamp", rs.next()); assertEquals(aTimestamp, rs.getTimestamp("ts")); assertFalse("Got too many rows with ts = aTimestamp", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testTimestampWComplex() { PreparedStatement ps = null; ResultSet rs = null; Timestamp aTimestamp = Timestamp.valueOf("2009-03-27 17:18:19"); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, tsw) VALUES(?, ?)"); ps.setInt(1, 3); ps.setTimestamp(2, aTimestamp); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE tsw = ?"); ps.setTimestamp(1, aTimestamp); rs = ps.executeQuery(); assertTrue("Got no rows with tsw = aTimestamp", rs.next()); assertEquals(Timestamp.class, rs.getObject("tsw").getClass()); assertTrue("Got only one row with tsw = aTimestamp", rs.next()); assertEquals(aTimestamp, rs.getTimestamp("tsw")); assertFalse("Got too many rows with tsw = aTimestamp", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /* * Driver needs to be modified to transfer bits in byte (binary) fashion, * the same as is done for VARBINARY/bytea type. public void testBitComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, bt) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "101"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE bt = ?"); ps.setString(1, "101"); rs = ps.executeQuery(); assertTrue("Got no rows with bt = 101", rs.next()); assertEquals(String.class, rs.getObject("bt").getClass()); assertTrue("Got only one row with bt = 101", rs.next()); assertEquals("101000000", rs.getString("bt")); assertFalse("Got too many rows with bt = 101", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testBitVaryingComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, btv) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "10101"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE btv = ?"); ps.setString(1, "10101"); rs = ps.executeQuery(); assertTrue("Got no rows with btv = 10101", rs.next()); assertEquals(String.class, rs.getObject("btv").getClass()); assertTrue("Got only one row with btv = 10101", rs.next()); assertEquals("10101", rs.getString("btv")); assertFalse("Got too many rows with btv = 10101", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } */ public void testBinaryComplex() { PreparedStatement ps = null; ResultSet rs = null; byte[] expectedBytes = new byte[] { (byte) 0xaa, (byte) 0x99, (byte) 0, (byte) 0 }; byte[] ba1, ba2; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, bin) VALUES(?, ?)"); ps.setInt(1, 3); ps.setBytes(2, expectedBytes); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE bin = ?"); ps.setBytes(1, expectedBytes); rs = ps.executeQuery(); assertTrue("Got no rows with bin = b'AA99'", rs.next()); ba1 = rs.getBytes("bin"); assertTrue("Got only one row with bin = b'AA99'", rs.next()); ba2 = rs.getBytes("bin"); assertFalse("Got too many rows with bin = b'AA99'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong (1)", expectedBytes.length, ba1.length); for (int i = 0; i < ba1.length; i++) { assertEquals("Byte " + i + " wrong (1)", expectedBytes[i], ba1[i]); } assertEquals("Retrieved bye array length wrong (2)", expectedBytes.length, ba2.length); for (int i = 0; i < ba2.length; i++) { assertEquals("Byte " + i + " wrong (2)", expectedBytes[i], ba2[i]); } } public void testVarBinaryComplex() { PreparedStatement ps = null; ResultSet rs = null; byte[] expectedBytes = new byte[] { (byte) 0xaa, (byte) 0x99 }; byte[] ba1, ba2; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, vb) VALUES(?, ?)"); ps.setInt(1, 3); ps.setBytes(2, expectedBytes); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE vb = ?"); ps.setBytes(1, expectedBytes); rs = ps.executeQuery(); assertTrue("Got no rows with vb = b'AA99'", rs.next()); ba1 = rs.getBytes("vb"); assertTrue("Got only one row with vb = b'AA99'", rs.next()); ba2 = rs.getBytes("vb"); assertFalse("Got too many rows with vb = b'AA99'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong (1)", expectedBytes.length, ba1.length); for (int i = 0; i < ba1.length; i++) { assertEquals("Byte " + i + " wrong (1)", expectedBytes[i], ba1[i]); } assertEquals("Retrieved bye array length wrong (2)", expectedBytes.length, ba2.length); for (int i = 0; i < ba2.length; i++) { assertEquals("Byte " + i + " wrong (2)", expectedBytes[i], ba2[i]); } } /* * TODO: Learn how to set input params for INTERVAL types. * I don't see how I could set the variant * (HOUR, ...TO SECOND, etc.) with setString() or anything else. public void testDaySecIntervalComplex() { PreparedStatement ps = null; ResultSet rs = null; try { assertEquals("145 23:12:19.345000", rs.getString("dsival")); ps = netConn.prepareStatement( "INSERT INTO alltypes(id, dsival) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, 876.54D); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE dsival = ?"); ps.setString(1, 876.54D); rs = ps.executeQuery(); assertTrue("Got no rows with dsival = 876.54D", rs.next()); assertEquals(String.class, rs.getObject("dsival").getClass()); assertTrue("Got only one row with dsival = 876.54D", rs.next()); assertEquals(876.54D, rs.getString("dsival")); assertFalse("Got too many rows with dsival = 876.54D", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testSecIntervalComplex() { PreparedStatement ps = null; ResultSet rs = null; try { assertEquals("1000.345000", rs.getString("sival")); ps = netConn.prepareStatement( "INSERT INTO alltypes(id, sival) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, 876.54D); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE sival = ?"); ps.setString(1, 876.54D); rs = ps.executeQuery(); assertTrue("Got no rows with sival = 876.54D", rs.next()); assertEquals(String.class, rs.getObject("sival").getClass()); assertTrue("Got only one row with sival = 876.54D", rs.next()); assertEquals(876.54D, rs.getString("sival")); assertFalse("Got too many rows with sival = 876.54D", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } */ public static void main(String[] sa) { staticRunner(TestOdbcTypes.class, sa); } /* static protected boolean closeEnough(Time t1, Time t2, int fudgeMin) { long delta = t1.getTime() - t2.getTime(); if (delta < 0) { delta *= -1; } //System.err.println("Delta " + delta); //System.err.println("exp " + (fudgeMin * 1000 * 60)); return delta < fudgeMin * 1000 * 60; } */ }
[ "sluk3r@gmail.com" ]
sluk3r@gmail.com
85d386e658f3eb689708f9fdb3bf7c03f5d26f47
a767641ac3d8258a3280f807a1b5329a4c5565e9
/src/test/java/com/miage/altea/tp/pokemon_ui/controller/IndexControllerTest.java
42caaaeac61c395cfccdab0df1c8d6928bc77f90
[]
no_license
ALTEA-2019-2020/game-ui-tchobels
f87800c05c02b6d0545ebbf4b9ce30ebcbba20dc
6102b77645c322db5e6edfd258d1c3f6a595053e
refs/heads/master
2020-12-27T12:51:24.857432
2020-04-04T19:21:21
2020-04-04T19:21:21
237,909,790
0
0
null
2020-02-10T09:32:22
2020-02-03T07:36:35
null
UTF-8
Java
false
false
1,905
java
package com.miage.altea.tp.pokemon_ui.controller; import com.miage.altea.tp.pokemon_ui.trainers.service.impl.TrainerServiceImpl; import org.junit.jupiter.api.Test; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import static org.junit.jupiter.api.Assertions.*; public class IndexControllerTest { @Test void controllerShouldBeAnnotated() { assertNotNull(IndexController.class.getAnnotation(Controller.class)); } @Test void index_shouldReturnTheNameOfTheIndexTemplate() { var indexController = new IndexController(new TrainerServiceImpl()); var viewName = indexController.index(); assertEquals("index", viewName); } @Test void index_shouldBeAnnotated() throws NoSuchMethodException { var indexMethod = IndexController.class.getMethod("index"); var getMapping = indexMethod.getAnnotation(GetMapping.class); assertNotNull(getMapping); assertArrayEquals(new String[]{"/"}, getMapping.value()); } @Test void registerNewTrainer_shouldReturnAModelAndView() { var indexController = new IndexController(new TrainerServiceImpl()); var modelAndView = indexController.registerNewTrainer("Blue"); assertNotNull(modelAndView); assertEquals("register", modelAndView.getViewName()); assertEquals("Blue", modelAndView.getModel().get("name")); } @Test void registerNewTrainer_shouldBeAnnotated() throws NoSuchMethodException { var registerMethod = IndexController.class.getDeclaredMethod("registerNewTrainer", String.class); var getMapping = registerMethod.getAnnotation(PostMapping.class); assertNotNull(getMapping); assertArrayEquals(new String[]{"/registerTrainer"}, getMapping.value()); } }
[ "alexis.bels@outlook.fr" ]
alexis.bels@outlook.fr
7d9fe0408ae4f62dfb4bb8564823174c5dd97f5f
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/branches/apitest1/code/base/dso-common/src/com/tc/object/net/DSOClientMessageChannel.java
772b87dc99081c86f744f10a46cd2c456d942ce9
[]
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,380
java
/* * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright * notice. All rights reserved. */ package com.tc.object.net; import com.tc.async.api.Sink; import com.tc.net.GroupID; import com.tc.net.MaxConnectionsExceededException; import com.tc.net.protocol.tcm.ChannelEventListener; import com.tc.net.protocol.tcm.ClientMessageChannel; import com.tc.net.protocol.tcm.TCMessageType; import com.tc.object.ClientIDProvider; import com.tc.object.msg.AcknowledgeTransactionMessageFactory; import com.tc.object.msg.ClientHandshakeMessageFactory; import com.tc.object.msg.CommitTransactionMessageFactory; import com.tc.object.msg.CompletedTransactionLowWaterMarkMessageFactory; import com.tc.object.msg.JMXMessage; import com.tc.object.msg.LockRequestMessageFactory; import com.tc.object.msg.ObjectIDBatchRequestMessageFactory; import com.tc.object.msg.RequestManagedObjectMessageFactory; import com.tc.object.msg.RequestRootMessageFactory; import com.tc.util.TCTimeoutException; import java.io.IOException; import java.net.UnknownHostException; public interface DSOClientMessageChannel { public void addClassMapping(TCMessageType messageType, Class messageClass); public ClientIDProvider getClientIDProvider(); public void addListener(ChannelEventListener listener); public void routeMessageType(TCMessageType messageType, Sink destSink, Sink hydrateSink); public void open() throws MaxConnectionsExceededException, TCTimeoutException, UnknownHostException, IOException; public boolean isConnected(); public void close(); public ClientMessageChannel channel(); public LockRequestMessageFactory getLockRequestMessageFactory(); public CompletedTransactionLowWaterMarkMessageFactory getCompletedTransactionLowWaterMarkMessageFactory(); public RequestRootMessageFactory getRequestRootMessageFactory(); public RequestManagedObjectMessageFactory getRequestManagedObjectMessageFactory(); public ObjectIDBatchRequestMessageFactory getObjectIDBatchRequestMessageFactory(); public CommitTransactionMessageFactory getCommitTransactionMessageFactory(); public ClientHandshakeMessageFactory getClientHandshakeMessageFactory(); public AcknowledgeTransactionMessageFactory getAcknowledgeTransactionMessageFactory(); public JMXMessage getJMXMessage(); public GroupID[] getGroupIDs(); }
[ "amiller@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
amiller@7fc7bbf3-cf45-46d4-be06-341739edd864
475d75c0652e3f4ce576396738931184f5545d25
cc03c34962b9994d279cb3abcf53f60655dcddcd
/src/com/TMMS/Main/action/user/ShowUserLoginLogAction.java
f0ac73b83f867e5712a11eecbd4d27965d06b473
[]
no_license
shianqi/TMMS
1d452ce9f12661a717551f028c62b0ac73732847
ec169827eb1dfdba6dc0e97976678154d274262f
refs/heads/master
2021-01-21T04:50:21.614227
2016-06-05T03:22:01
2016-06-05T03:22:01
54,723,050
5
0
null
null
null
null
UTF-8
Java
false
false
994
java
package com.TMMS.Main.action.user; import java.util.List; import java.util.Map; import org.apache.struts2.ServletActionContext; import com.TMMS.Main.bean.Ul; import com.TMMS.Main.service.UsersService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class ShowUserLoginLogAction extends ActionSupport{ List<Ul> list; public List<Ul> getList() { return list; } public void setList(List<Ul> list) { this.list = list; } @Override public String execute() throws Exception { // TODO Auto-generated method stub Map<String, Object> session= ActionContext.getContext().getSession(); if(session.get("state")==null||session.get("state").equals("0")){ return ERROR; } UsersService usersService = new UsersService(); long username = Long.valueOf(String.valueOf(session.get("U_ID"))); list = usersService.showUserLoginLog(username); ServletActionContext.getRequest().setAttribute("list", list); return SUCCESS; } }
[ "shianqi@imudges.com" ]
shianqi@imudges.com
54cf69b4e9b5872c076ba273f1beb8ebdf4717b4
217572a4cede0cb431a89d96e2525233f7fdcde9
/callback/src/com/xiaodu/callback/d/AsyncInterfaceCallback.java
85acdeb607f355dd1609b96465c8ddd41f908d96
[]
no_license
greatestrabit/AdvancedJava
903f56bbff4a20aca17bcbd4895c0a9a5cf5204f
976932a33f60ed72779af5585cec7bfbf32e8523
refs/heads/master
2021-01-17T14:46:12.873769
2016-06-23T07:57:59
2016-06-23T07:57:59
54,872,440
2
1
null
null
null
null
UTF-8
Java
false
false
986
java
package com.xiaodu.callback.d; /** * 基于接口的异步回调,每次建立新的线程 * @author xiaodu.email@gmail.com * */ public class AsyncInterfaceCallback { /** * 使用内部类的实现方式,此处可见回调地狱 * @author xiaodu.email@gmail.com */ private static void innerMain() { Server server = new Server(); new Thread(new Runnable() { @Override public void run() { server.answer(new IClient() { @Override public void recvAnswer(final String answer) { System.out.println(answer); } }, "What is the answer to life, the universe and everything?"); } }).start(); System.out.println("asked ! waiting for the answer..."); } public static void main(final String[] args) { Server server = new Server(); ClientAsync client = new ClientAsync(server); client.ask("What is the answer to life, the universe and everything?"); System.out.println("asked ! waiting for the answer..."); innerMain(); } }
[ "xiaodu.email@gmail.com" ]
xiaodu.email@gmail.com
283a5fd934ed4fb6580dc7a2cddf9309fb46e1e0
777067dff55d5194c9b08e871a277ecbae8ae279
/spring3_myspringframework/src/main/java/com/yc/bean/HelloWorld.java
63decac1b253d707bec2c47d6295e70f90efe18a
[]
no_license
zyw0205/spring-test1
7d77bc7cbfb8e8c027146f4bbe1c9a219558fd97
f3fce0b5683f0b85dc105fb15a31dad2a291f33f
refs/heads/main
2023-04-02T15:07:04.286132
2021-04-15T03:54:11
2021-04-15T03:54:11
358,112,066
0
0
null
null
null
null
UTF-8
Java
false
false
510
java
package com.yc.bean; import com.yc.springframework.stereotype.MyPostConstruct; import com.yc.springframework.stereotype.MyPreDestroy; public class HelloWorld { @MyPostConstruct public void setup(){ System.out.println("MyPostConstruct"); } @MyPreDestroy public void destroy(){ System.out.println("MyPreDestroy"); } public HelloWorld(){ System.out.println("hello world 构造"); } public void show(){ System.out.println("show"); } }
[ "1738020386@qq.com" ]
1738020386@qq.com
d85615197349eec061cd3d414eb8a258f682a1ea
136264d27911b54402406f35c041fc7a3f6210cc
/jeeweb-web/jeeweb-admin/src/main/java/cn/jeeweb/web/ebp/schedule/DayReportScheduleService.java
8f9a429278457273889d16cf26a255b3fb867d7b
[ "Apache-2.0" ]
permissive
iteryijiang/jeeweb
41e525dd240c6855bf3fca5fd9105a0a8b0abd40
bf540eb4daf1b8889514b4f135e4820e2ebcb1fc
refs/heads/master
2022-11-26T03:52:03.372666
2019-08-01T12:45:05
2019-08-01T12:45:05
162,131,820
2
1
Apache-2.0
2022-11-24T02:52:51
2018-12-17T13:05:47
Java
UTF-8
Java
false
false
801
java
package cn.jeeweb.web.ebp.schedule; import java.util.Date; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import cn.jeeweb.common.utils.DateUtils; import cn.jeeweb.web.ebp.report.service.DayReportService; /** * 每天运行一次生成平台的日报汇总数据 * * @author ytj * */ @Component("dayReportScheduleService") public class DayReportScheduleService { @Autowired private DayReportService dayReportService; public void run() { //即将生成日报的日期 Date currentDate=DateUtils.getCurrentDate(); Date sourceDate=DateUtils.dateAddDay(currentDate,-1); try { dayReportService.addDayReportForCreate(sourceDate); } catch (Exception e) { e.printStackTrace(); } } }
[ "yaotengjiao135798@163.com" ]
yaotengjiao135798@163.com
6d85249513dc305b39f23de1808da4446de5ab1d
3f463152ff01258f4f57fc544b5300ec5c540702
/app/src/main/java/user/test/com/test_android_user/db/CityDao.java
5933931cf4f51018b12e6b67679da724998521d4
[]
no_license
Rocktiger/test_android_user
ee730b0d1408f1164893faf95677485bb043fe96
0ca7df8d0d39555a8de60886090618b94d98c581
refs/heads/master
2020-04-22T14:02:39.121997
2020-04-15T03:34:44
2020-04-15T03:34:44
170,429,744
0
0
null
null
null
null
UTF-8
Java
false
false
6,416
java
package user.test.com.test_android_user.db; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import user.test.com.test_android_user.bean.City; /** * {@link DataBaseHelper} */ public class CityDao { private static final String TABLE = "t_city"; private final String CITY_ID = "city_id"; private final String CITY_NAME = "city_name"; private final String PINYIN = "pinyin"; private final String SERVICE_OPRN = "service_open"; private DataBaseHelper mDataBaseHelper; private SQLiteDatabase db; public CityDao(Context context) { mDataBaseHelper = new DataBaseHelper(context); } public boolean isEmpty() { db = mDataBaseHelper.getWritableDatabase(); Cursor cursor = db.rawQuery("select count(*) as c from " + TABLE, null); if (cursor.moveToNext()) { int count = cursor.getInt(0); if (count > 0) { return false; } } return true; } public long insert(City city) { db = mDataBaseHelper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(CITY_ID, city.getCity_id()); values.put(CITY_NAME, city.getName()); values.put(PINYIN, city.getPinyin()); values.put(SERVICE_OPRN, city.getService_open()); long result = db.insert(TABLE, null, values); closeQuietly(db); return result; } public boolean queryCityExist(SQLiteDatabase db, String city_id){ if (db == null){ db = mDataBaseHelper.getReadableDatabase(); } boolean isExist = false; Cursor cursor = null; try{ cursor = db.query(TABLE, new String[]{CITY_ID}, CITY_ID + "=?", new String[]{city_id}, null, null, null, null); if (cursor !=null && cursor.getCount()>0) { isExist = true; } }catch (Exception e){ e.printStackTrace(); }finally { closeQuietly(cursor); } return isExist; } public long insertOrUpdate(List<City> citys) { long result = -1; db = mDataBaseHelper.getWritableDatabase(); db.beginTransaction(); try { for (City city : citys) { if (city != null && city.checkCity()) { ContentValues values = new ContentValues(); values.put(CITY_ID, city.getCity_id()); values.put(CITY_NAME, city.getName()); values.put(PINYIN, city.getPinyin()); values.put(SERVICE_OPRN, city.getService_open()); if (!queryCityExist(db, city.getCity_id()+"")){ result = db.insert(TABLE, null, values); }else { result = db.update(TABLE, values, CITY_ID + "=?", new String[]{ city.getCity_id()+"" }); } } } result = 0; db.setTransactionSuccessful(); } catch (SQLiteConstraintException e) { e.printStackTrace(); return result; } catch (Exception e) { e.printStackTrace(); return result; } finally { db.endTransaction(); closeQuietly(db); } return result; } public List<City> queryAll() { db = mDataBaseHelper.getReadableDatabase(); List<City> cities = new ArrayList<>(); Cursor cursor = db.rawQuery("select * from " + TABLE, null); if (cursor.moveToFirst()) { do { City city = new City(); city.setCity_id(cursor.getInt(cursor.getColumnIndex(CITY_ID))); city.setCity_name(cursor.getString(cursor.getColumnIndex(CITY_NAME))); city.setPinyin(cursor.getString(cursor.getColumnIndex(PINYIN))); city.setService_open(cursor.getInt(cursor.getColumnIndex(SERVICE_OPRN))); cities.add(city); } while (cursor.moveToNext()); } closeQuietly(db); Collections.sort(cities, new CityComparator()); return cities; } public List<City> searchCity(final String keyword) { return searchCity(keyword, true); } public List<City> searchCity(final String keyword, boolean isIncludePinYin) { db = mDataBaseHelper.getReadableDatabase(); String sqlStr = "select * from " + TABLE + " where city_name like \"%" + keyword + "%\"" + (isIncludePinYin ? " or pinyin like \"%" + keyword + "%\"" : ""); Cursor cursor = db.rawQuery(sqlStr, null); List<City> result = new ArrayList<>(); City city; while (cursor.moveToNext()) { String name = cursor.getString(cursor.getColumnIndex(CITY_NAME)); String pinyin = cursor.getString(cursor.getColumnIndex(PINYIN)); city = new City(name, pinyin); city.setService_open(cursor.getInt(cursor.getColumnIndex(SERVICE_OPRN))); city.setCity_id(cursor.getInt(cursor.getColumnIndex(CITY_ID))); result.add(city); } cursor.close(); db.close(); Collections.sort(result, new CityComparator()); return result; } private void closeQuietly(Closeable closeable) { if (null != closeable) { try { closeable.close(); } catch (IOException e) { e.printStackTrace(); } } } /** * sort by a-z */ private class CityComparator implements Comparator<City> { @Override public int compare(City lhs, City rhs) { if (lhs == null || rhs == null || TextUtils.isEmpty(lhs.getPinyin()) || TextUtils.isEmpty(rhs.getPinyin())) { return 0; } String a = lhs.getPinyin().substring(0, 1); String b = rhs.getPinyin().substring(0, 1); return a.compareTo(b); } } }
[ "" ]
4b7b77a11da4e11987484e2e0343cb7592dda208
ab8a3756a6d0580376deb3cf3cd1c3321f071343
/src/com/vositor/vositor/Element.java
671af1ae6f05f545a3b84935a9d1db183aa549d6
[]
no_license
gongpb/DesignPatterns
427e51159b3513fc05040bd32d7197d85251e043
4a7888a40396a61326bb88d07bb29a0a3214396e
refs/heads/master
2021-05-02T05:48:17.308084
2020-06-01T13:51:07
2020-06-01T13:51:07
13,065,223
1
1
null
null
null
null
GB18030
Java
false
false
341
java
package com.vositor.vositor; /** * 抽象元素 * 声明有哪一类访问者访问,程序中通过accept方法的参数来定义的 * @author gong_pibao */ public abstract class Element { //定义业务逻辑 public abstract void doSomething(); //允许访问者访问 public abstract void accept(IVisitor visitor); }
[ "my_program@126.com" ]
my_program@126.com
5dd876a0bd92e509959dd36c3729c5a39cb2e529
ce85f1a02ee0528e9c48b9a43015c745d219fb82
/InnowhiteRed5/src/com/innowhite/red5/audio/events/UnknownConferenceEvent.java
73013a33f5f5e584ccda1f28c85f2fcbcf30849c
[]
no_license
firemonk9/innowhite-server
36495e11eced76f9217f726ddcb91a2305eadb8c
e9281f02e98e299b0229ef3d5e14ec090e7d1174
refs/heads/master
2020-12-24T15:58:12.003036
2012-09-13T04:37:03
2012-09-13T04:37:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,116
java
/** * ===License Header=== * * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ * * Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below). * * This program 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. * * BigBlueButton 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 BigBlueButton; if not, see <http://www.gnu.org/licenses/>. * * ===License Header=== */ package com.innowhite.red5.audio.events; public class UnknownConferenceEvent extends ConferenceEvent { public UnknownConferenceEvent(String participantId, String room) { super(participantId, room); } }
[ "dhiraj.peechara@gmail.com" ]
dhiraj.peechara@gmail.com
c9fac3d37fc9ae4a7e2125953c92f0017fdb42b5
a4fbaba4bc6d2b6ba8922aa52765e6f4a9689245
/app/src/main/java/com/rharshit/stocker/base/widgets/IncludeExtendedFloatingActionButton.java
1cb278a15d5876a926e37100727b809e747d874d
[]
no_license
rharshit/StockerApp
3e53dcf315eea1a937824bf9e1618b081320780d
8a47fa72acda0bbdbf51c696b2d7accf2f35552a
refs/heads/master
2023-02-06T12:21:46.356435
2021-01-01T11:40:10
2021-01-01T11:40:10
313,230,973
0
0
null
2021-01-01T11:40:11
2020-11-16T08:08:00
Java
UTF-8
Java
false
false
264
java
package com.rharshit.stocker.base.widgets; import android.view.View; public interface IncludeExtendedFloatingActionButton { boolean isExtendedFabRequired(); void onExtendedFabClickListener(View v); boolean onExtendedFabLongClickListener(View v); }
[ "rharshit98@gmail.com" ]
rharshit98@gmail.com
13303dffeb861aea77613510ae7d6d55bcb955ff
fe86674d19d06e1d71d3369e0a9bb9d8f6637993
/app/src/main/java/com/example/windows/plink/ForgotPasswordActivity.java
0ae9c5e596b8b95a0f148672d3859c8359ff6c4a
[]
no_license
gopalkrisshna/Plink
029768336e7d74cae3c498cd3e141c7cb488b443
111fbf526f2e1f0184464304dc18e401949b801f
refs/heads/master
2021-05-06T03:39:37.100340
2017-12-20T16:00:44
2017-12-20T16:00:44
114,903,470
0
0
null
null
null
null
UTF-8
Java
false
false
3,951
java
package com.example.windows.plink; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.Toast; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import java.io.IOException; import java.io.UnsupportedEncodingException; public class ForgotPasswordActivity extends AppCompatActivity { EditText txtmob; String ip, mob; ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_forgot_password); //ipc mechanism getting data from login activity Bundle extras = getIntent().getExtras(); if (extras != null) { ip = extras.getString("ip"); } txtmob = (EditText) findViewById(R.id.fmobile); //creating progress dialog progressDialog = new ProgressDialog(ForgotPasswordActivity.this); progressDialog.setMessage("Please wait..."); progressDialog.setTitle("Forgot Password"); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setCancelable(false); } //called when button pressed //construct the url and call network task public void forget_pass(View view) { mob = txtmob.getText().toString().trim(); if (mob.equals("")) { Toast.makeText(getApplicationContext(), "Please enter registered mobile number", Toast.LENGTH_SHORT).show(); return; } String URL = ip + "/location/getpass.php?mobile=" + mob; URL = URL.trim(); System.out.println(URL); GetXMLTask task = new GetXMLTask(); task.execute(new String[]{URL}); } //network task performed private class GetXMLTask extends AsyncTask<String, Void, String> { //show progress dialog @Override protected void onPreExecute() { super.onPreExecute(); progressDialog.show(); } //perform network operations in background @Override protected String doInBackground(String... urls) { String output = null; for (String url : urls) { output = getOutputFromUrl(url); } return output; } private String getOutputFromUrl(String url) { String output = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); output = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return output; } //read the response @Override protected void onPostExecute(String output) { progressDialog.dismiss(); if (output != null) { output = output.trim(); Toast.makeText(getApplicationContext(), output, Toast.LENGTH_LONG).show(); } else Toast.makeText(getApplicationContext(), "Please try again...", Toast.LENGTH_LONG).show(); } } }
[ "gopalkrisshna@gmail.com" ]
gopalkrisshna@gmail.com
da7fb0e5f97b61e88ee00f11e7ed6c3203616101
af6dc32485bc2a89b5f86c1ce7a34fedd1d06fe1
/app/src/main/java/com/sundeepnarang/myfirstapp/Hum.java
ac2d6be2502f67bf611dcf496f29166010a48cab
[]
no_license
sundeepnarang/MyFirstApp
77374d49ff12147ea1ab01f2a2d41f534cf3f555
0eea5643d9146e91350396c8893005cdd9316169
refs/heads/master
2020-05-18T09:23:18.469806
2015-08-27T01:43:38
2015-08-27T01:43:38
41,459,229
0
0
null
null
null
null
UTF-8
Java
false
false
1,119
java
package com.sundeepnarang.myfirstapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class Hum extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hum); } /* @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_hum, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }*/ }
[ "sundeepnrng@gmail.com" ]
sundeepnrng@gmail.com
d5f79674f8a43002d510dd9c8c20720c9f6ded73
550b556e18ffb58e3e55fa8fd2fa5f5331fd8aea
/03_java_array_advance/src/step3_01/arrayAdvance1/ArrayEx26_정답2.java
1935833752e745b20c08efb67cbdd465ec3e93a1
[]
no_license
sojin612/sojin612magait03
a93303f8a3f149308857cc929be1aa5094e2b8e5
7a9e5e0311c487bc0dc57b9a709e11ee2e8400f7
refs/heads/master
2023-02-27T16:49:19.291184
2021-02-09T05:52:41
2021-02-09T05:52:41
325,923,238
0
0
null
null
null
null
UTF-8
Java
false
false
648
java
package step3_01.arrayAdvance1; import java.util.Random; import java.util.Scanner; /* * # 1 to 50[3단계] : 1 to 18 * 1. 구글에서 1 to 50 이라고 검색한다. * 2. 1 to 50 순발력 게임을 선택해 게임을 실습해본다. * 3. 위 게임을 숫자범위를 좁혀 1 to 18로 직접 구현한다. * 4. 숫자 1~9는 front 배열에 저장하고, * 숫자 10~18은 back 배열에 저장한다. */ public class ArrayEx26_정답2 { public static void main(String[] args) { final int SIZE = 9; int[] front = new int[SIZE]; int[] back = new int[SIZE]; } }
[ "sojin kim@DESKTOP-15HF2TJ" ]
sojin kim@DESKTOP-15HF2TJ
a3e31620abb8de5cf2d3a44414dc64f5df53071d
e68d1d911d72d9b56ad142ee1cbde1bd31def4e1
/app/src/main/java/mx/cetys/jorgepayan/whatsonsale/Controllers/Activities/LocationDetailsActivity.java
f2de99d466943edcd3249279bc6b1da911c052f2
[]
no_license
jpayan/WhatsOnSale
fdce2a566697c98b2fc591d75b457239061f98b2
5d9634daaf4073dba8d775b60c4f38fcbba32f14
refs/heads/master
2021-08-23T18:05:30.958079
2017-12-06T00:59:52
2017-12-06T00:59:52
111,599,209
0
1
null
null
null
null
UTF-8
Java
false
false
6,830
java
package mx.cetys.jorgepayan.whatsonsale.Controllers.Activities; import android.content.Intent; import android.support.v4.app.FragmentManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlacePicker; import java.util.ArrayList; import java.util.HashMap; import mx.cetys.jorgepayan.whatsonsale.Controllers.Fragments.LocationHomeFragment; import mx.cetys.jorgepayan.whatsonsale.Models.BusinessLocation; import mx.cetys.jorgepayan.whatsonsale.Utils.DB.Helpers.LocationHelper; import mx.cetys.jorgepayan.whatsonsale.Utils.SimpleDialog; import mx.cetys.jorgepayan.whatsonsale.R; import mx.cetys.jorgepayan.whatsonsale.Utils.Utils; public class LocationDetailsActivity extends AppCompatActivity { int PLACE_PICKER_REQUEST = 1; EditText editTextLocationAddress; EditText editTextLocationName; Button btnSaveLocation; Button btnDeleteLocation; LocationHelper locationHelper; BusinessLocation businessLocation = new BusinessLocation(); boolean edit = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_location_details); locationHelper = new LocationHelper(getApplicationContext()); editTextLocationAddress = (EditText) findViewById(R.id.edit_text_locationAddress); editTextLocationName = (EditText) findViewById(R.id.edit_txt_locationName); btnSaveLocation = (Button) findViewById(R.id.btn_saveLocation); btnDeleteLocation = (Button) findViewById(R.id.btn_deleteLocation); Intent fromActivity = getIntent(); int callingActivity = fromActivity.getIntExtra(LocationHomeFragment.CALLING_ACTIVITY, 0); if (callingActivity == 0) { btnDeleteLocation.setVisibility(View.INVISIBLE); btnDeleteLocation.setClickable(false); } else { edit = true; businessLocation = fromActivity.getParcelableExtra(LocationHomeFragment.LOCATION); System.out.println("BusinessLocation"); System.out.println(businessLocation); editTextLocationName.setText(businessLocation.getName()); editTextLocationAddress.setText(businessLocation.getAddress()); } final FragmentManager fm = getSupportFragmentManager(); editTextLocationAddress.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); Intent intent; try { intent = builder.build(LocationDetailsActivity.this); startActivityForResult(intent, PLACE_PICKER_REQUEST); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } } } ); btnSaveLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { businessLocation.setName(editTextLocationName.getText().toString()); if(businessLocation.getName().length() > 0 && businessLocation.getAddress().length() > 0) { final String locationId = (edit) ? businessLocation.getLocationId() : locationHelper.addLocation("", businessLocation.getName(), BusinessHomeActivity.currentBusiness.getBusinessId(), businessLocation.getLatitude(), businessLocation.getLongitude(), businessLocation.getAddress()); if (edit) { locationHelper.updateLocation(businessLocation); } Utils.post("location", getApplicationContext(), new HashMap<String, String>(){{ put("address", businessLocation.getAddress()); put("location_name", businessLocation.getName()); put("latitude", String.valueOf(businessLocation.getLatitude())); put("longitude", String.valueOf(businessLocation.getLongitude())); put("business_id", BusinessHomeActivity.currentBusiness.getBusinessId()); put("location_id", locationId); }}); Intent data = new Intent(); data.putExtra(LocationHomeFragment.SUCCESS, "saved."); setResult(RESULT_OK, data); finish(); } else { SimpleDialog emptyFieldsDialog = new SimpleDialog( "Fill up all the fields before saving the businessLocation.", "Ok"); emptyFieldsDialog.show(fm, "Alert Dialog Fragment"); } } }); btnDeleteLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { locationHelper.deleteLocation(businessLocation.getLocationId()); Utils.delete("businessLocation", getApplicationContext(), new ArrayList<String>() {{ add(businessLocation.getLocationId()); }}, fm); Intent data = new Intent(); data.putExtra(LocationHomeFragment.SUCCESS, "deleted."); setResult(RESULT_OK, data); finish(); } }); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) { if (resultCode == RESULT_OK) { Place place = PlacePicker.getPlace(data, this); businessLocation.setAddress((String) place.getAddress()); businessLocation.setLatitude(place.getLatLng().latitude); businessLocation.setLongitude(place.getLatLng().longitude); editTextLocationAddress.setText(businessLocation.getAddress()); } } } @Override public void onBackPressed() { finish(); } }
[ "jalexpayan@gmail.com" ]
jalexpayan@gmail.com
1ffc19f159c39946d9305f1a56119e44331dc7ca
c8a63acb2da62ef8bc8d6a7114b9521e45c423a6
/src/main/java/com/zz/police/modules/sys/generator/JdbcGenUtils.java
5ede04aa7cf7fe9ef37801211cfedb4e75cc80fb
[]
no_license
dengkp/police
8e02c03108bb994ec83629f634ba4aeab797151b
a9fda998c4179682fa8ca646ce8324e996331200
refs/heads/master
2020-04-02T03:49:29.731440
2018-10-21T10:56:05
2018-10-21T10:56:05
153,986,448
0
0
null
null
null
null
UTF-8
Java
false
false
9,217
java
package com.zz.police.modules.sys.generator; import com.zz.police.common.utils.CommonUtils; import com.zz.police.common.utils.JdbcUtils; import com.zz.police.common.utils.PropertiesUtils; import com.zz.police.modules.sys.entity.ColumnEntity; import com.zz.police.modules.sys.entity.TableEntity; import org.apache.commons.lang.StringUtils; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * 代码生成工具类(使用jdbc生成本地代码) * @author dengkp */ public class JdbcGenUtils { public static void generatorCode(String jdbcDriver, String jdbcUrl, String jdbcUsername, String jdbcPassword, String tablePrefix, String javaModule, String webModule) throws Exception { String rootPath = ""; String osName = "os.name"; String osWindows = "win"; if(!System.getProperty(osName).toLowerCase().startsWith(osWindows)) { rootPath = "/"; } String tableSql = "SELECT table_name, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = (SELECT DATABASE()) AND table_name LIKE '" + tablePrefix + "_%';"; JdbcUtils jdbcUtils = new JdbcUtils(jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword); List<Map> tableList = jdbcUtils.selectByParams(tableSql, null); TableEntity table = null; List<TableEntity> tables = new ArrayList<>(); Iterator<Map> tableIterator = tableList.iterator(); while(tableIterator.hasNext()) { Map<String, String> currTable = tableIterator.next(); table = new TableEntity(); String tableName = currTable.get("TABLE_NAME"); String className = GenUtils.tableToJava(tableName, ""); table.setTableName(tableName); table.setClassName(className); table.setObjName(StringUtils.uncapitalize(className)); table.setTableComment(currTable.get("TABLE_COMMENT")); String columnSql = "SELECT column_name,data_type,column_comment,column_key,extra FROM information_schema.columns WHERE TABLE_NAME = '"+ tableName + "' AND table_schema = (SELECT DATABASE()) ORDER BY ordinal_position"; ColumnEntity columnEntity = null; List<Map> columnList = jdbcUtils.selectByParams(columnSql,null); Iterator<Map> columnIterator = columnList.iterator(); while(columnIterator.hasNext()){ Map<String, String> currColumn = columnIterator.next(); columnEntity = new ColumnEntity(); columnEntity.setExtra(currColumn.get("EXTRA")); String columnName = currColumn.get("COLUMN_NAME"); String methodName = GenUtils.columnToJava(columnName); columnEntity.setColumnName(columnName); columnEntity.setFieldName(StringUtils.uncapitalize(methodName)); columnEntity.setMethodName(methodName); columnEntity.setColumnKey(currColumn.get("COLUMN_KEY")); columnEntity.setDataType(currColumn.get("DATA_TYPE")); columnEntity.setColumnComment(currColumn.get("COLUMN_COMMENT")); // 属性类型 columnEntity.setFieldType(PropertiesUtils.getInstance("template/config").get(columnEntity.getDataType())); // 主键判断 if ("PRI".equals(columnEntity.getColumnKey()) && table.getPk() == null) { table.setPk(columnEntity); } table.addColumn(columnEntity); } tables.add(table); } // 没主键,则第一个字段为主键 if (table.getPk() == null) { table.setPk(table.getColumns().get(0)); } String projectPath = getProjectPath(); System.out.println("===>>>java generation path:" + projectPath +"/src/main/java"); Map<String, Object> map = null; for (TableEntity tableEntity : tables) { // 封装模板数据 map = new HashMap<>(16); map.put("tableName", tableEntity.getTableName()); map.put("comments", tableEntity.getTableComment()); map.put("pk", tableEntity.getPk()); map.put("className", tableEntity.getClassName()); map.put("objName", tableEntity.getObjName()); map.put("functionCode", webModule); map.put("requestMapping", tableEntity.getTableName().replace("_","/")); map.put("viewPath", webModule + "/" + tableEntity.getClassName().toLowerCase()); map.put("authKey", GenUtils.urlToAuthKey(tableEntity.getTableName().replace("_","/"))); map.put("columns", tableEntity.getColumns()); map.put("hasDecimal", tableEntity.buildHasDecimal().getHasDecimal()); map.put("package", PropertiesUtils.getInstance("template/config").get("package")); map.put("module", javaModule); map.put("author", PropertiesUtils.getInstance("template/config").get("author")); map.put("email", PropertiesUtils.getInstance("template/config").get("email")); System.out.println("============ start table: " + tableEntity.getTableName() + " ================"); for (String template : GenUtils.getTemplates()) { String filePath = getFileName(template, javaModule, webModule, tableEntity.getClassName(), rootPath); String templatePath = rootPath + JdbcUtils.class.getResource("/" + template).getPath().replaceFirst("/", ""); System.out.println(filePath); File dstDir = new File(CommonUtils.getPath(filePath)); //文件夹不存在创建文件夹 if(!dstDir.exists()){ dstDir.mkdirs(); } File dstFile = new File(filePath); //文件不存在则创建 if(!dstFile.exists()){ CommonUtils.generate(templatePath, filePath, map); System.out.println(filePath + "===>>>创建成功!"); } else { System.out.println(filePath + "===>>>文件已存在,未重新生成!"); } } System.out.println("============ finish table: " + tableEntity.getTableName() + " ================\n"); } } public static String getFileName(String template, String javaModule, String webModule, String className, String rootPath) { String packagePath = rootPath + getProjectPath() + "/src/main/java/" + PropertiesUtils.getInstance("template/config").get("package").replace(".","/") + "/modules/" + javaModule + "/"; String resourcePath = rootPath + getProjectPath() + "/src/main/resources/"; String webPath = rootPath + getProjectPath() + "/src/main/webapp/"; if (template.contains(GenConstant.JAVA_ENTITY)) { return packagePath + "entity/" + className + "Entity.java"; } if (template.contains(GenConstant.JAVA_MAPPER)) { return packagePath + "dao/" + className + "Mapper.java"; } if (template.contains(GenConstant.XML_MAPPER)) { return packagePath + "mapper/" + className + "Mapper.xml"; } if (template.contains(GenConstant.JAVA_SERVICE)) { return packagePath + "service/" + className + "Service.java"; } if (template.contains(GenConstant.JAVA_SERVICE_IMPL)) { return packagePath + "service/impl/" + className + "ServiceImpl.java"; } if (template.contains(GenConstant.JAVA_CONTROLLER)) { return packagePath + "controller/" + className + "Controller.java"; } if (template.contains(GenConstant.HTML_LIST)) { return webPath + "WEB-INF/view/" + webModule + "/" + className.toLowerCase() + "/list.html"; } if (template.contains(GenConstant.HTML_ADD)) { return webPath + "WEB-INF/view/" + webModule + "/" + className.toLowerCase() + "/add.html"; } if (template.contains(GenConstant.HTML_EDIT)) { return webPath + "WEB-INF/view/" + webModule + "/" + className.toLowerCase() + "/edit.html"; } if (template.contains(GenConstant.JS_LIST)) { return webPath + "static/js/" + webModule + "/" + className.toLowerCase() + "/list.js"; } if (template.contains(GenConstant.JS_ADD)) { return webPath + "static/js/" + webModule + "/" + className.toLowerCase() + "/add.js"; } if (template.contains(GenConstant.JS_EDIT)) { return webPath + "static/js/" + webModule + "/" + className.toLowerCase() + "/edit.js"; } if (template.contains(GenConstant.SQL_MENU)) { return resourcePath + "sqls/" + className.toLowerCase() + "_menu.sql"; } return null; } public static String getProjectPath() { String basePath = JdbcUtils.class.getResource("/").getPath().replace("/target/classes/", "").replaceFirst("/", ""); return basePath; } }
[ "728953360@qq.com" ]
728953360@qq.com
8e5c17447d05832b2725015f7772a4763654df90
2324fd02d5cc25d80853c329139251145599abb1
/app/src/main/java/com/kickstarter/ui/adapters/RewardsItemAdapter.java
9e86e08a5bb4e9baf80ad73e9b91ec510a85ed94
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "ICU", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-facebook-software-license", "EPL-1.0", "MIT" ]
permissive
appspector/android-oss
4554deffd08924636c4a856bc9f5afa3bd10bae3
3fc542d10a32416338b66ea5e6ac5b8144e5bc2f
refs/heads/master
2020-03-15T12:56:18.640415
2018-05-15T11:25:54
2018-05-15T11:25:54
132,154,951
1
1
Apache-2.0
2018-05-24T14:30:59
2018-05-04T15:04:54
Java
UTF-8
Java
false
false
958
java
package com.kickstarter.ui.adapters; import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.view.View; import com.kickstarter.R; import com.kickstarter.models.RewardsItem; import com.kickstarter.ui.viewholders.KSViewHolder; import com.kickstarter.ui.viewholders.RewardsItemViewHolder; import java.util.List; import static java.util.Collections.emptyList; public final class RewardsItemAdapter extends KSAdapter { public RewardsItemAdapter() { addSection(emptyList()); } public void rewardsItems(final @NonNull List<RewardsItem> rewardsItems) { setSection(0, rewardsItems); notifyDataSetChanged(); } @Override protected int layout(final @NonNull SectionRow sectionRow) { return R.layout.rewards_item_view; } @Override protected @NonNull KSViewHolder viewHolder(final @LayoutRes int layout, final @NonNull View view) { return new RewardsItemViewHolder(view); } }
[ "christopherwright@gmail.com" ]
christopherwright@gmail.com
b70641c7c117f074adc5f39b233a4cd9c51bec76
8d4f7ab43b3883f25936f5b682399df279a0c367
/SS2012_VS_1_1/src/lagern/LagerPackage/exNotFoundHelper.java
afbde8a13407864ce61a2a966d9215d711514d43
[]
no_license
StiggyB/bernieundert
5cb4de8a0eeb9fd242e8661200ce1de40a16bb5a
7e3f180b79428bdd4bcc1d3b9f268143ba202063
refs/heads/master
2016-09-02T03:25:10.657834
2013-01-08T06:58:59
2013-01-08T06:58:59
32,143,925
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,398
java
package lagern.LagerPackage; /** * lagern/LagerPackage/exNotFoundHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from lager.idl * Donnerstag, 29. März 2012 20:04 Uhr MESZ */ abstract public class exNotFoundHelper { private static String _id = "IDL:lagern/Lager/exNotFound:1.0"; public static void insert (org.omg.CORBA.Any a, lagern.LagerPackage.exNotFound that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); a.type (type ()); write (out, that); a.read_value (out.create_input_stream (), type ()); } public static lagern.LagerPackage.exNotFound extract (org.omg.CORBA.Any a) { return read (a.create_input_stream ()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); } __active = true; org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1]; org.omg.CORBA.TypeCode _tcOf_members0 = null; _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); _members0[0] = new org.omg.CORBA.StructMember ( "s", _tcOf_members0, null); __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (lagern.LagerPackage.exNotFoundHelper.id (), "exNotFound", _members0); __active = false; } } } return __typeCode; } public static String id () { return _id; } public static lagern.LagerPackage.exNotFound read (org.omg.CORBA.portable.InputStream istream) { lagern.LagerPackage.exNotFound value = new lagern.LagerPackage.exNotFound (); // read and discard the repository ID istream.read_string (); value.s = istream.read_string (); return value; } public static void write (org.omg.CORBA.portable.OutputStream ostream, lagern.LagerPackage.exNotFound value) { // write the repository ID ostream.write_string (id ()); ostream.write_string (value.s); } }
[ "narfgnarf@gmail.com@48955575-598b-d27f-7a68-2b204972dbf9" ]
narfgnarf@gmail.com@48955575-598b-d27f-7a68-2b204972dbf9
3477ea0560ebd1ff4185eb6661d280f72987a0f2
5b353b1f09f1c5140bfb729afb930ddead3ab436
/src/test/java/unit/BuyerControllerTest.java
8601e2580ee01a9075edb2909f52144dacd585fc
[]
no_license
eduriol/buyer-manager
e70703ef392a4aab50c1687d0a39f5d0bacd30f1
9b7b9dc168ee7f3a8c171530eb25ae3008bd4cfe
refs/heads/master
2020-04-27T18:59:35.085675
2019-06-07T21:47:56
2019-06-07T21:47:56
174,596,798
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
package unit; import buyer.entities.Buyer; import buyer.BuyerController; import org.junit.Before; import org.junit.Test; import java.io.IOException; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; public class BuyerControllerTest { private BuyerController buyerController; @Before public void setUp() throws IOException { buyerController = new BuyerController(); } @Test public void testGetAllBuyersFirstBuyer() throws IOException { assertThat(buyerController.getAllBuyers().get(0), is(equalTo(Buyer.fromFile("src/main/resources/buyer1.json")))); } @Test public void testGetBuyerById() throws IOException { assertThat(buyerController.getBuyer(1L), is(equalTo(Buyer.fromFile("src/main/resources/buyer1.json")))); } @Test public void testGetBuyerByInexistentId() { assertThat(buyerController.getBuyer(0L), is(nullValue())); } @Test(expected = IllegalArgumentException.class) public void testAddItemExistingId() throws IOException { buyerController.addBuyer(Buyer.fromFile("src/main/resources/buyer1.json")); } @Test public void testAddBuyerDistinctId() throws IOException { buyerController.addBuyer(Buyer.fromFile("src/test/resources/buyer3.json")); assertThat(buyerController.getBuyer(3L), is(equalTo(Buyer.fromFile("src/test/resources/buyer3.json")))); } }
[ "eriol@ebay.com" ]
eriol@ebay.com
25360dcb6dfacdd1784f28637439cd68c94018c0
66237afc455789e4f6352dcfd40d9f114bb7bad7
/basearchcomponents/src/main/java/com/tanveershafeeprottoy/basearchcomponents/viewmodels/BaseAndroidViewModel.java
d5613f6429ea2407f429459fcf799f808f31de5c
[]
no_license
tanveerprottoy/base-arch-components
4f966862a9c22500ffcad0e69950f6e935fea3b3
87401d237ed7fd5329c9c19f707dd73a6858a146
refs/heads/master
2020-04-08T00:19:19.843975
2019-01-10T10:20:09
2019-01-10T10:20:09
158,847,326
0
0
null
null
null
null
UTF-8
Java
false
false
636
java
package com.tanveershafeeprottoy.basearchcomponents.viewmodels; import android.app.Application; import com.tanveershafeeprottoy.basearchcomponents.livedata.SingleLiveEvent; import androidx.lifecycle.AndroidViewModel; /** * @author Tanveer Shafee Prottoy */ public abstract class BaseAndroidViewModel extends AndroidViewModel { protected SingleLiveEvent<Throwable> throwableSingleLiveEvent = new SingleLiveEvent<>(); public BaseAndroidViewModel(Application application) { super(application); } protected void throwError(Throwable throwable) { throwableSingleLiveEvent.setValue(throwable); } }
[ "tanvir.shafi@parkkori.com" ]
tanvir.shafi@parkkori.com
db8d56030f4da2def3937dcffbfe2f83292478cc
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE563_Unused_Variable/CWE563_Unused_Variable__unused_public_member_variable_01_good1.java
27f264990306bc3f9765c61e46f47b303eca3e52
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
939
java
/* * @description Unused public class member variable * * */ package testcases.CWE563_Unused_Variable; import testcasesupport.*; public class CWE563_Unused_Variable__unused_public_member_variable_01_good1 extends AbstractTestCaseClassIssueGood { public int intGood1 = 0; private void good1() { /* FIX: Use intGood1 */ IO.writeLine("" + intGood1); } public void good() { good1(); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "you@example.com" ]
you@example.com
9df57cd174f78d6de625fb44a8522a6c6dde9c6f
71ec3c641b3d4bd400039a03ee4929f8cec5100f
/common/import-parsers/blackboard_9_nyu/src/java/org/sakaiproject/importer/impl/Blackboard9NYUFileParser.java
d5db59f3bfcb7471289a84cc415cdf657396f1f1
[ "LicenseRef-scancode-generic-cla", "ECL-2.0", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
NYUeServ/sakai11
f03020a82c8979e35c161e6c1273e95041f4a10e
35f04da43be735853fac37e0098e111e616f7618
refs/heads/master
2023-05-11T16:54:37.240151
2021-12-21T19:53:08
2021-12-21T19:53:08
57,332,925
3
5
ECL-2.0
2023-04-18T12:41:11
2016-04-28T20:50:33
Java
UTF-8
Java
false
false
36,579
java
package org.sakaiproject.importer.impl; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.text.Normalizer; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.HashMap; import java.util.zip.ZipInputStream; import java.util.zip.ZipEntry; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; import org.apache.commons.lang.StringUtils; import org.sakaiproject.archive.api.ImportMetadata; import org.sakaiproject.importer.api.IMSResourceTranslator; import org.sakaiproject.importer.api.Importable; import org.sakaiproject.importer.api.ImportFileParser; import org.sakaiproject.importer.impl.importables.FileResource; import org.sakaiproject.importer.impl.importables.Folder; import org.sakaiproject.importer.impl.importables.HtmlDocument; import org.sakaiproject.importer.impl.translators.Bb9NYUAnnouncementTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUAssessmentAttemptFilesTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUAssessmentAttemptTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUCollabSessionTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUCourseMembershipTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUCourseUploadsTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUDiscussionBoardTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUExternalLinkTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUGroupUploadsTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUHTMLDocumentTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUQuestionPoolTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUSurveyTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUTextDocumentTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUSmartTextDocumentTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUStaffInfoTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUAssessmentTranslator; import org.sakaiproject.util.Validator; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.TrueFileFilter; import org.apache.commons.io.filefilter.IOFileFilter; public class Blackboard9NYUFileParser extends IMSFileParser { public static final String BB_NAMESPACE_URI = "http://www.blackboard.com/content-packaging/"; public static final String WEBCT_NAMESPACE_URI = "http://www.webct.com/IMS"; public static final String ASSESSMENT_GROUP = "Assessments"; public static final String ANNOUNCEMENT_GROUP = "Announcements"; public static final String ASSESSMENT_FILES_DIRECTORY = "TQimages"; public Blackboard9NYUFileParser() { // eventually, this will be spring-injected, // but it's ok to hard-code this for now addResourceTranslator(new Bb9NYUAnnouncementTranslator()); addResourceTranslator(new Bb9NYUAssessmentTranslator()); addResourceTranslator(new Bb9NYUQuestionPoolTranslator()); addResourceTranslator(new Bb9NYUSurveyTranslator()); addResourceTranslator(new Bb9NYUAssessmentAttemptTranslator()); addResourceTranslator(new Bb9NYUStaffInfoTranslator()); addResourceTranslator(new Bb9NYUHTMLDocumentTranslator()); addResourceTranslator(new Bb9NYUTextDocumentTranslator()); addResourceTranslator(new Bb9NYUSmartTextDocumentTranslator()); addResourceTranslator(new Bb9NYUExternalLinkTranslator()); addResourceTranslator(new Bb9NYUCollabSessionTranslator()); addResourceTranslator(new Bb9NYUAssessmentAttemptFilesTranslator()); addResourceTranslator(new Bb9NYUCourseUploadsTranslator()); addResourceTranslator(new Bb9NYUGroupUploadsTranslator()); addResourceTranslator(new Bb9NYUCourseMembershipTranslator()); addResourceTranslator(new Bb9NYUDiscussionBoardTranslator()); resourceHelper = new Bb9NYUResourceHelper(); itemHelper = new Bb9NYUItemHelper(); fileHelper = new Bb9NYUFileHelper(); manifestHelper = new Bb9NYUManifestHelper(); } public ImportFileParser newParser() { return new Blackboard9NYUFileParser(); } public boolean isValidArchive(byte[] fileData) { if (super.isValidArchive(new ByteArrayInputStream(fileData))) { Document manifest = extractFileAsDOM("/imsmanifest.xml", new ByteArrayInputStream(fileData)); if (!hasBb9Version(fileData)) { return false; } if (enclosingDocumentContainsNamespaceDeclaration(manifest, BB_NAMESPACE_URI)) { return true; } else if (enclosingDocumentContainsNamespaceDeclaration(manifest, WEBCT_NAMESPACE_URI)) { return true; } else { return false; } } else return false; } private String readFullInputStream(InputStream stream) throws IOException { InputStreamReader reader = new InputStreamReader(stream); char[] buffer = new char[4096]; StringBuilder sb = new StringBuilder(); int len; while ((len = reader.read(buffer, 0, buffer.length)) >= 0) { sb.append(buffer, 0, len); } return sb.toString(); } private boolean hasBb9Version(byte[] fileData) { ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(fileData)); try { while (true) { ZipEntry entry = (ZipEntry) zipStream.getNextEntry(); if (entry == null) { return false; } if (".bb-package-info".equals(entry.getName())) { String packageInfo = readFullInputStream(zipStream); return (packageInfo.indexOf("app.release.number=9.") >= 0); } } } catch (IOException e) { return false; } } private boolean enclosingDocumentContainsNamespaceDeclaration(Node node, String nameSpaceURI) { return node.lookupPrefix(nameSpaceURI) != null; } protected boolean isCompoundDocument(Node node, Document resourceDescriptor) { // the rule we're observing is that any document of type resource/x-bb-document // that has more than one child will be treated as a compound document return "resource/x-bb-document".equals(XPathHelper.getNodeValue("./@type",node)) && node.hasChildNodes() && (node.getChildNodes().getLength() > 1); } protected Importable getCompanionForCompoundDocument(Document resourceDescriptor, Folder folder) { HtmlDocument html = new HtmlDocument(); StringBuffer content = new StringBuffer(); String bbText = XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", resourceDescriptor); bbText = StringUtils.replace(bbText, "@X@EmbeddedFile.location@X@", ""); content.append(" <p>" + bbText + "</p>\n"); List<Node> fileNodes = XPathHelper.selectNodes("/CONTENT/FILES/FILE", resourceDescriptor); content.append(" <table class=\"bb-files\"><tr><th colspan=\"2\">Included Files</th></tr>\n"); int cnt = 1; for (Node fileNode : fileNodes) { String fileName = XPathHelper.getNodeValue("./NAME", fileNode); content.append("<tr><td>" + cnt + ") </td><td><a href=\"" + fileName + "\">" + fileName + "</a></td></tr>\n"); cnt++; } content.append(" </table>\n"); html.setContent(content.toString()); html.setTitle(folder.getTitle()); html.setContextPath(folder.getPath() + folder.getTitle().replaceAll("/", "_") + "/introduction"); html.setLegacyGroup(folder.getLegacyGroup()); // we want the html document to come before the folder in sequence html.setSequenceNum(folder.getSequenceNum() - 1); return html; } protected boolean wantsCompanionForCompoundDocument() { return true; } protected Collection getCategoriesFromArchive(String pathToData) { Collection categories = new ArrayList(); Collection angelCategories = new ArrayList(); ImportMetadata im; ImportMetadata aim; Node topLevelItem; String resourceId; Node resourceNode; String targetType; List topLevelItems = manifestHelper.getTopLevelItemNodes(this.archiveManifest); for(Iterator i = topLevelItems.iterator(); i.hasNext(); ) { topLevelItem = (Node)i.next(); // save FOR ANGEL aim = new BasicImportMetadata(); aim.setId(itemHelper.getId(topLevelItem)); aim.setLegacyTool(itemHelper.getTitle(topLevelItem)); aim.setMandatory(false); aim.setFileName(".xml"); aim.setSakaiServiceName("ContentHostingService"); aim.setSakaiTool("Resources"); angelCategories.add(aim); // Each course TOC item has a target type. // At present, we only handle the CONTENT // and STAFF_INFO target types, // with assessments and announcements being identified // separately below. resourceId = XPathHelper.getNodeValue("./@identifierref", topLevelItem); resourceNode = manifestHelper.getResourceForId(resourceId, this.archiveManifest); targetType = XPathHelper.getNodeValue("/COURSETOC/TARGETTYPE/@value", resourceHelper.getDescriptor(resourceNode)); if (!(("CONTENT".equals(targetType)) || ("STAFF_INFO").equals(targetType))) continue; im = new BasicImportMetadata(); im.setId(itemHelper.getId(topLevelItem)); im.setLegacyTool(itemHelper.getTitle(topLevelItem)); im.setMandatory(false); im.setFileName(".xml"); im.setSakaiServiceName("ContentHostingService"); im.setSakaiTool("Resources"); categories.add(im); } // Figure out if there are assessments if (XPathHelper.selectNodes("//resource[@type='assessment/x-bb-qti-test']", this.archiveManifest).size() + XPathHelper.selectNodes("//resource[@type='assessment/x-bb-qti-pool']", this.archiveManifest).size() + XPathHelper.selectNodes("//resource[@type='assessment/x-bb-qti-survey']", this.archiveManifest).size() > 0) { im = new BasicImportMetadata(); im.setId("assessments"); im.setLegacyTool(ASSESSMENT_GROUP); im.setMandatory(false); im.setFileName(".xml"); im.setSakaiTool("Tests & Quizzes"); categories.add(im); } // Figure out if we need an Announcements category if (XPathHelper.selectNodes("//resource[@type='resource/x-bb-announcement']", this.archiveManifest).size() > 0) { im = new BasicImportMetadata(); im.setId("announcements"); im.setLegacyTool(ANNOUNCEMENT_GROUP); im.setMandatory(false); im.setFileName(".xml"); im.setSakaiTool("Announcements"); categories.add(im); } if (categories.size() == 0) { return angelCategories; } return categories; } protected Collection<Object> translateFromNodeToImportables(Node node, String contextPath, int priority, Importable parent) { Collection<Object> branchOfImportables = new ArrayList<Object>(); String tag = node.getNodeName(); String itemResourceId = null; if ("item".equalsIgnoreCase(tag)) { itemResourceId = itemHelper.getResourceId(node); } else if ("resource".equalsIgnoreCase(tag)) { itemResourceId = resourceHelper.getId(node); } else if ("file".equalsIgnoreCase(tag)) { itemResourceId = resourceHelper.getId(node.getParentNode()); } Document resourceDescriptor = resourceHelper.getDescriptor(manifestHelper.getResourceForId(itemResourceId, this.archiveManifest)); if (resourceHelper.isFolder(resourceDescriptor) || ("item".equalsIgnoreCase(tag) && (XPathHelper.selectNodes("./item", node).size() > 0)) || ( "item".equalsIgnoreCase(tag) && isCompoundDocument(manifestHelper.getResourceForId(itemResourceId, archiveManifest),resourceDescriptor) )) { String folderTitle = getTitleForNode(node); // NYU-7 strip tags from folder name folderTitle = folderTitle.trim().replaceAll("\\<.*?\\>", "").replaceAll("/", "_"); Folder folder = new Folder(); folder.setPath(contextPath); folder.setTitle(folderTitle); folder.setDescription(getDescriptionForNode(node)); folder.setSequenceNum(priority); if (parent != null) { folder.setParent(parent); folder.setLegacyGroup(parent.getLegacyGroup()); } else folder.setLegacyGroup(folderTitle); // BB9 has a bunch of folders called --TOP-- that we're actually not interested in. // // If we see one of those, process its children but set their parent to the --TOP-- node's // parent (cutting --TOP-- out of the hierarchy) Importable childrenParent = folder; // now we take care of the folder's child Nodes // construct a new path and make sure we replace any forward slashes from the resource title String folderPath = contextPath + folderTitle.replaceAll("/", "_") + "/"; if ("--TOP--".equals(folderTitle)) { childrenParent = parent; folderPath = contextPath; } if (isCompoundDocument(manifestHelper.getResourceForId(itemResourceId, archiveManifest),resourceDescriptor)) { if (wantsCompanionForCompoundDocument()) { priority++; folder.setSequenceNum(priority); branchOfImportables.add(getCompanionForCompoundDocument(resourceDescriptor, folder)); } Node nextNode = manifestHelper.getResourceForId(itemResourceId, archiveManifest); if (nextNode != node) { branchOfImportables.addAll(translateFromNodeToImportables(nextNode, folderPath, priority, childrenParent)); } else { System.err.println("WARNING: loop prevented for path: " + folderPath + " itemResourceId: " + itemResourceId); } } else { List<Node> children = XPathHelper.selectNodes("./item", node); int childPriority = 1; for (Iterator<Node> i = children.iterator(); i.hasNext();) { branchOfImportables.addAll( translateFromNodeToImportables((Node)i.next(),folderPath, childPriority, childrenParent)); childPriority++; } } resourceMap.remove(itemResourceId); if (!"--TOP--".equals(folderTitle)) { branchOfImportables.add(folder); } } // node is folder else if("item".equalsIgnoreCase(tag)) { // this item is a leaf, so we handle the resource associated with it Node resourceNode = manifestHelper.getResourceForId(itemResourceId, this.archiveManifest); if (resourceNode != null) { if (parent == null) { parent = new Folder(); parent.setLegacyGroup(itemHelper.getTitle(node)); } branchOfImportables.addAll( translateFromNodeToImportables(resourceNode,contextPath, priority, parent)); } } else if("file".equalsIgnoreCase(tag)) { FileResource file = new FileResource(); try { String fileName = fileHelper.getFilenameForNode(node).replaceAll("\\<.*?\\>", ""); file.setFileName(fileName); // this will get the bb:title (friendly title, not filename) String folderName = fileHelper.getTitle(node); // first try to remove all special characters folderName = Normalizer.normalize(folderName, Normalizer.Form.NFD); folderName = folderName.replaceAll("[^\\p{ASCII}]", ""); // second try to split the folderName with a comma if (StringUtils.contains(folderName, ",")) { String[] splitName = StringUtils.split(folderName, ","); folderName = StringUtils.left(splitName[0], 24); } // custom vars to help put this single file into a subfolder //String fileHolderFolder = fileName.substring(0, fileName.lastIndexOf('.')); boolean putThisFileIntoAFolder = false; if (node.getParentNode().getChildNodes().getLength() > 1) { file.setDescription(""); } else { // BB9: Seems like we don't want an intro file at all // // // Duke: stay consistent and null it // file.setDescription(""); // putThisFileIntoAFolder = true; // String newItemText = resourceHelper.getDescription(node.getParentNode()); // newItemText = StringUtils.replace(newItemText, "@X@EmbeddedFile.location@X@", ""); // if (StringUtils.trimToNull(newItemText) != null) { // HtmlDocument introFile = new HtmlDocument(); // String tmpName = contextPath + folderName + "/" + folderName; // introFile.setContextPath(tmpName); // introFile.setTitle(folderName); // introFile.setContent(newItemText); // if (parent != null) { // introFile.setParent(parent); // introFile.setLegacyGroup(parent.getLegacyGroup()); // } // branchOfImportables.add(introFile); // } } file.setInputStream(new ByteArrayInputStream(fileHelper.getFileBytesForNode(node, contextPath))); if (putThisFileIntoAFolder && !((Bb9NYUFileHelper)fileHelper).isPartOfAssessment(node)) { file.setDestinationResourcePath(contextPath + folderName + "/" + fileName); } else { file.setDestinationResourcePath( fileHelper.getFilePathForNode(node, contextPath). replaceAll("//", "/").replaceAll("embedded/", "") /*.replace(fileHolderFolder, fileHolderFolder + "/" + fileHolderFolder) */ ); } file.setContentType(this.mimeTypes.getContentType(fileName)); file.setTitle(fileHelper.getTitle(node)); if(parent != null) { file.setParent(parent); file.setLegacyGroup(parent.getLegacyGroup()); } else file.setLegacyGroup(""); } catch (IOException e) { resourceMap.remove(resourceHelper.getId(node.getParentNode())); return branchOfImportables; } branchOfImportables.add(file); resourceMap.remove(resourceHelper.getId(node.getParentNode())); return branchOfImportables; } else if("resource".equalsIgnoreCase(tag)) { // TODO handle a resource node Importable resource = null; boolean processResourceChildren = true; IMSResourceTranslator translator = (IMSResourceTranslator)translatorMap.get(resourceHelper.getType(node)); if (translator != null) { String title = resourceHelper.getTitle(node); ((Element)node).setAttribute("title", title); ((Element)node).setAttribute("priority", Integer.toString(priority)); resource = translator.translate(node, resourceHelper.getDescriptor(node), contextPath, this.pathToData); processResourceChildren = translator.processResourceChildren(); } if (resource != null) { // make a note of a dependency if there is one. String dependency = resourceHelper.getDependency(node); if (!"".equals(dependency)) { dependencies.put(resourceHelper.getId(node), dependency); } // section to twiddle with the Importable's legacyGroup, // which we only want to do if it hasn't already been set. if ((resource.getLegacyGroup() == null) || ("".equals(resource.getLegacyGroup()))) { // find out if something depends on this. if (dependencies.containsValue(resourceHelper.getId(node))) { resource.setLegacyGroup("mandatory"); } else if (parent != null) { resource.setParent(parent); resource.setLegacyGroup(parent.getLegacyGroup()); } else resource.setLegacyGroup(resourceHelper.getTitle(node)); } branchOfImportables.add(resource); parent = resource; } // processing the child nodes implies that their files can wind up in the Resources tool. // this is not always desirable, such as the QTI files from assessments. if (processResourceChildren) { NodeList children = node.getChildNodes(); for (int i = 0;i < children.getLength();i++) { branchOfImportables.addAll(translateFromNodeToImportables(children.item(i), contextPath, priority, parent)); } } resourceMap.remove(itemResourceId); } return branchOfImportables; } protected class Bb9NYUResourceHelper extends ResourceHelper { public String getTitle(Node resourceNode) { String title = resourceNode.getAttributes().getNamedItem("bb:title").getNodeValue().trim().replaceAll("\\<.*?\\>", "").replaceAll("/", "_"); return TitleUniquifier.uniquify(title, resourceNode); } public String getType(Node resourceNode) { String nodeType = XPathHelper.getNodeValue("./@type", resourceNode); if ("resource/x-bb-document".equals(nodeType)) { /* * Since we've gotten a bb-document, we need to figure out what kind it is. Known possible are: * 1. x-bb-externallink * 2. x-bb-document * a. Plain text * b. Smart text * c. HTML * The reason we have to do this is that all the above types are listed as type "resource/x-bb-document" * in the top level resource node. Their true nature is found with the XML descriptor (.dat file) */ if(resourceNode.hasChildNodes()) { // If it has child-nodes (files, usually) we don't want to parse the actual document return nodeType; } String subType = XPathHelper.getNodeValue("/CONTENT/CONTENTHANDLER/@value", resourceHelper.getDescriptor(resourceNode)); if ("resource/x-bb-externallink".equals(subType)) { nodeType = "resource/x-bb-externallink"; } else if ("resource/x-bb-asmt-test-link".equals(subType)) { nodeType = "resource/x-bb-asmt-test-link"; } else { String docType = XPathHelper.getNodeValue("/CONTENT/BODY/TYPE/@value", resourceHelper.getDescriptor(resourceNode)); if ("H".equals(docType)) { // NYU-2 nodeType = "resource/x-bb-document-smart-text"; } else if ("P".equals(docType)) { nodeType = "resource/x-bb-document-plain-text"; } else if ("S".equals(docType)) { nodeType = "resource/x-bb-document-smart-text"; } } } return nodeType; } public String getId(Node resourceNode) { return XPathHelper.getNodeValue("./@identifier", resourceNode); } public Document getDescriptor(Node resourceNode) { try { String descriptorFilename = resourceNode.getAttributes().getNamedItem("bb:file").getNodeValue(); DocumentBuilder docBuilder; docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputStream fis = new FileInputStream(pathToData + "/" + descriptorFilename); return (Document) docBuilder.parse(fis); } catch (Exception e) { return null; } } public String getDescription(Node resourceNode) { Document descriptor = resourceHelper.getDescriptor(resourceNode); return XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", descriptor); } public boolean isFolder(Document resourceDescriptor) { return "true".equals(XPathHelper.getNodeValue("/CONTENT/FLAGS/ISFOLDER/@value", resourceDescriptor)); } } protected class Bb9NYUItemHelper extends ItemHelper { public String getId(Node itemNode) { return XPathHelper.getNodeValue("./@identifier", itemNode); } private String getTitleHelper(Node itemNode) { String tempString = XPathHelper.getNodeValue("./title",itemNode); if (tempString.equals("content.Assignments.label")) return "Assignments"; if (tempString.equals("content.Documents.label")) return "Documents"; if (tempString.equals("content.Syllabus.label")) return "Syllabus"; if (tempString.equals("staff_information.FacultyInformation.label")) return "Faculty Information"; if (tempString.equals("COURSE_DEFAULT.Assignments.CONTENT_LINK.label")) return "Assignments"; if (tempString.equals("COURSE_DEFAULT.Communication.APPLICATION.label")) return "Communication"; if (tempString.equals("COURSE_DEFAULT.CourseInformation.CONTENT_LINK.label")) return "Course Information"; if (tempString.equals("COURSE_DEFAULT.ExternalLinks.CONTENT_LINK.label")) return "External Links"; if (tempString.equals("COURSE_DEFAULT.CourseDocuments.CONTENT_LINK.label")) return "Documents"; if (tempString.equals("COURSE_DEFAULT.StaffInformation.STAFF.label")) return "Staff"; if (tempString.equals("ORGANIZATION_DEFAULT.Information.CONTENT_LINK.label")) return "Information"; if (tempString.equals("ORGANIZATION_DEFAULT.Documents.CONTENT_LINK.label")) return "Documents"; if (tempString.equals("ORGANIZATION_DEFAULT.ExternalLinks.CONTENT_LINK.label")) return "External Links"; return tempString; } // Wraps the original getTitle (now renamed to getTitleHelper) being careful to make sure titles are unique for the same parent. public String getTitle(Node itemNode) { String title = getTitleHelper(itemNode); return TitleUniquifier.uniquify(title, itemNode); } public String getDescription(Node itemNode) { String resourceId = XPathHelper.getNodeValue("./@identifierref", itemNode); Node resourceNode = manifestHelper.getResourceForId(resourceId, archiveManifest); return resourceHelper.getDescription(resourceNode); } } protected class Bb9NYUManifestHelper extends ManifestHelper { public List getItemNodes(Document manifest) { return XPathHelper.selectNodes("//item", manifest); } public Node getResourceForId(String resourceId, Document manifest) { return XPathHelper.selectNode("//resource[@identifier='" + resourceId + "']",archiveManifest); } public List getResourceNodes(Document manifest) { return XPathHelper.selectNodes("//resource", manifest); } public List getTopLevelItemNodes(Document manifest) { return XPathHelper.selectNodes("//organization/item", manifest); } } protected class Bb9NYUFileHelper extends FileHelper { private File findBB9File(String basePath, Node node) { String linkName = XPathHelper.getNodeValue("./LINKNAME/@value", node); final String name = XPathHelper.getNodeValue("./NAME", node); int extensionPosition = linkName.lastIndexOf("."); if (extensionPosition < 0) { extensionPosition = linkName.length(); } final String extension = linkName.substring(extensionPosition); File baseFile = new File(basePath); if (!baseFile.exists()) { System.out.println("File not found: " + basePath); return null; } Iterator<File> matches = FileUtils.iterateFiles(baseFile, new IOFileFilter() { public boolean accept(File file) { return accept(file.getParentFile(), file.getName()); } public boolean accept(File dir, String filename) { // The filename will contain "name" (an ID) prefixed by // underscores, followed by an optional extension. // // Each data file has a counterpart with the same filename // plus an ".xml" extension, so we want to be careful not // to pick up this file by mistake. return (filename.matches(".*__" + name.substring(1) + "\\b.*") && !filename.toLowerCase().endsWith(".xml")); } }, TrueFileFilter.INSTANCE); if (matches.hasNext()) { return matches.next(); } System.out.println("No file found matching linkName: " + linkName + " with name: " + name); return null; } public byte[] getFileBytesForNode(Node node, String contextPath) throws IOException { //for Bb we ignore the contextPath... String basePath = XPathHelper.getNodeValue("./@identifier",node.getParentNode()); String fileHref = XPathHelper.getNodeValue("./@href", node).replaceAll("\\\\", File.separator); String filePath = basePath + File.separator + fileHref; File f = new File(pathToData + File.separator + filePath); if (!f.exists()) { // if the file doesn't exist in the location filePath = fileHref; f = new File(pathToData + File.separator + filePath); } if (f.exists() && !f.isDirectory()) { System.out.println("Found file directly: " + pathToData + File.separator + filePath + ";exists=" + f.exists()); return getBytesFromFile(f); } // BB9: if this file is a "csfiles" entry, dig it out now. if ("CS".equals(XPathHelper.getNodeValue("./STORAGETYPE/@value", node))) { // f = new File(pathToData + File.separator + // "csfiles" + File.separator + // "home_dir" + File.separator + // generateBB9Filename(node)); f = findBB9File(pathToData + File.separator + "csfiles" + File.separator + "home_dir", node); if (f != null && f.exists()) { return getBytesFromFile(f); } } // now iterate through to explicitly find the file (bad exclamation mark file issue) System.out.println("Folder: " + pathToData + File.separator + basePath + File.separator); File folder = new File(pathToData + File.separator + basePath + File.separator); File[] listOfFiles = folder.listFiles(); if (listOfFiles == null) { System.err.println("Got a null directory for base path: " + basePath + " href: " + fileHref); System.err.println("Context path was: " + contextPath); } try { for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { String fileName = listOfFiles[i].getName(); String thePath = getFileFromStrangePath(fileName, fileHref); System.out.println("Searching for strange path: " + thePath); if (!StringUtils.isEmpty(thePath)) { filePath = basePath + File.separator + thePath; f = new File(pathToData + File.separator + filePath); if (f.exists()) { return getBytesFromFile(f); } } filePath = basePath + File.separator + fileName; } else if (listOfFiles[i].isDirectory()) { File[] subDir = listOfFiles[i].listFiles(); //System.out.println("Directory " + listOfFiles[i].getName()); for (int j = 0; j < subDir.length; j++) { if (subDir[j].isFile()) { String thePath = getFileFromStrangePath(subDir[j].getName(), fileHref); System.out.println("s3:" + listOfFiles[i].getName() + File.separator + subDir[j].getName()); if (!StringUtils.isEmpty(thePath)) { filePath = basePath + File.separator + listOfFiles[i].getName() + File.separator + thePath; System.out.println("sub: " + filePath); f = new File(pathToData + File.separator + filePath); System.out.println("sub2: " + pathToData + File.separator + filePath); if (f.exists()) { return getBytesFromFile(f); } } filePath = basePath + File.separator + listOfFiles[i].getName() + File.separator + subDir[j].getName(); } } } } } catch (Exception exc) { exc.printStackTrace(); System.out.println("Bad folder: " + exc.getMessage()); } System.out.println("never found a matching file so just returning last doc"); return getBytesFromFile(new File(pathToData + File.separator + filePath)); } public boolean isPartOfAssessment(Node node) { String parentType = XPathHelper.getNodeValue("../@type", node); return ("assessment/x-bb-qti-pool".equals(parentType) || "assessment/x-bb-qti-test".equals(parentType)); } public String getFilePathForNode(Node node, String contextPath) { // for files that are part of an assessment, we're going to // tack on an extra container folder to the path. if (isPartOfAssessment(node)) { contextPath = contextPath + "/" + ASSESSMENT_FILES_DIRECTORY; } String fileHref = XPathHelper.getNodeValue("./@href", node); fileHref = fileHref.replaceAll("\\\\", "/"); String parentType = XPathHelper.getNodeValue("../@type", node); if (parentType.equals("webcontent")) { System.out.println("filehref: " + fileHref); if (fileHref.indexOf("/") > -1) { String [] temp = null; temp = fileHref.split("/"); String resourceId = XPathHelper.getNodeValue("./@identifier", node.getParentNode()); System.out.println("resourceId: " + resourceId); Node itemNode = XPathHelper.selectNode("//item[@identifierref='" + resourceId + "']",archiveManifest); String tempString = XPathHelper.getNodeValue("./title",itemNode); tempString = tempString.replaceAll("\\<.*?\\>", ""); // get rid of HTML tags in a title System.out.println("getting title from item: " + tempString); System.out.println("temp2: " + temp[2] + ";length: " + temp[2].length()); if (temp[2].length() == 38) { System.out.println("temp2: " + temp[2] + ";length: " + temp[2].length()); return contextPath + "/" + tempString.replaceAll("\\\\", "/") + "/index.html"; } else { return contextPath + "/" +tempString.replaceAll("\\\\", "/") + "/" + temp[2]; } } } return contextPath + "/" + fileHref.replaceAll("\\\\", "/"); } public String getTitle(Node fileNode) { /* String resourceId = XPathHelper.getNodeValue("./@identifier", fileNode.getParentNode()); System.out.println("resourceId: " + resourceId); Node itemNode = XPathHelper.selectNode("//item[@identifierref='" + resourceId + "']",archiveManifest); String tempString = XPathHelper.getNodeValue("./title",itemNode); System.out.println("getting title from item: " + tempString); */ // if the resource that this file belongs to has multiple files, // we just want to use the filename as the title if (fileNode.getParentNode().getChildNodes().getLength() > 1) { return getFilenameForNode(fileNode); } else { return resourceHelper.getTitle(fileNode.getParentNode()); } } public String getFilenameForNode(Node node) { String linkName = XPathHelper.getNodeValue("./LINKNAME/@value", node); if (linkName != null && !linkName.equals("")) { return linkName; } String sourceFilePath = XPathHelper.getNodeValue("./@href", node).replaceAll("\\\\", "/"); String temp = (sourceFilePath.lastIndexOf("/") < 0) ? sourceFilePath : sourceFilePath.substring(sourceFilePath.lastIndexOf("/") + 1); if (temp.indexOf(".htm") > -1 && temp.length() == 38) { return "index.html"; } else { return temp; } } private String getFileFromStrangePath(String fileName, String fileHref) { String strippedFileName = fileName; String strippedFileExtension = ""; if (fileName.startsWith("!")) { strippedFileName = fileName.substring(1); int suffixPos = strippedFileName.lastIndexOf("."); strippedFileName = strippedFileName.substring(0, suffixPos); strippedFileExtension = fileName.substring(suffixPos+1, fileName.length()); byte[] hexedName = null; try { hexedName = Hex.decodeHex(strippedFileName.toCharArray()); } catch (DecoderException e) { // TODO Auto-generated catch block e.printStackTrace(); } String hexString = new String(hexedName); //System.out.println("sfile: " + strippedFileName + ";extension=" + strippedFileExtension + ";hex=" + hexString); String fileNameWithoutExtension = fileHref; String fileNameExtension = ""; // just get the filename not the whole path if (fileNameWithoutExtension.contains("/")) { fileNameWithoutExtension = fileNameWithoutExtension.substring(fileNameWithoutExtension.lastIndexOf("/")+1, fileNameWithoutExtension.length()); } // find the extension if (fileHref.contains(".")) { fileNameWithoutExtension = fileNameWithoutExtension.substring(0,fileNameWithoutExtension.lastIndexOf(".")); fileNameExtension = fileHref.substring(fileHref.lastIndexOf("."), fileHref.length()); } if (fileNameWithoutExtension.equals(hexString) && strippedFileExtension.equalsIgnoreCase(fileNameExtension)) { System.out.println("found file match: " + fileNameWithoutExtension + "::" + hexString); return fileName; } } return ""; } } }
[ "mark@dishevelled.net" ]
mark@dishevelled.net
25952c9bdb528008de1432d1868965079b70f5e6
b1dcbeb3923071fe194dad74d3087c50790ec124
/VetorObjeto/ExemploMatris/src/Telinha/Tela.java
eb9880ca5d2981ae7e7ca40ef08328d8a24e840b
[]
no_license
lucasouza2/exerciciosJAVA
d0f41bf39ee81758168d72e946302627ca79a49c
4dc0e289e03918d4adfc1def1cba5583859846b0
refs/heads/master
2022-12-02T23:52:58.414447
2020-08-21T23:32:44
2020-08-21T23:32:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,862
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Telinha; import Matris.Matriz; /** * * @author aluno */ public class Tela extends javax.swing.JFrame { Matriz matrix = new Matriz(); public Tela() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTResultado = new javax.swing.JTextArea(); jBAmostrar = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTResultado.setColumns(20); jTResultado.setRows(5); jScrollPane1.setViewportView(jTResultado); jBAmostrar.setText("Amostrar"); jBAmostrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBAmostrarActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jBAmostrar) .addContainerGap(11, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGap(38, 38, 38) .addComponent(jBAmostrar) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jBAmostrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAmostrarActionPerformed jTResultado.setText(matrix.getMat()); }//GEN-LAST:event_jBAmostrarActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Tela().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jBAmostrar; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTResultado; // End of variables declaration//GEN-END:variables }
[ "lucasrico25@gmail.com" ]
lucasrico25@gmail.com
01d2c3272057453ba93c9b925d7a4f31c6a57f9c
fa63fa8fea6dfd24f369d69f39f322f78143077c
/mall-ware/src/main/java/com/scut/mall/ware/entity/WareOrderTaskDetailEntity.java
69e0a76c804d1f99a4b0132db929486ac70da2dd
[]
no_license
laizikeng/mall
4741f36ba872a673210c1f75b2da8abe2e505083
70f1ead689b4101f3e796438d8200285d0b32fcf
refs/heads/main
2023-07-05T02:36:05.184978
2021-08-21T02:42:33
2021-08-21T02:42:33
387,080,581
0
0
null
null
null
null
UTF-8
Java
false
false
843
java
package com.scut.mall.ware.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 库存工作单 * * @author lzk * @email 2601665132@qq.com * @date 2021-08-05 15:09:33 */ @Data @TableName("wms_ware_order_task_detail") public class WareOrderTaskDetailEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private Long id; /** * sku_id */ private Long skuId; /** * sku_name */ private String skuName; /** * 购买个数 */ private Integer skuNum; /** * 工作单id */ private Long taskId; /** * 仓库id */ private Long wareId; /** * 1-已锁定 2-已解锁 3-扣减 */ private Integer lockStatus; }
[ "2601665132@qq.com" ]
2601665132@qq.com
ae867689a214435da77a110737ea1203dd017e2f
51faeaec7f4250b7651885210b2aa6d9dfd81525
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/feign/UserFeignClientFB.java
5d9b7ceee6a1f66e986b1523f500546b07c8757c
[]
no_license
aijavahyf/springcloud1
3e4f01c3e8dcb4ebeaf88b0f3e9bd0838e67cb89
4dcd63070e05cf7be5c61fad7c21ed200df4772b
refs/heads/master
2022-12-06T14:30:00.557794
2020-09-02T08:01:45
2020-09-02T08:01:45
293,072,896
0
0
null
null
null
null
UTF-8
Java
false
false
696
java
package cn.tedu.sp04.order.feign; import cn.tedu.sp01.pojo.User; import cn.tedu.web.util.JsonResult; import org.springframework.stereotype.Component; import java.util.ArrayList; @Component public class UserFeignClientFB implements UserFeignClient { @Override public JsonResult<User> getUser(Integer userId) { if (Math.random()<0.5){ User u=new User(userId,"用户名"+userId,"密码"+userId); return JsonResult.ok().data(u); } return JsonResult.err().msg("获取用户失败"); } @Override public JsonResult addScore(Integer userId, Integer score) { return JsonResult.err().msg("增加用户积分失败"); } }
[ "aijavahyf@gmial.com" ]
aijavahyf@gmial.com
8ce536e02d772b1045c9f0d9af2ecb0df0fd0837
29ec707b07e26a265242998fa208ea9a8ce56f1a
/elena/Exercitii/src/exercitii/Concatenare2VectoriEx15.java
340eb14e16b0d93b8bc33a5539180a6f9cbdbdee
[]
no_license
elenaanghel90/exercises
40023edebd235a2ea91b61332d8bdb371a7c8c99
61cda902fdb9f7c0cb9ba5abbecde77bae1f8f9f
refs/heads/master
2021-01-05T06:48:16.673926
2020-02-16T16:04:49
2020-02-16T16:04:49
240,919,318
0
0
null
2020-10-13T19:35:35
2020-02-16T15:54:07
Java
UTF-8
Java
false
false
710
java
package exercitii; import java.util.Arrays; public class Concatenare2VectoriEx15 { public static void main(String[] args) { int[] sir1 = {3, 5, 7, 9}; int[] sir2 = {3, 5, 7, 9, 7}; System.out.println("Vectorii concatenati sunt = " + Arrays.toString(concateneazaVectorii(sir1, sir2))); } public static int[] concateneazaVectorii(int[] sirX, int[] sirY) { int[] sirConcatenat = new int[sirX.length + sirY.length]; for (int i = 0; i < sirX.length; i++) { sirConcatenat[i] = sirX[i]; } for (int j = 0; j < sirY.length; j++) { sirConcatenat[j + sirX.length] = sirY[j]; } return sirConcatenat; } }
[ "elenamarianaanghel@gmail.com" ]
elenamarianaanghel@gmail.com
1981377b3d4235fcd35171b80c59c5b365d5f824
ba9ee6fa06ab929eb236cf324dca196bc082c0e9
/src/api/java/com/heisenbugdev/heisenui/api/view/ICharacterView.java
608e118fca11f629884bf98bc708e84765623604
[ "MIT" ]
permissive
HeisenBugDev/Project-U
5ba250e7024104a173daf12eb4f854cfb333488d
8e29c1286e109e21f6b28a15f5e11fb1f049c08f
refs/heads/master
2016-09-06T10:38:27.655684
2014-05-18T09:03:49
2014-05-18T09:03:49
19,553,702
1
1
null
null
null
null
UTF-8
Java
false
false
213
java
package com.heisenbugdev.heisenui.api.view; import net.minecraft.entity.player.EntityPlayer; public interface ICharacterView { public EntityPlayer player(); public void setPlayer(EntityPlayer player); }
[ "jake@jadarstudios.com" ]
jake@jadarstudios.com
69b986e5c686358ed3521a8f1b9769198efa4467
f0591201f9e05a43ae063ec0f3f4b4915e2e4a59
/project-sysmgr-api/src/main/java/com/spirit/project/sysmgr/api/service/ServiceModuleService.java
50c4d70e8e4518d33dbd4412bcd70c330202aa00
[]
no_license
dante7qx/microservice-spirit
d7867237eb499bc4c5b83ad12650aaf658ea72f4
e6a2cd52ac44c12ea6d983430a801a3db43c0e8f
refs/heads/master
2021-01-22T22:20:39.295929
2017-08-08T02:03:56
2017-08-08T02:03:56
85,531,358
0
1
null
null
null
null
UTF-8
Java
false
false
563
java
package com.spirit.project.sysmgr.api.service; import java.util.List; import com.spirit.project.common.api.exception.SpiritAPIServiceException; import com.spirit.project.common.api.template.SpiritAbstractService; import com.spirit.project.sysmgr.api.dto.req.ServiceModuleReqDTO; import com.spirit.project.sysmgr.api.dto.resp.ServiceModuleRespDTO; public interface ServiceModuleService extends SpiritAbstractService<ServiceModuleReqDTO, ServiceModuleRespDTO> { public List<ServiceModuleRespDTO> findServiceModuleResps() throws SpiritAPIServiceException; }
[ "sunchao.0129@163.com" ]
sunchao.0129@163.com
2d689412ef439f27459681f4964bd275fa37b232
236e1b0ce3a98653366bdfc7c6eebd3e936fc4a7
/src/main/java/com/inti/FirstSonarJenkinsProjectApplication.java
fd76ddc4439c242c35802b1c1d8bd3251af95bf5
[]
no_license
mathieuDevJava/firstSonarJenkinsProject
90e34cb0c7d28b6c37b97c4ba27de54df8254d4e
d7876d0cc58a2c6458491b496d309fcd493c60ff
refs/heads/master
2023-07-17T07:51:54.636792
2021-08-24T09:37:14
2021-08-24T09:37:14
399,398,618
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package com.inti; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class FirstSonarJenkinsProjectApplication { public static void main(String[] args) { SpringApplication.run(FirstSonarJenkinsProjectApplication.class, args); } }
[ "max94h@yahoo.fr" ]
max94h@yahoo.fr
ff65daf60f402a5b7c201c9d6bca3d1922627bdf
1796f63604392ebbe6dc5b7ecd389d6592e507f8
/fundementals4-4challange/src/main/java/com/example/fundementals4_4challange/ui/share/ShareViewModel.java
f41ba2d30cede24c17d563d10987ebb058aa205c
[]
no_license
Perham94/Android_Kursen
3976833f83c175dce9310da4eb966d8a31673075
0fb3492b39c086baa000a6c07f19b36393ec4fec
refs/heads/master
2020-07-29T02:26:27.582011
2019-10-12T12:30:07
2019-10-12T12:30:07
209,631,944
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
package com.example.fundementals4_4challange.ui.share; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class ShareViewModel extends ViewModel { private MutableLiveData<String> mText; public ShareViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is share fragment"); } public LiveData<String> getText() { return mText; } }
[ "perham132@hotmail.se" ]
perham132@hotmail.se
6135ddd3b7fdeb7521a5fd6aebb86f0d31509ee9
8e9a5d2539e69e56b3fac2b0b68b4931a9fb78db
/com/creational/builderPattern/product/Sandwich.java
b14774f5f7e99d4fd16bd998cc92be653078823d
[]
no_license
mcdowesj/DesignPatterns_src
ff8df8c7699ecc6eac6159c53c79e4f8b448fb3d
2ea4c5bc47e46562704e10641d7c5e094ed5fd6e
refs/heads/master
2021-01-19T23:33:46.369596
2017-06-30T17:21:49
2017-06-30T17:23:12
88,999,435
0
0
null
null
null
null
UTF-8
Java
false
false
1,333
java
package com.creational.builderPattern.product; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * This is our Product. */ public class Sandwich { private static Logger log = Logger.getLogger(Sandwich.class.getName()); public BreadType breadType; public boolean isToasted; public CheeseType cheeseType; public MeatType meatType; public boolean hasMustard; public boolean hasMayo; public List<String> vegetables; public void display(){ String nl = "\n"; StringBuilder message = new StringBuilder("Sandwich on " + breadType + " bread \n"); if(isToasted){ message.append("Toasted \n"); } if(hasMayo){ message.append("Has mayo \n"); } if(hasMustard){ message.append("Has mustard \n"); } message.append("Veggies: \n"); for(String veg : vegetables){ message.append(" - ").append(veg).append("\n"); } log.log(Level.INFO, message.toString()); } public enum MeatType{ Turkey, Ham, Chicken, Salami } public enum CheeseType { American, Swiss, Cheddar, Provolone } public enum BreadType{ White, Wheat } }
[ "mcdowesj@tcd.ie" ]
mcdowesj@tcd.ie
e773b58582580b63c4f7ffb0a55ec82feced039a
0c3ca83acf7a4bcaf361c74a60ad46da13e0972c
/spring-all/MySpring/src/main/java/com/wangzhen/myspring/aop/advice/AroundAdvice.java
de9b72ceb01522534763d8168f3b8d31a258073d
[]
no_license
1228857713/jvmOnJava
41adb557d4a866ffbc9b3eaa57f36b9acb2ea09b
a3f3f33fe83bdae673da5ff8fca90952d9dab65e
refs/heads/master
2023-03-29T13:01:10.931505
2021-03-30T10:42:07
2021-03-30T10:42:07
296,494,052
237
16
null
null
null
null
UTF-8
Java
false
false
324
java
package com.wangzhen.myspring.aop.advice; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * 环绕通知 */ public interface AroundAdvice extends Advice { Object around(Method method, Object[] args, Object target) throws InvocationTargetException, IllegalAccessException; }
[ "1228857713@qq.com" ]
1228857713@qq.com
877d7232975541026b536fdeb749dd1a889ed401
551569861431b41e2b3455b268bcd585487c0036
/database/src/main/java/org/seasar/cms/database/identity/impl/PostgreIdentity.java
737581077b3d6edc28fe8f4600c8de30c42d9439
[]
no_license
seasarorg/test-cms-1
dc5066e1a4311036b2ec2480bd2cf183e6d40970
f5431cef37cb8b484e4e71c5a582f7f66ddce960
refs/heads/master
2021-01-21T12:03:11.890874
2013-10-09T03:58:55
2013-10-09T03:58:55
13,432,663
0
1
null
null
null
null
UTF-8
Java
false
false
586
java
package org.seasar.cms.database.identity.impl; /** * <p> * <b>同期化:</b> このクラスはスレッドセーフです。 * </p> * * @author YOKOTA Takehiko */ public class PostgreIdentity extends AbstractIdentity { public String getDatabaseProductId() { return "postgre"; } public boolean isMatched(String productName, String productVersion) { // XXX 実装しよう。 return false; } public String toNumericExpression(String expr) { return "(to_number(" + expr + ",'9999999999')"; } }
[ "skirnir@gmail.com" ]
skirnir@gmail.com
988b5c384045e2e4d458a1352ce6268a61fc72f5
b8acd431174702c81d5edfff4bded41f3e67b3f5
/src/com/mavenjenkns/com/MavenJenkins.java
91b0e1e59581a52fcd30e0e17d4ec72c67b3f30f
[]
no_license
cnspraveen/MavenProject_into_Github
b0079f3e6d2af04e3f0c2a9e0025cb12f1fd220f
0198e6c793f751e090715772cbe1f00eb0a660bc
refs/heads/master
2020-04-03T00:05:03.167690
2016-08-13T13:21:59
2016-08-13T13:21:59
65,078,417
0
0
null
null
null
null
UTF-8
Java
false
false
1,539
java
package com.mavenjenkns.com; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Reporter; import org.testng.annotations.Test; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; public class MavenJenkins { public ExtentReports e = new ExtentReports(".\\ExtentReport\\ExtentReport.html"); @Test(priority=1) public void MavenJenkinsMethod_Pass() { System.out.println("Hi"); ExtentTest t = e.startTest("MavenJenkinsMethod_Pass");// provide this method name itself WebDriver driver = new FirefoxDriver(); driver.get("https://www.google.com/"); Reporter.log("facebook login", true); Reporter.log("MavenJenkins integration", true); t.log(LogStatus.PASS, "Executing MavenJenkinsMethod successful"); //t.log(LogStatus.ERROR, "Error during execution"); t.log(LogStatus.INFO, "info of exexuting method"); e.endTest(t); } @Test(priority=2) public void MavenJenkinsMethod_Fail() { System.out.println("Bye"); WebDriver driver = new FirefoxDriver(); driver.get("https://www.google.com/"); Reporter.log("facebook login", true); Reporter.log("MavenJenkins integration", true); ExtentTest t = e.startTest("MavenJenkinsMethod_Fail");// provide this method name itself t.log(LogStatus.FAIL, "Executing MavenJenkinsMethod Fail"); e.endTest(t); e.flush(); } }
[ "cns.praveen@gmail.com" ]
cns.praveen@gmail.com
b696d34a4b9ee4ccbf487c66f3e47acd84fb853f
e5d43decdcbcce691f862482c0793d31c1bbb956
/src/sample/RegistrationController.java
ffc1badecc3a164ec18a9022e8df4700fecff489
[]
no_license
BilyanaNikiforova/-USP
b3e49435e8bb70f3f5bdebe3c2a7547c3e59b050
34eeb1b674f466dccbd87ef2f7d1627c58f965ec
refs/heads/master
2023-04-12T02:23:15.086234
2021-05-12T10:50:48
2021-05-12T10:50:48
350,987,051
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
package sample; public class RegistrationController { }
[ "biliana_nikifforova@abv.bg" ]
biliana_nikifforova@abv.bg
bd63616ec90e3672b4ba34cb26c0e43cb9ae485f
7aede3eac373f635094dd8fc6f57d9f4a59296a4
/app/src/main/java/com/example/samsung/rentalhousemanager/roomsetting/OnTextChangedCallback.java
60dd4e3f9b4774cd2f4321deff127bf9b971dfc9
[]
no_license
sparrowleung/RentalHouseManager
e18f635a4ff9fbe614be71ea7d2c6af919c4311b
108c09dccf20e04bbd210d2d105311c433df7fdf
refs/heads/master
2020-04-03T11:40:23.614580
2018-11-14T09:16:56
2018-11-14T09:16:56
155,228,583
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package com.example.samsung.rentalhousemanager.roomsetting; import android.widget.EditText; /** * Created by yuyang.liang on 2018/8/6. */ public interface OnTextChangedCallback { void onTextChanged(EditText editText, String text); }
[ "372895070@qq.com" ]
372895070@qq.com
fd78bb304016cec4e8b61f65befe6ed5e9ab9816
83d5f2569a2096ef89d059860e13f099419fe4f9
/src/main/java/com/builders/testcase/builder/ClientResponseBuilder.java
c01d97d90cf9c339f4fa507cf3c140f202e1d526
[]
no_license
Arthur-Diego/builders-test-case
b01fb364663ae7a920b5ce90123b489d041ac17c
15eac0b3d09f80c90f722c3ca4515602efe04dbb
refs/heads/master
2023-06-27T08:30:11.320586
2021-08-01T23:40:09
2021-08-01T23:40:09
391,586,008
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
package com.builders.testcase.builder; import com.builders.testcase.dto.AddressResponseDTO; import com.builders.testcase.dto.ClientResponseDTO; import com.builders.testcase.model.Client; import org.springframework.stereotype.Component; @Component public class ClientResponseBuilder { public ClientResponseDTO fromEntity(Client dto){ AddressResponseDTO addressResponseDTO = AddressResponseDTO.builder() .city(dto.getAddress().getCity()) .district(dto.getAddress().getDistrict()) .number(dto.getAddress().getNumber()) .state(dto.getAddress().getState()) .zipCode(dto.getAddress().getZipCode()) .publicPlace(dto.getAddress().getPublicPlace()) .build(); return ClientResponseDTO.builder() .id(dto.getId()) .age(dto.getAge()) .address(addressResponseDTO) .documentNumber(dto.getDocumentNumber()) .name(dto.getName()) .build(); } }
[ "arthur.diego7@gmail.com" ]
arthur.diego7@gmail.com
5d5d73d635e473c45947a309c80baa42382f1dda
90943ea83b7f46bd4d38a2c86fdfb1d71067cae4
/app/com/harmeetsingh13/custannotations/LoggerAnnotation.java
5cdb06f1235a8908ffe9eb28047f1aaa417205a3
[]
no_license
harmeetsingh0013/play-crud-operations-using-spring
dea269bfee912576ef651f413a7e04fed5fc6b15
6773d291bc2268eb77738720773c96219d5fbdae
refs/heads/master
2021-01-18T14:38:12.739295
2015-03-06T16:44:30
2015-03-06T16:44:30
28,305,295
0
0
null
null
null
null
UTF-8
Java
false
false
632
java
/** * */ package com.harmeetsingh13.custannotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import play.mvc.With; import com.harmeetsingh13.interceptors.LoggerInterceptor; /** * @author james * */ /** The interceptors we can also user as a custom annotations or put @with() annotation direct on action */ @With(value = {LoggerInterceptor.class}) @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface LoggerAnnotation { boolean send() default true; }
[ "harmeetsingh.0013@gmail.com" ]
harmeetsingh.0013@gmail.com
75a56b24696787486c58dfae31b1b39f5412620d
e6675123eebe7e3c04d40df5fab10116165c83ee
/水果君/src/com/get/fruit/BmobConstants.java
fd0e9856e5ec57d21bf3495bc935e8e2d40350ea
[]
no_license
getFruit/bigFuit
0936335d6aa9f8660ec26df6a807c6fe5a4a361a
4dece7fedb0342dbd438d5d9eccafa91c855bf4c
refs/heads/master
2021-01-10T11:23:56.523491
2015-10-15T05:52:23
2015-10-15T05:52:23
44,296,669
0
0
null
null
null
null
GB18030
Java
false
false
1,383
java
package com.get.fruit; import android.annotation.SuppressLint; import android.os.Environment; /** * @ClassName: BmobConstants * @Description: TODO * @author smile * @date 2014-6-19 下午2:48:33 */ @SuppressLint("SdCardPath") public class BmobConstants { public static String MyAvatarDir = "/sdcard/水果君/me/"; public static String MyFruitDir = "/sdcard/水果君/fruit/"; public static String MyTempDir = "/sdcard/水果君/ad/"; /** * 拍照回调 */ public static final int REQUESTCODE_TAKE_CAMERA = 0x000001;//拍照 public static final int REQUESTCODE_TAKE_LOCAL = 0x000002;//本地图片 public static final int REQUESTCODE_PICTURE_CROP =0x000003;//系统裁剪头像 public static final int REQUESTCODE_TAKE_LOCATION = 0x000004;//位置选择 public static final int REQUESTCODE_FROM_ADDFRUIT_FORADDRESS = 0x000006;//商品上传位置选择调用 public static final int REQUESTCODE_FROM_ADDFRUIT_FORCATEGORY = 0x000007;//商品上传分类调用 public static final int REQUESTCODE_FROM_MAINACTIVITY_FORADDRESS = 0x000008;// public static final int REQUESTCODE_FROM_FRAGMENT_FORADDRESS = 0x000009;// public static final String EXTRA_STRING = "extra_string"; public static final String ACTION_REGISTER_SUCCESS_FINISH ="register.success.finish";//注册成功之后登陆页面退出 }
[ "1562193678@qq.com" ]
1562193678@qq.com
05a05327eabc5edd5013d914a0adbf0f0644b97e
446a56b68c88df8057e85f424dbac90896f05602
/core/cas-server-core-services-registry/src/test/java/org/apereo/cas/services/resource/DefaultRegisteredServiceResourceNamingStrategyTests.java
28d844ca5a90c7d7cc6ffcb1ac9c9d814a06fee7
[ "Apache-2.0", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
apereo/cas
c29deb0224c52997cbfcae0073a4eb65ebf41205
5dc06b010aa7fd1b854aa1ae683d1ab284c09367
refs/heads/master
2023-09-01T06:46:11.062065
2023-09-01T01:17:22
2023-09-01T01:17:22
2,352,744
9,879
3,935
Apache-2.0
2023-09-14T14:06:17
2011-09-09T01:36:42
Java
UTF-8
Java
false
false
1,545
java
package org.apereo.cas.services.resource; import org.apereo.cas.services.RegisteredService; import lombok.val; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import java.util.regex.Pattern; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; /** * This is {@link DefaultRegisteredServiceResourceNamingStrategyTests}. * * @author Misagh Moayyed * @since 6.2.0 */ @Tag("RegisteredService") class DefaultRegisteredServiceResourceNamingStrategyTests { private static void verifyFileNamePattern(final Pattern pattern, final String name) { val matcher = pattern.matcher(name); assertTrue(matcher.find()); assertNotNull(matcher.group(1)); assertNotNull(matcher.group(2)); } @Test void verifyOperation() { val service = mock(RegisteredService.class); when(service.getId()).thenReturn(1000L); when(service.getName()).thenReturn("Test"); val strategy = new DefaultRegisteredServiceResourceNamingStrategy(); val pattern = strategy.buildNamingPattern("json", "xml", "xyz"); assertNotNull(pattern); val result = strategy.build(service, "json"); assertNotNull(result); assertEquals("Test-1000.json", result); verifyFileNamePattern(pattern, "Test-1000.json"); verifyFileNamePattern(pattern, "Test-1000.json"); verifyFileNamePattern(pattern, "Test-Example-1000.json"); verifyFileNamePattern(pattern, "Multiple-Test-Example-1.xml"); } }
[ "mm1844@gmail.com" ]
mm1844@gmail.com
bc97b42fb2ed7490f1af6d2f57315b3c0365db94
0d867bf8bcb71e89b4449903ff8619d0cc3ffd2e
/src/Pojo/ResponseUserLogin.java
e33c6e2add296177663c29f1a74837d361fdbb8c
[]
no_license
rutvikrockers/AndroidEntryManagerSonar
3077f0714765b8b912f0f411df84c3b41f7fa610
d017598aacfd4f500b89a4d9f2c78804d2c7be38
refs/heads/master
2020-04-13T22:19:05.538977
2018-12-29T04:36:58
2018-12-29T04:36:58
163,476,079
0
0
null
null
null
null
UTF-8
Java
false
false
576
java
package Pojo; /** * Created by rockers on 16/3/17. */ public class ResponseUserLogin { public boolean success; public int status; public String msg; public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } }
[ "rutvik.rockersinfo@gmail.com" ]
rutvik.rockersinfo@gmail.com
d3986b5505712308fc2709f6a791f1c088e086dd
a5a7d8a145b389ea043d582f6e3271f453ffc45c
/sificomlib/src/main/java/com/sificomlib/permission/PermissionUtil.java
f22ed4409afff4c3d770311086bbe3af1aba8c2b
[]
no_license
molaith/SiFiComLibDemo
2a1beb3a7d70c4482fba93a7518b5a98bd737b25
d573a6af226b47cb2ad15095fd8c8748f74d63a2
refs/heads/master
2022-04-16T12:21:26.680695
2020-04-16T09:54:05
2020-04-16T09:54:05
253,789,663
0
0
null
null
null
null
UTF-8
Java
false
false
3,023
java
package com.sificomlib.permission; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.provider.Settings; import androidx.core.content.ContextCompat; import java.util.ArrayList; import java.util.List; /** * Created by molaith on 2017/4/11. */ public class PermissionUtil { private static final int OVERLAY_PERMISSION_REQ_CODE = 0x012; public static final int OTHER_PERMISSION_REQ_CODE = 0x013; /** * 请求权限 * * @param context * @param permissions * @param listener */ public static void requestPermissions(final Context context, String[] permissions, PermissionRequestListener listener) { if (context instanceof Activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { ((Activity) context).requestPermissions(permissions, OTHER_PERMISSION_REQ_CODE); } } else { RequestPermissionFragment fragment = new RequestPermissionFragment(); fragment.requestPermission(permissions); fragment.addPermissionRequestListener(listener); FragementAttachActivity.attachLaunch(context, fragment); } } /** * 检测权限 * * @param context * @param permissions * @return */ public static boolean checkPermissions(Context context, String[] permissions) { List<String> grantedPermissions = new ArrayList<>(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { for (String permission : permissions) { if (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) { grantedPermissions.add(permission); } } } else { return true; } return grantedPermissions.size() == permissions.length; } /** * 检测权限 * * @param context * @param permission * @return */ public static boolean checkPermission(Context context, String permission) { return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; } public static boolean checkFloatWindowPermission(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return Settings.canDrawOverlays(context); } return true; } /** * Intention please: onActivityResult() must be implimented * * @param context must be Activity * @return requestCode */ public static int requestFloatWindowPermissionForResult(Activity context) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName())); context.startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE); return OVERLAY_PERMISSION_REQ_CODE; } }
[ "molaith@gmail.com" ]
molaith@gmail.com
9e123746a681dc64f1a52c413f5297ae3508200f
4f3766aad775198ede997219248904d208f0df37
/workspace_2019-12_maharshi_jinandra_final/Final/src/edu/neu/csye6200/Driver.java
00464e62c169d729541c90bc82586e9cf6547aad
[]
no_license
maharshi-neu/CSYE6200
8561acb43ac3da7b838148b1977b307e65fc247b
f9a48d630b2719bf5c1ffa66f5ae6297b00a144f
refs/heads/master
2023-05-31T07:56:39.424106
2021-06-01T03:38:53
2021-06-01T03:38:53
372,689,143
9
1
null
null
null
null
UTF-8
Java
false
false
147
java
package edu.neu.csye6200; public class Driver { public static void main(String[] args) { TwoAlternatingThreads.demo(); Final.demo(); } }
[ "jinandra.m@northeastern.edu" ]
jinandra.m@northeastern.edu
5406eacec3ecf0da781cdfad85ca21b64248d516
5f253f9e5a0b50d13377b46ea2613105460c6f67
/src/test/java/rs/htec/apps/sandbox_qa/NegativeLoginTest.java
3b3547c26528b98600999cbc0b069cfee4f1c0e8
[]
no_license
sstefanovic990/Homework
64daa9ab42470cc71f5a0128a408904c10fa3f56
fcb447d1ed1b707e2ed22c0474e04b88372f25e6
refs/heads/master
2023-05-28T19:16:41.457355
2020-01-27T14:53:32
2020-01-27T14:53:32
235,780,338
0
0
null
2023-05-09T18:19:36
2020-01-23T11:23:56
HTML
UTF-8
Java
false
false
1,147
java
package rs.htec.apps.sandbox_qa; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.Assert; import org.testng.annotations.Test; @Test public class NegativeLoginTest { public void negativeData () { System.setProperty("webdriver.chrome.driver", "src/main/resources/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://qa-sandbox.apps.htec.rs/"); WebElement LoginButton = driver.findElement(By.xpath("//a[@class='btn btn-lg btn-secondary']")); LoginButton.click(); WebElement Email = driver.findElement(By.cssSelector("input[name='email']")); Email.sendKeys("test@gmail.com"); WebElement Password = driver.findElement(By.cssSelector("input[name='password']")); Password.sendKeys("987321"); WebElement Submit = driver.findElement(By.cssSelector("form > .btn.btn-block.btn-primary.mt-4")); Submit.click(); Assert.assertTrue(driver.findElement(By.xpath("//div[@class='invalid-feedback']")).isDisplayed()); driver.close(); } }
[ "stefanstefanovic990@gmail.com" ]
stefanstefanovic990@gmail.com
fd9847cab59c475f7d71d270b8c93e4564e0ca58
ff81b2617acac09439a8c2b44184d8ac1045abeb
/src/main/java/com/app/server/services/MessageService.java
80d61541ca73cb88d04edf954e354ce52819d3e2
[]
no_license
sathishm07/IdlMeet
8e47ff35922db9f3686ddb574fcf82cc2d7fc523
d5126423a86d618718b52d60f0875a8e24c6eb28
refs/heads/master
2020-04-05T09:52:25.467126
2018-11-08T22:58:44
2018-11-08T22:58:44
156,052,596
0
0
null
null
null
null
UTF-8
Java
false
false
6,110
java
package com.app.server.services; import com.app.server.http.utils.APPResponse; import com.app.server.models.Message; import com.app.server.util.MongoPool; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.mongodb.BasicDBObject; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoCollection; import org.bson.Document; import org.bson.types.ObjectId; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; /** * Services run as singletons */ public class MessageService { private static MessageService self; private ObjectWriter ow; private MongoCollection<Document> messageCollection = null; private MessageService() { this.messageCollection = MongoPool.getInstance().getCollection("messages"); ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); } public static MessageService getInstance(){ if (self == null) self = new MessageService(); return self; } public ArrayList<Message> getAll(String id) { ArrayList<Message> messageList = new ArrayList<Message>(); BasicDBObject query = new BasicDBObject(); query.put("connectionId", id); FindIterable<Document> results = this.messageCollection.find(query); if (results == null) { return messageList; } for (Document item : results) { Message message = convertDocumentToMessage(item); messageList.add(message); } return messageList; } public Message getOne(String id) { BasicDBObject query = new BasicDBObject(); query.put("_id", new ObjectId(id)); Document item = messageCollection.find(query).first(); if (item == null) { return null; } return convertDocumentToMessage(item); } public Message create(String connectionId, Object request) { try { JSONObject json = null; json = new JSONObject(ow.writeValueAsString(request)); Message message = convertJsonToMessage(json, connectionId); Document doc = convertMessageToDocument(message, connectionId); messageCollection.insertOne(doc); ObjectId id = (ObjectId)doc.get( "_id" ); message.setId(id.toString()); message.setConnectionId(connectionId); return message; } catch(JsonProcessingException e) { System.out.println("Failed to create a document"); return null; } } public Object update(String id, String connectionId, Object request) { try { JSONObject json = null; json = new JSONObject(ow.writeValueAsString(request)); BasicDBObject query = new BasicDBObject(); query.put("_id", new ObjectId(id)); query.put("connectionId", new ObjectId(connectionId)); Document doc = new Document(); if (json.has("senderId")) doc.append("senderId",json.getString("senderId")); if (json.has("receiverId")) doc.append("receiverId",json.getString("receiverId")); if (json.has("messageContent")) doc.append("messageContent",json.getString("messageContent")); if (json.has("messageDate")) doc.append("messageDate",json.getString("messageDate")); if (json.has("messageStatus")) doc.append("messageStatus",json.getBoolean("messageStatus")); Document set = new Document("$set", doc); messageCollection.updateOne(query,set); return request; } catch(JSONException e) { System.out.println("Failed to update a document"); return null; } catch(JsonProcessingException e) { System.out.println("Failed to create a document"); return null; } } public Object delete(String id, String connectionId) { BasicDBObject query = new BasicDBObject(); query.put("_id", new ObjectId(id)); query.put("connectionId", new ObjectId(connectionId)); messageCollection.deleteOne(query); return new JSONObject(); } public Object deleteAll(String connectionId) { BasicDBObject query = new BasicDBObject(); query.put("connectionId", new ObjectId(connectionId)); messageCollection.deleteMany(new BasicDBObject()); return new JSONObject(); } private Message convertDocumentToMessage(Document item) { Message message = new Message( item.getString("connectionId"), item.getString("senderId"), item.getString("receiverId"), item.getString("messageContent"), item.getString("messageDate"), item.getBoolean("messageStatus") ); message.setId(item.getObjectId("_id").toString()); return message; } private Document convertMessageToDocument(Message message, String connectionId){ Document doc = new Document("connectionId", message.getconnectionId()) .append("senderId", message.getsenderId()) .append("receiverId", message.getreceiverId()) .append("messageContent", message.getmessageContent()) .append("messageDate", message.getmessageDate()) .append("messageStatus", message.getmessageStatus()); return doc; } private Message convertJsonToMessage(JSONObject json, String connectionId){ Message message = new Message( connectionId, json.getString("senderId"), json.getString("receiverId"), json.getString("messageContent"), json.getString("messageDate"), json.getBoolean("messageStatus")); return message; } } // end of main()
[ "sathishm07@gmail.com" ]
sathishm07@gmail.com
ffaa4da11d5689b0c5f58f7a12b1544197ee0505
2f1e51bb1153d2f37b3f68ca2feb0b6f84615fab
/server/src/main/java/org/nexu/outdoors/web/dao/ActivityDao.java
05b5eb9b4770922a6adda1c6bbaf5fe33446b6ef
[ "MIT" ]
permissive
cyrilsx/outdoors
3e5fbc5d3e28b6a06822c9a88d21948e5a1b92d4
5c89f30815321d84c6cfec51ec881b350af0707c
refs/heads/master
2021-01-21T12:06:23.122808
2014-02-20T20:57:44
2014-02-20T20:57:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,910
java
package org.nexu.outdoors.web.dao; import org.jongo.MongoCollection; import org.nexu.outdoors.web.dao.model.CActivity; import org.nexu.outdoors.web.dao.util.MongoCollectionFactory; import org.nexu.outdoors.web.model.Activity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.List; @Component public class ActivityDao { @Autowired private MongoCollectionFactory mongoCollectionFactory; private MongoCollection activityCollection; @PostConstruct private void init() { activityCollection = mongoCollectionFactory.getCollection(CActivity.class); } public Activity createOrUpdatePost(final Activity activity) { CActivity cActivity = new CActivity(activity.getName(), activity.getDescription(), activity.getPicturesUrl(), activity.getVideosUrl(), activity.getCreationDate(), activity.getLatestUpdate(), activity.getCreator(), activity.getContributors(), activity.getPlayers(), activity.getViewsCounter(), activity.getActivityLink()); if(cActivity.getCreationDate() == null) { activityCollection.save(cActivity); } else { activityCollection.update("{_id:#}", activity.getName()).with(cActivity); } return activity; } public Activity getActivityByLink(String name) { CActivity activity = activityCollection.findOne("{activityLink:#}", name).as(CActivity.class); if(activity == null) { throw new IllegalStateException("activityNotFound"); } return new Activity(activity.getName(), activity.getDescription(), activity.getPicturesUrl(), activity.getVideosUrl(), activity.getCreationDate(), activity.getLatestUpdate(), activity.getCreator(), activity.getContributors(),activity.getPlayers(), activity.getViewsCounter(), activity.getActivityLink()); } public List<Activity> findAll(int offset, int limit) { Iterable<CActivity> activities = activityCollection.find().skip(offset).limit(limit).as(CActivity.class); List<Activity> resActivityList = new ArrayList<Activity>(); for(CActivity activity : activities) { resActivityList.add(new Activity(activity.getName(), activity.getDescription(), activity.getPicturesUrl(), activity.getVideosUrl(), activity.getCreationDate(), activity.getLatestUpdate(), activity.getCreator(), activity.getContributors(), activity.getPlayers(), activity.getViewsCounter(), activity.getActivityLink())); } return resActivityList; } public Activity delete(String name) { Activity activity = getActivityByLink(name); activityCollection.remove("{_id:#}", name); return activity; } }
[ "cyril@nexu.org" ]
cyril@nexu.org
eda32fb8c919287df32de4c8a23572d5464564fa
812f69b597b1903fbd2fdc19486eaf965710c790
/app/src/main/java/com/abhat/designquotes/network/QuoteInteractor.java
f029736b9ed1ae450fd897b95730605e848901bc
[]
no_license
AnirudhBhat/DesignQuotes
bc27ba2aea2ecc1f25c737ebad493a52c4cb2be6
19d2e87ca608de618e0d7b8e0769f33e67acaf06
refs/heads/master
2021-01-21T09:38:17.072626
2017-05-28T15:46:07
2017-05-28T15:46:07
91,661,513
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.abhat.designquotes.network; /** * Created by cumulations on 23/4/17. */ public interface QuoteInteractor { interface onQuoteFetchFinished { void onSuccess(String quote, String author); void onNetworkError(); } void fetchQuoteFromNetwork(onQuoteFetchFinished listener); }
[ "kamal.a@cumulations.com" ]
kamal.a@cumulations.com
11527ee581e3c877173da4f7f86889c12375aa0a
ddb17e110e268e86d0444b0fe7c09a3747b0d561
/NHMP/src/ERP/Dataroom/model/controller/DataroomAdminListServlet.java
92d63cc99ed52bc49ddace8383a1b083a075fcfd
[]
no_license
shinsm0606/TMTS
222a1096826e0d0e0e672e376cbcee12a7b60211
9c8b2bc324b7558970fcb2c20a065dfa6c4fcb7c
refs/heads/master
2020-08-06T05:14:37.467372
2019-11-08T06:31:17
2019-11-08T06:31:17
212,600,131
1
0
null
2019-10-03T17:46:13
2019-10-03T14:25:33
Java
UTF-8
Java
false
false
3,655
java
package ERP.Dataroom.model.controller; import java.io.IOException; import java.util.ArrayList; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import ERP.Dataroom.model.vo.Dataroom; import ERP.notice.model.vo.Notice; import ERP.Dataroom.model.service.DataroomService; import Main.NursingHospital.model.ov.NursingHospital; /** * Servlet implementation class DataroomAdminListServlet */ @WebServlet("/drlist.ad") public class DataroomAdminListServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public DataroomAdminListServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 자료실 관리자페이지 전체 목록보기 출력 처리용 컨트롤러 모델서비스로 요청받고 처리(패이징 처리) //nursinghospital 의 로그인정보 받아오기 NursingHospital loginHospital = (NursingHospital)request.getSession().getAttribute("loginHospital"); int currentPage = 1; if(request.getParameter("page") != null) { currentPage = Integer.parseInt(request.getParameter("page")); } int limit = 10; //한 페이지에 출력할 목록 갯수 DataroomService drservice = new DataroomService(); int listCount = drservice.getListCount(loginHospital); //테이블의 전체 목록 갯수 조회 //총 페이지 수 계산 int maxPage = listCount / limit; if(listCount % limit > 0) maxPage++; //currentPage 가 속한 페이지그룹의 시작페이지숫자와 끝숫자 계산 //예, 현재 34페이지이면 31 ~ 40 이 됨. (페이지그룹의 수를 10개로 한 경우) int beginPage = (currentPage / limit) * limit + 1; int endPage = beginPage + 9; if(endPage > maxPage) endPage = maxPage; //currentPage 에 출력할 목록의 조회할 행 번호 계산 int startRow = (currentPage * limit) - 9; int endRow = currentPage * limit; //조회할 목록의 시작행과 끝행 번호 서비스로 전달하고 결과받기 ArrayList<Dataroom> list = drservice.selectList(startRow, endRow, loginHospital); RequestDispatcher view = null; if(list.size() >= 0) { view = request.getRequestDispatcher("views/ERP/Dataroom/ErpAdminDataroomListView.jsp"); request.setAttribute("list", list); request.setAttribute("maxPage", maxPage); request.setAttribute("currentPage", currentPage); request.setAttribute("beginPage", beginPage); request.setAttribute("endPage", endPage); request.setAttribute("loginHospital", loginHospital); }else { view = request.getRequestDispatcher("views/common/Error.jsp"); request.setAttribute("message", currentPage + "공지사항 관리자화면 전체 목록 조회 실패!"); } view.forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "kimbongsoo@DESKTOP-8L9PJN2" ]
kimbongsoo@DESKTOP-8L9PJN2
3e1fc8b06d737b4138e93822fa27d9c7a9ad0cc4
085e1b3ccb73ce51b2b055ae881f26aa2f7ae647
/test/plugins/org.talend.designer.core.generic.test/src/main/java/org/talend/designer/core/generic/model/ComponentTest.java
5edc5bca004cb2bac3f76db868678ed6caa9630c
[ "Apache-2.0" ]
permissive
dmuliyil/tdi-studio-se
8cf39d3fc484a4aa0039f1cfa3973f480923e8c2
0c469650cb97037ce37050c23f13dea86b0c2a5e
refs/heads/master
2021-01-11T16:34:40.162654
2017-01-25T02:39:44
2017-01-25T02:39:44
80,113,499
1
0
null
2017-01-26T12:41:42
2017-01-26T12:41:41
null
UTF-8
Java
false
false
2,235
java
// ============================================================================ // // Copyright (C) 2006-2016 Talend Inc. - www.talend.com // // This source code is available under agreement available at // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt // // You should have received a copy of the agreement // along with this program; if not, write to Talend SA // 9 rue Pages 92150 Suresnes, France // // ============================================================================ package org.talend.designer.core.generic.model; import static org.mockito.Mockito.*; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.talend.components.api.component.ComponentDefinition; import org.talend.components.api.properties.ComponentProperties; import org.talend.core.model.process.IElementParameter; import org.talend.core.model.process.INode; /** * created by hcyi on Feb 17, 2016 Detailled comment * */ public class ComponentTest { private Component component; protected Component getComponent() { return component; } @Before public void setUp() throws Exception { initComponent(); } protected void initComponent() throws Exception { component = mock(Component.class); ComponentDefinition componentDefinition = mock(ComponentDefinition.class); when(component.getComponentDefinition()).thenReturn(componentDefinition); component.setPaletteType("DI"); //$NON-NLS-1$ when(component.getName()).thenReturn("tComponentName");//$NON-NLS-1$ when(component.getLongName()).thenReturn("tComponentName");//$NON-NLS-1$ // } @Test public void testGetElementParameterValueFromComponentProperties() { INode iNode = mock(INode.class); ComponentProperties iNodeComponentProperties = mock(ComponentProperties.class); iNode.setComponentProperties(iNodeComponentProperties); IElementParameter param = mock(GenericElementParameter.class); Object obj = component.getElementParameterValueFromComponentProperties(iNode, param); Assert.assertNull(obj); } }
[ "hcyi@talend.com" ]
hcyi@talend.com
d80e268f23966bd04c64cdc05b9df2fd7cff8c7b
5ca54db9ac461f04570842c03495d8f9b6ac90a0
/Tarea/src/Logica/Principal.java
bc5a7b08d06ccaab1e81d0262d2589525168eb50
[]
no_license
uykarma/Tareas
08aca72e1bcfa3c94b80ae06c9350c819b752d24
1105ba38ec9e8fd85962b9e5892b47306ae1df3c
refs/heads/master
2023-04-12T16:33:27.705859
2021-05-12T16:05:11
2021-05-12T16:05:11
366,748,305
1
2
null
2021-05-12T23:12:36
2021-05-12T14:41:20
Java
UTF-8
Java
false
false
96
java
package Logica; public class Principal { public static void main (String[] args){ } }
[ "82124000+karmaUy@users.noreply.github.com" ]
82124000+karmaUy@users.noreply.github.com
062ebd6f7ac805e94d45e27c5cac4a59ff5b1bf4
ead79744c2365e4ce067c5098cff4e74066b2dae
/eurekaClient_Provider_silence1/src/main/java/com/etc/renting/dto/HousesInfo.java
2d07447b099656c57eafc3f2f79e10b2c7f15d36
[]
no_license
cassieit/house
1762cf81213f5deb16cb57b965612f04dc7571fe
50a6d039d0bd5620dc9af34411a5ea1aa457a51b
refs/heads/master
2023-04-04T18:57:53.693150
2021-03-26T03:12:43
2021-03-26T03:12:43
351,631,372
0
0
null
null
null
null
UTF-8
Java
false
false
3,677
java
package com.etc.renting.dto; public class HousesInfo { private Integer houses_id; private Integer admin_id; private Integer area_id; private Integer type_id; private String houses_name; private String houses_price; private String houses_style; private String houses_areas; private String houses_toward; private String houses_storey; private String houses_decorate; private String houses_image; private String houses_addr; private String houses_info; private String houses_time; private Integer images_id; private String images_name; public Integer getHouses_id() { return houses_id; } public void setHouses_id(Integer houses_id) { this.houses_id = houses_id; } public Integer getAdmin_id() { return admin_id; } public void setAdmin_id(Integer admin_id) { this.admin_id = admin_id; } public Integer getArea_id() { return area_id; } public void setArea_id(Integer area_id) { this.area_id = area_id; } public Integer getType_id() { return type_id; } public void setType_id(Integer type_id) { this.type_id = type_id; } public String getHouses_name() { return houses_name; } public void setHouses_name(String houses_name) { this.houses_name = houses_name; } public String getHouses_price() { return houses_price; } public void setHouses_price(String houses_price) { this.houses_price = houses_price; } public String getHouses_style() { return houses_style; } public void setHouses_style(String houses_style) { this.houses_style = houses_style; } public String getHouses_areas() { return houses_areas; } public void setHouses_areas(String houses_areas) { this.houses_areas = houses_areas; } public String getHouses_toward() { return houses_toward; } public void setHouses_toward(String houses_toward) { this.houses_toward = houses_toward; } public String getHouses_storey() { return houses_storey; } public void setHouses_storey(String houses_storey) { this.houses_storey = houses_storey; } public String getHouses_decorate() { return houses_decorate; } public void setHouses_decorate(String houses_decorate) { this.houses_decorate = houses_decorate; } public String getHouses_image() { return houses_image; } public void setHouses_image(String houses_image) { this.houses_image = houses_image; } public String getHouses_addr() { return houses_addr; } public void setHouses_addr(String houses_addr) { this.houses_addr = houses_addr; } public String getHouses_info() { return houses_info; } public void setHouses_info(String houses_info) { this.houses_info = houses_info; } public String getHouses_time() { return houses_time; } public void setHouses_time(String houses_time) { this.houses_time = houses_time; } public Integer getImages_id() { return images_id; } public void setImages_id(Integer images_id) { this.images_id = images_id; } public String getImages_name() { return images_name; } public void setImages_name(String images_name) { this.images_name = images_name; } }
[ "2630211077@qq.com" ]
2630211077@qq.com
7dcd678e3990faf576ac4b15e5ed3c1c1a5fd6b6
9290dc87ec131f3ef5253224f264875e41b0477d
/Tarun_Day5_Java/Assign/Phone.java
f9c3cee1f713aee2bed35be794d847c32e019030
[]
no_license
TarunSikka/JavaPrograms
3ba83f592953f9f46f6cb95f780ce9b35e4e3e1b
353b6704686a087097db9492baee9b3a4b1c6077
refs/heads/master
2020-03-28T09:43:40.318202
2018-12-13T15:16:43
2018-12-13T15:16:43
148,055,462
0
0
null
null
null
null
UTF-8
Java
false
false
864
java
class Phone { private int internationalAreaCode; private int prefix; private int number; Phone(int iac,int prefix,int number) { this.internationalAreaCode=iac; this.prefix=prefix; this.number=number; } public void setIAC(int iac) { this.internationalAreaCode=iac; } public int getIAC() { return internationalAreaCode; } public void setPrefix(int prefix) { this.prefix=prefix; } public int getPrefix() { return prefix; } public void setNumber(int number) { this.number=number; } public int getNumber() { return number; } /* public void addNumber(int iac,int prefix,int number) { this.internationalAreaCode=iac; this.prefix=prefix; this.number=number; }*/ }
[ "gooddude1224@gmail.com" ]
gooddude1224@gmail.com
00f006a6436f22e2ad47abf5e318efb87efece47
96306b9a3f119651c6a29ad43be6c7c999927cfe
/src/main/java/com/github/ljtfreitas/job/scheduler/JobSchedulerApplication.java
913c087205113dad73b5fa9cf693a854cdf5ae8e
[]
no_license
ljtfreitas/job-scheduler-api
cbc90935542ba1b860c0315f8bd1af7768e614b6
294d6177ad27ecca04be714e07d7ca67040f8eb1
refs/heads/master
2021-01-22T01:55:31.843972
2017-02-05T20:57:32
2017-02-05T20:57:32
81,021,045
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package com.github.ljtfreitas.job.scheduler; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class JobSchedulerApplication { public static void main(String[] args) { SpringApplication.run(JobSchedulerApplication.class, args); } }
[ "ljtfreitas@gmail.com" ]
ljtfreitas@gmail.com
e7dd93097741dc33b40aa2746478203afe68b418
d7df278878ae7f15ec7596f4fc463cda10352305
/iubar_paghe_logic/src/main/java/it/iubar/paghe/logic/anagrafica/auto/_AnagMap.java
9af437d403ac21c71604b2e57996bb04069b3303
[]
no_license
str4to/paghe-open
6a18602d6b24f14b3f4f0b7aaa341b624a24b6b7
0a79a39596f4a8a7f38ec8062cd2ccc4b87b62c6
refs/heads/master
2021-01-10T03:27:10.073178
2013-04-29T08:20:02
2013-04-29T08:20:02
36,080,742
0
0
null
null
null
null
UTF-8
Java
false
false
1,828
java
package it.iubar.paghe.logic.anagrafica.auto; import java.util.List; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.query.NamedQuery; import it.iubar.paghe.logic.anagrafica.AeNaturagiuridica; import it.iubar.paghe.logic.anagrafica.Comune; import it.iubar.paghe.logic.anagrafica.Provincia; import it.iubar.paghe.logic.anagrafica.Statoestero; /** * This class was generated by Cayenne. * It is probably a good idea to avoid changing this class manually, * since it may be overwritten next time code is regenerated. * If you need to make any customizations, please use subclass. */ public class _AnagMap { public static final String ALL_AE_NATURA_GIURIDICA_QUERYNAME = "AllAeNaturaGiuridica"; public static final String ALL_CITTADINANZE_QUERY_QUERYNAME = "AllCittadinanzeQuery"; public static final String ALL_COMUNI_QUERY_QUERYNAME = "AllComuniQuery"; public static final String ALL_PROVINCE_QUERY_QUERYNAME = "AllProvinceQuery"; public static final String RAW_QUERY_CITTADINANZA_QUERYNAME = "RawQueryCittadinanza"; public static final String RAW_QUERY_TIPO_IMPRESA_PER_AZIENDA_QUERYNAME = "RawQueryTipoImpresaPerAzienda"; public List<AeNaturagiuridica> performAllAeNaturaGiuridica(ObjectContext context ) { return context.performQuery(new NamedQuery("AllAeNaturaGiuridica")); } public List<Statoestero> performAllCittadinanzeQuery(ObjectContext context ) { return context.performQuery(new NamedQuery("AllCittadinanzeQuery")); } public List<Comune> performAllComuniQuery(ObjectContext context ) { return context.performQuery(new NamedQuery("AllComuniQuery")); } public List<Provincia> performAllProvinceQuery(ObjectContext context ) { return context.performQuery(new NamedQuery("AllProvinceQuery")); } }
[ "iubar.it@gmail.com@0a7ddd22-2559-11df-b4a3-2be847837fc9" ]
iubar.it@gmail.com@0a7ddd22-2559-11df-b4a3-2be847837fc9
2cc191ad8bb8c00ea56af1e7cb3fd87309327c13
f20af063f99487a25b7c70134378c1b3201964bf
/appengine/src/main/java/com/dereekb/gae/client/api/service/response/error/impl/ClientResponseErrorInfoImpl.java
77af6a96d7e9ee56280597f1095cf98f3a6a4aa8
[]
no_license
dereekb/appengine
d45ad5c81c77cf3fcca57af1aac91bc73106ccbb
d0869fca8925193d5a9adafd267987b3edbf2048
refs/heads/master
2022-12-19T22:59:13.980905
2020-01-26T20:10:15
2020-01-26T20:10:15
165,971,613
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package com.dereekb.gae.client.api.service.response.error.impl; import com.dereekb.gae.client.api.service.response.error.ClientResponseErrorInfo; import com.dereekb.gae.utilities.web.error.impl.ErrorInfoImpl; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.JsonNode; /** * {@link ClientResponseErrorInfo} implementation. * * @author dereekb * */ @JsonInclude(Include.NON_EMPTY) @JsonIgnoreProperties(ignoreUnknown = true) public class ClientResponseErrorInfoImpl extends ErrorInfoImpl implements ClientResponseErrorInfo { private JsonNode errorData; @Override public JsonNode getErrorData() { return this.errorData; } public void setErrorData(JsonNode errorData) { this.errorData = errorData; } @Override public String toString() { return "ClientResponseErrorInfoImpl [errorData=" + this.errorData + ", getCode()=" + this.getCode() + ", getTitle()=" + this.getTitle() + ", getDetail()=" + this.getDetail() + "]"; } }
[ "dereekb@gmail.com" ]
dereekb@gmail.com
72441717d64e88c8ac963ebff853d6988681a0e8
114d409959f07a69e17777fea491e326eed19bfc
/bst-player-api/src/main/java/com/bramosystems/oss/player/core/client/impl/FlashMediaPlayerImpl.java
973d181163a4fe7553abaeaa0562eabc33ebb4d2
[]
no_license
nublic/bst-player
82fa9740d4d0eeb654a466448ae9a439ebfacac0
23188ae7bb771cc380cc34e3e4c2800c1c76a908
refs/heads/master
2020-04-10T08:45:00.570008
2012-05-24T09:37:12
2012-05-24T09:37:12
3,971,266
1
0
null
null
null
null
UTF-8
Java
false
false
6,127
java
/* * Copyright 2009 Sikirulai Braheem * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.bramosystems.oss.player.core.client.impl; import com.bramosystems.oss.player.core.client.RepeatMode; import com.bramosystems.oss.player.core.client.ui.FlashMediaPlayer; import com.bramosystems.oss.player.core.event.client.PlayStateEvent; import com.bramosystems.oss.player.core.event.client.PlayStateEvent.State; import com.google.gwt.core.client.JavaScriptObject; /** * Native implementation of the FlashMediaPlayer class. It is not recommended to * interact with this class directly. * * @author Sikirulai Braheem * @see FlashMediaPlayer */ public class FlashMediaPlayerImpl extends JavaScriptObject { protected FlashMediaPlayerImpl() { } public static native FlashMediaPlayerImpl getPlayer(String playerId) /*-{ return $doc.getElementById(playerId); }-*/; public native final String getPluginVersion() /*-{ return this.getPluginVersion(); }-*/; public native final String getPlayerVersion() /*-{ return this.getPlayerVersion(); }-*/; public native final void loadMedia(String url) /*-{ this.load(url); }-*/; public native final void playMedia() /*-{ this.play(); }-*/; public native final boolean playMedia(int index) /*-{ return this.playIndex(index); }-*/; public native final boolean playNext() /*-{ return this.playNext(); }-*/; public native final boolean playPrevious() /*-{ return this.playPrev(); }-*/; public native final void stopMedia() /*-{ this.stop(true); }-*/; public native final void pauseMedia() /*-{ this.stop(false); }-*/; public native final void closeMedia() /*-{ try { this.close(); }catch(err){} }-*/; public native final double getPlayPosition() /*-{ return this.getPlayPosition(); }-*/; public native final void setPlayPosition(double position) /*-{ this.setPlayPosition(position); }-*/; public native final double getMediaDuration() /*-{ return this.getDuration(); }-*/; public native final void addToPlaylist(String mediaURL) /*-{ this.addToPlaylist(mediaURL); }-*/; public native final void removeFromPlaylist(int index) /*-{ this.removeFromPlaylist(index); }-*/; public native final void clearPlaylist() /*-{ this.clearPlaylist(); }-*/; public native final void insertIntoPlaylist(int index, String mediaURL) /*-{ this.insertIntoPlaylist(index, mediaURL); }-*/; public native final void reorderPlaylist(int from, int to) /*-{ this.reorderPlaylist(from, to); }-*/; public native final int getPlaylistIndex() /*-{ return this.getPlaylistIndex(); }-*/; public final State getState() { switch (_getState()) { case 2: // play started... return State.Started; case 3: // play stopped... return State.Stopped; case 4: // play paused... return State.Paused; case 9: // play finished... return State.Finished; default: return null; } } public native final int _getState() /*-{ this.getState(); }-*/; public native final int getPlaylistCount() /*-{ return this.getPlaylistSize(); }-*/; public native final double getVolume() /*-{ return this.getVolume(); }-*/; public native final void setVolume(double volume) /*-{ this.setVolume(volume); }-*/; public native final void setLoopCount(int count) /*-{ this.setLoopCount(count); }-*/; public native final int getLoopCount() /*-{ this.getLoopCount(); }-*/; public native final boolean isShuffleEnabled() /*-{ return this.isShuffleEnabled(); }-*/; public native final void setShuffleEnabled(boolean enable) /*-{ this.setShuffleEnabled(enable); }-*/; public native final int getVideoHeight() /*-{ return this.getVideoHeight(); }-*/; public native final int getVideoWidth() /*-{ return this.getVideoWidth(); }-*/; public native final String getMatrix() /*-{ return this.getMatrix(); }-*/; public native final void setMatrix(double a, double b, double c, double d, double tx, double ty) /*-{ this.setMatrix(a, b, c, d, tx, ty); }-*/; public native final boolean isControllerVisible() /*-{ return this.isControllerVisible(); }-*/; public native final void setControllerVisible(boolean visible) /*-{ this.setControllerVisible(visible); }-*/; public final RepeatMode getRepeatMode() { try { return RepeatMode.valueOf("REPEAT_" + getRepeatModeImpl().toUpperCase()); } catch (Exception e) { return RepeatMode.REPEAT_OFF; } } public final void setRepeatMode(RepeatMode mode) { switch(mode) { case REPEAT_ALL: setRepeatModeImpl("all"); break; case REPEAT_OFF: setRepeatModeImpl("off"); break; case REPEAT_ONE: setRepeatModeImpl("one"); } } private native String getRepeatModeImpl() /*-{ return this.getRepeatMode(); }-*/; private native void setRepeatModeImpl(String mode) /*-{ this.setRepeatMode(mode); }-*/; public native final boolean isAutoHideController() /*-{ return this.isAutoHideController(); }-*/; public native final void setAutoHideController(boolean autohide) /*-{ this.setAutoHideController(autohide); }-*/; }
[ "trupill@gmail.com" ]
trupill@gmail.com