method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6eaecb28-5b53-4969-a172-e4fa63ff6b68 | 0 | public static byte[] decryptByPublicKey(byte[] data, String key)
throws Exception {
// 对密钥解密
byte[] keyBytes = SecurityCoder.base64Decoder(key);
// 取得公钥
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
Key publicKey = keyFa... |
aa0aef67-7d83-4396-b42d-28b93fafe221 | 7 | public static CvTermReference getDefaultCvTerm(String name) {
if (name != null) {
name = name.toUpperCase();
if ("MASCOT".equals(name) || "MATRIX SCIENCE MASCOT".equals(name))
return MASCOT.getSearchEngineScores().get(0);
if ("XTANDEM".equals(name)) return XTA... |
4fc081be-b092-4874-bcf9-4dda4917eb47 | 3 | private Role intToRole(int r) {
if (r == 3) {
return Role.administrator;
} else if (r == 2) {
return Role.scout;
} else if (r == 1) {
return Role.team_member;
}
return null;
} |
1b734364-d6ac-4aff-89c4-3af76887b064 | 0 | private void aliveOrderInit() {
this.aliveOrder = null;
this.rsizone = false;
} |
2d1c10a2-85f7-4a2e-8193-ccc399bdc72e | 1 | public static boolean closingIn( Point a1, Point a2, Point b1, Point b2 ){
Point cut = intersection( a1, plus( a1, new Point( a2.y - a1.y, a1.x - a2.x )), b1, b2 );
int cx = b1.x - cut.x;
int cy = b1.y - cut.y;
int dx = b1.x - b2.x;
int dy = b1.y - b2.y;
boolean sx = (cx < 0) == (dx < 0);
boolean... |
1428250c-c0d3-441f-b2a9-4b0e31c73a42 | 8 | public void mouseWheelMoved(MouseWheelEvent e) {
StdScrollPane scrollpane = StdScrollPane.this;
if (scrollpane.isWheelScrollingEnabled()
&& e.getScrollAmount() != 0) {
JScrollBar toScroll;
int direction = 0;
// find which scrollbar to scroll, or return if none
if ((e.getModifiersEx() & MouseW... |
3f661cf6-471a-498c-87f6-18dcdf579371 | 0 | public void setDescription(String description) {
this.description = description;
} |
013db3a2-1a3c-4649-b085-ea28452a906a | 2 | private void finishConnectingAt( int x, int y ){
if( connection == null ){
return;
}
startConnectingAt( false );
connectAt( x, y, false );
if( targetArray == null ){
cancelConnecting();
}
else{
connected( connection, sourceItem, targetItem );
connection = null;
targetArray = null;
... |
8573c2ad-ba74-4c65-86b5-ed5d53190a65 | 3 | @Override
public Collection<Lot> searchLots (Map<String,String>params, boolean activeOnly, int maxResults) {
long requestId = this.findFreeKey(this.foundLotStatuses);
this.foundLotStatuses.put(requestId, false);
MsgFindLot msg = new MsgFindLot(this.address, this.ms.getAddressService().getAcc... |
0dc6cbb5-d057-4a4a-8f8c-8f5923416173 | 2 | public QueueElement dequeue (AbstractQueue<QueueElement> queue)
throws InterruptedException {
logger.entering(loggerName, "dequeue", queue);
QueueElement qe = null;
while (qe == null) {
if ((qe = queue.poll()) == null)
Thread.currentThread().sleep(200);
... |
73b32ad2-c4f0-4a6c-b2b9-e96a758fefd7 | 7 | void filterValues(double minValue, double maxValue) throws IOException {
for(int i = 0; i < rows; i++) {
double value = values.get(i);
if(!Double.isNaN(minValue) && !Double.isNaN(value) && minValue > value) {
values.set(i, Double.NaN);
}
if(!Double.isNaN(maxValue) && !Double.isNaN(value) && maxValue <... |
7e73ecc4-fe0d-4411-9c9f-3238d591fd15 | 3 | @Override
/**
* Runs in the background, timing fade in and fade out, changing the sequence,
* and issuing the appropriate volume change messages.
*/
public void run() {
while (!dying()) {
// if not currently fading in or out, put the thread to sleep
if (fadeOutGain == -1.0f && fadeInGain == 1.0... |
091f5b92-e448-448d-9719-0e13718c6458 | 5 | public static void walk(final Tile... path) {
if(!Walking.isRunEnabled()) {
if (Walking.getEnergy() > Random.nextInt(30, 50)) {
Walking.setRun(true);
Task.sleep(400, 500);
}
}
for (int i = path.length - 1; i >= 0; i --) {
if (Calculations.distanceTo(path[i]) >= 15) {
continue;
}
if (Wal... |
13fa6995-77d4-4dbc-8b81-657bfe102d98 | 5 | public void edit(Link link) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
link = em.merge(link);
em.getTransaction().commit();
} catch (Exception ex) {
... |
0c13c6ad-1f09-44eb-b342-3864df9b2c5d | 0 | @Override
public int getBomberNumber() {
return this.number;
} |
730635bd-b5c3-4876-9f18-d4ccc986b8cb | 8 | void releaseChildren(boolean destroy) {
if (items != null) {
for (int i = 0; i < items.length; i++) {
TreeItem item = items[i];
if (item != null && !item.isDisposed()) {
item.release(false);
}
}
items = null;
}
if (columns != null) {
for (int i = 0; i < columnCount; i++) {
TreeCol... |
c1184943-65ec-4c6d-b598-6c04acb5abfd | 4 | public InputStream next()
{
if (closed || (next == null && !initial)) return null;
setNext();
if (next == null) return null;
return new InputStreamWrapper(jar);
} |
9f31f74f-7318-4185-9470-63b3b3ad0ec9 | 6 | private TetrisStateBuffer search(TetrisStateBuffer in) {
stateDistQueue.clear();
veryFirstPiece = withVeryFirstPiece;
TetrisStateBuffer result = null;
addState(search.stateSet.get(search.getInitialState()), in);
int counter = 0;
while (!stateDistQueue.isEmpty()) {
StateDist stateDist = s... |
87835143-20f8-4d95-b8c3-c4ea99817dbc | 8 | public void init(String startLine) {
data = null;
performSeparationOfCommonEdges = true;
if (startLine != null && (startLine.contains("-E") || startLine.contains("--no-separation"))) {
performSeparationOfCommonEdges = false;
}
dropShadows = true;
if (startLine != null && (startLine.contains("-S") || star... |
9f6edf2b-daaf-47c7-b35c-b5d25b167c50 | 7 | final void method3677(Canvas canvas) {
try {
anObject8020 = null;
anInt7936++;
aCanvas7910 = null;
if (canvas != null && canvas != ((NativeToolkit) this).aCanvas7925) {
if (aHashtable8014.containsKey(canvas)) {
anObject8020 = aHashtable8014.get(canvas);
aCanvas7910 = canvas;
}
... |
bc1ae46d-b9e4-42de-9640-4fd479b90abe | 5 | public BulletHandler(GameWindow w){
window = w;
panel = window.panel;
initBulletHandler();
controls = window.controls;
player = window.player;
firerate =0;
try{
int index =0;
bulletpics = new BufferedImage[8];
BufferedImage bulletset = ImageIO.read(getClass().getResource("resources/bulletve... |
33f6896f-8ae3-4b8a-92b0-4982c87fc4b9 | 9 | public Set<Literal> getSameStartLiterals(Literal literal, ProvabilityLevel provability) {
Set<Literal> relatedLiterals = getRelatedLiterals(literal, provability);
if (null == relatedLiterals) return null;
Set<Literal> sameStartLiterals = new TreeSet<Literal>();
Temporal literalTemporal = literal.getTemporal();
... |
782b820a-12e2-408a-9fde-78eb62912163 | 8 | protected Behaviour getNextStep() {
if (restPoint == null) return null ;
if (restPoint instanceof Tile) {
if (((Tile) restPoint).blocked()) return null ;
}
if (restPoint instanceof Venue && menuFor((Venue) restPoint).size() > 0) {
if (actor.health.hungerLevel() > 0.1f) {
final Action... |
54425ae2-b814-411d-a051-0b638e832a96 | 9 | public void jouerCarte(){
if (!(main.isEmpty())){
boolean carteposee=false;
while(!(carteposee)){
System.out.println("quelle carte voulez vous poser parmi : ");
System.out.println("main :");
int i;
for (i=0;i<main.size();i++){
System.out.println("numero "+ (i+1) +" "+ main.get(i));
//System.o... |
ee8d58a9-583e-416c-98a8-638c4c102c00 | 8 | private static boolean isValidShuffleRecursiveDynamicProgramming(String str1, String str2, String str3, int i, int j, int k, Set<Triplet> cache) {
if(cache.contains(new Triplet(i, j, k))) {
return false;
}
if(k == str3.length()) {
return true;
}
char c =... |
8f2d77aa-cb63-4c3b-8030-7602c7c4cfe0 | 9 | @Override
public EventSet run(EventSetContext context, EventSet eventSetInUse, Object data) {
if (eventSetInUse != null
&& eventSetInUse.getStatus() == EventSetStatus.COLLECTION_IN_PROGRESS) {
return eventSetInUse;
}
List<EventSet> correlatingEventSets = context.findCorrelatingEventSets(
variableNam... |
aa74c5ba-81b9-419f-bae5-1994e4452025 | 5 | private int loadShader(String file, int type) {
System.out.println("Loading shader <" + file + ">");
StringBuilder source = new StringBuilder();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String line = null;
... |
d2e2c84c-8a83-4c0a-97b5-cec7ce61e3f8 | 2 | @Override
public int compareTo(Spot sp) {
if (candidates.size() < sp.getCandidates().size()) return -1;
if (candidates.size() == sp.getCandidates().size()) return 0;
return 1;
} |
d561df7f-d15c-4e4b-9a9a-95406cc135d6 | 1 | public String getCode(){
String str = element.getCode();
if(program != null)
str += program.getCode();
return str;
} |
159a44ed-1b08-4459-a2e3-d69aa1848203 | 6 | public void loadFields() {
HashMap<String,String> allFields = readFielldsFromFile();
Field [] fields = this.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
String name = field.getName();
if (allFields.containsKey(name)) {
if (field.getType() ... |
b5c6d7bb-b1a4-4279-aefc-1f9179e2e8a0 | 1 | protected void setSinglePreserved() {
if (parent != null)
parent.setPreserved();
} |
13d5156c-e869-4d0d-9742-90e92605426a | 3 | private void processInput(KeyEvent e) {
Integer keyNum = e.getKeyCode();
Character keyChar = Character.toLowerCase(e.getKeyChar());
if (ACCEPTED_KEYS.contains(keyChar.toString())) {
decodeInput(keyChar);
}
for(int i=0;i<ACCEPTED_NUM_KEYS.lengt... |
fc90a982-ac87-4ae8-915d-aff2d3d462cc | 4 | private static String name(PeekReader in) throws IOException {
StringBuilder buf = new StringBuilder();
while(true) {
int c = in.peek();
if(c < 0) {
break;
} else if(namechar((char)c)) {
buf.append((char)in.read());
} else {
break;
}
}
if(buf.length() == 0)
throw(new Fo... |
ef5fae5a-5e52-43c0-8ae9-66eb492a6174 | 1 | @Test
public void testRandomness() throws Exception {
// RandomUtils.useTestSeed(); allows you to create stable unit test
// but in reality one should make a decision on several different test results in order to know the variance
// check how with the default pearson similarity and the top 300 users as neigh... |
53c0198b-76af-42cf-9e09-f806d8d8ac14 | 8 | public CodecInfo(String strInfo) {
_isDecoder = _isAudioCodec = _isDecoder = _isSubtitleCodec = _isVideoCodec = _supportDirectRenderingMethod = _supportDrawHorizBand = _supportWeirdFrameTruncation = false;
char[] tagBit = strInfo.substring(1, 8).toCharArray();
if (tagBit[0] != '.')
_isDecoder = true;
if (tag... |
e9d6ac46-f40c-481e-b92d-79b33274a79a | 3 | public Point CheckTiles(int mouseX, int mouseY, int mButton)
{
int row = FindTileRow(mouseY);
int col = FindTileCol(mouseX);
Point p = new Point(row, col);
if(row != -1 && col != -1)
{
if (mButton == MouseEvent.BUTTON1)
{
ChangeTile(row, col);
}
}
... |
260e1dcc-6a61-4feb-9dd2-6fafc768896c | 1 | @Override
public void update() {
for (GUI child:children){
child.update();
}
} |
0d973880-902b-410f-b76e-b4ac5273f94b | 0 | public String adminUpdateProduct() {
this.product = this.userFacade.getProductById(this.id);
setProductFromProperty();
this.adminFacade.updateProduct(this.product);
return "adminProductDetails";
} |
e8e47dc6-07a9-4c4f-8e07-ba80e1c049ac | 7 | public Shell open(Display display) {
// Load the images
Class clazz = HoverHelp.class;
try {
if (images == null) {
images = new Image[imageLocations.length];
for (int i = 0; i < imageLocations.length; ++i) {
InputStream stream = clazz.getResourceAsStream(imageLocations[i]);
ImageData s... |
11705aa1-daa5-4f04-84e2-6afc3617b219 | 8 | @Override
public void run(){
try{
synchronized(this){
BufferedWriter bw=new BufferedWriter(
new OutputStreamWriter(s.getOutputStream()));
BufferedReader br=new BufferedReader(
n... |
439a5a34-15bf-4f97-81d4-f0b7e433d868 | 0 | public int getAantalpaginas() {
return aantalpaginas;
} |
a85946ec-b116-4391-98fe-80defda9a571 | 7 | public static void combSort11(double arrayToSort[], int linkedArray[]) {
int switches, j, top, gap;
double hold1; int hold2;
gap = arrayToSort.length;
do {
gap=(int)(gap/1.3);
switch(gap) {
case 0:
gap = 1;
break;
case 9:
case 10:
gap=11;... |
89255c06-1e74-4404-a164-3a81cd79a700 | 7 | protected static URL getURL(String classpathPart, String pkgname) {
String urlStr;
URL result;
File classpathFile;
File file;
JarFile jarfile;
Enumeration enm;
String pkgnameTmp;
result = nul... |
ca0dcf1c-d909-43e8-aa40-a23f177df438 | 5 | public Border findBorder(int locx, int locy, boolean opt) {
int top = 0, left = 0, bottom = 0, right = 0;
int val;
if (opt) {
val = newRun.getMazeVal(locx, locy);
} else {
val = newRun.getTravVal(locx, locy);
}
if ((val & 0x01) == 0x01) top = 5;
... |
bd4be931-3a37-4884-9e80-ade9361ae57b | 9 | private static Object nextValue(String jsonStr, AtomicInteger offset) {
while (offset.get() < jsonStr.length()) {
char c = jsonStr.charAt(offset.getAndIncrement());
if (Character.isWhitespace(c)) {
continue;
}
if (c == '"') {
offse... |
c6439f48-436d-42e0-aed5-8dbed5f257ec | 2 | public ServerThread(IPacketProcessor packetProcessor, int port) {
super();
this.packetProcessor = packetProcessor;
try {
socket = new DatagramSocket(port);
start();
} catch (java.lang.IllegalArgumentException e) {
packetProcessor.onError(ModelNotification.CONNECTION_ERROR);
} catch (SocketExceptio... |
654f716a-33b2-4929-9e5b-fab2b66e521b | 4 | private Rectangle calculatePixelPerfect(VGDLSprite sprite1, VGDLSprite sprite2)
{
Vector2d sprite1v = new Vector2d(sprite1.rect.getCenterX() - sprite1.lastrect.getCenterX(),
sprite1.rect.getCenterY() - sprite1.lastrect.getCenterY());
sprite1v.normalise();
Direction sprite1Di... |
bb7c414f-798c-4096-9917-5918605a605b | 3 | protected void mismatch()
{
// first test: are we long enough?
if ( pathLen >= MUM.MIN_LEN )
{
// second test: are we unique in the suffix tree?
if ( pos.node.isLeaf() )
{
// third test
if ( isMaximal() )
{
addToPath( arc );
// if we matched at least one byte of the current arc
... |
b2421ee9-0391-41fb-ba42-b15cb244cfe9 | 1 | public static File[] chooseFiles(JFrame frame, String Button, int mode) {
JFileChooser jfc = new JFileChooser();
jfc.setFileSelectionMode(mode);
jfc.setMultiSelectionEnabled(false);
jfc.setAcceptAllFileFilterUsed(true);
int success = jfc.showDialog(frame, Button);
if(success == JFileChooser.APPROVE_OPTION)... |
adfb37a1-d76f-42dd-a0aa-fc6d09d55d89 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (obj instanceof Image) {
if (image.equals((Image) obj)) {
return true;
}
}
if (!(obj instanceof ImagePanel)) {
return false;
}
ImagePanel other = (ImagePanel) ob... |
45eccaea-1a43-4f42-a465-8c861ebcc999 | 9 | public BirthdayStats getBirthdayStats() throws SQLException {
if (!dbcon.IsConnected) { return null; }
BirthdayStats stats = new BirthdayStats();
ResultSet res;
String year = new SimpleDateFormat("YYYY").format(new Date());
String month = new SimpleDateFormat("MM").format(new Date());
// Total birthday r... |
b290bdf2-5c9d-4456-a8a3-9b1672992414 | 9 | public XMLElement save() {
XMLElement arrowLink = new XMLElement();
arrowLink.setName("arrowlink");
if (style != null) {
arrowLink.setAttribute("STYLE", style);
}
if (getUniqueId() != null) {
arrowLink.setAttribute("ID", getUniqueId());
}
... |
04c7bec8-a5eb-4a7e-8af6-3c452fbe4b51 | 1 | public void render(){
texture.bind();
if(!isDead()){
int xChange = (change-1) % 3;
super.render();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(xChange * 0.25f,yChange * 0.25f + 0.25f);
GL11.glVertex2f(x, y);
GL11.glTexCoord2f(xChange * 0.25f + 0.25f,yChange * 0.25f + 0.25f);
GL11.glVerte... |
4b772ece-a4df-4d11-869a-cad5a9704a72 | 3 | public User[] loadUsers(ChatChannel channel){
User[] users = null;
try {
Socket socket = new Socket(SERVER_ADDRESS_CHAT, CHAT_PORT);
socket.setSoTimeout(TIMEOUT);
OutputStream outputStream = socket.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(
outputStre... |
69a9f7ef-bbc4-47e1-800d-8482979884f2 | 9 | public void run() {
try {
//create socket
tcpSocket = new Socket();
// Create remote bind-point
System.out.println("Connecting to " + host + ":" + port + ". Interval: " + interval);
SocketAddress remoteBindPoint = new InetSocketAddress(host, port);
... |
3ef0183b-99d7-4985-94fd-b94fcfe8a831 | 9 | @Override
public boolean keepCombating(Entity victim) {
boolean isRanging = PlayerCombat.isRanging(player) != 0;
if (!war.isCanCommence()) {
player.getPackets().sendGameMessage("The war hasn't started yet.",
true);
return false;
} else if (player.getCurrentFriendChat().getPlayers().contains(victim)) {... |
4341cbc8-d4c5-43ac-a721-19f7df8be5c7 | 0 | public void computeDerivatives(double t, double[] y, double[] yDot) {
double p;
p = (y[0]*y[0]+y[1]*y[1]+y[2]*y[2]+y[3]*y[3]-1);
yDot[0] = -0.5*y[1]*y[4]-0.5*y[2]*y[5]-0.5*y[3]*y[6]+0.5*y[2]-0.5*y[0]*p;
yDot[1] = 0.5*y[0]*y[4]+0.5*y[2]*y[6]-0.5*y[3]*y[5]-0.5*y[3]-0.5*y[1]*p;
yDot... |
91decc20-a33a-4e7a-a003-ca67e142fba7 | 8 | @Override
public void calculateFractalOrbit() {
iterations = 0;
Complex[] complex = new Complex[1];
complex[0] = new Complex(pixel_orbit);//z
Complex temp = null;
Complex zold = new Complex();
if(parser.foundS()) {
parser.setSvalue(new Complex(complex[... |
5f72c3e2-8766-4552-8c2e-a919f200dca1 | 5 | @Override
public Double getBalance(String id) {
if(id == null || "".equals(id.trim())) {
return -1.0;
}
for(Account a : accounts) {
if(id.equals(a.getId())) {
if(a.getBalance() < 0) {
return -1.0;
}
S... |
57ce8657-70ae-4f8b-aa1d-41d33fb4fc6e | 1 | public JsonArray getArray(String key) {
Object value = get(key);
if (value instanceof JsonArray) {
return (JsonArray) value;
}
return new JsonArray();
} |
f6c0b493-93b5-4c1d-b98a-81c5def3f94e | 3 | public void transformBlockInitializer(StructuredBlock block) {
StructuredBlock start = null;
StructuredBlock tail = null;
int lastField = -1;
while (block instanceof SequentialBlock) {
StructuredBlock ib = block.getSubBlocks()[0];
int field = transformOneField(lastField, ib);
if (field < 0)
clazzAn... |
9f0f0d36-47d2-4c04-9c1b-7b87669254f4 | 2 | public final String getAliasesAsString() {
String aliases = "";
for (String alias : this.aliases) {
if (!aliases.isEmpty()) aliases += ", ";
aliases += alias;
}
return aliases;
} |
bcb7708c-aa60-456b-9ec4-bc32f3efda0a | 7 | @Override
public void process(Exchange e) throws Exception {
String body = e.getIn().getBody(String.class);
body = body.replaceAll("\\[", "");
body = body.replaceAll("\\]", "");
StringTokenizer tok = new StringTokenizer(body, ",");
Date date=null;
String account=null... |
1fed62a8-5aa4-4224-baa8-00f10589cb8e | 2 | private void setupContents(int width, int height) {
//set up contents
contentsPanel.setBounds(0, 0, contentsWidth, height);
contentsPanel.setPreferredSize(new Dimension(contentsWidth, height));
contentsPanel.repaint();
contentsPanel.setVisible(false);
JButton mainMenuButton = contentsPanel.getMainMenuButto... |
f07bf6a3-36ba-4dcb-8c27-4562a817a615 | 6 | private void createTreeView(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
gridLayout.marginHeight = gridLayout.marginWidth = 2;
gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
composite.setLayout... |
11c6d30d-0ac6-4c4a-892f-91912d358c16 | 6 | @Override
public void run() {
List<Fetcher> fs = new ArrayList<Fetcher>();
// add shop fetcher
for (String url : this.getInitUrls()) {
Fetcher f = new TBShopFetcher(new RequestWrapper(url,
new TBShopCallback(), null, PriorityEnum.SHOP));
fs.add(f);
}
Map<String, Integer> offered = ne... |
89954a70-4b25-49f6-b15d-8337e1fb795b | 6 | @Override
public void worldChangedAt(Position pos) {
// Immutable cities and units took away a lot of the elegance here...
CityFigure cf = cityFigures.get(pos);
City city = game.getCityAt(pos);
if (city != null){
if (cf != null) editor.drawing().remove(cf);
... |
e6882089-530b-4100-95d9-3dbd305e8c0a | 0 | public Instruction getInstruction() {
return this.brain.getInstruction(this.state);
} |
937ed5db-1c7a-487d-b7ca-7571e390bbf4 | 8 | public void renderCracks(int xPos, int yPos, int damage) {
xPos -= xOffset;
yPos -= yOffset;
int damageSprite = damage / 10;
if (damageSprite > 7) {
damageSprite = 7;
}
for (int y = 0; y < Sprite.CRACKS.SIZE; y++) {
int yp = yPos + y;
for (int x = 0; x < Sprite.CRACKS.SIZE; x++) {
int xp = xPos ... |
59d18926-db36-40fa-aef0-a7c47da1bdf6 | 8 | @Override
public void run() {
try {
PUserDBAccess pdbAccess = new PUserDBAccess(dbAccess);
Statement stmt;
stmt = dbAccess.getConnection().createStatement();
PUser collaborativeProfile = pdbAccess.getUserProfile(user, null, clientName, true);
Map... |
6410b329-27bc-4d81-8f11-05834232a3b2 | 4 | public int doEndTag() throws JspException {
DateTimeZone dateTimeZone = null;
if (value == null) {
dateTimeZone = DateTimeZone.UTC;
} else if (value instanceof String) {
try {
dateTimeZone = DateTimeZone.forID((String) value);
} catch (IllegalA... |
35adaae8-664f-4f0d-9da7-bd97e2130c80 | 5 | public boolean containsObject() throws JSONException {
boolean result = false;
Iterator i = this.map.values().iterator();
while (!result && i.hasNext()) {
Object value = i.next();
result = value instanceof JSONObject
|| value instanceof JSONArray
&& ((JSONArray) va... |
0ea3b09c-9f06-4cab-aa68-2c77112f2cf6 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
d15b7bd1-b10a-403c-9f2d-36a8c4ee8813 | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID==Tickable.TICKID_MOB)
{
if(fullRound)
{
final MOB mob=(MOB)affected;
if(!mob.isInCombat())
unInvoke();
if(mob.location()!=null)
{
if(mob.location().show(mob,nu... |
d3395800-6767-4edb-97be-967d445ddba4 | 2 | public static void main(String args[]) {
QuickSort quick = new QuickSort();
Scanner scan = new Scanner(System.in);
int N, i;
System.out.println("Enter value of N");
N = scan.nextInt();
int array[] = new int[N];
System.out.println("Enter " + N + " Elements");
for (i = 0; i < N; i++)
array[i] = scan... |
309f808d-5bbf-41c2-b137-a2d4db6d3b4f | 0 | public static String getDefaultPasswordString() {
String random = RandomStringUtils.randomAlphanumeric(8);
return random;
} |
7e797879-2fd1-4418-8cd3-261f3c78d1b8 | 1 | public long getLatency(int clientId) {
synchronized(CONNECTION_LOCK) {
ClientInfo client = clients.get(clientId);
if(client != null)
return client.getLatency();
return -1;
}
} |
74606ad3-9282-430d-8905-7478d3ce7378 | 6 | private void generatePercentComparisonLines(
TreeMap<Float, Point2D.Float> marketToStockPairing) {
Point2D.Float dailyComparisonInitial = marketToStockPairing
.firstEntry().getValue();
boolean first = true;
for (Entry<Float, Point2D.Float> ent : marketToStockPairing.entrySet()) {
if (first) {
first ... |
0642c133-c781-4d93-81e2-6d9fdf086d35 | 7 | private LISP_object read_from(LinkedList<String> tokens)throws Exception{
if (tokens.size() == 0){
throw new Exception("unexpected EOF while reading");
}
String token = tokens.poll();
if (token.equals("")){
do{
token = tokens.poll();
... |
9ebd0514-4348-446c-be6a-7321aa61502f | 8 | public static ArrayList<ArrayList<Field>> generateMap(int maxFields, int tileSize) {
ArrayList<ArrayList<Field>> map = new ArrayList<ArrayList<Field>>();
Random random = new Random();
double center = (double) maxFields/2;
for(int i = 0; i < maxFields; i++){
double probI = Math.abs(center-(... |
53f73590-fb3f-426b-b67f-daaeff66b8a0 | 7 | public Element drawShape(int x, int y, int w, int h,
Map<String, Object> style)
{
String fillColor = mxUtils
.getString(style, mxConstants.STYLE_FILLCOLOR);
String strokeColor = mxUtils.getString(style,
mxConstants.STYLE_STROKECOLOR);
float strokeWidth = (float) (mxUtils.getFloat(style,
mxConstant... |
b013c120-54d2-47aa-a8cf-1c45d5c0ddc3 | 9 | public void initByArray(int... key) {
@SuppressWarnings("unused")
int lag = N32 >= 623 ? 11 : (N32 >= 68 ? 7 : (N32 >= 39 ? 5 : 3)) ;
int mid = (N32 - lag) / 2;
for (int i = sfmt.length - 1; i >= 0; i--)
sfmt[i] = 0x8b8b8b8b;
int count = key.length >= N32 ? key.length : N32 - 1, r = func1(0x8b8b8b8b)... |
98ffc05d-42f7-4021-a7c6-806b8604b392 | 0 | public JCheckBox getjCheckBoxPracticiens() {
return jCheckBoxPracticiens;
} |
a01dff86-11aa-4ce9-afc2-c8241f76b307 | 1 | public static int crypto_core(byte[] outv, byte[] inv, byte[] k, byte[] c)
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
int j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
int i;
j0 = x0 = load_littleendian(c, 0);
j1 = x1 = load_littleendian(k, 0);
j2 =... |
7e370e4d-1c4f-4552-8704-8e378f950715 | 6 | public void start() {
Random random = new Random();
Scanner scanner = new Scanner(System.in);
while ( true ) {
Long maxId = null;
float maxJC = Float.MIN_VALUE;
float jc;
System.out.print(">>> ");
String humanSay = scanner.nextLine... |
a593b1e3-b3fe-46a3-8820-d705889acdc5 | 3 | public static PreparedStatement createPreparedStatement(final Connection con, final String sql,
final boolean returnKeys, final Object... args) throws SQLException {
PreparedStatement ps;
if (returnKeys) {
ps = con.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
} else {
ps = con.prepareStatement... |
d90a2226-ac27-44bc-a0ce-efdba2a0257e | 2 | public static void setSpeedHost(String host) {
if (host.length() > 0 && !host.substring(host.length() - 1).equals("/")) {
host += "/";
}
getInstance().speedHost = host;
} |
be00fa9f-26ab-4af2-8c84-a9bd98e3cd8e | 3 | private int readInt()
{
int ret = readByteAsInt();
int tmp;
if (ret < 128)
{
return ret;
}
else
{
ret = (ret & 0x7f) << 7;
tmp = readByteAsInt();
if (tmp < 128)
{
ret = ret | tmp;
}
else
{
ret = (ret | tmp & 0x7f) << 7;
tmp = readByteAsInt();
if (tmp < 128)
{
... |
d6b8039c-ec20-4840-9e44-2f5988ccc89c | 9 | @Test
public void testSendMessageToListWithQueue() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSendMessageToListWithQueue -----");
String client_hash = "";
String client_hash2 = "";
String server_hash = "";
String server_hash2 = "";
try {
server1.set... |
a5658d70-2982-4caf-9308-b7feb26468d5 | 3 | private void parseSchemaElement(String element) throws ParseException {
char elementId = element.charAt(0);
String elementTail = element.substring(1);
validateSchemaElementId(elementId);
if (isBooleanSchemaElement(elementTail))
parseBooleanSchemaElement(elementId);
el... |
b5700277-9e9a-4ebb-a1be-14b3053a6f45 | 2 | private void paintMainMenu(Graphics2D g){
g.setFont(menuFont);
if (inHighScores){
drawHighScores(g);
}else if (inOptions){
drawOptions(g);
}else{
drawMenu(g);
}
} |
8b3934f0-bace-405e-8d06-1aa59e87ba18 | 3 | public static int showConfirmDialog(String msg, String title, int option, int type){
if (type < 0 || type > 2) type = 1;
return JOptionPane.showConfirmDialog(null, msg, (title == null ? "Confirm message" : title),
option, type);
} |
d7e5d6f9-40f0-40de-a3d0-b71e5639c060 | 8 | public void runGuesses(ArrayList<FaceData> data) {
for (FaceData fd : data) {
buildNetwork(fd);
boolean guess = true;
int[] acts = new int[4];
for (int i = 0; i < 4; i++) {
double act = calculateActivation(i + 1);
if (act == 1) {
acts[i]++;
guess = false;
}
}
if (isOnlyOneAct(... |
3bff5c9c-61bf-4e30-a883-91d69e3cbfda | 7 | private String compileCommand(Node command) throws CompilationErrorException {
StringBuilder builder = new StringBuilder();
switch (command.getNodeType()) {
case ASSIGNED:
builder.append(compileAssignValue(command));
break;
case RETURN:
... |
22219c8a-5e8c-4096-b988-f4599c436f25 | 4 | public JButton getPrevButton(){
if(prevButton == null){
for(Component comp : getComponents()){
if(comp instanceof JButton){
if("Spinner.previousButton".equals(comp.getName())){
prevButton = (JButton) comp;
}
... |
2bd51ce0-6436-4aaf-95d4-a82f07423460 | 8 | @Override
public boolean equals(Object o) {
if(!(o instanceof MapEntry)) {
return false;
}
MapEntry<?, ?> me = (MapEntry<?, ?>)o;
return (key == null ? me.getKey() == null : key.equals(me.getKey()))
&& (value == null ? me.getValue() == null : value.equals... |
d00799be-4e00-4e78-bed9-7245cb0660a0 | 2 | public boolean isMoreOuterThan(ClassDeclarer declarer) {
ClassDeclarer ancestor = declarer;
while (ancestor != null) {
if (ancestor == this)
return true;
ancestor = ancestor.getParent();
}
return false;
} |
96fefe7f-9b28-4d7d-bc53-573aa5fd7198 | 6 | @EventHandler
public void WitchSlow(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Slow.DodgeCha... |
3c0f3945-d4f8-425d-91b6-78542cbe55db | 2 | public Vector2f tileForce(Vector2f pos){
Vector2f temp = TileUtil.getCoordinate(pos);
Vector2f force = new Vector2f(0,0);
for(Tile tile : tileList ) {
if (TileUtil.getCoordinate(tile.getPosition()).equals(temp)){
force = tile.getForce();
}
}
return force;
} |
64f8b285-a49a-49b2-aade-b5c824916719 | 7 | public PNGDecoder(InputStream input) throws IOException {
this.input = input;
this.crc = new CRC32();
this.buffer = new byte[4096];
readFully(buffer, 0, SIGNATURE.length);
if(!checkSignature(buffer)) {
throw new IOException("Not a valid PNG file");
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.