hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
sequence
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
sequence
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
sequence
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
92441764f4a56f9682e786336adbd099a264d259
2,429
java
Java
checkspec.output/src/main/java/checkspec/report/output/html/Row.java
f-cramer/checkspec
b61360d319d3e7f610e736c10b3a388ccc10bdc1
[ "Apache-2.0" ]
null
null
null
checkspec.output/src/main/java/checkspec/report/output/html/Row.java
f-cramer/checkspec
b61360d319d3e7f610e736c10b3a388ccc10bdc1
[ "Apache-2.0" ]
null
null
null
checkspec.output/src/main/java/checkspec/report/output/html/Row.java
f-cramer/checkspec
b61360d319d3e7f610e736c10b3a388ccc10bdc1
[ "Apache-2.0" ]
null
null
null
25.840426
77
0.721284
1,002,879
package checkspec.report.output.html; /*- * #%L * CheckSpec Output * %% * Copyright (C) 2017 Florian Cramer * %% * 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. * #L% */ import java.util.StringJoiner; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.text.StringEscapeUtils; import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.RequiredArgsConstructor; /** * Represents a row inside of an HTML file. * * @author Florian Cramer * */ @Getter @EqualsAndHashCode @RequiredArgsConstructor class Row { private static final String TD = "<td>%s</td>"; private static final String SPAN = "<span>%s</span>"; private static final String SPAN_CLASS = "<span class=\"%s\">%s</span>"; private static final String NO_BREAK_SPACE = "\u00a0"; private static final String INDENTATION = repeat(NO_BREAK_SPACE, 4); @Getter(AccessLevel.NONE) private final int indent; private final Mark mark; private final String text; public final String getIndentation() { return repeat(INDENTATION, indent); } public Row withIncreasedIndent() { return new Row(indent + 1, mark, text); } @Override public String toString() { StringJoiner spans = new StringJoiner(""); String indentation = getIndentation(); if (mark != null && !indentation.isEmpty()) { spans.add(String.format(SPAN, indentation)); } if (mark != null) { spans.add(String.format(SPAN_CLASS, mark.getClassName(), mark.getText())); } spans.add(createTextElement()); return String.format(TD, spans.toString()); } protected String createTextElement() { return String.format(SPAN, StringEscapeUtils.escapeHtml4(text)); } public static final Row EMPTY = new Row(0, null, NO_BREAK_SPACE); private static String repeat(String s, int times) { return Stream.generate(() -> s) .limit(times) .collect(Collectors.joining()); } }
924417ca3ea61a7f0049b4843c946cc3eea20f91
609
java
Java
src/main/java/tools/PictureDeal.java
ziyouqishi/jigsaw
a876a5495bed3c1936695147a0209b29a33c07fd
[ "Apache-2.0" ]
3
2017-03-26T10:26:28.000Z
2019-07-09T07:14:18.000Z
src/main/java/tools/PictureDeal.java
ziyouqishi/jigsaw
a876a5495bed3c1936695147a0209b29a33c07fd
[ "Apache-2.0" ]
null
null
null
src/main/java/tools/PictureDeal.java
ziyouqishi/jigsaw
a876a5495bed3c1936695147a0209b29a33c07fd
[ "Apache-2.0" ]
2
2019-04-12T02:52:22.000Z
2019-06-23T08:30:41.000Z
25.375
71
0.711002
1,002,880
package tools; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import java.io.InputStream; /** * Created by 张佳亮 on 2016/7/13. */ public class PictureDeal { public Bitmap readBitmap(Context context, int resId) { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inPreferredConfig = Bitmap.Config.RGB_565; opts.inPurgeable = true; opts.inInputShareable = true; InputStream is = context.getResources().openRawResource(resId); return BitmapFactory.decodeStream(is, null, opts); } }
924419042101d537b653af2b26fcfa155cf6fcd4
9,134
java
Java
enode/src/main/java/org/netbeans/modules/enode/ScaledIcon.java
timboudreau/netbeans-contrib
e414495e8585df9911392d7e3b190153759ff6d3
[ "Apache-2.0" ]
2
2018-07-19T08:40:29.000Z
2019-12-07T19:37:03.000Z
enode/src/main/java/org/netbeans/modules/enode/ScaledIcon.java
timboudreau/netbeans-contrib
e414495e8585df9911392d7e3b190153759ff6d3
[ "Apache-2.0" ]
4
2021-02-03T19:27:41.000Z
2021-08-02T17:04:13.000Z
enode/src/main/java/org/netbeans/modules/enode/ScaledIcon.java
timboudreau/netbeans-contrib
e414495e8585df9911392d7e3b190153759ff6d3
[ "Apache-2.0" ]
2
2020-10-03T14:44:58.000Z
2022-01-13T22:03:24.000Z
36.830645
121
0.613751
1,002,881
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, the * "License"). You may not use this file except in compliance with the * License. You can obtain a copy of the License at * http://www.netbeans.org/cddl-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this * particular file as subject to the "Classpath" exception as provided * by Sun in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * Contributor(s): * * The Original Software is NetBeans. The Initial Developer of the Original * Software is Nokia. Portions Copyright 2003-2004 Nokia. * All Rights Reserved. * * If you wish your version of this file to be governed by only the CDDL * or only the GPL Version 2, indicate your decision by adding * "[Contributor] elects to include this software in this distribution * under the [CDDL or GPL Version 2] license." If you do not indicate a * single choice of license, a recipient has the option to distribute * your version of this file under either the CDDL, the GPL Version 2 or * to extend the choice of license to its licensees as provided above. * However, if you add GPL Version 2 code and therefore, elected the GPL * Version 2 license, then the option applies only if the new code is * made subject to such option by the copyright holder. */ package org.netbeans.modules.enode; import org.netbeans.spi.enode.NbIcon; import java.awt.*; import java.awt.image.BufferedImage; import javax.swing.*; /** * Scales an icon to a given width or height. By default icons are scaled to * a width of 20 pixels. Such icons are needed for menu items. * <p> * The aspect ratio of the icon is kept if the height is less than the width * (or if the width is less than the height, depending on which property shall * be kept). Otherwise the height is adjusted to the width (or the other way * round). * * @author John Stuwe */ public class ScaledIcon extends ImageIcon { /** * Constructor for creating scaled icons. To create a <tt>ScaledIcon</tt>, * use the public static methods in this class. * * @param image The image that shall be returned. * * @see #scale(Icon) * @see #scale(Icon,int) * @see #scale(Icon,int,boolean) */ private ScaledIcon( Image image ) { super( image ); } /** * Scales the icon to a width of 16 pixels. The aspect ratio of the icon is * kept if the resulting height would be less than 16 pixels, otherwise the * height is truncated to 16 pixels. * <p> * @param The icon that shall be scaled. * <p> * @return The scaled icon. This is a new instance of <tt>ScaledIcon</tt>. */ public static Icon create( ImageIcon icon ) { return create( icon, NbIcon.SIZE_16x16, true ); } /** * Scales the icon to a given width. The aspect ratio of the icon is kept if * the resulting height would be less than the given width, otherwise the * height is truncated to the given width. * <p> * @param The icon that shall be scaled. * <p> * @param width The width of the scaled icon. * <p> * @return The scaled icon. This is a new instance of <tt>ScaledIcon</tt>. */ public static Icon create( ImageIcon icon, int width ) { return create( icon, width, true ); } /** * Scales the icon to a given width or height. The aspect ratio of the icon * is kept if the resulting height (or width) would be less than the given * size, otherwise the height (or width) is truncated to the given size. * <p> * @param The icon that shall be scaled. * <p> * @param size The width or height of the scaled icon, depending on the flag * <tt>keepWidth</tt>. * <p> * @param keepWidth If <tt>true</tt>, the width is scaled to the given size, * otherwise the height of the icon is scaled to the given size. * <p> * @return The scaled icon. This is a new instance of <tt>ScaledIcon</tt>. */ public static Icon create( ImageIcon icon, int size, boolean keepWidth ) { return create( icon, size, keepWidth, false ); } /** * Scales the icon to a given width or height. The aspect ratio of the icon * is kept if the resulting height (or width) would be less than the given * size, otherwise the height (or width) is truncated to the given size. * <p> * @param The icon that shall be scaled. * <p> * @param size The width or height of the scaled icon, depending on the flag * <tt>keepWidth</tt>. * <p> * @param scaleWidth If <tt>true</tt>, the width is scaled to the given size, * otherwise the height of the icon is scaled to the given size. * <p> * @param magnify If <tt>true</tt>, the icons gets magnified if it is too * small. Otherwise the small icon is centered on a transparent * background. * <p> * @return The scaled icon. This is a new instance of <tt>ScaledIcon</tt>. */ public static Icon create( ImageIcon icon, int size, boolean scaleWidth, boolean magnify ) { Icon scaled = icon; if( icon.getImageLoadStatus( ) == MediaTracker.COMPLETE ) { int width = icon.getIconWidth( ); int height = icon.getIconHeight( ); Image image = icon.getImage( ); if( magnify || ( width > size ) || ( height > size ) ) { image = scaleImage( image, width, height, size, scaleWidth ); } else { BufferedImage buffer = new BufferedImage( size, size, BufferedImage.TYPE_INT_ARGB ); Graphics g = buffer.getGraphics( ); int x = ( size - width ) / 2; int y = ( size - height ) / 2; g.drawImage( image, x, y, null ); g.dispose( ); image = buffer; } scaled = new ScaledIcon( image ); } return scaled; } /** * Paints the scaled icon. To avoid a {@link NullPointerException}, the * method uses a {@link MediaTracker} to check if the scaled image is * available. If the image is not available nothing will be painted. * <p> * @param c The component that wants to paint the icon. * <p> * @param g The current graphics context. * <p> * @param x The x position for painting the icon. * <p> * @param y The y position for painting the icon. */ public void paintIcon( Component c, Graphics g, int x, int y ) { // // Ensure that the scaled image is really available! // if( getImageLoadStatus( ) == MediaTracker.COMPLETE ) { super.paintIcon( c, g, x, y ); } } /** * Scales the image, so that it fits into a square with the given size as * width and height. * * @param image The image that shall be scaled. * <p> * @param originalWidth The original width of the image. * <p> * @param originalHeight The original height of the image. * <p> * @param size The new width and height of the image. * <p> * @param scaleWidth If <tt>true</tt>, the width is scaled to the given * size, otherwise the height of the icon is scaled to the given * size. * <p> * @return The scaled image. */ private static Image scaleImage( Image image, int originalWidth, int originalHeight, int size, boolean scaleWidth ) { // // Keep aspect ratio if possible. If the height exceeds the // width, the icon gets distorted to avoid gaps between the // menu items. // int height = -1; int width = -1; if( scaleWidth ) { width = size; if( originalHeight > originalWidth ) { height = width; } } else { height = size; if( originalWidth > originalHeight ) { width = height; } } return image.getScaledInstance( width, height, Image.SCALE_SMOOTH ); } }
9244195820566361e99c044df2904326b1fed71a
4,466
java
Java
src/main/java/com/sls/po/model/Indent.java
Sougata1233/PO_API_Module
0cf42a3441c6060c16d427d986ae629cd1822efc
[ "MIT" ]
null
null
null
src/main/java/com/sls/po/model/Indent.java
Sougata1233/PO_API_Module
0cf42a3441c6060c16d427d986ae629cd1822efc
[ "MIT" ]
null
null
null
src/main/java/com/sls/po/model/Indent.java
Sougata1233/PO_API_Module
0cf42a3441c6060c16d427d986ae629cd1822efc
[ "MIT" ]
null
null
null
19.333333
105
0.749216
1,002,882
package com.sls.po.model; import java.util.Date; import javax.persistence.Column; 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; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.TableGenerator; @Entity() @Table(name="SCM_INDENT_LINE_ITEM") public class Indent { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "INDENT_ITM_SEQ") @SequenceGenerator(sequenceName = "scm_indent_item_seq", allocationSize = 1, name = "INDENT_ITM_SEQ") @Column(name="INDENT_SRL_NO") private long id; @Column(name="INDENT_NO") private String indentHeaderId; @Column(name="INDENT_TYPE") private String type ; @Column(name="INDENT_STATUS") private String status ; @Column(name="GROUP_CODE") private String itemGroupId; @Column(name="ITEM_CODE") private String itemId; @Column(name="UOM_CODE") private String unitId; @Column(name="DEPT_CODE") private long deptId; @Column(name="STOCK_IN_HAND") private float stock; @Column(name="INDENT_QTY") private long indentQuantity; @Column(name="CANCEL_QTY") private long indentCancelledQuantity; @Column(name="APPROVER_LEVEL_FIRST") private String approverFirst ; @Column(name="APPROVER_LEVEL_SECOND") private String approverSecond ; @Column(name="APPROVE_LEVEL_FIRST_DATE") private Date approveFirstDate ; @Column(name="APPROVE_LEVEL_SECOND_DATE") private Date approveSecondDate ; @Column(name="QUALITY") private long qualityCode; @Column(name="MARKA") private String marka; @Column(name="ADDITIONAL_REQUIREMENT") private String additionalRequirement; public String getAdditionalRequirement() { return additionalRequirement; } public void setAdditionalRequirement(String additionalRequirement) { this.additionalRequirement = additionalRequirement; } public long getQualityCode() { return qualityCode; } public void setQualityCode(long qualityCode) { this.qualityCode = qualityCode; } public String getMarka() { return marka; } public void setMarka(String marka) { this.marka = marka; } public String getApproverFirst() { return approverFirst; } public void setApproverFirst(String approverFirst) { this.approverFirst = approverFirst; } public String getApproverSecond() { return approverSecond; } public void setApproverSecond(String approverSecond) { this.approverSecond = approverSecond; } public Date getApproveFirstDate() { return approveFirstDate; } public void setApproveFirstDate(Date approveFirstDate) { this.approveFirstDate = approveFirstDate; } public Date getApproveSecondDate() { return approveSecondDate; } public void setApproveSecondDate(Date approveSecondDate) { this.approveSecondDate = approveSecondDate; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getIndentHeaderId() { return indentHeaderId; } public void setIndentHeaderId(String indentHeaderId) { this.indentHeaderId = indentHeaderId; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getItemGroupId() { return itemGroupId; } public void setItemGroupId(String itemGroupId) { this.itemGroupId = itemGroupId; } public String getItemId() { return itemId; } public void setItemId(String itemId) { this.itemId = itemId; } public String getUnitId() { return unitId; } public void setUnitId(String unitId) { this.unitId = unitId; } public long getDeptId() { return deptId; } public void setDeptId(long deptId) { this.deptId = deptId; } public float getStock() { return stock; } public void setStock(float stock) { this.stock = stock; } public long getIndentQuantity() { return indentQuantity; } public void setIndentQuantity(long indentQuantity) { this.indentQuantity = indentQuantity; } public long getIndentCancelledQuantity() { return indentCancelledQuantity; } public void setIndentCancelledQuantity(long indentCancelledQuantity) { this.indentCancelledQuantity = indentCancelledQuantity; } }
924419715eb18321234d03947afbe988d9da7700
678
java
Java
src/main/java/co/phystech/aosorio/models/ProcurementCodes.java
PhystechCo/CentralDBServices
c99568b0c8893c20d5748d416d26df2de18f7a23
[ "MIT" ]
null
null
null
src/main/java/co/phystech/aosorio/models/ProcurementCodes.java
PhystechCo/CentralDBServices
c99568b0c8893c20d5748d416d26df2de18f7a23
[ "MIT" ]
null
null
null
src/main/java/co/phystech/aosorio/models/ProcurementCodes.java
PhystechCo/CentralDBServices
c99568b0c8893c20d5748d416d26df2de18f7a23
[ "MIT" ]
null
null
null
16.142857
63
0.728614
1,002,883
/** * */ package co.phystech.aosorio.models; import java.util.List; import org.mongodb.morphia.annotations.Embedded; import org.mongodb.morphia.annotations.Entity; import org.mongodb.morphia.annotations.Id; /** * @author AOSORIO * */ @Entity("procurementcodes") public class ProcurementCodes { @Id private String code; @Embedded private List<Descriptions> descriptions; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public List<Descriptions> getDescriptions() { return descriptions; } public void setDescriptions(List<Descriptions> descriptions) { this.descriptions = descriptions; } }
92441a42a9383ad062c9c2e02a673c6371d1a454
841
java
Java
src/main/java/com/kingbase/lucene/commons/query/BooleanQueryFactory.java
mumusearch/lucene
b82c78e549cc0f760ae4aae736b6e9a834a0351c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/kingbase/lucene/commons/query/BooleanQueryFactory.java
mumusearch/lucene
b82c78e549cc0f760ae4aae736b6e9a834a0351c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/kingbase/lucene/commons/query/BooleanQueryFactory.java
mumusearch/lucene
b82c78e549cc0f760ae4aae736b6e9a834a0351c
[ "Apache-2.0" ]
null
null
null
24.735294
99
0.722949
1,002,884
package com.kingbase.lucene.commons.query; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.BooleanQuery.Builder; import org.apache.lucene.search.Query; /** * BooleanQuery * 使用BooleanQuery可以将各种查询类型组合成复杂的查询方式 * @author ganliang */ public class BooleanQueryFactory { /** * 创建BooleanQuery * @param querys 查询集合 * @param occurs occur集合 * @return */ public static Query createQuery(Query[] querys,Occur[] occurs){ if(querys==null||querys.length==0||occurs==null||occurs.length==0||querys.length!=occurs.length){ throw new IllegalArgumentException(); } //构建BooleanQuery Builder builder = new BooleanQuery.Builder(); for (int i = 0; i < querys.length; i++) { builder.add(querys[i], occurs[i]); } return builder.build(); } }
92441a716efdd3463477132ed14c21dbccee091c
3,130
java
Java
src/main/java/com/amazonaws/services/ec2/model/AssociateAddressResult.java
pbailis/aws-java-sdk-dynamodb-timestamp
33d9beb9e8b8bf6965312c2c61c621ce96d054c8
[ "Apache-2.0" ]
2
2015-04-09T03:30:56.000Z
2020-07-06T20:23:21.000Z
src/main/java/com/amazonaws/services/ec2/model/AssociateAddressResult.java
pbailis/aws-java-sdk-dynamodb-timestamp
33d9beb9e8b8bf6965312c2c61c621ce96d054c8
[ "Apache-2.0" ]
null
null
null
src/main/java/com/amazonaws/services/ec2/model/AssociateAddressResult.java
pbailis/aws-java-sdk-dynamodb-timestamp
33d9beb9e8b8bf6965312c2c61c621ce96d054c8
[ "Apache-2.0" ]
4
2015-02-03T19:36:40.000Z
2020-07-06T20:30:56.000Z
31.938776
129
0.641214
1,002,885
/* * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.ec2.model; /** * Associate Address Result */ public class AssociateAddressResult { private String associationId; /** * Returns the value of the AssociationId property for this object. * * @return The value of the AssociationId property for this object. */ public String getAssociationId() { return associationId; } /** * Sets the value of the AssociationId property for this object. * * @param associationId The new value for the AssociationId property for this object. */ public void setAssociationId(String associationId) { this.associationId = associationId; } /** * Sets the value of the AssociationId property for this object. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param associationId The new value for the AssociationId property for this object. * * @return A reference to this updated object so that method calls can be chained * together. */ public AssociateAddressResult withAssociationId(String associationId) { this.associationId = associationId; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (associationId != null) sb.append("AssociationId: " + associationId + ", "); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAssociationId() == null) ? 0 : getAssociationId().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AssociateAddressResult == false) return false; AssociateAddressResult other = (AssociateAddressResult)obj; if (other.getAssociationId() == null ^ this.getAssociationId() == null) return false; if (other.getAssociationId() != null && other.getAssociationId().equals(this.getAssociationId()) == false) return false; return true; } }
92441ad832b6cc5ec15eac45642ff7daf8a6267a
652
java
Java
app/src/main/java/com/simuwang/xxx/base/BaseBean.java
shaoshiyong/ssy
f8f0a9377ed9ebead1e4624b11e25e39e457e472
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/simuwang/xxx/base/BaseBean.java
shaoshiyong/ssy
f8f0a9377ed9ebead1e4624b11e25e39e457e472
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/simuwang/xxx/base/BaseBean.java
shaoshiyong/ssy
f8f0a9377ed9ebead1e4624b11e25e39e457e472
[ "Apache-2.0" ]
null
null
null
16.717949
40
0.51227
1,002,886
package com.simuwang.xxx.base; /** * function: 基础响应状态类 * * <p></p> * Created by Leo on 2017/12/20. */ @SuppressWarnings("ALL") public class BaseBean { protected int status; protected String msg; 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; } @Override public String toString() { return "BaseBean{" + "status=" + status + ", msg='" + msg + '\'' + '}'; } }
92441b277811b7971999b57123e22cccfcfb5e4a
2,713
java
Java
aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/transform/UploadDocumentsRequestMarshaller.java
DamonTung/aws-sdk-java
e33012aea76a1cc18866120d0c53fd593b2cf550
[ "Apache-2.0" ]
1
2019-10-17T14:03:43.000Z
2019-10-17T14:03:43.000Z
aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/transform/UploadDocumentsRequestMarshaller.java
DamonTung/aws-sdk-java
e33012aea76a1cc18866120d0c53fd593b2cf550
[ "Apache-2.0" ]
null
null
null
aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/transform/UploadDocumentsRequestMarshaller.java
DamonTung/aws-sdk-java
e33012aea76a1cc18866120d0c53fd593b2cf550
[ "Apache-2.0" ]
2
2017-10-05T10:52:18.000Z
2018-10-19T09:13:12.000Z
43.758065
158
0.755252
1,002,887
/* * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.cloudsearchdomain.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.cloudsearchdomain.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * UploadDocumentsRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class UploadDocumentsRequestMarshaller { private static final MarshallingInfo<java.io.InputStream> DOCUMENTS_BINDING = MarshallingInfo.builder(MarshallingType.STREAM) .marshallLocation(MarshallLocation.PAYLOAD).isExplicitPayloadMember(true).isBinary(true).build(); private static final MarshallingInfo<String> CONTENTTYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.HEADER).marshallLocationName("Content-Type").build(); private static final MarshallingInfo<Long> CONTENTLENGTH_BINDING = MarshallingInfo.builder(MarshallingType.LONG).marshallLocation(MarshallLocation.HEADER) .marshallLocationName("Content-Length").build(); private static final UploadDocumentsRequestMarshaller instance = new UploadDocumentsRequestMarshaller(); public static UploadDocumentsRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(UploadDocumentsRequest uploadDocumentsRequest, ProtocolMarshaller protocolMarshaller) { if (uploadDocumentsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(uploadDocumentsRequest.getDocuments(), DOCUMENTS_BINDING); protocolMarshaller.marshall(uploadDocumentsRequest.getContentType(), CONTENTTYPE_BINDING); protocolMarshaller.marshall(uploadDocumentsRequest.getContentLength(), CONTENTLENGTH_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
92441b8a6ec756877f2b83c595d28e6debc0cfb4
255
java
Java
android/main/src/petablox/android/srcmap/sourceinfo/MethodInfo.java
KihongHeo/petablox
860e9441834041392e37282884a51a5603d8c132
[ "BSD-3-Clause" ]
25
2016-02-03T19:14:38.000Z
2019-06-11T18:30:14.000Z
android/main/src/petablox/android/srcmap/sourceinfo/MethodInfo.java
KihongHeo/petablox
860e9441834041392e37282884a51a5603d8c132
[ "BSD-3-Clause" ]
24
2016-01-01T01:29:36.000Z
2019-03-14T02:04:46.000Z
android/main/src/petablox/android/srcmap/sourceinfo/MethodInfo.java
KihongHeo/petablox
860e9441834041392e37282884a51a5603d8c132
[ "BSD-3-Clause" ]
5
2016-01-04T08:59:17.000Z
2018-04-22T08:49:47.000Z
19.615385
79
0.760784
1,002,888
package petablox.android.srcmap.sourceinfo; import java.util.List; import petablox.android.srcmap.Marker; /** * @author Saswat Anand */ public interface MethodInfo { public abstract List<Marker> markers(int line, String markerType, String sig); }
92441c78e863447a13b83c424e8050c424c651c3
2,931
java
Java
com/smartg/color/Decode.java
andronix3/ColorSpace
1d7b802d3d8c24d80c1f6bb1505df6eb4f8e3665
[ "BSD-3-Clause" ]
1
2020-01-14T12:33:46.000Z
2020-01-14T12:33:46.000Z
com/smartg/color/Decode.java
andronix3/ColorSpace
1d7b802d3d8c24d80c1f6bb1505df6eb4f8e3665
[ "BSD-3-Clause" ]
null
null
null
com/smartg/color/Decode.java
andronix3/ColorSpace
1d7b802d3d8c24d80c1f6bb1505df6eb4f8e3665
[ "BSD-3-Clause" ]
null
null
null
34.892857
95
0.710338
1,002,889
/* * Copyright (c) Andrey Kuznetsov. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * o 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. * * o Neither the name of imagero Andrey Kuznetsov nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.smartg.color; import java.awt.Color; public class Decode extends IColorSpace { private static final long serialVersionUID = 746833503496538278L; float[] decode; IColorSpace colorSpace; int bitsPerSample; public Decode(float[] decode, IColorSpace cs, int bitsPerSample) { super(cs.getType(), cs.getNumComponents()); this.decode = decode; this.bitsPerSample = bitsPerSample; this.colorSpace = cs; } public Color getColor(float[] d) { float[] d2 = new float[d.length]; decode(d, d2); return colorSpace.getColor(d2); } private void decode(float[] src, float[] dst) { for (int i = 0; i < src.length; i++) { float x = src[i]; int index = i * 2; if (index < decode.length - 1) { float Dmin = decode[index]; float Dmax = decode[index + 1]; float xmax = (1 << bitsPerSample) - 1; x = x * xmax; dst[i] = interpolate(x, 0, xmax, Dmin, Dmax) / Dmax; } } } private static float interpolate(float x, float xmin, float xmax, float ymin, float ymax) { return ymin + ((x - xmin) * ((ymax - ymin) / (xmax - xmin))); } public int getComponentCount() { return colorSpace.getComponentCount(); } public float[] toRGB(float[] colorvalue) { float[] d2 = new float[colorvalue.length]; decode(colorvalue, d2); return colorSpace.toRGB(d2); } }
92441cc532e6e98cde3552d3b88d5d8c3b922626
137
java
Java
testframewok/src/main/java/jet/opengl/demos/nvidia/waves/crest/Wave_FilterData.java
mzhg/PostProcessingWork
4a8379d5263b1f227e54f31f61e59c0e3dba377c
[ "Apache-2.0" ]
16
2018-02-28T09:34:43.000Z
2022-03-09T06:06:30.000Z
testframewok/src/main/java/jet/opengl/demos/nvidia/waves/crest/Wave_FilterData.java
mzhg/PostProcessingWork
4a8379d5263b1f227e54f31f61e59c0e3dba377c
[ "Apache-2.0" ]
null
null
null
testframewok/src/main/java/jet/opengl/demos/nvidia/waves/crest/Wave_FilterData.java
mzhg/PostProcessingWork
4a8379d5263b1f227e54f31f61e59c0e3dba377c
[ "Apache-2.0" ]
6
2018-02-28T09:35:10.000Z
2021-12-12T05:38:15.000Z
17.125
44
0.759124
1,002,890
package jet.opengl.demos.nvidia.waves.crest; final class Wave_FilterData { public float weight; public boolean isTransition; }
92441da9bc9fcdea750af986837d91ba21d8960d
685
java
Java
engine/src/main/java/org/terasology/engine/rendering/assets/texture/subtexture/SubtextureData.java
ahv15/Terasology
197135c98eec86751e2609e5877b2611c375dc3e
[ "Apache-2.0" ]
2,996
2015-01-01T13:48:59.000Z
2022-03-28T17:56:47.000Z
engine/src/main/java/org/terasology/engine/rendering/assets/texture/subtexture/SubtextureData.java
ahv15/Terasology
197135c98eec86751e2609e5877b2611c375dc3e
[ "Apache-2.0" ]
3,251
2015-01-01T00:25:51.000Z
2022-03-31T22:06:39.000Z
engine/src/main/java/org/terasology/engine/rendering/assets/texture/subtexture/SubtextureData.java
ahv15/Terasology
197135c98eec86751e2609e5877b2611c375dc3e
[ "Apache-2.0" ]
1,775
2015-01-02T10:31:49.000Z
2022-03-30T03:50:11.000Z
25.37037
66
0.729927
1,002,891
// Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 package org.terasology.engine.rendering.assets.texture.subtexture; import org.terasology.gestalt.assets.AssetData; import org.terasology.joml.geom.Rectanglef; import org.terasology.engine.rendering.assets.texture.Texture; public class SubtextureData implements AssetData { private Texture texture; private Rectanglef region; public SubtextureData(Texture texture, Rectanglef region) { this.texture = texture; this.region = region; } public Texture getTexture() { return texture; } public Rectanglef getRegion() { return region; } }
92441dc571205f3bf1b58553a6cd466b4204e104
1,249
java
Java
shop-quartz/src/main/java/com/shop/quartz/controller/ScheduleJobLogController.java
yzh92/graduation-wechat-mall
1114761c3c2d357766e22f914a1aac155e375691
[ "MIT" ]
null
null
null
shop-quartz/src/main/java/com/shop/quartz/controller/ScheduleJobLogController.java
yzh92/graduation-wechat-mall
1114761c3c2d357766e22f914a1aac155e375691
[ "MIT" ]
null
null
null
shop-quartz/src/main/java/com/shop/quartz/controller/ScheduleJobLogController.java
yzh92/graduation-wechat-mall
1114761c3c2d357766e22f914a1aac155e375691
[ "MIT" ]
null
null
null
34.694444
154
0.813451
1,002,892
package com.shop.quartz.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.shop.common.util.PageParam; import com.shop.quartz.model.ScheduleJobLog; import com.shop.quartz.service.ScheduleJobLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 定时任务日志 * @author yzh */ @RestController @RequestMapping("/sys/scheduleLog") public class ScheduleJobLogController { @Autowired private ScheduleJobLogService scheduleJobLogService; /** * 定时任务日志列表 */ @GetMapping("/page") @PreAuthorize("@pms.hasPermission('sys:schedule:log')") public ResponseEntity<IPage<ScheduleJobLog>> page(Long jobId,PageParam<ScheduleJobLog> page){ IPage<ScheduleJobLog> list = scheduleJobLogService.page(page,new LambdaQueryWrapper<ScheduleJobLog>().eq(jobId != null,ScheduleJobLog::getJobId,jobId)); return ResponseEntity.ok(list); } }
92441fd22a4e828dde9187866a2012a8c1a71d11
226
java
Java
Facebook/Spring/facebook/src/main/java/edu/prahlad/facebook/repo/actions/GroupRepo.java
MukeshKumarP/CaseStudy
6e937ce27f6f19da826e07dfe097e1fdb7a819bb
[ "MIT" ]
null
null
null
Facebook/Spring/facebook/src/main/java/edu/prahlad/facebook/repo/actions/GroupRepo.java
MukeshKumarP/CaseStudy
6e937ce27f6f19da826e07dfe097e1fdb7a819bb
[ "MIT" ]
19
2021-09-02T13:00:22.000Z
2022-03-02T09:18:49.000Z
Facebook/Spring/facebook/src/main/java/edu/prahlad/facebook/repo/actions/GroupRepo.java
MukeshKumarP/CaseStudy
6e937ce27f6f19da826e07dfe097e1fdb7a819bb
[ "MIT" ]
1
2021-01-30T09:55:59.000Z
2021-01-30T09:55:59.000Z
28.25
66
0.831858
1,002,893
package edu.prahlad.facebook.repo.actions; import edu.prahlad.facebook.entity.actions.Group; import org.springframework.data.jpa.repository.JpaRepository; public interface GroupRepo extends JpaRepository<Group, Integer> { }
924421de26fdbe5c7d0d65965642678e070f606c
1,121
java
Java
kudu/src/main/java/org/apache/apex/malhar/kudu/KuduMutationType.java
tweise/apex-malhar
a964992771d464dd10c35142dacd6ceac1265ba5
[ "Apache-2.0" ]
98
2016-06-13T11:16:07.000Z
2021-11-10T18:58:48.000Z
kudu/src/main/java/org/apache/apex/malhar/kudu/KuduMutationType.java
tweise/apex-malhar
a964992771d464dd10c35142dacd6ceac1265ba5
[ "Apache-2.0" ]
315
2016-06-06T04:04:07.000Z
2019-06-03T17:44:35.000Z
kudu/src/main/java/org/apache/apex/malhar/kudu/KuduMutationType.java
isabella232/apex-malhar
0f016c82e4e1363b3f7de4ae28138bc7ba896d37
[ "Apache-2.0" ]
104
2016-06-06T06:53:56.000Z
2021-11-22T22:20:24.000Z
32.028571
110
0.733274
1,002,894
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.apex.malhar.kudu; /** * <p>Used in {@link KuduExecutionContext} to denote the type of mutation we would like to be executed for the * mutation being represented by the current tuple</p> * * @since 3.8.0 */ public enum KuduMutationType { INSERT, DELETE, UPDATE, UPSERT }
924423bad95026be5f11294bda4722625dd9e1a9
2,535
java
Java
src/Controller/CharacterController.java
LuisDiegoMora98/TEC_CR_Software_Design_Proyect_I
970a10b8125d4ef7f0fc3cdcc5aa8b3799c5ad88
[ "Apache-2.0" ]
null
null
null
src/Controller/CharacterController.java
LuisDiegoMora98/TEC_CR_Software_Design_Proyect_I
970a10b8125d4ef7f0fc3cdcc5aa8b3799c5ad88
[ "Apache-2.0" ]
null
null
null
src/Controller/CharacterController.java
LuisDiegoMora98/TEC_CR_Software_Design_Proyect_I
970a10b8125d4ef7f0fc3cdcc5aa8b3799c5ad88
[ "Apache-2.0" ]
1
2021-11-25T00:07:27.000Z
2021-11-25T00:07:27.000Z
33.355263
82
0.59211
1,002,895
/* * 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 Controller; import Model.Character; import Model.CharacterPrototypeFactory; import Model.Direction; import Model.ICreator; import Model.Weapon; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import utils.JSONLoader; /** * * @author aguil */ public class CharacterController { private final JSONLoader json; private ICreator factory; // A commentary public CharacterController() throws IOException{ this.json = JSONLoader.getInstance(); this.factory = new CharacterPrototypeFactory(); if(!json.getCharacters().isEmpty()){ this.loadCharacters(); } } private void loadCharacters(){ json.getCharacters().forEach(it -> { this.factory.addPrototype(it.getName(), it); }); } public void createCharacter(String pName, int pLife, int pLevelReq, int pLevel, int pHitsPerTime, int pFields, Direction pDirection, ArrayList<Weapon> pWeapons, Weapon pCurrent, int pCost, HashMap<Integer, ArrayList<String>> pAspects) throws IOException{ Character character = new Character.CharacterBuilder() .setName(pName) .setLife(pLife) .setLevelRequired(pLevelReq) .setLevel(pLevel) .setHitsPerTime(pHitsPerTime) .setFieldsInArmy(pFields) .setDirection(pDirection) .setWeapons(pWeapons) .setCurrentWeapon(pCurrent) .setCost(pCost) .setAspect(pAspects) .build(); this.factory.addPrototype(pName, character); this.json.writeJSON(character); } public ArrayList<Character> getManyCharacters(String pName, int pQuantity){ ArrayList<Character> list = new ArrayList<>(); for(int index = 0; index < pQuantity; index++){ list.add((Character)this.factory.getPrototypeDeepClone(pName)); } return list; } public Character getCharacter(String pName){ return (Character)this.factory.getPrototypeDeepClone(pName); } }
924423e5f6b8e36cdeb16a05c95a905631bc0ad8
1,426
java
Java
com.io7m.cardant.database.derby/src/main/java/com/io7m/cardant/database/derby/internal/xml/CADatabaseV1CommentParser.java
io7m/cardant
6558f11c2031e6c83bf76d68184c574c0795abda
[ "0BSD" ]
null
null
null
com.io7m.cardant.database.derby/src/main/java/com/io7m/cardant/database/derby/internal/xml/CADatabaseV1CommentParser.java
io7m/cardant
6558f11c2031e6c83bf76d68184c574c0795abda
[ "0BSD" ]
4
2021-10-03T21:13:40.000Z
2021-10-30T16:15:48.000Z
com.io7m.cardant.database.derby/src/main/java/com/io7m/cardant/database/derby/internal/xml/CADatabaseV1CommentParser.java
io7m/cardant
6558f11c2031e6c83bf76d68184c574c0795abda
[ "0BSD" ]
null
null
null
29.625
78
0.759494
1,002,896
/* * Copyright © 2021 Mark Raynsford <[email protected]> http://io7m.com * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package com.io7m.cardant.database.derby.internal.xml; import com.io7m.blackthorne.api.BTElementHandlerType; import com.io7m.blackthorne.api.BTElementParsingContextType; /** * A comment parser. */ public final class CADatabaseV1CommentParser implements BTElementHandlerType<Object, Object> { /** * A comment parser. * * @param context The context */ public CADatabaseV1CommentParser( final BTElementParsingContextType context) { } @Override public Object onElementFinished( final BTElementParsingContextType context) { return CADatabaseComment.DATABASE_COMMENT; } }
924423feccfa37d4e55ba55ee8c0c166ac1bcdcc
850
java
Java
gulimall-order/src/main/java/com/ss/gulimall/order/entity/RefundInfoEntity.java
FangSheng-chan/gulimall
32fa488c276c7d10d053c88934a36a52a3dc874a
[ "Apache-2.0" ]
null
null
null
gulimall-order/src/main/java/com/ss/gulimall/order/entity/RefundInfoEntity.java
FangSheng-chan/gulimall
32fa488c276c7d10d053c88934a36a52a3dc874a
[ "Apache-2.0" ]
null
null
null
gulimall-order/src/main/java/com/ss/gulimall/order/entity/RefundInfoEntity.java
FangSheng-chan/gulimall
32fa488c276c7d10d053c88934a36a52a3dc874a
[ "Apache-2.0" ]
null
null
null
15.722222
55
0.687868
1,002,897
package com.ss.gulimall.order.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.math.BigDecimal; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 退款信息 * * @author fangsheng * @email [email protected] * @date 2021-10-17 15:33:44 */ @Data @TableName("oms_refund_info") public class RefundInfoEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private Long id; /** * 退款的订单 */ private Long orderReturnId; /** * 退款金额 */ private BigDecimal refund; /** * 退款交易流水号 */ private String refundSn; /** * 退款状态 */ private Integer refundStatus; /** * 退款渠道[1-支付宝,2-微信,3-银联,4-汇款] */ private Integer refundChannel; /** * */ private String refundContent; }
9244243162e355b1dd1b81d243231d23a4f87723
911
java
Java
src/main/java/org/lyg/common/utils/DetaDBUtil.java
yaoguangluo/DETA_BackEnd
255df207a51bd0e1aabbe680defcdf57758a1434
[ "Apache-2.0" ]
104
2019-01-10T02:09:22.000Z
2021-01-09T04:43:52.000Z
src/main/java/org/lyg/common/utils/DetaDBUtil.java
yaoguangluo/DETA_BackEnd
255df207a51bd0e1aabbe680defcdf57758a1434
[ "Apache-2.0" ]
1
2019-03-25T16:57:48.000Z
2019-03-25T16:57:48.000Z
src/main/java/org/lyg/common/utils/DetaDBUtil.java
yaoguangluo/DETA_BackEnd
255df207a51bd0e1aabbe680defcdf57758a1434
[ "Apache-2.0" ]
34
2019-01-10T05:40:30.000Z
2021-01-22T11:01:44.000Z
35.038462
98
0.705818
1,002,898
package org.lyg.common.utils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class DetaDBUtil { public static String DBRequest(String request) throws IOException { URL url = new URL("http://localhost:3306" + request); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setConnectTimeout(20000); conn.setRequestProperty("Accept", "application/json"); if (conn.getResponseCode() != 200) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream()),"UTF-8")); String out = ""; String out1; while ((out1 = br.readLine()) != null) { out += out1; } conn.disconnect(); return out; } }
9244245d5f9940fccd3bc886edc43e89bc148e32
4,357
java
Java
implementation/src/main/java/io/smallrye/metrics/elementdesc/RawMemberInfo.java
jmartisk/smallrye-metrics
cdfe276388381f320adbc7d0c72822578d3f780f
[ "Apache-2.0" ]
28
2018-07-20T13:59:13.000Z
2022-02-26T03:52:44.000Z
implementation/src/main/java/io/smallrye/metrics/elementdesc/RawMemberInfo.java
jmartisk/smallrye-metrics
cdfe276388381f320adbc7d0c72822578d3f780f
[ "Apache-2.0" ]
252
2018-06-26T07:20:06.000Z
2022-03-17T19:29:28.000Z
implementation/src/main/java/io/smallrye/metrics/elementdesc/RawMemberInfo.java
jmartisk/smallrye-metrics
cdfe276388381f320adbc7d0c72822578d3f780f
[ "Apache-2.0" ]
31
2018-07-13T09:45:09.000Z
2021-03-23T13:51:38.000Z
30.900709
122
0.675235
1,002,899
package io.smallrye.metrics.elementdesc; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Objects; public class RawMemberInfo implements MemberInfo { private MemberType memberType; private String declaringClassName; private String declaringClassSimpleName; private String name; private String[] parameterTypeNames; private List<AnnotationInfo> annotationInfos = new ArrayList<>(); public RawMemberInfo() { } public RawMemberInfo(MemberType memberType, String declaringClassName, String declaringClassSimpleName, String name, Collection<AnnotationInfo> annotationInfos) { this.memberType = memberType; this.declaringClassName = declaringClassName; this.declaringClassSimpleName = declaringClassSimpleName; this.name = name; this.annotationInfos.addAll(annotationInfos); this.parameterTypeNames = new String[0]; } public RawMemberInfo(MemberType memberType, String declaringClassName, String declaringClassSimpleName, String name, Collection<AnnotationInfo> annotationInfos, String[] parameterTypes) { this.memberType = memberType; this.declaringClassName = declaringClassName; this.declaringClassSimpleName = declaringClassSimpleName; this.name = name; this.annotationInfos.addAll(annotationInfos); if (parameterTypes != null) { this.parameterTypeNames = parameterTypes; } else { this.parameterTypeNames = new String[0]; } } public void setMemberType(MemberType memberType) { this.memberType = memberType; } public void setDeclaringClassName(String declaringClassName) { this.declaringClassName = declaringClassName; } public void setDeclaringClassSimpleName(String declaringClassSimpleName) { this.declaringClassSimpleName = declaringClassSimpleName; } public void setName(String name) { this.name = name; } public void setParameterTypeNames(String[] parameterTypeNames) { this.parameterTypeNames = parameterTypeNames; } public void setAnnotationInfos(List<AnnotationInfo> annotationInfos) { this.annotationInfos = annotationInfos; } public List<AnnotationInfo> getAnnotationInfos() { return annotationInfos; } @Override public MemberType getMemberType() { return memberType; } @Override public String getDeclaringClassName() { return declaringClassName; } @Override public String getDeclaringClassSimpleName() { return declaringClassSimpleName; } @Override public String getName() { return name; } @Override public <T extends Annotation> AnnotationInfo getAnnotation(Class<T> metricClass) { return annotationInfos.stream().filter(annotation -> annotation.annotationName().equals(metricClass.getName())) .findFirst().orElse(null); } @Override public String[] getParameterTypeNames() { return parameterTypeNames; } @Override public <T extends Annotation> boolean isAnnotationPresent(Class<T> metricClass) { return annotationInfos.stream().anyMatch(annotation -> annotation.annotationName().equals(metricClass.getName())); } @Override public boolean equals(Object obj) { if (!(obj instanceof MemberInfo)) { return false; } MemberInfo other = (MemberInfo) obj; return other.getDeclaringClassName().equals(this.getDeclaringClassName()) && other.getName().equals(this.getName()) && Arrays.equals(other.getParameterTypeNames(), this.parameterTypeNames); } @Override public int hashCode() { return Objects.hash(this.declaringClassName, this.name, Arrays.hashCode(this.parameterTypeNames)); } @Override public String toString() { return "RawMemberInfo{" + "memberType=" + memberType + ", declaringClassName='" + declaringClassName + '\'' + ", name='" + name + '\'' + ", parameterTypeNames=" + Arrays.toString(parameterTypeNames) + '}'; } }
924425528d9b54b342769ff193747e7048b813d7
289
java
Java
inventory-service/src/main/java/top/neospot/cloud/inventory/annotation/DbContext.java
neocxf/neocloud
a5d55275a93baf308f5d322e6666865b0475fd30
[ "MIT" ]
null
null
null
inventory-service/src/main/java/top/neospot/cloud/inventory/annotation/DbContext.java
neocxf/neocloud
a5d55275a93baf308f5d322e6666865b0475fd30
[ "MIT" ]
11
2020-11-16T20:30:25.000Z
2022-02-17T01:48:56.000Z
inventory-service/src/main/java/top/neospot/cloud/inventory/annotation/DbContext.java
neocxf/neocloud
a5d55275a93baf308f5d322e6666865b0475fd30
[ "MIT" ]
null
null
null
19.266667
47
0.743945
1,002,900
package top.neospot.cloud.inventory.annotation; import java.lang.annotation.*; /** * By neo.chen{[email protected]} on 2019/5/21. */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface DbContext { DbEnum value() default DbEnum.MASTER; }
924425807f576196a38797c852bf38d3185e656c
3,593
java
Java
app/src/main/java/com/xuexiang/xuidemo/widget/SelectorColorDialog.java
liuxiaoqiang1018/XUI
7a8787177b8ce3ef195c6d2c88129e1a649ad57f
[ "Apache-2.0" ]
3,986
2019-01-08T06:18:34.000Z
2022-03-30T13:22:43.000Z
app/src/main/java/com/xuexiang/xuidemo/widget/SelectorColorDialog.java
liuxiaoqiang1018/XUI
7a8787177b8ce3ef195c6d2c88129e1a649ad57f
[ "Apache-2.0" ]
116
2019-01-16T09:00:21.000Z
2022-03-01T03:22:16.000Z
app/src/main/java/com/xuexiang/xuidemo/widget/SelectorColorDialog.java
blue-tears/XUI
dbb235ce1281ac538f75eca0eeb8ba4b10b1b944
[ "Apache-2.0" ]
730
2019-01-07T08:34:52.000Z
2022-03-28T06:42:41.000Z
30.726496
127
0.627816
1,002,901
/* * Copyright (C) 2018 xuexiangjys([email protected]) * * 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.xuexiang.xuidemo.widget; import android.content.Context; import android.graphics.Color; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseAdapter; import android.widget.GridView; import com.xuexiang.xui.widget.dialog.materialdialog.CustomMaterialDialog; import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog; import com.xuexiang.xutil.display.ScreenUtils; /** * 颜色选择器 * * @author xuexiang * @since 2018/12/28 上午10:15 */ public class SelectorColorDialog extends CustomMaterialDialog { private OnColorSelectedListener mOnColorSelectedListener; /** * 构造窗体 * * @param context */ public SelectorColorDialog(Context context, OnColorSelectedListener listener) { super(context); mOnColorSelectedListener = listener; } @Override protected MaterialDialog.Builder getDialogBuilder(Context context) { return new MaterialDialog.Builder(context) .customView(getContentView(context), false); } private View getContentView(final Context context) { GridView gv = new GridView(context); gv.setNumColumns(4); gv.setAdapter(new BaseAdapter() { int[] colors = new int[]{Color.TRANSPARENT, 0xffffffff, 0xff000000, 0xffe51c23, 0xffE84E40, 0xff9c27b0, 0xff673ab7, 0xff3f51b5, 0xff5677fc, 0xff03a9f4, 0xff00bcd4, 0xff009688, 0xff259b24, 0xff8bc34a, 0xffcddc39, 0xffffeb3b, 0xffffc107, 0xffff9800, 0xffff5722, 0xff795548}; @Override public int getCount() { return colors.length; } @Override public Object getItem(int position) { return colors[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View v = new View(context); v.setBackgroundColor(colors[position]); v.setOnClickListener(v1 -> { if (mOnColorSelectedListener != null) { mOnColorSelectedListener.onColorSelected(colors[position]); } dismiss(); }); GridView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, (int) (ScreenUtils.getScreenWidth() / 5f)); v.setLayoutParams(lp); return v; } }); return gv; } @Override protected void initViews(Context context) { } /** * 颜色选择 */ public interface OnColorSelectedListener { /** * 颜色选择 * * @param color */ void onColorSelected(int color); } }
924425ad11464539a468ab31570856da11198872
2,656
java
Java
springboot/src/main/java/curso/springboot/security/WebConfigSecurity.java
ramirovictor/Spring-Boot-MVC-Thymeleaf-JPA-banco-PostgreSQL
100721db78e6139cb13205a7cdeaa7ffab8177ad
[ "MIT" ]
null
null
null
springboot/src/main/java/curso/springboot/security/WebConfigSecurity.java
ramirovictor/Spring-Boot-MVC-Thymeleaf-JPA-banco-PostgreSQL
100721db78e6139cb13205a7cdeaa7ffab8177ad
[ "MIT" ]
null
null
null
springboot/src/main/java/curso/springboot/security/WebConfigSecurity.java
ramirovictor/Spring-Boot-MVC-Thymeleaf-JPA-banco-PostgreSQL
100721db78e6139cb13205a7cdeaa7ffab8177ad
[ "MIT" ]
null
null
null
42.83871
108
0.783886
1,002,902
package curso.springboot.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class WebConfigSecurity extends WebSecurityConfigurerAdapter{ @Autowired private ImplementacaoUserDetailsService implementacaoUserDetailsService; @Override // Configura as solicitações de acesso por Http protected void configure(HttpSecurity http) throws Exception { http.csrf() .disable() // Desativa as configurações padrão de memória. .authorizeRequests() // Pertimir restringir acessos .antMatchers(HttpMethod.GET, "/").permitAll() // Qualquer usuário acessa a pagina inicial .antMatchers(HttpMethod.GET, "/cadastropessoa").hasAnyRole("ADMIN") .anyRequest().authenticated() .and().formLogin().permitAll() // permite qualquer usuário .loginPage("/login") .defaultSuccessUrl("/cadastropessoa") .failureUrl("/login?error=true") .and() .logout().logoutSuccessUrl("/login") // Mapeia URL de Logout e invalida usuário autenticado .logoutRequestMatcher(new AntPathRequestMatcher("/logout")); } @Override // Cria autenticação do usuário com banco de dados ou em memória protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(implementacaoUserDetailsService) .passwordEncoder(new BCryptPasswordEncoder()); // auth.inMemoryAuthentication().passwordEncoder(new BCryptPasswordEncoder()) // .withUser("alex") // .password("$2a$10$.pXzrV8oqC8zI6FNiD8yXudaDONhzAXE44/pMvdstRdlqR0kwLjLK") // .roles("ADMIN"); } @Override // Ignora URL especificas public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/materialize/**"); } }
924425c6954fe483c3a94a6205e3950a22dc26f4
236
java
Java
core/src/main/java/com/ctrip/xpipe/api/utils/FileSize.java
yanghongkjxy/x-pipe
10c1977e62c7237b69e21569a969174510441fee
[ "Apache-2.0" ]
1,652
2016-04-18T10:34:30.000Z
2022-03-30T06:15:35.000Z
core/src/main/java/com/ctrip/xpipe/api/utils/FileSize.java
yanghongkjxy/x-pipe
10c1977e62c7237b69e21569a969174510441fee
[ "Apache-2.0" ]
342
2016-07-27T10:38:01.000Z
2022-03-31T11:11:46.000Z
core/src/main/java/com/ctrip/xpipe/api/utils/FileSize.java
yanghongkjxy/x-pipe
10c1977e62c7237b69e21569a969174510441fee
[ "Apache-2.0" ]
492
2016-04-25T05:14:10.000Z
2022-03-16T01:40:38.000Z
14.75
46
0.724576
1,002,903
package com.ctrip.xpipe.api.utils; import java.util.function.LongSupplier; /** * control the size returned * @author wenchao.meng * * Jan 5, 2017 */ public interface FileSize { long getSize(LongSupplier realSizeProvider) ; }
9244279f33debc58e82ebdea380474d2f7ee9a55
709
java
Java
src/main/java/de/castcrafter/travel_anchors/block/ContainerTravelAnchor.java
MoeHunt3r/travel_anchors
a948164770650928298d20af1d30e07a5c3e216e
[ "Apache-2.0" ]
null
null
null
src/main/java/de/castcrafter/travel_anchors/block/ContainerTravelAnchor.java
MoeHunt3r/travel_anchors
a948164770650928298d20af1d30e07a5c3e216e
[ "Apache-2.0" ]
null
null
null
src/main/java/de/castcrafter/travel_anchors/block/ContainerTravelAnchor.java
MoeHunt3r/travel_anchors
a948164770650928298d20af1d30e07a5c3e216e
[ "Apache-2.0" ]
null
null
null
41.705882
127
0.809591
1,002,904
package de.castcrafter.travel_anchors.block; import de.castcrafter.travel_anchors.base.ContainerBase; import de.castcrafter.travel_anchors.setup.Registration; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerTravelAnchor extends ContainerBase<TileTravelAnchor> { public ContainerTravelAnchor(int window, World world, BlockPos pos, PlayerInventory playerInventory, PlayerEntity player) { super(Registration.TRAVEL_ANCHOR_CONTAINER.get(), window, world, pos, playerInventory, player, 0, 0); this.layoutPlayerInventorySlots(8, 51); } }
924428b1fbf9e82ffa154464dd936afe509fa1f9
2,862
java
Java
jpasskit/src/main/java/de/brendamour/jpasskit/semantics/PKPersonNameComponentsBuilder.java
joostbaas/jpasskit
4d241c03204a7b61a1375b30505c84f70940247c
[ "Apache-2.0" ]
175
2015-06-15T02:37:22.000Z
2022-03-21T13:40:29.000Z
jpasskit/src/main/java/de/brendamour/jpasskit/semantics/PKPersonNameComponentsBuilder.java
joostbaas/jpasskit
4d241c03204a7b61a1375b30505c84f70940247c
[ "Apache-2.0" ]
232
2015-07-13T12:26:49.000Z
2022-03-21T20:12:24.000Z
jpasskit/src/main/java/de/brendamour/jpasskit/semantics/PKPersonNameComponentsBuilder.java
joostbaas/jpasskit
4d241c03204a7b61a1375b30505c84f70940247c
[ "Apache-2.0" ]
84
2015-06-22T18:23:09.000Z
2022-03-21T13:40:22.000Z
29.255102
112
0.712592
1,002,905
/* * Copyright (C) 2021 Patrice Brend'amour <[email protected]> * * 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 de.brendamour.jpasskit.semantics; import java.util.Collections; import java.util.List; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import de.brendamour.jpasskit.IPKBuilder; import de.brendamour.jpasskit.IPKValidateable; /** * Allows constructing and validating {@link PKPersonNameComponents} entities. * * @author Patrice Brend'amour */ @JsonPOJOBuilder(withPrefix = "") public class PKPersonNameComponentsBuilder implements IPKValidateable, IPKBuilder<PKPersonNameComponents> { private PKPersonNameComponents seat; protected PKPersonNameComponentsBuilder() { this.seat = new PKPersonNameComponents(); } @Override public PKPersonNameComponentsBuilder of(final PKPersonNameComponents source) { if (source != null) { this.seat = source.clone(); } return this; } public PKPersonNameComponentsBuilder familyName(String familyName) { this.seat.familyName = familyName; return this; } public PKPersonNameComponentsBuilder givenName(String givenName) { this.seat.givenName = givenName; return this; } public PKPersonNameComponentsBuilder middleName(String middleName) { this.seat.middleName = middleName; return this; } public PKPersonNameComponentsBuilder namePrefix(String namePrefix) { this.seat.namePrefix = namePrefix; return this; } public PKPersonNameComponentsBuilder nameSuffix(String nameSuffix) { this.seat.nameSuffix = nameSuffix; return this; } public PKPersonNameComponentsBuilder nickname(String nickname) { this.seat.nickname = nickname; return this; } public PKPersonNameComponentsBuilder phoneticRepresentation(PKPersonNameComponents phoneticRepresentation) { this.seat.phoneticRepresentation = phoneticRepresentation; return this; } @Override public boolean isValid() { return getValidationErrors().isEmpty(); } @Override public List<String> getValidationErrors() { return Collections.emptyList(); } @Override public PKPersonNameComponents build() { return this.seat; } }
92442996633ed803cec85c56d25a9b9ec31d5cba
2,832
java
Java
src/main/java/io/hgraphdb/mutators/EdgeIndexRemover.java
sleep-NULL/hgraphdb
4d98e952b2d721e8dcf8e6ce8ed93cc4b66b8bc7
[ "Apache-2.0" ]
247
2016-11-10T14:40:31.000Z
2022-03-29T04:06:21.000Z
src/main/java/io/hgraphdb/mutators/EdgeIndexRemover.java
sleep-NULL/hgraphdb
4d98e952b2d721e8dcf8e6ce8ed93cc4b66b8bc7
[ "Apache-2.0" ]
136
2016-11-11T14:32:16.000Z
2022-03-21T20:04:46.000Z
src/main/java/io/hgraphdb/mutators/EdgeIndexRemover.java
fredsadaghiani/hgraphdb
528c4ea4451b2f1fa1b64810142aa99c450a4e2a
[ "Apache-2.0" ]
67
2016-11-22T18:21:39.000Z
2022-02-18T10:27:07.000Z
39.887324
127
0.668785
1,002,906
package io.hgraphdb.mutators; import com.google.common.collect.ImmutableMap; import io.hgraphdb.Constants; import io.hgraphdb.HBaseEdge; import io.hgraphdb.HBaseGraph; import io.hgraphdb.IndexMetadata; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Mutation; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import java.util.Iterator; import java.util.Map; import java.util.stream.Stream; public class EdgeIndexRemover implements Mutator { private final HBaseGraph graph; private final Edge edge; private final Map<String, Boolean> keys; private final Long ts; public EdgeIndexRemover(HBaseGraph graph, Edge edge, String key, Long ts) { this.graph = graph; this.edge = edge; this.keys = ImmutableMap.of(key, false); this.ts = ts; } public EdgeIndexRemover(HBaseGraph graph, Edge edge, Iterator<IndexMetadata> indices, Long ts) { this.graph = graph; this.edge = edge; this.keys = IteratorUtils.collectMap(IteratorUtils.filter(indices, i -> i.label().equals(edge.label())), IndexMetadata::propertyKey, IndexMetadata::isUnique); this.ts = ts; } @Override public Iterator<Mutation> constructMutations() { return keys.entrySet().stream() .filter(entry -> entry.getKey().equals(Constants.CREATED_AT) || ((HBaseEdge) edge).hasProperty(entry.getKey())) .flatMap(entry -> { Mutation in = constructDelete(Direction.IN, entry); Mutation out = constructDelete(Direction.OUT, entry); return Stream.of(in, out); }).iterator(); } private Delete constructDelete(Direction direction, Map.Entry<String, Boolean> entry) { boolean isUnique = entry.getValue(); Delete delete = new Delete(graph.getEdgeIndexModel().serializeForWrite(edge, direction, isUnique, entry.getKey())); if (ts != null) { delete.addColumn(Constants.DEFAULT_FAMILY_BYTES, Constants.CREATED_AT_BYTES, ts); } else { delete.addColumns(Constants.DEFAULT_FAMILY_BYTES, Constants.CREATED_AT_BYTES); } if (isUnique) { if (ts != null) { delete.addColumn(Constants.DEFAULT_FAMILY_BYTES, Constants.VERTEX_ID_BYTES, ts); delete.addColumn(Constants.DEFAULT_FAMILY_BYTES, Constants.EDGE_ID_BYTES, ts); } else { delete.addColumns(Constants.DEFAULT_FAMILY_BYTES, Constants.VERTEX_ID_BYTES); delete.addColumns(Constants.DEFAULT_FAMILY_BYTES, Constants.EDGE_ID_BYTES); } } return delete; } }
924429d8bfdbeec15705dd4a42dcd2b354008af7
726
java
Java
src/main/java/br/com/zup/ecommerce/product/uploadimages/FakeUploadImageService.java
almiracioly/orange-talents-01-template-ecommerce
9410a668750f52728c358ea378de5eafda4ec63b
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zup/ecommerce/product/uploadimages/FakeUploadImageService.java
almiracioly/orange-talents-01-template-ecommerce
9410a668750f52728c358ea378de5eafda4ec63b
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zup/ecommerce/product/uploadimages/FakeUploadImageService.java
almiracioly/orange-talents-01-template-ecommerce
9410a668750f52728c358ea378de5eafda4ec63b
[ "Apache-2.0" ]
null
null
null
30.25
86
0.692837
1,002,907
package br.com.zup.ecommerce.product.uploadimages; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.util.Date; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @Service @Primary public class FakeUploadImageService implements UploadImageService { @Override public Set<String> store(List<MultipartFile> images) { return images .stream() .map(image-> "http://imgbucket.io/" .concat(image.getOriginalFilename() .concat("-" + new Date().getTime()))).collect(Collectors.toSet()); } }
92442a35549ab59fb896eee9c4726157f0bfabf5
4,266
java
Java
quickblur/src/main/java/com/fendoudebb/util/QuickBlur.java
fendoudebb/QuickBlur
f9926596a713d2686b2538e4e36d521d2455f52b
[ "Apache-2.0" ]
1
2020-07-23T12:57:50.000Z
2020-07-23T12:57:50.000Z
quickblur/src/main/java/com/fendoudebb/util/QuickBlur.java
fendoudebb/QuickBlur
f9926596a713d2686b2538e4e36d521d2455f52b
[ "Apache-2.0" ]
null
null
null
quickblur/src/main/java/com/fendoudebb/util/QuickBlur.java
fendoudebb/QuickBlur
f9926596a713d2686b2538e4e36d521d2455f52b
[ "Apache-2.0" ]
null
null
null
27.701299
85
0.578528
1,002,908
package com.fendoudebb.util; import android.content.Context; import android.graphics.Bitmap; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.ScriptIntrinsicBlur; import android.renderscript.Type; import android.util.Log; /** * zbj on 2017-07-26 18:10. */ public class QuickBlur { private static final String TAG = "QuickBlur"; private static final float SCALE = 1 / 8.0F;//default scale private static final int RADIUS = 5;//default radius private int mRadius = RADIUS; private float mScale = SCALE; private Bitmap mBitmap; private Context mContext; private volatile static QuickBlur singleton = null; public static QuickBlur with(Context context) { if (singleton == null) { synchronized (QuickBlur.class) { if (singleton == null) { singleton = new QuickBlur(context); } } } return singleton; } private QuickBlur(Context context) { mContext = context.getApplicationContext(); } /** * 链式编程 * * @param bitmap 需要被模糊的bitmap * @return Builder构建模式 */ public Builder bitmap(Bitmap bitmap) { if (bitmap != null) { return new Builder(bitmap); } return null; } public class Builder { Builder(Bitmap bitmap) { mBitmap = bitmap; } /** * 指定模糊前缩小的倍数,默认为8,即1/8的缩放 * * @param scale 缩放的系数 * @return Builder构建模式 */ public Builder scale(int scale) { mScale = 1.0f / scale; return this; } /** * 模糊半径,默认为5 * * @param radius radius值域: (0,25] * @return Builder构建模式 */ public Builder radius(int radius) { mRadius = radius; return this; } public Bitmap blur() { if (mBitmap == null) { throw new RuntimeException("Bitmap can not be null"); } if (mRadius == 0 || mRadius > 25) { throw new RuntimeException("radius must between 0 < r <= 25 "); } return rsBlur(mContext, mBitmap, mRadius, mScale); } } /** * 使用RenderScript 模糊图片 * * @param context 上下文 * @param source 传入的需要被模糊的原图片 * @return 模糊完成后的bitmap */ private Bitmap rsBlur(Context context, Bitmap source, int radius, float scale) { Log.d(TAG, "origin size:" + source.getWidth() + "*" + source.getHeight()); // 计算图片缩小后的长宽 int width = Math.round(source.getWidth() * scale); int height = Math.round(source.getHeight() * scale); if (width <= 0 || height <= 0) { Log.d(TAG, "rsBlur: width and height must be > 0"); return source; } // 将缩小后的图片做为预渲染的图片。 //java.lang.IllegalArgumentException: width and height must be > 0 Bitmap inputBmp = Bitmap.createScaledBitmap(source, width, height, false); // 创建RenderScript内核对象 RenderScript rs = RenderScript.create(context); Log.d(TAG, "scale size:" + inputBmp.getWidth() + "*" + inputBmp.getHeight()); // 创建一个模糊效果的RenderScript的工具对象 Element e = Element.U8_4(rs); ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, e); // 由于RenderScript并没有使用VM来分配内存,所以需要使用Allocation类来创建和分配内存空间。 // 创建Allocation对象的时候其实内存是空的,需要使用copyTo()将数据填充进去。 final Allocation input = Allocation.createFromBitmap(rs, inputBmp); Type type = input.getType(); final Allocation output = Allocation.createTyped(rs, type); // 设置blurScript对象的输入内存 blurScript.setInput(input); // 设置渲染的模糊程度, 25f是最大模糊度 blurScript.setRadius(radius); // 将输出数据保存到输出内存中 blurScript.forEach(output); // 将数据填充到Allocation中 output.copyTo(inputBmp); //Destroy everything to free memory // e.destroy(); input.destroy(); output.destroy(); blurScript.destroy(); // type.destroy(); rs.destroy(); return inputBmp; } }
92442a82f6042554009e8bde9fcbdd0ab2319b18
4,047
java
Java
LoginPage.java
bharayou/PatientRecordManagement
dd8cd0b14b36019c3041a25921327098f14d46ca
[ "MIT" ]
null
null
null
LoginPage.java
bharayou/PatientRecordManagement
dd8cd0b14b36019c3041a25921327098f14d46ca
[ "MIT" ]
null
null
null
LoginPage.java
bharayou/PatientRecordManagement
dd8cd0b14b36019c3041a25921327098f14d46ca
[ "MIT" ]
null
null
null
29.326087
83
0.668149
1,002,909
import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPasswordField; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JTextField; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Font; @SuppressWarnings("serial") public class LoginPage extends JFrame { private JPasswordField passwordField; private JTextField userField; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { LoginPage frame = new LoginPage(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public LoginPage() { setResizable(false); setTitle("Login Page"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(50, 50, 1800, 900); getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("Patients Record Management"); lblNewLabel.setFont(new Font("Berlin Sans FB", Font.PLAIN, 50)); lblNewLabel.setBounds(945, 156, 682, 69); getContentPane().add(lblNewLabel); JLabel Username = new JLabel("Username:"); Username.setFont(new Font("Berlin Sans FB", Font.PLAIN, 24)); Username.setBounds(1049, 272, 115, 26); getContentPane().add(Username); userField = new JTextField(); userField.setFont(new Font("Calibri", Font.PLAIN, 24)); userField.setBounds(1176, 270, 322, 36); getContentPane().add(userField); userField.setColumns(10); JLabel Password = new JLabel("Password:"); Password.setFont(new Font("Berlin Sans FB", Font.PLAIN, 24)); Password.setBounds(1049, 327, 115, 26); getContentPane().add(Password); passwordField = new JPasswordField(); passwordField.setFont(new Font("Calibri", Font.PLAIN, 24)); passwordField.setBounds(1176, 325, 322, 36); getContentPane().add(passwordField); JButton btnLogIn = new JButton("Log In"); btnLogIn.setFont(new Font("Calibri", Font.PLAIN, 24)); btnLogIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String user=userField.getText(); @SuppressWarnings("deprecation") String pass=passwordField.getText(); StaffDetails result=JdbcConnectionCalls.loginJdbcRun(user, pass); if(result==null) { JOptionPane.showMessageDialog(null, "Invalid USername or Password"); } else if(result.getRoleId()==3) { AdminPage admin= new AdminPage(result.getFirstName(), result.getId()); admin.run(); setVisible(false); } else if(result.getRoleId()==1) { DoctorPage doctor=new DoctorPage(result.getFirstName(), result.getId()); doctor.run(); setVisible(false); } else if(result.getRoleId()==2) { StaffPage staff=new StaffPage(result.getFirstName(), result.getId()); staff.run(); setVisible(false); } else { JOptionPane.showMessageDialog(null, "Invalid USername or Password"); } } }); btnLogIn.setBounds(1244, 396, 163, 36); getContentPane().add(btnLogIn); JLabel lblNewUser = new JLabel("New User? "); lblNewUser.setFont(new Font("Berlin Sans FB", Font.PLAIN, 24)); lblNewUser.setBounds(1063, 501, 124, 26); getContentPane().add(lblNewUser); JButton btnRegister = new JButton("Register"); btnRegister.setFont(new Font("Calibri", Font.PLAIN, 24)); btnRegister.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { AdminAccess admin=new AdminAccess(); admin.run(); } }); btnRegister.setBounds(1232, 491, 188, 36); getContentPane().add(btnRegister); JLabel lblImage = new JLabel(""); lblImage.setIcon(new ImageIcon("C:/Users/Its'Me/Desktop/Image/loginPage.jpeg")); lblImage.setBounds(0, 0, 1800, 900); getContentPane().add(lblImage); } }
92442ad29d1aaaab61d9d74ac053bea7eb7ca2f4
2,477
java
Java
starcollector/src/probono/model/UserWordDAO.java
Dowonna/Star-Collector
9d940e1e1b30794339874d1f4ca4771d1076f563
[ "MIT" ]
1
2021-01-02T05:54:14.000Z
2021-01-02T05:54:14.000Z
starcollector/src/probono/model/UserWordDAO.java
Dowonna/Star-Collector
9d940e1e1b30794339874d1f4ca4771d1076f563
[ "MIT" ]
null
null
null
starcollector/src/probono/model/UserWordDAO.java
Dowonna/Star-Collector
9d940e1e1b30794339874d1f4ca4771d1076f563
[ "MIT" ]
null
null
null
23.817308
99
0.679451
1,002,910
/* * CREATE TABLE probono ( probono_id VARCHAR2(50) PRIMARY KEY, probono_name VARCHAR2(50) NOT NULL, probono_purpose VARCHAR2(200) NOT NULL ); */ package probono.model; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import probono.model.util.DBUtil; public class UserWordDAO { //저장 public static boolean saveUserWord(String id, String word) throws SQLException{ Connection con = null; PreparedStatement pstmt = null; try{ con = DBUtil.getConnection(); pstmt = con.prepareStatement("insert into userword values(?,?)"); pstmt.setString(1, id); pstmt.setString(2, word); int result = pstmt.executeUpdate(); if(result == 1){ return true; } }finally{ DBUtil.close(con, pstmt); } return false; } //수정 //프로보노 id로 프로보노 목적 수정하기 public static boolean updateUserWord(String probonoId, String probonoPurpose) throws SQLException{ Connection con = null; PreparedStatement pstmt = null; try{ con = DBUtil.getConnection(); pstmt = con.prepareStatement("update probono set probono_purpose=? where probono_id=?"); pstmt.setString(1, probonoPurpose); pstmt.setString(2, probonoId); int result = pstmt.executeUpdate(); if(result == 1){ return true; } }finally{ DBUtil.close(con, pstmt); } return false; } //삭제 public static boolean deleteUserWord(String id, String word) throws SQLException{ Connection con = null; PreparedStatement pstmt = null; try{ con = DBUtil.getConnection(); pstmt = con.prepareStatement("delete from userword where userId=? and word=?"); pstmt.setString(1, id); pstmt.setString(2, word); int result = pstmt.executeUpdate(); if(result == 1){ return true; } }finally{ DBUtil.close(con, pstmt); } return false; } //해당 유저가 저장한 단어 검색 public static ArrayList<String> getUserWords(String userId) throws SQLException{ Connection con = null; PreparedStatement pstmt = null; ResultSet rset = null; ArrayList<String> list = null; try{ con = DBUtil.getConnection(); pstmt = con.prepareStatement("select * from userword where userid=?"); pstmt.setString(1, userId); rset = pstmt.executeQuery(); list = new ArrayList<String>(); while(rset.next()){ list.add(rset.getString(2)); } }finally{ DBUtil.close(con, pstmt, rset); } return list; } }
92442b6fa1d2de1cd126dd53a863fee8fb31e8c1
301
java
Java
app/src/main/java/com/moldedbits/android/ExampleAppActivity.java
bennythejudge/android-jumpstart
18669a428fca13c8ac3c66b94d3e37a495c9b8a5
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/moldedbits/android/ExampleAppActivity.java
bennythejudge/android-jumpstart
18669a428fca13c8ac3c66b94d3e37a495c9b8a5
[ "Apache-2.0" ]
1
2018-10-13T20:58:30.000Z
2018-10-13T20:58:30.000Z
app/src/main/java/com/moldedbits/android/ExampleAppActivity.java
bennythejudge/android-jumpstart
18669a428fca13c8ac3c66b94d3e37a495c9b8a5
[ "Apache-2.0" ]
null
null
null
21.5
60
0.754153
1,002,911
package com.moldedbits.android; import android.os.Bundle; public class ExampleAppActivity extends BaseDrawerActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_example_app); } }
92442bd3530d0677d2788c32fb0b0b7b6610210f
8,371
java
Java
src/com/dyllongagnier/cs4150/timing/CodeTimer.java
slaymaker1907/jsmart-timing
94e4e862384064c2c41257ce7db83edf3c36b5d9
[ "MIT" ]
null
null
null
src/com/dyllongagnier/cs4150/timing/CodeTimer.java
slaymaker1907/jsmart-timing
94e4e862384064c2c41257ce7db83edf3c36b5d9
[ "MIT" ]
null
null
null
src/com/dyllongagnier/cs4150/timing/CodeTimer.java
slaymaker1907/jsmart-timing
94e4e862384064c2c41257ce7db83edf3c36b5d9
[ "MIT" ]
null
null
null
30.111511
132
0.695377
1,002,912
package com.dyllongagnier.cs4150.timing; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; import java.time.Duration; import java.util.ArrayList; import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.math3.distribution.TDistribution; import org.apache.commons.math3.stat.descriptive.SummaryStatistics; import org.apache.commons.math3.stat.inference.TTest; /** * This class provides a way to time code in a meaningful way by accounting for as many confounding * variables as possible such as the garbage collector, the just in time compiler, and other * random noise. * * To use this class, first implement the JunkCode interface (this allows setup to be called before * each timing sample is taken and has a getJunk method that is used to prevent almost useless * loops from being compiled away). * * Once the JunkCode interface is implemented, call warmup which will run the input code many, many * times to allow the code being timed to be compiled by the JIT (the code that is warmed up need not * be the same object as the one to eventually be timed, but it should be of the same class; this * allows for JITing the code with small data so that warmup is fast). * * Finally, call timeCode with whatever code you want to have timed. This class tries to ensure * that the time returned is statistically significant to a limited degree. * * Many of the methods in this class are made protected with the intention that this class may * be customized to suit a wide variety of timing needs. * * @author Dyllon Gagnier * */ public class CodeTimer extends JunkHash { /** * The class used to loop things many times. */ private TimingLoop loop = new TimingLoop(); /** * This returns the loop used to loop things many times. * @return The loop used to loop things many times. */ protected TimingLoop getLoop() { return loop; } /** * This method returns the number of times garbage collection has occured. Garbage collection is usually parallel, * so for precision, -XX:+UseSerialGC should be used to make sure stop the world happens. * @return The number of times GC occured. */ protected int numberOfCollections() { int result = 0; for(GarbageCollectorMXBean collector : ManagementFactory.getGarbageCollectorMXBeans()) { result += collector.getCollectionCount(); } return result; } /** * Runs the input function and returns true if garbage collection occured * while running the input function. * @param toRun The function to run. * @return True if GC occured. */ protected boolean detectGarbageCollection(Runnable toRun) { int collCount = numberOfCollections(); toRun.run(); return numberOfCollections() != collCount; } /** * This method runs a particular function until the time passed running the function * exceeds the input time. * @param toRun The function to repeat. * @param timeToRun The time to run the function for. * @return The results of timing the code. */ private TimedIterations runForTime(Runnable toRun, Duration timeToRun) { Duration timeRun = Duration.ofNanos(0); int itersToRun = 1; while(timeRun.compareTo(timeToRun) < 0) { itersToRun *= 2; timeRun = this.getLoop().forLoop(toRun, itersToRun); } return new TimedIterations(timeRun, itersToRun); } /** * This method runs setup of the junk code once and then runs * the main code the input times and ensures that the code in the main * part of toRun is compiled. * @param toRun The code to compile. * @param iterations The number of times to run the code. */ public void warmup(JunkCode toRun, int iterations) { toRun.setup(); this.getLoop().forLoop(toRun, iterations); this.changeHash(toRun.getJunkState()); } /** * This is identical to the warmup code taking an int except that it * runs the code 50,000 times. * @param toRun The code to run. */ public void warmup(JunkCode toRun) { this.warmup(toRun, 50_000); } /** * Returns the minimum timing sample size (to ensure that accuracy of the clock doesn't * contaminate measurements). * @return The minimum time to run. */ protected Duration getTimeToRun() { return Duration.ofSeconds(2); } /** * Runs code for a minimal amount of time and makes sure that garbage collection does not * occur when running the code and then returns the time to run the input code once. * * @param toTime The code to time. * @return The time to run the code. */ private Duration getTimingSample(JunkCode toTime) { MutableObject<TimedIterations> actualTime = new MutableObject<>(); Runnable garbageRun = () -> { actualTime.setValue(this.runForTime(toTime, this.getTimeToRun())); }; toTime.setup(); while(this.detectGarbageCollection(garbageRun)) { toTime.setup(); this.changeHash(toTime.getJunkState()); } return actualTime.getValue().getTimePerIteration(); } /** * Times the input code and returns the time to run it. * @param toTime The code to time. * @return The time to run code. */ public Duration timeCode(JunkCode toTime) { ArrayList<Duration> sampleSet = new ArrayList<>(); while(!this.isSignificant(sampleSet)) sampleSet.add(this.getTimingSample(toTime)); return this.getAverageDuration(sampleSet); } /** * Returns the average duration in an iterable of durations. * @param durations The input durations to measure. * @return The average duration of of the input durations. */ protected Duration getAverageDuration(Iterable<Duration> durations) { Duration sum = Duration.ZERO; int count = 0; for(Duration duration : durations) { sum = sum.plus(duration); count++; } return sum.dividedBy(count); } /** * Returns true if the input values are statistically significant. * @param values The values to determine if significant. * @return True if durations are statistically significant. */ protected boolean isSignificant(ArrayList<Duration> values) { SummaryStatistics sample = this.toStats(values); if (sample.getN() < 10) return false; double critVal = this.getCritValue(sample); return critVal < this.getMeanDelta() * sample.getMean(); } /** * Gets how close the measured average must be to the real mean time. * @return */ protected double getMeanDelta() { return 0.01; } /** * Returns the critical value in reference to statistical significance for the input * data sample. * @param sample The data to determine the critical value of. * @return The critical value of the input. */ protected double getCritValue(SummaryStatistics sample) { TDistribution distro = new TDistribution(sample.getN() - 1); return distro.inverseCumulativeProbability(1.0 - this.getAlpha() / 2) * sample.getStandardDeviation() / Math.sqrt(sample.getN()); } /** * Gets the T test to use for this class. * @return The T test for this class. */ protected TTest getTTest() { return new TTest(); } /** * Computes the average of an array of doubles. * @param values The data. * @return The average of the data. */ protected double computeAverage(double[] values) { double sum = 0; for(double value : values) sum += value; return sum / values.length; } /** * Finds the statistics for Apache from an iterable of durations. * @param values The values to take the statistics from. * @return Statistics about the input values. */ private SummaryStatistics toStats(Iterable<Duration> values) { SummaryStatistics result = new SummaryStatistics(); for(Duration value : values) result.addValue(this.durationToDouble(value)); return result; } /** * Converts a duration to a double * @param value The value to get the duration of. * @return The nanoseconds of the duration. */ protected double durationToDouble(Duration value) { return value.toNanos(); } /** * Gets the alpha value for statistical significance. * @return The alpha of significance. */ protected double getAlpha() { return 0.05; } }
92442c671bb23ec020b94f1f1f38ccb40db8f4da
358
java
Java
app/src/main/java/cn/ycbjie/ycaudioplayer/ui/advert/model/api/AdvertApi.java
taledog/YCAudioPlayer
f2cb3d7df5aa435bf23e3fea91a05e0c94f86df2
[ "Apache-2.0" ]
337
2018-01-18T09:00:22.000Z
2022-03-27T13:15:55.000Z
app/src/main/java/cn/ycbjie/ycaudioplayer/ui/advert/model/api/AdvertApi.java
maiduoduo/YCAudioPlayer
f2cb3d7df5aa435bf23e3fea91a05e0c94f86df2
[ "Apache-2.0" ]
14
2018-02-09T05:54:49.000Z
2020-02-28T03:12:07.000Z
app/src/main/java/cn/ycbjie/ycaudioplayer/ui/advert/model/api/AdvertApi.java
maiduoduo/YCAudioPlayer
f2cb3d7df5aa435bf23e3fea91a05e0c94f86df2
[ "Apache-2.0" ]
100
2018-02-02T05:32:45.000Z
2022-03-10T10:49:17.000Z
21.058824
69
0.782123
1,002,913
package cn.ycbjie.ycaudioplayer.ui.advert.model.api; import cn.ycbjie.ycaudioplayer.ui.advert.model.bean.AdvertCommon; import io.reactivex.Observable; import retrofit2.http.GET; import retrofit2.http.Query; public interface AdvertApi { @GET("fundworks/media/getFlashScreen") Observable<AdvertCommon> getSplashImage(@Query("type") int type); }
92442d14bbe9219e76555f7894293e46577f60f7
2,554
java
Java
metastore/src/java/org/apache/hadoop/hive/metastore/filemeta/OrcFileMetadataHandler.java
manbuyun/hive
cdb1052e24ca493c6486fef3dd8956dde61be834
[ "Apache-2.0" ]
4,140
2015-01-07T11:57:35.000Z
2022-03-31T06:26:22.000Z
metastore/src/java/org/apache/hadoop/hive/metastore/filemeta/OrcFileMetadataHandler.java
manbuyun/hive
cdb1052e24ca493c6486fef3dd8956dde61be834
[ "Apache-2.0" ]
1,779
2015-05-27T04:32:42.000Z
2022-03-31T18:53:19.000Z
metastore/src/java/org/apache/hadoop/hive/metastore/filemeta/OrcFileMetadataHandler.java
manbuyun/hive
cdb1052e24ca493c6486fef3dd8956dde61be834
[ "Apache-2.0" ]
3,958
2015-01-01T15:14:49.000Z
2022-03-30T21:08:32.000Z
38.119403
94
0.712999
1,002,914
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hive.metastore.filemeta; import java.io.IOException; import java.nio.ByteBuffer; import java.util.List; import org.apache.hadoop.hive.metastore.FileMetadataHandler; import org.apache.hadoop.hive.metastore.Metastore.SplitInfos; import org.apache.hadoop.hive.metastore.api.FileMetadataExprType; import org.apache.hadoop.hive.ql.io.sarg.SearchArgument; public class OrcFileMetadataHandler extends FileMetadataHandler { @Override protected FileMetadataExprType getType() { return FileMetadataExprType.ORC_SARG; } @Override public void getFileMetadataByExpr(List<Long> fileIds, byte[] expr, ByteBuffer[] metadatas, ByteBuffer[] results, boolean[] eliminated) throws IOException { SearchArgument sarg = getExpressionProxy().createSarg(expr); // For now, don't push anything into HBase, nor store anything special in HBase if (metadatas == null) { // null means don't return metadata; we'd need the array anyway for now. metadatas = new ByteBuffer[results.length]; } getStore().getFileMetadata(fileIds, metadatas); for (int i = 0; i < metadatas.length; ++i) { eliminated[i] = false; results[i] = null; if (metadatas[i] == null) continue; ByteBuffer metadata = metadatas[i].duplicate(); // Duplicate to avoid modification. SplitInfos result = null; try { result = getFileFormatProxy().applySargToMetadata(sarg, metadata, conf); } catch (IOException ex) { LOG.error("Failed to apply SARG to metadata", ex); metadatas[i] = null; continue; } eliminated[i] = (result == null); if (!eliminated[i]) { results[i] = ByteBuffer.wrap(result.toByteArray()); } } } }
92442ecb5a7b34ddb261511e1cdbb17cf2753e45
1,840
java
Java
src/battleship/Network/TCPServer.java
aytarozgur/Battleship-TCP-UDP
9a55b0aec04585546d0814c63905fe27a6fe3fea
[ "Apache-2.0" ]
2
2019-02-27T09:09:54.000Z
2020-09-17T11:56:21.000Z
src/battleship/Network/TCPServer.java
aytarozgur/Battleship-TCP-UDP
9a55b0aec04585546d0814c63905fe27a6fe3fea
[ "Apache-2.0" ]
null
null
null
src/battleship/Network/TCPServer.java
aytarozgur/Battleship-TCP-UDP
9a55b0aec04585546d0814c63905fe27a6fe3fea
[ "Apache-2.0" ]
null
null
null
26.666667
101
0.592935
1,002,915
package battleship.Network; import battleship.GUI.LobbyTCP; import javax.swing.*; import java.io.*; import java.net.*; public class TCPServer implements Runnable { public static int tcpServerPortNb = 4444; public static int responseWaitTime2 = 3000; public static String initCode = "Battleship"; public boolean running; public String gameName; public LobbyTCP lobbyPtr; String clientSentence; String capitalizedSentence; private Timer responseListenTimer; private ServerSocket socket2; private Thread thread; public TCPServer(LobbyTCP lobbyPtr, boolean broadcastServer2) { this.lobbyPtr = lobbyPtr; try { if (broadcastServer2) socket2 = new ServerSocket(tcpServerPortNb); else socket2 = new ServerSocket(); } catch (Exception e) { System.out.println(e.getMessage()); } } public void startServer(String gameName) { // start as broadcast listener if (running) return; running = true; this.gameName = gameName; start(); } public void stopServer() { running = false; } public void start() { if (thread == null) { thread = new Thread(this); thread.start(); } } @Override public void run() { try { while (running) { Socket connectionSocket = socket2.accept(); ObjectInputStream ois = new ObjectInputStream( connectionSocket.getInputStream()); ObjectOutputStream oos = new ObjectOutputStream( connectionSocket.getOutputStream()); } socket2.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } }
92442fce6d7858a60788380dd5a445021ba2351a
707
java
Java
Java/string2/DoubleChar.java
RCoon/CodingBat
c5004c03e668c62751dc7f13154c79e25ea34339
[ "MIT" ]
1
2015-11-06T02:26:50.000Z
2015-11-06T02:26:50.000Z
Java/string2/DoubleChar.java
RCoon/CodingBat
c5004c03e668c62751dc7f13154c79e25ea34339
[ "MIT" ]
null
null
null
Java/string2/DoubleChar.java
RCoon/CodingBat
c5004c03e668c62751dc7f13154c79e25ea34339
[ "MIT" ]
null
null
null
22.806452
73
0.62942
1,002,916
package string2; /* * Given a string, return a string where for every char in the original, * there are two chars. * * doubleChar("The") --> "TThhee" * doubleChar("AAbb") --> "AAAAbbbb" * doubleChar("Hi-There") --> "HHii--TThheerree" */ public class DoubleChar { public static void main(String[] args) { DoubleChar test = new DoubleChar(); System.out.println(test.doubleChar("The")); System.out.println(test.doubleChar("AAbb")); System.out.println(test.doubleChar("Hi-There")); } public String doubleChar(String str) { String result = ""; for (int i = 0; i < str.length(); i++) { result = result + str.charAt(i) + str.charAt(i); } return result; } }
92443062c30ff32136eb061d8a56dfef757312c1
1,184
java
Java
spring-data-fabric-chaincode/src/main/java/io/github/hooj0/springdata/fabric/chaincode/repository/query/SimpleChaincodeEntityMetadata.java
hooj0/spring-data-fabric-chaincode
54144d8c88d2f41ebf566600025a27bd4e3bc1df
[ "MIT" ]
10
2018-08-15T06:12:20.000Z
2021-03-16T13:07:09.000Z
spring-data-fabric-chaincode/src/main/java/io/github/hooj0/springdata/fabric/chaincode/repository/query/SimpleChaincodeEntityMetadata.java
hooj0/spring-data-fabric-chaincode
54144d8c88d2f41ebf566600025a27bd4e3bc1df
[ "MIT" ]
null
null
null
spring-data-fabric-chaincode/src/main/java/io/github/hooj0/springdata/fabric/chaincode/repository/query/SimpleChaincodeEntityMetadata.java
hooj0/spring-data-fabric-chaincode
54144d8c88d2f41ebf566600025a27bd4e3bc1df
[ "MIT" ]
2
2020-05-18T03:19:43.000Z
2020-11-24T01:54:11.000Z
28.804878
109
0.765453
1,002,917
package io.github.hooj0.springdata.fabric.chaincode.repository.query; import org.springframework.util.Assert; import io.github.hooj0.springdata.fabric.chaincode.core.mapping.ChaincodePersistentEntity; /** * Implementation of {@link ChaincodeEntityMetadata} based on the type and {@link ChaincodePersistentEntity}. * @author hoojo * @createDate 2018年7月18日 上午10:01:36 * @file SimpleChaincodeEntityMetadata.java * @package io.github.hooj0.springdata.fabric.chaincode.repository.query * @project spring-data-fabric-chaincode * @blog http://hoojo.cnblogs.com * @email [email protected] * @version 1.0 */ public class SimpleChaincodeEntityMetadata<T> implements ChaincodeEntityMetadata<T> { private final ChaincodePersistentEntity<?> entity; private final Class<T> type; SimpleChaincodeEntityMetadata(Class<T> type, ChaincodePersistentEntity<?> entity) { Assert.notNull(type, "Type must not be null"); Assert.notNull(entity, "Collection entity must not be null or empty"); this.type = type; this.entity = entity; } @Override public Class<T> getJavaType() { return type; } @Override public String getEntityName() { return this.entity.getName(); } }
92443117ba71f28d14735e0338e054d9d2fec36d
2,575
java
Java
src/main/java/org/tmatesoft/svn/core/internal/server/dav/handlers/SVNGitDeleteHandler.java
naver/SVNGit
6c14e2488af04bc90238dab55618a52bd4b7894e
[ "Apache-2.0" ]
22
2015-01-08T10:22:45.000Z
2020-07-07T11:51:46.000Z
src/main/java/org/tmatesoft/svn/core/internal/server/dav/handlers/SVNGitDeleteHandler.java
naver/SVNGit
6c14e2488af04bc90238dab55618a52bd4b7894e
[ "Apache-2.0" ]
2
2015-01-26T09:05:10.000Z
2015-02-06T03:56:44.000Z
src/main/java/org/tmatesoft/svn/core/internal/server/dav/handlers/SVNGitDeleteHandler.java
naver/SVNGit
6c14e2488af04bc90238dab55618a52bd4b7894e
[ "Apache-2.0" ]
5
2015-01-15T04:59:31.000Z
2020-07-03T08:24:29.000Z
38.432836
135
0.714563
1,002,918
package org.tmatesoft.svn.core.internal.server.dav.handlers; import com.navercorp.svngit.TreeBuilder; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.internal.io.fs.SVNGitRepositoryFactory; import org.tmatesoft.svn.core.internal.server.dav.DAVPathUtil; import org.tmatesoft.svn.core.internal.server.dav.DAVRepositoryManager; import org.tmatesoft.svn.core.internal.server.dav.DAVResource; import org.tmatesoft.svn.core.internal.server.dav.DAVResourceURI; import org.tmatesoft.svn.core.io.SVNRepository; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; // Copy of DAVDeleteHandler public class SVNGitDeleteHandler extends DAVDeleteHandler { public SVNGitDeleteHandler(DAVRepositoryManager repositoryManager, HttpServletRequest request, HttpServletResponse response) { super(repositoryManager, request, response); } public void execute() throws SVNException { String versionName = getRequestHeader(SVN_VERSION_NAME_HEADER); long version = DAVResource.INVALID_REVISION; try { version = Long.parseLong(versionName); } catch (NumberFormatException e) { } DAVRepositoryManager manager = getRepositoryManager(); // use latest version, if no version was specified SVNRepository resourceRepository = SVNGitRepositoryFactory.create(SVNURL.parseURIEncoded(manager.getResourceRepositoryRoot())); if ( version == -1 ) { version = resourceRepository.getLatestRevision(); } DAVResourceURI resourceURI = new DAVResourceURI(manager.getResourceContext(), manager.getResourcePathInfo(), null, false, version); TreeBuilder treeBuilder = SVNGitPropPatchHandler.treeBuilders.get(resourceURI.getActivityID()); if (treeBuilder == null) { sendError(HttpServletResponse.SC_NOT_FOUND, null); return; } // Get the path to delete String path = resourceURI.getPath(); if (path == null || path.isEmpty()) { // Delete the activity SVNGitPropPatchHandler.treeBuilders.remove(resourceURI.getActivityID()); setResponseStatus(HttpServletResponse.SC_NO_CONTENT); return; } path = DAVPathUtil.dropLeadingSlash(path); // TODO: Response 404 Not Found if not exists. // Delete the path treeBuilder.remove(path); setResponseStatus(HttpServletResponse.SC_NO_CONTENT); } }
924433cf65812a71f0c04793f5a405154e17ccc9
8,554
java
Java
liquid/src/test/java/com/lmpessoa/services/views/liquid/internal/LiquidDateFormatterTest.java
Lmpessoa/java-services
bdadc50056a709a7b5afdb880994dd2f69be12e2
[ "MIT" ]
null
null
null
liquid/src/test/java/com/lmpessoa/services/views/liquid/internal/LiquidDateFormatterTest.java
Lmpessoa/java-services
bdadc50056a709a7b5afdb880994dd2f69be12e2
[ "MIT" ]
null
null
null
liquid/src/test/java/com/lmpessoa/services/views/liquid/internal/LiquidDateFormatterTest.java
Lmpessoa/java-services
bdadc50056a709a7b5afdb880994dd2f69be12e2
[ "MIT" ]
null
null
null
26.984227
86
0.644611
1,002,919
/* * Copyright (c) 2018 Leonardo Pessoa * https://github.com/lmpessoa/java-services * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.lmpessoa.services.views.liquid.internal; import static org.junit.Assert.assertEquals; import java.time.LocalDate; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.Locale; import org.junit.Test; public class LiquidDateFormatterTest { private static final ZonedDateTime DATE = ZonedDateTime.of(2017, 6, 5, 5, 42, 7, 0, ZoneId.of("America/Sao_Paulo")); private static final LiquidDateFormatter FORMATTER = new LiquidDateFormatter( Locale.forLanguageTag("en-GB")); @Test public void testLiteralPercent() { String result = FORMATTER.format(DATE, "%%"); assertEquals("%", result); } @Test public void testShortWeekdayName() { String result = FORMATTER.format(DATE, "%a"); assertEquals("Mon", result); } @Test public void testFullWeekdayName() { String result = FORMATTER.format(DATE, "%A"); assertEquals("Monday", result); } @Test public void testShortMonthName_b() { String result = FORMATTER.format(DATE, "%b"); assertEquals("Jun", result); } @Test public void testShortMonthName_h() { String result = FORMATTER.format(DATE, "%h"); assertEquals("Jun", result); } @Test public void testFullMonthName() { String result = FORMATTER.format(DATE, "%B"); assertEquals("June", result); } @Test public void testDayOfTheMonthWithZeroes() { String result = FORMATTER.format(DATE, "%d"); assertEquals("05", result); } @Test public void testDayOfTheMonth() { String result = FORMATTER.format(DATE, "%e"); assertEquals(" 5", result); } @Test public void testHourWith24HoursAndZeroes() { String result = FORMATTER.format(DATE.plusHours(12), "%H"); assertEquals("17", result); } @Test public void testHourWith12HoursAndZeroes() { String result = FORMATTER.format(DATE.plusHours(12), "%I"); assertEquals("05", result); } @Test public void testDayOfTheYear() { String result = FORMATTER.format(DATE, "%j"); assertEquals("156", result); } @Test public void testHourWith24Hours() { String result = FORMATTER.format(DATE.plusHours(12), "%k"); assertEquals("17", result); } @Test public void testHourWith12Hours() { String result = FORMATTER.format(DATE.plusHours(12), "%l"); assertEquals(" 5", result); } @Test public void testMonthWithZeroes() { String result = FORMATTER.format(DATE, "%m"); assertEquals("06", result); } @Test public void testMinutesWithZeroes() { String result = FORMATTER.format(DATE, "%M"); assertEquals("42", result); } @Test public void testMeridianIndicator() { String result = FORMATTER.format(DATE, "%p"); assertEquals("AM", result); } @Test public void testSecondsWithZeroes() { String result = FORMATTER.format(DATE, "%S"); assertEquals("07", result); } @Test public void testWeekNumberStartingSunday() { String result = FORMATTER.format(DATE, "%U"); assertEquals("23", result); } @Test public void testWeekNumberStartingMonday() { String result = FORMATTER.format(DATE, "%W"); assertEquals("23", result); } @Test public void testWeekNumberStartingSunday_2() { String result = FORMATTER.format(LocalDate.of(2018, 8, 3), "%U"); assertEquals("30", result); } @Test public void testWeekNumberStartingMonday_2() { String result = FORMATTER.format(LocalDate.of(2018, 8, 3), "%W"); assertEquals("31", result); } @Test public void testWeekNumberStartingSunday_3() { String result = FORMATTER.format(LocalDate.of(2015, 11, 22), "%U"); assertEquals("47", result); } @Test public void testWeekNumberStartingMonday_3() { String result = FORMATTER.format(LocalDate.of(2015, 11, 22), "%W"); assertEquals("46", result); } @Test public void testDayOfTheWeek() { String result = FORMATTER.format(DATE, "%w"); assertEquals("1", result); } @Test public void testYearWithoutCentury() { String result = FORMATTER.format(DATE, "%y"); assertEquals("17", result); } @Test public void testYearWithCentury() { String result = FORMATTER.format(DATE, "%Y"); assertEquals("2017", result); } @Test public void testCentury() { String result = FORMATTER.format(DATE, "%C"); assertEquals("21", result); } @Test public void testTimeZoneName() { String result = FORMATTER.format(DATE, "%Z"); assertEquals("BRT", result); } @Test public void testTimeZoneOffset() { String result = FORMATTER.format(DATE, "%z"); assertEquals("-0300", result); } @Test public void testTimeZoneOffset_2() { String result = FORMATTER.format(DATE, "%:z"); assertEquals("-03:00", result); } @Test public void testTimeZoneOffset_3() { String result = FORMATTER.format(DATE, "%::z"); assertEquals("-03:00:00", result); } @Test public void testTimeZoneOffset_4() { String result = FORMATTER.format(DATE, "%:::z"); assertEquals("-03", result); } @Test public void testFormatDateTime() { String result = FORMATTER.format(DATE, "%c"); assertEquals("Mon Jun 5 05:42:07 2017", result); } @Test public void testSimpleDate() { String result = FORMATTER.format(DATE, "%D"); assertEquals("06/05/17", result); } @Test public void testIso8601Date() { String result = FORMATTER.format(DATE, "%F"); assertEquals("2017-06-05", result); } @Test public void testVmsDate() { String result = FORMATTER.format(DATE, "%v"); assertEquals(" 5-JUN-2017", result); } @Test public void test12HourTime() { String result = FORMATTER.format(DATE, "%r"); assertEquals("05:42:07 AM", result); } @Test public void testFullDateTime() { String result = FORMATTER.format(DATE, "%+"); assertEquals("Mon Jun 5 05:42:07 BRT 2017", result); } @Test public void testDayOfTheYearWithUpcase() { String result = FORMATTER.format(DATE, "%^j"); assertEquals("156", result); } @Test public void testDayOfTheYearWithMoreZeroes() { String result = FORMATTER.format(DATE, "%5j"); assertEquals("00156", result); } @Test public void testDayOfTheYearStrippingMoreZeroes() { String result = FORMATTER.format(DATE, "%-5j"); assertEquals("156", result); } @Test public void testDayOfTheYearWithBlanks() { String result = FORMATTER.format(DATE, "%_5j"); assertEquals(" 156", result); } @Test public void testDayOfTheMonthWithoutZeroes() { String result = FORMATTER.format(DATE.minusMonths(5), "%-j"); assertEquals("5", result); } @Test public void testDayOfTheMonthWithLength() { String result = FORMATTER.format(DATE.minusMonths(5), "%2j"); assertEquals("05", result); } @Test public void testMonthUpcase() { String result = FORMATTER.format(DATE, "%^b"); assertEquals("JUN", result); } @Test public void testMonthAligned() { String result = FORMATTER.format(DATE, "%^9B"); assertEquals(" JUNE", result); } }
924434ac5aaf53abc42642d9f29f9113d55a3164
254
java
Java
20190902_v1_1/src/pos/app/src/main/java/com/bx/erp/http/request/RequestWXPayRefund.java
Boxin-ChinaGD/BXERP
4273910059086ab9b76bd547c679d852a1129a0c
[ "Apache-2.0" ]
4
2021-11-11T08:57:32.000Z
2022-03-21T02:56:08.000Z
20190902_v1_1/src/pos/app/src/main/java/com/bx/erp/http/request/RequestWXPayRefund.java
Boxin-ChinaGD/BXERP
4273910059086ab9b76bd547c679d852a1129a0c
[ "Apache-2.0" ]
null
null
null
20190902_v1_1/src/pos/app/src/main/java/com/bx/erp/http/request/RequestWXPayRefund.java
Boxin-ChinaGD/BXERP
4273910059086ab9b76bd547c679d852a1129a0c
[ "Apache-2.0" ]
2
2021-12-20T08:34:31.000Z
2022-02-09T06:52:41.000Z
23.090909
57
0.76378
1,002,920
package com.bx.erp.http.request; import com.bx.erp.http.HttpRequestUnit; public class RequestWXPayRefund extends HttpRequestUnit { @Override public EnumRequestType getEnumRequestType() { return EnumRequestType.ERT_WXPay_Refund; } }
924435452e46544c9c8a3ce56723aa97302f40cb
1,856
java
Java
launcher/src/main/java/org/cosinus/launchertv/views/ApplicationAdapter.java
fudongbai/LauncherTV
be360624a48dc0d3bc17561899301365bafa1f3f
[ "Apache-2.0" ]
79
2017-01-18T21:37:57.000Z
2022-03-28T05:56:33.000Z
launcher/src/main/java/org/cosinus/launchertv/views/ApplicationAdapter.java
sexxicek74/LauncherTV
8354958ff9a5b77dc2a9a7102cee139cc6a8dabd
[ "Apache-2.0" ]
22
2017-07-31T21:11:01.000Z
2022-03-05T18:44:57.000Z
launcher/src/main/java/org/cosinus/launchertv/views/ApplicationAdapter.java
sexxicek74/LauncherTV
8354958ff9a5b77dc2a9a7102cee139cc6a8dabd
[ "Apache-2.0" ]
51
2017-01-15T21:05:52.000Z
2022-03-22T09:49:44.000Z
29.935484
81
0.747306
1,002,921
/* * Simple TV Launcher * Copyright 2017 Alexandre Del Bigio * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.cosinus.launchertv.views; import android.content.Context; import android.support.annotation.NonNull; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import org.cosinus.launchertv.AppInfo; import org.cosinus.launchertv.R; public class ApplicationAdapter extends ArrayAdapter<AppInfo> { private final int mResource; public ApplicationAdapter(Context context, int resId, AppInfo[] items) { super(context, R.layout.list_item, items); mResource = resId; } @NonNull @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { View view; if (convertView == null) { view = View.inflate(getContext(), mResource, null); } else { view = convertView; } ImageView packageImage = (ImageView) view.findViewById(R.id.application_icon); TextView packageName = (TextView) view.findViewById(R.id.application_name); AppInfo appInfo = getItem(position); if (appInfo != null) { view.setTag(appInfo); packageName.setText(appInfo.getName()); if (appInfo.getIcon() != null) packageImage.setImageDrawable(appInfo.getIcon()); } return (view); } }
924435e18b6cbfe79352fe9bb5e8d2470b2bdd2c
3,316
java
Java
src/com/amadornes/rscircuits/component/misc/ComponentPost.java
amadornes/SCM-Legacy
2ff0fee2e378e6b4a88f51edebd16ff2d17b80fd
[ "MIT" ]
15
2021-01-14T17:12:26.000Z
2021-12-26T11:51:09.000Z
src/com/amadornes/rscircuits/component/misc/ComponentPost.java
amadornes/SCM-Legacy
2ff0fee2e378e6b4a88f51edebd16ff2d17b80fd
[ "MIT" ]
null
null
null
src/com/amadornes/rscircuits/component/misc/ComponentPost.java
amadornes/SCM-Legacy
2ff0fee2e378e6b4a88f51edebd16ff2d17b80fd
[ "MIT" ]
6
2021-01-28T18:12:14.000Z
2021-08-23T14:08:53.000Z
25.90625
89
0.636309
1,002,922
package com.amadornes.rscircuits.component.misc; import java.util.Arrays; import java.util.EnumSet; import java.util.List; import com.amadornes.rscircuits.SCM; import com.amadornes.rscircuits.api.circuit.ICircuit; import com.amadornes.rscircuits.api.component.EnumComponentSlot; import com.amadornes.rscircuits.component.ComponentBaseInt; import com.amadornes.rscircuits.component.SimpleFactory; import com.amadornes.rscircuits.util.ComponentReference; import mcmultipart.MCMultiPartMod; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; public class ComponentPost extends ComponentBaseInt { public static final ResourceLocation NAME = new ResourceLocation(SCM.MODID, "post"); public ComponentPost(ICircuit circuit) { super(circuit); } @Override public ResourceLocation getName() { return NAME; } @Override public float getComplexity() { return ComponentReference.COMPLEXITY_POST; } @Override public boolean isDynamic() { return false; } @Override public EnumSet<EnumComponentSlot> getSlots() { return EnumSet.of(EnumComponentSlot.CENTER); } @Override public void addSelectionBoxes(List<AxisAlignedBB> boxes) { double d = 1 / 16D; double t = 2 / 16D; boxes.add(new AxisAlignedBB(d, 0, d, d + t, 1, d + t)); boxes.add(new AxisAlignedBB(1 - d - t, 0, d, 1 - d, 1, d + t)); boxes.add(new AxisAlignedBB(1 - d - t, 0, 1 - d - t, 1 - d, 1, 1 - d)); boxes.add(new AxisAlignedBB(d, 0, 1 - d - t, d + t, 1, 1 - d)); // double d = 2 / 16D; // boxes.add(new AxisAlignedBB(0.5 - d, 0, 0.5 - d, 0.5 + d, 1, 0.5 + d)); } @Override public List<ItemStack> getDrops() { return Arrays.asList(getPickedItem()); } @Override public ItemStack getPickedItem() { return new ItemStack(Items.STICK); } @Override public AxisAlignedBB getSelectionBox(AxisAlignedBB box) { double d = 1 / 16D; return new AxisAlignedBB(d, 0, d, 1 - d, 1, 1 - d); } @Override public void serializePlacement(PacketBuffer buf) { } @Override public void deserializePlacement(PacketBuffer buf) { } public static class Factory extends SimpleFactory<ComponentPost> { @Override public BlockStateContainer createBlockState() { return new BlockStateContainer(MCMultiPartMod.multipart); } @Override public ResourceLocation getModelPath() { return new ResourceLocation(SCM.MODID, "component/post"); } @Override public boolean isValidPlacementStack(ItemStack stack, EntityPlayer player) { return stack.getItem() == Items.STICK; } @Override public ComponentPost instantiate(ICircuit circuit) { return new ComponentPost(circuit); } } }
924437466bfc510b6d6fa44ad0e0e7d6ecefa443
1,277
java
Java
spring-aop/src/main/java/org/springframework/aop/TargetClassAware.java
liudaxx/spring-framework
114dd4c8e13438eed3749102c772a8933f1547c6
[ "Apache-2.0" ]
112
2017-11-04T11:48:25.000Z
2022-03-14T08:10:35.000Z
spring-aop/src/main/java/org/springframework/aop/TargetClassAware.java
liudaxx/spring-framework
114dd4c8e13438eed3749102c772a8933f1547c6
[ "Apache-2.0" ]
7
2020-02-28T01:27:57.000Z
2022-03-08T21:12:13.000Z
spring-aop/src/main/java/org/springframework/aop/TargetClassAware.java
liudaxx/spring-framework
114dd4c8e13438eed3749102c772a8933f1547c6
[ "Apache-2.0" ]
78
2017-12-15T13:28:46.000Z
2021-12-19T09:59:09.000Z
31.925
75
0.732968
1,002,923
/* * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.aop; /** * Minimal interface for exposing the target class behind a proxy. * * <p>Implemented by AOP proxy objects and proxy factories * (via {@link org.springframework.aop.framework.Advised}) * as well as by {@link TargetSource TargetSources}. * * @author Juergen Hoeller * @since 2.0.3 * @see org.springframework.aop.support.AopUtils#getTargetClass(Object) */ public interface TargetClassAware { /** * Return the target class behind the implementing object * (typically a proxy configuration or an actual proxy). * @return the target Class, or {@code null} if not known */ Class<?> getTargetClass(); }
924437563ed47328aeb50ff778ddd53e7cd54cf0
276
java
Java
highcharts/src/main/java/us/ascendtech/highcharts/client/chartoptions/series/functions/MouseOver.java
nagin/gwt-highcharts
8604726f703e0705f1cf6a085abf5dc867d12965
[ "Apache-2.0" ]
7
2018-08-16T14:10:32.000Z
2019-11-19T15:32:14.000Z
highcharts/src/main/java/us/ascendtech/highcharts/client/chartoptions/series/functions/MouseOver.java
nagin/gwt-highcharts
8604726f703e0705f1cf6a085abf5dc867d12965
[ "Apache-2.0" ]
1
2019-11-06T08:59:14.000Z
2019-11-06T16:05:57.000Z
highcharts/src/main/java/us/ascendtech/highcharts/client/chartoptions/series/functions/MouseOver.java
nagin/gwt-highcharts
8604726f703e0705f1cf6a085abf5dc867d12965
[ "Apache-2.0" ]
4
2019-07-01T12:51:35.000Z
2022-03-10T10:08:27.000Z
27.6
77
0.851449
1,002,924
package us.ascendtech.highcharts.client.chartoptions.series.functions; import jsinterop.annotations.JsFunction; import us.ascendtech.highcharts.client.chartoptions.series.SeriesPointEvents; @JsFunction public interface MouseOver { void mouseOut(SeriesPointEvents event); }
9244376eea8e37b74d5d99d6d2bc7b59f48bb207
1,352
java
Java
java/srcPubnubApi/srcInterfaces/com/pubnub/api/PubnubInterface.java
palmzeed/JAVA-3.7.2
5a2c747a485ecbe068252984f6ac12756557bd80
[ "MIT" ]
1
2020-12-28T18:00:35.000Z
2020-12-28T18:00:35.000Z
java/srcPubnubApi/srcInterfaces/com/pubnub/api/PubnubInterface.java
chenguang89/java
5a2c747a485ecbe068252984f6ac12756557bd80
[ "MIT" ]
2
2020-12-28T20:10:27.000Z
2020-12-28T21:46:09.000Z
java/srcPubnubApi/srcInterfaces/com/pubnub/api/PubnubInterface.java
admdev8/java
a764fb2458f15d0d543d27dc56df4923a784a6c5
[ "MIT" ]
1
2020-12-23T14:49:12.000Z
2020-12-23T14:49:12.000Z
18.777778
59
0.531805
1,002,925
package com.pubnub.api; interface PubnubInterface { /** * This method unsets auth key. * */ public void unsetAuthKey(); /** * This method returns unique identifier. * * @return Unique Identifier . */ public String uuid(); /** * This method sets auth key. * * @param authKey * . 0 length string or null unsets auth key */ public void setAuthKey(String authKey); /** * Sets domain value, default is "pubnub.com" * * @param domain * Domain value */ public void setDomain(String domain); /** * Sets origin value, default is "pubsub" * * @param origin * Origin value */ public void setOrigin(String origin); /** * Gets current UUID * * @return uuid current UUID value for Pubnub client */ public String getUUID(); /** * Returns domain * * @return domain */ public String getDomain(); /** * This method returns auth key. Return null if not set * * @return Auth Key. null if auth key not set */ public String getAuthKey(); /** * Sets value for UUID * * @param uuid * UUID value for Pubnub client */ public void setUUID(String uuid); }
9244377bd8df060ebe06a9b5f5b4abc6dbabc7dd
44,652
java
Java
MapBusesRoute/src/java/src/Functions.java
manglakaran/TrafficKarmaSent
5fe876685510f9bd26977bba734e78034f888613
[ "MIT" ]
null
null
null
MapBusesRoute/src/java/src/Functions.java
manglakaran/TrafficKarmaSent
5fe876685510f9bd26977bba734e78034f888613
[ "MIT" ]
null
null
null
MapBusesRoute/src/java/src/Functions.java
manglakaran/TrafficKarmaSent
5fe876685510f9bd26977bba734e78034f888613
[ "MIT" ]
null
null
null
32.73607
126
0.448132
1,002,926
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package src; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * * @author Dibyendu1363 */ public class Functions { public String getMean(String st) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; double sum = 0; double sum1 = 0; int count = 0; while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); if (parts2[0].equals(first) && parts2[1].equals(end)) { sum = sum + Double.parseDouble(parts1[8]); sum1 = sum1 + Double.parseDouble(parts1[7]); count++; } } double speed_mean = sum / count; double per = sum / sum1 * 100; String state = ""; if (per >= 80.02) { state = "Mild"; } else if (per < 80.02 && per > 66.7) { state = "Medium"; } else { state = "Heavy"; } String result = speed_mean + " Km/Hr -> " + state; return result; } public String getMedian(String st) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; ArrayList<String> speeds_main = new ArrayList<String>(); double speed_limit = 0; ArrayList<String> all = new ArrayList<String>(); while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); if (parts2[0].equals(first) && parts2[1].equals(end)) { all.add(parts1[7] + " # " + parts1[8] + " # " + parts1[9]); } } for (int i = 0; i < all.size(); i++) { String s = all.get(i); String prts[] = s.split("#"); speeds_main.add(prts[1].trim()); } Collections.sort(speeds_main); double speed_median_main = Double.parseDouble(speeds_main.get((speeds_main.size() + 1) / 2 - 1)); String state = ""; for (int k = 0; k < all.size(); k++) { String s = all.get(k); String prts[] = s.split("#"); if (prts[1].trim().equals(speed_median_main + "")) { state = prts[2]; speed_limit = Double.parseDouble(prts[0]); } } if (state.equals("None")) { double per = speed_median_main / speed_limit * 100; if (per >= 80.02) { state = "Mild"; } else if (per < 80.02 && per > 66.7) { state = "Medium"; } else { state = "Heavy"; } } String result = speed_median_main + " Km/Hr -> " + state; return result; } public String getVariance(String st) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; double sum = 0; int count = 0; ArrayList<Double> speeds = new ArrayList<Double>(); while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); if (parts2[0].equals(first) && parts2[1].equals(end)) { speeds.add(Double.parseDouble(parts1[8])); sum = sum + Double.parseDouble(parts1[8]); count++; } } double speed_mean = sum / count; double sum1 = 0; for (int i = 0; i < speeds.size(); i++) { sum1 = sum1 + Math.pow(speeds.get(i) - speed_mean, 2); } double speed_variance = sum1 / speeds.size(); String result = speed_variance + " SqKm/Hr"; return result; } public String getSD(String st) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; double sum = 0; int count = 0; ArrayList<Double> speeds = new ArrayList<Double>(); while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); if (parts2[0].equals(first) && parts2[1].equals(end)) { speeds.add(Double.parseDouble(parts1[8])); sum = sum + Double.parseDouble(parts1[8]); count++; } } double speed_mean = sum / count; double sum1 = 0; for (int i = 0; i < speeds.size(); i++) { sum1 = sum1 + Math.pow(speeds.get(i) - speed_mean, 2); } double speed_SD = Math.sqrt(sum1 / speeds.size()); String result = speed_SD + " Km/Hr"; return result; } public String getMeanDay(String st, String dt) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } String ss = ""; int flag = 0; for (int i = 0; i < dt.length(); i++) { if (Character.isDigit(dt.charAt(i))) { ss = ss.concat(dt.charAt(i) + ""); flag = 1; } if (flag == 1 && !Character.isDigit(dt.charAt(i))) { break; } } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; double sum = 0; double sum1 = 0; int count = 0; while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); String parts3[] = parts[0].split("/"); if (parts2[0].equals(first) && parts2[1].equals(end) && parts3[0].equals(ss)) { sum = sum + Double.parseDouble(parts1[8]); sum1 = sum1 + Double.parseDouble(parts1[7]); count++; } } double speed_mean_day = sum / count; double per = sum / sum1 * 100; String state = ""; if (per >= 80.02) { state = "Mild"; } else if (per < 80.02 && per > 66.7) { state = "Medium"; } else { state = "Heavy"; } String result = speed_mean_day + " Km/Hr -> " + state; return result; } public String getMedianDay(String st, String dt) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } String ss = ""; int flag = 0; for (int i = 0; i < dt.length(); i++) { if (Character.isDigit(dt.charAt(i))) { ss = ss.concat(dt.charAt(i) + ""); flag = 1; } if (flag == 1 && !Character.isDigit(dt.charAt(i))) { break; } } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; ArrayList<String> all = new ArrayList<String>(); ArrayList<String> speeds_main = new ArrayList<String>(); double speed_limit = 0; while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); String parts3[] = parts[0].split("/"); if (parts2[0].equals(first) && parts2[1].equals(end) && parts3[0].equals(ss)) { all.add(parts1[7] + " # " + parts1[8] + " # " + parts1[9]); } } for (int i = 0; i < all.size(); i++) { String s = all.get(i); String prts[] = s.split("#"); speeds_main.add(prts[1].trim()); } Collections.sort(speeds_main); double speed_median_day_main = Double.parseDouble(speeds_main.get((speeds_main.size() + 1) / 2 - 1)); String state = ""; for (int k = 0; k < all.size(); k++) { String s = all.get(k); String prts[] = s.split("#"); if (prts[1].trim().equals(speed_median_day_main + "")) { state = prts[2]; speed_limit = Double.parseDouble(prts[0]); } } if (state.equals("None")) { double per = speed_median_day_main / speed_limit * 100; if (per >= 80.02) { state = "Mild"; } else if (per < 80.02 && per > 66.7) { state = "Medium"; } else { state = "Heavy"; } } String result = speed_median_day_main + " Km/Hr -> " + state; return result; } public String getVarianceDay(String st, String dt) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } String ss = ""; int flag = 0; for (int i = 0; i < dt.length(); i++) { if (Character.isDigit(dt.charAt(i))) { ss = ss.concat(dt.charAt(i) + ""); flag = 1; } if (flag == 1 && !Character.isDigit(dt.charAt(i))) { break; } } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; double sum = 0; int count = 0; ArrayList<Double> speeds = new ArrayList<Double>(); while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); String parts3[] = parts[0].split("/"); if (parts2[0].equals(first) && parts2[1].equals(end) && parts3[0].equals(ss)) { speeds.add(Double.parseDouble(parts1[8])); sum = sum + Double.parseDouble(parts1[8]); count++; } } double speed_mean_day = sum / count; double sum1 = 0; for (int i = 0; i < speeds.size(); i++) { sum1 = sum1 + Math.pow(speeds.get(i) - speed_mean_day, 2); } double speed_variance_day = sum1 / speeds.size(); String result = speed_variance_day + " SqKm/Hr"; return result; } public String getSDDay(String st, String dt) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } String ss = ""; int flag = 0; for (int i = 0; i < dt.length(); i++) { if (Character.isDigit(dt.charAt(i))) { ss = ss.concat(dt.charAt(i) + ""); flag = 1; } if (flag == 1 && !Character.isDigit(dt.charAt(i))) { break; } } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; double sum = 0; int count = 0; ArrayList<Double> speeds = new ArrayList<Double>(); while ((str = br.readLine()) != null) { String parts[] = str.split(" "); String parts1[] = parts[1].split("--"); String parts2[] = parts1[1].split("_"); String parts3[] = parts[0].split("/"); if (parts2[0].equals(first) && parts2[1].equals(end) && parts3[0].equals(ss)) { speeds.add(Double.parseDouble(parts1[8])); sum = sum + Double.parseDouble(parts1[8]); count++; } } double speed_mean_day = sum / count; double sum1 = 0; for (int i = 0; i < speeds.size(); i++) { sum1 = sum1 + Math.pow(speeds.get(i) - speed_mean_day, 2); } double speed_SD_day = Math.sqrt(sum1 / speeds.size()); String result = speed_SD_day + " Km/Hr"; return result; } public String getMeanTime(String st, String tm) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } int val = 0; if (tm.contains("pm") | tm.contains("p.m") | tm.contains("p.m.")) { val = 12; tm = tm.replace("p", ""); tm = tm.replace("m", ""); tm = tm.replace(".", ""); tm = tm.replace(" ", ""); } else { if (tm.contains("a")) { tm = tm.replace("a", ""); } if (tm.contains("m")) { tm = tm.replace("m", ""); } tm = tm.replace(" ", ""); tm = tm.replace(".", ""); } String query; if (tm.contains(":")) { String prt[] = tm.split(":"); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else if (tm.contains(" ")) { String prt[] = tm.split(" "); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else { int fnl = Integer.parseInt(tm) + val; query = fnl + ":" + "00"; } ArrayList<String> dates = new ArrayList<String>(); FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; while ((str = br.readLine()) != null) { String parts[] = str.split(" "); if (!dates.contains(parts[0])) { dates.add(parts[0]); } } FileReader fr1 = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br1 = new BufferedReader(fr1); br1.readLine(); String str1; HashMap<String, ArrayList<String>> hm = new HashMap<String, ArrayList<String>>(); for (String base : dates) { hm.put(base, new ArrayList<String>()); } while ((str1 = br1.readLine()) != null) { Iterator it = hm.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); String s = pair.getKey() + ""; String oo[] = str1.split(" "); String ooo[] = oo[1].split("--"); if (s.equals(oo[0]) && ooo[1].equals(first + "_" + end)) { String sp = ooo[0] + "#" + ooo[8] + "#" + ooo[7]; ArrayList temp = hm.get(pair.getKey()); temp.add(sp); } } } //System.out.println(hm); ArrayList<Double> speed_main = new ArrayList<Double>(); HashMap<String, String> hm1 = new HashMap<String, String>(); Iterator i = hm.entrySet().iterator(); while (i.hasNext()) { Map.Entry pair = (Map.Entry) i.next(); ArrayList arr = hm.get(pair.getKey()); ArrayList<String> entries_per_day = new ArrayList<String>(); ArrayList<Integer> gaps = new ArrayList<Integer>(); ArrayList<String> speeds = new ArrayList<String>(); for (int p = 0; p < arr.size(); p++) { String ll = arr.get(p) + ""; String l[] = ll.split("#"); speed_main.add(Double.parseDouble(l[2])); String p1[] = l[0].split(":"); int g = Integer.parseInt(p1[0]) * 3600 + Integer.parseInt(p1[1]) * 60 + Integer.parseInt(p1[2]); String pa[] = query.split(":"); int c = Integer.parseInt(pa[0]) * 3600 + Integer.parseInt(pa[1]) * 60; int gap; if (c > g) { gap = c - g; } else { gap = g - c; } entries_per_day.add(l[0]); gaps.add(gap); speeds.add(l[1]); } String closest_time = entries_per_day.get(gaps.indexOf(Collections.min(gaps))); String closest_time_speed = speeds.get(gaps.indexOf(Collections.min(gaps))) + ""; String closest_time_speed_main = speed_main.get(gaps.indexOf(Collections.min(gaps))) + ""; hm1.put(pair.getKey() + "", closest_time + "#" + closest_time_speed + "#" + closest_time_speed_main); } //System.out.println(hm1); double sum = 0; double sum1 = 0; Iterator ii = hm1.entrySet().iterator(); while (ii.hasNext()) { Map.Entry pair = (Map.Entry) ii.next(); String h = hm1.get(pair.getKey()); String lol[] = h.split("#"); sum = sum + Double.parseDouble(lol[1]); sum1 = sum1 + Double.parseDouble(lol[2]); } double speed_mean_time = sum / hm1.size(); double per = sum / sum1 * 100; String state = ""; if (per >= 80.02) { state = "Mild"; } else if (per < 80.02 && per > 66.7) { state = "Medium"; } else { state = "Heavy"; } String result = speed_mean_time + " Km/Hr -> " + state; return result; } public String getMedianTime(String st, String tm) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } int val = 0; if (tm.contains("pm") | tm.contains("p.m") | tm.contains("p.m.")) { val = 12; tm = tm.replace("p", ""); tm = tm.replace("m", ""); tm = tm.replace(".", ""); tm = tm.replace(" ", ""); } else { if (tm.contains("a")) { tm = tm.replace("a", ""); } if (tm.contains("m")) { tm = tm.replace("m", ""); } tm = tm.replace(" ", ""); tm = tm.replace(".", ""); } String query; if (tm.contains(":")) { String prt[] = tm.split(":"); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else if (tm.contains(" ")) { String prt[] = tm.split(" "); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else { int fnl = Integer.parseInt(tm) + val; query = fnl + ":" + "00"; } ArrayList<String> dates = new ArrayList<String>(); FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; while ((str = br.readLine()) != null) { String parts[] = str.split(" "); if (!dates.contains(parts[0])) { dates.add(parts[0]); } } FileReader fr1 = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br1 = new BufferedReader(fr1); br1.readLine(); String str1; HashMap<String, ArrayList<String>> hm = new HashMap<String, ArrayList<String>>(); for (String base : dates) { hm.put(base, new ArrayList<String>()); } String speed_limit = ""; while ((str1 = br1.readLine()) != null) { Iterator it = hm.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); String s = pair.getKey() + ""; String oo[] = str1.split(" "); String ooo[] = oo[1].split("--"); if (s.equals(oo[0]) && ooo[1].equals(first + "_" + end)) { String sp = ooo[0] + "#" + ooo[8] + "#" + ooo[9]; speed_limit = ooo[7]; ArrayList temp = hm.get(pair.getKey()); temp.add(sp); } } } HashMap<String, String> hm1 = new HashMap<String, String>(); Iterator i = hm.entrySet().iterator(); while (i.hasNext()) { Map.Entry pair = (Map.Entry) i.next(); ArrayList arr = hm.get(pair.getKey()); ArrayList<Integer> gaps = new ArrayList<Integer>(); ArrayList<String> speeds = new ArrayList<String>(); ArrayList<String> states = new ArrayList<String>(); for (int p = 0; p < arr.size(); p++) { String ll = arr.get(p) + ""; String l[] = ll.split("#"); String p1[] = l[0].split(":"); int g = Integer.parseInt(p1[0]) * 3600 + Integer.parseInt(p1[1]) * 60 + Integer.parseInt(p1[2]); String pa[] = query.split(":"); int c = Integer.parseInt(pa[0]) * 3600 + Integer.parseInt(pa[1]) * 60; int gap; if (c > g) { gap = c - g; } else { gap = g - c; } gaps.add(gap); speeds.add(l[1]); states.add(l[2]); } String closest_time_speed = speeds.get(gaps.indexOf(Collections.min(gaps))) + ""; String closest_time_state = states.get(gaps.indexOf(Collections.min(gaps))) + ""; hm1.put(pair.getKey() + "", closest_time_speed + "#" + closest_time_state); } ArrayList<String> a1 = new ArrayList<String>(); Iterator uu = hm1.entrySet().iterator(); while (uu.hasNext()) { Map.Entry pair = (Map.Entry) uu.next(); String sty = hm1.get(pair.getKey()) + ""; String pl[] = sty.split("#"); a1.add(pl[0]); } Collections.sort(a1); String speed_median_time = a1.get((a1.size() + 1) / 2 - 1); String state = ""; Iterator u1 = hm1.entrySet().iterator(); while (u1.hasNext()) { Map.Entry pair = (Map.Entry) u1.next(); String sty = hm1.get(pair.getKey()) + ""; String pl[] = sty.split("#"); if (speed_median_time.equals(pl[0])) { state = pl[1]; } } if (state.equals("None")) { double per = Double.parseDouble(speed_median_time) / Double.parseDouble(speed_limit) * 100; if (per >= 80.02) { state = "Mild"; } else if (per < 80.02 && per > 66.7) { state = "Medium"; } else { state = "Heavy"; } } String result = speed_median_time + " Km/Hr -> " + state; return result; } public String getVarianceTime(String st, String tm) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } int val = 0; if (tm.contains("pm") | tm.contains("p.m") | tm.contains("p.m.")) { val = 12; tm = tm.replace("p", ""); tm = tm.replace("m", ""); tm = tm.replace(".", ""); tm = tm.replace(" ", ""); } else { if (tm.contains("a")) { tm = tm.replace("a", ""); } if (tm.contains("m")) { tm = tm.replace("m", ""); } tm = tm.replace(" ", ""); tm = tm.replace(".", ""); } String query; if (tm.contains(":")) { String prt[] = tm.split(":"); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else if (tm.contains(" ")) { String prt[] = tm.split(" "); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else { int fnl = Integer.parseInt(tm) + val; query = fnl + ":" + "00"; } ArrayList<String> dates = new ArrayList<String>(); FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; while ((str = br.readLine()) != null) { String parts[] = str.split(" "); if (!dates.contains(parts[0])) { dates.add(parts[0]); } } FileReader fr1 = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br1 = new BufferedReader(fr1); br1.readLine(); String str1; HashMap<String, ArrayList<String>> hm = new HashMap<String, ArrayList<String>>(); for (String base : dates) { hm.put(base, new ArrayList<String>()); } while ((str1 = br1.readLine()) != null) { Iterator it = hm.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); String s = pair.getKey() + ""; String oo[] = str1.split(" "); String ooo[] = oo[1].split("--"); if (s.equals(oo[0]) && ooo[1].equals(first + "_" + end)) { String sp = ooo[0] + "#" + ooo[8]; ArrayList temp = hm.get(pair.getKey()); temp.add(sp); } } } HashMap<String, String> hm1 = new HashMap<String, String>(); Iterator i = hm.entrySet().iterator(); while (i.hasNext()) { Map.Entry pair = (Map.Entry) i.next(); ArrayList arr = hm.get(pair.getKey()); ArrayList<String> entries_per_day = new ArrayList<String>(); ArrayList<Integer> gaps = new ArrayList<Integer>(); ArrayList<String> speeds = new ArrayList<String>(); for (int p = 0; p < arr.size(); p++) { String ll = arr.get(p) + ""; String l[] = ll.split("#"); String p1[] = l[0].split(":"); int g = Integer.parseInt(p1[0]) * 3600 + Integer.parseInt(p1[1]) * 60 + Integer.parseInt(p1[2]); String pa[] = query.split(":"); int c = Integer.parseInt(pa[0]) * 3600 + Integer.parseInt(pa[1]) * 60; int gap; if (c > g) { gap = c - g; } else { gap = g - c; } entries_per_day.add(l[0]); gaps.add(gap); speeds.add(l[1]); } String closest_time = entries_per_day.get(gaps.indexOf(Collections.min(gaps))); String closest_time_speed = speeds.get(gaps.indexOf(Collections.min(gaps))) + ""; hm1.put(pair.getKey() + "", closest_time + "#" + closest_time_speed); } ArrayList<Double> lp = new ArrayList<Double>(); double sum = 0; Iterator ii = hm1.entrySet().iterator(); while (ii.hasNext()) { Map.Entry pair = (Map.Entry) ii.next(); String h = hm1.get(pair.getKey()); String lol[] = h.split("#"); lp.add(Double.parseDouble(lol[1])); sum = sum + Double.parseDouble(lol[1]); } double speed_mean_time = sum / hm1.size(); double sm = 0; for (int y = 0; y < lp.size(); y++) { sm = sm + Math.pow(lp.get(y) - speed_mean_time, 2); } double speed_variance_time = sm / lp.size(); String result = speed_variance_time + " SqKm/Hr"; return result; } public String getSDTime(String st, String tm) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } int val = 0; if (tm.contains("pm") | tm.contains("p.m") | tm.contains("p.m.")) { val = 12; tm = tm.replace("p", ""); tm = tm.replace("m", ""); tm = tm.replace(".", ""); tm = tm.replace(" ", ""); } else { if (tm.contains("a")) { tm = tm.replace("a", ""); } if (tm.contains("m")) { tm = tm.replace("m", ""); } tm = tm.replace(" ", ""); tm = tm.replace(".", ""); } String query; if (tm.contains(":")) { String prt[] = tm.split(":"); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else if (tm.contains(" ")) { String prt[] = tm.split(" "); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else { int fnl = Integer.parseInt(tm) + val; query = fnl + ":" + "00"; } ArrayList<String> dates = new ArrayList<String>(); FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; while ((str = br.readLine()) != null) { String parts[] = str.split(" "); if (!dates.contains(parts[0])) { dates.add(parts[0]); } } FileReader fr1 = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br1 = new BufferedReader(fr1); br1.readLine(); String str1; HashMap<String, ArrayList<String>> hm = new HashMap<String, ArrayList<String>>(); for (String base : dates) { hm.put(base, new ArrayList<String>()); } while ((str1 = br1.readLine()) != null) { Iterator it = hm.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); String s = pair.getKey() + ""; String oo[] = str1.split(" "); String ooo[] = oo[1].split("--"); if (s.equals(oo[0]) && ooo[1].equals(first + "_" + end)) { String sp = ooo[0] + "#" + ooo[8]; ArrayList temp = hm.get(pair.getKey()); temp.add(sp); } } } HashMap<String, String> hm1 = new HashMap<String, String>(); Iterator i = hm.entrySet().iterator(); while (i.hasNext()) { Map.Entry pair = (Map.Entry) i.next(); ArrayList arr = hm.get(pair.getKey()); ArrayList<String> entries_per_day = new ArrayList<String>(); ArrayList<Integer> gaps = new ArrayList<Integer>(); ArrayList<String> speeds = new ArrayList<String>(); for (int p = 0; p < arr.size(); p++) { String ll = arr.get(p) + ""; String l[] = ll.split("#"); String p1[] = l[0].split(":"); int g = Integer.parseInt(p1[0]) * 3600 + Integer.parseInt(p1[1]) * 60 + Integer.parseInt(p1[2]); String pa[] = query.split(":"); int c = Integer.parseInt(pa[0]) * 3600 + Integer.parseInt(pa[1]) * 60; int gap; if (c > g) { gap = c - g; } else { gap = g - c; } entries_per_day.add(l[0]); gaps.add(gap); speeds.add(l[1]); } String closest_time = entries_per_day.get(gaps.indexOf(Collections.min(gaps))); String closest_time_speed = speeds.get(gaps.indexOf(Collections.min(gaps))) + ""; hm1.put(pair.getKey() + "", closest_time + "#" + closest_time_speed); } ArrayList<Double> lp = new ArrayList<Double>(); double sum = 0; Iterator ii = hm1.entrySet().iterator(); while (ii.hasNext()) { Map.Entry pair = (Map.Entry) ii.next(); String h = hm1.get(pair.getKey()); String lol[] = h.split("#"); lp.add(Double.parseDouble(lol[1])); sum = sum + Double.parseDouble(lol[1]); } double speed_mean_time = sum / hm1.size(); double sm = 0; for (int y = 0; y < lp.size(); y++) { sm = sm + Math.pow(lp.get(y) - speed_mean_time, 2); } double speed_SD_time = Math.sqrt(sm / lp.size()); String result = speed_SD_time + " Km/Hr"; return result; } public String getState(String st, String dt, String tm) throws FileNotFoundException, IOException { String first, end; if (st.contains(":")) { String pp[] = st.split(":"); first = pp[0]; end = pp[1]; } else if (st.contains("-")) { String pp[] = st.split("-"); first = pp[0]; end = pp[1]; } else if (st.contains("_")) { String pp[] = st.split("_"); first = pp[0]; end = pp[1]; } else { String pp[] = st.split(" "); first = pp[0]; end = pp[1]; } String ss = ""; int flag = 0; for (int i = 0; i < dt.length(); i++) { if (Character.isDigit(dt.charAt(i))) { ss = ss.concat(dt.charAt(i) + ""); flag = 1; } if (flag == 1 && !Character.isDigit(dt.charAt(i))) { break; } } String query; int val = 0; if (tm.contains("pm") | tm.contains("p.m") | tm.contains("p.m.")) { val = 12; tm = tm.replace("p", ""); tm = tm.replace("m", ""); tm = tm.replace(".", ""); tm = tm.replace(" ", ""); } else { if (tm.contains("a")) { tm = tm.replace("a", ""); } if (tm.contains("m")) { tm = tm.replace("m", ""); } tm = tm.replace(" ", ""); tm = tm.replace(".", ""); } if (tm.contains(":")) { String prt[] = tm.split(":"); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else if (tm.contains(" ")) { String prt[] = tm.split(" "); String hr = prt[0]; String mnt = prt[1]; int fnl = Integer.parseInt(hr) + val; query = fnl + ":" + mnt; } else { int fnl = Integer.parseInt(tm) + val; query = fnl + ":" + "00"; } FileReader fr = new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\final_data_bing.txt"); BufferedReader br = new BufferedReader(fr); br.readLine(); String str; ArrayList<String> a1 = new ArrayList<String>(); ArrayList<Integer> a2 = new ArrayList<Integer>(); double speed_limit = 0; while ((str = br.readLine()) != null) { String p[] = str.split(" "); String pp[] = p[0].split("/"); String ppp[] = p[1].split("--"); if (pp[0].equals(ss) && ppp[1].equals(first + "_" + end)) { speed_limit = Double.parseDouble(ppp[7]); a1.add(ppp[0] + "#" + ppp[8] + "#" + ppp[9]); String p1[] = ppp[0].split(":"); int g1 = Integer.parseInt(p1[0]) * 3600 + Integer.parseInt(p1[1]) * 60 + Integer.parseInt(p1[2]); String pa[] = query.split(":"); int c = Integer.parseInt(pa[0]) * 3600 + Integer.parseInt(pa[1]) * 60; int gap; if (c > g1) { gap = c - g1; } else { gap = g1 - c; } a2.add(gap); } } ArrayList<Integer> a3 = new ArrayList<Integer>(); for (int ii = 0; ii < a2.size(); ii++) { a3.add(a2.get(ii)); } Collections.sort(a2); String fg[] = a1.get(a3.indexOf(a2.get(0))).split("#"); if (fg[2].equals("None")) { double per = Double.parseDouble(fg[1]) / speed_limit * 100; if (per >= 80.02) { fg[2] = "Mild"; } else if (per < 80.02 && per > 66.7) { fg[2] = "Medium"; } else { fg[2] = "Heavy"; } } String result = fg[1] + " Km/Hr -> " + fg[2]; return result; } }
9244386242667c0a2e213c10e678f3d3bc38af42
5,400
java
Java
src/main/java/hextostring/convert/AbstractConverter.java
MX-Futhark/hook-any-text
1277026a4e5ba114bbaabaf2036439286d41179c
[ "MIT" ]
47
2015-08-17T19:12:47.000Z
2022-03-10T21:52:27.000Z
src/main/java/hextostring/convert/AbstractConverter.java
MX-Futhark/hook-any-text
1277026a4e5ba114bbaabaf2036439286d41179c
[ "MIT" ]
30
2015-08-24T16:47:45.000Z
2021-11-17T16:12:54.000Z
src/main/java/hextostring/convert/AbstractConverter.java
MX-Futhark/hook-any-text
1277026a4e5ba114bbaabaf2036439286d41179c
[ "MIT" ]
7
2017-08-22T18:36:48.000Z
2021-01-23T16:02:48.000Z
26.732673
77
0.710741
1,002,927
package hextostring.convert; import java.nio.charset.Charset; import java.util.LinkedList; import java.util.List; import java.util.Locale; import hextostring.ConvertOptions; import hextostring.debug.DebuggableLine; import hextostring.debug.DebuggableLineList; import hextostring.evaluate.EvaluatorFactory; import hextostring.evaluate.string.StringEvaluator; import hextostring.replacement.HexToStrStrategy; import hextostring.replacement.ReplacementType; import hextostring.replacement.Replacements; /** * Abstract converter using a definite encoding. * * @author Maxime PIA */ public abstract class AbstractConverter implements Converter { private Charset charset; private Replacements replacements; private StringEvaluator japaneseStringEvaluator; public AbstractConverter(Charset charset) { setCharset(charset); } /** * Getter on the charset used by the converter. * * @param charset * The charset used by the converter. */ protected Charset getCharset() { return charset; } /** * Sets the charset for the converter and adapts its evaluators accordingly. * * @param charset * The new charset for this converter. */ protected void setCharset(Charset charset) { this.charset = charset; this.japaneseStringEvaluator = EvaluatorFactory.getStringEvaluatorInstance(); } @Override public void setReplacements(Replacements r) { replacements = r; if (replacements == null) { replacements = ConvertOptions.DEFAULT_REPLACEMENTS; } } /** * Verifies if the input is valid and sets it to lowercase without spaces. * * @param hex * The input string. * @return * The lowercase, sans spaces version of the input string. */ protected static String preProcessHex(String hex) { String lowercaseHex = hex.toLowerCase(Locale.ENGLISH).replace(" ", "").replace("\n", ""); if (!lowercaseHex.matches("[a-f0-9]+")) { throw new IllegalArgumentException("Invalid hex string."); } return lowercaseHex; } /** * Inputs strings may contains areas of zeros. This method removes them. * * @param hex * The lowercase version of the input string. * @return A list a strings found between areas of zeros. */ protected abstract List<String> extractConvertibleChunks(String hex); /** * Calls extractConvertibleChunks of hex parts of a transitory string and * re-glue mixed parts together whenever possible. * * @param mixed * The transitory string * @return A list of convertible transitory strings. */ private List<String> extractConvertibleChunksFromMixedString(String mixed) { List<String> result = new LinkedList<>(); List<String> parts = HexToStrStrategy.splitParts(mixed); List<String> previousHexChunks = null; String previousHexPart = null, previousReadablePart = null; boolean hexPart = true, stringPreceded = false; for (String part : parts) { int lastIndex = result.size() - 1; if (hexPart) { List<String> chunks = extractConvertibleChunks(part); if (chunks.size() > 0 && previousReadablePart != null) { // the first chunk corresponds to the start of the hex part boolean stringPrecedes = part.indexOf(chunks.get(0)) == 0; if (stringPrecedes) { result.set( lastIndex, result.get(lastIndex) + chunks.get(0) ); chunks = chunks.subList(1, chunks.size()); stringPreceded = true; } else { stringPreceded = false; } } result.addAll(chunks); previousHexPart = part; previousHexChunks = chunks; } else { part = "-" + part + "-"; // restore "-" removed by splitParts boolean stringFollows = false; if (previousHexChunks.size() + (stringPreceded ? 1 : 0) > 0) { String lastChunk = result.get(lastIndex); // the last chunk corresponds to the end of the hex part stringFollows = previousHexPart.lastIndexOf(lastChunk) + lastChunk.length() == previousHexPart.length(); if (stringFollows) { result.set(lastIndex, lastChunk + part); } } if (!stringFollows) { result.add(part); } previousReadablePart = part; } hexPart = !hexPart; } return result; } /** * Converts a hex string into several Japanese lines * * @param hex * A hex string copied from Cheat Engine's memory viewer. * @return The result of the conversion wrapped into a debuggable object. */ @Override public DebuggableLineList convert(String hex) { DebuggableLineList lines = new DebuggableLineList(preProcessHex(hex)); lines.setHexInputAfterHexReplacements( replacements.apply(lines.getHexInput(), ReplacementType.HEX2HEX) ); lines.setHexInputAfterStrReplacements( replacements.apply( lines.getHexInputAfterHexReplacements(), ReplacementType.HEX2STR ) ); List<String> hexCollection = extractConvertibleChunksFromMixedString( lines.getHexInputAfterStrReplacements() ); for (String hexChunk : hexCollection) { DebuggableLine line = new DebuggableLine(hexChunk); line.setReadableString(HexToStrStrategy.toReadableString( line.getHex(), charset )); line.setReadableStringAfterReplacements(replacements.apply( line.getReadableString(), ReplacementType.STR2STR )); line.setEvaluationResult( japaneseStringEvaluator.evaluate( line.getReadableStringAfterReplacements() ) ); lines.addLine(line); } return lines; } }
92443924eb0acf8bf8ab755060501a9300e94a12
1,849
java
Java
wicket-examples/src/main/java/org/apache/wicket/examples/debug/InspectorBug.java
astubbs/wicket.get-portals2
6ceca0773ab057880643ba2bd87eb18855e04082
[ "Apache-2.0" ]
2
2015-11-23T16:52:11.000Z
2016-05-08T14:37:42.000Z
wicket-examples/src/main/java/org/apache/wicket/examples/debug/InspectorBug.java
astubbs/wicket.get-portals2
6ceca0773ab057880643ba2bd87eb18855e04082
[ "Apache-2.0" ]
null
null
null
wicket-examples/src/main/java/org/apache/wicket/examples/debug/InspectorBug.java
astubbs/wicket.get-portals2
6ceca0773ab057880643ba2bd87eb18855e04082
[ "Apache-2.0" ]
null
null
null
34.240741
100
0.741482
1,002,928
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.wicket.examples.debug; import org.apache.wicket.PageParameters; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.image.Image; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.panel.Panel; /** * A page that shows interesting attributes of the Wicket environment, including the current session * and the component tree for the current page. * * @author Jonathan Locke */ public final class InspectorBug extends Panel { private static final long serialVersionUID = 1L; /** * Constructor * * @param id * Component id * @param page * Page to inspect */ public InspectorBug(final String id, final WebPage page) { super(id); PageParameters parameters = new PageParameters(); parameters.put("pageId", page.getId()); Link link = new BookmarkablePageLink("link", InspectorPage.class, parameters); link.add(new Image("bug")); add(link); } }
9244397359dee7aa20961816120ee48521486aaf
1,360
java
Java
src/test/java/uk/co/malbec/machinery/consumers/PartitionByConsumerTest.java
robindevilliers/machinery
883f10d26f2d72e0b9eab7582579bd9e3b2a53a3
[ "Apache-2.0" ]
null
null
null
src/test/java/uk/co/malbec/machinery/consumers/PartitionByConsumerTest.java
robindevilliers/machinery
883f10d26f2d72e0b9eab7582579bd9e3b2a53a3
[ "Apache-2.0" ]
null
null
null
src/test/java/uk/co/malbec/machinery/consumers/PartitionByConsumerTest.java
robindevilliers/machinery
883f10d26f2d72e0b9eab7582579bd9e3b2a53a3
[ "Apache-2.0" ]
null
null
null
37.777778
144
0.733088
1,002,929
package uk.co.malbec.machinery.consumers; import org.junit.Test; import uk.co.malbec.machinery.collector.Scalar; import uk.co.malbec.machinery.partitions.DynamicCategoryGroup; import java.math.BigInteger; import java.util.function.Consumer; import static java.util.function.Function.identity; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; import static uk.co.malbec.machinery.Machinery.count; import static uk.co.malbec.machinery.Machinery.operation; public class PartitionByConsumerTest { @Test public void test() throws Exception { DynamicCategoryGroup<String, Scalar<BigInteger>> dynamicCategoryGroup = new DynamicCategoryGroup<>(() -> new Scalar<>(BigInteger.ZERO)); Consumer<String> stringConsumer = new PartitionByConsumer<>(identity(), String::equals, () -> dynamicCategoryGroup, operation(dynamicCategoryGroup::current, BigInteger::add, BigInteger.ONE, dynamicCategoryGroup::current) ); stringConsumer.accept("alpha"); stringConsumer.accept("alpha"); stringConsumer.accept("alpha"); stringConsumer.accept("beta"); stringConsumer.accept("beta"); assertThat(dynamicCategoryGroup.get("alpha").getValue().intValue(), is(3)); assertThat(dynamicCategoryGroup.get("beta").getValue().intValue(), is(2)); } }
92443988394e7832d66be2371ae182c094f7d736
615
java
Java
src/application/EnumSetApp.java
novaardiansyah/java-collections
3a769a2b8d875b75067d4a7732837a753dec70d4
[ "MIT" ]
null
null
null
src/application/EnumSetApp.java
novaardiansyah/java-collections
3a769a2b8d875b75067d4a7732837a753dec70d4
[ "MIT" ]
null
null
null
src/application/EnumSetApp.java
novaardiansyah/java-collections
3a769a2b8d875b75067d4a7732837a753dec70d4
[ "MIT" ]
null
null
null
21.964286
111
0.653659
1,002,930
package application; import java.util.EnumSet; import java.util.Set; public class EnumSetApp { public static enum Gender { MALE, FEMALE, NOT_MENTION; } public static void main(String[] args) { System.out.println(""); // ? Newline // Set<Gender> genders = EnumSet.allOf(Gender.class); Set<Gender> genders = EnumSet.of(Gender.FEMALE, Gender.MALE, Gender.FEMALE); // ? duplicate will be ignored for (var gender : genders) { System.out.println(gender); } Gender[] genders2 = Gender.values(); for (var gender : genders2) { System.out.println(gender); } } }
9244399a366eaace66be7a64dac74c82967ff445
1,614
java
Java
shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderFactoryTest.java
LeeGuoPing/shardingsphere
adf3ac02b53868b1933d1631ca879f7614478de1
[ "Apache-2.0" ]
4,372
2019-01-16T03:07:05.000Z
2020-04-17T11:16:15.000Z
shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderFactoryTest.java
LeeGuoPing/shardingsphere
adf3ac02b53868b1933d1631ca879f7614478de1
[ "Apache-2.0" ]
3,040
2019-01-16T01:18:40.000Z
2020-04-17T12:53:05.000Z
shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerBuilderFactoryTest.java
LeeGuoPing/shardingsphere
adf3ac02b53868b1933d1631ca879f7614478de1
[ "Apache-2.0" ]
1,515
2019-01-16T08:44:17.000Z
2020-04-17T09:07:53.000Z
41.384615
152
0.77943
1,002,931
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.mode.manager; import org.apache.shardingsphere.infra.config.mode.ModeConfiguration; import org.apache.shardingsphere.mode.manager.fixture.FixtureContextManagerBuilder; import org.junit.Test; import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertThat; public final class ContextManagerBuilderFactoryTest { @Test public void assertGetInstanceWithModeConfiguration() { assertThat(ContextManagerBuilderFactory.getInstance(new ModeConfiguration("Test", null, true)), instanceOf(FixtureContextManagerBuilder.class)); } @Test public void assertGetInstanceWithoutModeConfiguration() { assertThat(ContextManagerBuilderFactory.getInstance(null), instanceOf(FixtureContextManagerBuilder.class)); } }
92443aabc1389dcb7d7faabd34bde3c1898f603c
2,967
java
Java
app/src/main/java/me/zhouzhuo/zzletterssidebardemo/adapter/PersonRecyclerViewAdapter.java
zhouzhuo810/ZzLettersSideBar
d6b3594f7ea1ebb50ed5da0829503441ba919a07
[ "Apache-2.0" ]
26
2016-08-16T12:16:15.000Z
2021-01-28T09:14:28.000Z
app/src/main/java/me/zhouzhuo/zzletterssidebardemo/adapter/PersonRecyclerViewAdapter.java
zhouzhuo810/ZzLettersSideBar
d6b3594f7ea1ebb50ed5da0829503441ba919a07
[ "Apache-2.0" ]
1
2017-01-16T06:18:27.000Z
2017-01-18T03:16:18.000Z
app/src/main/java/me/zhouzhuo/zzletterssidebardemo/adapter/PersonRecyclerViewAdapter.java
zhouzhuo810/ZzLettersSideBar
d6b3594f7ea1ebb50ed5da0829503441ba919a07
[ "Apache-2.0" ]
8
2016-08-16T09:06:15.000Z
2018-06-07T02:57:51.000Z
29.376238
114
0.662622
1,002,932
package me.zhouzhuo.zzletterssidebardemo.adapter; import android.content.Context; import android.view.View; import android.widget.TextView; import java.util.List; import me.zhouzhuo.zzletterssidebar.adapter.BaseSortRecyclerViewAdapter; import me.zhouzhuo.zzletterssidebar.viewholder.BaseRecyclerViewHolder; import me.zhouzhuo.zzletterssidebardemo.R; import me.zhouzhuo.zzletterssidebardemo.entity.PersonEntity; /** * Created by zz on 2016/8/17. */ public class PersonRecyclerViewAdapter extends BaseSortRecyclerViewAdapter<PersonEntity, BaseRecyclerViewHolder> { public PersonRecyclerViewAdapter(Context ctx, List<PersonEntity> mDatas) { super(ctx, mDatas); } //return your itemView layoutRes id @Override public int getItemLayoutId() { return R.layout.list_item; } //add a header ,optional, if no need, return 0 @Override public int getHeaderLayoutId() { return R.layout.list_item_head; } //add a footer, optional, if no need, return 0 @Override public int getFooterLayoutId() { return R.layout.list_item_foot; } @Override public BaseRecyclerViewHolder getViewHolder(View itemView, int type) { switch (type) { case BaseSortRecyclerViewAdapter.TYPE_HEADER: return new HeaderHolder(itemView); case BaseSortRecyclerViewAdapter.TYPE_FOOT: return new FooterHolder(itemView); } return new MyViewHolder(itemView); } @Override public void onBindViewHolder(final BaseRecyclerViewHolder holder, final int position) { if (holder instanceof MyViewHolder) { //must add this final int mPos = position - getHeadViewSize(); if (mPos < mDatas.size()) { initLetter(holder, mPos); ((MyViewHolder) holder).tvName.setText(mDatas.get(mPos).getPersonName()); //add click event optional initClickListener(holder, mPos); } } else if (holder instanceof HeaderHolder) { } else if (holder instanceof FooterHolder) { ((FooterHolder) holder).tvFoot.setText(getContentCount() + "位联系人"); } } //custom your ViewHolder here public static class MyViewHolder extends BaseRecyclerViewHolder { protected TextView tvName; public MyViewHolder(View itemView) { super(itemView); tvName = (TextView) itemView.findViewById(R.id.list_item_tv_name); } } public static class HeaderHolder extends BaseRecyclerViewHolder { public HeaderHolder(View itemView) { super(itemView); } } public static class FooterHolder extends BaseRecyclerViewHolder { protected TextView tvFoot; public FooterHolder(View itemView) { super(itemView); tvFoot = (TextView) itemView.findViewById(R.id.tv_foot); } } }
92443bea3021ce437d12d5bb0bb6bb0eda06aa09
3,723
java
Java
modeltool/src/main/java/edu/cmu/sv/modelinference/modeltool/handlers/STLog2ModelHandler.java
coco-team/log2model
f908295c6ed68abc46959143eda5b71010f07c84
[ "Apache-2.0" ]
1
2016-06-08T14:47:23.000Z
2016-06-08T14:47:23.000Z
modeltool/src/main/java/edu/cmu/sv/modelinference/modeltool/handlers/STLog2ModelHandler.java
ksluckow/log2model
74dbbfe6c69a948b08bdd0f0f6a4501f8f1d8854
[ "Apache-2.0" ]
null
null
null
modeltool/src/main/java/edu/cmu/sv/modelinference/modeltool/handlers/STLog2ModelHandler.java
ksluckow/log2model
74dbbfe6c69a948b08bdd0f0f6a4501f8f1d8854
[ "Apache-2.0" ]
null
null
null
33.241071
117
0.732474
1,002,933
/** * Copyright 2016 Carnegie Mellon University * * 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 edu.cmu.sv.modelinference.modeltool.handlers; import java.io.IOException; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import edu.cmu.sv.modelinference.common.Util; import edu.cmu.sv.modelinference.common.api.LogHandler; import edu.cmu.sv.modelinference.common.api.LogProcessingException; import edu.cmu.sv.modelinference.common.formats.st.GridState; import edu.cmu.sv.modelinference.common.formats.st.STConfig; import edu.cmu.sv.modelinference.common.formats.st.STConfig.GridPartitions; import edu.cmu.sv.modelinference.common.formats.st.STModelInferer; import edu.cmu.sv.modelinference.common.model.Model; import edu.cmu.sv.modelinference.common.model.ModelInferer; /** * @author Kasper Luckow * */ public class STLog2ModelHandler implements LogHandler<Model<?>> { private static final Logger logger = LoggerFactory.getLogger(STLog2ModelHandler.class.getName()); private static final String GRID_DIM = "dim"; private static STLog2ModelHandler instance = null; public static STLog2ModelHandler getInstance() { if(instance == null) { instance = new STLog2ModelHandler(); } return instance; } private Options cmdOpts; private STLog2ModelHandler() { this.cmdOpts = createCmdOptions(); } private Options createCmdOptions() { Options options = new Options(); Option addOpts = Option.builder(GRID_DIM).argName("Grid Dimensions").hasArg() .desc("Dimensions of the grid projected on the airfield. Format: NUMxNUM.").build(); options.addOption(addOpts); return options; } @Override public String getHandlerName() { return STConfig.LOG_CONFIG_NAME; } @Override public Model<?> process(String logFile, String logType, String[] additionalCmdArgs) throws LogProcessingException { CommandLineParser parser = new DefaultParser(); CommandLine cmd = null; try { cmd = parser.parse(cmdOpts, additionalCmdArgs, false); } catch(ParseException exp) { logger.error(exp.getMessage()); System.err.println(exp.getMessage()); Util.printHelpAndExit(STLog2ModelHandler.class, cmdOpts); } Model<?> model = null; ModelInferer<GridState> modelInferer = null; if(cmd.hasOption(GRID_DIM)) { String partStr = cmd.getOptionValue(GRID_DIM).trim(); GridPartitions parts; try { parts = STConfig.extractGridPartitions(partStr); } catch (ParseException e) { throw new LogProcessingException(e); } modelInferer = new STModelInferer(parts.horiz, parts.vert); } else modelInferer = new STModelInferer(STModelInferer.DEF_PARTITIONS, STModelInferer.DEF_PARTITIONS); try { model = modelInferer.generateModel(logFile); } catch (IOException e) { throw new LogProcessingException(e); } return model; } }
92443caa72cdea34e4b030b11d6707620079a2d2
1,213
java
Java
graph-view/src/main/java/com/nfx/android/graph/androidgraph/SignalManagerInterface.java
nfxdevelopment/graph-view
ccfcb806929c446a33fa0fa0a8747eaf0739bce0
[ "Apache-2.0" ]
null
null
null
graph-view/src/main/java/com/nfx/android/graph/androidgraph/SignalManagerInterface.java
nfxdevelopment/graph-view
ccfcb806929c446a33fa0fa0a8747eaf0739bce0
[ "Apache-2.0" ]
1
2017-05-20T14:37:19.000Z
2017-05-20T14:37:19.000Z
graph-view/src/main/java/com/nfx/android/graph/androidgraph/SignalManagerInterface.java
nickwinder/graph-view
ccfcb806929c446a33fa0fa0a8747eaf0739bce0
[ "Apache-2.0" ]
null
null
null
27.568182
88
0.771641
1,002,934
package com.nfx.android.graph.androidgraph; import android.support.annotation.ColorInt; import android.support.annotation.Nullable; import com.nfx.android.graph.androidgraph.AxisScale.AxisParameters; import com.nfx.android.graph.graphbufferinput.InputListener; /** * NFX Development * Created by nick on 15/01/17. */ public interface SignalManagerInterface { void addSignal(int id, SignalBuffer signalBuffer, @ColorInt int color); InputListener addSignal(int id, int sizeOfBuffer, AxisParameters xAxisParameters, @ColorInt int color); boolean hasSignal(int id); void removeSignal(int id); HorizontalLabelPointer enableTriggerLevelPointer(int signalId, @ColorInt int color); @Nullable HorizontalLabelPointer getTriggerLevelPointer(int signalId); LabelPointer enableXAxisZeroIntersect(@ColorInt int colour); void disableXAxisZeroIntersect(); void enableYAxisIntercept(int signalId); void disableYAxisIntercept(int signalId); @Nullable SignalBuffer signalWithinCatchmentArea(float positionY); SignalBufferInterface getSignalBufferInterface(int signalId); MarkerManagerInterface getMarkerManagerInterface(); }
92443d7aeed4646952a6d1e893177ec9571d0c0a
11,917
java
Java
src/cef/messesinfo/ads/WebDialog.java
patou/messesinfoandroid
07449ec4d6fe8e4e96393345f3b675db6efeab81
[ "Apache-2.0" ]
1
2017-01-11T05:52:21.000Z
2017-01-11T05:52:21.000Z
src/cef/messesinfo/ads/WebDialog.java
patou/messesinfoandroid
07449ec4d6fe8e4e96393345f3b675db6efeab81
[ "Apache-2.0" ]
null
null
null
src/cef/messesinfo/ads/WebDialog.java
patou/messesinfoandroid
07449ec4d6fe8e4e96393345f3b675db6efeab81
[ "Apache-2.0" ]
null
null
null
35.573134
190
0.547705
1,002,935
//package cef.messesinfo.ads; // //import android.content.res.Resources; //import android.util.AttributeSet; //import android.util.Log; //import android.webkit.WebSettings; //import android.webkit.WebView; // //import java.io.UnsupportedEncodingException; //import java.net.URLEncoder; //import java.util.Random; // //public class WebDialog extends Dialog //{ // // static final int BLUE = 0xFF6D84B4; // static final float[] DIMENSIONS_DIFF_LANDSCAPE = // { 20, 60 }; // static final float[] DIMENSIONS_DIFF_PORTRAIT = // { 40, 60 }; // static final FrameLayout.LayoutParams FILL = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); // static final int MARGIN = 4; // static final int PADDING = 2; // static final String DISPLAY_STRING = "touch"; // // private String mUrl; //// private DialogListener mListener; // private WebView webView; // private LinearLayout mContent; // // private static final String HTML_DOCUMENT_TEMPLATE = "<html><head><style>* {padding: 0; margin: 0; background-color: transparent;}</style></head>\n" // + "<body>%s</body></html>"; // // private static final String IMG_TAG = "<a href='%1$s/ck.php?n=a186f406&amp;cb=%4$d' target='_blank'>\n" + // "<img src='%1$s/avw.php?zoneid=%2$d&amp;cb=%4$d&amp;n=a186f406&amp;charset=UTF-8' border='0' alt='' />\n" + // "</a>"; // // private String deliveryURL = "http://pub.cef.fr/script/www/delivery"; // // private String jsTagURL = "ajs.php"; // // private Integer zoneID; // // private boolean hasHTTPS = false; // // private String source; // // private Random prng = new Random(); // // private Resources res; // // public WebDialog(Context context, String url) // { // super(context); // mUrl = url; // } // // @Override // protected void onCreate(Bundle savedInstanceState) // { // super.onCreate(savedInstanceState); // mContent = new LinearLayout(getContext()); // mContent.setOrientation(LinearLayout.VERTICAL); // setUpWebView(); // Display display = getWindow().getWindowManager().getDefaultDisplay(); // final float scale = getContext().getResources().getDisplayMetrics().density; // int orientation = getContext().getResources().getConfiguration().orientation; // float[] dimensions = (orientation == Configuration.ORIENTATION_LANDSCAPE) ? DIMENSIONS_DIFF_LANDSCAPE : DIMENSIONS_DIFF_PORTRAIT; // addContentView(mContent, new LinearLayout.LayoutParams(display.getWidth() - ((int) (dimensions[0] * scale + 0.5f)), display.getHeight() - ((int) (dimensions[1] * scale + 0.5f)))); // } // // private void setUpWebView() // { // webView = new WebView(getContext()); // WebSettings settings = webView.getSettings(); // settings.setJavaScriptEnabled(true); // settings.setPluginsEnabled(true); // settings.setAllowFileAccess(false); // settings.setPluginState(WebSettings.PluginState.ON); // // webView.setBackgroundColor(0x00000000); // transparent // webView.setVerticalScrollBarEnabled(false); // webView.setHorizontalScrollBarEnabled(false); // webView.setWebChromeClient(new OpenXAdWebChromeClient()); // webView.setWebViewClient(new WebDialog.DialogWebViewClient()); // // System.out.println(" mURL = " + mUrl); // // webView.loadUrl(mUrl); // webView.setLayoutParams(FILL); // mContent.addView(webView); // } // // private class DialogWebViewClient extends WebViewClient // { // // @Override // public boolean shouldOverrideUrlLoading(WebView view, String url) // { // view.loadUrl(url); // // return true; // } // // @Override // public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) // { // super.onReceivedError(view, errorCode, description, failingUrl); // WebDialog.this.dismiss(); // } // // @Override // public void onPageStarted(WebView view, String url, Bitmap favicon) // { // super.onPageStarted(view, url, favicon); // mSpinner.show(); // } // // @Override // public void onPageFinished(WebView view, String url) // { // super.onPageFinished(view, url); // String title = webView.getTitle(); // if (title != null && title.length() > 0) // { // mTitle.setText(title); // } // mSpinner.dismiss(); // } // // } // // private void initWebView() { // WebSettings settings = webView.getSettings(); // settings.setJavaScriptEnabled(true); // settings.setPluginsEnabled(true); // settings.setAllowFileAccess(false); // settings.setPluginState(WebSettings.PluginState.ON); // // webView.setBackgroundColor(0x00000000); // transparent // webView.setVerticalScrollBarEnabled(false); // webView.setHorizontalScrollBarEnabled(false); // webView.setWebChromeClient(new OpenXAdWebChromeClient()); // // addView(webView); // } // // protected String getZoneTemplate(int zoneID) { // try { // String zoneTag = String.format(IMG_TAG, // (hasHTTPS ? "https://" : "http://") + deliveryURL + '/' + jsTagURL, // zoneID, // source == null ? "" : URLEncoder.encode(source, "utf-8"), // prng.nextLong()); // String raw = String.format(HTML_DOCUMENT_TEMPLATE, zoneTag); // return raw; // } // catch (UnsupportedEncodingException e) { // Log.wtf(LOGTAG, "UTF-8 not supported?!", e); // } // // return null; // } // // @Override // protected void onLayout(boolean changed, int left, int top, int right, // int bottom) { // webView.layout(left, top, right, bottom); // } // // @Override // protected void onFinishInflate() { // super.onFinishInflate(); // load(); // } // // /** // * Load ad from OpenX server using the parameters that were set previously. // * This will not work if the following minimum required parameters were not // * set: delivery_url and zone_id. // */ // public void load() { // if (zoneID != null) { // load(zoneID); // } // else { // Log.w(LOGTAG, "zoneID is empty"); // } // } // // /** // * Load ad from OpenX server using the parameters that were set previously // * and the supplied zoneID. This will not work if the required parameter // * delivery_url was not set. // * // * @see #load() // * @param zoneID ID of OpenX zone to load ads from. // */ // public void load(int zoneID) { // // check required parameters // if (deliveryURL != null) { // webView.loadDataWithBaseURL(null, getZoneTemplate(zoneID), "text/html", "utf-8", null); // } // else { // Log.w(LOGTAG, "deliveryURL is empty"); // } // } // // public String getDeliveryURL() { // return deliveryURL; // } // // /** // * The path to server and directory containing OpenX delivery scripts in the // * form servername/path. This parameter is required. Example: // * openx.example.com/delivery. // * // * @param deliveryURL // */ // public void setDeliveryURL(String deliveryURL) { // this.deliveryURL = deliveryURL; // } // // private void setDeliveryURL(AttributeSet attrs) { // int delivery_url = attrs.getAttributeResourceValue(ATTRS_NS, PARAMETER_DELIVERY_URL, -1); // if (delivery_url != -1) { // this.deliveryURL = res.getString(delivery_url); // } // else { // this.deliveryURL = attrs.getAttributeValue(ATTRS_NS, PARAMETER_DELIVERY_URL); // } // } // // public String getJsTagURL() { // return jsTagURL; // } // // /** // * The name of OpenX script that serves ad code for simple JavaScript type // * tag. Default: ajs.php. This parameter usually does not need to be // * changed. // * // * @param jsTagURL // */ // public void setJsTagURL(String jsTagURL) { // this.jsTagURL = jsTagURL; // } // // private void setJsTagURL(AttributeSet attrs) { // int js_tag_url_id = attrs.getAttributeResourceValue(ATTRS_NS, PARAMETER_JS_TAG_URL, -1); // if (js_tag_url_id != -1) { // this.jsTagURL = res.getString(js_tag_url_id); // } // else { // String js_tag_url = attrs.getAttributeValue(ATTRS_NS, PARAMETER_JS_TAG_URL); // if (js_tag_url != null) { // this.jsTagURL = js_tag_url; // } // } // } // // public Integer getZoneID() { // return zoneID; // } // // /** // * The ID of OpenX zone from which ads should be selected to display inside // * the widget. This parameter is required unless you use load(int) method. // * // * @param zoneID // */ // public void setZoneID(Integer zoneID) { // this.zoneID = zoneID; // } // // private void setZoneID(AttributeSet attrs) { // int zone_id_rs = attrs.getAttributeResourceValue(ATTRS_NS, PARAMETER_ZONE_ID, -1); // if (zone_id_rs != -1) { // this.zoneID = new Integer(res.getInteger(zone_id_rs)); // } // else { // int zone_id = attrs.getAttributeIntValue(ATTRS_NS, PARAMETER_ZONE_ID, -1); // if (zone_id != -1) { // this.zoneID = new Integer(zone_id); // } // } // } // // public boolean hasHTTPS() { // return hasHTTPS; // } // // /** // * Set this to true if ads should be served over HTTPS protocol. Default: // * false. // * // * @param hasHTTPS // */ // public void setHasHTTPS(boolean hasHTTPS) { // this.hasHTTPS = hasHTTPS; // } // // private void setHasHTTPS(AttributeSet attrs) { // int has_https = attrs.getAttributeResourceValue(ATTRS_NS, PARAMETER_HAS_HTTPS, -1); // if (has_https != -1) { // this.hasHTTPS = res.getBoolean(has_https); // } // else { // this.hasHTTPS = attrs.getAttributeBooleanValue(ATTRS_NS, PARAMETER_HAS_HTTPS, false); // } // } // // public String getSource() { // return source; // } // // /** // * This parameter can be used to target ads by its value. It is optional. // * // * @param source // */ // public void setSource(String source) { // this.source = source; // } // // private void setSource(AttributeSet attrs) { // int source_id = attrs.getAttributeResourceValue(ATTRS_NS, PARAMETER_SOURCE, -1); // if (source_id != -1) { // this.source = res.getString(source_id); // } // else { // this.source = attrs.getAttributeValue(ATTRS_NS, PARAMETER_SOURCE); // } // } //}
92443d8e0d47a23196a45f3f71d3da1d8ef846f5
806
java
Java
mall-product/src/main/java/com/firenay/mall/product/service/AttrGroupService.java
czy1024/luna-mall
7c7eff86b86427b9d750cf630a9822e11236cf2d
[ "Apache-2.0" ]
2
2021-06-08T12:32:56.000Z
2021-06-08T12:33:01.000Z
mall-product/src/main/java/com/firenay/mall/product/service/AttrGroupService.java
lunasaw/luna-mall
7c7eff86b86427b9d750cf630a9822e11236cf2d
[ "Apache-2.0" ]
null
null
null
mall-product/src/main/java/com/firenay/mall/product/service/AttrGroupService.java
lunasaw/luna-mall
7c7eff86b86427b9d750cf630a9822e11236cf2d
[ "Apache-2.0" ]
null
null
null
27.793103
81
0.800248
1,002,936
package com.firenay.mall.product.service; import com.baomidou.mybatisplus.extension.service.IService; import com.firenay.common.utils.PageUtils; import com.firenay.mall.product.entity.AttrGroupEntity; import com.firenay.mall.product.vo.AttrGroupWithAttrsVo; import com.firenay.mall.product.vo.SpuItemAttrGroup; import java.util.List; import java.util.Map; /** * 属性分组 * @author firenay * @email [email protected] * @date 2020-05-31 17:06:04 */ public interface AttrGroupService extends IService<AttrGroupEntity> { PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params, Long catelogId); List<AttrGroupWithAttrsVo> getAttrGroupWithAttrByCatelogId(Long catelogId); List<SpuItemAttrGroup> getAttrGroupWithAttrsBySpuId(Long spuId, Long catalogId); }
92443d9af0eeaa66a1358358d49abfac2b2aa084
2,685
java
Java
platform/lang-impl/src/com/intellij/packageDependencies/DefaultScopesProvider.java
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
null
null
null
platform/lang-impl/src/com/intellij/packageDependencies/DefaultScopesProvider.java
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
null
null
null
platform/lang-impl/src/com/intellij/packageDependencies/DefaultScopesProvider.java
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
1
2019-02-06T14:50:03.000Z
2019-02-06T14:50:03.000Z
32.349398
103
0.760894
1,002,937
/* * Copyright 2000-2016 JetBrains s.r.o. * * 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.intellij.packageDependencies; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; import com.intellij.psi.search.scope.NonProjectFilesScope; import com.intellij.psi.search.scope.ProjectFilesScope; import com.intellij.psi.search.scope.packageSet.CustomScopesProvider; import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx; import com.intellij.psi.search.scope.packageSet.NamedScope; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @author anna * @author Konstantin Bulenkov */ public class DefaultScopesProvider extends CustomScopesProviderEx { private final NamedScope myProblemsScope; private final Project myProject; private final List<NamedScope> myScopes; public static DefaultScopesProvider getInstance(Project project) { return Extensions.findExtension(CUSTOM_SCOPES_PROVIDER, project, DefaultScopesProvider.class); } public DefaultScopesProvider(@NotNull Project project) { myProject = project; NamedScope projectScope = new ProjectFilesScope(); NamedScope nonProjectScope = new NonProjectFilesScope(); myProblemsScope = new ProblemScope(project); myScopes = Arrays.asList(projectScope, getProblemsScope(), getAllScope(), nonProjectScope); } @Override @NotNull public List<NamedScope> getCustomScopes() { return myScopes; } @NotNull public NamedScope getProblemsScope() { return myProblemsScope; } @NotNull public List<NamedScope> getAllCustomScopes() { final List<NamedScope> scopes = new ArrayList<>(); for (CustomScopesProvider provider : Extensions.getExtensions(CUSTOM_SCOPES_PROVIDER, myProject)) { scopes.addAll(provider.getFilteredScopes()); } return scopes; } @Nullable public NamedScope findCustomScope(String name) { for (NamedScope scope : getAllCustomScopes()) { if (name.equals(scope.getName())) { return scope; } } return null; } }
92443de576ad751b014b379b4db1d9e0e20e0037
3,960
java
Java
gradle/wrapper/dists/gradle-1.12-all/4ff8jj5a73a7zgj5nnzv1ubq0/gradle-1.12/src/launcher/org/gradle/tooling/internal/provider/connection/AdaptedOperationParameters.java
bit-man/pushfish-android
5f4fcf56adf5a8cdb6f31d91c315bcd3b3dc93bc
[ "BSD-2-Clause" ]
158
2015-04-18T23:39:02.000Z
2021-07-01T18:28:29.000Z
gradle/wrapper/dists/gradle-1.12-all/4ff8jj5a73a7zgj5nnzv1ubq0/gradle-1.12/src/launcher/org/gradle/tooling/internal/provider/connection/AdaptedOperationParameters.java
bit-man/pushfish-android
5f4fcf56adf5a8cdb6f31d91c315bcd3b3dc93bc
[ "BSD-2-Clause" ]
31
2015-04-29T18:52:40.000Z
2020-06-29T19:25:24.000Z
gradle/wrapper/dists/gradle-1.12-all/4ff8jj5a73a7zgj5nnzv1ubq0/gradle-1.12/src/launcher/org/gradle/tooling/internal/provider/connection/AdaptedOperationParameters.java
bit-man/pushfish-android
5f4fcf56adf5a8cdb6f31d91c315bcd3b3dc93bc
[ "BSD-2-Clause" ]
32
2016-01-05T21:58:24.000Z
2021-06-21T21:56:34.000Z
30.461538
102
0.718434
1,002,938
/* * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gradle.tooling.internal.provider.connection; import org.gradle.api.logging.LogLevel; import org.gradle.tooling.internal.adapter.CompatibleIntrospector; import org.gradle.tooling.internal.protocol.BuildOperationParametersVersion1; import org.gradle.tooling.internal.protocol.InternalLaunchable; import org.gradle.tooling.internal.protocol.ProgressListenerVersion1; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; public class AdaptedOperationParameters implements ProviderOperationParameters { private final BuildOperationParametersVersion1 delegate; private final List<String> tasks; CompatibleIntrospector introspector; public AdaptedOperationParameters(BuildOperationParametersVersion1 operationParameters) { this(operationParameters, null); } public AdaptedOperationParameters(BuildOperationParametersVersion1 delegate, List<String> tasks) { this.delegate = delegate; this.introspector = new CompatibleIntrospector(delegate); this.tasks = tasks == null ? null : new LinkedList<String>(tasks); } public InputStream getStandardInput(InputStream defaultInput) { return maybeGet(defaultInput, "getStandardInput"); } public LogLevel getBuildLogLevel() { return new BuildLogLevelMixIn(this).getBuildLogLevel(); } public boolean getVerboseLogging(boolean defaultValue) { return introspector.getSafely(defaultValue, "getVerboseLogging"); } public File getJavaHome(File defaultJavaHome) { return maybeGet(defaultJavaHome, "getJavaHome"); } public List<String> getJvmArguments(List<String> defaultJvmArgs) { return maybeGet(defaultJvmArgs, "getJvmArguments"); } private <T> T maybeGet(T defaultValue, String methodName) { T out = introspector.getSafely(defaultValue, methodName); if (out == null) { return defaultValue; } return out; } public File getProjectDir() { return delegate.getProjectDir(); } public Boolean isSearchUpwards() { return delegate.isSearchUpwards(); } public File getGradleUserHomeDir() { return delegate.getGradleUserHomeDir(); } public Boolean isEmbedded() { return delegate.isEmbedded(); } public Integer getDaemonMaxIdleTimeValue() { return delegate.getDaemonMaxIdleTimeValue(); } public TimeUnit getDaemonMaxIdleTimeUnits() { return delegate.getDaemonMaxIdleTimeUnits(); } public long getStartTime() { return delegate.getStartTime(); } public OutputStream getStandardOutput() { return delegate.getStandardOutput(); } public OutputStream getStandardError() { return delegate.getStandardError(); } public ProgressListenerVersion1 getProgressListener() { return delegate.getProgressListener(); } public List<String> getArguments(List<String> defaultArguments) { return maybeGet(defaultArguments, "getArguments"); } public List<String> getTasks() { return tasks; } public List<InternalLaunchable> getLaunchables() { return maybeGet(null, "getLaunchables"); } }
92443e864e9de8ff6a685b31c1ab22ac3e65bc95
253
java
Java
src/main/java/com/mssql/Service/UserService.java
ChaitanyaMM/MSSQL
05466c8688366c98f58c32b1c8710f40d5ca55d0
[ "Apache-2.0" ]
null
null
null
src/main/java/com/mssql/Service/UserService.java
ChaitanyaMM/MSSQL
05466c8688366c98f58c32b1c8710f40d5ca55d0
[ "Apache-2.0" ]
null
null
null
src/main/java/com/mssql/Service/UserService.java
ChaitanyaMM/MSSQL
05466c8688366c98f58c32b1c8710f40d5ca55d0
[ "Apache-2.0" ]
null
null
null
13.315789
47
0.747036
1,002,939
package com.mssql.Service; import java.util.Map; import org.springframework.http.ResponseEntity; import com.mssql.Objects.User; public interface UserService { public User add(User user) ; public String sample(); public User get(int id); }
92443fdac4b5555c76b380d3bc4f72faec1a1cae
480
java
Java
Java/Java Fundamentals/02.Java OOP Basics - Jun 2018/05.02.Exercise Interfaces and Abstraction/src/p09CollectionHierarchy/MyList.java
mgpavlov/SoftUni
cef1a7e4e475c69bbeb7bfdcaf7b3e64c88d604c
[ "MIT" ]
1
2019-06-07T18:24:58.000Z
2019-06-07T18:24:58.000Z
Java/Java Fundamentals/02.Java OOP Basics - Jun 2018/05.02.Exercise Interfaces and Abstraction/src/p09CollectionHierarchy/MyList.java
mgpavlov/SoftUni
cef1a7e4e475c69bbeb7bfdcaf7b3e64c88d604c
[ "MIT" ]
null
null
null
Java/Java Fundamentals/02.Java OOP Basics - Jun 2018/05.02.Exercise Interfaces and Abstraction/src/p09CollectionHierarchy/MyList.java
mgpavlov/SoftUni
cef1a7e4e475c69bbeb7bfdcaf7b3e64c88d604c
[ "MIT" ]
1
2020-06-16T11:20:31.000Z
2020-06-16T11:20:31.000Z
17.777778
59
0.6125
1,002,940
package p09CollectionHierarchy; import java.util.BitSet; import java.util.List; public class MyList extends BaseCollection implements Used{ public MyList(List<String> list) { super(list); } @Override public String remove() { return super.list.remove(0); } @Override public int add(String ele) { super.list.add(0, ele); return 0; } @Override public int used() { return super.list.size(); } }
92443fe804b845d5e536e7ab28269cc279aaf3db
6,332
java
Java
src/main/java/org/trebol/config/SecurityConfig.java
trebol-ecommerce/spring-boot-backend
7e6e273eef417adbee1ced6970970791a903887c
[ "MIT" ]
4
2021-10-01T23:02:29.000Z
2022-02-13T04:08:03.000Z
src/main/java/org/trebol/config/SecurityConfig.java
trangntt-016/spring-boot-backend
7e6e273eef417adbee1ced6970970791a903887c
[ "MIT" ]
48
2021-09-28T16:56:02.000Z
2022-01-26T21:42:49.000Z
src/main/java/org/trebol/config/SecurityConfig.java
trangntt-016/spring-boot-backend
7e6e273eef417adbee1ced6970970791a903887c
[ "MIT" ]
5
2021-09-28T22:33:20.000Z
2022-03-15T18:47:42.000Z
42.496644
107
0.775111
1,002,941
/* * Copyright (c) 2022 The Trebol eCommerce Project * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the Software is furnished * to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package org.trebol.config; import io.jsonwebtoken.Claims; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.web.cors.CorsConfigurationSource; import org.trebol.exceptions.CorsMappingParseException; import org.trebol.jpa.entities.Customer; import org.trebol.jpa.services.GenericCrudJpaService; import org.trebol.pojo.CustomerPojo; import org.trebol.security.IAuthorizationHeaderParserService; import org.trebol.security.JwtGuestAuthenticationFilter; import org.trebol.security.JwtLoginAuthenticationFilter; import org.trebol.security.JwtTokenVerifierFilter; import javax.crypto.SecretKey; @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { private final UserDetailsService userDetailsService; private final SecretKey secretKey; private final SecurityProperties securityProperties; private final CorsProperties corsProperties; private final IAuthorizationHeaderParserService<Claims> jwtClaimsParserService; private final GenericCrudJpaService<CustomerPojo, Customer> customersService; @Autowired public SecurityConfig(UserDetailsService userDetailsService, SecretKey secretKey, SecurityProperties securityProperties, IAuthorizationHeaderParserService<Claims> jwtClaimsParserService, CorsProperties corsProperties, GenericCrudJpaService<CustomerPojo, Customer> customersService) { this.userDetailsService = userDetailsService; this.secretKey = secretKey; this.securityProperties = securityProperties; this.jwtClaimsParserService = jwtClaimsParserService; this.corsProperties = corsProperties; this.customersService = customersService; } @Override protected void configure(HttpSecurity http) throws Exception { http .headers() .frameOptions().sameOrigin() .and() .cors() .and() .csrf() .disable() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .addFilter( this.loginFilterForUrl("/public/login")) .addFilterAfter( this.guestFilterForUrl("/public/guest"), JwtLoginAuthenticationFilter.class) .addFilterAfter( new JwtTokenVerifierFilter(jwtClaimsParserService), JwtGuestAuthenticationFilter.class); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(daoAuthenticationProvider()); auth.inMemoryAuthentication() .withUser("guest") .password(passwordEncoder().encode("guest")) .authorities("checkout"); } @Bean public DaoAuthenticationProvider daoAuthenticationProvider() { DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); provider.setPasswordEncoder(passwordEncoder()); provider.setUserDetailsService(userDetailsService); return provider; } @Bean public CorsConfigurationSource corsConfigurationSource() throws CorsMappingParseException { return new CorsConfigurationSourceBuilder(corsProperties).build(); } @Bean public PasswordEncoder passwordEncoder() { int strength = securityProperties.getBcryptEncoderStrength(); return new BCryptPasswordEncoder(strength); } private UsernamePasswordAuthenticationFilter loginFilterForUrl(String url) throws Exception { JwtLoginAuthenticationFilter filter = new JwtLoginAuthenticationFilter( securityProperties, secretKey, super.authenticationManager()); filter.setFilterProcessesUrl(url); return filter; } private UsernamePasswordAuthenticationFilter guestFilterForUrl(String url) throws Exception { JwtGuestAuthenticationFilter filter = new JwtGuestAuthenticationFilter( securityProperties, secretKey, super.authenticationManager(), customersService); filter.setFilterProcessesUrl(url); return filter; } }
9244402ba2daa0b357b0f4501458ec8f3d2fdd26
743
java
Java
src/main/java/com/bow/utils/PropertiesUtil.java
williamxww/poplar
24ceff869d22b610b57f9d18b6b346e612714a7d
[ "MIT" ]
null
null
null
src/main/java/com/bow/utils/PropertiesUtil.java
williamxww/poplar
24ceff869d22b610b57f9d18b6b346e612714a7d
[ "MIT" ]
null
null
null
src/main/java/com/bow/utils/PropertiesUtil.java
williamxww/poplar
24ceff869d22b610b57f9d18b6b346e612714a7d
[ "MIT" ]
null
null
null
23.967742
68
0.734859
1,002,942
package com.bow.utils; import java.io.IOException; import java.io.StringReader; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; /** * @author wwxiang * @since 2017/12/28. */ public class PropertiesUtil { public static Properties parse(String content) throws IOException { StringReader reader = new StringReader(content); Properties properties = new Properties(); properties.load(reader); return properties; } public static Map<String, String> format(Properties props) { Map<String, String> result = new ConcurrentHashMap<>(); for (Object key : props.keySet()) { String keyStr = (String) key; result.put(keyStr, props.getProperty(keyStr)); } return result; } }
92444266387fdd29e834b15a58cd9638bf076d39
435
java
Java
CM5/Core/service-api/src/main/java/ru/intertrust/cm/core/business/api/schedule/ScheduleProcessor.java
InterTurstCo/ActiveFrame5
a042afd5297be9636656701e502918bdbd63ce80
[ "Apache-2.0" ]
4
2019-11-24T14:14:05.000Z
2021-03-30T14:35:30.000Z
CM5/Core/service-api/src/main/java/ru/intertrust/cm/core/business/api/schedule/ScheduleProcessor.java
InterTurstCo/ActiveFrame5
a042afd5297be9636656701e502918bdbd63ce80
[ "Apache-2.0" ]
4
2019-11-20T14:05:11.000Z
2021-12-06T16:59:54.000Z
CM5/Core/service-api/src/main/java/ru/intertrust/cm/core/business/api/schedule/ScheduleProcessor.java
InterTurstCo/ActiveFrame5
a042afd5297be9636656701e502918bdbd63ce80
[ "Apache-2.0" ]
2
2019-12-26T15:19:53.000Z
2022-03-27T11:01:41.000Z
21.75
70
0.733333
1,002,943
package ru.intertrust.cm.core.business.api.schedule; import java.util.concurrent.Future; import ru.intertrust.cm.core.business.api.dto.Id; /** * Интерфейс асинхронного класса выполняющего задания в пуле процессов * @author larin * */ public interface ScheduleProcessor { /** * Запуск выполнения периодического задания в пуле процессов * @return */ public Future<String> startAsync(Id taskExecutionId); }
9244429c4302bfd5309d88951ea217f9b6792260
10,599
java
Java
ole-app/olefs/src/main/java/org/kuali/rice/krms/impl/repository/RuleRepositoryServiceImpl.java
VU-libtech/OLE-INST
9f5efae4dfaf810fa671c6ac6670a6051303b43d
[ "ECL-2.0" ]
1
2017-01-26T03:50:56.000Z
2017-01-26T03:50:56.000Z
ole-app/olefs/src/main/java/org/kuali/rice/krms/impl/repository/RuleRepositoryServiceImpl.java
VU-libtech/OLE-INST
9f5efae4dfaf810fa671c6ac6670a6051303b43d
[ "ECL-2.0" ]
3
2020-11-16T20:28:08.000Z
2021-03-22T23:41:19.000Z
ole-app/olefs/src/main/java/org/kuali/rice/krms/impl/repository/RuleRepositoryServiceImpl.java
VU-libtech/OLE-INST
9f5efae4dfaf810fa671c6ac6670a6051303b43d
[ "ECL-2.0" ]
null
null
null
39.996226
148
0.735824
1,002,944
/** * Copyright 2005-2012 The Kuali Foundation * * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kuali.rice.krms.impl.repository; import org.apache.commons.lang.StringUtils; import org.kuali.rice.core.api.criteria.CriteriaLookupService; import org.kuali.rice.core.api.criteria.GenericQueryResults; import org.kuali.rice.core.api.criteria.Predicate; import org.kuali.rice.core.api.criteria.QueryByCriteria; import org.kuali.rice.krad.service.BusinessObjectService; import org.kuali.rice.krad.service.KRADServiceLocator; import org.kuali.rice.krms.api.repository.RuleRepositoryService; import org.kuali.rice.krms.api.repository.agenda.AgendaTreeDefinition; import org.kuali.rice.krms.api.repository.agenda.AgendaTreeRuleEntry; import org.kuali.rice.krms.api.repository.agenda.AgendaTreeSubAgendaEntry; import org.kuali.rice.krms.api.repository.context.ContextDefinition; import org.kuali.rice.krms.api.repository.context.ContextSelectionCriteria; import org.kuali.rice.krms.api.repository.rule.RuleDefinition; import org.kuali.rice.krms.impl.util.KrmsImplConstants.PropertyNames; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import static org.kuali.rice.core.api.criteria.PredicateFactory.*; /** * NOTE: This is a patched version of this class which fixes a bug in Rice 2.0.0 releated to execution of * an agenda with no rules. */ public class RuleRepositoryServiceImpl implements RuleRepositoryService { protected BusinessObjectService businessObjectService; private CriteriaLookupService criteriaLookupService; /** * This overridden method ... * * @see org.kuali.rice.krms.api.repository.RuleRepositoryService#selectContext(org.kuali.rice.krms.api.repository.context.ContextSelectionCriteria) */ @Override public ContextDefinition selectContext( ContextSelectionCriteria contextSelectionCriteria) { if (contextSelectionCriteria == null){ throw new IllegalArgumentException("selection criteria is null"); } if (StringUtils.isBlank(contextSelectionCriteria.getNamespaceCode())){ throw new IllegalArgumentException("selection criteria namespaceCode is null or blank"); } QueryByCriteria queryCriteria = buildQuery(contextSelectionCriteria); GenericQueryResults<ContextBo> results = getCriteriaLookupService().lookup(ContextBo.class, queryCriteria); List<ContextBo> resultBos = results.getResults(); //assuming 1 ? ContextDefinition result = null; if (resultBos != null) { if (resultBos.size() == 1) { ContextBo bo = resultBos.iterator().next(); return ContextBo.to(bo); } else throw new IllegalArgumentException("ambiguous qualifiers"); } return result; } @Override public AgendaTreeDefinition getAgendaTree(String agendaId) { if (StringUtils.isBlank(agendaId)){ throw new IllegalArgumentException("agenda id is null or blank"); } // Get agenda items from db, then build up agenda tree structure AgendaBo agendaBo = getBusinessObjectService().findBySinglePrimaryKey(AgendaBo.class, agendaId); String agendaItemId = agendaBo.getFirstItemId(); // walk thru the agenda items, building an agenda tree definition Builder along the way AgendaTreeDefinition.Builder myBuilder = AgendaTreeDefinition.Builder.create(); myBuilder.setAgendaId( agendaId ); if (agendaItemId != null) { myBuilder = walkAgendaItemTree(agendaItemId, myBuilder); } // build the agenda tree and return it return myBuilder.build(); } @Override public List<AgendaTreeDefinition> getAgendaTrees(List<String> agendaIds) { List<AgendaTreeDefinition> agendaTrees = new ArrayList<AgendaTreeDefinition>(); for (String agendaId : agendaIds){ agendaTrees.add( getAgendaTree(agendaId) ); } return Collections.unmodifiableList(agendaTrees); } @Override public RuleDefinition getRule(String ruleId) { if (StringUtils.isBlank(ruleId)){ return null; } RuleBo bo = getBusinessObjectService().findBySinglePrimaryKey(RuleBo.class, ruleId); return RuleBo.to(bo); } @Override public List<RuleDefinition> getRules(List<String> ruleIds) { if (ruleIds == null) throw new IllegalArgumentException("ruleIds must not be null"); // Fetch BOs List<RuleBo> bos = null; if (ruleIds.size() == 0) { bos = Collections.emptyList(); } else { QueryByCriteria.Builder qBuilder = QueryByCriteria.Builder.create(); List<Predicate> pList = new ArrayList<Predicate>(); qBuilder.setPredicates(in("id", ruleIds.toArray())); GenericQueryResults<RuleBo> results = getCriteriaLookupService().lookup(RuleBo.class, qBuilder.build()); bos = results.getResults(); } // Translate BOs ArrayList<RuleDefinition> rules = new ArrayList<RuleDefinition>(); for (RuleBo bo : bos) { RuleDefinition rule = RuleBo.to(bo); rules.add(rule); } return Collections.unmodifiableList(rules); } /** * Recursive method to create AgendaTreeDefinition builder * * */ private AgendaTreeDefinition.Builder walkAgendaItemTree(String agendaItemId, AgendaTreeDefinition.Builder builder){ //TODO: prevent circular, endless looping if (StringUtils.isBlank(agendaItemId)){ return null; } // Get AgendaItemDefinition Business Object from database // NOTE: if we read agendaItem one at a time from db. Could consider linking in OJB and getting all at once AgendaItemBo agendaItemBo = getBusinessObjectService().findBySinglePrimaryKey(AgendaItemBo.class, agendaItemId); // If Rule // TODO: validate that only either rule or subagenda, not both if (!StringUtils.isBlank( agendaItemBo.getRuleId() )){ // setup new rule entry builder AgendaTreeRuleEntry.Builder ruleEntryBuilder = AgendaTreeRuleEntry.Builder .create(agendaItemBo.getId(), agendaItemBo.getRuleId()); ruleEntryBuilder.setRuleId( agendaItemBo.getRuleId() ); ruleEntryBuilder.setAgendaItemId( agendaItemBo.getId() ); if (agendaItemBo.getWhenTrueId() != null){ // Go follow the true branch, creating AgendaTreeDefinintion Builder for the // true branch level AgendaTreeDefinition.Builder myBuilder = AgendaTreeDefinition.Builder.create(); myBuilder.setAgendaId( agendaItemBo.getAgendaId() ); ruleEntryBuilder.setIfTrue( walkAgendaItemTree(agendaItemBo.getWhenTrueId(),myBuilder)); } if (agendaItemBo.getWhenFalseId() != null){ // Go follow the false branch, creating AgendaTreeDefinintion Builder AgendaTreeDefinition.Builder myBuilder = AgendaTreeDefinition.Builder.create(); myBuilder.setAgendaId( agendaItemBo.getAgendaId() ); ruleEntryBuilder.setIfFalse( walkAgendaItemTree(agendaItemBo.getWhenFalseId(), myBuilder)); } // Build the Rule Entry and add it to the AgendaTreeDefinition builder builder.addRuleEntry( ruleEntryBuilder.build() ); } // if SubAgenda and a sub agenda tree entry if (!StringUtils.isBlank(agendaItemBo.getSubAgendaId())) { AgendaTreeSubAgendaEntry.Builder subAgendaEntryBuilder = AgendaTreeSubAgendaEntry.Builder.create(agendaItemBo.getId(), agendaItemBo.getSubAgendaId()); builder.addSubAgendaEntry( subAgendaEntryBuilder.build() ); } // if this agenda item has an "After Id", follow that branch if (!StringUtils.isBlank( agendaItemBo.getAlwaysId() )){ builder = walkAgendaItemTree( agendaItemBo.getAlwaysId(), builder); } return builder; } /** * * This method converts a {@link org.kuali.rice.krms.api.repository.context.ContextSelectionCriteria} object into a * {@link org.kuali.rice.core.api.criteria.QueryByCriteria} object with the proper predicates for AttributeBo properties. * * @param selectionCriteria * @return */ private QueryByCriteria buildQuery( ContextSelectionCriteria selectionCriteria ){ Predicate p; QueryByCriteria.Builder qBuilder = QueryByCriteria.Builder.create(); List<Predicate> pList = new ArrayList<Predicate>(); if (selectionCriteria.getNamespaceCode() != null){ p = equal(PropertyNames.Context.NAMESPACE, selectionCriteria.getNamespaceCode()); pList.add(p); } if (selectionCriteria.getName() != null){ p = equal(PropertyNames.Context.NAME, selectionCriteria.getName()); pList.add(p); } if (selectionCriteria.getContextQualifiers() != null){ for (Map.Entry<String, String> entry : selectionCriteria.getContextQualifiers().entrySet()){ p = and(equal(PropertyNames.Context.ATTRIBUTE_BOS + "." + PropertyNames.BaseAttribute.ATTRIBUTE_DEFINITION + "." + PropertyNames.KrmsAttributeDefinition.NAME, entry.getKey()), equal(PropertyNames.Context.ATTRIBUTE_BOS + "." + PropertyNames.BaseAttribute.VALUE, entry.getValue())); pList.add(p); } } Predicate[] preds = new Predicate[pList.size()]; pList.toArray(preds); qBuilder.setPredicates(and(preds)); return qBuilder.build(); } /** * Sets the businessObjectService property. * * @param businessObjectService The businessObjectService to set. */ public void setBusinessObjectService(final BusinessObjectService businessObjectService) { this.businessObjectService = businessObjectService; } protected BusinessObjectService getBusinessObjectService() { if ( businessObjectService == null ) { // TODO: inject this instead businessObjectService = KRADServiceLocator.getBusinessObjectService(); } return businessObjectService; } /** * Sets the criteriaLookupService attribute value. * * @param criteriaLookupService The criteriaLookupService to set. */ public void setCriteriaLookupService(final CriteriaLookupService criteriaLookupService) { this.criteriaLookupService = criteriaLookupService; } protected CriteriaLookupService getCriteriaLookupService() { return criteriaLookupService; } }
924443ace4d34d72e8f0dec4f651de73a9d4847e
9,722
java
Java
rif4j-integration-test/src/test/java/at/sti2/rif4j/test/suite/DocumentType.java
semantalytics/rif4j
9100ebb095a043dbfb583ffd6a29fdc89b25d1df
[ "Apache-2.0" ]
null
null
null
rif4j-integration-test/src/test/java/at/sti2/rif4j/test/suite/DocumentType.java
semantalytics/rif4j
9100ebb095a043dbfb583ffd6a29fdc89b25d1df
[ "Apache-2.0" ]
null
null
null
rif4j-integration-test/src/test/java/at/sti2/rif4j/test/suite/DocumentType.java
semantalytics/rif4j
9100ebb095a043dbfb583ffd6a29fdc89b25d1df
[ "Apache-2.0" ]
null
null
null
29.730887
125
0.521292
1,002,945
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2010.12.15 at 06:35:01 PM MEZ // package at.sti2.rif4j.test.suite; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import at.sti2.rif4j.test.suite.DocumentType; import at.sti2.rif4j.test.suite.NSyntaxType; import at.sti2.rif4j.test.suite.PSyntaxType; /** * <p>Java class for documentType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="documentType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Normative"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="remote" type="{http://www.w3.org/2001/XMLSchema}anyURI" maxOccurs="unbounded"/> * &lt;/sequence> * &lt;attribute name="syntax" type="{http://www.w3.org/2009/10/rif-test#}nSyntaxType" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;element name="Presentation" maxOccurs="unbounded" minOccurs="0"> * &lt;complexType> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string"> * &lt;attribute name="syntax" use="required" type="{http://www.w3.org/2009/10/rif-test#}pSyntaxType" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "documentType", propOrder = { "normative", "presentation" }) public class DocumentType { @XmlElement(name = "Normative", required = true) protected DocumentType.Normative normative; @XmlElement(name = "Presentation") protected List<DocumentType.Presentation> presentation; /** * Gets the value of the normative property. * * @return * possible object is * {@link DocumentType.Normative } * */ public DocumentType.Normative getNormative() { return normative; } /** * Sets the value of the normative property. * * @param value * allowed object is * {@link DocumentType.Normative } * */ public void setNormative(DocumentType.Normative value) { this.normative = value; } /** * Gets the value of the presentation property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the presentation property. * * <p> * For example, to add a new item, do as follows: * <pre> * getPresentation().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DocumentType.Presentation } * * */ public List<DocumentType.Presentation> getPresentation() { if (presentation == null) { presentation = new ArrayList<DocumentType.Presentation>(); } return this.presentation; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="remote" type="{http://www.w3.org/2001/XMLSchema}anyURI" maxOccurs="unbounded"/> * &lt;/sequence> * &lt;attribute name="syntax" type="{http://www.w3.org/2009/10/rif-test#}nSyntaxType" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "name", "remote" }) public static class Normative { @XmlElement(required = true) protected String name; @XmlElement(required = true) @XmlSchemaType(name = "anyURI") protected List<String> remote; @XmlAttribute protected NSyntaxType syntax; /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } /** * Gets the value of the remote property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the remote property. * * <p> * For example, to add a new item, do as follows: * <pre> * getRemote().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getRemote() { if (remote == null) { remote = new ArrayList<String>(); } return this.remote; } /** * Gets the value of the syntax property. * * @return * possible object is * {@link NSyntaxType } * */ public NSyntaxType getSyntax() { return syntax; } /** * Sets the value of the syntax property. * * @param value * allowed object is * {@link NSyntaxType } * */ public void setSyntax(NSyntaxType value) { this.syntax = value; } } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string"> * &lt;attribute name="syntax" use="required" type="{http://www.w3.org/2009/10/rif-test#}pSyntaxType" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "value" }) public static class Presentation { @XmlValue protected String value; @XmlAttribute(required = true) protected PSyntaxType syntax; /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the syntax property. * * @return * possible object is * {@link PSyntaxType } * */ public PSyntaxType getSyntax() { return syntax; } /** * Sets the value of the syntax property. * * @param value * allowed object is * {@link PSyntaxType } * */ public void setSyntax(PSyntaxType value) { this.syntax = value; } } }
9244448447821acbca4be4baa6c27eab6c36f307
1,375
java
Java
pear-modules/pear-system/src/main/java/top/codezx/system/mapper/SysPlaceMapper.java
CodeDrawing/City-Sport-Manage-Platform
9e3e765a8bb900daf3ec2516e446d0ed3e4bc029
[ "MIT" ]
1
2022-01-19T03:09:21.000Z
2022-01-19T03:09:21.000Z
pear-modules/pear-system/src/main/java/top/codezx/system/mapper/SysPlaceMapper.java
CodeDrawing/City-Sport-Manage-Platform
9e3e765a8bb900daf3ec2516e446d0ed3e4bc029
[ "MIT" ]
1
2022-01-24T03:19:26.000Z
2022-01-24T03:19:26.000Z
pear-modules/pear-system/src/main/java/top/codezx/system/mapper/SysPlaceMapper.java
CodeDrawing/City-Sport-Manage-Platform
9e3e765a8bb900daf3ec2516e446d0ed3e4bc029
[ "MIT" ]
null
null
null
23.305085
68
0.708364
1,002,946
package top.codezx.system.mapper; import org.apache.ibatis.annotations.Mapper; import top.codezx.system.domain.SysArrivalInfo; import top.codezx.system.domain.SysPlace; import top.codezx.system.domain.SysUser; import java.util.Date; import java.util.List; @Mapper public interface SysPlaceMapper { /** * 获取场馆信息 * @param param * @return 场馆列表 */ List<SysPlace> selectList(SysPlace param); /** * 根据用户名来获取用户信息 * @param username * @return */ SysUser arrivalLogin(String username); SysArrivalInfo alreadyHaveTheDate(String date,String placeName); // 数据库中没有今天该场所的信息,那么就使用这个方法进行添加记录 int insertArrivalInfo(SysArrivalInfo sysArrivalInfo); /** * 年龄 * @param sysArrivalInfo * @return */ int updateUnder18(SysArrivalInfo sysArrivalInfo); int updateUnder18To30(SysArrivalInfo sysArrivalInfo); int updateUnder31To60(SysArrivalInfo sysArrivalInfo); int updateAbove61(SysArrivalInfo sysArrivalInfo); /** * 性别 * @param * @return */ int updateManNumber(SysArrivalInfo sysArrivalInfo); int updateWomanNumber(SysArrivalInfo sysArrivalInfo); SysPlace selectById(String placeId); boolean insert(SysPlace sysPlace); boolean deleteById(String placeId); boolean deleteByIds(String[] ids); boolean updateById(SysPlace sysPlace); }
924444ea7bffde93d8715414d4324f6043fb1548
3,384
java
Java
src/test/java/org/apache/ibatis/submitted/language/VelocitySqlSource.java
yangfancoming/mybatis
7cd9c6093a608a0e0da32155e75d1fddd090c8d5
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/test/java/org/apache/ibatis/submitted/language/VelocitySqlSource.java
yangfancoming/mybatis
7cd9c6093a608a0e0da32155e75d1fddd090c8d5
[ "ECL-2.0", "Apache-2.0" ]
2
2021-12-10T01:18:31.000Z
2021-12-14T21:27:31.000Z
src/test/java/org/apache/ibatis/submitted/language/VelocitySqlSource.java
yangfancoming/mybatis
7cd9c6093a608a0e0da32155e75d1fddd090c8d5
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
35.25
105
0.742317
1,002,947
package org.apache.ibatis.submitted.language; import org.apache.ibatis.builder.BuilderException; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.SqlSource; import org.apache.ibatis.session.Configuration; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.RuntimeSingleton; import org.apache.velocity.runtime.parser.node.SimpleNode; import java.io.StringReader; import java.io.StringWriter; import java.util.HashMap; import java.util.Map; /** * Just a test case. Not a real Velocity implementation. */ public class VelocitySqlSource implements SqlSource { public static final String PARAMETER_OBJECT_KEY = "_parameter"; public static final String DATABASE_ID_KEY = "_databaseId"; private final Configuration configuration; private final Template script; static { Velocity.setProperty("runtime.log", "target/velocity.log"); Velocity.init(); } public VelocitySqlSource(Configuration configuration, String scriptText) { this.configuration = configuration; try { RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices(); StringReader reader = new StringReader(scriptText); Template template = new Template(); template.setName("Template name"); SimpleNode node = runtimeServices.parse(reader, template); script = new Template(); script.setRuntimeServices(runtimeServices); script.setData(node); script.initDocument(); } catch (Exception ex) { throw new BuilderException("Error parsing velocity script", ex); } } @Override public BoundSql getBoundSql(Object parameterObject) { Map<String, Object> bindings = createBindings(parameterObject, configuration); VelocityContext context = new VelocityContext(bindings); StringWriter sw = new StringWriter(); script.merge(context, sw); VelocitySqlSourceBuilder sqlSourceParser = new VelocitySqlSourceBuilder(configuration); Class<?> parameterType = parameterObject == null ? Object.class : parameterObject.getClass(); SqlSource sqlSource = sqlSourceParser.parse(sw.toString(), parameterType); BoundSql boundSql = sqlSource.getBoundSql(parameterObject); for (Map.Entry<String, Object> entry : bindings.entrySet()) { boundSql.setAdditionalParameter(entry.getKey(), entry.getValue()); } return boundSql; } public static Map<String, Object> createBindings(Object parameterObject, Configuration configuration) { Map<String, Object> bindings = new HashMap<>(); bindings.put(PARAMETER_OBJECT_KEY, parameterObject); bindings.put(DATABASE_ID_KEY, configuration.getDatabaseId()); bindings.put("it", new IteratorParameter(bindings)); return bindings; } public static class IteratorParameter { private static final String PREFIX = "__frch_"; private int count = 0; private final Map<String, Object> bindings; public IteratorParameter(Map<String, Object> bindings) { this.bindings = bindings; } public String next(Object prop) { StringBuilder sb = new StringBuilder(); String name = sb.append(PREFIX).append("_ITEM").append("_").append(count++).toString(); bindings.put(name, prop); return name; } } }
924444ebfedf499f9ad974e57f6a82bbaf686515
1,117
java
Java
eclipse-workspace/DDD/src/aula3/Funcionario.java
yujinishioka/domain-driven-design
f42224f255546d5ee11c1c77ec1e7ae581f06068
[ "MIT" ]
1
2022-03-08T21:59:52.000Z
2022-03-08T21:59:52.000Z
eclipse-workspace/DDD/src/aula3/Funcionario.java
yujinishioka/domain-driven-design
f42224f255546d5ee11c1c77ec1e7ae581f06068
[ "MIT" ]
null
null
null
eclipse-workspace/DDD/src/aula3/Funcionario.java
yujinishioka/domain-driven-design
f42224f255546d5ee11c1c77ec1e7ae581f06068
[ "MIT" ]
null
null
null
16.924242
51
0.710833
1,002,948
package aula3; public class Funcionario { // atributos private int idFuncionario; private String nome; private String departamento; private double salario; private String admissao; private String rg; // metodos: getters e setters public int getIdFuncionario() { return idFuncionario; } public void setIdFuncionario(int idFuncionario) { this.idFuncionario = idFuncionario; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getDepartamento() { return departamento; } public void setDepartamento(String departamento) { this.departamento = departamento; } public double getSalario() { return salario; } public void setSalario(double salario) { this.salario = salario; } public String getAdmissao() { return admissao; } public void setAdmissao(String admissao) { this.admissao = admissao; } public String getRg() { return rg; } public void setRg(String rg) { this.rg = rg; } public double aumentarSalario(double aumento) { salario = salario + aumento; return salario; } }
92444671a789d34976fd153543de793d37b9d1ab
1,991
java
Java
banco_lab_v/src/com/bank/model/CustomerModel.java
Jukoleda/labv_banco
68ec428e94a65dcfc14b40847f80aa0408a6cd3b
[ "MIT" ]
null
null
null
banco_lab_v/src/com/bank/model/CustomerModel.java
Jukoleda/labv_banco
68ec428e94a65dcfc14b40847f80aa0408a6cd3b
[ "MIT" ]
null
null
null
banco_lab_v/src/com/bank/model/CustomerModel.java
Jukoleda/labv_banco
68ec428e94a65dcfc14b40847f80aa0408a6cd3b
[ "MIT" ]
null
null
null
20.957895
109
0.704169
1,002,949
package com.bank.model; public class CustomerModel { /* `IdCustomer` INT NOT NULL AUTO_INCREMENT, `FirstName` VARCHAR(45) NULL, `LastName` VARCHAR(45) NULL, `TypeId` INT NOT NULL, `IdNumber` VARCHAR(20) NOT NULL, `Email` VARCHAR(45) NULL, `Pass` VARCHAR(45) NULL, `IsAdmin` BOOLEAN DEFAULT 0, PRIMARY KEY (`IdCustomer`)) */ private int idCustomer; private String firstName; private String lastName; private TypeIdModel typeId; private String idNumber; private String email; private String pass; private boolean idAdmin; public CustomerModel() { super(); } public CustomerModel(int idCustomer, String firstName, String lastName, TypeIdModel typeId, String idNumber, String email, String pass, boolean idAdmin) { super(); this.idCustomer = idCustomer; this.firstName = firstName; this.lastName = lastName; this.typeId = typeId; this.idNumber = idNumber; this.email = email; this.pass = pass; this.idAdmin = idAdmin; } public int getIdCustomer() { return idCustomer; } public void setIdCustomer(int idCustomer) { this.idCustomer = idCustomer; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public TypeIdModel getTypeId() { return typeId; } public void setTypeId(TypeIdModel typeId) { this.typeId = typeId; } public String getIdNumber() { return idNumber; } public void setIdNumber(String idNumber) { this.idNumber = idNumber; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPass() { return pass; } public void setPass(String pass) { this.pass = pass; } public boolean isIdAdmin() { return idAdmin; } public void setIdAdmin(boolean idAdmin) { this.idAdmin = idAdmin; } }
924446c0aa890641b5c93e5ea7a62b1f120e694a
377
java
Java
src/main/java/com/example/application/service/exceptions/DatabaseLayerException.java
L0chus/n42_old
3346d4e80450bca011f5c07e907765925d75c47e
[ "Unlicense" ]
null
null
null
src/main/java/com/example/application/service/exceptions/DatabaseLayerException.java
L0chus/n42_old
3346d4e80450bca011f5c07e907765925d75c47e
[ "Unlicense" ]
null
null
null
src/main/java/com/example/application/service/exceptions/DatabaseLayerException.java
L0chus/n42_old
3346d4e80450bca011f5c07e907765925d75c47e
[ "Unlicense" ]
null
null
null
20.944444
55
0.671088
1,002,950
package com.example.application.service.exceptions; public class DatabaseLayerException extends Throwable { private String reason = null; public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public DatabaseLayerException( String reason ) { this.reason = reason; } }
9244476f127d062c2a839250d8e1dbfac7bcf6ab
543
java
Java
dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticEntity.java
RidaFathi/Java-webapp
888343aff869806b5eceb76a2d2f9ec62e2c9d83
[ "Apache-2.0" ]
32
2015-08-11T21:44:38.000Z
2021-05-06T13:48:59.000Z
dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticEntity.java
RidaFathi/Java-webapp
888343aff869806b5eceb76a2d2f9ec62e2c9d83
[ "Apache-2.0" ]
125
2015-09-09T09:07:35.000Z
2021-06-10T12:04:35.000Z
dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticEntity.java
RidaFathi/Java-webapp
888343aff869806b5eceb76a2d2f9ec62e2c9d83
[ "Apache-2.0" ]
36
2015-09-01T16:57:52.000Z
2021-05-21T19:10:56.000Z
21.72
63
0.740331
1,002,951
package com.sdl.webapp.common.api.mapping.semantic.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * <p>SemanticEntity class.</p> */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SemanticEntity { String entityName() default ""; String value() default ""; String vocabulary() default ""; String prefix() default ""; boolean public_() default false; }
924447be956011fceb641eb9ac355e163a9b90ee
6,513
java
Java
station-renderer-api-v0/src/main/java/net/modificationstation/stationapi/api/client/render/model/json/ModelOverrideList.java
paulevsGitch/StationAPI
c74957e4badec0cf4460f7d2787f64e79b20e793
[ "MIT" ]
18
2019-02-15T18:08:12.000Z
2020-12-13T20:09:36.000Z
station-renderer-api-v0/src/main/java/net/modificationstation/stationapi/api/client/render/model/json/ModelOverrideList.java
paulevsGitch/StationAPI
c74957e4badec0cf4460f7d2787f64e79b20e793
[ "MIT" ]
6
2020-06-12T09:47:33.000Z
2020-11-27T15:36:23.000Z
station-renderer-api-v0/src/main/java/net/modificationstation/stationapi/api/client/render/model/json/ModelOverrideList.java
paulevsGitch/StationAPI
c74957e4badec0cf4460f7d2787f64e79b20e793
[ "MIT" ]
5
2019-03-17T09:51:23.000Z
2020-11-26T23:36:39.000Z
46.521429
168
0.682021
1,002,952
package net.modificationstation.stationapi.api.client.render.model.json; import com.google.common.collect.Lists; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.BlockBase; import net.minecraft.entity.Living; import net.minecraft.item.ItemBase; import net.minecraft.item.ItemInstance; import net.minecraft.level.BlockView; import net.minecraft.util.maths.TilePos; import net.modificationstation.stationapi.api.block.BlockState; import net.modificationstation.stationapi.api.client.model.block.BlockModelPredicateProvider; import net.modificationstation.stationapi.api.client.model.item.ItemModelPredicateProvider; import net.modificationstation.stationapi.api.client.registry.BlockModelPredicateProviderRegistry; import net.modificationstation.stationapi.api.client.registry.ItemModelPredicateProviderRegistry; import net.modificationstation.stationapi.api.client.render.model.BakedModel; import net.modificationstation.stationapi.api.client.render.model.ModelBakeRotation; import net.modificationstation.stationapi.api.client.render.model.ModelLoader; import net.modificationstation.stationapi.api.client.render.model.UnbakedModel; import net.modificationstation.stationapi.api.registry.Identifier; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Function; @Environment(EnvType.CLIENT) public class ModelOverrideList { public static final ModelOverrideList EMPTY = new ModelOverrideList(); private final BakedOverride[] overrides; private final Identifier[] conditionTypes; private ModelOverrideList() { this.overrides = new BakedOverride[0]; this.conditionTypes = new Identifier[0]; } public ModelOverrideList(ModelLoader modelLoader, JsonUnbakedModel parent, Function<Identifier, UnbakedModel> unbakedModelGetter, List<ModelOverride> overrides) { this.conditionTypes = overrides.stream().flatMap(ModelOverride::streamConditions).map(ModelOverride.Condition::getType).distinct().toArray(Identifier[]::new); Object2IntOpenHashMap<Identifier> object2IntMap = new Object2IntOpenHashMap<>(); for (int i = 0; i < this.conditionTypes.length; ++i) { object2IntMap.put(this.conditionTypes[i], i); } ArrayList<BakedOverride> list = Lists.newArrayList(); for (int j = overrides.size() - 1; j >= 0; --j) { ModelOverride modelOverride = overrides.get(j); BakedModel bakedModel = this.bakeOverridingModel(modelLoader, parent, unbakedModelGetter, modelOverride); InlinedCondition[] inlinedConditions = modelOverride.streamConditions().map(condition -> { int i = object2IntMap.getInt(condition.getType()); return new InlinedCondition(i, condition.getThreshold()); }).toArray(InlinedCondition[]::new); list.add(new BakedOverride(inlinedConditions, bakedModel)); } this.overrides = list.toArray(new BakedOverride[0]); } @Nullable private BakedModel bakeOverridingModel(ModelLoader loader, JsonUnbakedModel parent, Function<Identifier, UnbakedModel> unbakedModelGetter, ModelOverride override) { UnbakedModel unbakedModel = unbakedModelGetter.apply(override.getModelId()); if (Objects.equals(unbakedModel, parent)) { return null; } return loader.bake(override.getModelId(), ModelBakeRotation.X0_Y0); } @Nullable public BakedModel apply(BakedModel model, BlockState state, @Nullable BlockView world, @Nullable TilePos pos, int seed) { if (this.overrides.length != 0) { BlockBase block = state.getBlock(); int i = this.conditionTypes.length; float[] fs = new float[i]; for (int j = 0; j < i; ++j) { Identifier identifier = this.conditionTypes[j]; BlockModelPredicateProvider modelPredicateProvider = BlockModelPredicateProviderRegistry.INSTANCE.get(block, identifier); fs[j] = modelPredicateProvider != null ? modelPredicateProvider.call(state, world, pos, seed) : Float.NEGATIVE_INFINITY; } for (BakedOverride bakedOverride : this.overrides) { if (!bakedOverride.test(fs)) continue; BakedModel bakedModel = bakedOverride.model; if (bakedModel == null) { return model; } return bakedModel; } } return model; } @Nullable public BakedModel apply(BakedModel model, ItemInstance stack, @Nullable BlockView world, @Nullable Living entity, int seed) { if (this.overrides.length != 0) { ItemBase item = stack.getType(); int i = this.conditionTypes.length; float[] fs = new float[i]; for (int j = 0; j < i; ++j) { Identifier identifier = this.conditionTypes[j]; ItemModelPredicateProvider modelPredicateProvider = ItemModelPredicateProviderRegistry.INSTANCE.get(item, identifier); fs[j] = modelPredicateProvider != null ? modelPredicateProvider.call(stack, world, entity, seed) : Float.NEGATIVE_INFINITY; } for (BakedOverride bakedOverride : this.overrides) { if (!bakedOverride.test(fs)) continue; BakedModel bakedModel = bakedOverride.model; if (bakedModel == null) { return model; } return bakedModel; } } return model; } @SuppressWarnings("ClassCanBeRecord") @Environment(EnvType.CLIENT) static class BakedOverride { private final InlinedCondition[] conditions; @Nullable final BakedModel model; BakedOverride(InlinedCondition[] conditions, @Nullable BakedModel model) { this.conditions = conditions; this.model = model; } boolean test(float[] values) { for (InlinedCondition inlinedCondition : this.conditions) { float f = values[inlinedCondition.index]; if (!(f < inlinedCondition.threshold)) continue; return false; } return true; } } @Environment(EnvType.CLIENT) record InlinedCondition(int index, float threshold) { } }
9244482c65164bf766d545960e3d78f8ec4f846a
825
java
Java
TreeQueryNodeGrpc/src/main/java/org/treequery/grpc/controller/HealthCheckGrpcController.java
dexterchan/TreeQuery
74882ed0793198d1f81617df728740d7afe8d813
[ "Apache-2.0" ]
null
null
null
TreeQueryNodeGrpc/src/main/java/org/treequery/grpc/controller/HealthCheckGrpcController.java
dexterchan/TreeQuery
74882ed0793198d1f81617df728740d7afe8d813
[ "Apache-2.0" ]
6
2020-04-15T03:47:33.000Z
2020-09-06T11:03:04.000Z
TreeQueryNodeGrpc/src/main/java/org/treequery/grpc/controller/HealthCheckGrpcController.java
dexterchan/TreeQuery
74882ed0793198d1f81617df728740d7afe8d813
[ "Apache-2.0" ]
1
2020-07-09T06:57:41.000Z
2020-07-09T06:57:41.000Z
41.25
128
0.804848
1,002,953
package org.treequery.grpc.controller; import io.grpc.stub.StreamObserver; import lombok.extern.slf4j.Slf4j; import org.treequery.proto.HealthCheckRequest; import org.treequery.proto.HealthCheckResponse; import org.treequery.proto.HealthCheckServiceGrpc; import org.treequery.proto.TreeQueryServiceGrpc; @Slf4j public class HealthCheckGrpcController extends HealthCheckServiceGrpc.HealthCheckServiceImplBase{ @Override public void check(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver) { log.info(String.format("health check request %s",request.toString())); HealthCheckResponse res = HealthCheckResponse.newBuilder().setStatus(HealthCheckResponse.ServingStatus.SERVING).build(); responseObserver.onNext(res); responseObserver.onCompleted(); } }
92444860160beb3265b6d411b44e16f495c3dc4c
4,827
java
Java
fsdevtools-sharedutils/src/main/java/com/espirit/moddev/util/FileUtil.java
cr4igo/FSDevTools
624b890301c18ea8e8942ac8d2c051ee074320cb
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
fsdevtools-sharedutils/src/main/java/com/espirit/moddev/util/FileUtil.java
cr4igo/FSDevTools
624b890301c18ea8e8942ac8d2c051ee074320cb
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
fsdevtools-sharedutils/src/main/java/com/espirit/moddev/util/FileUtil.java
cr4igo/FSDevTools
624b890301c18ea8e8942ac8d2c051ee074320cb
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
37.130769
142
0.702714
1,002,954
package com.espirit.moddev.util; import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.Collection; /** * Utility class for file operations. */ public enum FileUtil { ; /** * Moves the content of the given {@link Path path} on directory up. * If the given path is a directory, all contents of the directory will be moved - but the given directory will stay at its current location. * * @param path the file or directory to move * @throws IOException If move operation could not be performed */ public static void moveContentsUp(@NotNull final Path path) throws IOException { final File file = path.toFile(); final Path newParent = path.toAbsolutePath().getParent(); if (newParent == null) { throw new IllegalStateException("Parent of '" + path.toAbsolutePath() + "' is null!"); } if (file.isDirectory()) { // move all contents of the directory final File[] children = file.listFiles(); if (children != null) { for (final File child : children) { final Path newPath = newParent.resolve(child.getName()); if (!child.renameTo(newPath.toFile())) { throw new IOException("Renaming file '" + child.getAbsolutePath() + "' to '" + newPath.toAbsolutePath() + "' failed!"); } } } } else { // directly move the file Files.move(path, newParent.resolve(path.getFileName())); } } /** * Deletes the file (or directory) at the given {@link Path path}. * If the given path is a directory, all contents of the directory will be deleted recursively. * * @param path the file or directory to delete * @throws IOException if an I/O error occurs */ public static void deleteDirectory(@NotNull final Path path) throws IOException { if (!path.toFile().exists()) { return; } Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult postVisitDirectory(@NotNull final Path dir, @NotNull final IOException exc) throws IOException { Files.delete(dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(@NotNull final Path file, @NotNull final BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } }); } /** * Marks the {@link File file} at the given {@link Path path} as executable files. * * @param path the path of the {@link File file} to modify * @throws IOException if the {@link File file} could not be marked as executable * @throws FileNotFoundException if the file at the given {@link Path path} does not exist */ public static void setExecutable(@NotNull final Path path) throws FileNotFoundException, IOException { final File file = path.toFile(); if (!file.exists()) { throw new FileNotFoundException("File '" + path.toAbsolutePath() + "' does not exist!"); } if (!file.setExecutable(true)) { throw new IOException("Could not set file '" + path.toAbsolutePath() + "' executable!"); } } /** * Marks the {@link File executable} at the given {@link Path paths} as executable files. * * @param path the root path for the given executables * @param executables the relative paths of the executable to update * @throws IOException if one (or more) {@link File files} could not be marked as executable * @throws FileNotFoundException if one (or more) files at the given {@link Path path} does not exist */ public static void setExecutable(@NotNull final Path path, @NotNull final Collection<String[]> executables) throws IOException { for (final String[] executablePath : executables) { Path executable = path; for (final String pathElement : executablePath) { executable = executable.resolve(pathElement); } FileUtil.setExecutable(executable); } } /** * Creates the directory named by the given {@link Path path}, including any necessary but nonexistent parent directories. * If the given path represents a file, only the parent directories will be created. * Note that if this operation fails it may have succeeded in creating some of the necessary parent directories. * * @param path the path to create * @throws IOException if the directory for the given {@link Path path} could not be created */ public static void mkDirs(@NotNull final Path path) throws IOException { final File file = path.toFile(); if (!file.exists()) { if (!file.mkdirs()) { throw new IOException("Could not create directories for '" + file.toPath().toAbsolutePath() + "'!"); } } } }
92444863b198eb3656485654f0bdf7b2413f1759
924
java
Java
src/main/java/org/folio/auth/authtokenmodule/LimitedSizeQueue.java
folio-org/mod-authtoken
e32248d444e0e9f61b09b8b91cdbbe76210c311a
[ "Apache-2.0" ]
2
2019-03-01T13:51:35.000Z
2022-02-22T20:31:22.000Z
src/main/java/org/folio/auth/authtokenmodule/LimitedSizeQueue.java
folio-org/mod-authtoken
e32248d444e0e9f61b09b8b91cdbbe76210c311a
[ "Apache-2.0" ]
70
2017-04-27T13:04:04.000Z
2022-03-31T17:31:11.000Z
src/main/java/org/folio/auth/authtokenmodule/LimitedSizeQueue.java
folio-org/mod-authtoken
e32248d444e0e9f61b09b8b91cdbbe76210c311a
[ "Apache-2.0" ]
5
2017-07-11T20:16:55.000Z
2022-02-28T08:51:10.000Z
20.086957
88
0.662338
1,002,955
package org.folio.auth.authtokenmodule; import java.util.LinkedHashMap; import java.util.Map; public class LimitedSizeQueue<K> extends LinkedHashMap<K, Boolean> { private final int maxSize; public LimitedSizeQueue(int size) { maxSize = size; } @Override public boolean equals(Object obj) { if (!super.equals(obj)) { return false; } LimitedSizeQueue<K> fobj = (LimitedSizeQueue<K>) obj; return fobj.maxSize == maxSize; } @Override public int hashCode() { return super.hashCode() + 31 * maxSize; } @Override protected boolean removeEldestEntry(Map.Entry<K, Boolean> eldest) { return size() > maxSize; } /** * Adds key if not already in queue. If key exists, its queue position doesn't change. * @param k key */ public void add(K k) { super.put(k, Boolean.TRUE); } public boolean contains(K k) { return super.containsKey(k); } }
92444956a1a88f0116d1a0be0a5ca97a31f8355c
2,616
java
Java
dream/qiqi-common/src/main/java/com/qiqi/common/advice/ExceptionHandlerAdvice.java
bublesy/qiqi
54bda003777ca359abd920c5f213b063a7681a6d
[ "Apache-2.0" ]
null
null
null
dream/qiqi-common/src/main/java/com/qiqi/common/advice/ExceptionHandlerAdvice.java
bublesy/qiqi
54bda003777ca359abd920c5f213b063a7681a6d
[ "Apache-2.0" ]
null
null
null
dream/qiqi-common/src/main/java/com/qiqi/common/advice/ExceptionHandlerAdvice.java
bublesy/qiqi
54bda003777ca359abd920c5f213b063a7681a6d
[ "Apache-2.0" ]
null
null
null
31.142857
177
0.723624
1,002,956
package com.qiqi.common.advice; import com.alibaba.fastjson.JSONException; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.jdbc.BadSqlGrammarException; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; /** * @author QiQiDream * @date 2020-06-24 10:51 */ @Slf4j @RestControllerAdvice public class ExceptionHandlerAdvice extends ResponseEntityExceptionHandler { /** * 处理自定义异常(RuntimeException异常!) */ @ExceptionHandler(value =RuntimeException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public String exceptionHandler(RuntimeException e){ log.error("自定义异常!",e); return e.getMessage(); } /** * 处理空指针的异常 */ @ExceptionHandler(value =NullPointerException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public String exceptionHandler(NullPointerException e){ log.error("发生空指针异常!",e); return "空指针异常"; } /** * FastJSON序列化异常 */ @ExceptionHandler(value = JSONException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public String exceptionHandler(JSONException e){ log.error("FastJSON序列化异常!",e); return "FastJSON序列化异常"; } /** * 错误的SQL语法异常 */ @ExceptionHandler(value = BadSqlGrammarException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public String exceptionHandler(BadSqlGrammarException e){ log.error("错误的SQL语法异常!",e); return "错误的SQL语法异常!"; } /** * 请求方法异常 */ @Override protected ResponseEntity<Object> handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { log.error("不支持请求方法\""+ex.getMethod() + "\""); return ResponseEntity.status(status).body( "不支持请求方法\""+ex.getMethod() + "\"" ); } /** * 处理其他异常(服务器异常!) */ @ExceptionHandler(value =Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public String exceptionHandler(Exception e){ log.error("服务器异常!",e); return "服务器异常!"; } }
924449709b207cc61314abe85ed178ca331fa5e5
1,815
java
Java
pigeon-gps/src/main/java/io/g740/pigeon/biz/object/dto/df/DfConfTableFieldDto.java
g7401/pigeon
27107fbec9a4bc29b0503814c19c7db7b2cae7ed
[ "Apache-2.0" ]
null
null
null
pigeon-gps/src/main/java/io/g740/pigeon/biz/object/dto/df/DfConfTableFieldDto.java
g7401/pigeon
27107fbec9a4bc29b0503814c19c7db7b2cae7ed
[ "Apache-2.0" ]
null
null
null
pigeon-gps/src/main/java/io/g740/pigeon/biz/object/dto/df/DfConfTableFieldDto.java
g7401/pigeon
27107fbec9a4bc29b0503814c19c7db7b2cae7ed
[ "Apache-2.0" ]
null
null
null
19.308511
71
0.652342
1,002,957
package io.g740.pigeon.biz.object.dto.df; import io.g740.pigeon.biz.share.constants.DataFieldAggregationTypeEnum; import io.g740.pigeon.biz.share.constants.DataFieldRoleEnum; import io.g740.pigeon.biz.share.constants.DataFieldTypeEnum; import lombok.Data; import org.springframework.data.domain.Sort; /** * @author bbottong */ @Data public class DfConfTableFieldDto { /** * 字段名称 */ private String fieldName; /** * 字段描述 */ private String fieldDescription; /** * 字段别名 */ private String fieldLabel; /** * 字段类型 */ private DataFieldTypeEnum fieldType; /** * 如果当作列表/表格字段,在列表/表格中的元素顺序 */ private Integer listElementSequence; /** * 如果当作列表/表格字段,在表格中的元素宽度 */ private Integer listElementWidth; /** * 是否当作排序字段 */ private Boolean enabledAsSortElement; /** * 如果当作排序字段,排序的方向 */ private Sort.Direction sortDirection; /** * 如果当作排序字段,在排序字段组合中的序号 */ private Integer sortElementSequence; /** * 如果当作排序字段,是否强制排序 */ private Boolean sortForced; /** * 如果当作列表/表格字段,该字段在Group By功能中的角色(维度字段/KPI字段) */ private DataFieldRoleEnum role; /** * 如果当作列表/表格字段,如果role=KPI,则需填写该字段在Group By功能中作为KPI字段所需要的聚合函数 */ private DataFieldAggregationTypeEnum aggregationType; /** * 启用数据权限控制时,该字段对应的resource category uid */ private Long resourceCategoryUid; /** * 启用数据权限控制时,该字段对应的resource category name */ private String resourceCategoryName; /** * 启用数据权限控制时,该字段对应的resource category的structure hierarchy上的节点uid */ private Long resourceStructureUid; /** * 启用数据权限控制时,该字段对应的resource category的structure hierarchy上的节点name */ private String resourceStructureName; }
92444a16023c5d02dd6dc46572d50d0533a3937a
730
java
Java
source/jenkins/src/main/java/com/xpx/bootcamp/jenkins/entity/Build.java
xpanxion/xhire-spring-bootcamp
1e5ddf08bc80a5eddab03ec7a704dcf5a5a49699
[ "MIT" ]
null
null
null
source/jenkins/src/main/java/com/xpx/bootcamp/jenkins/entity/Build.java
xpanxion/xhire-spring-bootcamp
1e5ddf08bc80a5eddab03ec7a704dcf5a5a49699
[ "MIT" ]
null
null
null
source/jenkins/src/main/java/com/xpx/bootcamp/jenkins/entity/Build.java
xpanxion/xhire-spring-bootcamp
1e5ddf08bc80a5eddab03ec7a704dcf5a5a49699
[ "MIT" ]
null
null
null
14.038462
47
0.620548
1,002,958
package com.xpx.bootcamp.jenkins.entity; import java.util.List; /** * The Class Build. */ public class Build { /** The number. */ private Integer number; /** The actions. */ private List<Action> actions; /** * Gets the number. * * @return the number */ public Integer getNumber() { return number; } /** * Sets the number. * * @param number the new number */ public void setNumber(Integer number) { this.number = number; } /** * Gets the actions. * * @return the actions */ public List<Action> getActions() { return actions; } /** * Sets the actions. * * @param actions the new actions */ public void setActions(List<Action> actions) { this.actions = actions; } }
92444aa85d9358eca33f021d5201fd50c780119d
12,934
java
Java
fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/FedoraBinaryImpl.java
jschnasse/fcrepo4
5c889d110960432167167aa098fb5529ef14fe18
[ "Apache-2.0" ]
1
2016-11-09T20:29:13.000Z
2016-11-09T20:29:13.000Z
fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/FedoraBinaryImpl.java
jschnasse/fcrepo4
5c889d110960432167167aa098fb5529ef14fe18
[ "Apache-2.0" ]
null
null
null
fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/FedoraBinaryImpl.java
jschnasse/fcrepo4
5c889d110960432167167aa098fb5529ef14fe18
[ "Apache-2.0" ]
null
null
null
34.036842
113
0.649142
1,002,959
/** * Copyright 2014 DuraSpace, 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 org.fcrepo.kernel.impl; import com.codahale.metrics.Counter; import com.codahale.metrics.Histogram; import com.codahale.metrics.Timer; import com.hp.hpl.jena.rdf.model.Resource; import org.fcrepo.kernel.models.NonRdfSourceDescription; import org.fcrepo.kernel.models.FedoraBinary; import org.fcrepo.kernel.models.FedoraResource; import org.fcrepo.kernel.exception.InvalidChecksumException; import org.fcrepo.kernel.exception.PathNotFoundRuntimeException; import org.fcrepo.kernel.exception.RepositoryRuntimeException; import org.fcrepo.kernel.identifiers.IdentifierConverter; import org.fcrepo.kernel.impl.rdf.impl.FixityRdfContext; import org.fcrepo.kernel.impl.utils.impl.CacheEntryFactory; import org.fcrepo.kernel.services.policy.StoragePolicyDecisionPoint; import org.fcrepo.kernel.utils.ContentDigest; import org.fcrepo.kernel.utils.FixityResult; import org.fcrepo.kernel.utils.iterators.RdfStream; import org.fcrepo.metrics.RegistryService; import org.modeshape.jcr.api.Binary; import org.modeshape.jcr.api.ValueFactory; import org.slf4j.Logger; import javax.jcr.Node; import javax.jcr.PathNotFoundException; import javax.jcr.Property; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.version.Version; import javax.jcr.version.VersionHistory; import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.util.Collection; import static com.codahale.metrics.MetricRegistry.name; import static org.fcrepo.kernel.impl.utils.FedoraTypesUtils.isFedoraBinary; import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT; import static org.modeshape.jcr.api.JcrConstants.JCR_DATA; import static org.modeshape.jcr.api.JcrConstants.JCR_MIME_TYPE; import static org.slf4j.LoggerFactory.getLogger; /** * @author cabeer * @since 9/19/14 */ public class FedoraBinaryImpl extends FedoraResourceImpl implements FedoraBinary { private static final Logger LOGGER = getLogger(FedoraBinaryImpl.class); static final RegistryService registryService = RegistryService.getInstance(); static final Counter fixityCheckCounter = registryService.getMetrics().counter(name(FedoraBinary.class, "fixity-check-counter")); static final Timer timer = registryService.getMetrics().timer( name(NonRdfSourceDescription.class, "fixity-check-time")); static final Histogram contentSizeHistogram = registryService.getMetrics().histogram(name(FedoraBinary.class, "content-size")); /** * Wrap an existing Node as a Fedora Binary * @param node */ public FedoraBinaryImpl(final Node node) { super(node); if (node.isNew()) { initializeNewBinaryProperties(); } } private void initializeNewBinaryProperties() { try { decorateContentNode(node); } catch (RepositoryException e) { LOGGER.warn("Count not decorate {} with FedoraBinary properties: {}", node, e); } } @Override public NonRdfSourceDescription getDescription() { try { return new NonRdfSourceDescriptionImpl(getNode().getParent()); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } /* * (non-Javadoc) * @see org.fcrepo.kernel.Datastream#getContent() */ @Override public InputStream getContent() { try { return getBinaryContent().getStream(); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } /* * (non-Javadoc) * @see org.fcrepo.kernel.Datastream#getBinaryContent() */ @Override public javax.jcr.Binary getBinaryContent() { try { return getProperty(JCR_DATA).getBinary(); } catch (final PathNotFoundException e) { throw new PathNotFoundRuntimeException(e); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } /* * (non-Javadoc) * @see org.fcrepo.kernel.Datastream#setContent(java.io.InputStream, * java.lang.String, java.net.URI, java.lang.String, * org.fcrepo.kernel.services.policy.StoragePolicyDecisionPoint) */ @Override public void setContent(final InputStream content, final String contentType, final URI checksum, final String originalFileName, final StoragePolicyDecisionPoint storagePolicyDecisionPoint) throws InvalidChecksumException { try { final Node contentNode = getNode(); if (contentNode.canAddMixin(FEDORA_BINARY)) { contentNode.addMixin(FEDORA_BINARY); } if (contentType != null) { contentNode.setProperty(JCR_MIME_TYPE, contentType); } if (originalFileName != null) { contentNode.setProperty(PREMIS_FILE_NAME, originalFileName); } LOGGER.debug("Created content node at path: {}", contentNode.getPath()); String hint = null; if (storagePolicyDecisionPoint != null) { hint = storagePolicyDecisionPoint.evaluatePolicies(node); } final ValueFactory modevf = (ValueFactory) node.getSession().getValueFactory(); final Binary binary = modevf.createBinary(content, hint); /* * This next line of code deserves explanation. If we chose for the * simpler line: Property dataProperty = * contentNode.setProperty(JCR_DATA, requestBodyStream); then the JCR * would not block on the stream's completion, and we would return to * the requester before the mutation to the repo had actually completed. * So instead we use createBinary(requestBodyStream), because its * contract specifies: "The passed InputStream is closed before this * method returns either normally or because of an exception." which * lets us block and not return until the job is done! The simpler code * may still be useful to us for an asynchronous method that we develop * later. */ final Property dataProperty = contentNode.setProperty(JCR_DATA, binary); final String dsChecksum = binary.getHexHash(); final URI uriChecksumString = ContentDigest.asURI("SHA-1", dsChecksum); if (checksum != null && !checksum.equals(uriChecksumString)) { LOGGER.debug("Failed checksum test"); throw new InvalidChecksumException("Checksum Mismatch of " + uriChecksumString + " and " + checksum); } decorateContentNode(contentNode); LOGGER.debug("Created data property at path: {}", dataProperty.getPath()); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } /* * (non-Javadoc) * @see org.fcrepo.kernel.Datastream#getContentSize() */ @Override public long getContentSize() { try { if (hasProperty(CONTENT_SIZE)) { return getProperty(CONTENT_SIZE).getLong(); } } catch (final RepositoryException e) { LOGGER.info("Could not get contentSize(): {}", e.getMessage()); } return -1L; } /* * (non-Javadoc) * @see org.fcrepo.kernel.Datastream#getContentDigest() */ @Override public URI getContentDigest() { try { if (hasProperty(CONTENT_DIGEST)) { return new URI(getProperty(CONTENT_DIGEST).getString()); } } catch (final RepositoryException | URISyntaxException e) { LOGGER.info("Could not get content digest: {}", e.getMessage()); } return ContentDigest.missingChecksum(); } /* * (non-Javadoc) * @see org.fcrepo.kernel.Datastream#getMimeType() */ @Override public String getMimeType() { try { if (hasProperty(JCR_MIME_TYPE)) { return getProperty(JCR_MIME_TYPE).getString(); } return "application/octet-stream"; } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } /* * (non-Javadoc) * @see org.fcrepo.kernel.Datastream#getFilename() */ @Override public String getFilename() { try { if (hasProperty(PREMIS_FILE_NAME)) { return getProperty(PREMIS_FILE_NAME).getString(); } return node.getParent().getName(); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } @Override public RdfStream getFixity(final IdentifierConverter<Resource, FedoraResource> idTranslator) { return getFixity(idTranslator, getContentDigest(), getContentSize()); } @Override public RdfStream getFixity(final IdentifierConverter<Resource, FedoraResource> idTranslator, final URI digestUri, final long size) { fixityCheckCounter.inc(); try (final Timer.Context context = timer.time()) { final Repository repo = node.getSession().getRepository(); LOGGER.debug("Checking resource: " + getPath()); final String algorithm = ContentDigest.getAlgorithm(digestUri); final Collection<FixityResult> fixityResults = CacheEntryFactory.forProperty(repo, getProperty(JCR_DATA)).checkFixity(algorithm); return new FixityRdfContext(this, idTranslator, fixityResults, digestUri, size); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } /** * When deleting the binary, we also need to clean up the description document. */ @Override public void delete() { final NonRdfSourceDescription description = getDescription(); super.delete(); description.delete(); } @Override public Version getBaseVersion() { return getDescription().getBaseVersion(); } private static void decorateContentNode(final Node contentNode) throws RepositoryException { if (contentNode == null) { LOGGER.warn("{} node appears to be null!", JCR_CONTENT); return; } if (contentNode.canAddMixin(FEDORA_BINARY)) { contentNode.addMixin(FEDORA_BINARY); } if (contentNode.hasProperty(JCR_DATA)) { final Property dataProperty = contentNode.getProperty(JCR_DATA); final Binary binary = (Binary) dataProperty.getBinary(); final String dsChecksum = binary.getHexHash(); contentSizeHistogram.update(dataProperty.getLength()); contentNode.setProperty(CONTENT_SIZE, dataProperty.getLength()); contentNode.setProperty(CONTENT_DIGEST, ContentDigest.asURI("SHA-1", dsChecksum).toString()); LOGGER.debug("Decorated data property at path: {}", dataProperty.getPath()); } } /* * (non-Javadoc) * @see org.fcrepo.kernel.models.FedoraResource#getVersionHistory() */ @Override public VersionHistory getVersionHistory() { try { return getSession().getWorkspace().getVersionManager().getVersionHistory(getDescription().getPath()); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } } @Override public boolean isVersioned() { return getDescription().isVersioned(); } @Override public void enableVersioning() { super.enableVersioning(); getDescription().enableVersioning(); } @Override public void disableVersioning() { super.disableVersioning(); getDescription().disableVersioning(); } /** * Check if the given node is a Fedora binary * @param node * @return */ public static boolean hasMixin(final Node node) { return isFedoraBinary.apply(node); } }
92444b13950f1f6f8ba0716b6a32aa85e3c07b85
3,140
java
Java
transaction-summary-service/src/test/java/pl/com/michalpolak/hyperbudget/transaction/core/TransactionStatisticsTest.java
polakm/HyperBudget
cb1cca9034b38f5770e2e9068fc67bc549435d40
[ "Apache-2.0" ]
3
2018-11-12T20:34:00.000Z
2019-08-25T16:43:16.000Z
transaction-summary-service/src/test/java/pl/com/michalpolak/hyperbudget/transaction/core/TransactionStatisticsTest.java
polakm/HyperBudget
cb1cca9034b38f5770e2e9068fc67bc549435d40
[ "Apache-2.0" ]
4
2020-09-05T02:32:28.000Z
2022-02-26T12:20:37.000Z
transaction-summary-service/src/test/java/pl/com/michalpolak/hyperbudget/transaction/core/TransactionStatisticsTest.java
polakm/HyperBudget
cb1cca9034b38f5770e2e9068fc67bc549435d40
[ "Apache-2.0" ]
1
2020-05-06T07:00:21.000Z
2020-05-06T07:00:21.000Z
31.4
109
0.699363
1,002,960
package pl.com.michalpolak.hyperbudget.transaction.core; import org.joda.money.CurrencyUnit; import org.joda.money.Money; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.junit.Test; import pl.com.michalpolak.hyperbudget.transaction.core.api.TransactionInfo; import pl.com.michalpolak.hyperbudget.transaction.core.api.TransactionStatistics; import pl.com.michalpolak.hyperbudget.transaction.core.spi.Transaction; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; public class TransactionStatisticsTest { public TransactionStatistics getTransactionStatistics(int ... amounts){ List<TransactionInfo> transactions = new ArrayList<>(); for (long amount : amounts) { BigDecimal decimalAmount = new BigDecimal(amount); TransactionInfo.Builder builder = TransactionInfo.builder(); Transaction transaction = Transaction.builder(). withAmount(Money.of(CurrencyUnit.USD,amount)) .build(); TransactionInfo transactionInfo = TransactionInfo.builder().withTransaction(transaction).build(); transactions.add(transactionInfo); } return TransactionStatistics.of(transactions); } public TransactionStatistics getTransactionStatisticsForEmptyList(){ List<TransactionInfo> transactions = new ArrayList<>(); return TransactionStatistics.of(transactions); } @Test public void sumOfIncomes(){ int[] amounts = {1000,-1000,-200,400,600}; TransactionStatistics statistics = getTransactionStatistics(amounts); BigDecimal result = statistics.sumOfIncomes(); assertEquals(new BigDecimal("2000.00"), result); } @Test public void sumOfIncomesForEmptyList(){ TransactionStatistics statistics = getTransactionStatisticsForEmptyList(); BigDecimal result = statistics.sumOfIncomes(); assertEquals(new BigDecimal("0"), result); } @Test public void sumOfExpenses(){ int[] amounts = {1000,-1000,-200,400,600}; TransactionStatistics statistics = getTransactionStatistics(amounts); BigDecimal result = statistics.sumOfExpenses(); assertEquals(new BigDecimal("-1200.00"), result); } @Test public void sumOfExpensesForEmptyList(){ TransactionStatistics statistics = getTransactionStatisticsForEmptyList(); BigDecimal result = statistics.sumOfExpenses(); assertEquals(new BigDecimal("0"), result); } @Test public void totalSum(){ int[] amounts = {1000,-1000,-200,400,600}; TransactionStatistics statistics = getTransactionStatistics(amounts); BigDecimal result = statistics.totalSum(); assertEquals(new BigDecimal("800.00"), result); } @Test public void totalSumForEmptyList(){ TransactionStatistics statistics = getTransactionStatisticsForEmptyList(); BigDecimal result = statistics.totalSum(); assertEquals(new BigDecimal("0"), result); } }
92444b22d43e0b650c6033e5dfd32c60aea89de9
1,019
java
Java
src/main/java/com/udacity/jwdnd/course1/cloudstorage/mappers/NoteMapper.java
AudriusSveikauskas/Super-Duper-Drive-Cloud-Storage
6837e35fbd9717e193173f363461b77e1cddfb6c
[ "MIT" ]
null
null
null
src/main/java/com/udacity/jwdnd/course1/cloudstorage/mappers/NoteMapper.java
AudriusSveikauskas/Super-Duper-Drive-Cloud-Storage
6837e35fbd9717e193173f363461b77e1cddfb6c
[ "MIT" ]
null
null
null
src/main/java/com/udacity/jwdnd/course1/cloudstorage/mappers/NoteMapper.java
AudriusSveikauskas/Super-Duper-Drive-Cloud-Storage
6837e35fbd9717e193173f363461b77e1cddfb6c
[ "MIT" ]
null
null
null
17.877193
121
0.699706
1,002,961
package com.udacity.jwdnd.course1.cloudstorage.mappers; import com.udacity.jwdnd.course1.cloudstorage.models.Note; import org.apache.ibatis.annotations.*; @Mapper public interface NoteMapper { @Select("SELECT * FROM NOTES") Note[] getAllNotes(); @Select("SELECT * FROM NOTES WHERE noteid = #{noteId}") Note getNoteById(Integer noteId); @Select("SELECT * FROM NOTES WHERE userid = #{userId}") Note[] getAllNotesByUserId(Integer userId); @Update("UPDATE NOTES SET notetitle = #{title}, notedescription = #{description} WHERE noteid = #{noteId}") void updateNoteByNoteId(Integer noteId, String title, String description); @Delete("DELETE FROM NOTES WHERE noteid = #{noteId}") void deleteNoteByNoteId(Integer noteId); @Insert("INSERT INTO NOTES (notetitle, notedescription, userid) VALUES(#{noteTitle}, #{noteDescription}, #{userId})") @Options(useGeneratedKeys = true, keyProperty = "noteId") int insertNoteAndReturnId(Note note); }
92444de930c3d72eeaec1e49a71b61737311b414
9,296
java
Java
src/main/java/tyvrel/mag/core/model/CrossSection.java
Tyvrel/rc
fb6dcbeb855e4d960fd8e9a4524442fc6246cdc3
[ "CC-BY-4.0" ]
null
null
null
src/main/java/tyvrel/mag/core/model/CrossSection.java
Tyvrel/rc
fb6dcbeb855e4d960fd8e9a4524442fc6246cdc3
[ "CC-BY-4.0" ]
null
null
null
src/main/java/tyvrel/mag/core/model/CrossSection.java
Tyvrel/rc
fb6dcbeb855e4d960fd8e9a4524442fc6246cdc3
[ "CC-BY-4.0" ]
null
null
null
32.848057
113
0.688576
1,002,962
package tyvrel.mag.core.model; import tyvrel.mag.core.exception.ImproperDataException; import tyvrel.mag.core.exception.LSException; import tyvrel.mag.core.model.classification.ConcreteClassification; import tyvrel.mag.core.model.classification.Steel; import tyvrel.mag.core.model.reinforcement.LongitudinalReinforcement; import tyvrel.mag.core.model.reinforcement.Reinforcement; import tyvrel.mag.core.model.reinforcement.ShearReinforcement; import static tyvrel.mag.core.exception.Precondition.pos; /** * This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this * license, visit http://creativecommons.org/licenses/by/4.0/. * <p> * Describes cross section of the element */ public class CrossSection { private Shape shape; private int crossSectionType; private ConcreteClassification concreteClassification; private Steel longitudinalReinforcementSteel; private Steel shearReinforcementSteel; private LongitudinalReinforcement as; private ShearReinforcement asw; private double cnom; /** * Creates an instance of the cross section * * @param shape shape * @param longitudinalReinforcementSteel longitudinal reinforcement steel * @param shearReinforcementSteel shear reinforcement steel * @param concreteClassification concrete classification * @param crossSectionType type of the cross section * @param as longitudinal reinforcement * @param asw shear reinforcement * @param cnom concrete cover in m */ public CrossSection(Shape shape, Steel longitudinalReinforcementSteel, Steel shearReinforcementSteel, ConcreteClassification concreteClassification, int crossSectionType, LongitudinalReinforcement as, ShearReinforcement asw, double cnom) { this.longitudinalReinforcementSteel = longitudinalReinforcementSteel; this.shearReinforcementSteel = shearReinforcementSteel; this.shape = shape; this.concreteClassification = concreteClassification; this.crossSectionType = crossSectionType; this.as = as; this.asw = asw; this.cnom = cnom; } /** * Returns axial spacing between bottom reinforcement in m * * @return axial spacing between bottom reinforcement in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getAsbSpacing() throws ImproperDataException, LSException { Reinforcement as = this.as.getAsb(); double horizontalClearance = pos(() -> shape.getB() - 2 * cnom - 2 * asw.getPhi() - as.getPhi()); return pos(() -> horizontalClearance / (as.getN() - 1)); } /** * Returns axial spacing between top reinforcement in m * * @return axial spacing between top reinforcement in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getAsaSpacing() throws ImproperDataException, LSException { Reinforcement as = this.as.getAsa(); double horizontalClearance = pos(() -> shape.getB() - 2 * cnom - 2 * asw.getPhi() - as.getPhi ()); return pos(() -> horizontalClearance / (as.getN() - 1)); } /** * Returns effective height if bottom is tensioned in m * * @return effective height if bottom is tensioned in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getDb() throws ImproperDataException, LSException { double h = pos(() -> shape.getH()); double cNom = pos(() -> cnom); double fib = pos(() -> as.getAsb().getPhi()); double fisw = pos(() -> asw.getPhi()); return pos(() -> h - cNom - fisw - fib / 2); } /** * Returns effective height if top is tensioned in m * * @return effective height if top is tensioned in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getDa() throws ImproperDataException, LSException { double h = pos(() -> shape.getH()); double cNom = pos(() -> cnom); double fia = pos(() -> as.getAsa().getPhi()); double fisw = pos(() -> asw.getPhi()); return pos(() -> h - cNom - fisw - fia / 2); } /** * Returns distance between axis of bottom reinforcement and bottom face of cross section in m * * @return distance between axis of bottom reinforcement and bottom face of cross section in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getAb() throws ImproperDataException, LSException { double cNom = pos(() -> cnom); double fib = pos(() -> as.getAsb().getPhi()); double fisw = pos(() -> asw.getPhi()); return pos(() -> cNom + fisw + fib / 2); } /** * Returns distance between axis of top reinforcement and top face of cross section in m * * @return distance between axis of top reinforcement and top face of cross section in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getAa() throws ImproperDataException, LSException { double cNom = pos(() -> cnom); double fia = pos(() -> as.getAsa().getPhi()); double fisw = pos(() -> asw.getPhi()); return pos(() -> cNom + fisw + fia / 2); } /** * Returns clearance for longitudinal reinforcement in m * * @return clearance for longitudinal reinforcement in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getAsClearance() throws ImproperDataException, LSException { double b = pos(() -> shape.getB()); double fisw = pos(() -> asw.getPhi()); return pos(() -> b - 2 * pos(cnom) - 2 * fisw); } /** * Returns clearance for shear reinforcement in m * * @return clearance for shear reinforcement in m * @throws ImproperDataException if data is improper * @throws LSException if limit state is exceeded */ public double getAswClearance() throws ImproperDataException, LSException { double b = pos(() -> shape.getB()); return pos(() -> b - 2 * pos(cnom)); } @Override public String toString() { return "CrossSection{" + "shape=" + shape + ", concreteClassification=" + concreteClassification + ", crossSectionType=" + crossSectionType + ", as=" + as + ", asw=" + asw + ", cnom=" + cnom + ", longitudinalReinforcementSteel=" + longitudinalReinforcementSteel + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CrossSection that = (CrossSection) o; if (crossSectionType != that.crossSectionType) return false; if (Double.compare(that.cnom, cnom) != 0) return false; if (shape != null ? !shape.equals(that.shape) : that.shape != null) return false; if (concreteClassification != null ? !concreteClassification.equals(that.concreteClassification) : that .concreteClassification != null) return false; if (as != null ? !as.equals(that.as) : that.as != null) return false; if (asw != null ? !asw.equals(that.asw) : that.asw != null) return false; return longitudinalReinforcementSteel != null ? longitudinalReinforcementSteel.equals(that .longitudinalReinforcementSteel) : that.longitudinalReinforcementSteel == null; } @Override public int hashCode() { int result; long temp; result = shape != null ? shape.hashCode() : 0; result = 31 * result + (concreteClassification != null ? concreteClassification.hashCode() : 0); result = 31 * result + crossSectionType; result = 31 * result + (as != null ? as.hashCode() : 0); result = 31 * result + (asw != null ? asw.hashCode() : 0); temp = Double.doubleToLongBits(cnom); result = 31 * result + (int) (temp ^ (temp >>> 32)); result = 31 * result + (longitudinalReinforcementSteel != null ? longitudinalReinforcementSteel.hashCode() : 0); return result; } /** * Returns cross section type * * @return cross section type */ public int getCrossSectionType() { return crossSectionType; } /** * Returns shear reinforcement * * @return shear reinforcement */ public ShearReinforcement getAsw() { return asw; } /** * Returns concrete classification * * @return concrete classification */ public ConcreteClassification getConcreteClassification() { return concreteClassification; } /** * Returns longitudinal reinforcement * * @return longitudinal reinforcement */ public LongitudinalReinforcement getAs() { return as; } /** * Returns shape * * @return shape */ public Shape getShape() { return shape; } /** * Returns concrete cover in m * * @return concrete cover in m */ public double getCnom() { return cnom; } /** * Returns longitudinal reinforcement steel * * @return longitudinal reinforcement steel */ public Steel getLongitudinalReinforcementSteel() { return longitudinalReinforcementSteel; } /** * Returns shear reinforcement steel * * @return shear reinforcement steel */ public Steel getShearReinforcementSteel() { return shearReinforcementSteel; } }
92444f1ff05e630419de05a6cc1a78255db5a73c
501
java
Java
Avant/src/cl/zpricing/avant/web/AjaxTestController.java
Pariz2018/AvantPricing
4a2c58465845cc16a42c66f42cebe99f69e523b6
[ "MIT" ]
null
null
null
Avant/src/cl/zpricing/avant/web/AjaxTestController.java
Pariz2018/AvantPricing
4a2c58465845cc16a42c66f42cebe99f69e523b6
[ "MIT" ]
null
null
null
Avant/src/cl/zpricing/avant/web/AjaxTestController.java
Pariz2018/AvantPricing
4a2c58465845cc16a42c66f42cebe99f69e523b6
[ "MIT" ]
null
null
null
23.857143
64
0.824351
1,002,963
package cl.zpricing.avant.web; import org.directwebremoting.annotations.RemoteMethod; import org.directwebremoting.annotations.RemoteProxy; import org.springframework.stereotype.Controller; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Controller @Service("springService") @RemoteProxy(name="dwrService") @Transactional public class AjaxTestController { @RemoteMethod public String getHolaMundo() { return "Hola mundo"; } }
92444fb677a8fb859c73483c49a98fbb0289b8fa
4,407
java
Java
AboutHttp/multithreaddownload/src/main/java/com/four/voicerecord/multithreaddownload/DownLoad1.java
believe563/PostLeanredCodes
9b8891a6cd88bc4f561d653c1679c9049ee031c6
[ "MIT" ]
null
null
null
AboutHttp/multithreaddownload/src/main/java/com/four/voicerecord/multithreaddownload/DownLoad1.java
believe563/PostLeanredCodes
9b8891a6cd88bc4f561d653c1679c9049ee031c6
[ "MIT" ]
null
null
null
AboutHttp/multithreaddownload/src/main/java/com/four/voicerecord/multithreaddownload/DownLoad1.java
believe563/PostLeanredCodes
9b8891a6cd88bc4f561d653c1679c9049ee031c6
[ "MIT" ]
null
null
null
29.577181
115
0.523032
1,002,964
package com.four.voicerecord.multithreaddownload; import android.os.Environment; import android.os.Handler; import android.os.Message; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.RandomAccessFile; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.Executor; import java.util.concurrent.Executors; /** * Created by fengjianghui on 2015-12-08. * * 模仿迅雷多线程下载 */ public class DownLoad1 { private Handler handler; public DownLoad1(Handler handler) { this.handler=handler; } //创建一个线程池对象,固定长度的线程,3个线程 Executor threadPool = Executors.newFixedThreadPool(3); /** * 下载文件 * * @param url */ public void downLoadFile(String url) { try { URL httpUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection(); conn.setRequestMethod("GET"); // conn.setReadTimeout(5000); //获得下载图片的总体的长度 int count = conn.getContentLength(); //将长度分成3份,每份是长度的1/3,这样就可以在线程中将图片分成3份下载 int block = count / 3; //拿到文件名 String fileName = getFileName(url); //SD卡中的下载地址 File parent = Environment.getExternalStorageDirectory(); //文件下载的完整路径 File fileDownload = new File(parent, fileName); //往线程池提交任务 /** * 假如长度为11,分为3个线程 * 11/3 * 第一个线程:0-2 * 第二个线程:3-5 * 第三个线程:6-10 */ for (int i = 0; i < 3; i++) { long start = i * block; long end = (i + 1) * block-1; if (i == 2) { end = count;//不会丢失它多出来的那个字节的数据 } DownloadRunnable r = new DownloadRunnable(url, fileDownload.getAbsolutePath(), start, end,handler); //线程池去提交任务 threadPool.execute(r); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } //给线程池创建一个类 //进行网络读写的时候要在runnable中读写 class DownloadRunnable implements Runnable{ private String url; private String fileName;//指的是文件的绝对路径 private long start; private long end; private Handler handler; public DownloadRunnable(String url, String fileName, long start, long end,Handler handler) { this.url=url; this.fileName=fileName; this.start=start; this.end = end; this.handler=handler; } @Override public void run() { try { URL httpUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection(); conn.setRequestMethod("GET"); // conn.setReadTimeout(5000); //通过runnable去发送网络请求 //设置请求的长度,即从服务器下载的内容在start-end之间的长度之内 //关于Range详见文档 //设置一个请求头 conn.setRequestProperty("Range", "bytes=" + start + "-" + end); //创建一个randomAccess往本地文件进行读写,指定要打开的文件名和打开方式 RandomAccessFile access = new RandomAccessFile(new File(fileName), "rwd"); //指定位置开始读写 access.seek(start); //开始读写数据,只会读start-end之间的数据 InputStream in = conn.getInputStream(); byte[] b = new byte[1024 * 4]; int len; while ((len = in.read(b)) != -1) { access.write(b,0,len);//从0开始,读取len个长度 } Message message=new Message(); message.what=1; handler.sendMessage(message); //读取完之后,将流关掉 if (access != null) { access.close(); } if (in != null) { in.close(); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } /** * 根据url取出图片的名字 */ public String getFileName(String url) { return url.substring(url.lastIndexOf("/")+1); } }
92445030ed731fa36be66b3629c3d058d983b6ef
1,360
java
Java
src/main/java/com/google/devtools/build/lib/rules/objc/Attribute.java
pbekambo/bazel.0.5.1
843dc1c2bd76315e78cb03ee21bad4bbebe9e6ea
[ "Apache-2.0" ]
17
2017-10-25T05:39:49.000Z
2021-03-03T07:32:13.000Z
src/main/java/com/google/devtools/build/lib/rules/objc/Attribute.java
pbekambo/bazel.0.5.1
843dc1c2bd76315e78cb03ee21bad4bbebe9e6ea
[ "Apache-2.0" ]
3
2020-12-07T07:03:15.000Z
2021-02-04T14:06:14.000Z
src/main/java/com/google/devtools/build/lib/rules/objc/Attribute.java
pbekambo/bazel.0.5.1
843dc1c2bd76315e78cb03ee21bad4bbebe9e6ea
[ "Apache-2.0" ]
6
2018-02-13T06:55:59.000Z
2019-05-26T15:24:45.000Z
30.909091
81
0.738235
1,002,965
// Copyright 2015 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.lib.rules.objc; import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode; import com.google.devtools.build.lib.analysis.RuleContext; /** * Container for an attribute name and access mode such as are commonly passed to * {@link RuleContext#getPrerequisite(String, Mode)} and related methods. */ public class Attribute { private final String name; private final Mode accessMode; /** * Creates an attribute reference with the given name and access mode. */ public Attribute(String name, Mode accessMode) { this.name = name; this.accessMode = accessMode; } public String getName() { return name; } public Mode getAccessMode() { return accessMode; } }
92445044ed3db2ccbfd7596d210cdab7c3c2ddae
8,308
java
Java
src/main/java/jacobi/core/spatial/sort/HilbertSort3D.java
ykechan/jacobi
995026c23e5806fdcf436026ed264099e0e73429
[ "MIT" ]
2
2020-11-15T01:03:10.000Z
2022-03-04T15:34:20.000Z
src/main/java/jacobi/core/spatial/sort/HilbertSort3D.java
ykechan/jacobi
995026c23e5806fdcf436026ed264099e0e73429
[ "MIT" ]
null
null
null
src/main/java/jacobi/core/spatial/sort/HilbertSort3D.java
ykechan/jacobi
995026c23e5806fdcf436026ed264099e0e73429
[ "MIT" ]
null
null
null
30.77037
97
0.648652
1,002,966
/* * The MIT License * * Copyright 2020 Y.K. Chan * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package jacobi.core.spatial.sort; import java.util.ArrayDeque; import java.util.Deque; import java.util.List; import java.util.stream.IntStream; import jacobi.core.util.IntStack; /** * Implementation of sorting of Hilbert curve order in 3-D. * * <p>Spatial sort does not scale well into higher dimensions since the number of partitions * and possible transitions grows exponentially with the number of dimensions. Sorting in 3-D * is on the verge of being manageable and mentally visualizable. To justify the complexity, * this class is dedicated to sorting in Hilbert curve which preserves locality the best.</p> * * <p>A region of 3-D space can be partitioned into 8 octrants. The octrants are traversed * 2 different ways for each starting position which makes 16 basis curve. These are pre-defined * with each curve represented in an octal integer with least significant coefficient being * the code of the octrant to travel first. For each basis curve, the octrants can be further * enhanced by the basis curves themselves, and the resolution is encoded in 16-based long * with least significant coefficient being the index of the basis curves to enhance the first * octrant that was traveled first.</p> * * @author Y.K. Chan * */ public class HilbertSort3D implements SpatialSort { /** * Constructor. * @param xIdx Index of x-dimension * @param yIdx Index of y-dimension * @param zIdx Index of z-dimension */ public HilbertSort3D(int xIdx, int yIdx, int zIdx) { this.xIdx = xIdx; this.yIdx = yIdx; this.zIdx = zIdx; } @Override public int[] sort(List<double[]> vectors) { return this.sort( this.init(vectors), BASIS[0], IntStream.range(0, vectors.size()).toArray() ); } /** * Sort a list of vectors by basis curve * @param comps Vector components serialized * @param basis Basis curve * @param order Order sequence * @return Sorted sequence */ protected int[] sort(double[] comps, int basis, int[] order) { Deque<Category> stack = new ArrayDeque<>(); stack.push(new Category(0, order.length, basis, 0)); while(!stack.isEmpty()){ Category cat = stack.pop(); if(cat.end - cat.begin < 2) { continue; } int[] counts = this.sort(comps, cat, order); long enhance = this.enhanceResolution(cat.parity); int start = cat.begin; for(int count : counts){ if(count == cat.end - cat.begin){ // all are degenerated break; } if(count > 0){ stack.push(new Category( start, start + count, BASIS[(int) (enhance % BASIS.length)], cat.depth + 1 )); } start += count; enhance /= BASIS.length; } } return order; } /** * Sort a list of vectors within a octrant * @param comps Vector components serialized * @param octrant Octrant in 3-D space * @param order Order sequence * @return Sorted sequence */ protected int[] sort(double[] comps, Category octrant, int[] order) { IntStack[] octs = this.octGroups(comps, octrant.begin, octrant.end, order); int[] counts = new int[octs.length]; int start = octrant.begin; for(int i = 0; i < octs.length; i++){ IntStack oct = octs[(octrant.parity >> 3 * i) % octs.length]; if(oct == null){ continue; } oct.toArray(order, start); start += oct.size(); counts[i] = oct.size(); } if(start != octrant.end) { throw new IllegalStateException(); } return counts; } /** * Group vectors into 8 octrants * @param comps Vector components serialized * @param begin Begin index of interest * @param end End index of interest * @param order Order sequence * @return Indices of vectors in 8 octrants */ protected IntStack[] octGroups(double[] comps, int begin, int end, int[] order) { IntStack[] groups = new IntStack[8]; double[] u = this.mean(comps, begin, end, order); for(int i = begin; i < end; i++){ int k = order[i]; int parity = (comps[3*k] < u[0] ? 0 : 1) + (comps[3*k + 1] < u[1] ? 0 : 2) + (comps[3*k + 2] < u[2] ? 0 : 4); if(groups[parity] == null) { groups[parity] = new IntStack(4); } groups[parity].push(k); } return groups; } /** * Serialize components of a list of vectors * @param vectors List of vectors * @return Vector components serialized */ protected double[] init(List<double[]> vectors) { double[] comps = new double[3 * vectors.size()]; int k = 0; for(double[] v : vectors){ comps[k++] = v[this.xIdx]; comps[k++] = v[this.yIdx]; comps[k++] = v[this.zIdx]; } return comps; } /** * Compute the mean of vectors * @param comps Vector components serialized * @param begin Begin index of interest * @param end End index of interest * @param order Order sequence * @returnv Mean vector */ protected double[] mean(double[] comps, int begin, int end, int[] order) { double[] ans = new double[3]; for(int i = begin; i < end; i++) { int k = 3 * order[i]; ans[0] += comps[k++]; ans[1] += comps[k++]; ans[2] += comps[k]; } for(int i = 0; i < ans.length; i++) { ans[i] /= end - begin; } return ans; } /** * Enhance the resolution of a octrant given the parity of the octrant * @param parity Parity of the octrant * @return Encoded parities for the inner octrants */ protected long enhanceResolution(int parity) { int index = BasisType.values().length * (parity % 8); for(BasisType type : BasisType.values()) { if(parity == BASIS[index + type.ordinal()]) { return ENHANCE[index + type.ordinal()]; } } throw new IllegalArgumentException("Parity " + parity + " is not a basis."); } private int xIdx, yIdx, zIdx; /** * Encoded basis curve */ protected static final int[] BASIS = { 9954504, 16147656, 3135888, 5237064, 12533913, 14598297, 740313, 7043841, 13825602, 11761218, 6749442, 445914, 16405011, 10211859, 4353867, 2252691, 372204, 6565356, 12423348, 14524524, 2951613, 5015997, 10027773, 16331301, 4243302, 2178918, 16036902, 9733374, 6822711, 629559, 13641327, 11540151 }; /** * Encoded basis curves for enhancing resolution */ protected static final long[] ENHANCE = { 472462885633L , 60548678401L , 882708449985L , 750667566945L , 326563205637L , 189258469893L , 1015990721093L, 617653477349L , 202138788745L , 339443524489L , 616680270793L , 1017232109161L, 56241271437L , 468155478669L , 749962541901L , 884218019565L , 1005591970065L, 593677762833L , 316293400785L , 184252517745L , 859692290069L , 722387554325L , 449575671893L , 51238428149L , 735267873177L , 872572608921L , 50265221593L , 450817059961L , 589370355869L , 1001284563101L, 183547492701L , 317802970365L }; /** * Types of Hilbert basis curve * @author Y.K. Chan */ protected enum BasisType { STAY, DIAG, RIGHT, FORWARD } }
924450e14b7e4eed96a2db5e6536d7b41e04c61f
676
java
Java
src/main/java/de/skerkewitz/enora2d/common/Point2f.java
skerkewitz/blubber-blasen
260b9c92dd55c41e954df9d8f570cc19cecc41c2
[ "MIT" ]
1
2019-03-01T15:53:26.000Z
2019-03-01T15:53:26.000Z
src/main/java/de/skerkewitz/enora2d/common/Point2f.java
skerkewitz/blubber-blasen
260b9c92dd55c41e954df9d8f570cc19cecc41c2
[ "MIT" ]
null
null
null
src/main/java/de/skerkewitz/enora2d/common/Point2f.java
skerkewitz/blubber-blasen
260b9c92dd55c41e954df9d8f570cc19cecc41c2
[ "MIT" ]
null
null
null
16.9
55
0.607988
1,002,967
package de.skerkewitz.enora2d.common; public class Point2f { public final static Point2f ZERO = new Point2f(0, 0); public float x; public float y; public Point2f(float x, float y) { this.x = x; this.y = y; } public Point2f(Point2f p) { this(p.x, p.y); } public Point2f plus(Point2f o) { return plus(o.x, o.y); } public Point2f plus(float x, float y) { return new Point2f(this.x + x, this.y + y); } public Point2f plus(Point2i o) { return new Point2f(x + o.x, y + o.y); } public Point2i toPoint2i() { return new Point2i((int) x, (int) y); } public Point2f cloneCopy() { return new Point2f(this); } }
9244524d16cd3289178241a4cc871aaa03d1eaf1
241
java
Java
src/main/java/com/ss/hazelcast/SampleApplication/payments/model/Employee.java
ssahadevan/SampleApplication
392157a45a8dfefc734d138de54b1945e1888787
[ "MIT" ]
3
2020-07-06T23:50:13.000Z
2020-11-12T17:53:04.000Z
src/main/java/com/ss/hazelcast/SampleApplication/payments/model/Employee.java
ssahadevan/SampleApplication
392157a45a8dfefc734d138de54b1945e1888787
[ "MIT" ]
1
2020-10-12T21:33:08.000Z
2020-10-15T17:10:07.000Z
src/main/java/com/ss/hazelcast/SampleApplication/payments/model/Employee.java
ssahadevan/SampleApplication
392157a45a8dfefc734d138de54b1945e1888787
[ "MIT" ]
null
null
null
17.214286
58
0.775934
1,002,968
package com.ss.hazelcast.SampleApplication.payments.model; import lombok.Builder; import lombok.Getter; @Getter @Builder public class Employee { private String name; private Double salary; private EmployeePosition position; }
9244538fd1094f54395fed147dda543f0ff9d2fe
426
java
Java
core/src/main/java/com/wenc/core/util/TenantSqlHelper.java
ant2008/wis-aftersale
d305802ab4e282b81e7763cd1b47e689c0f8e5fd
[ "MIT" ]
null
null
null
core/src/main/java/com/wenc/core/util/TenantSqlHelper.java
ant2008/wis-aftersale
d305802ab4e282b81e7763cd1b47e689c0f8e5fd
[ "MIT" ]
null
null
null
core/src/main/java/com/wenc/core/util/TenantSqlHelper.java
ant2008/wis-aftersale
d305802ab4e282b81e7763cd1b47e689c0f8e5fd
[ "MIT" ]
null
null
null
17.04
66
0.50939
1,002,969
package com.wenc.core.util; public class TenantSqlHelper { /** * 判断是否存在tenant_id字段 * * @param aSql * @return */ public static boolean ifExistTenantId(String aSql) { if (aSql == null || aSql.trim().equals("")) { return false; } if (aSql.trim().toLowerCase().indexOf("tenantid =") > 0) { return true; } return false; } }
9244546d7e8a163b957c6d4675d4ecf378b1e2c7
941
java
Java
Model/src/net/retrocarnage/editor/model/AttributionData.java
huddeldaddel/retro-carnage-editor
9962f3422c8a75621d89b6cbaa7250c5ca4971a4
[ "MIT" ]
null
null
null
Model/src/net/retrocarnage/editor/model/AttributionData.java
huddeldaddel/retro-carnage-editor
9962f3422c8a75621d89b6cbaa7250c5ca4971a4
[ "MIT" ]
1
2021-10-17T08:34:37.000Z
2021-10-17T08:34:37.000Z
Model/src/net/retrocarnage/editor/model/AttributionData.java
huddeldaddel/retro-carnage-editor
9962f3422c8a75621d89b6cbaa7250c5ca4971a4
[ "MIT" ]
null
null
null
19.604167
55
0.631243
1,002,970
package net.retrocarnage.editor.model; /** * This class holds license information about an asset. * * @author Thomas Werner */ public class AttributionData { private String author; private String website; private String licenseLink; private String licenseText; public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getWebsite() { return website; } public void setWebsite(String website) { this.website = website; } public String getLicenseLink() { return licenseLink; } public void setLicenseLink(String licenseLink) { this.licenseLink = licenseLink; } public String getLicenseText() { return licenseText; } public void setLicenseText(String licenseText) { this.licenseText = licenseText; } }
92445583254261dd08b6a7e6d7b419e3fcb985e1
123
java
Java
src/Main.java
joshmanzano/instant-messaging-system
ab5461821f2e226892d045bac00ff5f847a93aec
[ "MIT" ]
null
null
null
src/Main.java
joshmanzano/instant-messaging-system
ab5461821f2e226892d045bac00ff5f847a93aec
[ "MIT" ]
null
null
null
src/Main.java
joshmanzano/instant-messaging-system
ab5461821f2e226892d045bac00ff5f847a93aec
[ "MIT" ]
null
null
null
17.571429
49
0.634146
1,002,971
public class Main { public static void main(String[] args){ MainController mc = new MainController(); } }
924456da2d85dc0f2dfff03de5332c76262ad128
4,375
java
Java
doma-processor/src/test/java/org/seasar/doma/internal/apt/generator/PrinterTest.java
lunch2000/doma
2aa38c75aacdbff43e8c1045597751d5cf7e2c27
[ "Apache-2.0" ]
310
2015-01-19T02:44:27.000Z
2022-03-19T07:16:42.000Z
doma-processor/src/test/java/org/seasar/doma/internal/apt/generator/PrinterTest.java
lunch2000/doma
2aa38c75aacdbff43e8c1045597751d5cf7e2c27
[ "Apache-2.0" ]
163
2015-01-25T03:41:54.000Z
2022-03-22T09:42:13.000Z
doma-processor/src/test/java/org/seasar/doma/internal/apt/generator/PrinterTest.java
lunch2000/doma
2aa38c75aacdbff43e8c1045597751d5cf7e2c27
[ "Apache-2.0" ]
81
2015-02-21T07:00:54.000Z
2022-03-24T05:50:01.000Z
31.028369
90
0.592
1,002,972
package org.seasar.doma.internal.apt.generator; import static org.junit.jupiter.api.Assertions.*; import java.util.Arrays; import java.util.Collections; import java.util.Formatter; import java.util.List; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.ElementFilter; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.seasar.doma.internal.apt.CompilerSupport; import org.seasar.doma.internal.apt.TestProcessor; class PrinterTest extends CompilerSupport { @SuppressWarnings("unused") private Integer field; @BeforeEach void beforeEach() { addCompilationUnit(getClass()); } @AfterEach void afterEach() throws Exception { compile(); assertTrue(getCompiledResult()); } @Test void print_Class() { addProcessor( new TestProcessor() { @Override protected void run() { Formatter formatter = new Formatter(); Printer printer = new Printer(ctx, formatter); printer.print("%1$s", String.class); assertEquals("java.lang.String", formatter.toString()); } }); } @Test void print_TypeMirror() { addProcessor( new TestProcessor() { @Override protected void run() { TypeElement typeElement = ctx.getMoreElements().getTypeElement(String.class); TypeMirror typeMirror = typeElement.asType(); Formatter formatter = new Formatter(); Printer printer = new Printer(ctx, formatter); printer.print("%1$s", typeMirror); assertEquals("java.lang.String", formatter.toString()); } }); } @Test void print_TypeElement() { addProcessor( new TestProcessor() { @Override protected void run() { TypeElement typeElement = ctx.getMoreElements().getTypeElement(String.class); Formatter formatter = new Formatter(); Printer printer = new Printer(ctx, formatter); printer.print("%1$s", typeElement); assertEquals("java.lang.String", formatter.toString()); } }); } @Test void print_Element() { Class<?> testClass = getClass(); addProcessor( new TestProcessor() { @Override protected void run() { TypeElement typeElement = ctx.getMoreElements().getTypeElement(testClass); VariableElement field = ElementFilter.fieldsIn(typeElement.getEnclosedElements()).stream() .filter(f -> f.getSimpleName().contentEquals("field")) .findFirst() .orElseThrow(AssertionError::new); Formatter formatter = new Formatter(); Printer printer = new Printer(ctx, formatter); printer.print("%1$s", field); assertEquals("field", formatter.toString()); } }); } @Test void print_List() { addProcessor( new TestProcessor() { @Override protected void run() { TypeElement typeElement = ctx.getMoreElements().getTypeElement(String.class); TypeMirror typeMirror = typeElement.asType(); List<Object> list = Arrays.asList( String.class, typeElement, typeMirror, Collections.singletonList(Integer.class)); Formatter formatter = new Formatter(); Printer printer = new Printer(ctx, formatter); printer.print("%1$s", list); assertEquals( "java.lang.String, java.lang.String, java.lang.String, java.lang.Integer", formatter.toString()); } }); } @Test void print_Code() { addProcessor( new TestProcessor() { @Override protected void run() { Code code = new Code(p -> p.print("%1$s", String.class)); Formatter formatter = new Formatter(); Printer printer = new Printer(ctx, formatter); printer.print("<%1$s>", code); assertEquals("<java.lang.String>", formatter.toString()); } }); } }
924457a8d88e2f1ba6bc35142886e7a57401db49
623
java
Java
app/models/entities/Response.java
Arko1K/makemyflight
e36fb4d6e36cc88e2362a6c21b496e308f464000
[ "Apache-2.0" ]
null
null
null
app/models/entities/Response.java
Arko1K/makemyflight
e36fb4d6e36cc88e2362a6c21b496e308f464000
[ "Apache-2.0" ]
null
null
null
app/models/entities/Response.java
Arko1K/makemyflight
e36fb4d6e36cc88e2362a6c21b496e308f464000
[ "Apache-2.0" ]
null
null
null
16.394737
52
0.621188
1,002,973
package models.entities; import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_NULL) public class Response { boolean success; Object data; String error; public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } public String getError() { return error; } public void setError(String error) { this.error = error; } }
924458d5c6417e39089c6d0ebbe14292ea84aca6
1,172
java
Java
src/aether/emblem/LanceChar.java
sorahavok/java-games
6eb7dcd7712789ff97562f7dda26045cc741dab7
[ "MIT" ]
null
null
null
src/aether/emblem/LanceChar.java
sorahavok/java-games
6eb7dcd7712789ff97562f7dda26045cc741dab7
[ "MIT" ]
null
null
null
src/aether/emblem/LanceChar.java
sorahavok/java-games
6eb7dcd7712789ff97562f7dda26045cc741dab7
[ "MIT" ]
null
null
null
22.113208
98
0.680887
1,002,974
package aether.emblem; import java.awt.*; public class LanceChar extends Character { private Image characterImage = Generator.lanceImg; public LanceChar(String title, int hp, int attack, int def, int skill, Weapon wep, int xLocation, int yLocation, int team) { super(title, hp, attack, def, skill, wep, xLocation, yLocation, team); // int gender = (int)(Math.random()*2); // if(gender==0) // {CharacterFace = Generator.FacePikemanMale;} // else // {CharacterFace = Generator.FacePikemanFemale;} } @Override public Image getImage() { if(!alive) { return Generator.remove; } if(this.getTeam() == 1) { characterFace = Generator.FacePikemanFemale; if(this.getMoved() == false) characterImage = Generator.lanceImg; else { characterImage = Generator.graylanceImg; } } if(this.getTeam() == 2) { characterFace = Generator.FacePikemanMale; if(this.getMoved() == false) characterImage = Generator.redlanceImg; else { characterImage = Generator.grayredlanceImg; } } return characterImage; } @Override public int getMovement() { return 2; } @Override public int getRange() { return 1; } }
92445a112266feff146709f8994f8026323936cf
28,261
java
Java
main/phylonet/coalescent/WQInference.java
smirarab/ASTRAL
4aaf5839308b8ccec58a92fa71bf8a6ea8a2d895
[ "Apache-2.0" ]
159
2015-01-05T04:44:48.000Z
2022-03-31T12:26:57.000Z
main/phylonet/coalescent/WQInference.java
smirarab/ASTRAL
4aaf5839308b8ccec58a92fa71bf8a6ea8a2d895
[ "Apache-2.0" ]
58
2015-06-29T00:42:38.000Z
2022-02-25T12:05:53.000Z
main/phylonet/coalescent/WQInference.java
smirarab/ASTRAL
4aaf5839308b8ccec58a92fa71bf8a6ea8a2d895
[ "Apache-2.0" ]
63
2015-01-19T20:26:35.000Z
2022-03-16T07:12:53.000Z
34.339004
164
0.626906
1,002,975
package phylonet.coalescent; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.Set; import java.util.Stack; import phylonet.coalescent.BipartitionWeightCalculator.Quadrapartition; import phylonet.coalescent.BipartitionWeightCalculator.Results; import phylonet.tree.model.TNode; import phylonet.tree.model.Tree; import phylonet.tree.model.sti.STINode; import phylonet.tree.model.sti.STITreeCluster; import phylonet.tree.model.sti.STITreeCluster.Vertex; import phylonet.util.BitSet; public class WQInference extends AbstractInference<Tripartition> { int forceAlg = -1; long maxpossible; public WQInference(Options inOptions, List<Tree> trees, List<Tree> extraTrees, List<Tree> toRemoveExtraTrees) { super(inOptions, trees, extraTrees, toRemoveExtraTrees); this.forceAlg = inOptions.getAlg(); } /** * Calculates maximum possible score, to be used for normalization. * @return */ long calculateMaxPossible() { if (weightCalculator instanceof WQWeightCalculator && ((WQWeightCalculator)weightCalculator).algorithm instanceof WQWeightCalculator.CondensedTraversalWeightCalculator){ return ((WQWeightCalculator.CondensedTraversalWeightCalculator) ((WQWeightCalculator)weightCalculator).algorithm).polytree.maxScore / 4L - unresolvableQuartets(); } //TODO: MUTIND: In the multi individual case, some quartets can never be satisfied. // We should compute their number and substract that from maxpossible here. long weight = 0; Integer allsides = null; Iterator<STITreeCluster> tit = ((WQDataCollection)this.dataCollection).treeAllClusters.iterator(); boolean newTree = true; Deque<Integer> stack = new ArrayDeque<Integer>(); // TODO: this should not use private stuff from weight calculator. // redo to use tree objects. for (Integer gtb: ((WQWeightCalculator)this.weightCalculator).geneTreesAsInts()){ if (newTree) { allsides = tit.next().getBitSet().cardinality(); newTree = false; } if (gtb >= 0){ stack.push(1); } else if (gtb == Integer.MIN_VALUE) { stack.clear(); newTree = true; } else { ArrayList<Integer> children = new ArrayList<Integer>(); Integer newSide = 0; for (int i = gtb; i < 0 ; i++) { Integer pop = stack.pop(); children.add(pop); newSide+=pop; } stack.push(newSide); Integer sideRemaining = allsides - newSide; if ( sideRemaining !=0) { children.add(sideRemaining); } for (int i = 0; i < children.size(); i++) { Long a = children.get(i) + 0l; for (int j = i+1; j < children.size(); j++) { Long b = children.get(j) + 0l; /*if (children.size() > 5) { if ((side1.s0+side2.s0 == 0? 1 :0) + (side1.s1+side2.s1 == 0? 1 :0) + (side1.s2+side2.s2 == 0? 1:0) > 1) continue; } */ for (int k = j+1; k < children.size(); k++) { Long c = children.get(k) + 0l; weight += (a+b+c-3l) *a*b*c; } } } } } return weight/4l - unresolvableQuartets(); } private long unresolvableQuartets() { if (GlobalMaps.taxonNameMap.getSpeciesIdMapper().isSingleIndividual()) return 0; long ret = 0; long four = 0; long three = 0; Iterator<Tree> ti = this.trees.iterator(); System.err.print("Counting unresolvable quartets ... "); for (STITreeCluster gtCL : ((WQDataCollection)this.dataCollection).treeAllClusters) { long[] counts = new long [GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSpeciesCount()]; // number of inds of each species long size = gtCL.getClusterSize(); BitSet bs = gtCL.getBitSet(); for (int i = bs.nextSetBit(0); i >=0 ; i = bs.nextSetBit(i+1)) { counts[(GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSpeciesIdForTaxon(i))]++; } Tree t = ti.next(); for (Long count: counts) { // First compute how many quartets there are from single inds ret += (count*(count-1l)*(count-2l))/6l*(size-count)+ // 3 inds of this species + 1 other (count*(count-1l)*(count-2l)*(count-3l))/24l; // 4 inds of this species } Set<Integer> seenspecies = new HashSet<Integer>(); Stack<long []> stack =new Stack<long[]>(); for (TNode n: t.postTraverse()) { if (n.isLeaf()) { int sp = GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSpeciesIdForTaxon( GlobalMaps.taxonIdentifier.taxonId(n.getName())); if (counts[sp] >=3) seenspecies.add(sp); long[] p = new long[counts.length]; p[sp] = p[sp]+1; stack.push(p); continue; } Set<Integer> donespecies = new HashSet<Integer>(); long[] sum1 = new long[counts.length], sum2 = new long[seenspecies.size()], sum3 = new long[seenspecies.size()], sum4 = new long[seenspecies.size()]; for (int i = 0; i < n.getChildCount(); i++) { long[] pops = stack.pop(); int s = 0; for (Integer species : seenspecies){ long pop = pops[species]; if (pop != 0) { sum1[species] += pop; long popp = pop*pop; sum2[s] += popp; sum3[s] += popp*pop; sum4[s] += popp*popp; } if (sum1[species] == counts[species]) { donespecies.add(species); } s++; } } stack.push(sum1); int sindex = 0; for (Integer species : seenspecies){ long s1 = sum1[species], s2 = sum2[sindex], s3 = sum3[sindex], s4 = sum4[sindex]; if (s1 != 0 ) { four += s1*(Math.pow(s1,3) + 8*s3 - 6*s1*s2) - 6*s4 + 3*s2*s2; three += (Math.pow(s1,3) + 2*s3 -3*s1*s2)*(size-counts[species]); } sindex++; } seenspecies.removeAll(donespecies); } } //System.err.println("four: "+four/24l); ret -= (three/6 + four/24l); System.err.println(ret); return ret; } void initializeWeightCalculator() { ((WQWeightCalculator)this.weightCalculator).setupGeneTrees(this); if (this.forceAlg == 2) { ((WQWeightCalculator)this.weightCalculator).useSetWeightsAlgorithm(); } this.weightCalculator.initializeWeightContainer( this.trees.size() * GlobalMaps.taxonIdentifier.taxonCount() * 2); } /** * This method first computes the quartet scores and then calls * scoreBranches to annotate branches (if needed). * The method assumes the input tree st has labels of individuals (not species). */ public double scoreSpeciesTreeWithGTLabels(Tree st, boolean initialize) { if (initialize) { mapNames(); IClusterCollection clusters = newClusterCollection(); this.dataCollection = newCounter(clusters); weightCalculator = newWeightCalculator(); WQDataCollection wqDataCollection = (WQDataCollection) this.dataCollection; wqDataCollection.preProcess(this); this.initializeWeightCalculator(); //ASTRAL IV SPECIFIC this.maxpossible = this.calculateMaxPossible(); System.err.println("Number of quartet trees in the gene trees: "+this.maxpossible); //System.err.println(this.maxpossible); } Stack<STITreeCluster> stack = new Stack<STITreeCluster>(); long sum = 0l; boolean poly = false; for (TNode node: st.postTraverse()) { if (node.isLeaf()) { String nodeName = node.getName(); //GlobalMaps.TaxonNameMap.getSpeciesName(node.getName()); STITreeCluster cluster = GlobalMaps.taxonIdentifier.newCluster(); Integer taxonID = GlobalMaps.taxonIdentifier.taxonId(nodeName); cluster.addLeaf(taxonID); stack.add(cluster); } else { ArrayList<STITreeCluster> childbslist = new ArrayList<STITreeCluster>(); BitSet bs = new BitSet(GlobalMaps.taxonIdentifier.taxonCount()); for (TNode child: node.getChildren()) { STITreeCluster pop = stack.pop(); childbslist.add(pop); bs.or(pop.getBitSet()); } STITreeCluster cluster = GlobalMaps.taxonIdentifier.newCluster(); cluster.setCluster((BitSet) bs.clone()); //((STINode)node).setData(new GeneTreeBitset(node.isRoot()? -2: -1)); stack.add(cluster); STITreeCluster remaining = cluster.complementaryCluster(); if (remaining.getClusterSize() != 0) { childbslist.add(remaining); } if (childbslist.size() > 3) { /*for (STITreeCluster chid :childbslist) { System.err.print(chid.getClusterSize()+" "); } System.err.println(" (polytomy)");*/ if (this.getBranchAnnotation() % 2 == 0) { poly = true; continue; } } for (int i = 0; i < childbslist.size(); i++) { for (int j = i+1; j < childbslist.size(); j++) { for (int k = j+1; k < childbslist.size(); k++) { sum += weightCalculator.getWeight( new Tripartition(childbslist.get(i), childbslist.get(j), childbslist.get(k)), null); } } } } } if (poly) { System.err.println("Final quartet score is: won't report because of the existense of polytomies and to save time. " + "To get the score run with -t 1 and you can score the tree below using -q. "); System.err.println("Final normalized quartet score is: won't report because of the existense of polytomies and to save time. " + "To get the score run with -t 1 and you can score the tree below using -q. "); } else { System.err.println("Final quartet score is: " + sum/4l); System.err.println("Final normalized quartet score is: "+ (sum/4l+0.)/this.maxpossible); //System.out.println(st.toNewickWD()); } if (this.getBranchAnnotation() == 0){ for (TNode n: st.postTraverse()) { ((STINode) n).setData(null); } } else { double logscore = this.scoreBranches(st); if (this.getBranchAnnotation() % 12 == 0) { System.err.println("log local posterior: "+logscore); return logscore; } } return (sum/4l+0.)/this.maxpossible; } private boolean skipNode (TNode node) { TNode parent = node.getParent(); return node.isLeaf() || node.isRoot() || node.getChildCount() > 2 || (parent.getChildCount() > 3) || (parent.getChildCount() > 2 && !parent.isRoot()) || ((parent.isRoot() && parent.getChildCount() == 2 && node.getSiblings().get(0).getChildCount() != 2)); } private class NodeData { Double mainfreq, alt1freqs, alt2freqs; Long quartcount; Integer effn ; Quadrapartition [] quads; STBipartition[] bipartitions; } /** * Annotates the species tree branches with support, branch length, etc. * @param st * @return */ private double scoreBranches(Tree st) { double ret = 0; weightCalculator = new BipartitionWeightCalculator(this,((WQWeightCalculator)this.weightCalculator).geneTreesAsInts()); BipartitionWeightCalculator weightCalculator2 = (BipartitionWeightCalculator) weightCalculator; WQDataCollection wqDataCollection = (WQDataCollection) this.dataCollection; //wqDataCollection.initializeWeightCalculator(this); /** * Add bitsets to each node for all taxa under it. * Bitsets are saved in nodes "data" field */ BufferedWriter freqWriter = null; BufferedWriter Rscript = null; //List<String> freqWriterLines = new ArrayList<String>(); if (this.getBranchAnnotation() % 16 == 0) { String freqOutputPath = this.options.getFreqOutputPath(); try { Rscript = new BufferedWriter(new FileWriter(freqOutputPath + File.separator+ "freqQuadVisualization.R")); freqWriter = new BufferedWriter(new FileWriter(freqOutputPath + File.separator+ "freqQuad.csv")); } catch (IOException e) { throw new RuntimeException(e); } } Stack<STITreeCluster> stack = new Stack<STITreeCluster>(); int numNodes = 0; for (TNode n: st.postTraverse()) { STINode node = (STINode) n; if (node.isLeaf()) { String nodeName = node.getName(); //GlobalMaps.TaxonNameMap.getSpeciesName(node.getName()); STITreeCluster cluster = GlobalMaps.taxonIdentifier.newCluster(); Integer taxonID = GlobalMaps.taxonIdentifier.taxonId(nodeName); cluster.addLeaf(taxonID); stack.add(cluster); node.setData(cluster); } else { ArrayList<STITreeCluster> childbslist = new ArrayList<STITreeCluster>(); BitSet bs = new BitSet(GlobalMaps.taxonIdentifier.taxonCount()); for (TNode child: n.getChildren()) { STITreeCluster pop = stack.pop(); childbslist.add(pop); bs.or(pop.getBitSet()); } STITreeCluster cluster = GlobalMaps.taxonIdentifier.newCluster(); cluster.setCluster((BitSet) bs.clone()); //((STINode)node).setData(new GeneTreeBitset(node.isRoot()? -2: -1)); stack.add(cluster); node.setData(cluster); if (options.getBranchannotation() % 16 == 0) { String ndName = "N" + Integer.toString(numNodes); numNodes += 1; node.setName(ndName); } } } stack = new Stack<STITreeCluster>(); /** * For each node, * 1. create three quadripartitoins for the edge above it * 2. score the quadripartition * 3. save the scores in a list for annotations in the next loop */ Queue<NodeData> nodeDataList = new LinkedList<NodeData>(); for (TNode n: st.postTraverse()) { STINode node = (STINode) n; if (node.isLeaf()) { stack.push((STITreeCluster) node.getData()); } else { NodeData nd = null; STITreeCluster cluster = (STITreeCluster) node.getData(); STITreeCluster c1 = null, c2 = null; long cs = cluster.getClusterSize()+0l; for (int i =0; i< node.getChildCount(); i++) { if (c1 == null) c1 = stack.pop(); else if (c2 == null) c2 = stack.pop(); else stack.pop(); } stack.push(cluster); /** * For terminal branches in a multi-ind data */ if (cs > 1 && GlobalMaps.taxonNameMap.getSpeciesIdMapper().isSingleSP(cluster.getBitSet())) { STITreeCluster[] sisterRemaining = getSisterRemaining(node); STITreeCluster sister = sisterRemaining[0]; STITreeCluster remaining = sisterRemaining[1]; nd = getNodeData(0d, 0d, 0d, 0); nodeDataList.add(nd); /** * Compute a quadripartition per each individual */ BitSet bitSet = cluster.getBitSet(); for (int j = bitSet.nextSetBit(0); j >= 0; j = bitSet.nextSetBit(j + 1)) { c1 = new STITreeCluster(cluster); c1.getBitSet().clear(j); c2 = GlobalMaps.taxonIdentifier.newCluster(); c2.getBitSet().set(j); Quadrapartition[] threequads = new Quadrapartition [] { weightCalculator2.new Quadrapartition (c1, c2, sister, remaining), weightCalculator2.new Quadrapartition (c1, sister, c2, remaining), weightCalculator2.new Quadrapartition (c1, remaining, c2, sister) }; /** * Scores all three quadripartitoins */ Results s = weightCalculator2.getWeight(threequads); nd.mainfreq += s.qs[0]; nd.alt1freqs += s.qs[1]; nd.alt2freqs += s.qs[2]; nd.effn += s.effn; } /** * Average frequencies. TODO: Good with missing data? */ nd.mainfreq /= cs; nd.alt1freqs /= cs; nd.alt2freqs /= cs; nd.effn /= (int) cs; nd.quartcount = (cs*(cs-1)/2) * (sister.getClusterSize()+0l) * (remaining.getClusterSize()+0l); } else if (! skipNode(node) ) { /** * Normal internal branches */ STITreeCluster[] sisterRemaining = getSisterRemaining(node); STITreeCluster sister = sisterRemaining[0]; STITreeCluster remaining = sisterRemaining[1]; Quadrapartition[] threequads = new Quadrapartition [] { weightCalculator2.new Quadrapartition (c1, c2, sister, remaining), weightCalculator2.new Quadrapartition (c1, sister, c2, remaining), weightCalculator2.new Quadrapartition (c1, remaining, c2, sister) }; /** * 2. Scores all three quadripartitoins */ Results s = weightCalculator2.getWeight(threequads); nd = getNodeData(s.qs[0],s.qs[1],s.qs[2],s.effn); nodeDataList.add(nd); nd.quartcount= (c1.getClusterSize()+0l) * (c2.getClusterSize()+0l) * (sister.getClusterSize()+0l) * (remaining.getClusterSize()+0l); if (this.getBranchAnnotation() == 7){ if (remaining.getClusterSize() != 0 && sister.getClusterSize() != 0 && c2.getClusterSize() != 0 && c1.getClusterSize() != 0 ){ System.err.print(c1.toString()+c2.toString()+"|"+sister.toString()+remaining.toString()+"\n"); } } if (this.getBranchAnnotation() == 6 || this.getBranchAnnotation() % 16 == 0) { STITreeCluster c1plussis = GlobalMaps.taxonIdentifier.newCluster(); c1plussis.setCluster((BitSet) c1.getBitSet().clone()); c1plussis.getBitSet().or(sister.getBitSet()); STITreeCluster c1plusrem = GlobalMaps.taxonIdentifier.newCluster(); c1plusrem.setCluster((BitSet) c1.getBitSet().clone()); c1plusrem.getBitSet().or(remaining.getBitSet()); STBipartition bmain = new STBipartition(cluster, cluster.complementaryCluster()); STBipartition b2 = new STBipartition(c1plussis, c1plussis.complementaryCluster()); STBipartition b3 = new STBipartition(c1plusrem, c1plusrem.complementaryCluster()); STBipartition[] biparts = new STBipartition[] {bmain, b2, b3}; nd.quads = threequads; nd.bipartitions = biparts; } } else { /** * Root or trivial branches */ nodeDataList.add(null); } if (nd != null && nd.effn < 20) { System.err.println("You may want to ignore posterior probabilities and other statistics related to the following " + "branch branch because the effective number of genes impacting it is only "+ nd.effn + ":\n\t" + GlobalMaps.taxonNameMap.getSpeciesIdMapper().getSTClusterForGeneCluster(cluster)); } } } /** * Annotate each branch by updating its data field * according to scores and user's annotation preferences. */ NodeData nd = null; for (TNode n: st.postTraverse()) { STINode node = (STINode) n; if (node.isLeaf()) { node.setData(null); continue; } nd = nodeDataList.poll(); if (nd == null ) { node.setData(null); continue; } Double f1 = nd.mainfreq; Double f2 = nd.alt1freqs; Double f3 = nd.alt2freqs; Long quarc = nd.quartcount; Double effni = nd.effn + 0.0; if ( Math.abs((f1+f2+f3) - effni) > 0.001 ) { //System.err.println("Adjusting effective N from\t" + effni + "\tto\t" + (f1 + f2 + f3) + ". This should only happen as a result of polytomies in gene trees."); effni = f1 + f2 + f3; } if (this.options.getGeneRepeat() != 1) { f1 /= this.options.getGeneRepeat(); f2 /= this.options.getGeneRepeat(); f3 /= this.options.getGeneRepeat(); effni /= this.options.getGeneRepeat(); } //Long sum = p+a1+a2; Posterior post = new Posterior( f1,f2,f3,(double)effni, options.getLambda()); double bl = post.branchLength(); node.setParentDistance(bl); if (this.getBranchAnnotation() == 0){ node.setData(null); } else if (this.getBranchAnnotation() == 1){ node.setData(df.format((f1+.0)/effni*100)); } else if (this.getBranchAnnotation() == 10) { df.setMaximumFractionDigits(5); double pval = post.getPvalue(); if (pval < 0) { System.err.println("" + "Cannot perform polytomy test with effective N (after polytomies) "+ effni + ":\n\t" + node); node.setData("NA"); } else { node.setData(df.format(pval)); } } else { double postQ1 = post.getPost(); ret += Math.log(postQ1); if (this.getBranchAnnotation() == 3 || this.getBranchAnnotation() == 12) { node.setData(df.format(postQ1)); } else if (this.getBranchAnnotation() % 2 == 0) { post = new Posterior(f2,f1,f3,(double)effni, options.getLambda()); double postQ2 = post.getPost(); post = new Posterior(f3,f1,f2,(double)effni, options.getLambda()); double postQ3 = post.getPost(); if (this.getBranchAnnotation() == 2) node.setData( "'[q1="+(f1)/effni+";q2="+(f2)/effni+";q3="+(f3)/effni+ ";f1="+f1+";f2="+f2+";f3="+f3+ ";pp1="+postQ1+";pp2="+postQ2+";pp3="+postQ3+ ";QC="+quarc+";EN="+effni+"]'"); else if (this.getBranchAnnotation() == 4) { node.setData("'[pp1="+df.format(postQ1)+";pp2="+df.format(postQ2)+";pp3="+df.format(postQ3)+"]'"); } else if (this.getBranchAnnotation() == 6){ node.setData(df.format(postQ1)); Quadrapartition[] threequads = nd.quads; STBipartition[] biparts = nd.bipartitions; System.err.println(threequads[0] + " [" + biparts[0].toString2() +"] : "+postQ1 +" ** f1 = "+f1+ " f2 = "+f2+" f3 = "+f3+" EN = "+ effni+" **"); System.err.println(threequads[1] + " ["+biparts[1].toString2()+"] : "+postQ2+ " ** f1 = "+f2+ " f2 = "+f1+" f3 = "+f3+" EN = "+ effni+" **"); System.err.println(threequads[2] + " ["+biparts[2].toString2()+"] : "+postQ3+ " ** f1 = "+f3+ " f2 = "+f1+" f3 = "+f2+" EN = "+ effni+" **"); } else if (this.getBranchAnnotation() == 8){ node.setData( "'[q1="+df.format((f1)/effni)+ ";q2="+df.format((f2)/effni)+ ";q3="+df.format((f3)/effni)+"]'"); } else if (this.getBranchAnnotation() % 16 == 0) { node.setData("'[pp1="+df.format(postQ1)+";pp2="+df.format(postQ2)+";pp3="+df.format(postQ3)+"]'"); Quadrapartition[] threequads = nd.quads; //STBipartition[] biparts = nd.bipartitions; if (threequads == null) continue; try { if (this.getBranchAnnotation() == 16) { String lineTmp = node.getName() + "\t" + "t1" + "\t" + threequads[0].toString2() + "\t" + Double.toString(postQ1) + "\t" + Double.toString(f1) + "\t" + Double.toString(effni); freqWriter.write(lineTmp + "\n"); lineTmp = node.getName() + "\t" + "t2" + "\t" + threequads[1].toString2() + "\t" + Double.toString(postQ2) + "\t" + Double.toString(f2) + "\t" + Double.toString(effni); freqWriter.write(lineTmp + "\n"); lineTmp = node.getName() + "\t" + "t3" + "\t" + threequads[2].toString2() + "\t" + Double.toString(postQ3) + "\t" + Double.toString(f3) + "\t" + Double.toString(effni); freqWriter.write(lineTmp + "\n"); } else { String lineTmp = node.getName() + "\t" + "t1" + "\t" + threequads[0].toString2() + "\t" + Double.toString((f1)/effni) + "\t" + Double.toString(f1) + "\t" + Double.toString(effni); freqWriter.write(lineTmp + "\n"); lineTmp = node.getName() + "\t" + "t2" + "\t" + threequads[1].toString2() + "\t" + Double.toString((f2)/effni) + "\t" + Double.toString(f2) + "\t" + Double.toString(effni); freqWriter.write(lineTmp + "\n"); lineTmp = node.getName() + "\t" + "t3" + "\t" + threequads[2].toString2() + "\t" + Double.toString((f3)/effni) + "\t" + Double.toString(f3) + "\t" + Double.toString(effni); freqWriter.write(lineTmp + "\n"); } } catch (IOException e) { throw new RuntimeException(e); } } } //i++; } } if (!nodeDataList.isEmpty()) throw new RuntimeException("Hmm, this shouldn't happen; "+nodeDataList); if (this.getBranchAnnotation() % 16 == 0) { try { Rscript.write("#!/usr/bin/env Rscript\n"); Rscript.write("red='#d53e4f';orange='#1d91c0';blue='#41b6c4';colormap = c(red,orange,blue)\n"); Rscript.write("require(reshape2);require(ggplot2);\n"); Rscript.write("dirPath = '.'; filePath = paste(dirPath" + ",'/freqQuadCorrected.csv',sep=''); md<-read.csv(filePath,header=F,sep='\\t'); md$value = md$V5/md$V6;\n"); Rscript.write("a<-length(levels(as.factor(md$V7)))*3.7; b<-4; sizes <- c(a,b);\n"); Rscript.write("md$V8<-reorder(md$V8,-md$value)\n"); Rscript.write("ggplot(data=md)+aes(x=V8,y=value,fill=V9)+" + "geom_bar(stat='identity',color=1,width=0.8,position='dodge')+" + "theme_bw()+theme(axis.text.x=element_text(angle=90))+scale_fill_manual" + "(values=colormap,name='Topology')+geom_hline(yintercept=1/3,size=0.4,linetype=2)+" + "ylab('relative freq.')+facet_wrap(~V7,scales='free_x')+xlab('')\n"); Rscript.write("pdfFile = paste(dirPath,'/relativeFreq.pdf',sep=''); ggsave(pdfFile,width = sizes[1], height= sizes[2]);\n"); Rscript.close(); freqWriter.close(); } catch (IOException e) { throw new RuntimeException("Hmm, the Rscript and frequency of Quadripartition files cannot be created!"); } } System.err.println("Extended species tree:"); System.err.println(st.toStringWD()); return ret; } private NodeData getNodeData(Double m, Double a1, Double a2, Integer en) { NodeData nd; nd = new NodeData(); nd.mainfreq = m; nd.alt1freqs=a1; nd.alt2freqs=a2; nd.effn = en; return nd; } private STITreeCluster[] getSisterRemaining(STINode node) { STITreeCluster [] sisterRemaining = {null,null}; Iterator<STINode> siblingsIt = node.getParent().getChildren().iterator(); STINode sibling = siblingsIt.next(); if ( sibling == node ) sibling = siblingsIt.next(); sisterRemaining[0] = (STITreeCluster)sibling.getData(); if (node.getParent().isRoot() && node.getParent().getChildCount() == 3) { sibling = siblingsIt.next(); if (sibling == node) sibling = siblingsIt.next(); sisterRemaining[1] = (STITreeCluster)sibling.getData();; } else if (node.getParent().isRoot() && node.getParent().getChildCount() == 2) { if (sibling.getChildCount() == 2) { Iterator<STINode> nieceIt = sibling.getChildren().iterator(); sisterRemaining[0] = (STITreeCluster) nieceIt.next().getData(); sisterRemaining[1] = (STITreeCluster) nieceIt.next().getData(); } else { System.err.println("WARN: we should never be here; something wrong with branch annotations (but topology will be fine). "); } } else { sisterRemaining[1] = ((STITreeCluster)node.getParent().getData()).complementaryCluster(); } return sisterRemaining; } @Override Long getTotalCost(Vertex all) { System.err.println("Normalized score (portion of input quartet trees satisfied before correcting for multiple individuals): " + all._max_score/4./this.maxpossible); return (long) (all._max_score/4l); } @Override AbstractComputeMinCostTask<Tripartition> newComputeMinCostTask(AbstractInference<Tripartition> dlInference, Vertex all, IClusterCollection clusters) { return new WQComputeMinCostTask( (WQInference) dlInference, all, clusters); } IClusterCollection newClusterCollection() { return new WQClusterCollection(GlobalMaps.taxonIdentifier.taxonCount()); } WQDataCollection newCounter(IClusterCollection clusters) { return new WQDataCollection((WQClusterCollection)clusters, this); } @Override AbstractWeightCalculator<Tripartition> newWeightCalculator() { return new WQWeightCalculator(this); } @Override void setupMisc() { this.maxpossible = this.calculateMaxPossible(); System.err.println("Number of quartet trees in the gene trees: " + this.maxpossible); } /** * obsolete */ private void automaticallyDecideAlgorithm(int geneTreeTripartitonCountSize, int k){ if (this.forceAlg != -1) { return; } if (k <= 0 || geneTreeTripartitonCountSize <= 0) { throw new RuntimeException("gene tree tripartition size or k not set properly"); } if (this.forceAlg == -1) { this.forceAlg = ( GlobalMaps.taxonIdentifier.taxonCount() <= 32 || (geneTreeTripartitonCountSize < k*6)) ? 2 : 1; } else { throw new RuntimeException("Algorithm already set"); } } }
92445a56f3871b38daba88c5a49bbc643679b6ef
2,707
java
Java
src/main/java/me/qyh/blog/plugin/markdowniteditor/Https.java
liyuanxuan/blog-master
d8099170407bd50c54e22380e29a264d44b6ce4d
[ "Apache-2.0" ]
null
null
null
src/main/java/me/qyh/blog/plugin/markdowniteditor/Https.java
liyuanxuan/blog-master
d8099170407bd50c54e22380e29a264d44b6ce4d
[ "Apache-2.0" ]
null
null
null
src/main/java/me/qyh/blog/plugin/markdowniteditor/Https.java
liyuanxuan/blog-master
d8099170407bd50c54e22380e29a264d44b6ce4d
[ "Apache-2.0" ]
null
null
null
24.169643
81
0.720355
1,002,976
package me.qyh.blog.plugin.markdowniteditor; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; import java.nio.charset.StandardCharsets; import jdk.incubator.http.HttpClient; import jdk.incubator.http.HttpClient.Version; import jdk.incubator.http.HttpRequest; import jdk.incubator.http.HttpRequest.BodyPublisher; import jdk.incubator.http.HttpResponse.BodyHandler; import me.qyh.blog.core.exception.SystemException; /** * <p> * <b>如果启用了java9的httpclient,则会优先采用,可以在tomcat的启动参数中,加入额外的模块,例如在catalina.sh中加入</b> * </p> * * <pre> * JAVA_OPTS=--add-modules=jdk.incubator.httpclient * </pre> * * @author wwwqyhme * */ class Https { private static boolean isIncubatorEnable; private static HttpTools tools; static { try { Class.forName("jdk.incubator.http.HttpClient"); isIncubatorEnable = true; } catch (Exception e) { } if (isIncubatorEnable) { tools = new IncubatorHttpTools(); } else { tools = new DefaultHttpTools(); } } public static String post(String uri, String data) throws IOException { return tools.post(uri, data); } private Https() { super(); } private interface HttpTools { String post(String uri, String data) throws IOException; } private static final class IncubatorHttpTools implements HttpTools { private HttpClient client; public IncubatorHttpTools() { super(); this.client = HttpClient.newHttpClient(); } @Override public String post(String uri, String data) throws IOException { URI _uri; try { _uri = new URI(uri); } catch (URISyntaxException e) { throw new SystemException(e.getMessage(), e); } HttpRequest req = HttpRequest.newBuilder().uri(_uri).version(Version.HTTP_1_1) .POST(BodyPublisher.fromString(data)).build(); try { return client.send(req, BodyHandler.asString()).body(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SystemException(e.getMessage(), e); } } } private static final class DefaultHttpTools implements HttpTools { @Override public String post(String uri, String data) throws IOException { URL url = new URL(uri); URLConnection con = url.openConnection(); HttpURLConnection http = (HttpURLConnection) con; http.setRequestMethod("POST"); http.setDoOutput(true); http.connect(); try (OutputStream os = http.getOutputStream()) { os.write(data.getBytes(StandardCharsets.UTF_8)); } try (InputStream is = http.getInputStream()) { return new String(is.readAllBytes()); } } } }
92445a702dcc91d97287ef97de403492e00d71d6
2,024
java
Java
workbench/mps-platform/jetbrains.mps.ide.platform/source_gen/jetbrains/mps/ide/icons/GlobalIconManager.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
workbench/mps-platform/jetbrains.mps.ide.platform/source_gen/jetbrains/mps/ide/icons/GlobalIconManager.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
workbench/mps-platform/jetbrains.mps.ide.platform/source_gen/jetbrains/mps/ide/icons/GlobalIconManager.java
trespasserw/MPS
dbc5c76496e8ccef46dd420eefcd5089b1bc234b
[ "Apache-2.0" ]
null
null
null
36.8
184
0.784091
1,002,977
package jetbrains.mps.ide.icons; /*Generated by MPS */ import jetbrains.mps.annotations.GeneratedClass; import com.intellij.openapi.Disposable; import jetbrains.mps.classloading.ClassLoaderManager; import com.intellij.openapi.application.ApplicationManager; import jetbrains.mps.ide.MPSCoreComponents; import jetbrains.mps.smodel.language.ConceptRegistry; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.components.ServiceManager; import jetbrains.mps.classloading.DeployListener; import java.util.Set; import jetbrains.mps.module.ReloadableModule; import org.jetbrains.annotations.NotNull; import org.jetbrains.mps.openapi.util.ProgressMonitor; @GeneratedClass(node = "r:836426ab-a6f4-4fa3-9a9c-34c02ed6ab5d(jetbrains.mps.ide.icons)/1315815304215647153", model = "r:836426ab-a6f4-4fa3-9a9c-34c02ed6ab5d(jetbrains.mps.ide.icons)") public class GlobalIconManager extends BaseIconManager implements Disposable { private ClassLoaderManager myClm; private MyDeployListener myListener = new MyDeployListener(); public GlobalIconManager() { super(ApplicationManager.getApplication().getComponent(MPSCoreComponents.class).getPlatform().findComponent(ConceptRegistry.class)); MPSCoreComponents cc = ApplicationManager.getApplication().getComponent(MPSCoreComponents.class); myClm = cc.getClassLoaderManager(); myClm.addListener(this.myListener); Disposer.register(cc, this); } public static GlobalIconManager getInstance() { return ServiceManager.getService(GlobalIconManager.class); } @Override public void dispose() { if (myClm != null) { myClm.removeListener(myListener); myClm = null; } } private class MyDeployListener implements DeployListener { public MyDeployListener() { } public void onUnloaded(Set<ReloadableModule> unloaded, @NotNull ProgressMonitor pm) { invalidate(unloaded); } public void onLoaded(Set<ReloadableModule> loaded, @NotNull ProgressMonitor pm) { invalidate(loaded); } } }
92445a804d990a5b4a530650227655317bcdf79e
287
java
Java
src/main/java/com/questnr/requests/CommunityNameRequest.java
questnr/questnr-core
1439dfb176bc020112de6367dbc56d45e57b0204
[ "MIT" ]
null
null
null
src/main/java/com/questnr/requests/CommunityNameRequest.java
questnr/questnr-core
1439dfb176bc020112de6367dbc56d45e57b0204
[ "MIT" ]
null
null
null
src/main/java/com/questnr/requests/CommunityNameRequest.java
questnr/questnr-core
1439dfb176bc020112de6367dbc56d45e57b0204
[ "MIT" ]
null
null
null
20.5
56
0.710801
1,002,978
package com.questnr.requests; public class CommunityNameRequest { private String communityName; public String getCommunityName() { return communityName; } public void setCommunityName(String communityName) { this.communityName = communityName; } }