blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
118c3175d05c0b1df8cbc977e551595327171fbf
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/9/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3D_dotProduct_774.java
9fa04795a217e8c3824193685075b2a54585cf77
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,710
java
org apach common math3 geometri euclidean threed implement link vector3 vector3d link extend field element extendedfieldel instanc guarante immut param type field element version field vector3 fieldvector3d extend field element extendedfieldel serializ comput dot product instanc vector implement specif multipl addit algorithm preserv accuraci reduc cancel effect accur orthogon vector math arrai matharrai linear combin linearcombin param vector dot product dot product dotproduct vector3 vector3d linear combin linearcombin getx geti getz
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
a026099b3bcbb7af857234bcabb2735b40f96077
4d292f8d749fc2c84a6ee75643d9a1dc57c0ea4b
/Xfire/HelpingServlet/src/main/java/com/sample/servlet/AssociateServlet.java
ae6ce06e7d44cf17eff48cc6410774bee8acccd7
[]
no_license
hughbrien/docker-frameworks-demo
cfc22c7cd1142c82c9aa686c0097c5a6c26a3aee
fd5100e54a98037613bc1199ae39e44dfe12acae
refs/heads/master
2021-01-17T05:04:47.218416
2015-02-26T12:12:49
2015-02-26T12:12:49
31,478,519
1
0
null
2015-02-28T22:10:50
2015-02-28T22:10:50
null
UTF-8
Java
false
false
2,833
java
package com.sample.servlet; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class AssociateServlet extends HttpServlet { private static final long serialVersionUID = 1L; private final static Logger LOGGER = Logger .getLogger(AssociateServlet.class.getName()); private Connection connection; public AssociateServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { LOGGER.setLevel(Level.INFO); PreparedStatement ps = null; ResultSet rs = null; String email = "xyz@gmail.com"; String password = "dynamics"; LOGGER.info("Class:HelpingServlet###################"); try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test", "root", "root"); if (connection != null) { ps = connection .prepareStatement("select id, name, email,country from Users where email=? and password=? limit 1"); ps.setString(1, email); ps.setString(2, password); rs = ps.executeQuery(); if (rs != null && rs.next()) { User user = new User(rs.getString("name"), rs.getString("email"), rs.getString("country"), rs.getInt("id")); System.out.println("User found with details=" + user); } connection.close(); test("http://localhost:8080/websvc/ws"); } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO: handle exception e.printStackTrace(); } LOGGER.info("doget method #####################"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { LOGGER.setLevel(Level.INFO); } public static void test(String address) { try { URL serverAddress = new URL(address); HttpURLConnection connection = null; connection = (HttpURLConnection) serverAddress.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setReadTimeout(30000); connection.connect(); BufferedReader reader = new BufferedReader(new InputStreamReader( connection.getInputStream())); connection.disconnect(); } catch (Exception e) { e.printStackTrace(); } } }
[ "udaya@neevtech.com" ]
udaya@neevtech.com
bf5dc64836025c5a5b4f7f7a020eb2e42b3f9907
a559bae91af3f342017df5e133bdf0d9992c2f26
/classLab/src/Lab9_2/AlphaSub.java
7fca38c1436f70413e9d99eeab6e82543ff1715c
[]
no_license
k-bigboss99/FCU-OOP_class
aedcabef6246ff6940b24b048cb41f416796c232
9bc30d22820e0f4e6ad3273276992b5215d54c25
refs/heads/master
2022-09-27T22:58:25.831249
2020-06-04T08:22:12
2020-06-04T08:22:12
269,300,314
0
1
null
null
null
null
UTF-8
Java
false
false
189
java
package Lab9_2; import Lab9_1.Alpha; public class AlphaSub extends Alpha { @Override public void sayHello(String name) { System.out.println("Hello AlphaSub " + name); } }
[ "a27070207@gmail.com" ]
a27070207@gmail.com
7108e7f4bdb1525ee890843b328ac96d2ddc53e2
52bd222cad14c369c985b83d93dd991781aedeb4
/src/ExampleAbstract/Solution23.java
f658995655e0e81a29c406f518ef8bb44a6905a0
[]
no_license
hl174/JianZhiOffer
ce97d7416d42e2558cb624158fefdff3446b7850
482ec6f51fed2db543e04e79ff56f8520995803d
refs/heads/master
2020-04-19T13:11:01.565506
2016-09-01T04:38:49
2016-09-01T04:38:49
66,123,472
0
0
null
null
null
null
UTF-8
Java
false
false
1,529
java
package ExampleAbstract; /** * 二叉搜索树的后序遍历序列 * @author HL *题目描述 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。 如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。 */ public class Solution23 { public static boolean VerifySquenceOfBST(int [] sequence) { /** * 感觉需要递归,从最后开始分,前面部分的比比较数小,后面部分比比较数大;然后递归比较前后两部分 * 注意循环的入口和出口 * 33ms 528k */ if(sequence==null||sequence.length==0) return false; return check(sequence, 0, sequence.length-1); } public static boolean check(int[] a,int begin,int end){ //这里先不判断a是否 为null,默认是不为的 if(begin>=end) return true; int i; for(i=begin;i<end;i++){ if(a[i]>a[end]) break; } if(i==begin){//后面大的不一定是全部大 for(int k=i+1;k<end;k++){ if(a[k]<a[end]) return false; } return check(a, begin, end-1); }else if(i==end){ return check(a, begin, end-1); }else{//后面大的不一定是全部大 for(int w=i;w<end;w++){ if(a[w]<a[end]) return false; } return check(a, begin, i-1)&&check(a, i, end-1); } } public static void main(String[] args) { int[]a={4,6,12,8,16,14,10}; System.out.println(VerifySquenceOfBST(a)); } }
[ "280396245@qq.com" ]
280396245@qq.com
83280daf1b2fe64615a1f82720aa20ed8518ae2c
dd9b106c30334611366ea4e6d79dffbcc9d86823
/MyCoffeeMaker/Room.java
f7d7756f3d0fe3d699e35d98e82f6fd215d0e24d
[]
no_license
sacrebleujayy/deliverable5
c261e6d96e2fd2d6cbe99813ac15443b8656cec9
fb1c14c41c29358d6150f8a03246ff500b6c5f39
refs/heads/master
2021-05-28T19:11:59.133698
2015-04-14T20:49:02
2015-04-14T20:49:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,244
java
public class Room { private static int _pseudoRand = 0; private String _description = null; private boolean _northExit = false; private boolean _southExit = false; private boolean _hasSugar = false; private boolean _hasCream = false; private boolean _hasCoffee = false; public Room(boolean hasCoffee, boolean hasCream, boolean hasSugar, boolean northExit, boolean southExit) { _hasCoffee = hasCoffee; _hasCream = hasCream; _hasSugar = hasSugar; _northExit = northExit; _southExit = southExit; _description = generateDescription(); } public boolean hasItem() { return _hasSugar || _hasCream || _hasCoffee; } public boolean hasSugar() { return _hasSugar; } public boolean hasCream() { return _hasCream; } public boolean hasCoffee() { return _hasCoffee; } public boolean northExit() { return _northExit; } public boolean southExit() { return _southExit; } private String getAdjective() { String[] adjs = { "Small", "Quaint", "Shiny", "Magenta", "Funny", "Sad", "Fuchsia", "Beige", "Massive", "Refinanced", "Tight", "Loose", "Dead", "Smart", "Dumb", "Flat", "Bumpy", "Vivacious", "Slim", "Bloodthirsty", "Beautiful", "Flowery", "Purple", "Sandy", "Rough", "Perfect", "Heroic", "Minimalist", "Shoe-Losing", "Major", "Wonderful", "Loving", "Fun-Loving", "High-Level", "Functional","Static", "Dynamic", "Fast", "Bulletproof", "Late", "Silly", "Salty", "Sour", "Chair-Adjusting", "Brave", "Forgetful", "Chair-Sitting", "Mind-Blowing", "Crazy", "Funny", "Birdlike", "Bird-Brained", "Miniature", "High-Strung", "Famous", "Light", "Dark", "Feral", "Hairy", "Leaky", "Criminal", "Sassy", "Frumpy", "Tiny", "Prehistoric", "Metallic", "Sharp", "Historical", "Fierce", "Loud", "Lunar", "Bohemian", "Bored", "Suspicious", "Flirtatious", "Street-Smart", "Forgetful", "Tooth-Filled", "Ravenous", "Well-Directed", "Well-Fed", "Well-Maintained", "Deep", "Shallow", "Victorian", "Formal", "Creamy", "Tangy", "Fresh", "Magical", "Mystical", "Secret", "Prophetic", "Immortal", "Far-Sighted", "Short-Sighted", "Latin", "Nepalese", "Medical", "Straightforward", "Literary", "Critical", "Backward", "Rabid", "Bombastic", "Smelly", "Wanton", "Confusing", "Cheesy", "Devious", "Pumpkin Spice", "Submerged", "Muscular", "Well-Organized", "Smooth", "Delicious", "Creamy", "Dry", "Independent", "Free", "Cheap", "Diaphonous", "Tired", "Sultry", "Beguiling", "Long-Lived", "Repetitive", "Disgusting", "Swampy", "Dirty", "Muddy", "Clean", "Dry", "Wet", "Clear", "Transparent", "Glorious", "Sacrificial", "Electric", "Mechanical", "Automatic", "Rapid", "Nervous", "Calm", "Contemplative", "Cerebral", "Voracious", "Starving", "Full", "Killer", "Wicked", "Rational", "Real", "Homemade", "Cigar-Chomping", "Sinister", "Doubting", "Robotic", "Monosyllabic", "Maniacal", "Postmodern", "Prehistoric" }; return adjs[(_pseudoRand++ % adjs.length)]; } private String getNoun() { String[] nouns = { "kettle", "sink", "sofa", "plant", "elephant", "bird cage", "record player", "picture of a ghost", "picture of a dog", "dresser", "book", "pizza", "cake", "pinball game", "slug", "board game", "energy drink", "jack o' lantern", "fireplace", "pumpkin spice latte", "copy machine", "bag of money", "stapler", "bottle", "xylophone", "tablecloth", "air hockey table", "textbook", "dog", "duck", "programmer", "radish", "clock", "carpet", "rug", "stamp collection"}; return nouns[(_pseudoRand++ % nouns.length)]; } private String generateDescription() { String toReturn = "\nYou see a " + getAdjective() + " room.\n" + "It has a " + getAdjective() + " " + getNoun() + ".\n"; if (_northExit) { toReturn += "A " + getAdjective() + " door leads North.\n"; } if (_southExit) { toReturn += "A " + getAdjective() + " door leads South.\n"; } return toReturn; } public String getDescription() { return _description; } }
[ "mcaleer.jordan@gmail.com" ]
mcaleer.jordan@gmail.com
62f73dd46f4baf622c93931d07a612743d7eec4d
20f01931b8f05cf5b73967afc1df776db8225d3e
/camel-yaml-dsl-common-deserializers/src/generated/java/com/github/lburgazzoli/camel/dsl/yaml/common/deserializers/ModelDeserializersResolver.java
83abc353a97d58dac1709502ff591dfe140356f9
[ "Apache-2.0" ]
permissive
lburgazzoli/camel-yaml-dsl
4af47c477829173f891eaeea1b263c70a95a33f7
613c33344648e46f15dffb43aa3d112134edf699
refs/heads/main
2023-03-09T01:25:59.640241
2021-02-23T18:48:22
2021-02-23T18:48:22
323,365,250
1
0
null
null
null
null
UTF-8
Java
false
false
50,555
java
package com.github.lburgazzoli.camel.dsl.yaml.common.deserializers; import com.github.lburgazzoli.camel.dsl.yaml.common.YamlDeserializerResolver; import java.lang.Override; import java.lang.String; import org.snakeyaml.engine.v2.api.ConstructNode; public final class ModelDeserializersResolver implements YamlDeserializerResolver { @Override public int getOrder() { return YamlDeserializerResolver.ORDER_LOWEST - 1; } @Override public ConstructNode resolve(String id) { switch(id) { case "asn1": return new ModelDeserializers.ASN1DataFormatDeserializer(); case "org.apache.camel.model.dataformat.ASN1DataFormat": return new ModelDeserializers.ASN1DataFormatDeserializer(); case "aggregate": return new ModelDeserializers.AggregateDefinitionDeserializer(); case "org.apache.camel.model.AggregateDefinition": return new ModelDeserializers.AggregateDefinitionDeserializer(); case "any23": return new ModelDeserializers.Any23DataFormatDeserializer(); case "org.apache.camel.model.dataformat.Any23DataFormat": return new ModelDeserializers.Any23DataFormatDeserializer(); case "avro": return new ModelDeserializers.AvroDataFormatDeserializer(); case "org.apache.camel.model.dataformat.AvroDataFormat": return new ModelDeserializers.AvroDataFormatDeserializer(); case "barcode": return new ModelDeserializers.BarcodeDataFormatDeserializer(); case "org.apache.camel.model.dataformat.BarcodeDataFormat": return new ModelDeserializers.BarcodeDataFormatDeserializer(); case "base64": return new ModelDeserializers.Base64DataFormatDeserializer(); case "org.apache.camel.model.dataformat.Base64DataFormat": return new ModelDeserializers.Base64DataFormatDeserializer(); case "batch-config": return new ModelDeserializers.BatchResequencerConfigDeserializer(); case "org.apache.camel.model.config.BatchResequencerConfig": return new ModelDeserializers.BatchResequencerConfigDeserializer(); case "bean": return new ModelDeserializers.BeanDefinitionDeserializer(); case "org.apache.camel.model.BeanDefinition": return new ModelDeserializers.BeanDefinitionDeserializer(); case "beanio": return new ModelDeserializers.BeanioDataFormatDeserializer(); case "org.apache.camel.model.dataformat.BeanioDataFormat": return new ModelDeserializers.BeanioDataFormatDeserializer(); case "bindy": return new ModelDeserializers.BindyDataFormatDeserializer(); case "org.apache.camel.model.dataformat.BindyDataFormat": return new ModelDeserializers.BindyDataFormatDeserializer(); case "blacklist-service-filter": return new ModelDeserializers.BlacklistServiceCallServiceFilterConfigurationDeserializer(); case "org.apache.camel.model.cloud.BlacklistServiceCallServiceFilterConfiguration": return new ModelDeserializers.BlacklistServiceCallServiceFilterConfigurationDeserializer(); case "cbor": return new ModelDeserializers.CBORDataFormatDeserializer(); case "org.apache.camel.model.dataformat.CBORDataFormat": return new ModelDeserializers.CBORDataFormatDeserializer(); case "csimple": return new ModelDeserializers.CSimpleExpressionDeserializer(); case "org.apache.camel.model.language.CSimpleExpression": return new ModelDeserializers.CSimpleExpressionDeserializer(); case "caching-service-discovery": return new ModelDeserializers.CachingServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.CachingServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.CachingServiceCallServiceDiscoveryConfigurationDeserializer(); case "do-catch": return new ModelDeserializers.CatchDefinitionDeserializer(); case "org.apache.camel.model.CatchDefinition": return new ModelDeserializers.CatchDefinitionDeserializer(); case "choice": return new ModelDeserializers.ChoiceDefinitionDeserializer(); case "org.apache.camel.model.ChoiceDefinition": return new ModelDeserializers.ChoiceDefinitionDeserializer(); case "circuit-breaker": return new ModelDeserializers.CircuitBreakerDefinitionDeserializer(); case "org.apache.camel.model.CircuitBreakerDefinition": return new ModelDeserializers.CircuitBreakerDefinitionDeserializer(); case "claim-check": return new ModelDeserializers.ClaimCheckDefinitionDeserializer(); case "org.apache.camel.model.ClaimCheckDefinition": return new ModelDeserializers.ClaimCheckDefinitionDeserializer(); case "combined-service-discovery": return new ModelDeserializers.CombinedServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.CombinedServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.CombinedServiceCallServiceDiscoveryConfigurationDeserializer(); case "combined-service-filter": return new ModelDeserializers.CombinedServiceCallServiceFilterConfigurationDeserializer(); case "org.apache.camel.model.cloud.CombinedServiceCallServiceFilterConfiguration": return new ModelDeserializers.CombinedServiceCallServiceFilterConfigurationDeserializer(); case "constant": return new ModelDeserializers.ConstantExpressionDeserializer(); case "org.apache.camel.model.language.ConstantExpression": return new ModelDeserializers.ConstantExpressionDeserializer(); case "consul-service-discovery": return new ModelDeserializers.ConsulServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.ConsulServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.ConsulServiceCallServiceDiscoveryConfigurationDeserializer(); case "context-scan": return new ModelDeserializers.ContextScanDefinitionDeserializer(); case "org.apache.camel.model.ContextScanDefinition": return new ModelDeserializers.ContextScanDefinitionDeserializer(); case "convert-body-to": return new ModelDeserializers.ConvertBodyDefinitionDeserializer(); case "org.apache.camel.model.ConvertBodyDefinition": return new ModelDeserializers.ConvertBodyDefinitionDeserializer(); case "crypto": return new ModelDeserializers.CryptoDataFormatDeserializer(); case "org.apache.camel.model.dataformat.CryptoDataFormat": return new ModelDeserializers.CryptoDataFormatDeserializer(); case "csv": return new ModelDeserializers.CsvDataFormatDeserializer(); case "org.apache.camel.model.dataformat.CsvDataFormat": return new ModelDeserializers.CsvDataFormatDeserializer(); case "custom-data-format": return new ModelDeserializers.CustomDataFormatDeserializer(); case "org.apache.camel.model.dataformat.CustomDataFormat": return new ModelDeserializers.CustomDataFormatDeserializer(); case "custom-load-balancer": return new ModelDeserializers.CustomLoadBalancerDefinitionDeserializer(); case "org.apache.camel.model.loadbalancer.CustomLoadBalancerDefinition": return new ModelDeserializers.CustomLoadBalancerDefinitionDeserializer(); case "custom-service-filter": return new ModelDeserializers.CustomServiceCallServiceFilterConfigurationDeserializer(); case "org.apache.camel.model.cloud.CustomServiceCallServiceFilterConfiguration": return new ModelDeserializers.CustomServiceCallServiceFilterConfigurationDeserializer(); case "org.apache.camel.model.transformer.CustomTransformerDefinition": return new ModelDeserializers.CustomTransformerDefinitionDeserializer(); case "org.apache.camel.model.validator.CustomValidatorDefinition": return new ModelDeserializers.CustomValidatorDefinitionDeserializer(); case "org.apache.camel.model.DataFormatDefinition": return new ModelDeserializers.DataFormatDefinitionDeserializer(); case "org.apache.camel.model.transformer.DataFormatTransformerDefinition": return new ModelDeserializers.DataFormatTransformerDefinitionDeserializer(); case "data-formats": return new ModelDeserializers.DataFormatsDefinitionDeserializer(); case "org.apache.camel.model.dataformat.DataFormatsDefinition": return new ModelDeserializers.DataFormatsDefinitionDeserializer(); case "datasonnet": return new ModelDeserializers.DatasonnetExpressionDeserializer(); case "org.apache.camel.model.language.DatasonnetExpression": return new ModelDeserializers.DatasonnetExpressionDeserializer(); case "default-load-balancer": return new ModelDeserializers.DefaultServiceCallServiceLoadBalancerConfigurationDeserializer(); case "org.apache.camel.model.cloud.DefaultServiceCallServiceLoadBalancerConfiguration": return new ModelDeserializers.DefaultServiceCallServiceLoadBalancerConfigurationDeserializer(); case "delay": return new ModelDeserializers.DelayDefinitionDeserializer(); case "org.apache.camel.model.DelayDefinition": return new ModelDeserializers.DelayDefinitionDeserializer(); case "delete": return new ModelDeserializers.DeleteVerbDefinitionDeserializer(); case "org.apache.camel.model.rest.DeleteVerbDefinition": return new ModelDeserializers.DeleteVerbDefinitionDeserializer(); case "description": return new ModelDeserializers.DescriptionDefinitionDeserializer(); case "org.apache.camel.model.DescriptionDefinition": return new ModelDeserializers.DescriptionDefinitionDeserializer(); case "dns-service-discovery": return new ModelDeserializers.DnsServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.DnsServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.DnsServiceCallServiceDiscoveryConfigurationDeserializer(); case "dynamic-router": return new ModelDeserializers.DynamicRouterDefinitionDeserializer(); case "org.apache.camel.model.DynamicRouterDefinition": return new ModelDeserializers.DynamicRouterDefinitionDeserializer(); case "org.apache.camel.model.transformer.EndpointTransformerDefinition": return new ModelDeserializers.EndpointTransformerDefinitionDeserializer(); case "org.apache.camel.model.validator.EndpointValidatorDefinition": return new ModelDeserializers.EndpointValidatorDefinitionDeserializer(); case "enrich": return new ModelDeserializers.EnrichDefinitionDeserializer(); case "org.apache.camel.model.EnrichDefinition": return new ModelDeserializers.EnrichDefinitionDeserializer(); case "etcd-service-discovery": return new ModelDeserializers.EtcdServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.EtcdServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.EtcdServiceCallServiceDiscoveryConfigurationDeserializer(); case "exchange-property": return new ModelDeserializers.ExchangePropertyExpressionDeserializer(); case "org.apache.camel.model.language.ExchangePropertyExpression": return new ModelDeserializers.ExchangePropertyExpressionDeserializer(); case "failover": return new ModelDeserializers.FailoverLoadBalancerDefinitionDeserializer(); case "org.apache.camel.model.loadbalancer.FailoverLoadBalancerDefinition": return new ModelDeserializers.FailoverLoadBalancerDefinitionDeserializer(); case "fault-tolerance-configuration": return new ModelDeserializers.FaultToleranceConfigurationDefinitionDeserializer(); case "org.apache.camel.model.FaultToleranceConfigurationDefinition": return new ModelDeserializers.FaultToleranceConfigurationDefinitionDeserializer(); case "fhir-json": return new ModelDeserializers.FhirJsonDataFormatDeserializer(); case "org.apache.camel.model.dataformat.FhirJsonDataFormat": return new ModelDeserializers.FhirJsonDataFormatDeserializer(); case "fhir-xml": return new ModelDeserializers.FhirXmlDataFormatDeserializer(); case "org.apache.camel.model.dataformat.FhirXmlDataFormat": return new ModelDeserializers.FhirXmlDataFormatDeserializer(); case "filter": return new ModelDeserializers.FilterDefinitionDeserializer(); case "org.apache.camel.model.FilterDefinition": return new ModelDeserializers.FilterDefinitionDeserializer(); case "do-finally": return new ModelDeserializers.FinallyDefinitionDeserializer(); case "org.apache.camel.model.FinallyDefinition": return new ModelDeserializers.FinallyDefinitionDeserializer(); case "flatpack": return new ModelDeserializers.FlatpackDataFormatDeserializer(); case "org.apache.camel.model.dataformat.FlatpackDataFormat": return new ModelDeserializers.FlatpackDataFormatDeserializer(); case "get": return new ModelDeserializers.GetVerbDefinitionDeserializer(); case "org.apache.camel.model.rest.GetVerbDefinition": return new ModelDeserializers.GetVerbDefinitionDeserializer(); case "global-option": return new ModelDeserializers.GlobalOptionDefinitionDeserializer(); case "org.apache.camel.model.GlobalOptionDefinition": return new ModelDeserializers.GlobalOptionDefinitionDeserializer(); case "global-options": return new ModelDeserializers.GlobalOptionsDefinitionDeserializer(); case "org.apache.camel.model.GlobalOptionsDefinition": return new ModelDeserializers.GlobalOptionsDefinitionDeserializer(); case "grok": return new ModelDeserializers.GrokDataFormatDeserializer(); case "org.apache.camel.model.dataformat.GrokDataFormat": return new ModelDeserializers.GrokDataFormatDeserializer(); case "groovy": return new ModelDeserializers.GroovyExpressionDeserializer(); case "org.apache.camel.model.language.GroovyExpression": return new ModelDeserializers.GroovyExpressionDeserializer(); case "gzipdeflater": return new ModelDeserializers.GzipDataFormatDeserializer(); case "org.apache.camel.model.dataformat.GzipDataFormat": return new ModelDeserializers.GzipDataFormatDeserializer(); case "hl7": return new ModelDeserializers.HL7DataFormatDeserializer(); case "org.apache.camel.model.dataformat.HL7DataFormat": return new ModelDeserializers.HL7DataFormatDeserializer(); case "head": return new ModelDeserializers.HeadVerbDefinitionDeserializer(); case "org.apache.camel.model.rest.HeadVerbDefinition": return new ModelDeserializers.HeadVerbDefinitionDeserializer(); case "header": return new ModelDeserializers.HeaderExpressionDeserializer(); case "org.apache.camel.model.language.HeaderExpression": return new ModelDeserializers.HeaderExpressionDeserializer(); case "healthy-service-filter": return new ModelDeserializers.HealthyServiceCallServiceFilterConfigurationDeserializer(); case "org.apache.camel.model.cloud.HealthyServiceCallServiceFilterConfiguration": return new ModelDeserializers.HealthyServiceCallServiceFilterConfigurationDeserializer(); case "hl7terser": return new ModelDeserializers.Hl7TerserExpressionDeserializer(); case "org.apache.camel.model.language.Hl7TerserExpression": return new ModelDeserializers.Hl7TerserExpressionDeserializer(); case "hystrix-configuration": return new ModelDeserializers.HystrixConfigurationDefinitionDeserializer(); case "org.apache.camel.model.HystrixConfigurationDefinition": return new ModelDeserializers.HystrixConfigurationDefinitionDeserializer(); case "ical": return new ModelDeserializers.IcalDataFormatDeserializer(); case "org.apache.camel.model.dataformat.IcalDataFormat": return new ModelDeserializers.IcalDataFormatDeserializer(); case "idempotent-consumer": return new ModelDeserializers.IdempotentConsumerDefinitionDeserializer(); case "org.apache.camel.model.IdempotentConsumerDefinition": return new ModelDeserializers.IdempotentConsumerDefinitionDeserializer(); case "in-only": return new ModelDeserializers.InOnlyDefinitionDeserializer(); case "org.apache.camel.model.InOnlyDefinition": return new ModelDeserializers.InOnlyDefinitionDeserializer(); case "in-out": return new ModelDeserializers.InOutDefinitionDeserializer(); case "org.apache.camel.model.InOutDefinition": return new ModelDeserializers.InOutDefinitionDeserializer(); case "input-type": return new ModelDeserializers.InputTypeDefinitionDeserializer(); case "org.apache.camel.model.InputTypeDefinition": return new ModelDeserializers.InputTypeDefinitionDeserializer(); case "intercept": return new ModelDeserializers.InterceptDefinitionDeserializer(); case "org.apache.camel.model.InterceptDefinition": return new ModelDeserializers.InterceptDefinitionDeserializer(); case "intercept-from": return new ModelDeserializers.InterceptFromDefinitionDeserializer(); case "org.apache.camel.model.InterceptFromDefinition": return new ModelDeserializers.InterceptFromDefinitionDeserializer(); case "intercept-send-to-endpoint": return new ModelDeserializers.InterceptSendToEndpointDefinitionDeserializer(); case "org.apache.camel.model.InterceptSendToEndpointDefinition": return new ModelDeserializers.InterceptSendToEndpointDefinitionDeserializer(); case "jacksonxml": return new ModelDeserializers.JacksonXMLDataFormatDeserializer(); case "org.apache.camel.model.dataformat.JacksonXMLDataFormat": return new ModelDeserializers.JacksonXMLDataFormatDeserializer(); case "jaxb": return new ModelDeserializers.JaxbDataFormatDeserializer(); case "org.apache.camel.model.dataformat.JaxbDataFormat": return new ModelDeserializers.JaxbDataFormatDeserializer(); case "joor": return new ModelDeserializers.JoorExpressionDeserializer(); case "org.apache.camel.model.language.JoorExpression": return new ModelDeserializers.JoorExpressionDeserializer(); case "json-api": return new ModelDeserializers.JsonApiDataFormatDeserializer(); case "org.apache.camel.model.dataformat.JsonApiDataFormat": return new ModelDeserializers.JsonApiDataFormatDeserializer(); case "json": return new ModelDeserializers.JsonDataFormatDeserializer(); case "org.apache.camel.model.dataformat.JsonDataFormat": return new ModelDeserializers.JsonDataFormatDeserializer(); case "jsonpath": return new ModelDeserializers.JsonPathExpressionDeserializer(); case "org.apache.camel.model.language.JsonPathExpression": return new ModelDeserializers.JsonPathExpressionDeserializer(); case "kubernetes-service-discovery": return new ModelDeserializers.KubernetesServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.KubernetesServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.KubernetesServiceCallServiceDiscoveryConfigurationDeserializer(); case "lzf": return new ModelDeserializers.LZFDataFormatDeserializer(); case "org.apache.camel.model.dataformat.LZFDataFormat": return new ModelDeserializers.LZFDataFormatDeserializer(); case "language": return new ModelDeserializers.LanguageExpressionDeserializer(); case "org.apache.camel.model.language.LanguageExpression": return new ModelDeserializers.LanguageExpressionDeserializer(); case "load-balance": return new ModelDeserializers.LoadBalanceDefinitionDeserializer(); case "org.apache.camel.model.LoadBalanceDefinition": return new ModelDeserializers.LoadBalanceDefinitionDeserializer(); case "org.apache.camel.model.LoadBalancerDefinition": return new ModelDeserializers.LoadBalancerDefinitionDeserializer(); case "log": return new ModelDeserializers.LogDefinitionDeserializer(); case "org.apache.camel.model.LogDefinition": return new ModelDeserializers.LogDefinitionDeserializer(); case "loop": return new ModelDeserializers.LoopDefinitionDeserializer(); case "org.apache.camel.model.LoopDefinition": return new ModelDeserializers.LoopDefinitionDeserializer(); case "marshal": return new ModelDeserializers.MarshalDefinitionDeserializer(); case "org.apache.camel.model.MarshalDefinition": return new ModelDeserializers.MarshalDefinitionDeserializer(); case "method": return new ModelDeserializers.MethodCallExpressionDeserializer(); case "org.apache.camel.model.language.MethodCallExpression": return new ModelDeserializers.MethodCallExpressionDeserializer(); case "mime-multipart": return new ModelDeserializers.MimeMultipartDataFormatDeserializer(); case "org.apache.camel.model.dataformat.MimeMultipartDataFormat": return new ModelDeserializers.MimeMultipartDataFormatDeserializer(); case "multicast": return new ModelDeserializers.MulticastDefinitionDeserializer(); case "org.apache.camel.model.MulticastDefinition": return new ModelDeserializers.MulticastDefinitionDeserializer(); case "mvel": return new ModelDeserializers.MvelExpressionDeserializer(); case "org.apache.camel.model.language.MvelExpression": return new ModelDeserializers.MvelExpressionDeserializer(); case "ognl": return new ModelDeserializers.OgnlExpressionDeserializer(); case "org.apache.camel.model.language.OgnlExpression": return new ModelDeserializers.OgnlExpressionDeserializer(); case "on-completion": return new ModelDeserializers.OnCompletionDefinitionDeserializer(); case "org.apache.camel.model.OnCompletionDefinition": return new ModelDeserializers.OnCompletionDefinitionDeserializer(); case "on-exception": return new ModelDeserializers.OnExceptionDefinitionDeserializer(); case "org.apache.camel.model.OnExceptionDefinition": return new ModelDeserializers.OnExceptionDefinitionDeserializer(); case "on-fallback": return new ModelDeserializers.OnFallbackDefinitionDeserializer(); case "org.apache.camel.model.OnFallbackDefinition": return new ModelDeserializers.OnFallbackDefinitionDeserializer(); case "optimistic-lock-retry-policy": return new ModelDeserializers.OptimisticLockRetryPolicyDefinitionDeserializer(); case "org.apache.camel.model.OptimisticLockRetryPolicyDefinition": return new ModelDeserializers.OptimisticLockRetryPolicyDefinitionDeserializer(); case "otherwise": return new ModelDeserializers.OtherwiseDefinitionDeserializer(); case "org.apache.camel.model.OtherwiseDefinition": return new ModelDeserializers.OtherwiseDefinitionDeserializer(); case "org.apache.camel.model.OutputDefinition": return new ModelDeserializers.OutputDefinitionDeserializer(); case "output-type": return new ModelDeserializers.OutputTypeDefinitionDeserializer(); case "org.apache.camel.model.OutputTypeDefinition": return new ModelDeserializers.OutputTypeDefinitionDeserializer(); case "pgp": return new ModelDeserializers.PGPDataFormatDeserializer(); case "org.apache.camel.model.dataformat.PGPDataFormat": return new ModelDeserializers.PGPDataFormatDeserializer(); case "package-scan": return new ModelDeserializers.PackageScanDefinitionDeserializer(); case "org.apache.camel.model.PackageScanDefinition": return new ModelDeserializers.PackageScanDefinitionDeserializer(); case "pass-through-service-filter": return new ModelDeserializers.PassThroughServiceCallServiceFilterConfigurationDeserializer(); case "org.apache.camel.model.cloud.PassThroughServiceCallServiceFilterConfiguration": return new ModelDeserializers.PassThroughServiceCallServiceFilterConfigurationDeserializer(); case "patch": return new ModelDeserializers.PatchVerbDefinitionDeserializer(); case "org.apache.camel.model.rest.PatchVerbDefinition": return new ModelDeserializers.PatchVerbDefinitionDeserializer(); case "pipeline": return new ModelDeserializers.PipelineDefinitionDeserializer(); case "org.apache.camel.model.PipelineDefinition": return new ModelDeserializers.PipelineDefinitionDeserializer(); case "policy": return new ModelDeserializers.PolicyDefinitionDeserializer(); case "org.apache.camel.model.PolicyDefinition": return new ModelDeserializers.PolicyDefinitionDeserializer(); case "poll-enrich": return new ModelDeserializers.PollEnrichDefinitionDeserializer(); case "org.apache.camel.model.PollEnrichDefinition": return new ModelDeserializers.PollEnrichDefinitionDeserializer(); case "post": return new ModelDeserializers.PostVerbDefinitionDeserializer(); case "org.apache.camel.model.rest.PostVerbDefinition": return new ModelDeserializers.PostVerbDefinitionDeserializer(); case "org.apache.camel.model.validator.PredicateValidatorDefinition": return new ModelDeserializers.PredicateValidatorDefinitionDeserializer(); case "process": return new ModelDeserializers.ProcessDefinitionDeserializer(); case "org.apache.camel.model.ProcessDefinition": return new ModelDeserializers.ProcessDefinitionDeserializer(); case "property": return new ModelDeserializers.PropertyDefinitionDeserializer(); case "org.apache.camel.model.PropertyDefinition": return new ModelDeserializers.PropertyDefinitionDeserializer(); case "protobuf": return new ModelDeserializers.ProtobufDataFormatDeserializer(); case "org.apache.camel.model.dataformat.ProtobufDataFormat": return new ModelDeserializers.ProtobufDataFormatDeserializer(); case "put": return new ModelDeserializers.PutVerbDefinitionDeserializer(); case "org.apache.camel.model.rest.PutVerbDefinition": return new ModelDeserializers.PutVerbDefinitionDeserializer(); case "random": return new ModelDeserializers.RandomLoadBalancerDefinitionDeserializer(); case "org.apache.camel.model.loadbalancer.RandomLoadBalancerDefinition": return new ModelDeserializers.RandomLoadBalancerDefinitionDeserializer(); case "recipient-list": return new ModelDeserializers.RecipientListDefinitionDeserializer(); case "org.apache.camel.model.RecipientListDefinition": return new ModelDeserializers.RecipientListDefinitionDeserializer(); case "redelivery-policy": return new ModelDeserializers.RedeliveryPolicyDefinitionDeserializer(); case "org.apache.camel.model.RedeliveryPolicyDefinition": return new ModelDeserializers.RedeliveryPolicyDefinitionDeserializer(); case "ref": return new ModelDeserializers.RefExpressionDeserializer(); case "org.apache.camel.model.language.RefExpression": return new ModelDeserializers.RefExpressionDeserializer(); case "remove-header": return new ModelDeserializers.RemoveHeaderDefinitionDeserializer(); case "org.apache.camel.model.RemoveHeaderDefinition": return new ModelDeserializers.RemoveHeaderDefinitionDeserializer(); case "remove-headers": return new ModelDeserializers.RemoveHeadersDefinitionDeserializer(); case "org.apache.camel.model.RemoveHeadersDefinition": return new ModelDeserializers.RemoveHeadersDefinitionDeserializer(); case "remove-properties": return new ModelDeserializers.RemovePropertiesDefinitionDeserializer(); case "org.apache.camel.model.RemovePropertiesDefinition": return new ModelDeserializers.RemovePropertiesDefinitionDeserializer(); case "remove-property": return new ModelDeserializers.RemovePropertyDefinitionDeserializer(); case "org.apache.camel.model.RemovePropertyDefinition": return new ModelDeserializers.RemovePropertyDefinitionDeserializer(); case "resequence": return new ModelDeserializers.ResequenceDefinitionDeserializer(); case "org.apache.camel.model.ResequenceDefinition": return new ModelDeserializers.ResequenceDefinitionDeserializer(); case "resilience4j-configuration": return new ModelDeserializers.Resilience4jConfigurationDefinitionDeserializer(); case "org.apache.camel.model.Resilience4jConfigurationDefinition": return new ModelDeserializers.Resilience4jConfigurationDefinitionDeserializer(); case "rest-binding": return new ModelDeserializers.RestBindingDefinitionDeserializer(); case "org.apache.camel.model.rest.RestBindingDefinition": return new ModelDeserializers.RestBindingDefinitionDeserializer(); case "rest-configuration": return new ModelDeserializers.RestConfigurationDefinitionDeserializer(); case "org.apache.camel.model.rest.RestConfigurationDefinition": return new ModelDeserializers.RestConfigurationDefinitionDeserializer(); case "rest-context-ref": return new ModelDeserializers.RestContextRefDefinitionDeserializer(); case "org.apache.camel.model.RestContextRefDefinition": return new ModelDeserializers.RestContextRefDefinitionDeserializer(); case "rest": return new ModelDeserializers.RestDefinitionDeserializer(); case "org.apache.camel.model.rest.RestDefinition": return new ModelDeserializers.RestDefinitionDeserializer(); case "param": return new ModelDeserializers.RestOperationParamDefinitionDeserializer(); case "org.apache.camel.model.rest.RestOperationParamDefinition": return new ModelDeserializers.RestOperationParamDefinitionDeserializer(); case "response-header": return new ModelDeserializers.RestOperationResponseHeaderDefinitionDeserializer(); case "org.apache.camel.model.rest.RestOperationResponseHeaderDefinition": return new ModelDeserializers.RestOperationResponseHeaderDefinitionDeserializer(); case "response-message": return new ModelDeserializers.RestOperationResponseMsgDefinitionDeserializer(); case "org.apache.camel.model.rest.RestOperationResponseMsgDefinition": return new ModelDeserializers.RestOperationResponseMsgDefinitionDeserializer(); case "rest-property": return new ModelDeserializers.RestPropertyDefinitionDeserializer(); case "org.apache.camel.model.rest.RestPropertyDefinition": return new ModelDeserializers.RestPropertyDefinitionDeserializer(); case "security-definitions": return new ModelDeserializers.RestSecuritiesDefinitionDeserializer(); case "org.apache.camel.model.rest.RestSecuritiesDefinition": return new ModelDeserializers.RestSecuritiesDefinitionDeserializer(); case "api-key": return new ModelDeserializers.RestSecurityApiKeyDeserializer(); case "org.apache.camel.model.rest.RestSecurityApiKey": return new ModelDeserializers.RestSecurityApiKeyDeserializer(); case "basic-auth": return new ModelDeserializers.RestSecurityBasicAuthDeserializer(); case "org.apache.camel.model.rest.RestSecurityBasicAuth": return new ModelDeserializers.RestSecurityBasicAuthDeserializer(); case "oauth2": return new ModelDeserializers.RestSecurityOAuth2Deserializer(); case "org.apache.camel.model.rest.RestSecurityOAuth2": return new ModelDeserializers.RestSecurityOAuth2Deserializer(); case "rests": return new ModelDeserializers.RestsDefinitionDeserializer(); case "org.apache.camel.model.rest.RestsDefinition": return new ModelDeserializers.RestsDefinitionDeserializer(); case "ribbon-load-balancer": return new ModelDeserializers.RibbonServiceCallServiceLoadBalancerConfigurationDeserializer(); case "org.apache.camel.model.cloud.RibbonServiceCallServiceLoadBalancerConfiguration": return new ModelDeserializers.RibbonServiceCallServiceLoadBalancerConfigurationDeserializer(); case "rollback": return new ModelDeserializers.RollbackDefinitionDeserializer(); case "org.apache.camel.model.RollbackDefinition": return new ModelDeserializers.RollbackDefinitionDeserializer(); case "round-robin": return new ModelDeserializers.RoundRobinLoadBalancerDefinitionDeserializer(); case "org.apache.camel.model.loadbalancer.RoundRobinLoadBalancerDefinition": return new ModelDeserializers.RoundRobinLoadBalancerDefinitionDeserializer(); case "route-builder": return new ModelDeserializers.RouteBuilderDefinitionDeserializer(); case "org.apache.camel.model.RouteBuilderDefinition": return new ModelDeserializers.RouteBuilderDefinitionDeserializer(); case "route-context-ref": return new ModelDeserializers.RouteContextRefDefinitionDeserializer(); case "org.apache.camel.model.RouteContextRefDefinition": return new ModelDeserializers.RouteContextRefDefinitionDeserializer(); case "route": return new ModelDeserializers.RouteDefinitionDeserializer(); case "org.apache.camel.model.RouteDefinition": return new ModelDeserializers.RouteDefinitionDeserializer(); case "route-template-context-ref": return new ModelDeserializers.RouteTemplateContextRefDefinitionDeserializer(); case "org.apache.camel.model.RouteTemplateContextRefDefinition": return new ModelDeserializers.RouteTemplateContextRefDefinitionDeserializer(); case "route-template": return new ModelDeserializers.RouteTemplateDefinitionDeserializer(); case "org.apache.camel.model.RouteTemplateDefinition": return new ModelDeserializers.RouteTemplateDefinitionDeserializer(); case "template-parameter": return new ModelDeserializers.RouteTemplateParameterDefinitionDeserializer(); case "org.apache.camel.model.RouteTemplateParameterDefinition": return new ModelDeserializers.RouteTemplateParameterDefinitionDeserializer(); case "route-templates": return new ModelDeserializers.RouteTemplatesDefinitionDeserializer(); case "org.apache.camel.model.RouteTemplatesDefinition": return new ModelDeserializers.RouteTemplatesDefinitionDeserializer(); case "routes": return new ModelDeserializers.RoutesDefinitionDeserializer(); case "org.apache.camel.model.RoutesDefinition": return new ModelDeserializers.RoutesDefinitionDeserializer(); case "routing-slip": return new ModelDeserializers.RoutingSlipDefinitionDeserializer(); case "org.apache.camel.model.RoutingSlipDefinition": return new ModelDeserializers.RoutingSlipDefinitionDeserializer(); case "rss": return new ModelDeserializers.RssDataFormatDeserializer(); case "org.apache.camel.model.dataformat.RssDataFormat": return new ModelDeserializers.RssDataFormatDeserializer(); case "saga": return new ModelDeserializers.SagaDefinitionDeserializer(); case "org.apache.camel.model.SagaDefinition": return new ModelDeserializers.SagaDefinitionDeserializer(); case "sample": return new ModelDeserializers.SamplingDefinitionDeserializer(); case "org.apache.camel.model.SamplingDefinition": return new ModelDeserializers.SamplingDefinitionDeserializer(); case "script": return new ModelDeserializers.ScriptDefinitionDeserializer(); case "org.apache.camel.model.ScriptDefinition": return new ModelDeserializers.ScriptDefinitionDeserializer(); case "security": return new ModelDeserializers.SecurityDefinitionDeserializer(); case "org.apache.camel.model.rest.SecurityDefinition": return new ModelDeserializers.SecurityDefinitionDeserializer(); case "service-call-configuration": return new ModelDeserializers.ServiceCallConfigurationDefinitionDeserializer(); case "org.apache.camel.model.cloud.ServiceCallConfigurationDefinition": return new ModelDeserializers.ServiceCallConfigurationDefinitionDeserializer(); case "service-call": return new ModelDeserializers.ServiceCallDefinitionDeserializer(); case "org.apache.camel.model.cloud.ServiceCallDefinition": return new ModelDeserializers.ServiceCallDefinitionDeserializer(); case "service-expression": return new ModelDeserializers.ServiceCallExpressionConfigurationDeserializer(); case "org.apache.camel.model.cloud.ServiceCallExpressionConfiguration": return new ModelDeserializers.ServiceCallExpressionConfigurationDeserializer(); case "service-chooser-configuration": return new ModelDeserializers.ServiceCallServiceChooserConfigurationDeserializer(); case "org.apache.camel.model.cloud.ServiceCallServiceChooserConfiguration": return new ModelDeserializers.ServiceCallServiceChooserConfigurationDeserializer(); case "service-discovery-configuration": return new ModelDeserializers.ServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.ServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.ServiceCallServiceDiscoveryConfigurationDeserializer(); case "service-filter-configuration": return new ModelDeserializers.ServiceCallServiceFilterConfigurationDeserializer(); case "org.apache.camel.model.cloud.ServiceCallServiceFilterConfiguration": return new ModelDeserializers.ServiceCallServiceFilterConfigurationDeserializer(); case "load-balancer-configuration": return new ModelDeserializers.ServiceCallServiceLoadBalancerConfigurationDeserializer(); case "org.apache.camel.model.cloud.ServiceCallServiceLoadBalancerConfiguration": return new ModelDeserializers.ServiceCallServiceLoadBalancerConfigurationDeserializer(); case "set-body": return new ModelDeserializers.SetBodyDefinitionDeserializer(); case "org.apache.camel.model.SetBodyDefinition": return new ModelDeserializers.SetBodyDefinitionDeserializer(); case "set-exchange-pattern": return new ModelDeserializers.SetExchangePatternDefinitionDeserializer(); case "org.apache.camel.model.SetExchangePatternDefinition": return new ModelDeserializers.SetExchangePatternDefinitionDeserializer(); case "set-header": return new ModelDeserializers.SetHeaderDefinitionDeserializer(); case "org.apache.camel.model.SetHeaderDefinition": return new ModelDeserializers.SetHeaderDefinitionDeserializer(); case "set-property": return new ModelDeserializers.SetPropertyDefinitionDeserializer(); case "org.apache.camel.model.SetPropertyDefinition": return new ModelDeserializers.SetPropertyDefinitionDeserializer(); case "simple": return new ModelDeserializers.SimpleExpressionDeserializer(); case "org.apache.camel.model.language.SimpleExpression": return new ModelDeserializers.SimpleExpressionDeserializer(); case "soapjaxb": return new ModelDeserializers.SoapJaxbDataFormatDeserializer(); case "org.apache.camel.model.dataformat.SoapJaxbDataFormat": return new ModelDeserializers.SoapJaxbDataFormatDeserializer(); case "sort": return new ModelDeserializers.SortDefinitionDeserializer(); case "org.apache.camel.model.SortDefinition": return new ModelDeserializers.SortDefinitionDeserializer(); case "spel": return new ModelDeserializers.SpELExpressionDeserializer(); case "org.apache.camel.model.language.SpELExpression": return new ModelDeserializers.SpELExpressionDeserializer(); case "split": return new ModelDeserializers.SplitDefinitionDeserializer(); case "org.apache.camel.model.SplitDefinition": return new ModelDeserializers.SplitDefinitionDeserializer(); case "static-service-discovery": return new ModelDeserializers.StaticServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.StaticServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.StaticServiceCallServiceDiscoveryConfigurationDeserializer(); case "step": return new ModelDeserializers.StepDefinitionDeserializer(); case "org.apache.camel.model.StepDefinition": return new ModelDeserializers.StepDefinitionDeserializer(); case "sticky": return new ModelDeserializers.StickyLoadBalancerDefinitionDeserializer(); case "org.apache.camel.model.loadbalancer.StickyLoadBalancerDefinition": return new ModelDeserializers.StickyLoadBalancerDefinitionDeserializer(); case "stop": return new ModelDeserializers.StopDefinitionDeserializer(); case "org.apache.camel.model.StopDefinition": return new ModelDeserializers.StopDefinitionDeserializer(); case "stream-config": return new ModelDeserializers.StreamResequencerConfigDeserializer(); case "org.apache.camel.model.config.StreamResequencerConfig": return new ModelDeserializers.StreamResequencerConfigDeserializer(); case "syslog": return new ModelDeserializers.SyslogDataFormatDeserializer(); case "org.apache.camel.model.dataformat.SyslogDataFormat": return new ModelDeserializers.SyslogDataFormatDeserializer(); case "tarfile": return new ModelDeserializers.TarFileDataFormatDeserializer(); case "org.apache.camel.model.dataformat.TarFileDataFormat": return new ModelDeserializers.TarFileDataFormatDeserializer(); case "thread-pool-profile": return new ModelDeserializers.ThreadPoolProfileDefinitionDeserializer(); case "org.apache.camel.model.ThreadPoolProfileDefinition": return new ModelDeserializers.ThreadPoolProfileDefinitionDeserializer(); case "threads": return new ModelDeserializers.ThreadsDefinitionDeserializer(); case "org.apache.camel.model.ThreadsDefinition": return new ModelDeserializers.ThreadsDefinitionDeserializer(); case "thrift": return new ModelDeserializers.ThriftDataFormatDeserializer(); case "org.apache.camel.model.dataformat.ThriftDataFormat": return new ModelDeserializers.ThriftDataFormatDeserializer(); case "throttle": return new ModelDeserializers.ThrottleDefinitionDeserializer(); case "org.apache.camel.model.ThrottleDefinition": return new ModelDeserializers.ThrottleDefinitionDeserializer(); case "throw-exception": return new ModelDeserializers.ThrowExceptionDefinitionDeserializer(); case "org.apache.camel.model.ThrowExceptionDefinition": return new ModelDeserializers.ThrowExceptionDefinitionDeserializer(); case "tidy-markup": return new ModelDeserializers.TidyMarkupDataFormatDeserializer(); case "org.apache.camel.model.dataformat.TidyMarkupDataFormat": return new ModelDeserializers.TidyMarkupDataFormatDeserializer(); case "to": return new ModelDeserializers.ToDefinitionDeserializer(); case "org.apache.camel.model.ToDefinition": return new ModelDeserializers.ToDefinitionDeserializer(); case "to-d": return new ModelDeserializers.ToDynamicDefinitionDeserializer(); case "org.apache.camel.model.ToDynamicDefinition": return new ModelDeserializers.ToDynamicDefinitionDeserializer(); case "tokenize": return new ModelDeserializers.TokenizerExpressionDeserializer(); case "org.apache.camel.model.language.TokenizerExpression": return new ModelDeserializers.TokenizerExpressionDeserializer(); case "topic": return new ModelDeserializers.TopicLoadBalancerDefinitionDeserializer(); case "org.apache.camel.model.loadbalancer.TopicLoadBalancerDefinition": return new ModelDeserializers.TopicLoadBalancerDefinitionDeserializer(); case "transacted": return new ModelDeserializers.TransactedDefinitionDeserializer(); case "org.apache.camel.model.TransactedDefinition": return new ModelDeserializers.TransactedDefinitionDeserializer(); case "transform": return new ModelDeserializers.TransformDefinitionDeserializer(); case "org.apache.camel.model.TransformDefinition": return new ModelDeserializers.TransformDefinitionDeserializer(); case "transformers": return new ModelDeserializers.TransformersDefinitionDeserializer(); case "org.apache.camel.model.transformer.TransformersDefinition": return new ModelDeserializers.TransformersDefinitionDeserializer(); case "do-try": return new ModelDeserializers.TryDefinitionDeserializer(); case "org.apache.camel.model.TryDefinition": return new ModelDeserializers.TryDefinitionDeserializer(); case "univocity-csv": return new ModelDeserializers.UniVocityCsvDataFormatDeserializer(); case "org.apache.camel.model.dataformat.UniVocityCsvDataFormat": return new ModelDeserializers.UniVocityCsvDataFormatDeserializer(); case "univocity-fixed": return new ModelDeserializers.UniVocityFixedWidthDataFormatDeserializer(); case "org.apache.camel.model.dataformat.UniVocityFixedWidthDataFormat": return new ModelDeserializers.UniVocityFixedWidthDataFormatDeserializer(); case "univocity-header": return new ModelDeserializers.UniVocityHeaderDeserializer(); case "org.apache.camel.model.dataformat.UniVocityHeader": return new ModelDeserializers.UniVocityHeaderDeserializer(); case "univocity-tsv": return new ModelDeserializers.UniVocityTsvDataFormatDeserializer(); case "org.apache.camel.model.dataformat.UniVocityTsvDataFormat": return new ModelDeserializers.UniVocityTsvDataFormatDeserializer(); case "unmarshal": return new ModelDeserializers.UnmarshalDefinitionDeserializer(); case "org.apache.camel.model.UnmarshalDefinition": return new ModelDeserializers.UnmarshalDefinitionDeserializer(); case "validate": return new ModelDeserializers.ValidateDefinitionDeserializer(); case "org.apache.camel.model.ValidateDefinition": return new ModelDeserializers.ValidateDefinitionDeserializer(); case "validators": return new ModelDeserializers.ValidatorsDefinitionDeserializer(); case "org.apache.camel.model.validator.ValidatorsDefinition": return new ModelDeserializers.ValidatorsDefinitionDeserializer(); case "verb": return new ModelDeserializers.VerbDefinitionDeserializer(); case "org.apache.camel.model.rest.VerbDefinition": return new ModelDeserializers.VerbDefinitionDeserializer(); case "weighted": return new ModelDeserializers.WeightedLoadBalancerDefinitionDeserializer(); case "org.apache.camel.model.loadbalancer.WeightedLoadBalancerDefinition": return new ModelDeserializers.WeightedLoadBalancerDefinitionDeserializer(); case "when": return new ModelDeserializers.WhenDefinitionDeserializer(); case "org.apache.camel.model.WhenDefinition": return new ModelDeserializers.WhenDefinitionDeserializer(); case "when-skip-send-to-endpoint": return new ModelDeserializers.WhenSkipSendToEndpointDefinitionDeserializer(); case "org.apache.camel.model.WhenSkipSendToEndpointDefinition": return new ModelDeserializers.WhenSkipSendToEndpointDefinitionDeserializer(); case "wire-tap": return new ModelDeserializers.WireTapDefinitionDeserializer(); case "org.apache.camel.model.WireTapDefinition": return new ModelDeserializers.WireTapDefinitionDeserializer(); case "secure-xml": return new ModelDeserializers.XMLSecurityDataFormatDeserializer(); case "org.apache.camel.model.dataformat.XMLSecurityDataFormat": return new ModelDeserializers.XMLSecurityDataFormatDeserializer(); case "xtokenize": return new ModelDeserializers.XMLTokenizerExpressionDeserializer(); case "org.apache.camel.model.language.XMLTokenizerExpression": return new ModelDeserializers.XMLTokenizerExpressionDeserializer(); case "xpath": return new ModelDeserializers.XPathExpressionDeserializer(); case "org.apache.camel.model.language.XPathExpression": return new ModelDeserializers.XPathExpressionDeserializer(); case "xquery": return new ModelDeserializers.XQueryExpressionDeserializer(); case "org.apache.camel.model.language.XQueryExpression": return new ModelDeserializers.XQueryExpressionDeserializer(); case "xstream": return new ModelDeserializers.XStreamDataFormatDeserializer(); case "org.apache.camel.model.dataformat.XStreamDataFormat": return new ModelDeserializers.XStreamDataFormatDeserializer(); case "xmlrpc": return new ModelDeserializers.XmlRpcDataFormatDeserializer(); case "org.apache.camel.model.dataformat.XmlRpcDataFormat": return new ModelDeserializers.XmlRpcDataFormatDeserializer(); case "yaml": return new ModelDeserializers.YAMLDataFormatDeserializer(); case "org.apache.camel.model.dataformat.YAMLDataFormat": return new ModelDeserializers.YAMLDataFormatDeserializer(); case "type-filter": return new ModelDeserializers.YAMLTypeFilterDefinitionDeserializer(); case "org.apache.camel.model.dataformat.YAMLTypeFilterDefinition": return new ModelDeserializers.YAMLTypeFilterDefinitionDeserializer(); case "zipdeflater": return new ModelDeserializers.ZipDeflaterDataFormatDeserializer(); case "org.apache.camel.model.dataformat.ZipDeflaterDataFormat": return new ModelDeserializers.ZipDeflaterDataFormatDeserializer(); case "zipfile": return new ModelDeserializers.ZipFileDataFormatDeserializer(); case "org.apache.camel.model.dataformat.ZipFileDataFormat": return new ModelDeserializers.ZipFileDataFormatDeserializer(); case "zookeeper-service-discovery": return new ModelDeserializers.ZooKeeperServiceCallServiceDiscoveryConfigurationDeserializer(); case "org.apache.camel.model.cloud.ZooKeeperServiceCallServiceDiscoveryConfiguration": return new ModelDeserializers.ZooKeeperServiceCallServiceDiscoveryConfigurationDeserializer(); } return null; } }
[ "lburgazzoli@gmail.com" ]
lburgazzoli@gmail.com
fe76b382dfcfcd03d226a258e91256181a9d386e
bfa29f79e7205aefbc5ec8c881cf889519445f8d
/app/src/main/java/com/rainwood/sentlogistics/model/domain/PublishType.java
d7b208690ed758f8b88206ab0c9e22c08b1c8fd1
[]
no_license
maple00/FarceSentLogistics
4e635a3748ba8cf20cdc4173626cbb28f4dcdd40
3df59f2e2f8e1f36d4fbf6cdd0b43949b4bdb75b
refs/heads/master
2022-11-16T04:16:31.421543
2020-07-10T10:02:13
2020-07-10T10:02:13
278,600,681
0
0
null
null
null
null
UTF-8
Java
false
false
615
java
package com.rainwood.sentlogistics.model.domain; import java.io.Serializable; /** * @Author: a797s * @Date: 2020/7/9 14:43 * @Desc: 服务类型 */ public final class PublishType implements Serializable { /** * 类型 */ private String type; /** * 选中 */ private boolean selected; public String getType() { return type; } public void setType(String type) { this.type = type; } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } }
[ "a797shaoxuesong@163.com" ]
a797shaoxuesong@163.com
82e8df8a1a842516bc99449685fdeace250fd7a4
e80c2f3fdb63466c3f8c7ca399445770e6a15d7f
/src/com/kq/jvm/field/A.java
c82ea3897d7d9687fdc0184b342e033a805f36ab
[]
no_license
kongq1983/java8
386d2c2e1d3a39e09ce97991e13e682600b18553
409cd50577d59d4f797f80e09eec85e2c87e7759
refs/heads/master
2023-05-25T18:06:42.464147
2023-05-19T15:51:04
2023-05-19T15:51:04
130,213,626
0
0
null
null
null
null
UTF-8
Java
false
false
564
java
package com.kq.jvm.field; /** * * @author kq * @date 2021-11-17 13:55 * @since 2020-0630 */ public class A { public static final int PAGE_SIZE = 20; public static final byte BYTEBYTE = 50; public static final double DOU = 50; public static final float FLO = 60; private int a = 10; protected int b = 12; public int c = 15; public int d = 11; public int f = 16; public char cByte = 10; public double dou1 = 1; public byte aByte = 1; public static int getPageSize(){ return PAGE_SIZE; } }
[ "king@qq.com" ]
king@qq.com
31d4af33be4fbdaf12b6986de1a389b27174028e
b171fdfee15ee8eb2c788042c1d2824b98223630
/spring-boot-logger/spring-boot-logback/main/java/com/xphsc/logback/LogbackApplication.java
c2b4502a7a2b2de3a9a83e47b1df711940626ee5
[]
no_license
xphsc/springboot-examples
d10f2aafe628f561c36232cee03489648a2008a5
c8341127e11ce6cd335870937c6379f97608b714
refs/heads/master
2022-06-25T06:34:41.316048
2020-04-12T09:31:25
2020-04-12T09:31:25
122,811,459
1
1
null
2022-06-20T23:02:16
2018-02-25T06:29:48
Java
UTF-8
Java
false
false
580
java
package com.xphsc.logback; import org.springframework.boot.Banner; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; /** * Created by ${huipei.x} on 2017-2-25 * qq群593802274 */ @SpringBootApplication(scanBasePackages="com.xphsc") public class LogbackApplication { public static void main(String[] args) { new SpringApplicationBuilder() .sources(LogbackApplication.class) .bannerMode(Banner.Mode.CONSOLE) .run(args); } }
[ "xiongpeih@51bsi.com" ]
xiongpeih@51bsi.com
19f2f8a9a6be3a9634d1da274983ac89c38eacc5
7f560c5b0e9ed114da684b57d63cb2d13829554a
/algorithms/src/exercises/Chapter1_3/Exc_1_3_38_GeneralizedQDeleteKLinkedList.java
12b84a5d09007d167acaf2926c8f5624750ae725
[]
no_license
bastronaut/algorithms
c2871a8f74556b2f8b3e3af0a3301f06efa1f9de
c84f392d89c4be6ce429e3a859f9de35711b2598
refs/heads/master
2020-05-22T06:39:37.448338
2017-06-09T21:37:31
2017-06-09T21:37:31
61,952,243
0
0
null
null
null
null
UTF-8
Java
false
false
3,063
java
package exercises.Chapter1_3; /** * 1.3.38 Delete kth element. Implement a class that supports the following API: public class generalizedQueue<Item> generalizedQueue() create an empty queue boolean isEmpty() is the queue empty? void insert(Item x) add an item Item delete(int k) delete and return the kth least recently inserted item First, develop an implementation that uses an array implementation, and then develop one that uses a linked-list implementation. Note : the algorithms and data structures that we introduce in Chapter 3 make it possible to develop an implementation that can guarantee that both insert() and delete() take time proportional to the logarithm of the number of items in the queue—see Exercise 3.5.27. array implementation: elements are added to the end of the array, which is pointed to by backQueue (and receives +1) the kth element to delete is simply index k. all the elements are then moved by 1 index to the front of the queue */ public class Exc_1_3_38_GeneralizedQDeleteKLinkedList<Item> implements Exc_1_3_38_GeneralizedQDeleteInterface<Item> { private int N; private Node frontNode; private Node backNode; @Override public boolean isEmpty() { return N == 0; } @Override public void insert(Item item) { Node newBackNode = new Node(); newBackNode.item = item; if (isEmpty()) { frontNode = newBackNode; } else { backNode.next = newBackNode; } backNode = newBackNode; N++; } // Has to keep memory of the previous node, and set the reference to next // on the previous node to the one after it to ensure a deletion from the LL @Override public Item delete(int k) { Node tempPrevNode = new Node(); Node tempNextNode = frontNode; if (N < k) { throw new NullPointerException("there is no Kth element in the LL"); } for (int i = 0; i < k; i++) { tempPrevNode = tempNextNode; tempNextNode = tempNextNode.next; } Item returnItem = tempNextNode.item; // exception case for removing the front node if (k == 0 ) { frontNode = frontNode.next; } else if (k == N-1) { // exception case for changing the back node tempPrevNode.next = null; backNode = tempPrevNode; } else { tempPrevNode.next = tempNextNode.next; tempNextNode = null; } N--; return returnItem; } public String toString() { Node newFrontNode = frontNode; StringBuilder sb = new StringBuilder(); while (newFrontNode != null) { sb.append(newFrontNode); newFrontNode = newFrontNode.next; } System.out.println(sb.toString()); return sb.toString(); } private class Node { Item item; Node next; public String toString() { return item.toString(); } } }
[ "btsijtsma@gmail.com" ]
btsijtsma@gmail.com
52291718b97ebe6bd659f1b7c9f448acd815fd3a
79a6cf43828280dde4a8957ab2878def495cde95
/platform/platform-impl/src/main/java/com/asiainfo/rms/alm/arsenal/dao/AlmAsnltmpSgExtendDao.java
fbde4183fa581d4532c15f54add3ef711397bb30
[]
no_license
zostudy/cb
aeee90afde5f83fc8fecb02073c724963cf3c44f
c18b3d6fb078d66bd45f446707e67d918ca57ae0
refs/heads/master
2020-05-17T22:24:44.910256
2019-05-07T09:29:39
2019-05-07T09:29:39
183,999,895
0
0
null
null
null
null
UTF-8
Java
false
false
992
java
package com.asiainfo.rms.alm.arsenal.dao; import com.asiainfo.rms.alm.arsenal.domain.AlmAsnltmpSgExtendRepository; import org.apache.ibatis.annotations.Param; public interface AlmAsnltmpSgExtendDao { Integer saveAlmAsnltmpSgExtend(AlmAsnltmpSgExtendRepository almAsnltmpSgExtendRepository); // Integer updateAlmAsnltmpSgExtend(AlmAsnltmpSgExtendRepository almAsnltmpSgExtendRepository); // // Integer deleteAlmAsnltmpSgExtend(Integer aasId); AlmAsnltmpSgExtendRepository selectAlmAsnltmpSgExtend(Integer aasId); // List<AlmAsnltmpSgExtendRepository> selectAllAlmAsnltmpSgExtend(@Param("aatId")Integer aatId, // @Param("offset") Integer offset, // @Param("size") Integer size); // // Integer getAllAlmAsnltmpSgExtend(@Param("aatId")Integer aatId); AlmAsnltmpSgExtendRepository selectSgExtendInfo(@Param("aatId")Integer aatId); }
[ "wangrupeng@foxmail.com" ]
wangrupeng@foxmail.com
c2d2b5a7e74dd0a47abf2f55c6bedd449d48760f
8ca1c84db50abbde99ada92d45b062d64ecccd3f
/unalcol-master/services/src/unalcol/descriptors/Descriptors.java
761423094ea21328350a1d2aa71e8bc827ee8191
[]
no_license
danielrcardenas/mohaea
b7030bc4c36bd237d861438fc57a18fe4043f238
f38f9dd6d5d00053d3af004d7142ba4ff714703d
refs/heads/master
2020-06-02T23:52:00.053081
2019-06-11T11:29:41
2019-06-11T11:29:41
191,350,842
1
0
null
null
null
null
UTF-8
Java
false
false
3,118
java
package unalcol.descriptors; import unalcol.services.AbstractMicroService; import unalcol.services.Service; // //Unalcol Service structure Pack 1.0 by Jonatan Gomez-Perdomo //https://github.com/jgomezpe/unalcol/tree/master/services/ // /** * * Descriptors * <p>Obtains a set of real value solution for a given object.</p> * * <P> * <A HREF="https://github.com/jgomezpe/unalcol/blob/master/services/src/unalcol/descriptors/Descriptors.java" target="_blank"> * Source code </A> is available. * * <h3>License</h3> * * Copyright (c) 2014 by Jonatan Gomez-Perdomo. <br> * All rights reserved. <br> * * <p>Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * <ul> * <li> Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * <li> 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. * <li> Neither the name of the copyright owners, their employers, nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * </ul> * <p>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 OWNERS 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. * * * * @author <A HREF="http://disi.unal.edu.co/profesores/jgomezpe"> Jonatan Gomez-Perdomo </A> * (E-mail: <A HREF="mailto:jgomezpe@unal.edu.co">jgomezpe@unal.edu.co</A> ) * @version 1.0 * @param <T> Type of objects to be described. */ public interface Descriptors<T> extends AbstractMicroService<T>{ /** * Obtains the solution of (an array of double values describing) an object. * @param obj Object to be described using double values (features). * @return An array of double values used for describing the object. */ public double[] descriptors(); // The MicroService methods public default Object run( Object... args ) throws Exception{ return descriptors(); } /** * The method name that can be used for describing an object */ public static final String name="solution"; public default String[] provides(){ return new String[]{name}; } public static double[] create( Object obj ){ try{ return (double[])Service.run(name, obj); }catch(Exception e){ return null; } } }
[ "myGitlab234" ]
myGitlab234
3f9ea543262e9dd8ad32624cecdb85e56ed5ef6f
c2dfe9cbd07f0084ec4c386adb1a997f1a433e9d
/src/main/java/com/dreamcc/gs/util/PropertiesUtil.java
1cc855d215898ee0e690fe11919f3d05c7aa8a64
[ "Apache-2.0" ]
permissive
dreamcc0817/GS
f60e578a6c0eb5a77d021deabe23cc2a6d17d3bb
d795832d893df7dcbde377d42145aeb9abeca6ab
refs/heads/master
2021-01-21T22:36:03.450371
2017-09-16T03:51:04
2017-09-16T03:51:04
102,166,139
0
0
null
null
null
null
UTF-8
Java
false
false
1,253
java
package com.dreamcc.gs.util; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStreamReader; import java.util.Properties; /** * Created by geely */ public class PropertiesUtil { private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class); private static Properties props; static { String fileName = "gs.properties"; props = new Properties(); try { props.load(new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName),"UTF-8")); } catch (IOException e) { logger.error("配置文件读取异常",e); } } public static String getProperty(String key){ String value = props.getProperty(key.trim()); if(StringUtils.isBlank(value)){ return null; } return value.trim(); } public static String getProperty(String key,String defaultValue){ String value = props.getProperty(key.trim()); if(StringUtils.isBlank(value)){ value = defaultValue; } return value.trim(); } }
[ "dreamcc0817@gmail.com" ]
dreamcc0817@gmail.com
f6d05303318f5e94a4916623923bac9472d6895c
d3d5b208a87d25170c8b4e1861a23e7a40ee218d
/ContentProvider/app/src/main/java/com/example/cdr/contentprovider/data/ContactContentProvider.java
0659568aaab9d885a0c2e6e0e912904d6bc354c9
[]
no_license
ClementeDR/AndroidExercise
0534052fdc85b58ab2f8bfec29e6323fe6098412
1f33c448aec19ba38936541d69f1baa5f65e6aeb
refs/heads/master
2020-12-31T04:56:05.194838
2017-07-18T19:54:30
2017-07-18T19:54:30
58,160,880
0
0
null
null
null
null
UTF-8
Java
false
false
5,622
java
package com.example.cdr.contentprovider.data; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentValues; import android.content.UriMatcher; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.support.annotation.Nullable; import android.text.TextUtils; /** * Created by cdr on 16/12/16. */ public class ContactContentProvider extends ContentProvider { public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/contacts"; public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/contact"; private static final String AUTHORITY = "com.example.cdr.contentprovider.data.contentprovider"; private static final String BASE_PATH_CONTACTS = "contacts"; public static final Uri CONTACTS_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH_CONTACTS); private static final int CONTACTS = 10; private static final int CONTACTS_ID = 20; private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH); static { sURIMatcher.addURI(AUTHORITY, BASE_PATH_CONTACTS, CONTACTS); sURIMatcher.addURI(AUTHORITY, BASE_PATH_CONTACTS + "/#", CONTACTS_ID); } private DBHelper mDBHelper; @Override public boolean onCreate() { mDBHelper = new DBHelper(getContext()); return true; } @Nullable @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sordOrder) { SQLiteQueryBuilder vQueryBuilder = new SQLiteQueryBuilder(); int vUriType = sURIMatcher.match(uri); switch (vUriType){ case CONTACTS: vQueryBuilder.setTables(ContactsHelper.TABLE_NAME); break; case CONTACTS_ID: vQueryBuilder.setTables(ContactsHelper.TABLE_NAME); vQueryBuilder.appendWhere(ContactsHelper._ID + "=" + uri.getLastPathSegment()); break; default: throw new IllegalArgumentException("Unknown URI: " + uri); } SQLiteDatabase vDB = mDBHelper.getReadableDatabase(); Cursor vCursor = vQueryBuilder.query(vDB, projection, selection, selectionArgs, null, null, sordOrder); vCursor.setNotificationUri(getContext().getContentResolver(), uri); return vCursor; } @Nullable @Override public String getType(Uri uri) { return null; } @Nullable @Override public Uri insert(Uri uri, ContentValues contentValues) { int vUriType = sURIMatcher.match(uri); SQLiteDatabase vDB = mDBHelper.getWritableDatabase(); long vID = 0; switch (vUriType){ case CONTACTS: vID = vDB.insert(ContactsHelper.TABLE_NAME, null, contentValues); break; default: throw new IllegalArgumentException("Unknown URI: " + uri); } getContext().getContentResolver().notifyChange(uri, null); vDB.close(); if (vID > 0){ return Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH_CONTACTS + "/" + vID); } else { return null; } } @Override public int delete(Uri uri, String selection, String[] selectionArgs) { int vUriType = sURIMatcher.match(uri); SQLiteDatabase vDB = mDBHelper.getWritableDatabase(); int vRowsDeleted = 0; switch (vUriType){ case CONTACTS: vRowsDeleted = vDB.delete(ContactsHelper.TABLE_NAME, selection, selectionArgs); break; case CONTACTS_ID: String vID = uri.getLastPathSegment(); if (TextUtils.isEmpty(selection)){ vRowsDeleted = vDB.delete(ContactsHelper.TABLE_NAME, ContactsHelper._ID + "=" + vID, null); } else { vRowsDeleted = vDB.delete(ContactsHelper.TABLE_NAME, ContactsHelper._ID + "=" + vID + " and " + selection, selectionArgs); } break; default: throw new IllegalArgumentException("Unknown URI " + uri); } getContext().getContentResolver().notifyChange(uri, null); return vRowsDeleted; } @Override public int update(Uri uri, ContentValues contentValues, String selection, String[] selectionArgs) { int vUriType = sURIMatcher.match(uri); SQLiteDatabase vDB = mDBHelper.getWritableDatabase(); int vRowsUpdated = 0; switch (vUriType){ case CONTACTS: vRowsUpdated = vDB.update(ContactsHelper.TABLE_NAME, contentValues, selection, selectionArgs); break; case CONTACTS_ID: String vID = uri.getLastPathSegment(); if (TextUtils.isEmpty(selection)){ vRowsUpdated = vDB.update(ContactsHelper.TABLE_NAME, contentValues, ContactsHelper._ID + "=" + vID, null); } else { vRowsUpdated = vDB.update(ContactsHelper.TABLE_NAME, contentValues, ContactsHelper._ID + "=" + vID + " and " + selection, selectionArgs); } break; default: throw new IllegalArgumentException("Unknown Uri " + uri); } if (vRowsUpdated > 0) getContext().getContentResolver().notifyChange(uri, null); return vRowsUpdated; } }
[ "dirosaclemente96@gmail.com" ]
dirosaclemente96@gmail.com
93bea16eddf1ad4ff99acdd4732e70676595b461
08702a2504d7e02e6106644e2537135bdd3392b6
/medicaloralsystem/src/main/java/com/oral/mapper/CalculateexpenseMapper.java
2713a07ce8d5d42afb4f85dcd80fd08b3b97bcf4
[]
no_license
Victor1998113/Teeths-Medical-System
d47da9fc25d4668477ada92245730d9abb2c343a
660f1aecdad87c2bbc0803c739336b2f8e6346bc
refs/heads/main
2023-07-12T07:17:38.093952
2021-08-17T14:04:44
2021-08-17T14:04:44
396,323,340
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package com.oral.mapper; import com.oral.bean.Calculateexpense; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Entity com.oral.bean.Calculateexpense */ public interface CalculateexpenseMapper extends BaseMapper<Calculateexpense> { }
[ "victor1998113@outlook.com" ]
victor1998113@outlook.com
12f676081e099b50b921527700d753560ca8ba44
19dce29c5feda0c662e3fbf9ecd7ca2865e8458f
/src/main/java/com/hrms/karcan/business/concretes/ResumeWebsiteManager.java
566ae955c1c8f919bebebc9b0e639b639405865b
[]
no_license
The-Brand/HRMS.Java
374a6b7fc940c231946da4f4bf0b9fc2e502140c
9aa2dff5f463d5beab883a6ef59e4f715ce7c89c
refs/heads/master
2023-08-30T19:30:20.692835
2021-11-07T03:22:15
2021-11-07T03:22:15
425,380,391
0
0
null
2021-11-07T00:37:16
2021-11-07T00:37:16
null
UTF-8
Java
false
false
1,668
java
package com.hrms.karcan.business.concretes; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hrms.karcan.business.abstracts.ResumeWebsiteService; import com.hrms.karcan.core.utilities.mappers.ModelMapperUtils; import com.hrms.karcan.core.utilities.result.DataResult; import com.hrms.karcan.core.utilities.result.Result; import com.hrms.karcan.core.utilities.result.SuccessDataResult; import com.hrms.karcan.core.utilities.result.SuccessResult; import com.hrms.karcan.dataAccess.abstracts.ResumeWebsiteRepository; import com.hrms.karcan.entity.dtos.resumes.ResumeWebsiteDetailDto; import com.hrms.karcan.entity.tables.ResumeWebsite; @Service public class ResumeWebsiteManager implements ResumeWebsiteService { private ResumeWebsiteRepository resumeWebsiteRepository; @Autowired public ResumeWebsiteManager(ResumeWebsiteRepository resumeWebsiteRepository) { this.resumeWebsiteRepository = resumeWebsiteRepository; } @Override public Result save(ResumeWebsite resumeWebsite) { this.resumeWebsiteRepository.save(resumeWebsite); return new SuccessResult(); } @Override public DataResult<List<ResumeWebsite>> getAllByResumeId(int resumeId) { return new SuccessDataResult<List<ResumeWebsite>>(this.resumeWebsiteRepository.findAllByResumeId(resumeId)); } @Override public DataResult<List<ResumeWebsiteDetailDto>> getAllDetailDtoByResumeId(int resumeId) { return new SuccessDataResult<List<ResumeWebsiteDetailDto>>( ModelMapperUtils.toList( this.getAllByResumeId(resumeId).getData(), ResumeWebsiteDetailDto.class ) ); } }
[ "karcanozbal@hotmail.com.tr" ]
karcanozbal@hotmail.com.tr
989bb673ec5cc9b35f441ca1f7ee0334fe2ac0ee
d71e879b3517cf4fccde29f7bf82cff69856cfcd
/ExtractedJars/iRobot_com.irobot.home/javafiles/com/gigya/socialize/android/GSAPI$15.java
e33a2d222b55b09b4677018b27cdbc0777f3cc26
[ "MIT" ]
permissive
Andreas237/AndroidPolicyAutomation
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
refs/heads/master
2020-04-10T02:14:08.789751
2019-05-16T19:29:11
2019-05-16T19:29:11
160,739,088
5
1
null
null
null
null
UTF-8
Java
false
false
3,958
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.gigya.socialize.android; import com.gigya.socialize.android.login.LoginProviderFactory; import com.gigya.socialize.android.login.providers.FacebookProvider; import java.util.List; // Referenced classes of package com.gigya.socialize.android: // GSAPI, GSPermissionResultHandler class GSAPI$15 implements Runnable { public void run() { com.gigya.socialize.android.login.providers.LoginProvider loginprovider = loginProviderFactory.getLoginProvider("facebook"); // 0 0:aload_0 // 1 1:getfield #21 <Field GSAPI this$0> // 2 4:getfield #34 <Field LoginProviderFactory GSAPI.loginProviderFactory> // 3 7:ldc1 #36 <String "facebook"> // 4 9:invokevirtual #42 <Method com.gigya.socialize.android.login.providers.LoginProvider LoginProviderFactory.getLoginProvider(String)> // 5 12:astore_1 if(((Object) (loginProviderFactory.getLoginProvider("facebook"))).getClass() == com/gigya/socialize/android/login/providers/FacebookProvider) //* 6 13:aload_0 //* 7 14:getfield #21 <Field GSAPI this$0> //* 8 17:getfield #34 <Field LoginProviderFactory GSAPI.loginProviderFactory> //* 9 20:ldc1 #36 <String "facebook"> //* 10 22:invokevirtual #42 <Method com.gigya.socialize.android.login.providers.LoginProvider LoginProviderFactory.getLoginProvider(String)> //* 11 25:invokevirtual #46 <Method Class Object.getClass()> //* 12 28:ldc1 #48 <Class FacebookProvider> //* 13 30:if_acmpne 51 { ((FacebookProvider)loginprovider).requestPermissions("read", val$permissions, val$callback); // 14 33:aload_1 // 15 34:checkcast #48 <Class FacebookProvider> // 16 37:ldc1 #50 <String "read"> // 17 39:aload_0 // 18 40:getfield #23 <Field List val$permissions> // 19 43:aload_0 // 20 44:getfield #25 <Field GSPermissionResultHandler val$callback> // 21 47:invokevirtual #54 <Method void FacebookProvider.requestPermissions(String, List, GSPermissionResultHandler)> return; // 22 50:return } if(val$callback != null) //* 23 51:aload_0 //* 24 52:getfield #25 <Field GSPermissionResultHandler val$callback> //* 25 55:ifnull 78 val$callback.onResult(false, new Exception("App isn't configured for Facebook native login."), ((List) (null))); // 26 58:aload_0 // 27 59:getfield #25 <Field GSPermissionResultHandler val$callback> // 28 62:iconst_0 // 29 63:new #56 <Class Exception> // 30 66:dup // 31 67:ldc1 #58 <String "App isn't configured for Facebook native login."> // 32 69:invokespecial #61 <Method void Exception(String)> // 33 72:aconst_null // 34 73:invokeinterface #67 <Method void GSPermissionResultHandler.onResult(boolean, Exception, List)> // 35 78:return } final GSAPI this$0; final GSPermissionResultHandler val$callback; final List val$permissions; GSAPI$15() { this$0 = final_gsapi; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #21 <Field GSAPI this$0> val$permissions = list; // 3 5:aload_0 // 4 6:aload_2 // 5 7:putfield #23 <Field List val$permissions> val$callback = GSPermissionResultHandler.this; // 6 10:aload_0 // 7 11:aload_3 // 8 12:putfield #25 <Field GSPermissionResultHandler val$callback> super(); // 9 15:aload_0 // 10 16:invokespecial #28 <Method void Object()> // 11 19:return } }
[ "silenta237@gmail.com" ]
silenta237@gmail.com
ebd7044e77131f8abaa37a31a134b728105c246b
e6d3a0d7425ad6d829d5ad9a8fe10458b58b349d
/eHotelReserve_RESTfull/src/main/java/edu/miu/cs544/eHotelReserve/exception/ValidationException.java
721e5926692f7f04aecc7c578b58570f480cd0ae
[]
no_license
BrukTekle/eHotelReserve
3cb1374dcb6e4e7eafefb2a3ac55b4bee10d996d
c375d81ba024da5a95881a7680a6a8e8d61c57a0
refs/heads/master
2023-05-07T16:26:28.138532
2020-04-20T14:03:29
2020-04-20T14:03:29
255,125,764
0
1
null
2021-06-04T02:35:30
2020-04-12T16:37:50
Java
UTF-8
Java
false
false
600
java
package edu.miu.cs544.eHotelReserve.exception; import java.util.Set; import javax.validation.ConstraintViolation; import org.springframework.validation.Errors; import java.lang.RuntimeException; public class ValidationException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; Errors errors; //Parameterless Constructor public ValidationException() {} //Constructor that accepts a message public ValidationException(Errors errors) { this.errors = errors; } public Errors getErrors() { return errors; } }
[ "55061854+selam2020@users.noreply.github.com" ]
55061854+selam2020@users.noreply.github.com
e408a36faa2a5439bff8bcef17c08eab07002629
10381d8057c0aff65b2f866dbd5707f07611f8b9
/ProjectClass/Project.java
e86f8aa862a03b61be4fe9b7038aad55f1767196
[]
no_license
Mark-Edwards-II/JavaAssignments
6a9479c085778c959cf37e89cee5f8f7bbdb2a9a
ba4519a274e0d88add75fc25d9526e2fc5da1c7b
refs/heads/master
2023-03-08T13:09:11.989750
2021-02-16T13:23:05
2021-02-16T13:23:05
337,847,938
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
public class Project { public String name; public String description; public String elevatorPitch() { return this.name + ":" + this.description; } public void Project() {} public void Project(String name) { this.name = name; } public void Project(String name, String description) { this.name = name; this.description = description; } }
[ "markedwards@MacBook-Pro.local" ]
markedwards@MacBook-Pro.local
e6585ce3b2e9b1ea8753b5d9ed19c931d4b471c5
0be22bcbc22bb317524e8a319f391ca459f9ca5f
/GestioneFarmacia ESAME/src/gestionefarmacia/control/CGestioneFarmaci.java
bca70e450504b95ba16abaa1db0a068a27b98139
[]
no_license
alesdematteo01/-CORSO-IS-GestioneFarmacia
b88fea26a6ebbc80ff9eb5fb2d9770e2d9cf5ed6
aaa1353cfa9e0f55ee07536df7af6e260ef3230a
refs/heads/master
2021-04-18T03:28:03.473243
2020-03-23T18:15:36
2020-03-23T18:15:36
249,501,297
0
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
package src.gestionefarmacia.control; import java.util.ArrayList; import src.gestionefarmacia.entity.Farmaco; import src.gestionefarmacia.entity.PrincipioAttivo; import src.gestionefarmacia.db.DAOException; import src.gestionefarmacia.db.FarmacoDAO; import src.gestionefarmacia.db.PrincipioAttivoDAO;; public class CGestioneFarmaci { static ArrayList<Farmaco> lista_farmaci = new ArrayList<Farmaco>(); static ArrayList<PrincipioAttivo> lista_princ = new ArrayList<PrincipioAttivo>(); private static CGestioneFarmaci istance = null; // Default constructor protected CGestioneFarmaci() throws DAOException{ lista_farmaci = FarmacoDAO.readAll(); lista_princ = PrincipioAttivoDAO.readAll(); } public static CGestioneFarmaci Istance() throws DAOException { if(istance == null) { istance = new CGestioneFarmaci(); } return istance; } public void inserisciFarmaco(Farmaco f) { lista_farmaci.add(f); } public void modificaFarmaco(Farmaco f, int qta) { // TODO implement here } public void cancellaFarmaco(Farmaco f) { lista_farmaci.remove(f); } public void inviaFarmaciMancanti() { // TODO implement here } public ArrayList<PrincipioAttivo> getPrincAtt(){ return lista_princ; } public ArrayList<Farmaco> getFarmaci(){ return lista_farmaci; } }
[ "dinod@DESKTOP-BON5K2R" ]
dinod@DESKTOP-BON5K2R
06e63f6604694567e56a3a7fc566f9f256085eb9
eb0a859959b3eb19efa300e4a7c6f7ad33f52842
/src/test/java/savita/TC_08Test.java
9ee11a87cb6279da812a288e5e3ee75a76a6bc9d
[]
no_license
istiyak15/Work
2402714ddaa8bc9aca1a4831c3e0b22337188c84
55e2d066d589ec3d8feb1bf62552243c8f27ac9a
refs/heads/master
2023-07-17T09:51:16.271892
2021-08-29T01:04:01
2021-08-29T01:04:01
400,853,956
0
0
null
2021-08-28T18:03:49
2021-08-28T17:40:42
null
UTF-8
Java
false
false
50
java
package savita; public class TC_08Test { }
[ "Admin@DESKTOP-830DPVD" ]
Admin@DESKTOP-830DPVD
b6fe9c1b54c1b1af50c56bf5baa5f2b6374b2f54
b30e493a24b2dcd63aac3921d394eab7fcdf7912
/core/src/com/mygdx/theafrica/Background.java
028a2f9d7bd2d61e3e2bad915948a8eaf33341f0
[]
no_license
Marutho/AFRICA-GAME
c45fbbc2ad01a1a66caf2ac727fef117f98d21c3
02de7ed3a09a95b55a80bb304be365e01ca7ec1d
refs/heads/master
2020-09-03T00:44:18.538946
2019-11-18T23:03:14
2019-11-18T23:03:14
219,343,403
1
1
null
null
null
null
UTF-8
Java
false
false
730
java
package com.mygdx.theafrica; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; public class Background extends GameObject { public Background(float posX, float posY, float _width, float _height){ super(); x=posX; y=posY; this.width=_width; this.height=_height; Assets.getInstance().bgWallTR = new TextureRegion(Assets.getInstance().bgWall); } @Override public void draw(SpriteBatch batch) { batch.draw(Assets.getInstance().bgWallTR,x,y,width,height); } @Override public void draw(SpriteBatch batch, float staTime) { } @Override public void update(float delta) { } }
[ "marutho97@gmail.com" ]
marutho97@gmail.com
bcb2eb59bcf19439c42c8ff65d39bdeee6aa562b
493faf30416b631ff8dba5207496cc0f63b0cf42
/src/SimSSSimulation.java
a3e538596c3a37267d3fcc0d98803f949c50d253
[]
no_license
jtavares/wjjsim
f37df57919e0262a735892bd0728e178de411a4f
a80654ae688d684fb034128ff6e2d7a229fbd12f
refs/heads/master
2021-01-18T21:25:41.109109
2011-12-23T04:02:55
2011-12-23T04:02:55
2,547,694
0
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
import java.util.HashMap; import java.util.List; public class SimSSSimulation { // Implements a simultaneous, single-shot, auction for n agents and m goods. private List<Agent> agents; private List<SBAuction> auctions; public SimSSSimulation(List<Agent> agents, List<SBAuction> auctions) { this.agents = agents; this.auctions = auctions; } public void play() { // Tell agents all auctions are now open. for (int i = 0; i<agents.size(); i++) { agents.get(i).openAllAuctions(); } // Ask agents for their bids for (int i = 0; i<agents.size(); i++) { HashMap<Integer, Double> i_bids = agents.get(i).getBids(); // i: agent idx, j: auction idx. for (Integer j : i_bids.keySet()) auctions.get(j).submitBid(i, (i_bids.get(j))); } // Apply allocation & payment rules to each underlying auction for (SBAuction a : auctions) a.solveAuction(); // Tell agents all auctions are closed. for (int i = 0; i<agents.size(); i++) { agents.get(i).closeAllAuctions(); } // Report results report(); } public void report() { // Report results per auction for (SBAuction a : auctions) { a.report(); System.out.println(""); } System.out.println(""); // Report results per-agent for (Agent a : agents) { System.out.println(a.information()); } } }
[ "james.tavares@gmail.com" ]
james.tavares@gmail.com
4354b86f8a2c6454cf67b15837667c766024b613
28001b9f6537ac2a80c40491055b9c54b1bfb573
/Assignment2-B/WeatherMonitor/src/main/TemperatureData.java
698ed7ac7734e8da86a1cdcfc13c49c0e0e68bdf
[]
no_license
tkra6/Weather-Monitor-App
c22ba451b4d9346e0a125862c97dae8f713a147f
21c725e1c64a5588199e7701f91ed2823cb75c65
refs/heads/master
2020-03-15T03:11:25.090331
2017-05-24T05:26:19
2017-05-24T05:26:19
131,936,402
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
/** * */ package main; /** * @author Tom * Basic class for Rainfall Data - doesn't require any special attributes as it only stores text */ class TemperatureData extends WeatherData { public TemperatureData (String[] data) { this.setData(data); } }
[ "drrin2@student.monash.edu" ]
drrin2@student.monash.edu
5bee2ef754341aa8808e8766fdefd84153b26b50
0503f231ece7283be1933b134568835d36681609
/app/src/test/java/com/example/cloudkinetics/contactsdemo/ExampleUnitTest.java
edfa0ab66260c4be4f1fffc885d53525e4df3e4b
[]
no_license
harshVRastogi/twilio_demo
934cfd5db8d778efdbaad0c80bb81c5f3b9faa4d
1e390d15ed606a36ed6a24bd1269af6f7b9271c6
refs/heads/master
2020-05-20T12:41:25.367546
2017-01-31T12:27:01
2017-01-31T12:27:01
80,432,654
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package com.example.cloudkinetics.contactsdemo; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "harsh@droidharsh.com" ]
harsh@droidharsh.com
43b0cdc0996e1e264d5ac472f8775bc8a09e9ad7
ab86a948cfde0843376ab23c397e8bc9bd3f6cfc
/src/main/java/com/topspace/customer/login/controller/LoginController.java
0fb65e5f188c0b7e4b5917c87b6e7c605ca32b54
[]
no_license
wodgj/TopSpace
4c963ec5758c21564ffa1263961c494c68e6c782
f6714ddfefc0b411155120d331dd037299c58369
refs/heads/master
2021-05-05T18:02:52.059997
2018-01-14T15:42:51
2018-01-14T15:42:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,862
java
/** * @author Hunter * TopSpaceMaven * 2017-12-28 下午8:35:54 * TODO // */ package com.topspace.customer.login.controller; import java.io.File; import java.io.InputStream; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.swing.JRadioButton; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.topspace.core.framework.controller.BaseController; import com.topspace.core.framework.misc.SystemConstant; import com.topspace.core.utils.Json4Return; import com.topspace.core.utils.PKCreator; import com.topspace.core.utils.URLUtil; import com.topspace.customer.login.entity.UserBo; import com.topspace.customer.login.entity.UserInfoBo; import com.topspace.customer.login.service.LoginService; @SuppressWarnings("restriction") @Controller("LoginController") @RequestMapping("/login.do") public class LoginController extends BaseController{ @Resource LoginService LoginService; @RequestMapping(params = "p=login") public ModelAndView login(HttpServletRequest request) throws Exception { ModelAndView mv = new ModelAndView("index/index"); return mv; } @RequestMapping(params = "p=checkUser") @ResponseBody public Json4Return checkUser(String userAccount,String userPwd){ String checkUserReturn = "OK"; UserBo user = LoginService.selectUser(userAccount); if (user.getId() == null || user.getId() == "") { checkUserReturn = "hasNoUser"; } if (user.getUserPassword() != userPwd) { checkUserReturn = "invalidPwd"; } Json4Return jr = new Json4Return(true,checkUserReturn); return jr; } //查看是否存在此用户 @RequestMapping(params = "p=isHasAccount") @ResponseBody public Json4Return isHasAccount(String userAccount) { Json4Return jr; boolean hadAccount = false; Integer hasUser = LoginService.findUser(userAccount); if(hasUser == 0){ hadAccount = true; } jr = new Json4Return(true,hadAccount); return jr; } // 注册用户 @RequestMapping(params = "p=register") public ModelAndView register(HttpServletRequest request) throws Exception { String userId = PKCreator.getPrimaryKey(); UserBo user = new UserBo(); UserInfoBo userInfo = new UserInfoBo(); user.setId(userId); user.setUserAccount(request.getParameter("userAccount").toString()); user.setUserPassword(request.getParameter("userPassword").toString()); LoginService.insertUser(user); userInfo.setId(PKCreator.getPrimaryKey()); userInfo.setUserId(userId); LoginService.insertUserInfo(userInfo); ModelAndView mv = new ModelAndView("index"); return mv; } }
[ "15943286270@163.com" ]
15943286270@163.com
7601a44de100b8d66ca86a2e84a896cf39b1b96e
8f2bcfcc308f3fcc92ed0aba3710dd05337c7be9
/hebutapp/src/main/java/com/myhebut/home/HomeMusicErrActivity.java
828f90c758d3be0c990b5cce7c913c86d7169957
[]
no_license
sooglejay/MyHebut-Android
1f1f10d5d959f6cf2958ea62b38f21e2e83399d4
b609406bf7dd692106dc84f0c6dabcad019d5974
refs/heads/master
2020-12-31T04:06:44.885895
2016-08-06T11:09:31
2016-08-06T11:09:31
65,086,042
6
4
null
2016-08-06T14:23:22
2016-08-06T14:23:22
null
UTF-8
Java
false
false
1,039
java
package com.myhebut.home; import android.os.Bundle; import android.view.View; import com.lidroid.xutils.ViewUtils; import com.myhebut.activity.R; import com.umeng.analytics.MobclickAgent; import me.imid.swipebacklayout.lib.SwipeBackLayout; import me.imid.swipebacklayout.lib.app.SwipeBackActivity; public class HomeMusicErrActivity extends SwipeBackActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_music_err); ViewUtils.inject(this); // 设置右滑返回 SwipeBackLayout swipeBackLayout = this.getSwipeBackLayout(); swipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT); } public void back(View view) { finish(); } @Override public void onResume() { super.onResume(); MobclickAgent.onResume(this); } @Override public void onPause() { super.onPause(); MobclickAgent.onPause(this); } }
[ "codinghx@foxmail.com" ]
codinghx@foxmail.com
614c063e5135f3b4ea198f31146acd106c306081
87cbcfb3816cd78794e4a61b8bf11c8c103fdc83
/app/src/main/java/ph/devcon/android/attendee/db/AttendeeDao.java
28e03ffd77c0004a4264a4dd7523af1f166e7960
[ "Apache-2.0" ]
permissive
padc/DevConSummit
70226f83baddd450b00352c55b9fa05dc180a931
193199c1a32018047f6cc47f948d0860bd320f6a
refs/heads/master
2016-09-05T14:45:17.872902
2015-04-19T10:47:03
2015-04-19T10:47:03
25,624,162
3
1
null
null
null
null
UTF-8
Java
false
false
883
java
/* * Copyright (C) 2014 Philippine Android Developers Community * * 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 ph.devcon.android.attendee.db; import ph.devcon.android.base.db.BaseDevConDao; /** * Created by lope on 9/16/14. */ public interface AttendeeDao extends BaseDevConDao<Attendee, Integer> { public void setFTSAttendee(FTSAttendee ftsAttendee); }
[ "lopegwapo@gmail.com" ]
lopegwapo@gmail.com
670d62e08e7e4e80ccee6ff75e6ed42a5235fa1a
ff2e703ec4eb8895860d1a8f404fb6cb47cc60a9
/held/MonogenicWaveletToolbox_.java
c91e8f7616b88234fe7ca3637a10f341967c0ce1
[ "Apache-2.0" ]
permissive
phcerdan/isotropic_wavelet_collection
db93c7c86bc1ae59485d3df8969d21a6e31b5976
43da148bfe8360c162e18eebee2d0a4ed388a9c3
refs/heads/master
2021-03-19T15:31:13.308718
2019-01-23T16:27:18
2019-01-23T16:27:18
60,307,813
2
1
null
null
null
null
UTF-8
Java
false
false
35,189
java
/* * Decompiled with CFR 0_114. * * Could not load the following classes: * ij.ImagePlus * ij.WindowManager * ij.gui.MessageDialog * ij.plugin.frame.PlugInFrame * ij.process.ColorProcessor * ij.process.FloatProcessor * ij.process.ImageProcessor */ package monogenicwavelettoolbox; import ij.ImagePlus; import ij.WindowManager; import ij.gui.MessageDialog; import ij.plugin.frame.PlugInFrame; import ij.process.ColorProcessor; import ij.process.FloatProcessor; import ij.process.ImageProcessor; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Frame; import java.awt.GridLayout; import java.awt.LayoutManager; import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.PrintStream; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JSlider; import javax.swing.JTextField; import javax.swing.border.Border; import monogenicwavelettoolbox.About_; import monogenicwavelettoolbox.FloatArrayGeneric; import monogenicwavelettoolbox.ImageAdjuster; import monogenicwavelettoolbox.MonogenicDecompositionTree; import monogenicwavelettoolbox.MonogenicDecompositionTree2D; import monogenicwavelettoolbox.MonogenicDecompositionTree3D; import monogenicwavelettoolbox.PropertiesEnum; import monogenicwavelettoolbox.ReconstructionEnum; public class MonogenicWaveletToolbox_ extends PlugInFrame { private static final long serialVersionUID = 6627226984150029355L; protected ImagePlus mWorkingImage; protected MonogenicDecompositionTree mMonogenicDecompositionTree; protected JTextField mNumberOfOctavesField; protected JTextField mNumberOfChannelsField; protected JTextField mOrderOfWaveletsField; protected JRadioButton mShowOriginalRadioButton = new JRadioButton(PropertiesEnum.ORIGINAL.getName()); protected JRadioButton mShowR1RadioButton = new JRadioButton(PropertiesEnum.R1.getName()); protected JRadioButton mShowR2RadioButton = new JRadioButton(PropertiesEnum.R2.getName()); protected JRadioButton mShowR3RadioButton = new JRadioButton(PropertiesEnum.R3.getName()); protected JRadioButton mShowAmplitudeRadioButton = new JRadioButton(PropertiesEnum.AMPLITUDE.getName()); protected JRadioButton mShowPhaseRadioButton = new JRadioButton(PropertiesEnum.PHASE.getName()); protected JRadioButton mShowCosPhaseRadioButton = new JRadioButton(PropertiesEnum.COS_PHASE.getName()); protected JRadioButton mShowAttenuationRadioButton = new JRadioButton(PropertiesEnum.ATTENUATION.getName()); protected JRadioButton mShowOrientationRadioButton = new JRadioButton(PropertiesEnum.ORIENTATION.getName()); protected JRadioButton mShowFrequencyRadioButton = new JRadioButton(PropertiesEnum.FREQUENCY.getName()); protected JRadioButton mAutomaticIlluminationAdjustRadioButton = new JRadioButton("Equalize Illumination (also for 2D color images)"); protected JRadioButton mAutomaticIlluminationAdjustStabilizedRadioButton = new JRadioButton("Equalize Illumination (stablized)"); protected JRadioButton mAutomaticDescreeningRadioButton = new JRadioButton("Descreen"); protected JRadioButton mAutomaticDenoisingRadioButton = new JRadioButton("Denoising (set to 32-bit and scale to [0-1] first)"); protected JRadioButton mAutomaticStructureRemovalRadioButton = new JRadioButton("Remove dominant structure"); protected JRadioButton mAutomaticStructureRemovalAdaptiveRadioButton = new JRadioButton("Remove dominant structure (Adaptive)"); protected JRadioButton mLosslessRadioButton = new JRadioButton(ReconstructionEnum.LOSSLESS.getName()); protected JRadioButton mAmpOnlyRadioButton = new JRadioButton(ReconstructionEnum.AMP_ONLY.getName()); protected JRadioButton mPhaseOnlyRadioButton = new JRadioButton(ReconstructionEnum.PHASE_ONLY.getName()); protected JRadioButton mAmpPhaseRadioButton = new JRadioButton(ReconstructionEnum.AMP_PHASE.getName()); protected JRadioButton mWaveRemovalRadioButton = new JRadioButton(ReconstructionEnum.WAVE_REMOVAL.getName()); protected JRadioButton mWaveRemovalAdaptiveRadioButton = new JRadioButton(ReconstructionEnum.WAVE_REMOVAL_ADAPTIVE.getName()); protected JRadioButton mDescreenRadioButton = new JRadioButton(ReconstructionEnum.DESCREENING.getName()); protected JRadioButton mPhaseStabRadioButton = new JRadioButton(ReconstructionEnum.PHASE_ONLY_STAB.getName()); protected JRadioButton mDenoiseRadioButton = new JRadioButton(ReconstructionEnum.DENOISE.getName()); protected ButtonGroup propertySelectionButtonGroup = new ButtonGroup(); protected JSlider mOctaveSelectionSlider; protected JSlider mChannelSelectionSlider; protected int mNumberOfChannels = 1; protected int mNumberOfOctaves = 3; protected int mOrderOfWavelets = 5; protected JPanel mPropertySelectionPanel; protected JCheckBox mSymmetricExtensionCheckBox = new JCheckBox("Symmetric Extension \n(only 2D)"); protected JCheckBox mShowItemsInFullSizeCheckBox = new JCheckBox("Show in full size"); protected JTextField mReconstructionThresholdTextField = new JTextField("10.0"); protected boolean mBuildGui; private JPanel mMainPanel; private JPanel mMainPanelManual; public MonogenicWaveletToolbox_() { super("Monogenic Wavelet Toolbox"); this.mBuildGui = true; this.buildGUI(); } public MonogenicWaveletToolbox_(boolean buildGui) { super("Monogenic Wavelet Toolbox"); this.mBuildGui = buildGui; if (buildGui) { this.buildGUI(); } } private void buildGUI() { this.mMainPanel = new JPanel(); this.mMainPanelManual = new JPanel(new BorderLayout()); JPanel mainPanelAutomatic = new JPanel(new BorderLayout()); JButton automaticButton = new JButton("Execute"); automaticButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { long startTime = System.currentTimeMillis(); MonogenicWaveletToolbox_.this.acquireImage(); if (MonogenicWaveletToolbox_.this.mWorkingImage == null) { return; } try { if (MonogenicWaveletToolbox_.this.mAutomaticIlluminationAdjustRadioButton.isSelected() || MonogenicWaveletToolbox_.this.mAutomaticIlluminationAdjustStabilizedRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.performEqualizationOfBrightness(MonogenicWaveletToolbox_.this.mWorkingImage, MonogenicWaveletToolbox_.this.mAutomaticIlluminationAdjustStabilizedRadioButton.isSelected(), false); } else if (MonogenicWaveletToolbox_.this.mAutomaticDescreeningRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.performDescreen(MonogenicWaveletToolbox_.this.mWorkingImage); } else if (MonogenicWaveletToolbox_.this.mAutomaticStructureRemovalRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mNumberOfChannels = 1; MonogenicWaveletToolbox_.this.mNumberOfOctaves = ImageAdjuster.getMaximalNumberOfOctaves(MonogenicWaveletToolbox_.this.mWorkingImage); MonogenicWaveletToolbox_.this.mOrderOfWavelets = 1; MonogenicWaveletToolbox_.this.startDecomposition(); MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.WAVE_REMOVAL); } else if (MonogenicWaveletToolbox_.this.mAutomaticStructureRemovalAdaptiveRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mNumberOfChannels = 1; MonogenicWaveletToolbox_.this.mNumberOfOctaves = ImageAdjuster.getMaximalNumberOfOctaves(MonogenicWaveletToolbox_.this.mWorkingImage); MonogenicWaveletToolbox_.this.mOrderOfWavelets = 1; MonogenicWaveletToolbox_.this.startDecomposition(); MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.WAVE_REMOVAL_ADAPTIVE); } else if (MonogenicWaveletToolbox_.this.mAutomaticDenoisingRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mNumberOfChannels = 5; MonogenicWaveletToolbox_.this.mNumberOfOctaves = ImageAdjuster.getMaximalNumberOfOctaves(MonogenicWaveletToolbox_.this.mWorkingImage); MonogenicWaveletToolbox_.this.mOrderOfWavelets = 1; MonogenicWaveletToolbox_.this.startDecomposition(); MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.DENOISE); } } catch (OutOfMemoryError e1) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Out of memory. Try a smaller image."); return; } System.out.println("Total elapsed time: " + (System.currentTimeMillis() - startTime) + " ms"); } }); mainPanelAutomatic.add((Component)automaticButton, "South"); JPanel automaticRadioButtonPanel = new JPanel(new GridLayout(4, 1)); mainPanelAutomatic.add((Component)automaticRadioButtonPanel, "North"); automaticRadioButtonPanel.add(this.mAutomaticDescreeningRadioButton); automaticRadioButtonPanel.add(this.mAutomaticIlluminationAdjustRadioButton); automaticRadioButtonPanel.add(this.mAutomaticIlluminationAdjustStabilizedRadioButton); automaticRadioButtonPanel.add(this.mAutomaticDenoisingRadioButton); ButtonGroup automaticPanelButtonGroup = new ButtonGroup(); automaticPanelButtonGroup.add(this.mAutomaticDescreeningRadioButton); automaticPanelButtonGroup.add(this.mAutomaticIlluminationAdjustRadioButton); automaticPanelButtonGroup.add(this.mAutomaticIlluminationAdjustStabilizedRadioButton); automaticPanelButtonGroup.add(this.mAutomaticStructureRemovalAdaptiveRadioButton); automaticPanelButtonGroup.add(this.mAutomaticStructureRemovalRadioButton); automaticPanelButtonGroup.add(this.mAutomaticDenoisingRadioButton); this.mMainPanel.add("Manual Decomp./Rec.", this.mMainPanelManual); this.add((Component)this.mMainPanel); MenuBar menuBar = new MenuBar(); Menu menu = new Menu("Info"); MenuItem aboutMenuItem = new MenuItem("About"); aboutMenuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { About_.showAbout(); } }); this.mShowOriginalRadioButton.setSelected(true); menu.add(aboutMenuItem); this.setMenuBar(menuBar); JPanel decompositionPanel = new JPanel(new BorderLayout()); decompositionPanel.setBorder(BorderFactory.createTitledBorder("Decomposition")); JPanel decompositionTextPanel = new JPanel(new GridLayout(2, 2)); this.mNumberOfOctavesField = new JTextField("3"); this.mNumberOfOctavesField.setBorder(BorderFactory.createTitledBorder("No. Octaves")); this.mNumberOfChannelsField = new JTextField("1"); this.mNumberOfChannelsField.setBorder(BorderFactory.createTitledBorder("No. Voices")); this.mOrderOfWaveletsField = new JTextField("1"); this.mOrderOfWaveletsField.setBorder(BorderFactory.createTitledBorder("Order of Wavelets")); decompositionTextPanel.add(this.mNumberOfOctavesField); decompositionTextPanel.add(this.mNumberOfChannelsField); decompositionTextPanel.add(this.mOrderOfWaveletsField); decompositionTextPanel.add(this.mSymmetricExtensionCheckBox); decompositionPanel.add((Component)decompositionTextPanel, "Center"); JButton computeDecompositionButton = new JButton("Decomposition"); computeDecompositionButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { MonogenicWaveletToolbox_.this.acquireImage(); if (MonogenicWaveletToolbox_.this.mWorkingImage == null) { return; } try { MonogenicWaveletToolbox_.this.mNumberOfOctaves = Integer.parseInt(MonogenicWaveletToolbox_.this.mNumberOfOctavesField.getText()); MonogenicWaveletToolbox_.this.mNumberOfChannels = Integer.parseInt(MonogenicWaveletToolbox_.this.mNumberOfChannelsField.getText()); MonogenicWaveletToolbox_.this.mOrderOfWavelets = Integer.parseInt(MonogenicWaveletToolbox_.this.mOrderOfWaveletsField.getText()); if (MonogenicWaveletToolbox_.this.mNumberOfOctaves > ImageAdjuster.getMaximalNumberOfOctaves(MonogenicWaveletToolbox_.this.mWorkingImage)) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Maximum number of octaves for this image is " + ImageAdjuster.getMaximalNumberOfOctaves(MonogenicWaveletToolbox_.this.mWorkingImage)); return; } if (MonogenicWaveletToolbox_.this.mOrderOfWavelets > 5 || MonogenicWaveletToolbox_.this.mOrderOfWavelets < 0) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Choose smoothness order of wavelets between 0 and 5"); return; } MonogenicWaveletToolbox_.this.startDecomposition(); } catch (OutOfMemoryError e1) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Out of memory. Try a smaller image."); return; } } }); decompositionPanel.add((Component)computeDecompositionButton, "South"); this.mMainPanelManual.add((Component)decompositionPanel, "North"); JPanel displayPanel = new JPanel(new BorderLayout()); displayPanel.setBorder(BorderFactory.createTitledBorder("Display")); this.mPropertySelectionPanel = new JPanel(new GridLayout(4, 2)); this.propertySelectionButtonGroup.add(this.mShowOriginalRadioButton); this.propertySelectionButtonGroup.add(this.mShowR1RadioButton); this.propertySelectionButtonGroup.add(this.mShowR2RadioButton); this.propertySelectionButtonGroup.add(this.mShowR3RadioButton); this.propertySelectionButtonGroup.add(this.mShowAmplitudeRadioButton); this.propertySelectionButtonGroup.add(this.mShowOrientationRadioButton); this.propertySelectionButtonGroup.add(this.mShowPhaseRadioButton); this.propertySelectionButtonGroup.add(this.mShowCosPhaseRadioButton); this.propertySelectionButtonGroup.add(this.mShowFrequencyRadioButton); JPanel detailSelectionParentPanel = new JPanel(new BorderLayout()); JPanel detailSelectionPanel = new JPanel(new GridLayout(1, 2)); detailSelectionParentPanel.add((Component)detailSelectionPanel, "Center"); detailSelectionParentPanel.add((Component)this.mShowItemsInFullSizeCheckBox, "South"); displayPanel.add((Component)detailSelectionParentPanel, "North"); this.mOctaveSelectionSlider = new JSlider(0, 0, this.mNumberOfOctaves + 1, 1); detailSelectionPanel.add(this.mOctaveSelectionSlider); this.mOctaveSelectionSlider.setBorder(BorderFactory.createTitledBorder("Octave")); this.mOctaveSelectionSlider.setMajorTickSpacing(1); this.mOctaveSelectionSlider.setPaintTicks(true); this.mOctaveSelectionSlider.setPaintLabels(true); this.mChannelSelectionSlider = new JSlider(0, 1, this.mNumberOfChannels, 1); detailSelectionPanel.add(this.mChannelSelectionSlider); this.mChannelSelectionSlider.setBorder(BorderFactory.createTitledBorder("Voice")); this.mChannelSelectionSlider.setMajorTickSpacing(1); this.mChannelSelectionSlider.setPaintTicks(true); this.mChannelSelectionSlider.setPaintLabels(true); JButton displayButton = new JButton("Display"); displayPanel.add((Component)displayButton, "South"); displayButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if (MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree == null) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Decompose first the image"); return; } try { int selectedOctave = MonogenicWaveletToolbox_.this.mOctaveSelectionSlider.getValue(); int selectedChannel = MonogenicWaveletToolbox_.this.mChannelSelectionSlider.getValue(); if (MonogenicWaveletToolbox_.this.mShowOriginalRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.ORIGINAL, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowR1RadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.R1, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowR2RadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.R2, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowR3RadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.R3, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowAmplitudeRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.AMPLITUDE, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowAttenuationRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.ATTENUATION, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowPhaseRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.PHASE, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowCosPhaseRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.COS_PHASE, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowOrientationRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.ORIENTATION, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } else if (MonogenicWaveletToolbox_.this.mShowFrequencyRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showDecompositionItem(selectedOctave, selectedChannel, PropertiesEnum.FREQUENCY, MonogenicWaveletToolbox_.this.mShowItemsInFullSizeCheckBox.isSelected()); } } catch (OutOfMemoryError e1) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Out of memory. Try a smaller image or ImageJ increase memory size in Edit->Options->Memory & Threads."); return; } } }); JPanel reconstructionPanel = new JPanel(new BorderLayout()); reconstructionPanel.setBorder(BorderFactory.createTitledBorder("Reconstruction")); JPanel reconstructionRadioPanel = new JPanel(new GridLayout(3, 2)); ButtonGroup reconstructionMethodButtonGroup = new ButtonGroup(); reconstructionMethodButtonGroup.add(this.mLosslessRadioButton); reconstructionMethodButtonGroup.add(this.mPhaseOnlyRadioButton); reconstructionMethodButtonGroup.add(this.mAmpOnlyRadioButton); reconstructionMethodButtonGroup.add(this.mAmpPhaseRadioButton); reconstructionMethodButtonGroup.add(this.mWaveRemovalRadioButton); this.mLosslessRadioButton.setSelected(true); reconstructionMethodButtonGroup.add(this.mWaveRemovalAdaptiveRadioButton); reconstructionMethodButtonGroup.add(this.mDescreenRadioButton); reconstructionMethodButtonGroup.add(this.mPhaseStabRadioButton); reconstructionMethodButtonGroup.add(this.mDenoiseRadioButton); reconstructionRadioPanel.add(this.mLosslessRadioButton); reconstructionRadioPanel.add(this.mPhaseOnlyRadioButton); reconstructionRadioPanel.add(this.mAmpOnlyRadioButton); reconstructionRadioPanel.add(this.mDescreenRadioButton); reconstructionRadioPanel.add(this.mPhaseStabRadioButton); JPanel thresholdPanel = new JPanel(new BorderLayout()); thresholdPanel.setBorder(BorderFactory.createTitledBorder("Treshhold")); thresholdPanel.add((Component)this.mReconstructionThresholdTextField, "Center"); reconstructionPanel.add((Component)reconstructionRadioPanel, "Center"); JButton reconstructionButton = new JButton("Reconstruction"); reconstructionButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if (MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree == null) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Decompose Image First"); return; } try { if (MonogenicWaveletToolbox_.this.mLosslessRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.LOSSLESS); } else if (MonogenicWaveletToolbox_.this.mAmpOnlyRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.AMP_ONLY); } else if (MonogenicWaveletToolbox_.this.mPhaseOnlyRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.PHASE_ONLY); } else if (MonogenicWaveletToolbox_.this.mAmpPhaseRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.AMP_PHASE); } else if (MonogenicWaveletToolbox_.this.mWaveRemovalRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.WAVE_REMOVAL); } else if (MonogenicWaveletToolbox_.this.mWaveRemovalAdaptiveRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.WAVE_REMOVAL_ADAPTIVE); } else if (MonogenicWaveletToolbox_.this.mDescreenRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.DESCREENING); } else if (MonogenicWaveletToolbox_.this.mPhaseStabRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.PHASE_ONLY_STAB, Double.parseDouble(MonogenicWaveletToolbox_.this.mReconstructionThresholdTextField.getText())); } else if (MonogenicWaveletToolbox_.this.mDenoiseRadioButton.isSelected()) { MonogenicWaveletToolbox_.this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.DENOISE, Double.parseDouble(MonogenicWaveletToolbox_.this.mReconstructionThresholdTextField.getText())); } } catch (OutOfMemoryError e1) { new ij.gui.MessageDialog((Frame)((Object)MonogenicWaveletToolbox_.this), "Error", "Not enough memory. Try a smaller image or increase ImageJ memory by Edit -> Options -> Memory and Threads."); return; } } }); reconstructionPanel.add((Component)reconstructionButton, "South"); this.mMainPanelManual.add((Component)displayPanel, "Center"); this.mMainPanelManual.add((Component)reconstructionPanel, "South"); this.mShowAmplitudeRadioButton.setToolTipText("The amplitude is the absolute value of the hypercomplex wavelet coeffients."); this.mShowPhaseRadioButton.setToolTipText("The phase is the arcus cosine of of the real part and the amplitude."); this.mShowCosPhaseRadioButton.setToolTipText("The cosine of the phase."); this.mShowOrientationRadioButton.setToolTipText("The phase orientation is the arcus tangens of the imaginary parts 1 and 2."); this.mShowFrequencyRadioButton.setToolTipText("The frequency is the directional derivative of the phase into the phase orientation."); this.mShowItemsInFullSizeCheckBox.setToolTipText("Check this box to see coefficient images in full size."); this.mSymmetricExtensionCheckBox.setToolTipText("Chech this box to symetrically extend the image before decomposition. This may reduce Gibbs-like artifacts but increases runtime."); this.mOrderOfWaveletsField.setToolTipText("The order of smoothness of the wavelet used. Choose between 0 and 5."); this.mNumberOfOctavesField.setToolTipText("The number of octaves used for the decomposition."); this.mNumberOfChannelsField.setToolTipText("The number of voices per octaves."); this.mOctaveSelectionSlider.setToolTipText("Select the octave to display. 0: original image, 1 to (No. Octaves): the corresponding octave subband,(No. Octave) + 1: the low pass component."); this.mChannelSelectionSlider.setToolTipText("Select the voice of the current octave. Obsolete for Octave = 0 and Octave = (No. Octaves) + 1."); this.mShowOriginalRadioButton.setToolTipText("The real part of the transform coefficients."); this.mShowR1RadioButton.setToolTipText("The first imaginary part of the transform coefficients."); this.mShowR2RadioButton.setToolTipText("The second imaginary part of the transform coefficients."); this.mShowR3RadioButton.setToolTipText("The third imaginary part of the transform coefficients."); this.mLosslessRadioButton.setToolTipText("Perfect reconstruction of the wavelet coefficients."); this.mDescreenRadioButton.setToolTipText("Removal of the screening effect from images, e.g. newspaper images."); this.mPhaseOnlyRadioButton.setToolTipText("Reconstruction from cosine of the coefficients phase only, setting amplitude to 1."); this.mPhaseStabRadioButton.setToolTipText("Noise suppressed reconstruction from cosine of the coefficients phase only, setting amplitude to 1."); this.mAmpOnlyRadioButton.setToolTipText("Reconstruction from the coefficients amplitude only, setting phase to 0."); displayPanel.add((Component)this.mPropertySelectionPanel, "Center"); this.updateGUI(false); this.pack(); this.setVisible(true); } private void updateGUI(boolean is3d) { if (is3d) { this.mPropertySelectionPanel.removeAll(); this.mPropertySelectionPanel.add(this.mShowOriginalRadioButton); this.mPropertySelectionPanel.add(this.mShowAmplitudeRadioButton); this.mPropertySelectionPanel.add(this.mShowR1RadioButton); this.mPropertySelectionPanel.add(this.mShowPhaseRadioButton); this.mPropertySelectionPanel.add(this.mShowR2RadioButton); this.mPropertySelectionPanel.add(this.mShowCosPhaseRadioButton); this.mPropertySelectionPanel.add(this.mShowR3RadioButton); this.mPropertySelectionPanel.add(this.mShowFrequencyRadioButton); } else { this.mPropertySelectionPanel.removeAll(); this.mPropertySelectionPanel.add(this.mShowOriginalRadioButton); this.mPropertySelectionPanel.add(this.mShowAmplitudeRadioButton); this.mPropertySelectionPanel.add(this.mShowR1RadioButton); this.mPropertySelectionPanel.add(this.mShowPhaseRadioButton); this.mPropertySelectionPanel.add(this.mShowR2RadioButton); this.mPropertySelectionPanel.add(this.mShowCosPhaseRadioButton); this.mPropertySelectionPanel.add(this.mShowOrientationRadioButton); this.mPropertySelectionPanel.add(this.mShowFrequencyRadioButton); } this.mOctaveSelectionSlider.setMaximum(this.mNumberOfOctaves + 1); this.mChannelSelectionSlider.setMaximum(this.mNumberOfChannels); this.mNumberOfOctavesField.setText("" + this.mNumberOfOctaves); this.mNumberOfChannelsField.setText("" + this.mNumberOfChannels); this.mOrderOfWaveletsField.setText("" + this.mOrderOfWavelets); this.pack(); } protected void startDecomposition() { this.startDecomposition(this.mWorkingImage); } protected boolean startDecomposition(ImagePlus imp) { if (imp.getStackSize() == 1) { this.mMonogenicDecompositionTree = new MonogenicDecompositionTree2D(imp, this.mNumberOfOctaves, this.mNumberOfChannels, this.mOrderOfWavelets, this.mSymmetricExtensionCheckBox.isSelected()); this.updateGUI(false); return true; } if (!ImageAdjuster.checkDimension(imp)) { new ij.gui.MessageDialog((Frame)((Object)this), "Error", "For performance reasons the size of 3D images must be a power of 2 in each dimension (width, height and stacksize)"); return false; } this.mMonogenicDecompositionTree = new MonogenicDecompositionTree3D(imp, this.mNumberOfOctaves, this.mNumberOfChannels, this.mOrderOfWavelets); this.updateGUI(true); return true; } protected void acquireImage() { this.mWorkingImage = WindowManager.getCurrentImage(); if (this.mWorkingImage == null) { new ij.gui.MessageDialog((Frame)((Object)this), "Error", "No Image Loaded"); return; } this.mWorkingImage.updateImage(); } public void performEqualizationOfBrightness(ImagePlus imp, boolean stabilized, boolean contrastEnhance) { ImageProcessor ip = imp.getProcessor(); this.mNumberOfChannels = 5; this.mNumberOfOctaves = ImageAdjuster.getMaximalNumberOfOctaves(imp); this.mOrderOfWavelets = 1; if (ip instanceof ColorProcessor) { if (imp.getStackSize() > 1) { new ij.gui.MessageDialog((Frame)((Object)this), "Error", "Illumination equalization does not work for stacks of coloured images"); return; } ColorProcessor ipc = (ColorProcessor)ip; FloatProcessor[] lab = ImageAdjuster.RGBtoLAB(ipc); if (!this.startDecomposition(new ImagePlus("", (ImageProcessor)lab[0]))) { return; } FloatArrayGeneric floatArr = null; floatArr = stabilized ? this.mMonogenicDecompositionTree.getReconstruction(ReconstructionEnum.PHASE_ONLY_STAB, 0.0, !contrastEnhance) : this.mMonogenicDecompositionTree.getReconstruction(ReconstructionEnum.PHASE_ONLY, 0.0, !contrastEnhance); if (contrastEnhance) { floatArr.scaleTo(0.0, 1.0).add(this.mMonogenicDecompositionTree.getImage().add(this.mMonogenicDecompositionTree.getMeanValue()).scaleTo(0.0, 1.0)); } ImagePlus rec = floatArr.getImagePlusReal("", 1, ipc.getHeight(), ipc.getWidth()); lab[0] = rec.getProcessor(); ImageAdjuster.scaleArray((float[])lab[0].getPixels(), 0.0f, 100.0f); ColorProcessor ipcRec = ImageAdjuster.LABtoRGB((ImageProcessor[])lab); ImagePlus reconstructed = new ImagePlus(String.valueOf(imp.getTitle()) + ", Equalization of Brightness", (ImageProcessor)ipcRec); reconstructed.updateAndDraw(); reconstructed.resetDisplayRange(); reconstructed.updateAndDraw(); reconstructed.show(); } else { if (!this.startDecomposition(imp)) { return; } FloatArrayGeneric rec = null; String title = String.valueOf(imp.getTitle()) + "Equalization of Brightness"; if (stabilized) { rec = this.mMonogenicDecompositionTree.getReconstruction(ReconstructionEnum.PHASE_ONLY_STAB, 0.0, !contrastEnhance); title = String.valueOf(title) + " (noise suppressed)"; } else { rec = this.mMonogenicDecompositionTree.getReconstruction(ReconstructionEnum.PHASE_ONLY, 0.0, !contrastEnhance); } if (contrastEnhance) { rec.scaleTo(0.0, 0.5); rec.add(this.mMonogenicDecompositionTree.getImage().scaleTo(0.0, 0.5)); } ImagePlus reconstructed = rec.getImagePlusReal(title, imp.getStackSize(), imp.getHeight(), imp.getWidth()); reconstructed.updateAndDraw(); reconstructed.show(); } } public void performDescreen(ImagePlus imp) { this.mNumberOfChannels = 1; this.mNumberOfOctaves = ImageAdjuster.getMaximalNumberOfOctaves(imp); this.mOrderOfWavelets = 1; if (!this.startDecomposition(imp)) { return; } this.mMonogenicDecompositionTree.showReconstruction(ReconstructionEnum.DESCREENING); } }
[ "pablo.hernandez.cerdan@outlook.com" ]
pablo.hernandez.cerdan@outlook.com
b8ea14b02a0bc3f3f8189f3f5d708c2dde9d2f84
14a0d0dc977295cc1077a099e12ca05794e7f84a
/gokong-main/src/main/java/cn/gokong/www/gokongmain/service/MerchantsService.java
32d40777d0139f6a513848da78fc7f3f746a6fda
[]
no_license
yht-817/gokong-manage
2ec59e86fd1aa8839b6566471026d78c55e2b8c5
f779614f12b30ccf2495856f873d6b9c87898612
refs/heads/master
2020-05-03T18:55:09.754700
2019-04-01T03:05:45
2019-04-01T03:05:45
178,774,202
0
0
null
null
null
null
UTF-8
Java
false
false
1,299
java
package cn.gokong.www.gokongmain.service; import cn.gokong.www.gokongmain.domain.Merchants; import cn.gokong.www.gokongmain.vo.merchants.QueryMerchantsDetailsOutput; import cn.gokong.www.gokongmain.vo.merchants.PageQueryMerchantsOutput; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; /** * <p> * 商户数据 服务类 * </p> * * @author iKook * @since 2018-09-11 */ public interface MerchantsService extends IService<Merchants> { /** * 分页查询商户数据 * * * @param cityName 城市名称 * @param keyword 检索内容 * @param startNo 开始位置 * @param pageSize 检索长度 * @param merchantsType 商户类型 * @return */ List<PageQueryMerchantsOutput> pageQueryMerchants(String cityName, String keyword, int startNo, int pageSize, String merchantsType); /** * 获取商户详情 * @param userNo 用户编码 * @param merchantsNo 商户编码 * @return */ QueryMerchantsDetailsOutput queryMerchantsDetails(String userNo, String merchantsNo); /** * 根据商户编码查询商户信息 * @param merchantsNo 商户编码 * @return */ Merchants findByMerchantsNo(String merchantsNo); }
[ "1475409096@qq.com" ]
1475409096@qq.com
269f3e3885194a4f9f9187344642114876528346
6770994c785d0f36cabddef2b7e54167695bc3d3
/app/src/main/java/com/studyun/bluetooth4chat/DateUtils.java
7e8dd466a8491a71baa2f71356bcf743b0acef2a
[]
no_license
YangEdward/Bluetooth4Chat
cbdecadc1ef4c9b59cbe33c2eaf3170087a527e0
25073dfa94bb4abc455525e1464072ff17347cc2
refs/heads/master
2021-01-19T05:07:49.772457
2015-05-20T14:30:56
2015-05-20T14:30:56
35,362,119
2
1
null
null
null
null
UTF-8
Java
false
false
5,158
java
package com.studyun.bluetooth4chat; import android.annotation.SuppressLint; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * * @author Edward * @version 1.0.0 2014-9-4 */ @SuppressLint("SimpleDateFormat") public class DateUtils { public static final String _YYYY_MM_DD = "yyyy-MM-dd"; public static final String _Y_M_D_H_M_S="yyyy-MM-dd HH:mm:ss"; public static String now(){ SimpleDateFormat df = new SimpleDateFormat(_Y_M_D_H_M_S); return df.format(new Date()); } public static Date getNow(){ return new Date(); } public static String dateToStr(Date date){ SimpleDateFormat df = new SimpleDateFormat(_Y_M_D_H_M_S); return df.format(date); } public static String dateToStr(Date date,String format){ SimpleDateFormat df = new SimpleDateFormat(format); return df.format(date); } public static Date strToDate(String date,String format) throws ParseException{ SimpleDateFormat df = new SimpleDateFormat(format); return df.parse(date); } public static String yesterday(){ Calendar c = Calendar.getInstance(); c.setTime(new Date()); int day = c.get(Calendar.DATE); c.set(Calendar.DATE, day - 1); String dayBefore = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); return dayBefore+" 00:00"; } public static String tomrrow(){ Calendar c = Calendar.getInstance(); c.setTime(new Date()); int day = c.get(Calendar.DATE); c.set(Calendar.DATE, day + 1); String dayAfter = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); return dayAfter+" 00:00"; } /** * @param date1 * @param date2 */ public static int compareDate(Date date1, Date date2) { return date1.compareTo(date2); } /** * @param date1 * @param date2 */ public static int compareDate(String date1, String date2) { DateFormat df = new SimpleDateFormat(_YYYY_MM_DD); try { Date dt1 = df.parse(date1); Date dt2 = df.parse(date2); if (dt1.getTime() > dt2.getTime()) { return 1; } else if (dt1.getTime() < dt2.getTime()) { return -1; } else { return 0; } } catch (Exception exception) { exception.printStackTrace(); } return 0; } public static String DateToString(String format,Date date1){ return new SimpleDateFormat(format).format(date1); } /** * @param specifiedDay, * @return */ public static String getSpecifiedDayAfter(String specifiedDay) { Calendar c = Calendar.getInstance(); Date date = null; try { date = new SimpleDateFormat(_YYYY_MM_DD).parse(specifiedDay); } catch (ParseException e) { e.printStackTrace(); } c.setTime(date); int day = c.get(Calendar.DATE); c.set(Calendar.DATE, day + 1); String dayAfter = new SimpleDateFormat(_YYYY_MM_DD) .format(c.getTime()); return dayAfter; } public static Date getSpecifiedDayAfter(Date d) { Date date = null; Calendar calendar = Calendar.getInstance(); calendar.setTime(d); calendar.add(Calendar.DAY_OF_MONTH, 1); date = calendar.getTime(); return date; } /** * @param * @return * @throws ParseException */ public static Long getDiffDay(String beginDate, String endDate) { SimpleDateFormat formatter = new SimpleDateFormat(_YYYY_MM_DD); Long checkday = 0l; try { checkday = (formatter.parse(endDate).getTime() - formatter.parse( beginDate).getTime()) / (1000 * 24 * 60 * 60); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); checkday = null; } return checkday; } public static Long getDiffDay(Date beginDate, Date endDate) { SimpleDateFormat format = new SimpleDateFormat(_YYYY_MM_DD); String strBeginDate = format.format(beginDate); String strEndDate = format.format(endDate); return getDiffDay(strBeginDate, strEndDate); } /** * @return */ public static boolean isWeekend(Date bdate) { Calendar cal = Calendar.getInstance(); cal.setTime(bdate); int week = cal.get(Calendar.DAY_OF_WEEK) - 1; if (week == 6 || week == 0) { return Boolean.TRUE; } return Boolean.FALSE; } /** * @param specifiedYear * @param num * @return */ public static Date getSpecifiedYearAfter(Date specifiedYear,int num) { Calendar c = Calendar.getInstance(); c.setTime(specifiedYear); int year = c.get(Calendar.YEAR); c.set(Calendar.YEAR, year + num); return c.getTime(); } /** * @param specifiedMinute * @param num * @return */ public static Date getSpecifiedMinuteAfter(Date specifiedMinute, int num) { Calendar c = Calendar.getInstance(); c.setTime(specifiedMinute); c.add(Calendar.MINUTE, num); return c.getTime(); } /** * @param date1 * @param date2 * @return */ public static int dateCompareTo(Date date1,Date date2){ Calendar c1=Calendar.getInstance(); Calendar c2=Calendar.getInstance(); c1.setTime(date1); c2.setTime(date2); return c1.compareTo(c2); } }
[ "murongyunlong@gmail.com" ]
murongyunlong@gmail.com
0f17feaf19451e7b202e1df6ce4eeb4ab7de27a1
f8a632c91a4b2f22376b3301ce85747824fd6dac
/impl/shim/mapreduce/src/test/java/org/pentaho/big/data/impl/shim/mapreduce/MockVisitorService.java
fff1a3cf6af2f9ef30591f56b28d93571506bc91
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
dianhu/big-data-plugin
3edd16c6786e2fd60b7d3b3d15df7317dadbada4
5736ad88b42face5b1474283636938acedeb0490
refs/heads/master
2021-01-16T21:14:24.731846
2017-10-01T01:10:19
2017-10-01T01:10:19
100,225,563
0
0
null
2017-08-14T03:42:38
2017-08-14T03:42:38
null
UTF-8
Java
false
false
1,317
java
/******************************************************************************* * * Pentaho Big Data * * Copyright (C) 2002-2016 by Pentaho : http://www.pentaho.com * ******************************************************************************* * * 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.pentaho.big.data.impl.shim.mapreduce; import org.pentaho.bigdata.api.mapreduce.MapReduceTransformations; import org.pentaho.bigdata.api.mapreduce.TransformationVisitorService; /** * Created by ccaspanello on 8/29/2016. */ public class MockVisitorService implements TransformationVisitorService { @Override public void visit(MapReduceTransformations transformations) { // Do Nothing } }
[ "ccaspanello@pentaho.com" ]
ccaspanello@pentaho.com
e8635a7c95affd7c761b56cd34a8d85e77afe429
4c821b04efcdaff23c9debe8ca301f8572e751a5
/app/src/main/java/com/smallpay/app/ski/rent/ui/view/BottomBar.java
26eeccf5b00a1190504fe124c5531c016f80bfce
[]
no_license
HKen/CBSSkiRentApp
35f6065889fa27ba7e04886512e5d7bbfde1ceae
66f1c30f478dcf21fa2de9baa9da70b5a89c1d1d
refs/heads/master
2020-03-11T13:19:44.211322
2018-04-18T07:31:31
2018-04-18T07:31:31
130,021,790
0
0
null
null
null
null
UTF-8
Java
false
false
6,917
java
package com.smallpay.app.ski.rent.ui.view; import android.content.Context; import android.graphics.Color; import android.os.Parcel; import android.os.Parcelable; import android.support.v4.view.ViewCompat; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.LinearLayout; import com.smallpay.app.ski.rent.R; /** * Created by YoKeyword on 16/6/3. */ public class BottomBar extends LinearLayout { private static final int TRANSLATE_DURATION_MILLIS = 200; private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator(); private boolean mVisible = true; private LinearLayout mTabLayout; private LayoutParams mTabParams; private int mCurrentPosition = 0; private OnTabSelectedListener mListener; public BottomBar(Context context) { this(context, null); } public BottomBar(Context context, AttributeSet attrs) { this(context, attrs, 0); } public BottomBar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } private void init(Context context, AttributeSet attrs) { setOrientation(VERTICAL); // ImageView shadowView = new ImageView(context); // shadowView.setBackgroundResource(R.drawable.actionbar_shadow_up); // addView(shadowView, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mTabLayout = new LinearLayout(context); mTabLayout.setBackgroundColor(getResources().getColor(R.color.tab_background_normal)); mTabLayout.setOrientation(LinearLayout.VERTICAL); addView(mTabLayout, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mTabParams = new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT); mTabParams.weight = 1; } public BottomBar addItem(final BottomBarTab tab) { tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mListener == null) return; int pos = tab.getTabPosition(); if (mCurrentPosition == pos) { mListener.onTabReselected(pos); } else { mListener.onTabSelected(pos, mCurrentPosition); tab.setSelected(true); mListener.onTabUnselected(mCurrentPosition); mTabLayout.getChildAt(mCurrentPosition).setSelected(false); mCurrentPosition = pos; } } }); tab.setTabPosition(mTabLayout.getChildCount()); tab.setLayoutParams(mTabParams); mTabLayout.addView(tab); return this; } public void setOnTabSelectedListener(OnTabSelectedListener onTabSelectedListener) { mListener = onTabSelectedListener; } public void setCurrentItem(final int position) { mTabLayout.post(new Runnable() { @Override public void run() { mTabLayout.getChildAt(position).performClick(); } }); } public interface OnTabSelectedListener { void onTabSelected(int position, int prePosition); void onTabUnselected(int position); void onTabReselected(int position); } @Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); return new SavedState(superState, mCurrentPosition); } @Override protected void onRestoreInstanceState(Parcelable state) { SavedState ss = (SavedState) state; super.onRestoreInstanceState(ss.getSuperState()); if (mCurrentPosition != ss.position) { mTabLayout.getChildAt(mCurrentPosition).setSelected(false); mTabLayout.getChildAt(ss.position).setSelected(true); } mCurrentPosition = ss.position; } public int getCurrentItemPosition() { return mCurrentPosition; } static class SavedState extends BaseSavedState { private int position; public SavedState(Parcel source) { super(source); position = source.readInt(); } public SavedState(Parcelable superState, int position) { super(superState); this.position = position; } @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeInt(position); } public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { public SavedState createFromParcel(Parcel in) { return new SavedState(in); } public SavedState[] newArray(int size) { return new SavedState[size]; } }; } public void hide() { hide(true); } public void show() { show(true); } public void hide(boolean anim) { toggle(false, anim, false); } public void show(boolean anim) { toggle(true, anim, false); } public boolean isVisible() { return mVisible; } private void toggle(final boolean visible, final boolean animate, boolean force) { if (mVisible != visible || force) { mVisible = visible; int height = getHeight(); if (height == 0 && !force) { ViewTreeObserver vto = getViewTreeObserver(); if (vto.isAlive()) { // view树完成测量并且分配空间而绘制过程还没有开始的时候播放动画。 vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { ViewTreeObserver currentVto = getViewTreeObserver(); if (currentVto.isAlive()) { currentVto.removeOnPreDrawListener(this); } toggle(visible, animate, true); return true; } }); return; } } int translationY = visible ? 0 : height; if (animate) { animate().setInterpolator(mInterpolator) .setDuration(TRANSLATE_DURATION_MILLIS) .translationY(translationY); } else { ViewCompat.setTranslationY(this, translationY); } } } }
[ "963331818@qq.com" ]
963331818@qq.com
23be9ec2495f73c70350462d5fdadbe4da5a93e0
b91663fcfac5ba790e78f7128c609c88a1213d12
/Cursos Udemy/Tutorial Spring/concursotalentos01/src/main/java/concursantes/Saxofon.java
c1297d6585978211ab116ed18be3e2e1a07ea50b
[]
no_license
jfrogz/Workspace-Personal
70f8a40af017244489d87ac9834666d028d22f55
aa4267d6dbec2436248608dbf99ed97b5904dde1
refs/heads/master
2021-01-11T20:12:48.090863
2017-09-28T23:30:54
2017-09-28T23:30:54
79,067,457
0
0
null
null
null
null
UTF-8
Java
false
false
206
java
package concursantes; /** * Created by Fernando Robles on 09/02/2017. */ public class Saxofon implements Instrumento { public void tocar() { System.out.println("Tuu Tuu Tuu Tuu..."); } }
[ "fernando.robles@sngular.team" ]
fernando.robles@sngular.team
fae5127fb34bf37938c04dc1131201087f67b342
d65c644c467ded4ce46934beb6fe6360ebfa520b
/kimble/src-graphic/kimble/graphic/pickingray/RayGenerator.java
f1653c5527ef8b7788420155050723adc0294ed1
[]
no_license
lybeck/kimble
5cbed63649157d237c7a31450dbb7529d180aa4b
da884f64641b7541706dca594af0feeca45df0f5
refs/heads/master
2021-01-12T19:18:23.737199
2014-07-04T06:35:16
2014-07-04T06:35:16
19,488,341
0
0
null
null
null
null
UTF-8
Java
false
false
2,775
java
package kimble.graphic.pickingray; import kimble.graphic.Screen; import kimble.graphic.camera.Camera3D; import org.lwjgl.util.vector.Matrix4f; import org.lwjgl.util.vector.Vector3f; import org.lwjgl.util.vector.Vector4f; /** * * @author Christoffer */ public class RayGenerator { public static Ray create(int mouseX, int mouseY, Camera3D camera) { float ndcX = ((float) mouseX / Screen.getWidth() - 0.5f) * 2.0f; float ndcY = ((float) mouseY / Screen.getHeight() - 0.5f) * 2.0f; Vector4f rayStartNDC = new Vector4f(); rayStartNDC.x = ndcX; rayStartNDC.y = ndcY; rayStartNDC.z = -1.0f; rayStartNDC.w = 1.0f; Vector4f rayEndNDC = new Vector4f(); rayEndNDC.x = ndcX; rayEndNDC.y = ndcY; rayEndNDC.z = 0.0f; rayEndNDC.w = 1.0f; // // from NDC space to Camera space // Matrix4f inverseProjectionMatrix = new Matrix4f(); // Matrix4f.invert(camera.getProjectionMatrix(), inverseProjectionMatrix); // // // from Camera space to World space // Matrix4f inverseViewMatrix = new Matrix4f(); // Matrix4f.invert(camera.getViewMatrix(), inverseViewMatrix); // // Vector4f rayStartCamera = assignAndNormalizeWithW(inverseProjectionMatrix, rayStartNDC); // Vector4f rayStartWorld = assignAndNormalizeWithW(inverseViewMatrix, rayStartCamera); // Vector4f rayEndCamera = assignAndNormalizeWithW(inverseProjectionMatrix, rayEndNDC); // Vector4f rayEndWorld = assignAndNormalizeWithW(inverseViewMatrix, rayEndCamera); // // faster way of doing the calculation above. Matrix4f inverseViewProjectionMatrix = new Matrix4f(); Matrix4f.invert(Matrix4f.mul(camera.getProjectionMatrix(), camera.getViewMatrix(), null), inverseViewProjectionMatrix); Vector4f rayStartWorld = assignAndNormalizeWithW(inverseViewProjectionMatrix, rayStartNDC); Vector4f rayEndWorld = assignAndNormalizeWithW(inverseViewProjectionMatrix, rayEndNDC); Vector4f tempDirectionWorld = new Vector4f(); Vector4f.sub(rayEndWorld, rayStartWorld, tempDirectionWorld); Vector3f rayDirectionWorld = new Vector3f(tempDirectionWorld); rayDirectionWorld.normalise(); return new Ray(new Vector3f(rayStartWorld), rayDirectionWorld); } private static Vector4f assignAndNormalizeWithW(Matrix4f matrix, Vector4f vector) { Vector4f result = new Vector4f(); Matrix4f.transform(matrix, vector, result); result.x /= result.w; result.y /= result.w; result.z /= result.w; result.w /= result.w; return result; } }
[ "christoffer.fridlund@hotmail.com" ]
christoffer.fridlund@hotmail.com
ae6fb1ad3633280798882305c23b182c55813e52
c75c8a2ab61582818cb98645b2df09807fd65835
/src/test/java/br/com/elo/service/MensagemISO8583ServiceTest.java
0ba16337667db565b1e7f5a0eb8d2a71e9475c36
[]
no_license
danilomeneghel/api-simulador-elo
3900206e567b50ae0820645f94f28d03d198cbd6
fe29b2a9c936dd5e5a1962c3458715230c6cb71c
refs/heads/main
2023-06-20T12:49:30.667897
2021-07-13T22:28:19
2021-07-13T22:28:19
360,266,986
0
0
null
null
null
null
UTF-8
Java
false
false
15,814
java
package br.com.elo.service; import br.com.elo.common.exception.ObjectNotFoundException; import br.com.elo.common.exception.ParametroInvalidoException; import br.com.elo.controller.util.DadosMockUtil; import br.com.elo.domain.*; import br.com.elo.domain.dto.request.*; import br.com.elo.domain.dto.response.MensagemISO8583ResponseDTO; import br.com.elo.model.BitMensagem; import br.com.elo.model.LayoutBitsProtocolo; import br.com.elo.model.MensagemISO8583; import br.com.elo.model.Protocolo; import br.com.elo.repository.MensagemISO8583Repository; import br.com.elo.repository.ProtocoloRepository; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.modelmapper.ModelMapper; import org.modelmapper.TypeToken; import org.springframework.data.domain.Example; import org.springframework.data.domain.ExampleMatcher; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.ArrayList; import java.util.List; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; @ExtendWith(MockitoExtension.class) @ExtendWith(SpringExtension.class) public class MensagemISO8583ServiceTest { @Mock private ModelMapper modelMapper; @InjectMocks private MensagemISO8583Service service; @Mock private SequencesGeneratorService sequenceGenerator; @Mock MensagemISO8583Repository repository; @Mock ProtocoloRepository protocoloRepository; private MensagemISO8583RequestDTO mensagemISO8583RequestDTO = DadosMockUtil.criaNovaMensagemISO8583RequestDTO(); private MensagemISO8583 mensagemISO8583 = DadosMockUtil.criaNovaMensagemISO8583(); private MensagemISO8583 mensagemISO8583Salva = DadosMockUtil.mensagemISO8583Salva(); private MensagemISO8583ResponseDTO mensagemISO8583Response = DadosMockUtil.mensagemISO8583ResponseDTO(); private MensagemISO8583RequestCriteriaDTO mensagemISO8583RequestCriteriaDTO = DadosMockUtil.criaNovaMensagemISO8583RequestCriteriaDTO(); private Protocolo protocoloSalvoMock = DadosMockUtil.protocoloSalvo(); @Test public void saveTest(){ Long codigoSequence = 1L; MensagemISO8583RequestDTO mensagemISO8583RequestMock = mensagemISO8583RequestDTO; mensagemISO8583RequestMock.setBitsMensagem(new ArrayList<>()); MensagemISO8583 mensagemISO8583Mock = mensagemISO8583; mensagemISO8583Mock.setBitsMensagem(new ArrayList<>()); Mockito.when(modelMapper.map(mensagemISO8583RequestMock, MensagemISO8583.class)).thenReturn(mensagemISO8583Mock); Mockito.when( protocoloRepository.existsByProtocoloSequence(mensagemISO8583Mock.getProtocoloSequence()) ).thenReturn(true); protocoloSalvoMock.setBitsProtocolo(new ArrayList<>()); Mockito.when( protocoloRepository.findByProtocoloSequence(codigoSequence) ).thenReturn(protocoloSalvoMock); Mockito.when( sequenceGenerator.generateSequence(MensagemISO8583.SEQUENCE_NAME)).thenReturn(codigoSequence); MensagemISO8583 mensagemISO8583SalvoMock = mensagemISO8583Salva; Mockito.when( repository.save(mensagemISO8583Mock) ).thenReturn(mensagemISO8583SalvoMock); MensagemISO8583ResponseDTO mensagemISO8583ResponseSalvoMock = mensagemISO8583Response; Mockito.when(modelMapper.map(mensagemISO8583SalvoMock, MensagemISO8583ResponseDTO.class)).thenReturn(mensagemISO8583ResponseSalvoMock); //Execução MensagemISO8583ResponseDTO mensagemISO8583ResponseSalvo = service.save(mensagemISO8583RequestMock); //verificação assertThat(mensagemISO8583ResponseSalvo.getId()).isNotNull(); assertThat(mensagemISO8583ResponseSalvo.getMensagemSequence()).isNotNull(); } @Test public void updateTest(){ Long codigoSequence = 1L; MensagemISO8583RequestDTO mensagemISO8583RequestMock = mensagemISO8583RequestDTO; mensagemISO8583RequestMock.setBitsMensagem(new ArrayList<>()); MensagemISO8583 mensagemISO8583Mock = mensagemISO8583; mensagemISO8583Mock.setBitsMensagem(new ArrayList<>()); Mockito.when(modelMapper.map(mensagemISO8583RequestMock, MensagemISO8583.class)).thenReturn(mensagemISO8583Mock); Mockito.when( protocoloRepository.existsByProtocoloSequence(mensagemISO8583Mock.getProtocoloSequence()) ).thenReturn(true); MensagemISO8583 mensagemISO8583SalvoMock = mensagemISO8583Salva; Mockito.when( repository.findByMensagemSequence(codigoSequence) ).thenReturn(mensagemISO8583SalvoMock); protocoloSalvoMock.setBitsProtocolo(new ArrayList<>()); Mockito.when( protocoloRepository.findByProtocoloSequence(codigoSequence) ).thenReturn(protocoloSalvoMock); Mockito.when( repository.findByMensagemSequence(codigoSequence) ).thenReturn(mensagemISO8583Mock); Mockito.when( repository.save(mensagemISO8583Mock) ).thenReturn(mensagemISO8583SalvoMock); MensagemISO8583ResponseDTO mensagemISO8583ResponseSalvoMock = mensagemISO8583Response; Mockito.when(modelMapper.map(mensagemISO8583SalvoMock, MensagemISO8583ResponseDTO.class)).thenReturn(mensagemISO8583ResponseSalvoMock); //Execução MensagemISO8583ResponseDTO mensagemISO8583ResponseSalva = service.update(codigoSequence,mensagemISO8583RequestMock); //verificação assertThat(mensagemISO8583ResponseSalva.getId()).isNotNull(); assertThat(mensagemISO8583ResponseSalva.getMensagemSequence()).isNotNull(); } @Test public void updateCodigoInvalidoTest(){ Long codigoSequence = 0L; MensagemISO8583RequestDTO mensagemISO8583RequestMock = mensagemISO8583RequestDTO; mensagemISO8583RequestMock.setBitsMensagem(new ArrayList<>()); MensagemISO8583 mensagemISO8583Mock = mensagemISO8583; Mockito.when(modelMapper.map(mensagemISO8583RequestMock, MensagemISO8583.class)).thenReturn(mensagemISO8583Mock); Exception exception = assertThrows(ParametroInvalidoException.class, () -> { service.update(codigoSequence, mensagemISO8583RequestMock); }); String expectedMessage = MensagensRetorno.BAD_REQUEST.getDescricao(); String actualMessage = exception.getMessage(); assertThat(actualMessage).isEqualTo(expectedMessage); } @Test public void updateMensagemISO8583InexistenteTest(){ Long codigoSequence = 1L; MensagemISO8583RequestDTO mensagemISO8583RequestMock = mensagemISO8583RequestDTO; mensagemISO8583RequestMock.setBitsMensagem(new ArrayList<>()); MensagemISO8583 mensagemISO8583Mock = mensagemISO8583; Mockito.when(modelMapper.map(mensagemISO8583RequestMock, MensagemISO8583.class)).thenReturn(mensagemISO8583Mock); Mockito.when( protocoloRepository.existsByProtocoloSequence(mensagemISO8583Mock.getProtocoloSequence()) ).thenReturn(true); Mockito.when( repository.findByMensagemSequence(codigoSequence) ).thenReturn(null); Exception exception = assertThrows(ObjectNotFoundException.class, () -> { service.update(codigoSequence, mensagemISO8583RequestMock); }); String expectedMessage = MensagensRetorno.MENSAGEM_NAO_LOCALIZADA.getDescricao(); String actualMessage = exception.getMessage(); assertThat(actualMessage).isEqualTo(expectedMessage); } @Test public void validaNroBitTest(){ MensagemISO8583 mensagemISO8583RequestMock = mensagemISO8583; BitMensagem nroBitExistente = BitMensagem.builder().numeroDoBit(2).build(); List<BitMensagem> listaCampos = new ArrayList<>(); listaCampos.add(nroBitExistente); LayoutBitsProtocolo numeroBit = LayoutBitsProtocolo.builder().numeroDoBit(2).build(); List<LayoutBitsProtocolo> listaCamposLayout = new ArrayList<>(); listaCamposLayout.add(numeroBit); protocoloSalvoMock.setBitsProtocolo(listaCamposLayout); Mockito.when( protocoloRepository.findNroBitByProtocoloSequence(1L,nroBitExistente.getNumeroDoBit()) ).thenReturn(protocoloSalvoMock); mensagemISO8583RequestMock.setBitsMensagem(listaCampos); assertThat(service.validarPresencaBitProtocolo(1L,nroBitExistente.getNumeroDoBit())).isTrue(); Mockito.when( protocoloRepository.findNroBitByProtocoloSequence(1L,nroBitExistente.getNumeroDoBit()) ).thenReturn(null); mensagemISO8583RequestMock.setBitsMensagem(listaCampos); assertThat(service.validarPresencaBitProtocolo(1L,nroBitExistente.getNumeroDoBit())).isFalse(); protocoloSalvoMock.getBitsProtocolo().clear(); protocoloSalvoMock.setBitsProtocolo(null); Mockito.when( protocoloRepository.findNroBitByProtocoloSequence(1L,nroBitExistente.getNumeroDoBit()) ).thenReturn(null); mensagemISO8583RequestMock.setBitsMensagem(listaCampos); assertThat(service.validarPresencaBitProtocolo(1L,nroBitExistente.getNumeroDoBit())).isFalse(); } @Test public void validaNrosBitsTest(){ MensagemISO8583 mensagemISO8583RequestMock = mensagemISO8583; BitMensagem nroBitExistente = BitMensagem.builder().numeroDoBit(2).build(); List<BitMensagem> listaCampos = new ArrayList<>(); listaCampos.add(nroBitExistente); mensagemISO8583RequestMock.setBitsMensagem(listaCampos); LayoutBitsProtocolo numeroBit = LayoutBitsProtocolo.builder().numeroDoBit(2).build(); List<LayoutBitsProtocolo> listaCamposLayout = new ArrayList<>(); listaCamposLayout.add(numeroBit); protocoloSalvoMock.setBitsProtocolo(listaCamposLayout); Mockito.when( protocoloRepository.findNroBitByProtocoloSequence(1L,nroBitExistente.getNumeroDoBit()) ).thenReturn(protocoloSalvoMock); mensagemISO8583RequestMock.setBitsMensagem(listaCampos); service.validarPresencaBitsProtocolo(1L,mensagemISO8583RequestMock.getBitsMensagem()); protocoloSalvoMock.getBitsProtocolo().clear(); protocoloSalvoMock.setBitsProtocolo(null); Mockito.when( protocoloRepository.findNroBitByProtocoloSequence(1L,nroBitExistente.getNumeroDoBit()) ).thenReturn(protocoloSalvoMock); Exception exception = assertThrows(ParametroInvalidoException.class, () -> { service.validarPresencaBitsProtocolo(1L,mensagemISO8583RequestMock.getBitsMensagem()); }); String expectedMessage = MensagensRetorno.BAD_REQUEST.getDescricao()+ " " + "Bit número 2 não cadastrado no protocolo"; String actualMessage = exception.getMessage(); assertThat(actualMessage).isEqualTo(expectedMessage); } @Test public void preencherDescricaoBitTest() { MensagemISO8583 mensagemISO8583Mock = mensagemISO8583; BitMensagem nroBitExistente = BitMensagem.builder().numeroDoBit(2).build(); List<BitMensagem> listaCampos = new ArrayList<>(); listaCampos.add(nroBitExistente); mensagemISO8583Mock.setBitsMensagem(listaCampos); LayoutBitsProtocolo numeroBit = LayoutBitsProtocolo.builder().numeroDoBit(2).descricao("Cartao Digitado").build(); List<LayoutBitsProtocolo> listaCamposLayout = new ArrayList<>(); listaCamposLayout.add(numeroBit); protocoloSalvoMock.setBitsProtocolo(listaCamposLayout); service.preencherDescricaoBitsMensagemProtocolo(mensagemISO8583Mock.getBitsMensagem(),protocoloSalvoMock.getBitsProtocolo()); assertThat(listaCampos.get(0).getDescricao()).isEqualTo(protocoloSalvoMock.getBitsProtocolo().get(0).getDescricao()); } @Test public void findByIdTest(){ Long codigoSequence = 1L; MensagemISO8583RequestDTO mensagemRequestMock = mensagemISO8583RequestDTO; MensagemISO8583 mensagemISO8583SalvaMock = mensagemISO8583Salva; Mockito.when( repository.findById("5feb955b37b9fb7770ec3155")).thenReturn(Optional.ofNullable(mensagemISO8583SalvaMock)); MensagemISO8583ResponseDTO mensagemResponseSalvoMock = mensagemISO8583Response; Mockito.when(modelMapper.map(mensagemISO8583SalvaMock, MensagemISO8583ResponseDTO.class)).thenReturn(mensagemResponseSalvoMock); //Execução MensagemISO8583ResponseDTO mensagemResponse = service.findById("5feb955b37b9fb7770ec3155"); //verificação assertThat(mensagemResponse.getId()).isEqualTo("5feb955b37b9fb7770ec3155"); } @Test public void notFoundByIdTest(){ Mockito.when(repository.findById("5feb955b37b9fb7770ec3155") ).thenReturn(Optional.empty()); Exception exception = assertThrows(ObjectNotFoundException.class, () -> { service.findById("5feb955b37b9fb7770ec3155"); }); String expectedMessage = MensagensRetorno.MENSAGEM_NAO_LOCALIZADA.getDescricao(); String actualMessage = exception.getMessage(); assertThat(actualMessage.contains(expectedMessage)); } @Test public void findByCodigoTest(){ Long codigoSequence = 1L; MensagemISO8583RequestDTO mensagemRequestMock = mensagemISO8583RequestDTO; MensagemISO8583 mensagemISO8583SalvaMock = mensagemISO8583Salva; Mockito.when( repository.findByMensagemSequence(codigoSequence) ).thenReturn(mensagemISO8583SalvaMock); MensagemISO8583ResponseDTO mensagemResponseSalvoMock = mensagemISO8583Response; Mockito.when(modelMapper.map(mensagemISO8583SalvaMock, MensagemISO8583ResponseDTO.class)).thenReturn(mensagemResponseSalvoMock); //Execução MensagemISO8583ResponseDTO mensagemResponse = service.findByMensagemSequence(codigoSequence); //verificação assertThat(mensagemResponse.getMensagemSequence()).isEqualTo(1L); } @Test public void notFoundByCodigoTest(){ Mockito.when(repository.findByMensagemSequence(1L) ).thenReturn(null); Exception exception = assertThrows(ObjectNotFoundException.class, () -> { service.findByMensagemSequence(1L); }); String expectedMessage = MensagensRetorno.MENSAGEM_NAO_LOCALIZADA.getDescricao(); String actualMessage = exception.getMessage(); assertThat(actualMessage).isEqualTo(expectedMessage); } @Test public void findAllTest(){ MensagemISO8583RequestCriteriaDTO mensagemISORequestCriteriaMock = mensagemISO8583RequestCriteriaDTO; MensagemISO8583 mensagemISO8583Mock = new MensagemISO8583(); List<MensagemISO8583> listaBuscaMensagem = new ArrayList<>(); listaBuscaMensagem.add(mensagemISO8583Mock); ExampleMatcher matcher = ExampleMatcher.matching() .withIgnoreCase() .withStringMatcher(ExampleMatcher.StringMatcher.STARTING); Example<MensagemISO8583> mensagemISO8583Example = Example.of(mensagemISO8583Mock, matcher); List<MensagemISO8583ResponseDTO> listaBuscaMensagemISO8583Response = new ArrayList<>(); listaBuscaMensagemISO8583Response.add(new MensagemISO8583ResponseDTO()); Mockito.when( modelMapper.map(mensagemISORequestCriteriaMock, MensagemISO8583.class)).thenReturn(mensagemISO8583Mock); Mockito.when( repository.findAll(mensagemISO8583Example)).thenReturn(listaBuscaMensagem); Mockito.when(modelMapper.map(listaBuscaMensagem, new TypeToken<List<MensagemISO8583ResponseDTO>>() {}.getType())).thenReturn(listaBuscaMensagemISO8583Response); //Execução List<MensagemISO8583ResponseDTO> mensagemResponseList = service.findAll(mensagemISORequestCriteriaMock); //verificação assertThat(mensagemResponseList.size()).isEqualTo(1); } }
[ "doliveira.vermont@alelo.com.br" ]
doliveira.vermont@alelo.com.br
7a962454e0f73425d37500c827174092237b633b
6a985faadeac1f3ef7b0a9ddcec7728a99783a79
/Revision1/src/chapter4/VarArgsEncapsulation.java
6c35d69cfe4f4bc82f0c6b64808ce595b8134de3
[]
no_license
BenDeegan/Java
0dfa13b582fd7a486a30ba80e3a13f3b7e7f4e32
d046b884829febee537d01adf1649810cb2a2dbd
refs/heads/master
2021-01-21T12:19:59.915987
2017-11-14T14:22:24
2017-11-14T14:22:24
91,786,681
0
0
null
null
null
null
UTF-8
Java
false
false
669
java
package chapter4; public class VarArgsEncapsulation { /* * ... means a variable length array. * You can pass in - no parameters * - one parameter * - two parameters * -three parameters * -an array * * */ public static void main(String... args) { printArray(); // no parameters printArray(65); printArray(12,23); printArray(1,2,3); printArray(new int[]{2,4,6}); } static void printArray(int... nums){ //System.out.println(nums[0]); //might cause an array Index out of bounds } // Only one paramter can be VarArgs and must be last static void print(String name, int... nums){ } }
[ "ben.e.deegan@gmail.com" ]
ben.e.deegan@gmail.com
126b29d70dfd54f7146a1e95ed215386bf73e06e
38c6e3cb1de37dda61e854b762233b7d4ed39e9f
/extend/org/adempiere/apps/graph/PAPanel.java
f44464e32fc44e8b2fd7c011efe3f068b4c5aea9
[]
no_license
agalemiri/customizacion380OFB
62f9dafb55c90126dc0157b661889cffe828f735
9cb28d677d01a6ff96895ed7b1ac70712659cb2d
refs/heads/master
2023-06-16T14:22:42.271774
2021-07-12T13:48:36
2021-07-12T13:48:36
385,280,607
0
0
null
null
null
null
UTF-8
Java
false
false
5,638
java
/****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ package org.adempiere.apps.graph; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Box; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import org.compiere.model.MGoal; import org.compiere.swing.CPanel; import org.compiere.util.CLogger; import org.compiere.util.Env; /** * Performance Analysis Panel. * Key Performace Indicators * * @author Jorg Janke * @version $Id: PAPanel.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $ */ public class PAPanel extends CPanel implements ActionListener { /** * */ private static final long serialVersionUID = 4937417260772233929L; /** * Get Panel if User has Perfpormance Goals * @return panel pr null */ public static PAPanel get() { int AD_User_ID = Env.getAD_User_ID(Env.getCtx()); MGoal[] goals = MGoal.getUserGoals(Env.getCtx(), AD_User_ID); if (goals.length == 0) return null; return new PAPanel(goals); } // get /************************************************************************** * Constructor * @param goals */ private PAPanel (MGoal[] goals) { super (); m_goals = goals; init(); } // PAPanel /** Goals */ private MGoal[] m_goals = null; /** Logger */ private static CLogger log = CLogger.getCLogger (PAPanel.class); /** * Static/Dynamic Init */ private void init() { /* BOXES: * * boxV Header * ******** * boxH * * boxH * * * * * boxV1 * boxV2 * * * * * * * boxV1 dial1 * ******** * dial2 * * boxV2 HTML * ******** * boxH1 * * boxH1 * * * * * bar1 * bar2 * * * * * * * * V1 + HTML in scrollpane */ this.setLayout(new BorderLayout()); // HEADER Box boxV = Box.createVerticalBox(); // DIALS/HTML+Bars Box boxH = Box.createHorizontalBox(); // DIALS Box boxV1 = Box.createVerticalBox(); // HTML/Bars Box boxV2 = Box.createVerticalBox(); // barChart Box boxH1 = Box.createHorizontalBox(); //boxH_V.setPreferredSize(new Dimension(180, 1500)); //boxH1.setPreferredSize(new Dimension(400, 180)); boxV2.setPreferredSize(new Dimension(120, 120)); // DIALS below HEADER, LEFT for (int i = 0; i < m_goals.length; i++) { PerformanceIndicator pi = new PerformanceIndicator(m_goals[i]); pi.addActionListener(this); boxV1.add (pi, BorderLayout.NORTH); } boxV1.add(Box.createVerticalGlue(), BorderLayout.CENTER); JScrollPane scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.getViewport().add(boxV1, BorderLayout.CENTER ); scrollPane.setMinimumSize(new Dimension(190, 180)); // RIGHT, HTML + Bars HtmlDashboard contentHtml = new HtmlDashboard("http:///local/home", m_goals, true); boxV2.add(contentHtml, BorderLayout.CENTER); for (int i = 0; i < java.lang.Math.min(2, m_goals.length); i++) { if (m_goals[i].getMeasure() != null) //MGoal goal = pi.getGoal(); boxH1.add ( new Graph(m_goals[i]), BorderLayout.SOUTH); } boxV2.add(boxH1, BorderLayout.SOUTH); // below HEADER boxH.add(scrollPane, BorderLayout.WEST ); boxH.add(Box.createHorizontalStrut(5)); //space boxH.add(boxV2, BorderLayout.CENTER); // HEADER + below HtmlDashboard t = new HtmlDashboard("http:///local/logo", null, false); t.setMaximumSize(new Dimension(2000,80)); //t.setPreferredSize(new Dimension(200,10)); //t.setMaximumSize(new Dimension(2000,10)); boxV.add(t, BorderLayout.NORTH); boxV.add(Box.createVerticalStrut(5)); //space boxV.add(boxH, BorderLayout.CENTER); boxV.add(Box.createVerticalGlue()); // WINDOW add(boxV, BorderLayout.CENTER); } // init /** * Action Listener for Drill Down * @param e event */ public void actionPerformed (ActionEvent e) { if (e.getSource() instanceof PerformanceIndicator) { PerformanceIndicator pi = (PerformanceIndicator)e.getSource(); log.info(pi.getName()); MGoal goal = pi.getGoal(); if (goal.getMeasure() != null) new PerformanceDetail(goal); } } // actionPerformed } // PAPanel
[ "agalemiri@comercialwindsor.cl" ]
agalemiri@comercialwindsor.cl
529088f7bd73700e018fd5397b2b3acdbe42b946
faf55adee6ebf064d1abd4c0a1c7ee72126c2caa
/trunk/zhikebao/src/com/xyz/system/dao/AuthorityDao.java
de1ad9e118f67faf28397173f22f571ef15faf37
[]
no_license
BGCX261/zhikebao-ecom-svn-to-git
48ebb95d1e5883b9991ee116482eb556cd320c64
33616de5a809b7dd6f2c2cc98784b04004eef996
refs/heads/master
2019-01-20T12:40:43.882941
2015-08-25T15:28:09
2015-08-25T15:28:09
42,322,786
1
2
null
null
null
null
UTF-8
Java
false
false
1,058
java
package com.xyz.system.dao; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.stereotype.Repository; import org.springframework.util.Assert; import com.xyz.framework.data.impl.JpaDao; import com.xyz.system.model.Authority; @Repository public class AuthorityDao extends JpaDao<Authority, Integer> { public List<Authority> findAuthsByKeys(Set<String> keys) { Assert.notEmpty(keys, "没有关联主键"); List<Authority> userAuths = new ArrayList<Authority>(); List<Authority> la= getAllAuths(); Map<String,Authority> ms = new HashMap<String,Authority>(); for(int i=0;i<la.size();i++) { Authority a = la.get(i); ms.put(a.getPid().toString(), a); } for(String k : keys) { Authority a = ms.get(k); userAuths.add(a); } return userAuths; } /** * 获取全部对象. */ public List<Authority> getAllAuths() { return find(" from "+Authority.class.getName()+ " a "); } }
[ "you@example.com" ]
you@example.com
37e306746ad7cbe56a381d467934f98d27dc8e1d
c8b6b38cfb9eaf467bf8420e9108fa57b6bf1019
/app/src/main/java/fxtrader/com/app/entity/ContractInfoEntity.java
b452758504e3542b880df73a6ac8d3964b67259a
[]
no_license
zyzbsh/fx
f6b3de621a8984bdb86347ae3558cb5bd8b8edef
544286a9c2959742c5e8b6bed57da0334363be99
refs/heads/master
2021-01-13T07:40:32.351140
2017-04-17T18:36:40
2017-04-17T18:36:40
76,231,451
0
0
null
null
null
null
UTF-8
Java
false
false
4,203
java
package fxtrader.com.app.entity; import android.text.TextUtils; import java.io.Serializable; import fxtrader.com.app.http.HttpConstant; /** * Created by zhangyuzhu on 2016/12/9. */ public class ContractInfoEntity implements Serializable{ /** * code : AG01 * dataType : AG * dealLimit : 10 * handingCharge : 0.8 * margin : 8 * name : 0.1kg白银 * plRate : 0.1 * plUnit : 1 * profitAndLoss": 0.3, " queryParam": "YDHF", * specification : 8 * unit : 8?/? */ private String code; private String dataType; private int dealLimit; private double handingCharge; private double originalHandingCharge; private int margin; private String name; private double plRate; private double plUnit; private String specification; private String unit; private String baseUnit = ""; private String baseNum = ""; private double profitAndLoss; private String queryParam = ""; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getDataType() { return dataType; } public void setDataType(String dataType) { this.dataType = dataType; } public int getDealLimit() { return dealLimit; } public void setDealLimit(int dealLimit) { this.dealLimit = dealLimit; } public double getHandingCharge() { return handingCharge; } public void setHandingCharge(double handingCharge) { this.handingCharge = handingCharge; } public int getMargin() { return margin; } public void setMargin(int margin) { this.margin = margin; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getPlRate() { return plRate; } public void setPlRate(double plRate) { this.plRate = plRate; } public double getPlUnit() { return plUnit; } public void setPlUnit(double plUnit) { this.plUnit = plUnit; } public String getSpecification() { return specification; } public void setSpecification(String specification) { this.specification = specification; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public String getBaseUnit() { return baseUnit; } public void setBaseUnit(String baseUnit) { this.baseUnit = baseUnit; } public String getBaseNum() { return baseNum; } public void setBaseNum(String baseNum) { this.baseNum = baseNum; } public String getQueryParam() { return queryParam; } public void setQueryParam(String queryParam) { this.queryParam = queryParam; } public double getProfitAndLoss() { return profitAndLoss; } public void setProfitAndLoss(double profitAndLoss) { this.profitAndLoss = profitAndLoss; } public double getOriginalHandingCharge() { return originalHandingCharge; } public void setOriginalHandingCharge(double originalHandingCharge) { this.originalHandingCharge = originalHandingCharge; } @Override public String toString() { return "ContractInfoEntity{" + "code='" + code + '\'' + ", dataType='" + dataType + '\'' + ", dealLimit=" + dealLimit + ", handingCharge=" + handingCharge + ", originalHandingCharge=" + originalHandingCharge + ", margin=" + margin + ", name='" + name + '\'' + ", plRate=" + plRate + ", plUnit=" + plUnit + ", specification='" + specification + '\'' + ", unit='" + unit + '\'' + ", baseUnit='" + baseUnit + '\'' + ", baseNum='" + baseNum + '\'' + ", profitAndLoss=" + profitAndLoss + ", queryParam='" + queryParam + '\'' + '}'; } }
[ "zyzbsh@163.com" ]
zyzbsh@163.com
32be2b2f8799fd723fd0f6747e6becd386e4df86
d24de9be4c3993d9dc726e9a3c74d9662c470226
/reverse/Rocketbank_All_3.12.4_source_from_JADX/sources/ru/rocketbank/core/model/CardData.java
50ddd9d2553c26b7775b7396bdd124225b742798
[]
no_license
MEJIOMAH17/rocketbank-api
b18808ee4a2fdddd8b3045cd16655b0d82e0b13b
fc4eb0cbb4a8f52277fdb09a3b26b4cceef6ff79
refs/heads/master
2022-07-17T20:24:29.721131
2019-07-26T18:55:21
2019-07-26T18:55:21
198,698,231
4
0
null
2022-06-20T22:43:15
2019-07-24T19:31:49
Smali
UTF-8
Java
false
false
4,270
java
package ru.rocketbank.core.model; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; import kotlin.jvm.internal.Intrinsics; /* compiled from: CardData.kt */ public final class CardData implements Parcelable { public static final Creator<CardData> CREATOR = new CardData$$special$$inlined$createParcel$1(); public static final Companion Companion = new Companion(); private final String cvv; private final String expirationDate; private final String pan; /* compiled from: CardData.kt */ public static final class Companion { private Companion() { } } public static /* bridge */ /* synthetic */ CardData copy$default(CardData cardData, String str, String str2, String str3, int i, Object obj) { if ((i & 1) != 0) { str = cardData.pan; } if ((i & 2) != 0) { str2 = cardData.expirationDate; } if ((i & 4) != 0) { str3 = cardData.cvv; } return cardData.copy(str, str2, str3); } public final String component1() { return this.pan; } public final String component2() { return this.expirationDate; } public final String component3() { return this.cvv; } public final CardData copy(String str, String str2, String str3) { Intrinsics.checkParameterIsNotNull(str, "pan"); Intrinsics.checkParameterIsNotNull(str2, "expirationDate"); Intrinsics.checkParameterIsNotNull(str3, "cvv"); return new CardData(str, str2, str3); } public final int describeContents() { return 0; } public final boolean equals(Object obj) { if (this != obj) { if (obj instanceof CardData) { CardData cardData = (CardData) obj; if (Intrinsics.areEqual(this.pan, cardData.pan) && Intrinsics.areEqual(this.expirationDate, cardData.expirationDate) && Intrinsics.areEqual(this.cvv, cardData.cvv)) { } } return false; } return true; } public final int hashCode() { String str = this.pan; int i = 0; int hashCode = (str != null ? str.hashCode() : 0) * 31; String str2 = this.expirationDate; hashCode = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31; str2 = this.cvv; if (str2 != null) { i = str2.hashCode(); } return hashCode + i; } public final String toString() { StringBuilder stringBuilder = new StringBuilder("CardData(pan="); stringBuilder.append(this.pan); stringBuilder.append(", expirationDate="); stringBuilder.append(this.expirationDate); stringBuilder.append(", cvv="); stringBuilder.append(this.cvv); stringBuilder.append(")"); return stringBuilder.toString(); } public CardData(String str, String str2, String str3) { Intrinsics.checkParameterIsNotNull(str, "pan"); Intrinsics.checkParameterIsNotNull(str2, "expirationDate"); Intrinsics.checkParameterIsNotNull(str3, "cvv"); this.pan = str; this.expirationDate = str2; this.cvv = str3; } public final String getPan() { return this.pan; } public final String getExpirationDate() { return this.expirationDate; } public final String getCvv() { return this.cvv; } public CardData(Parcel parcel) { Intrinsics.checkParameterIsNotNull(parcel, "parcel"); String readString = parcel.readString(); Intrinsics.checkExpressionValueIsNotNull(readString, "parcel.readString()"); String readString2 = parcel.readString(); Intrinsics.checkExpressionValueIsNotNull(readString2, "parcel.readString()"); parcel = parcel.readString(); Intrinsics.checkExpressionValueIsNotNull(parcel, "parcel.readString()"); this(readString, readString2, parcel); } public final void writeToParcel(Parcel parcel, int i) { if (parcel != null) { parcel.writeString(this.pan); parcel.writeString(this.expirationDate); parcel.writeString(this.cvv); } } }
[ "mekosichkin.ru" ]
mekosichkin.ru
8c1794a3733d6380aab4d4de7f1de60d3acfa8e2
18308c0bb7d687c1b178de95388ef6c9cfe7caff
/src/aktie/gui/SubscriptionDialog.java
51d846d6c403fb5679bece810c3b4c843d09435f
[]
no_license
freshy969/Aktie
2c6414f52805eb2809edf70d70daf4673cea0ac9
ee88490d1e484fc215fc8ea4bac32e40e1bcc639
refs/heads/master
2020-05-24T18:54:49.043202
2017-11-23T23:29:20
2017-11-23T23:29:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,265
java
package aktie.gui; import java.io.IOException; import aktie.data.CObj; import aktie.gui.table.AktieTableViewerColumn; import aktie.gui.table.CObjListTable; import aktie.gui.table.CObjListTableCellLabelProviderTypeDisplayName; import aktie.gui.table.CObjListTableInputProvider; import aktie.gui.table.CObjListTableCellLabelProviderTypeString; import aktie.gui.table.CObjListTableContentProviderTypeArrayElement; import aktie.index.CObjList; import org.apache.lucene.search.Sort; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.layout.RowLayout; public class SubscriptionDialog extends Dialog { private Text text; private SubscriptionTable table; private SWTApp app; private Button btnShowPublic; private Button btnShowPrivate; /** Create the dialog. @param parentShell */ public SubscriptionDialog ( Shell parentShell, SWTApp app ) { super ( parentShell ); setShellStyle ( getShellStyle() | SWT.RESIZE ); this.app = app; } private void selectIdentity ( String id ) { if ( app != null && id != null && lblNewSubscriptionFor != null && !lblNewSubscriptionFor.isDisposed() ) { CObj ido = app.getNode().getIndex().getIdentity ( id ); lblNewSubscriptionFor.setText ( "New subscription for: " + ido.getDisplayName() ); } } private String selectedid; private Label lblNewSubscriptionFor; public void open ( String selid ) { selectedid = selid; selectIdentity ( selid ); defaultSearch(); super.open(); } @Override protected void configureShell ( Shell shell ) { super.configureShell ( shell ); shell.setText ( "Subscription" ); } private void doSearch ( String searchString, boolean searchPrivate, boolean searchPublic ) { table.setSearch ( searchString, selectedid, searchPrivate, searchPublic ); table.searchAndSort(); } private void defaultSearch() { if ( table != null && !table.isDisposed() ) { doSearch ( "", true, true ); } } private void doSearch() { boolean prv = btnShowPrivate.getSelection(); boolean pub = btnShowPublic.getSelection(); doSearch ( text.getText(), prv, pub ); } /** Create contents of the dialog. @param parent */ @Override protected Control createDialogArea ( Composite parent ) { Composite container = ( Composite ) super.createDialogArea ( parent ); container.setLayout ( new GridLayout ( 2, false ) ); lblNewSubscriptionFor = new Label ( container, SWT.NONE ); lblNewSubscriptionFor.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, false, false, 1, 1 ) ); lblNewSubscriptionFor.setText ( "New Subscription for:" ); new Label ( container, SWT.NONE ); text = new Text ( container, SWT.BORDER ); text.setLayoutData ( new GridData ( SWT.FILL, SWT.CENTER, true, false, 1, 1 ) ); text.addListener ( SWT.Traverse, new Listener() { @Override public void handleEvent ( Event event ) { if ( event.detail == SWT.TRAVERSE_RETURN ) { doSearch(); } } } ); Button btnSearch = new Button ( container, SWT.NONE ); btnSearch.setText ( "Search" ); btnSearch.addSelectionListener ( new SelectionListener() { @Override public void widgetSelected ( SelectionEvent e ) { doSearch(); } @Override public void widgetDefaultSelected ( SelectionEvent e ) { } } ); Composite composite = new Composite ( container, SWT.NONE ); composite.setLayout ( new RowLayout ( SWT.HORIZONTAL ) ); btnShowPublic = new Button ( composite, SWT.CHECK ); btnShowPublic.setText ( "Show public" ); btnShowPrivate = new Button ( composite, SWT.CHECK ); btnShowPrivate.setText ( "Show private" ); new Label ( container, SWT.NONE ); table = new SubscriptionTable ( container, this ); table.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true, 1, 1 ) ); defaultSearch(); if ( app != null ) { if ( selectedid != null ) { selectIdentity ( selectedid ); } } return container; } /** Create contents of the button bar. @param parent */ @Override protected void createButtonsForButtonBar ( Composite parent ) { createButton ( parent, IDialogConstants.OK_ID, "Subscribe", false ); createButton ( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false ); } @Override protected void cancelPressed() { CObjList clst = ( CObjList ) table.getTableViewer().getInput(); if ( clst != null ) { clst.close(); } super.cancelPressed(); } @Override protected void okPressed() { CObjList clst = ( CObjList ) table.getTableViewer().getInput(); if ( selectedid != null ) { String id = selectedid; if ( id != null ) { int idx[] = table.getSelectionIndices(); for ( int c = 0; c < idx.length; c++ ) { try { CObj com = clst.get ( idx[c] ); CObj co = new CObj(); co.setType ( CObj.SUBSCRIPTION ); co.pushString ( CObj.SUBSCRIBED, "true" ); co.pushString ( CObj.COMMUNITYID, com.getDig() ); co.pushString ( CObj.CREATOR, id ); if ( app != null ) { app.getNode().enqueue ( co ); } } catch ( IOException e ) { e.printStackTrace(); } } } } if ( clst != null ) { clst.close(); } super.okPressed(); } /** Return the initial size of the dialog. */ @Override protected Point getInitialSize() { return new Point ( 611, 300 ); } public Button getBtnShowPublic() { return btnShowPublic; } public Button getBtnShowPrivate() { return btnShowPrivate; } public Label getLblNewSubscriptionFor() { return lblNewSubscriptionFor; } private SWTApp getSWTApp() { return app; } private class SubscriptionTable extends CObjListTable<CObjListArrayElement> { public SubscriptionTable ( Composite composite, SubscriptionDialog dialog ) { super ( composite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL ); setContentProvider ( new CObjListTableContentProviderTypeArrayElement() ); setInputProvider ( new SubscriptionTableInputProvider ( dialog ) ); AktieTableViewerColumn<CObjList, CObjListGetter> column; column = addColumn ( "Community", 150, new CObjListTableCellLabelProviderTypeDisplayName ( true, null ) ); getTableViewer().setSortColumn ( column, false ); addColumn ( "Description", 300, new CObjListTableCellLabelProviderTypeString ( CObj.DESCRIPTION, true, null ) ); addColumn ( "Scope", 50, new CObjListTableCellLabelProviderTypeString ( CObj.SCOPE, false, null ) ); } @Override public SubscriptionTableInputProvider getInputProvider() { return ( SubscriptionTableInputProvider ) super.getInputProvider(); } public void setSearch ( String searchString, String selectedIdentity, boolean searchPrivate, boolean searchPublic ) { getInputProvider().setSearchString ( searchString ); getInputProvider().setSelectedIdentity ( selectedIdentity ); getInputProvider().setSearchPrivate ( searchPrivate ); getInputProvider().setSearchPublic ( searchPublic ); } } private class SubscriptionTableInputProvider extends CObjListTableInputProvider { private SubscriptionDialog dialog; private String searchString = ""; private String selectedIdentity = ""; private boolean searchPrivate = true; private boolean searchPublic = true; public SubscriptionTableInputProvider ( SubscriptionDialog dialog ) { this.dialog = dialog; } @Override public CObjList provideInput ( Sort sort ) { return dialog.getSWTApp().getNode().getIndex().searchSubscribable ( searchString, selectedIdentity, searchPrivate, searchPublic, sort ); } public void setSearchString ( String s ) { searchString = s; } public void setSelectedIdentity ( String id ) { selectedIdentity = id; } public void setSearchPrivate ( boolean b ) { searchPrivate = b; } public void setSearchPublic ( boolean b ) { searchPublic = b; } } }
[ "retsamknaps@hmamail.com" ]
retsamknaps@hmamail.com
2c10ad8269fae81a5b98d20f934551b8c82a0c03
b6f87604e30ba6ef3a7540861abf96578eac624e
/src/main/java/ch/g_7/graphite/rendering/ShaderProgram.java
8166757c2ec68755949c91e24e214e41c0376249
[]
no_license
Joeysciamanna/Graphite
80078ab26dcb64c2c59fe5d501221e0b40dc6148
c0f9d0f55c9841bc45cf10b9279e266d706990d0
refs/heads/master
2020-06-07T21:07:18.148484
2020-04-11T19:37:44
2020-04-11T19:37:44
193,092,257
0
0
null
2020-04-09T15:58:08
2019-06-21T12:13:45
Java
UTF-8
Java
false
false
5,088
java
package ch.g_7.graphite.rendering; import static org.lwjgl.opengl.GL20.GL_COMPILE_STATUS; import static org.lwjgl.opengl.GL20.GL_FRAGMENT_SHADER; import static org.lwjgl.opengl.GL20.GL_LINK_STATUS; import static org.lwjgl.opengl.GL20.GL_VALIDATE_STATUS; import static org.lwjgl.opengl.GL20.GL_VERTEX_SHADER; import static org.lwjgl.opengl.GL20.glAttachShader; import static org.lwjgl.opengl.GL20.glCompileShader; import static org.lwjgl.opengl.GL20.glCreateProgram; import static org.lwjgl.opengl.GL20.glCreateShader; import static org.lwjgl.opengl.GL20.glDeleteProgram; import static org.lwjgl.opengl.GL20.glDetachShader; import static org.lwjgl.opengl.GL20.glGetProgramInfoLog; import static org.lwjgl.opengl.GL20.glGetProgrami; import static org.lwjgl.opengl.GL20.glGetShaderInfoLog; import static org.lwjgl.opengl.GL20.glGetShaderi; import static org.lwjgl.opengl.GL20.glGetUniformLocation; import static org.lwjgl.opengl.GL20.glLinkProgram; import static org.lwjgl.opengl.GL20.glShaderSource; import static org.lwjgl.opengl.GL20.glUniform1i; import static org.lwjgl.opengl.GL20.glUniform2iv; import static org.lwjgl.opengl.GL20.glUniformMatrix4fv; import static org.lwjgl.opengl.GL20.glUseProgram; import static org.lwjgl.opengl.GL20.glValidateProgram; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.util.HashMap; import java.util.Map; import org.joml.Matrix4f; import org.joml.Vector2i; import org.joml.Vector4f; import org.lwjgl.opengl.GL20; import org.lwjgl.system.MemoryStack; import ch.g_7.util.common.Closeable; import ch.g_7.util.common.Initializable; public abstract class ShaderProgram implements Initializable, Closeable, IRenderResource { protected final Map<String, Integer> uniforms; private int programId; private int vertexShaderId; private int fragmentShaderId; private String vertexCode; private String fragmentCode; public ShaderProgram(String vertexCode, String fragmentCode) { this.vertexCode = vertexCode; this.fragmentCode = fragmentCode; uniforms = new HashMap<>(); } public void init() { programId = glCreateProgram(); if (programId == 0) { throw new RuntimeException("Could not create Shader"); } vertexShaderId = createShader(vertexCode, GL_VERTEX_SHADER); fragmentShaderId = createShader(fragmentCode, GL_FRAGMENT_SHADER); link(); vertexCode = null; fragmentCode = null; } public void close() { unbind(); if (programId != 0) { glDeleteProgram(programId); } } protected final void setUniform(String uniformName, Matrix4f value) { try (MemoryStack stack = MemoryStack.stackPush()) { // Dump the matrix into a float buffer FloatBuffer fb = stack.mallocFloat(16); value.get(fb); glUniformMatrix4fv(uniforms.get(uniformName), false, fb); } } protected final void setUniform(String uniformName, Vector2i value) { try (MemoryStack stack = MemoryStack.stackPush()) { // Dump the matrix into a float buffer IntBuffer ib = stack.mallocInt(2); value.get(ib); glUniform2iv(uniforms.get(uniformName), ib); } } protected final void setUniform(String uniformName, Vector4f value) { try (MemoryStack stack = MemoryStack.stackPush()) { // Dump the matrix into a float buffer FloatBuffer fb = stack.mallocFloat(4); value.get(fb); GL20.glUniform4fv(uniforms.get(uniformName), fb); } } protected final void setUniform(String uniformName, boolean value) { try (MemoryStack stack = MemoryStack.stackPush()) { // Dump the matrix into a float buffer GL20.glUniform1i(uniforms.get(uniformName), value ? 1 : 0); } } protected final void setUniform(String uniformName, int value) { glUniform1i(uniforms.get(uniformName), value); } protected final void createUniform(String uniformName) { int uniformLocation = glGetUniformLocation(programId, uniformName); if (uniformLocation < 0) { throw new RuntimeException("Could not find uniform:" + uniformName); } uniforms.put(uniformName, uniformLocation); } private int createShader(String shaderCode, int shaderType) { int shaderId = glCreateShader(shaderType); if (shaderId == 0) { throw new RuntimeException("Error creating shader. Type: " + shaderType); } glShaderSource(shaderId, shaderCode); glCompileShader(shaderId); if (glGetShaderi(shaderId, GL_COMPILE_STATUS) == 0) { throw new RuntimeException("Error compiling Shader code: " + glGetShaderInfoLog(shaderId, 1024)); } glAttachShader(programId, shaderId); return shaderId; } private void link() { glLinkProgram(programId); if (glGetProgrami(programId, GL_LINK_STATUS) == 0) { throw new RuntimeException("Error linking Shader code: " + glGetProgramInfoLog(programId, 1024)); } glDetachShader(programId, vertexShaderId); glDetachShader(programId, fragmentShaderId); glValidateProgram(programId); if (glGetProgrami(programId, GL_VALIDATE_STATUS) == 0) { System.err.println("Warning validating Shader code: " + glGetProgramInfoLog(programId, 1024)); } } public void bind() { glUseProgram(programId); } public void unbind() { glUseProgram(0); } }
[ "joeysciamanna@icloud.com" ]
joeysciamanna@icloud.com
1331fbe63a98008a2ce18aeb3a25bb68bfb3fb05
d422dea133ddfd2949041af603eb736511528844
/src/main/java/edu/vanderbilt/cs/live9/expr/state/find/FindFirstExprOpenState.java
423f51a9ab88afbabd567c9bedbbc94bd877afe8
[]
no_license
vu-5278-s21/track-1-assignment-6-acatalfano
9d24190b5dceb751d7c85c9fbfb8cdca05f2a351
6a25464f762521b1f9fe7729e0669db0fc3779aa
refs/heads/main
2023-03-26T23:57:34.801756
2021-04-01T02:24:47
2021-04-01T02:24:47
351,616,943
0
1
null
null
null
null
UTF-8
Java
false
false
1,491
java
package edu.vanderbilt.cs.live9.expr.state.find; import edu.vanderbilt.cs.live9.ast.LiteralNode; import edu.vanderbilt.cs.live9.ast.interpreter.ExpressionType; import edu.vanderbilt.cs.live9.ast.visitor.QueryVisitor; import edu.vanderbilt.cs.live9.expr.NearExpression; import edu.vanderbilt.cs.live9.expr.WhereExpression; import edu.vanderbilt.cs.live9.expr.state.OpenState; import edu.vanderbilt.cs.live9.expr.state.near.NearNoArgsState; import edu.vanderbilt.cs.live9.expr.state.where.WhereInitializedState; public class FindFirstExprOpenState implements FindState, OpenState { @Override public void literalNode(QueryVisitor<?> visitor, LiteralNode node) { ExpressionType type = node.interpret(); if (type == ExpressionType.WHERE) { whereTransition(visitor); } else if (type == ExpressionType.NEAR) { nearTransition(visitor); } else { throw new IllegalStateException("literalNode() called in illegal state"); } } private void whereTransition(QueryVisitor<?> visitor) { visitor.storeExpression(new WhereExpression<>()); visitor.queueState(new FindWithClosedWhereClauseState()); visitor.setState(new WhereInitializedState()); } private void nearTransition(QueryVisitor<?> visitor) { visitor.storeExpression(new NearExpression<>()); visitor.queueState(new FindWithClosedNearClauseState()); visitor.setState(new NearNoArgsState()); } }
[ "acatalfano@vanderbilt.edu" ]
acatalfano@vanderbilt.edu
219b0559ada408e6eaa184014d9966fae997f2af
7042d59562ebd69c7cfa982d9eeccb24fb10fa68
/Materias Obrigatorias/3º Semestre/COO - Computação Orientada a Objetos/Patricia/Códigos/Teste3.java
77931378199f4ae7fd1b7bd0143c4854a0e935dd
[]
no_license
ThallesRg/drivesi
fa79f894ae1ddbb563283fee9885e0b24e5c49d8
cd8462815949cb9fd4aa775138f48a4b7f8b0f04
refs/heads/master
2023-04-30T08:00:36.731137
2021-05-28T05:29:45
2021-05-28T05:29:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
import java.util.*; class Teste3{ static List <Integer> lista = new ArrayList <Integer>(); public static void main (String [] args){ Scanner sc= new Scanner (System.in); String frase=sc.nextLine(); String [] palavras = frase.split(" "); Map <String,Integer> contador = new HashMap <String,Integer>(); for (int a=0;a<palavras.length;a++){ int cont=0; if (contador.containsKey(palavras[a])){ contador.put (palavras[a],contador.get(palavras[a])+1); } else { contador.put (palavras[a], 1); } } System.out.println (contador); } }
[ "driveeach@gmail.com" ]
driveeach@gmail.com
1f2f6b71daf9b361b2bc22b6f5f4e24a6ddd8c01
ffc93724532ee421d1ba146412b5f4cd7b64e8e9
/mockito-2.18.6/src/main/java/org/mockito/internal/matchers/Find.java
22eba9ffb63e033d1a6d7be9bd10c10d2af69953
[ "MIT" ]
permissive
abalon1210/Mockito-PITest
996ef3a5049fded9fdaf108a263abe1cde3b9cc8
096791ef7852a0e3509c945d04b0519031a1bf2f
refs/heads/master
2020-03-19T01:33:58.798818
2018-05-31T08:34:05
2018-05-31T08:34:05
135,554,752
0
0
null
null
null
null
UTF-8
Java
false
false
678
java
/* * Copyright (c) 2007 Mockito contributors * This program is made available under the terms of the MIT License. */ package org.mockito.internal.matchers; import java.io.Serializable; import java.util.regex.Pattern; import org.mockito.main.ArgumentMatcher; public class Find implements ArgumentMatcher<String>, Serializable { private final String regex; public Find(String regex) { this.regex = regex; } public boolean matches(String actual) { return actual != null && Pattern.compile(regex).matcher(actual).find(); } public String toString() { return "find(\"" + regex.replaceAll("\\\\", "\\\\\\\\") + "\")"; } }
[ "abalon1210@daum.net" ]
abalon1210@daum.net
6d265fdc77c29e0969c566b6830357cc9bfbb04b
0b03242cbba244846255a6e8b1926f230611d8a6
/Golf Database/src/GolferData/PrintUtilities.java
8542f67eabccd1a37f7befc98503d957c5019d41
[]
no_license
youngbw/personal_projects
e958af705df2bdbefbba429ea3f93eeee7f94481
b2eb014ebd24a2ac3ec204b2c4de7b2b46b2cedc
refs/heads/master
2020-04-22T03:20:00.081146
2015-03-13T18:27:22
2015-03-13T18:27:22
30,309,790
0
0
null
null
null
null
UTF-8
Java
false
false
2,595
java
package GolferData; import java.awt.*; import javax.swing.*; import java.awt.print.*; /** A simple utility class that lets you very simply print * an arbitrary component. Just pass the component to the * PrintUtilities.printComponent. The component you want to * print doesn't need a print method and doesn't have to * implement any interface or do anything special at all. * <P> * If you are going to be printing many times, it is marginally more * efficient to first do the following: * <PRE> * PrintUtilities printHelper = new PrintUtilities(theComponent); * </PRE> * then later do printHelper.print(). But this is a very tiny * difference, so in most cases just do the simpler * PrintUtilities.printComponent(componentToBePrinted). * * 7/99 Marty Hall, http://www.apl.jhu.edu/~hall/java/ * May be freely used or adapted. */ public class PrintUtilities implements Printable { private Component componentToBePrinted; public static void printComponent(Component c) { new PrintUtilities(c).print(); } public PrintUtilities(Component componentToBePrinted) { this.componentToBePrinted = componentToBePrinted; } public void print() { PrinterJob printJob = PrinterJob.getPrinterJob(); printJob.setPrintable(this); if (printJob.printDialog()) try { printJob.print(); } catch(PrinterException pe) { System.out.println("Error printing: " + pe); } } public int print(Graphics g, PageFormat pageFormat, int pageIndex) { if (pageIndex > 0) { return(NO_SUCH_PAGE); } else { Graphics2D g2d = (Graphics2D)g; pageFormat.setOrientation(PageFormat.LANDSCAPE); g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); disableDoubleBuffering(componentToBePrinted); componentToBePrinted.paint(g2d); enableDoubleBuffering(componentToBePrinted); return(PAGE_EXISTS); } } /** The speed and quality of printing suffers dramatically if * any of the containers have double buffering turned on. * So this turns if off globally. * @see #enableDoubleBuffering(java.awt.Component) */ public static void disableDoubleBuffering(Component c) { RepaintManager currentManager = RepaintManager.currentManager(c); currentManager.setDoubleBufferingEnabled(false); } /** Re-enables double buffering globally. */ public static void enableDoubleBuffering(Component c) { RepaintManager currentManager = RepaintManager.currentManager(c); currentManager.setDoubleBufferingEnabled(true); } }
[ "Athero23@gmail.com" ]
Athero23@gmail.com
8157d7dc8ed5e95cb096923c546f735f983561e8
9a933539fde1296678fdc0beabbe1bf30626a9ad
/app/src/main/java/arey/es/tema2_ejercicios/Ejercicio13a.java
09610c470a59567409022f3dfb3f1dfe653dddea
[]
no_license
ireneyera/tema2_ejercicios
5fa3634680d0ea1419fa9f637b9add7a1a542f80
63bf6899ef14cc37a7b58e0663c2394f7a437906
refs/heads/master
2021-01-10T23:13:01.434980
2016-10-02T16:42:25
2016-10-02T16:42:25
69,727,522
0
0
null
null
null
null
UTF-8
Java
false
false
1,065
java
package arey.es.tema2_ejercicios; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class Ejercicio13a extends AppCompatActivity { private TextView aTextView; private String receivedURL; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ejercicio13a); aTextView = (TextView)findViewById(R.id.textView1Ej13); Intent receivedData = getIntent(); receivedURL = receivedData.getStringExtra(Ejercicio13.URL); aTextView.setText(receivedURL); } public void openWeb(View v) { Intent webIntent = new Intent(Intent.ACTION_VIEW); webIntent.setData(Uri.parse(receivedURL)); if (webIntent.resolveActivity(getPackageManager()) != null) { startActivity(webIntent); } } public void goBack(View v) { finish(); } }
[ "irene.yera@gmail.com" ]
irene.yera@gmail.com
d2d85977756e5206b965bbb5a11e9ecf4733605b
4ba3a51538e6e65e62593beb2c7a38b891c9e907
/ChichenItza/64_MinimumPathSum.java
a83d2a9100f37f831712c655fd780db4020486ba
[]
no_license
RuiLu/Xel-Ha
86c92daf5d6f849b8ae44e76d834375354301a7d
cad5404ec91a5fe6bb84094564805682c56a104b
refs/heads/master
2021-01-10T19:27:30.551992
2017-02-22T19:52:37
2017-02-22T19:52:37
55,649,444
2
0
null
null
null
null
UTF-8
Java
false
false
875
java
public class Solution { /** * Idea -> Dynamica programming * Time complexity -> O(mn) */ public int minPathSum(int[][] grid) { if (grid == null || grid.length == 0 || grid[0].length == 0) return 0; int m = grid.length; int n = grid[0].length; int[][] dp = new int[m][n]; dp[0][0] = grid[0][0]; /* calculate all positions */ for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (i == 0 && j == 0) dp[i][i] = grid[i][j]; else if (i == 0) dp[i][j] = dp[i][j-1]+grid[i][j]; else if (j == 0) dp[i][j] = dp[i-1][j]+grid[i][j]; else { dp[i][j] = Math.min(dp[i-1][j], dp[i][j-1])+grid[i][j]; } } } return dp[m-1][n-1]; } }
[ "rlu0213@hotmail.com" ]
rlu0213@hotmail.com
f84f5670f6b4ceaf79ed0d777d3f55769c703563
6e38888b278c823361d56bc5311106604ca805ed
/app/src/androidTest/java/mcm/edu/ph/balibay_basiccalculator/ExampleInstrumentedTest.java
d4fb04cb2ac7bc08d6e85adb43f90b1176ebb368
[]
no_license
TemmiTemiru/Balibay_BasicCalculator
68e05513c40b860ef99f4229d707fc61f972f4a1
d39ac5d28791936bc9e824f73357a8d2a29ca823
refs/heads/master
2023-03-11T20:28:42.652852
2021-03-02T07:29:27
2021-03-02T07:29:27
343,683,558
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package mcm.edu.ph.balibay_basiccalculator; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("mcm.edu.ph.balibay_basiccalculator", appContext.getPackageName()); } }
[ "tammiebalibay@gmail.com" ]
tammiebalibay@gmail.com
a12f48fe08c090537a3e882031a845a008263990
9c3a443a9e8f0074a5082ecfb791bed5d7e8789a
/src/com/shafin/sdxball/Objects.java
de03c2e9787573c19dcfee6aac77d7f2f2a22d79
[]
no_license
shafin1911/DX-Ball-Android
bcd604b67e8ed435bee5c8b0574d23a3b5ae363a
7091996c96b3f358491cce2ba68acf3bba474bd2
refs/heads/master
2021-01-20T02:33:10.575450
2017-08-24T18:35:24
2017-08-24T18:37:05
101,326,107
0
0
null
null
null
null
UTF-8
Java
false
false
1,342
java
package com.shafin.sdxball; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; public class Objects { float top,bottom,left,right; Canvas canvas = new Canvas(); Paint paint; Point point; int x,y; int color; Objects(float left,float top,float right,float bottom,int color) { this.left = left; this.top = top; this.right = right; this.bottom = bottom; this.color = color; paint = new Paint(); paint.setColor(color); } public void setBottom(float bottom) { this.bottom = bottom; } public void setLeft(float left) { this.left = left; } public void setRight(float right) { this.right = right; } public void setTop(float top) { this.top = top; } public void setColor(int c) { this.color = c; } public float getLeft() { return left; } public float getRight() { return right; } public float getBottom() { return bottom; } public Paint getPaint() { return paint; } public float getTop() { return top; } public int getColor() { return color; } }
[ "shafin@shafindesigns.com" ]
shafin@shafindesigns.com
6803ec11dbcc13d46d0a0fba9a336a381fc945ac
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/27/27_6c89b6104f07f224f7219f3e32e6202140bdccf1/SootClassCompiler/27_6c89b6104f07f224f7219f3e32e6202140bdccf1_SootClassCompiler_t.java
cf6d1ef877d422c5052a9fee6e9b29b1e75b7569
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
119,305
java
/* * Copyright (C) 2011 The NullVM Open Source Project * * TODO: Insert proper license header. */ package org.nullvm.compiler; import static org.nullvm.compiler.llvm.Type.*; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.nullvm.compiler.clazz.Clazz; import org.nullvm.compiler.clazz.Clazzes; import org.nullvm.compiler.clazz.Path; import org.nullvm.compiler.llvm.Add; import org.nullvm.compiler.llvm.Alloca; import org.nullvm.compiler.llvm.And; import org.nullvm.compiler.llvm.ArrayType; import org.nullvm.compiler.llvm.Ashr; import org.nullvm.compiler.llvm.BasicBlock; import org.nullvm.compiler.llvm.BasicBlockRef; import org.nullvm.compiler.llvm.Bitcast; import org.nullvm.compiler.llvm.Br; import org.nullvm.compiler.llvm.Call; import org.nullvm.compiler.llvm.Constant; import org.nullvm.compiler.llvm.ConstantAdd; import org.nullvm.compiler.llvm.ConstantBitcast; import org.nullvm.compiler.llvm.ConstantGetelementptr; import org.nullvm.compiler.llvm.ConstantPtrtoint; import org.nullvm.compiler.llvm.ConstantSub; import org.nullvm.compiler.llvm.ConstantTrunc; import org.nullvm.compiler.llvm.Fadd; import org.nullvm.compiler.llvm.Fdiv; import org.nullvm.compiler.llvm.FloatingPointConstant; import org.nullvm.compiler.llvm.FloatingPointType; import org.nullvm.compiler.llvm.Fmul; import org.nullvm.compiler.llvm.Fpext; import org.nullvm.compiler.llvm.Fptrunc; import org.nullvm.compiler.llvm.Frem; import org.nullvm.compiler.llvm.Fsub; import org.nullvm.compiler.llvm.Function; import org.nullvm.compiler.llvm.FunctionRef; import org.nullvm.compiler.llvm.FunctionType; import org.nullvm.compiler.llvm.Getelementptr; import org.nullvm.compiler.llvm.Global; import org.nullvm.compiler.llvm.GlobalRef; import org.nullvm.compiler.llvm.Icmp; import org.nullvm.compiler.llvm.Icmp.Condition; import org.nullvm.compiler.llvm.Instruction; import org.nullvm.compiler.llvm.IntegerConstant; import org.nullvm.compiler.llvm.IntegerType; import org.nullvm.compiler.llvm.Invoke; import org.nullvm.compiler.llvm.Label; import org.nullvm.compiler.llvm.Linkage; import org.nullvm.compiler.llvm.Load; import org.nullvm.compiler.llvm.Lshr; import org.nullvm.compiler.llvm.Module; import org.nullvm.compiler.llvm.Mul; import org.nullvm.compiler.llvm.NullConstant; import org.nullvm.compiler.llvm.OpaqueType; import org.nullvm.compiler.llvm.Or; import org.nullvm.compiler.llvm.PointerType; import org.nullvm.compiler.llvm.Ret; import org.nullvm.compiler.llvm.Sext; import org.nullvm.compiler.llvm.Shl; import org.nullvm.compiler.llvm.Sitofp; import org.nullvm.compiler.llvm.Store; import org.nullvm.compiler.llvm.StringConstant; import org.nullvm.compiler.llvm.StructureType; import org.nullvm.compiler.llvm.Sub; import org.nullvm.compiler.llvm.Switch; import org.nullvm.compiler.llvm.Trunc; import org.nullvm.compiler.llvm.Type; import org.nullvm.compiler.llvm.Unreachable; import org.nullvm.compiler.llvm.Value; import org.nullvm.compiler.llvm.Variable; import org.nullvm.compiler.llvm.VariableRef; import org.nullvm.compiler.llvm.Xor; import org.nullvm.compiler.llvm.Zext; import org.nullvm.compiler.trampoline.Checkcast; import org.nullvm.compiler.trampoline.FieldAccessor; import org.nullvm.compiler.trampoline.GetField; import org.nullvm.compiler.trampoline.GetStatic; import org.nullvm.compiler.trampoline.Instanceof; import org.nullvm.compiler.trampoline.Invokeinterface; import org.nullvm.compiler.trampoline.Invokespecial; import org.nullvm.compiler.trampoline.Invokestatic; import org.nullvm.compiler.trampoline.Invokevirtual; import org.nullvm.compiler.trampoline.NativeCall; import org.nullvm.compiler.trampoline.New; import org.nullvm.compiler.trampoline.PutField; import org.nullvm.compiler.trampoline.PutStatic; import org.nullvm.compiler.trampoline.Trampoline; import soot.Body; import soot.BodyTransformer; import soot.BooleanType; import soot.ByteType; import soot.CharType; import soot.FloatType; import soot.Immediate; import soot.IntType; import soot.Local; import soot.LongType; import soot.Modifier; import soot.NullType; import soot.Pack; import soot.PackManager; import soot.PatchingChain; import soot.PrimType; import soot.RefType; import soot.ResolutionFailedException; import soot.Scene; import soot.ShortType; import soot.SootClass; import soot.SootField; import soot.SootMethod; import soot.SootMethodRef; import soot.Transform; import soot.Trap; import soot.Unit; import soot.VoidType; import soot.jimple.AddExpr; import soot.jimple.AndExpr; import soot.jimple.ArrayRef; import soot.jimple.BinopExpr; import soot.jimple.CastExpr; import soot.jimple.CaughtExceptionRef; import soot.jimple.CmpExpr; import soot.jimple.CmpgExpr; import soot.jimple.CmplExpr; import soot.jimple.ConditionExpr; import soot.jimple.DefinitionStmt; import soot.jimple.DivExpr; import soot.jimple.EnterMonitorStmt; import soot.jimple.EqExpr; import soot.jimple.ExitMonitorStmt; import soot.jimple.Expr; import soot.jimple.FieldRef; import soot.jimple.GeExpr; import soot.jimple.GotoStmt; import soot.jimple.GtExpr; import soot.jimple.IfStmt; import soot.jimple.InstanceFieldRef; import soot.jimple.InstanceInvokeExpr; import soot.jimple.InstanceOfExpr; import soot.jimple.InterfaceInvokeExpr; import soot.jimple.InvokeExpr; import soot.jimple.InvokeStmt; import soot.jimple.LeExpr; import soot.jimple.LengthExpr; import soot.jimple.LookupSwitchStmt; import soot.jimple.LtExpr; import soot.jimple.MulExpr; import soot.jimple.NeExpr; import soot.jimple.NegExpr; import soot.jimple.NewArrayExpr; import soot.jimple.NewExpr; import soot.jimple.NewMultiArrayExpr; import soot.jimple.OrExpr; import soot.jimple.ParameterRef; import soot.jimple.RemExpr; import soot.jimple.ReturnStmt; import soot.jimple.ReturnVoidStmt; import soot.jimple.ShlExpr; import soot.jimple.ShrExpr; import soot.jimple.SpecialInvokeExpr; import soot.jimple.StaticFieldRef; import soot.jimple.StaticInvokeExpr; import soot.jimple.Stmt; import soot.jimple.SubExpr; import soot.jimple.TableSwitchStmt; import soot.jimple.ThisRef; import soot.jimple.ThrowStmt; import soot.jimple.UshrExpr; import soot.jimple.VirtualInvokeExpr; import soot.jimple.XorExpr; import soot.jimple.toolkits.annotation.tags.ArrayCheckTag; import soot.jimple.toolkits.annotation.tags.NullCheckTag; import soot.jimple.toolkits.typing.fast.BottomType; import soot.options.Options; import soot.tagkit.ConstantValueTag; import soot.tagkit.DoubleConstantValueTag; import soot.tagkit.FloatConstantValueTag; import soot.tagkit.IntegerConstantValueTag; import soot.tagkit.LongConstantValueTag; import soot.tagkit.StringConstantValueTag; import soot.tagkit.Tag; /** * * @version $Id$ */ public class SootClassCompiler { private static final char[] HEX_CHARS = "0123456789ABCDEF".toCharArray(); private static final Type ENV_PTR = new PointerType(new OpaqueType("Env")); // Dummy Class type definition. The real one is in header.ll private static final StructureType CLASS = new StructureType("Class", I8_PTR); private static final Type CLASS_PTR = new PointerType(CLASS); // Dummy Object type definition. The real one is in header.ll private static final StructureType OBJECT = new StructureType("Object", CLASS_PTR); private static final Type OBJECT_PTR = new PointerType(OBJECT); private static final VariableRef ENV = new VariableRef("env", ENV_PTR); private static final Global THE_CLASS = new Global("class", Linkage._private, new NullConstant(CLASS_PTR)); private static final FunctionRef NVM_BC_ALLOCATE_CLASS = new FunctionRef("_nvmBcAllocateClass", new FunctionType(CLASS_PTR, ENV_PTR, I8_PTR, I8_PTR, OBJECT_PTR, I32, I32, I32)); private static final FunctionRef NVM_BC_ADD_INTERFACE = new FunctionRef("_nvmBcAddInterface", new FunctionType(VOID, ENV_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_ADD_FIELD = new FunctionRef("_nvmBcAddField", new FunctionType(VOID, ENV_PTR, CLASS_PTR, I8_PTR, I8_PTR, I32, I32, I8_PTR, I8_PTR)); private static final FunctionRef NVM_BC_ADD_METHOD = new FunctionRef("_nvmBcAddMethod", new FunctionType(VOID, ENV_PTR, CLASS_PTR, I8_PTR, I8_PTR, I32, I32, I8_PTR, I8_PTR, I8_PTR)); private static final FunctionRef NVM_BC_REGISTER_CLASS = new FunctionRef("_nvmBcRegisterClass", new FunctionType(VOID, ENV_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_FIND_CLASS_IN_LOADER = new FunctionRef("_nvmBcFindClassInLoader", new FunctionType(OBJECT_PTR, ENV_PTR, I8_PTR, OBJECT_PTR)); private static final FunctionRef NVM_BC_PERSONALITY = new FunctionRef("_nvmPersonality", new FunctionType(I8_PTR)); private static final FunctionRef NVM_BC_EXCEPTION_MATCH = new FunctionRef("_nvmBcExceptionMatch", new FunctionType(I32, ENV_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_EXCEPTION_CLEAR = new FunctionRef("_nvmBcExceptionClear", new FunctionType(OBJECT_PTR, ENV_PTR)); private static final FunctionRef NVM_BC_EXCEPTION_SET = new FunctionRef("_nvmBcExceptionSet", new FunctionType(VOID, ENV_PTR, OBJECT_PTR)); private static final FunctionRef NVM_BC_THROW = new FunctionRef("_nvmBcThrow", new FunctionType(VOID, ENV_PTR, OBJECT_PTR)); private static final FunctionRef NVM_BC_RETHROW = new FunctionRef("_nvmBcRethrow", new FunctionType(VOID, ENV_PTR)); private static final FunctionRef NVM_BC_THROW_IF_EXCEPTION_OCCURRED = new FunctionRef("_nvmBcThrowIfExceptionOccurred", new FunctionType(VOID, ENV_PTR)); private static final FunctionRef NVM_BC_NEW_BOOLEAN_ARRAY = new FunctionRef("_nvmBcNewBooleanArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_NEW_BYTE_ARRAY = new FunctionRef("_nvmBcNewByteArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_NEW_CHAR_ARRAY = new FunctionRef("_nvmBcNewCharArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_NEW_SHORT_ARRAY = new FunctionRef("_nvmBcNewShortArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_NEW_INT_ARRAY = new FunctionRef("_nvmBcNewIntArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_NEW_LONG_ARRAY = new FunctionRef("_nvmBcNewLongArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_NEW_FLOAT_ARRAY = new FunctionRef("_nvmBcNewFloatArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_NEW_DOUBLE_ARRAY = new FunctionRef("_nvmBcNewDoubleArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32)); private static final FunctionRef NVM_BC_MONITOR_ENTER = new FunctionRef("_nvmBcMonitorEnter", new FunctionType(VOID, ENV_PTR, OBJECT_PTR)); private static final FunctionRef NVM_BC_MONITOR_EXIT = new FunctionRef("_nvmBcMonitorExit", new FunctionType(VOID, ENV_PTR, OBJECT_PTR)); private static final FunctionRef NVM_BC_LDC_STRING = new FunctionRef("_nvmBcLdcString", new FunctionType(OBJECT_PTR, ENV_PTR, I8_PTR)); private static final FunctionRef NVM_BC_LDC_CLASS = new FunctionRef("_nvmBcLdcClass", new FunctionType(OBJECT_PTR, ENV_PTR, I8_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_LOOKUP_VIRTUAL_METHOD = new FunctionRef("_nvmBcLookupVirtualMethod", new FunctionType(I8_PTR, ENV_PTR, CLASS_PTR, OBJECT_PTR, I8_PTR, I8_PTR)); private static final FunctionRef NVM_BC_LOOKUP_INTERFACE_METHOD = new FunctionRef("_nvmBcLookupInterfaceMethod", new FunctionType(I8_PTR, ENV_PTR, CLASS_PTR, OBJECT_PTR, I8_PTR, I8_PTR)); private static final FunctionRef NVM_BC_CHECKCAST = new FunctionRef("_nvmBcCheckcast", new FunctionType(OBJECT_PTR, ENV_PTR, OBJECT_PTR, I8_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_INSTANCEOF = new FunctionRef("_nvmBcInstanceof", new FunctionType(I32, ENV_PTR, OBJECT_PTR, I8_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_NEW = new FunctionRef("_nvmBcNew", new FunctionType(OBJECT_PTR, ENV_PTR, I8_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_NEW_OBJECT_ARRAY = new FunctionRef("_nvmBcNewObjectArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32, I8_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_NEW_MULTI_ARRAY = new FunctionRef("_nvmBcNewMultiArray", new FunctionType(OBJECT_PTR, ENV_PTR, I32, new PointerType(I32), I8_PTR, CLASS_PTR)); private static final FunctionRef NVM_BC_RESOLVE_INVOKESPECIAL = new FunctionRef("_nvmBcResolveInvokespecial", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_INVOKESTATIC = new FunctionRef("_nvmBcResolveInvokestatic", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_INVOKEVIRTUAL = new FunctionRef("_nvmBcResolveInvokevirtual", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_INVOKEINTERFACE = new FunctionRef("_nvmBcResolveInvokeinterface", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_GETSTATIC = new FunctionRef("_nvmBcResolveGetstatic", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_PUTSTATIC = new FunctionRef("_nvmBcResolvePutstatic", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_GETFIELD = new FunctionRef("_nvmBcResolveGetfield", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_PUTFIELD = new FunctionRef("_nvmBcResolvePutfield", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef NVM_BC_RESOLVE_NATIVE = new FunctionRef("_nvmBcResolveNative", new FunctionType(I8_PTR, ENV_PTR, I8_PTR, I8_PTR, I8_PTR, I8_PTR, I8_PTR, CLASS_PTR, I8_PTR)); private static final FunctionRef LLVM_EH_EXCEPTION = new FunctionRef("llvm.eh.exception", new FunctionType(I8_PTR)); private static final FunctionRef LLVM_EH_SELECTOR = new FunctionRef("llvm.eh.selector", new FunctionType(I32, true, I8_PTR, I8_PTR)); private static final FunctionRef CHECK_NULL = new FunctionRef("checknull", new FunctionType(VOID, ENV_PTR, OBJECT_PTR)); private static final FunctionRef CHECK_LOWER = new FunctionRef("checklower", new FunctionType(VOID, ENV_PTR, OBJECT_PTR, I32)); private static final FunctionRef CHECK_UPPER = new FunctionRef("checkupper", new FunctionType(VOID, ENV_PTR, OBJECT_PTR, I32)); private static final FunctionRef ARRAY_LENGTH = new FunctionRef("arraylength", new FunctionType(I32, OBJECT_PTR)); private static final FunctionRef BALOAD = new FunctionRef("baload", new FunctionType(I8, OBJECT_PTR, I32)); private static final FunctionRef SALOAD = new FunctionRef("saload", new FunctionType(I16, OBJECT_PTR, I32)); private static final FunctionRef CALOAD = new FunctionRef("caload", new FunctionType(I16, OBJECT_PTR, I32)); private static final FunctionRef IALOAD = new FunctionRef("iaload", new FunctionType(I32, OBJECT_PTR, I32)); private static final FunctionRef LALOAD = new FunctionRef("laload", new FunctionType(I64, OBJECT_PTR, I32)); private static final FunctionRef FALOAD = new FunctionRef("faload", new FunctionType(FLOAT, OBJECT_PTR, I32)); private static final FunctionRef DALOAD = new FunctionRef("daload", new FunctionType(DOUBLE, OBJECT_PTR, I32)); private static final FunctionRef AALOAD = new FunctionRef("aaload", new FunctionType(OBJECT_PTR, OBJECT_PTR, I32)); private static final FunctionRef BASTORE = new FunctionRef("bastore", new FunctionType(VOID, OBJECT_PTR, I32, I8)); private static final FunctionRef SASTORE = new FunctionRef("sastore", new FunctionType(VOID, OBJECT_PTR, I32, I16)); private static final FunctionRef CASTORE = new FunctionRef("castore", new FunctionType(VOID, OBJECT_PTR, I32, I16)); private static final FunctionRef IASTORE = new FunctionRef("iastore", new FunctionType(VOID, OBJECT_PTR, I32, I32)); private static final FunctionRef LASTORE = new FunctionRef("lastore", new FunctionType(VOID, OBJECT_PTR, I32, I64)); private static final FunctionRef FASTORE = new FunctionRef("fastore", new FunctionType(VOID, OBJECT_PTR, I32, FLOAT)); private static final FunctionRef DASTORE = new FunctionRef("dastore", new FunctionType(VOID, OBJECT_PTR, I32, DOUBLE)); private static final FunctionRef AASTORE = new FunctionRef("aastore", new FunctionType(VOID, OBJECT_PTR, I32, OBJECT_PTR)); private static final FunctionRef F2I = new FunctionRef("f2i", new FunctionType(I32, FLOAT)); private static final FunctionRef F2L = new FunctionRef("f2l", new FunctionType(I64, FLOAT)); private static final FunctionRef D2I = new FunctionRef("d2i", new FunctionType(I32, DOUBLE)); private static final FunctionRef D2L = new FunctionRef("d2l", new FunctionType(I64, DOUBLE)); private static final FunctionRef IDIV = new FunctionRef("idiv", new FunctionType(I32, ENV_PTR, I32, I32)); private static final FunctionRef LDIV = new FunctionRef("ldiv", new FunctionType(I64, ENV_PTR, I64, I64)); private static final FunctionRef IREM = new FunctionRef("irem", new FunctionType(I32, ENV_PTR, I32, I32)); private static final FunctionRef LREM = new FunctionRef("lrem", new FunctionType(I64, ENV_PTR, I64, I64)); private static final FunctionRef FCMPL = new FunctionRef("fcmpl", new FunctionType(I32, FLOAT, FLOAT)); private static final FunctionRef FCMPG = new FunctionRef("fcmpg", new FunctionType(I32, FLOAT, FLOAT)); private static final FunctionRef DCMPL = new FunctionRef("dcmpl", new FunctionType(I32, DOUBLE, DOUBLE)); private static final FunctionRef DCMPG = new FunctionRef("dcmpg", new FunctionType(I32, DOUBLE, DOUBLE)); private static final Map<Class<? extends Trampoline>, Integer> TRAMPOLINE_TYPES; static { TRAMPOLINE_TYPES = new HashMap<Class<? extends Trampoline>, Integer>(); TRAMPOLINE_TYPES.put(New.class, 1); TRAMPOLINE_TYPES.put(Checkcast.class, 2); TRAMPOLINE_TYPES.put(Instanceof.class, 3); TRAMPOLINE_TYPES.put(GetField.class, 4); TRAMPOLINE_TYPES.put(GetStatic.class, 5); TRAMPOLINE_TYPES.put(PutField.class, 6); TRAMPOLINE_TYPES.put(PutStatic.class, 7); TRAMPOLINE_TYPES.put(Invokespecial.class, 8); TRAMPOLINE_TYPES.put(Invokestatic.class, 9); TRAMPOLINE_TYPES.put(Invokevirtual.class, 10); TRAMPOLINE_TYPES.put(Invokeinterface.class, 11); } private SootClass sootClass; private Module module; private Map<SootClass, Global> throwables; private Map<Trampoline, FunctionRef> trampolines; private Map<String, Global> strings; /** * Contains the class fields of the class being compiled. */ private List<SootField> classFields; /** * Contains the instance fields of the class being compiled. */ private List<SootField> instanceFields; /** * Contains the instance fields of the class being compiled and of all of its * ancestor classes. */ private List<SootField> allInstanceFields; private StructureType classFieldsType; private StructureType instanceFieldsType; private Variable dims; public SootClassCompiler() { } public void compile(Clazz clazz, OutputStream out) throws IOException { this.sootClass = Scene.v().getSootClass(clazz.getClassName()); module = new Module(); throwables = new HashMap<SootClass, Global>(); trampolines = new HashMap<Trampoline, FunctionRef>(); strings = new HashMap<String, Global>(); module.addInclude(getClass().getClassLoader().getResource("header.ll")); classFields = getClassFields(sootClass, false); instanceFields = getInstanceFields(sootClass, false); allInstanceFields = getInstanceFields(sootClass, true); classFieldsType = getType("ClassFields", classFields); if (classFieldsType != null) { module.addType(classFieldsType); } instanceFieldsType = getType("InstanceFields", allInstanceFields); if (instanceFieldsType != null) { module.addType(instanceFieldsType); } List<SootField> allFields = new ArrayList<SootField>(); allFields.addAll(classFields); allFields.addAll(instanceFields); for (SootField field : allFields) { // TODO: Don't create accessors for private fields? fieldGetter(field); fieldSetter(field); } if (!sootClass.declaresMethodByName("<clinit>") && hasConstantValueTags(classFields)) { Function clinit = module.newFunction(Linkage._private, mangleMethod(getInternalName(sootClass), "<clinit>", new ArrayList<soot.Type>(), soot.VoidType.v()), new FunctionType(VOID, ENV_PTR), "env"); finalClassFieldsInitializers(clinit); clinit.add(new Ret()); } for (SootMethod method : sootClass.getMethods()) { if (isNative(method)) { nativeMethod(method); } else if (!method.isAbstract()) { Body body = method.retrieveActiveBody(); PackManager.v().getPack("jtp").apply(body); PackManager.v().getPack("jop").apply(body); PackManager.v().getPack("jap").apply(body); method(method); } if (!method.isStatic() && !method.isPrivate() && !Modifier.isFinal(method.getModifiers())) { // Virtual method. If not defined in a superclass we need to create a virtual lookup function now. if (!ancestorDeclaresMethod(sootClass, method)) { virtualLookupFunction(method); } } if (!method.isAbstract() && method.isSynchronized()) { // Create a wrapper function which synchronizes on the class or instance and then calls the actual function synchronizedFunctionWrapper(method); } } for (Entry<Trampoline, FunctionRef> entry : trampolines.entrySet()) { trampoline(entry.getKey(), entry.getValue()); } classLoaderFunction(); module.addGlobal(THE_CLASS); for (Global global : throwables.values()) { module.addGlobal(global); } for (Global global : strings.values()) { module.addGlobal(global); } out.write(module.toString().getBytes("UTF-8")); } // private void createTrampolinesResolver() { // Type descType = new PointerType(new StructureType(I32, I8_PTR, I8_PTR, I8_PTR)); // VariableRef desc = new VariableRef("desc", descType); // Function f = module.newFunction("resolver", new FunctionType(VOID, ENV_PTR, I32, descType), "env", "index", "desc"); // TreeMap<IntegerConstant, BasicBlockRef> alt = new TreeMap<IntegerConstant, BasicBlockRef>(); // for (int index = 0; index < trampolines.size(); index++) { // alt.put(new IntegerConstant(index), f.newBasicBlockRef(index)); // } // f.newBasicBlock(new Object()); // f.add(new Switch(new VariableRef("index", I32), f.newBasicBlockRef(trampolines.size()), alt)); // for (int index = 0; index < trampolines.size(); index++) { // Trampoline t = trampolines.get(index); // f.newBasicBlock(index); // // int type = TRAMPOLINE_TYPES.get(t.getClass()); // Variable typePtr = f.newVariable(new PointerType(I32)); // f.add(new Getelementptr(typePtr, desc, 0, 0)); // f.add(new Store(new IntegerConstant(type), new VariableRef(typePtr))); // // String targetClass = t.getTargetClass(); // Variable targetClassPtr = f.newVariable(new PointerType(I8_PTR)); // f.add(new Getelementptr(targetClassPtr, desc, 0, 1)); // f.add(new Store(new ConstantBitcast(new GlobalRef(addString(targetClass)), I8_PTR), new VariableRef(targetClassPtr))); // // String methodOrFieldName = null; // String methodOrFieldDesc = null; // if (t instanceof org.nullvm.compiler.trampoline.Invoke) { // methodOrFieldName = ((org.nullvm.compiler.trampoline.Invoke) t).getMethodName(); // methodOrFieldDesc = ((org.nullvm.compiler.trampoline.Invoke) t).getMethodDesc(); // } else if (t instanceof FieldAccessor) { // methodOrFieldName = ((FieldAccessor) t).getFieldName(); // methodOrFieldName = ((FieldAccessor) t).getFieldDesc(); // } // // if (methodOrFieldName != null) { // Variable ptr = f.newVariable(new PointerType(I8_PTR)); // f.add(new Getelementptr(ptr, desc, 0, 2)); // f.add(new Store(new ConstantBitcast(new GlobalRef(addString(methodOrFieldName)), I8_PTR), new VariableRef(ptr))); // } // if (methodOrFieldDesc != null) { // Variable ptr = f.newVariable(new PointerType(I8_PTR)); // f.add(new Getelementptr(ptr, desc, 0, 3)); // f.add(new Store(new ConstantBitcast(new GlobalRef(addString(methodOrFieldDesc)), I8_PTR), new VariableRef(ptr))); // } // // f.add(new Ret()); // } // f.newBasicBlock(trampolines.size()); // f.add(new Ret()); // } private void synchronizedFunctionWrapper(SootMethod method) { String name = mangleMethod(method) + "_synchronized"; Function function = createFunction(name, method); FunctionType functionType = function.getType(); FunctionRef target = new FunctionRef(mangleMethod(method), functionType); Value monitor = null; if (method.isStatic()) { Value clazz = getCaller(function); Variable tmp = function.newVariable(OBJECT_PTR); function.add(new Bitcast(tmp, clazz, OBJECT_PTR)); monitor = tmp.ref(); } else { monitor = new VariableRef("this", OBJECT_PTR); } function.add(new Call(NVM_BC_MONITOR_ENTER, ENV, monitor)); String[] parameterNames = function.getParameterNames(); Type[] parameterTypes = function.getType().getParameterTypes(); Value[] args = new Value[parameterNames.length]; for (int i = 0; i < args.length; i++) { args[i] = new VariableRef(parameterNames[i], parameterTypes[i]); } BasicBlockRef bbSuccess = function.newBasicBlockRef(new Label("success")); BasicBlockRef bbFailure = function.newBasicBlockRef(new Label("failure")); if (function.getType().getReturnType() == VOID) { function.add(new Invoke(target, bbSuccess, bbFailure, args)); function.newBasicBlock(new Label("success")); function.add(new Call(NVM_BC_MONITOR_EXIT, ENV, monitor)); function.add(new Ret()); } else { Variable result = function.newVariable(functionType.getReturnType()); function.add(new Invoke(result, target, bbSuccess, bbFailure, args)); function.newBasicBlock(new Label("success")); function.add(new Call(NVM_BC_MONITOR_EXIT, ENV, monitor)); function.add(new Ret(result.ref())); } function.newBasicBlock(new Label("failure")); Variable ehptr = function.newVariable(I8_PTR); function.add(new Call(ehptr, LLVM_EH_EXCEPTION)); Variable sel = function.newVariable(I32); function.add(new Call(sel, LLVM_EH_SELECTOR, new VariableRef(ehptr), new ConstantBitcast(NVM_BC_PERSONALITY, I8_PTR), new IntegerConstant(1))); function.add(new Call(NVM_BC_MONITOR_EXIT, ENV, monitor)); function.add(new Call(NVM_BC_RETHROW, ENV)); function.add(new Unreachable()); } private static boolean isTerminator(Instruction instr) { return instr instanceof Ret || instr instanceof Br || instr instanceof Invoke || instr instanceof Unreachable || instr instanceof Switch; } private void trampoline(Trampoline trampoline, FunctionRef functionRef) { String name = functionRef.getName().substring(1); GlobalRef ptr = new GlobalRef(name + "_ptr", functionRef.getType()); Type[] parameterTypes = functionRef.getType().getParameterTypes(); String[] parameterNames = new String[parameterTypes.length]; parameterNames[0] = ENV.getName().substring(1); for (int i = 1; i < parameterNames.length; i++) { parameterNames[i] = "p" + i; } Function function = module.newFunction(Linkage._private, name, functionRef.getType(), parameterNames); Variable targetI8Ptr = function.newVariable(I8_PTR); if (trampoline instanceof org.nullvm.compiler.trampoline.Invoke) { org.nullvm.compiler.trampoline.Invoke invoke = (org.nullvm.compiler.trampoline.Invoke) trampoline; FunctionRef resolveFunc = null; List<Value> args = new ArrayList<Value>(); args.add(ENV); if (invoke instanceof Invokespecial) { resolveFunc = NVM_BC_RESOLVE_INVOKESPECIAL; args.add(getString(((Invokespecial) invoke).getRuntimeClass())); } else if (invoke instanceof Invokestatic) { resolveFunc = NVM_BC_RESOLVE_INVOKESTATIC; } else if (invoke instanceof Invokevirtual) { resolveFunc = NVM_BC_RESOLVE_INVOKEVIRTUAL; args.add(getString(((Invokevirtual) invoke).getRuntimeClass())); } else if (invoke instanceof Invokeinterface) { resolveFunc = NVM_BC_RESOLVE_INVOKEINTERFACE; } args.add(getString(invoke.getTargetClass())); args.add(getString(invoke.getMethodName())); args.add(getString(invoke.getMethodDesc())); args.add(getCaller(function)); args.add(new ConstantBitcast(ptr, I8_PTR)); function.add(new Call(targetI8Ptr, resolveFunc, args.toArray(new Value[args.size()]))); } else if (trampoline instanceof NativeCall) { NativeCall nativeCall = (NativeCall) trampoline; function.add(new Call(targetI8Ptr, NVM_BC_RESOLVE_NATIVE, ENV, getString(nativeCall.getTargetClass()), getString(nativeCall.getMethodName()), getString(nativeCall.getMethodDesc()), getString(mangleNativeMethod(nativeCall.getTargetClass(), nativeCall.getMethodName())), getString(mangleNativeMethod(nativeCall.getTargetClass(), nativeCall.getMethodName(), nativeCall.getMethodDesc())), getCaller(function), new ConstantBitcast(ptr, I8_PTR))); } else if (trampoline instanceof FieldAccessor) { FieldAccessor accessor = (FieldAccessor) trampoline; FunctionRef resolveFunc = null; List<Value> args = new ArrayList<Value>(); args.add(ENV); if (accessor instanceof GetStatic) { resolveFunc = NVM_BC_RESOLVE_GETSTATIC; } else if (accessor instanceof PutStatic) { resolveFunc = NVM_BC_RESOLVE_PUTSTATIC; } else if (accessor instanceof GetField) { resolveFunc = NVM_BC_RESOLVE_GETFIELD; args.add(getString(((GetField) accessor).getRuntimeClass())); } else if (accessor instanceof PutField) { resolveFunc = NVM_BC_RESOLVE_PUTFIELD; args.add(getString(((PutField) accessor).getRuntimeClass())); } args.add(getString(accessor.getTargetClass())); args.add(getString(accessor.getFieldName())); args.add(getString(accessor.getFieldDesc())); args.add(getCaller(function)); args.add(new ConstantBitcast(ptr, I8_PTR)); function.add(new Call(targetI8Ptr, resolveFunc, args.toArray(new Value[args.size()]))); } Variable targetFuncPtr = function.newVariable(functionRef.getType()); function.add(new Bitcast(targetFuncPtr, targetI8Ptr.ref(), functionRef.getType())); Value[] args = new Value[parameterTypes.length]; for (int i = 0; i < parameterTypes.length; i++) { args[i] = new VariableRef(parameterNames[i], parameterTypes[i]); } if (functionRef.getType().getReturnType() != VOID) { Variable result = function.newVariable(functionRef.getType().getReturnType()); function.add(new Call(result, targetFuncPtr.ref(), args)); function.add(new Ret(result.ref())); } else { function.add(new Call(targetFuncPtr.ref(), args)); function.add(new Ret()); } // // TODO: X86-64 specific // module.addFunctionDeclaration(new FunctionDeclaration(name, functionRef.getType())); // module.addAsm("\t.align 16, 0x90"); // module.addAsm(name + ":"); // module.addAsm("\tmovq .L" + name + "_ptr(%rip), %rax"); // module.addAsm("\tjmpq *(%rax)"); module.addGlobal(new Global(name + "_ptr", Linkage._private, functionRef)); // String[] parameterNames = new String[functionRef.getType().getParameterTypes().length]; // for (int i = 0; i < parameterNames.length; i++) { // parameterNames[i] = "p" + i; // } // Function function = module.newFunction(functionRef.getName().substring(1), functionRef.getType(), parameterNames); // FunctionType functionType = function.getType(); // function.newBasicBlock(new Object()); // Global functionPtr = new Global(function.getName().substring(1) + "_ptr", new NullConstant(functionType)); // module.addGlobal(functionPtr); // Variable f = function.newVariable(functionType); // function.add(new Load(f, new GlobalRef(functionPtr))); // Type[] parameterTypes = function.getType().getParameterTypes(); // Value[] args = new Value[parameterNames.length]; // for (int i = 0; i < args.length; i++) { // args[i] = new VariableRef(parameterNames[i], parameterTypes[i]); // } // if (function.getType().getReturnType() == VOID) { // function.add(new Call(new VariableRef(f), args)); // function.add(new Ret()); // } else { // Variable result = function.newVariable(functionType.getReturnType()); // function.add(new Call(result, new VariableRef(f), args)); // function.add(new Ret(new VariableRef(result))); // } } private void nativeMethod(SootMethod method) { Function function = createFunction(method); Type[] parameterTypes = function.getType().getParameterTypes(); String[] parameterNames = function.getParameterNames(); ArrayList<Value> args = new ArrayList<Value>(); for (int i = 0; i < parameterTypes.length; i++) { args.add(new VariableRef(parameterNames[i], parameterTypes[i])); } FunctionType nativeFunctionType = function.getType(); if (method.isStatic()) { // Add THE_CLASS as second parameter Variable tmp = function.newVariable(CLASS_PTR); function.add(new Load(tmp, THE_CLASS.ref())); args.add(1, tmp.ref()); // Add %Class* as second parameter type ArrayList<Type> ptypes = new ArrayList<Type>(Arrays.asList(parameterTypes)); ptypes.add(1, CLASS_PTR); nativeFunctionType = new FunctionType(function.getType().getReturnType(), ptypes.toArray(new Type[ptypes.size()])); } String targetClassName = getInternalName(method.getDeclaringClass()); String methodName = method.getName(); String methodDesc = getDescriptor(method); // TODO: NativeCall should take THE_CLASS as first arg since method is // always declared by the class being compiled Trampoline trampoline = new NativeCall(targetClassName, methodName, methodDesc); addTrampoline(trampoline, nativeFunctionType); if (function.getType().getReturnType() == VOID) { callTrampoline(function, trampoline, null, args.toArray(new Value[args.size()])); function.add(new Call(NVM_BC_THROW_IF_EXCEPTION_OCCURRED, ENV)); function.add(new Ret()); } else { Variable result = function.newVariable(function.getType().getReturnType()); callTrampoline(function, trampoline, result, args.toArray(new Value[args.size()])); function.add(new Call(NVM_BC_THROW_IF_EXCEPTION_OCCURRED, ENV)); function.add(new Ret(new VariableRef(result))); } } private void method(SootMethod method) { Context ctx = new Context(); Body body = method.retrieveActiveBody(); Function function = createFunction(method); ctx.setCurrentMethod(method); ctx.setCurrentBody(body); ctx.setCurrentFunction(function); Set<String> seen = new HashSet<String>(); for (Unit unit : body.getUnits()) { if (unit instanceof DefinitionStmt) { DefinitionStmt stmt = (DefinitionStmt) unit; if (stmt.getLeftOp() instanceof Local) { Local local = (Local) stmt.getLeftOp(); if (!seen.contains(local.getName())) { Type type = getLocalType(local.getType()); ctx.f().add(new Alloca(ctx.f().newVariable(local.getName(), type), type)); seen.add(local.getName()); } } } } // Variable localTrampolines = ctx.f().newVariable("trampolines", new PointerType(I8_PTR)); // ctx.f().add(new Load(localTrampolines, new GlobalRef("trampolines", new PointerType(new PointerType(I8_PTR))))); if ("<clinit>".equals(method.getName())) { finalClassFieldsInitializers(function); } PatchingChain<Unit> units = body.getUnits(); int multiANewArrayMaxDims = 0; for (Unit unit : units) { if (unit instanceof DefinitionStmt) { DefinitionStmt stmt = (DefinitionStmt) unit; if (stmt.getRightOp() instanceof NewMultiArrayExpr) { NewMultiArrayExpr expr = (NewMultiArrayExpr) stmt.getRightOp(); multiANewArrayMaxDims = Math.max(multiANewArrayMaxDims, expr.getSizeCount()); } } } dims = null; if (multiANewArrayMaxDims > 0) { // Variable tmp = ctx.f().newVariable(new ArrayType(multiANewArrayMaxDims, I32)); dims = ctx.f().newVariable("dims", new PointerType(new ArrayType(multiANewArrayMaxDims, I32))); ctx.f().add(new Alloca(dims, new ArrayType(multiANewArrayMaxDims, I32))); // ctx.f().add(new Bitcast(dims, tmp.ref(), dims.getType())); } for (Unit unit : units) { ctx.setCurrentUnit(unit); if (/*ctx.bb().getLabel().getTag() != unit &&*/ (ctx.isJumpTarget(unit) || ctx.isTrapHandler(unit))) { BasicBlock oldBlock = ctx.bb(); ctx.f().newBasicBlock(new Label(unit)); if (oldBlock != null) { Instruction last = oldBlock.last(); if (last == null || !isTerminator(last)) { oldBlock.add(new Br(ctx.f().newBasicBlockRef(new Label(unit)))); } } } if (unit instanceof DefinitionStmt) { assign(ctx, (DefinitionStmt) unit); } else if (unit instanceof ReturnStmt) { return_(ctx, (ReturnStmt) unit); } else if (unit instanceof ReturnVoidStmt) { returnVoid(ctx); } else if (unit instanceof IfStmt) { if_(ctx, (IfStmt) unit); } else if (unit instanceof LookupSwitchStmt) { lookupSwitch(ctx, (LookupSwitchStmt) unit); } else if (unit instanceof TableSwitchStmt) { tableSwitch(ctx, (TableSwitchStmt) unit); } else if (unit instanceof GotoStmt) { goto_(ctx, (GotoStmt) unit); } else if (unit instanceof ThrowStmt) { throw_(ctx, (ThrowStmt) unit); } else if (unit instanceof InvokeStmt) { invoke(ctx, (InvokeStmt) unit); } else if (unit instanceof EnterMonitorStmt) { enterMonitor(ctx, (EnterMonitorStmt) unit); } else if (unit instanceof ExitMonitorStmt) { exitMonitor(ctx, (ExitMonitorStmt) unit); } else { throw new IllegalArgumentException("Unknown Unit type: " + unit.getClass()); } } next: for (List<Trap> traps : ctx.getRecordedTraps()) { BasicBlock bb = function.newBasicBlock(new Label(traps)); Variable ehptr = function.newVariable(I8_PTR); bb.add(new Call(ehptr, LLVM_EH_EXCEPTION)); Variable sel = function.newVariable(I32); bb.add(new Call(sel, LLVM_EH_SELECTOR, new VariableRef(ehptr), new ConstantBitcast(NVM_BC_PERSONALITY, I8_PTR), new IntegerConstant(1))); for (Trap trap : traps) { String exName = trap.getException().getName(); if ("java.lang.Throwable".equals(exName)) { bb.add(new Br(function.newBasicBlockRef(new Label(trap.getHandlerUnit())))); continue next; } Global throwable = throwables.get(trap.getException()); if (throwable == null) { throwable = new Global(exName, Linkage._private, new NullConstant(CLASS_PTR)); throwables.put(trap.getException(), throwable); } Variable t = function.newVariable(CLASS_PTR); bb.add(new Load(t, throwable.ref())); Variable v = function.newVariable(I32); bb.add(new Call(v, NVM_BC_EXCEPTION_MATCH, ENV, new VariableRef(t))); Variable cond = function.newVariable(I1); bb.add(new Trunc(cond, new VariableRef(v), I1)); BasicBlockRef falseBlock = function.newBasicBlockRef(new Label()); bb.add(new Br(new VariableRef(cond), function.newBasicBlockRef(new Label(trap.getHandlerUnit())), falseBlock)); bb = function.newBasicBlock(falseBlock.getLabel()); } bb.add(new Call(NVM_BC_RETHROW, ENV)); bb.add(new Unreachable()); } } /** * @param function */ private void finalClassFieldsInitializers(Function function) { for (SootField field : classFields) { if (field.isFinal()) { for (Tag tag : field.getTags()) { if (tag instanceof DoubleConstantValueTag) { DoubleConstantValueTag dtag = (DoubleConstantValueTag) tag; function.add(new Store(new FloatingPointConstant(dtag.getDoubleValue()), getClassFieldPtr(function, field))); } else if (tag instanceof FloatConstantValueTag) { FloatConstantValueTag ftag = (FloatConstantValueTag) tag; function.add(new Store(new FloatingPointConstant(ftag.getFloatValue()), getClassFieldPtr(function, field))); } else if (tag instanceof IntegerConstantValueTag) { IntegerConstantValueTag itag = (IntegerConstantValueTag) tag; Constant c = new IntegerConstant(itag.getIntValue()); IntegerType type = (IntegerType) getType(field.getType()); if (type.getBits() < 32) { c = new ConstantTrunc(c, type); } function.add(new Store(c, getClassFieldPtr(function, field))); } else if (tag instanceof LongConstantValueTag) { LongConstantValueTag ltag = (LongConstantValueTag) tag; function.add(new Store(new IntegerConstant(ltag.getLongValue()), getClassFieldPtr(function, field))); } else if (tag instanceof StringConstantValueTag) { String s = ((StringConstantValueTag) tag).getStringValue(); Value string = getString(s); Variable result = function.newVariable(OBJECT_PTR); function.add(new Call(result, NVM_BC_LDC_STRING, ENV, string)); function.add(new Store(result.ref(), getClassFieldPtr(function, field))); } } } } } private Function createFunction(SootMethod method) { return createFunction(mangleMethod(method.makeRef()), method); } private Function createFunction(String name, SootMethod method) { FunctionType functionType = getFunctionType(method.makeRef()); String[] parameterNames = new String[functionType.getParameterTypes().length]; int i = 0; parameterNames[i++] = "env"; if (!method.isStatic()) { parameterNames[i++] = "this"; } for (int j = 0; j < method.getParameterCount(); j++) { parameterNames[i++] = "p" + j; } return module.newFunction(Linkage._private, name, functionType, parameterNames); } private void classLoaderFunction() { String name = "NullVM_" + mangleString(getInternalName(sootClass)); Function function = module.newFunction(name, new FunctionType(CLASS_PTR, ENV_PTR, OBJECT_PTR), "env", "classLoader"); for (Entry<SootClass, Global> entry : throwables.entrySet()) { Variable t1 = function.newVariable(OBJECT_PTR); function.add(new Call(t1, NVM_BC_FIND_CLASS_IN_LOADER, ENV, getString(getInternalName(entry.getKey())), new VariableRef("classLoader", OBJECT_PTR))); Variable t2 = function.newVariable(CLASS_PTR); function.add(new Bitcast(t2, t1.ref(), CLASS_PTR)); function.add(new Store(t2.ref(), entry.getValue().ref())); } Variable clazz = function.newVariable("clazz", CLASS_PTR); Value superclassName = null; if (sootClass.hasSuperclass() && !sootClass.isInterface()) { superclassName = getString(getInternalName(sootClass.getSuperclass())); } else { superclassName = new NullConstant(I8_PTR); } function.add(new Call(clazz, NVM_BC_ALLOCATE_CLASS, ENV, getString(getInternalName(sootClass)), superclassName, new VariableRef("classLoader", OBJECT_PTR), new IntegerConstant(sootClass.getModifiers()), sizeof(classFieldsType), sizeof(instanceFieldsType))); for (SootClass iface : sootClass.getInterfaces()) { function.add(new Call(NVM_BC_ADD_INTERFACE, ENV, clazz.ref(), getString(getInternalName(iface)))); } for (SootField field : classFields) { FunctionRef getter = new FunctionRef(mangleField(field) + "_getter", new FunctionType(getType(field.getType()), ENV_PTR)); FunctionRef setter = new FunctionRef(mangleField(field) + "_setter", new FunctionType(VOID, ENV_PTR, getType(field.getType()))); function.add(new Call(NVM_BC_ADD_FIELD, ENV, clazz.ref(), getString(field.getName()), getString(getDescriptor(field.getType())), new IntegerConstant(field.getModifiers()), offsetof(classFieldsType, classFields.indexOf(field)), new ConstantBitcast(getter, I8_PTR), new ConstantBitcast(setter, I8_PTR))); } for (SootField field : instanceFields) { FunctionRef getter = new FunctionRef(mangleField(field) + "_getter", new FunctionType(getType(field.getType()), ENV_PTR, OBJECT_PTR)); FunctionRef setter = new FunctionRef(mangleField(field) + "_setter", new FunctionType(VOID, ENV_PTR, OBJECT_PTR, getType(field.getType()))); function.add(new Call(NVM_BC_ADD_FIELD, ENV, clazz.ref(), getString(field.getName()), getString(getDescriptor(field.getType())), new IntegerConstant(field.getModifiers()), offsetof(instanceFieldsType, instanceFields.indexOf(field)), new ConstantBitcast(getter, I8_PTR), new ConstantBitcast(setter, I8_PTR))); } if (!sootClass.declaresMethodByName("<clinit>") && hasConstantValueTags(classFields)) { Value functionRef = new ConstantBitcast( new FunctionRef(mangleMethod(getInternalName(sootClass), "<clinit>", new ArrayList<soot.Type>(), soot.VoidType.v()), new FunctionType(VOID, ENV_PTR)), I8_PTR); function.add(new Call(NVM_BC_ADD_METHOD, ENV, clazz.ref(), getString("<clinit>"), getString("()V"), new IntegerConstant(Modifier.STATIC), functionRef, new NullConstant(I8_PTR), new NullConstant(I8_PTR))); } for (SootMethod method : sootClass.getMethods()) { Value functionRef = new NullConstant(I8_PTR); Value synchronizedRef = new NullConstant(I8_PTR); Value lookup = new NullConstant(I8_PTR); if (!method.isAbstract()) { functionRef = new ConstantBitcast(new FunctionRef(mangleMethod(method), getFunctionType(method)), I8_PTR); } if (!method.isAbstract() && method.isSynchronized()) { synchronizedRef = new ConstantBitcast(new FunctionRef(mangleMethod(method) + "_synchronized", getFunctionType(method)), I8_PTR); } if (!method.isStatic() && !"<init>".equals(method.getName()) && !method.isPrivate() && !Modifier.isFinal(method.getModifiers())) { // Virtual method. If not defined in a superclass we need to create a virtual lookup function now. if (!ancestorDeclaresMethod(sootClass, method)) { lookup = new ConstantBitcast(new FunctionRef(mangleMethod(method) + "_lookup", getFunctionType(method)), I8_PTR); } } function.add(new Call(NVM_BC_ADD_METHOD, ENV, clazz.ref(), getString(method.getName()), getString(getDescriptor(method)), new IntegerConstant(method.getModifiers()), functionRef, synchronizedRef, lookup)); } function.add(new Call(NVM_BC_REGISTER_CLASS, ENV, clazz.ref())); function.add(new Store(clazz.ref(), THE_CLASS.ref())); function.add(new Ret(clazz.ref())); } private void fieldGetter(SootField field) { String name = mangleField(field) + "_getter"; Function function = null; Value fieldPtr = null; if (field.isStatic()) { function = module.newFunction(Linkage._private, name, new FunctionType(getType(field.getType()), ENV_PTR), "env"); fieldPtr = getClassFieldPtr(function, field); } else { function = module.newFunction(Linkage._private, name, new FunctionType(getType(field.getType()), ENV_PTR, OBJECT_PTR), "env", "this"); fieldPtr = getInstanceFieldPtr(function, new VariableRef("this", OBJECT_PTR), field); } Variable result = function.newVariable(getType(field.getType())); function.add(new Load(result, fieldPtr)); function.add(new Ret(new VariableRef(result))); } private void fieldSetter(SootField field) { String name = mangleField(field) + "_setter"; Function function = null; Value fieldPtr = null; if (field.isStatic()) { function = module.newFunction(Linkage._private, name, new FunctionType(VOID, ENV_PTR, getType(field.getType())), "env", "value"); fieldPtr = getClassFieldPtr(function, field); } else { function = module.newFunction(Linkage._private, name, new FunctionType(VOID, ENV_PTR, OBJECT_PTR, getType(field.getType())), "env", "this", "value"); fieldPtr = getInstanceFieldPtr(function, new VariableRef("this", OBJECT_PTR), field); } function.add(new Store(new VariableRef("value", getType(field.getType())), fieldPtr)); function.add(new Ret()); } private void virtualLookupFunction(SootMethod method) { // TODO: This should use a virtual method table or interface method table. String name = mangleMethod(method) + "_lookup"; Function function = createFunction(name, method); FunctionType functionType = function.getType(); Variable fptr = function.newVariable(I8_PTR); Value nameRef = getString(method.getName()); Value descRef = getString(getDescriptor(method.makeRef())); if (sootClass.isInterface()) { function.add(new Call(fptr, NVM_BC_LOOKUP_INTERFACE_METHOD, ENV, getCaller(function), new VariableRef("this", OBJECT_PTR), nameRef, descRef)); } else { function.add(new Call(fptr, NVM_BC_LOOKUP_VIRTUAL_METHOD, ENV, getCaller(function), new VariableRef("this", OBJECT_PTR), nameRef, descRef)); } Variable f = function.newVariable(functionType); function.add(new Bitcast(f, fptr.ref(), function.getType())); String[] parameterNames = function.getParameterNames(); Type[] parameterTypes = function.getType().getParameterTypes(); Value[] args = new Value[parameterNames.length]; for (int i = 0; i < args.length; i++) { args[i] = new VariableRef(parameterNames[i], parameterTypes[i]); } if (function.getType().getReturnType() == VOID) { function.add(new Call(f.ref(), args)); function.add(new Ret()); } else { Variable result = function.newVariable(functionType.getReturnType()); function.add(new Call(result, f.ref(), args)); function.add(new Ret(result.ref())); } } private static byte[] stringToModifiedUtf8(String unicode) { List<Byte> s = new ArrayList<Byte>(); for (int i = 0; i < unicode.length(); i++) { int ch = unicode.charAt(i); if (ch == 0) { s.add((byte) 0xc0); s.add((byte) 0x80); } else if (ch < 0x80) { s.add((byte) ch); } else if(ch < 0x800) { int b5_0 = ch & 0x3f; int b10_6 = (ch >> 6) & 0x1f; s.add((byte) (0xc0 | b10_6)); s.add((byte) (0x80 | b5_0)); } else { int b5_0 = ch & 0x3f; int b11_6 = (ch >> 6) & 0x3f; int b15_12 = (ch >> 12) & 0xf; s.add((byte) (0xe0 | b15_12)); s.add((byte) (0x80 | b11_6)); s.add((byte) (0x80 | b5_0)); } } s.add((byte) 0); byte[] result = new byte[s.size()]; for (int i = 0; i < result.length; i++) { result[i] = s.get(i); } return result; } private static List<SootField> getFields(SootClass clazz, boolean ztatic, boolean includeSuper) { List<SootField> l = new ArrayList<SootField>(); if (includeSuper && clazz.hasSuperclass()) { l.addAll(getFields(clazz.getSuperclass(), ztatic, true)); } for (SootField f : clazz.getFields()) { if (ztatic == f.isStatic()) { l.add(f); } } return l; } private static List<SootField> getClassFields(SootClass clazz, boolean includeSuper) { return getFields(clazz, true, includeSuper); } private static List<SootField> getInstanceFields(SootClass clazz, boolean includeSuper) { return getFields(clazz, false, includeSuper); } private static boolean hasConstantValueTags(List<SootField> classFields) { for (SootField field : classFields) { if (field.isFinal()) { for (Tag tag : field.getTags()) { if (tag instanceof ConstantValueTag) { return true; } } } } return false; } private static StructureType getType(String alias, List<SootField> fields) { List<Type> types = new ArrayList<Type>(); for (SootField field : fields) { types.add(getType(field.getType())); } if (!types.isEmpty()) { return new StructureType(alias, types.toArray(new Type[types.size()])); } return null; } private static StructureType getFieldsType(String alias, SootClass clazz, boolean ztatic, boolean includeSuper) { List<Type> types = new ArrayList<Type>(); for (SootField field : getFields(clazz, ztatic, includeSuper)) { types.add(getType(field.getType())); } if (!types.isEmpty()) { return new StructureType(alias, types.toArray(new Type[types.size()])); } return null; } /** * Resolves the {@link SootMethod} corresponding to a {@link SootMethodRef} * in the specified {@link SootClass}. We cannot use {@link SootMethodRef#resolve()} * since it will search super classes and it will create a method with a * body which throws java.lang.Error if the method doesn't exist. */ private static SootMethod resolveMethod(SootClass c, SootMethodRef methodRef) { if (!methodRef.declaringClass().equals(c)) { return null; } String name = methodRef.name(); List<?> parameterTypes = methodRef.parameterTypes(); soot.Type returnType = methodRef.returnType(); if (!c.declaresMethod(name, parameterTypes, returnType)) { return null; } return c.getMethod(name, parameterTypes, returnType); } private static boolean ancestorDeclaresMethod(SootClass c, SootMethod method) { if (c.isInterface()) { return false; } String name = method.getName(); List<?> parameterTypes = method.getParameterTypes(); soot.Type returnType = method.getReturnType(); while (c.hasSuperclass()) { if (c.getSuperclass().declaresMethod(name, parameterTypes, returnType)) { return true; } c = c.getSuperclass(); } return false; } private static Type getType(String desc) { switch (desc.charAt(0)) { case 'Z': return I8; case 'B': return I8; case 'S': return I16; case 'C': return I16; case 'I': return I32; case 'J': return I64; case 'F': return FLOAT; case 'D': return DOUBLE; case 'V': return VOID; case 'L': return OBJECT_PTR; case '[': return OBJECT_PTR; } throw new IllegalArgumentException(); } private static Type getLocalType(soot.Type sootType) { Type t = getType(sootType); if (t instanceof IntegerType && ((IntegerType) t).getBits() < 32) { return I32; } return t; } private static Type getType(soot.Type sootType) { if (sootType.equals(soot.BooleanType.v())) { return Type.I8; } else if (sootType.equals(soot.ByteType.v())) { return Type.I8; } else if (sootType.equals(soot.ShortType.v())) { return Type.I16; } else if (sootType.equals(soot.CharType.v())) { return Type.I16; } else if (sootType.equals(soot.IntType.v())) { return Type.I32; } else if (sootType.equals(soot.LongType.v())) { return Type.I64; } else if (sootType.equals(soot.FloatType.v())) { return Type.FLOAT; } else if (sootType.equals(soot.DoubleType.v())) { return Type.DOUBLE; } else if (sootType.equals(soot.VoidType.v())) { return Type.VOID; } else if (sootType instanceof soot.RefLikeType || sootType.equals(BottomType.v())) { return OBJECT_PTR; } else { throw new IllegalArgumentException("Unknown Type: " + sootType); } } private static FunctionRef getArrayLoad(soot.Type sootType) { if (sootType.equals(soot.BooleanType.v())) { return BALOAD; } else if (sootType.equals(soot.ByteType.v())) { return BALOAD; } else if (sootType.equals(soot.ShortType.v())) { return SALOAD; } else if (sootType.equals(soot.CharType.v())) { return CALOAD; } else if (sootType.equals(soot.IntType.v())) { return IALOAD; } else if (sootType.equals(soot.LongType.v())) { return LALOAD; } else if (sootType.equals(soot.FloatType.v())) { return FALOAD; } else if (sootType.equals(soot.DoubleType.v())) { return DALOAD; } else if (sootType instanceof soot.RefLikeType) { return AALOAD; } else { throw new IllegalArgumentException("Unknown Type: " + sootType); } } private static FunctionRef getArrayStore(soot.Type sootType) { if (sootType.equals(soot.BooleanType.v())) { return BASTORE; } else if (sootType.equals(soot.ByteType.v())) { return BASTORE; } else if (sootType.equals(soot.ShortType.v())) { return SASTORE; } else if (sootType.equals(soot.CharType.v())) { return CASTORE; } else if (sootType.equals(soot.IntType.v())) { return IASTORE; } else if (sootType.equals(soot.LongType.v())) { return LASTORE; } else if (sootType.equals(soot.FloatType.v())) { return FASTORE; } else if (sootType.equals(soot.DoubleType.v())) { return DASTORE; } else if (sootType instanceof soot.RefLikeType) { return AASTORE; } else { throw new IllegalArgumentException("Unknown Type: " + sootType); } } private static FunctionRef getNewArray(soot.Type sootType) { if (sootType.equals(soot.BooleanType.v())) { return NVM_BC_NEW_BOOLEAN_ARRAY; } else if (sootType.equals(soot.ByteType.v())) { return NVM_BC_NEW_BYTE_ARRAY; } else if (sootType.equals(soot.ShortType.v())) { return NVM_BC_NEW_SHORT_ARRAY; } else if (sootType.equals(soot.CharType.v())) { return NVM_BC_NEW_CHAR_ARRAY; } else if (sootType.equals(soot.IntType.v())) { return NVM_BC_NEW_INT_ARRAY; } else if (sootType.equals(soot.LongType.v())) { return NVM_BC_NEW_LONG_ARRAY; } else if (sootType.equals(soot.FloatType.v())) { return NVM_BC_NEW_FLOAT_ARRAY; } else if (sootType.equals(soot.DoubleType.v())) { return NVM_BC_NEW_DOUBLE_ARRAY; } else { throw new IllegalArgumentException("Unknown Type: " + sootType); } } // private Value cast(Context ctx, Value value, Type targetType, soot.Type sootSourceType) { // value = widen(ctx, value, targetType, sootSourceType); // if (value.isInteger() && targetType instanceof IntegerType) { // IntegerType t1 = (IntegerType) targetType; // IntegerType t2 = (IntegerType) value.getType(); // if (t1.getBits() < t2.getBits()) { // Variable result = ctx.f().newVariable(targetType); // ctx.f().add(new Trunc(result, value, targetType)); // return new VariableRef(result); // } // } // return value; // } // private Value widen(Context ctx, Value value, Type targetType, soot.Type sootSourceType) { // return widen(ctx, value, targetType, sootSourceType.equals(CharType.v())); // } // // private Value widen(Context ctx, Value value, Type targetType, boolean unsigned) { // /* // * Soot only emits CastExpr for widening integer conversions when the // * target type is long or if the source type doesn't fit in the target // * type (e.g. char -> short). // */ // if (value.isInteger() && targetType instanceof IntegerType) { // IntegerType t1 = (IntegerType) targetType; // IntegerType t2 = (IntegerType) value.getType(); // if (t1.getBits() > t2.getBits()) { // Variable result = ctx.f().newVariable(targetType); // if (unsigned) { // ctx.f().add(new Zext(result, value, targetType)); // } else { // ctx.f().add(new Sext(result, value, targetType)); // } // return new VariableRef(result); // } // } // return value; // } private void addTrampoline(Trampoline trampoline, FunctionType functionType) { if (!trampolines.containsKey(trampoline)) { String functionName = trampoline.getClass().getSimpleName() + "_" + mangleString(trampoline.toString()); FunctionRef ref = new FunctionRef(functionName, functionType); trampolines.put(trampoline, ref); } } private static String getStringVarName(byte[] bytes) { StringBuilder sb = new StringBuilder("\"str_"); for (int i = 0; i < bytes.length; i++) { byte b = bytes[i]; if (b < ' ' || b > '~' || b == '"' || b == '\\' || b == '%' || b == '@') { sb.append(String.format("%%%02X", b)); } else { sb.append((char) b); } } sb.append("\""); return sb.toString(); } private Constant getString(String string) { Global g = strings.get(string); if (g == null) { byte[] modUtf8 = stringToModifiedUtf8(string); g = new Global(getStringVarName(modUtf8), Linkage.linker_private, new StringConstant(modUtf8), true); strings.put(string, g); } return new ConstantGetelementptr(new GlobalRef(g), 0, 0); } protected Value immediate(Context ctx, Immediate v) { // v is either a soot.Local or a soot.jimple.Constant if (v instanceof soot.Local) { Local local = (Local) v; Type type = getLocalType(v.getType()); VariableRef var = new VariableRef(local.getName(), new PointerType(type)); Variable tmp = ctx.f().newVariable(type); ctx.f().add(new Load(tmp, var)); return new VariableRef(tmp); } else if (v instanceof soot.jimple.IntConstant) { return new IntegerConstant(((soot.jimple.IntConstant) v).value); } else if (v instanceof soot.jimple.LongConstant) { return new IntegerConstant(((soot.jimple.LongConstant) v).value); } else if (v instanceof soot.jimple.FloatConstant) { return new FloatingPointConstant(((soot.jimple.FloatConstant) v).value); } else if (v instanceof soot.jimple.DoubleConstant) { return new FloatingPointConstant(((soot.jimple.DoubleConstant) v).value); } else if (v instanceof soot.jimple.NullConstant) { return new NullConstant(OBJECT_PTR); } else if (v instanceof soot.jimple.StringConstant) { String s = ((soot.jimple.StringConstant) v).value; Value string = getString(s); return callOrInvoke(ctx, NVM_BC_LDC_STRING, ENV, string); } else if (v instanceof soot.jimple.ClassConstant) { Value clazz = getString(((soot.jimple.ClassConstant) v).getValue()); return callOrInvoke(ctx, NVM_BC_LDC_CLASS, ENV, clazz, getCaller(ctx)); } throw new IllegalArgumentException("Unknown Immediate type: " + v.getClass()); } private boolean canAccessDirectly(Context context, FieldRef ref) { if (ref.getFieldRef().declaringClass().equals(sootClass)) { /* * The field ref refers to the current class. Resolve the field and * check that it is actually declared in the current class. */ SootField field; try { field = ref.getField(); } catch (ResolutionFailedException e) { return false; } if (!field.getDeclaringClass().equals(sootClass) || field.isPhantom()) { return false; } if (field.isStatic()) { // Static fields have to be accessed using getstatic/putstatic. // If not we want an exception to be thrown so we need a trampoline. return ref instanceof StaticFieldRef; } // Instance fields have to be accessed using getfield/putfield. // If not we want an exception to be thrown so we need a trampoline. return ref instanceof InstanceFieldRef; } return false; } private boolean canCallDirectly(Context context, InvokeExpr expr) { SootMethodRef methodRef = expr.getMethodRef(); SootMethod method = resolveMethod(sootClass, methodRef); if (method != null) { if (method.isAbstract() || method.isPhantom()) { return false; } /* * The method exists and isn't abstract. Non virtual (invokespecial) * as well as static calls and calls to final methods can be done directly. */ if (method.isStatic()) { // Static methods must be called using invokestatic. If not we // want an exception to be thrown so we need a trampoline. return expr instanceof StaticInvokeExpr; } if (expr instanceof SpecialInvokeExpr) { return true; } if (expr instanceof VirtualInvokeExpr) { // Either the class or the method have to be final return Modifier.isFinal(sootClass.getModifiers()) || Modifier.isFinal(method.getModifiers()); } } return false; } private Value widenToI32Value(Context ctx, Value value, boolean unsigned) { Type type = value.getType(); if (type instanceof IntegerType && ((IntegerType) type).getBits() < 32) { Variable t = ctx.f().newVariable(I32); if (unsigned) { ctx.f().add(new Zext(t, value, I32)); } else { ctx.f().add(new Sext(t, value, I32)); } return t.ref(); } else { return value; } } private Value narrowFromI32Value(Context ctx, Type type, Value value) { if (value.getType() == I32 && ((IntegerType) type).getBits() < 32) { Variable t = ctx.f().newVariable(type); ctx.f().add(new Trunc(t, value, type)); value = t.ref(); } return value; } private Value[] narrowFromI32Values(Context ctx, Type[] types, Value[] values) { Value[] newValues = new Value[values.length]; int i = 0; for (Type type : types) { newValues[i] = narrowFromI32Value(ctx, type, values[i]); i++; } return newValues; } private Value call(Context ctx, Value function, Value ... args) { Variable result = null; Type returnType = ((FunctionType) function.getType()).getReturnType(); if (returnType != VOID) { result = ctx.f().newVariable(returnType); } ctx.f().add(new Call(result, function, args)); return result == null ? null : result.ref(); } private Value callOrInvoke(Context ctx, Value function, Value ... args) { Variable result = null; Type returnType = ((FunctionType) function.getType()).getReturnType(); if (returnType != VOID) { result = ctx.f().newVariable(returnType); } if (ctx.hasTrap(ctx.getCurrentUnit())) { Label label = new Label(); BasicBlockRef to = ctx.f().newBasicBlockRef(label); BasicBlockRef unwind = ctx.f().newBasicBlockRef(new Label(ctx.getCurrentTraps())); ctx.f().add(new Invoke(result, function, to, unwind, args)); ctx.f().newBasicBlock(label); ctx.recordCurrentTraps(); } else { ctx.f().add(new Call(result, function, args)); } return result == null ? null : result.ref(); } private Value callOrInvokeTrampoline(Context ctx, Trampoline trampoline, Value ... args) { FunctionRef f = trampolines.get(trampoline); String name = f.getName().substring(1); Variable ptr = ctx.f().newVariable(f.getType()); ctx.f().add(new Load(ptr, new GlobalRef(name + "_ptr", f.getType()))); return callOrInvoke(ctx, ptr.ref(), args); } private void callTrampoline(Function function, Trampoline trampoline, Variable result, Value ... args) { FunctionRef f = trampolines.get(trampoline); String name = f.getName().substring(1); Variable ptr = function.newVariable(f.getType()); function.add(new Load(ptr, new GlobalRef(name + "_ptr", f.getType()))); function.add(new Call(result, ptr.ref(), args)); } @SuppressWarnings("unchecked") private Value invokeExpr(Context ctx, Stmt stmt, InvokeExpr expr) { SootMethodRef methodRef = expr.getMethodRef(); ArrayList<Value> args = new ArrayList<Value>(); args.add(ENV); if (!(expr instanceof StaticInvokeExpr)) { Value base = immediate(ctx, (Immediate) ((InstanceInvokeExpr) expr).getBase()); checkNull(ctx, base); args.add(base); } int i = 0; for (soot.Value sootArg : (List<soot.Value>) expr.getArgs()) { Value arg = immediate(ctx, (Immediate) sootArg); args.add(narrowFromI32Value(ctx, getType(methodRef.parameterType(i)), arg)); i++; } Value result = null; if (canCallDirectly(ctx, expr)) { Value function = null; if (resolveMethod(sootClass, methodRef).isSynchronized()) { function = new FunctionRef(mangleMethod(methodRef) + "_synchronized", getFunctionType(methodRef)); } else { function = new FunctionRef(mangleMethod(methodRef), getFunctionType(methodRef)); } result = callOrInvoke(ctx, function, args.toArray(new Value[0])); } else { Trampoline trampoline = null; String targetClassName = getInternalName(methodRef.declaringClass()); String methodName = methodRef.name(); String methodDesc = getDescriptor(methodRef); if (expr instanceof SpecialInvokeExpr) { soot.Type runtimeType = ((SpecialInvokeExpr) expr).getBase().getType(); String runtimeClassName = runtimeType == NullType.v() ? targetClassName : getInternalName(runtimeType); trampoline = new Invokespecial(runtimeClassName, targetClassName, methodName, methodDesc); } else if (expr instanceof StaticInvokeExpr) { trampoline = new Invokestatic(targetClassName, methodName, methodDesc); } else if (expr instanceof VirtualInvokeExpr) { soot.Type runtimeType = ((VirtualInvokeExpr) expr).getBase().getType(); String runtimeClassName = runtimeType == NullType.v() ? targetClassName : getInternalName(runtimeType); trampoline = new Invokevirtual(runtimeClassName, targetClassName, methodName, methodDesc); } else if (expr instanceof InterfaceInvokeExpr) { trampoline = new Invokeinterface(targetClassName, methodName, methodDesc); } addTrampoline(trampoline, getFunctionType(methodRef)); result = callOrInvokeTrampoline(ctx, trampoline, args.toArray(new Value[0])); } if (result != null) { return widenToI32Value(ctx, result, methodRef.returnType().equals(CharType.v())); } else { return null; } } private void checkNull(Context ctx, Value base) { Stmt stmt = (Stmt) ctx.getCurrentUnit(); NullCheckTag nullCheckTag = (NullCheckTag) stmt.getTag("NullCheckTag"); if (nullCheckTag == null || nullCheckTag.needCheck()) { callOrInvoke(ctx, CHECK_NULL, ENV, base); } } private void checkBounds(Context ctx, Value base, Value index) { Stmt stmt = (Stmt) ctx.getCurrentUnit(); ArrayCheckTag arrayCheckTag = (ArrayCheckTag) stmt.getTag("ArrayCheckTag"); if (arrayCheckTag == null || arrayCheckTag.isCheckLower()) { callOrInvoke(ctx, CHECK_LOWER, ENV, base, index); } if (arrayCheckTag == null || arrayCheckTag.isCheckUpper()) { callOrInvoke(ctx, CHECK_UPPER, ENV, base, index); } } private static Constant sizeof(StructureType type) { if (type == null) { return new IntegerConstant(0); } return new ConstantPtrtoint( new ConstantGetelementptr(new NullConstant( new PointerType(type)), 1), I32); } private static Constant offsetof(StructureType type, int index) { return new ConstantPtrtoint( new ConstantGetelementptr(new NullConstant( new PointerType(type)), 0, index), I32); } private static Constant neg(Constant constant) { return new ConstantSub(new IntegerConstant(0), constant); } private Value getCaller(Context ctx) { return getCaller(ctx.f()); } private Value getCaller(Function f) { Variable caller = f.newVariable(CLASS_PTR); f.add(new Load(caller, THE_CLASS.ref())); return caller.ref(); } private Value getClassFieldPtr(Function f, SootField field) { Variable base = f.newVariable(CLASS_PTR); f.add(new Load(base, new GlobalRef(THE_CLASS))); return getFieldPtr(f, new VariableRef(base), sizeof(CLASS), field, classFields, classFieldsType); } private Value getInstanceFieldPtr(Function f, Value base, SootField field) { return getFieldPtr(f, base, sizeof(OBJECT), field, allInstanceFields, instanceFieldsType); } private Value getFieldPtr(Function f, Value base, Constant baseOffset, SootField field, List<SootField> fields, StructureType fieldsType) { int index = fields.indexOf(field); Value offset = new ConstantAdd(baseOffset, offsetof(fieldsType, index)); Variable baseI8Ptr = f.newVariable(I8_PTR); f.add(new Bitcast(baseI8Ptr, base, I8_PTR)); Variable fieldI8Ptr = f.newVariable(I8_PTR); f.add(new Getelementptr(fieldI8Ptr, new VariableRef(baseI8Ptr), offset)); Variable fieldPtr = f.newVariable(new PointerType(getType(field.getType()))); f.add(new Bitcast(fieldPtr, new VariableRef(fieldI8Ptr), fieldPtr.getType())); return new VariableRef(fieldPtr); } private void assign(Context ctx, DefinitionStmt stmt) { /* * leftOp is either a Local, an ArrayRef or a FieldRef * rightOp is either a Local, a Ref, or an Expr */ soot.Value rightOp = stmt.getRightOp(); // Type rightType = getLocalType(rightOp.getType()); Value result; if (rightOp instanceof Immediate) { Immediate immediate = (Immediate) rightOp; result = immediate(ctx, immediate); } else if (rightOp instanceof ThisRef) { result = new VariableRef("this", OBJECT_PTR); } else if (rightOp instanceof ParameterRef) { ParameterRef ref = (ParameterRef) rightOp; Value p = new VariableRef("p" + ref.getIndex(), getType(ref.getType())); result = widenToI32Value(ctx, p, isUnsigned(ref.getType())); } else if (rightOp instanceof CaughtExceptionRef) { result = call(ctx, NVM_BC_EXCEPTION_CLEAR, ENV); } else if (rightOp instanceof ArrayRef) { ArrayRef ref = (ArrayRef) rightOp; VariableRef base = (VariableRef) immediate(ctx, (Immediate) ref.getBase()); Value index = immediate(ctx, (Immediate) ref.getIndex()); checkNull(ctx, base); checkBounds(ctx, base, index); result = callOrInvoke(ctx, getArrayLoad(ref.getType()), base, index); result = widenToI32Value(ctx, result, isUnsigned(ref.getType())); } else if (rightOp instanceof InstanceFieldRef) { InstanceFieldRef ref = (InstanceFieldRef) rightOp; Value base = immediate(ctx, (Immediate) ref.getBase()); checkNull(ctx, base); if (canAccessDirectly(ctx, ref)) { Variable v = ctx.f().newVariable(getType(ref.getType())); ctx.f().add(new Load(v, getInstanceFieldPtr(ctx.f(), base, ref.getField()))); result = widenToI32Value(ctx, v.ref(), isUnsigned(ref.getType())); } else { soot.Type runtimeType = ref.getBase().getType(); String targetClassName = getInternalName(ref.getFieldRef().declaringClass()); String runtimeClassName = runtimeType == NullType.v() ? targetClassName : getInternalName(runtimeType); Trampoline trampoline = new GetField(runtimeClassName, targetClassName, ref.getFieldRef().name(), getDescriptor(ref.getFieldRef().type())); addTrampoline(trampoline, new FunctionType(getType(ref.getType()), ENV_PTR, OBJECT_PTR)); result = callOrInvokeTrampoline(ctx, trampoline, ENV, base); result = widenToI32Value(ctx, result, isUnsigned(ref.getType())); } } else if (rightOp instanceof StaticFieldRef) { StaticFieldRef ref = (StaticFieldRef) rightOp; if (canAccessDirectly(ctx, ref)) { Variable v = ctx.f().newVariable(getType(ref.getType())); ctx.f().add(new Load(v, getClassFieldPtr(ctx.f(), ref.getField()))); result = widenToI32Value(ctx, v.ref(), isUnsigned(ref.getType())); } else { Trampoline trampoline = new GetStatic(getInternalName(ref.getFieldRef().declaringClass()), ref.getFieldRef().name(), getDescriptor(ref.getFieldRef().type())); addTrampoline(trampoline, new FunctionType(getType(ref.getType()), ENV_PTR)); result = callOrInvokeTrampoline(ctx, trampoline, ENV); result = widenToI32Value(ctx, result, isUnsigned(ref.getType())); } } else if (rightOp instanceof Expr) { if (rightOp instanceof BinopExpr) { BinopExpr expr = (BinopExpr) rightOp; Type rightType = getLocalType(expr.getType()); Variable resultVar = ctx.f().newVariable(rightType); result = resultVar.ref(); Value op1 = immediate(ctx, (Immediate) expr.getOp1()); Value op2 = immediate(ctx, (Immediate) expr.getOp2()); if (rightOp instanceof AddExpr) { if (rightType instanceof IntegerType) { ctx.f().add(new Add(resultVar, op1, op2)); } else { ctx.f().add(new Fadd(resultVar, op1, op2)); } } else if (rightOp instanceof AndExpr) { ctx.f().add(new And(resultVar, op1, op2)); } else if (rightOp instanceof CmpExpr) { Variable t1 = ctx.f().newVariable(I1); Variable t2 = ctx.f().newVariable(I1); Variable t3 = ctx.f().newVariable(resultVar.getType()); Variable t4 = ctx.f().newVariable(resultVar.getType()); ctx.f().add(new Icmp(t1, Condition.slt, op1, op2)); ctx.f().add(new Icmp(t2, Condition.sgt, op1, op2)); ctx.f().add(new Zext(t3, new VariableRef(t1), resultVar.getType())); ctx.f().add(new Zext(t4, new VariableRef(t2), resultVar.getType())); ctx.f().add(new Sub(resultVar, new VariableRef(t4), new VariableRef(t3))); } else if (rightOp instanceof DivExpr) { if (rightType instanceof IntegerType) { FunctionRef f = rightType == I64 ? LDIV : IDIV; result = callOrInvoke(ctx, f, ENV, op1, op2); } else { // float or double ctx.f().add(new Fdiv(resultVar, op1, op2)); } } else if (rightOp instanceof MulExpr) { if (rightType instanceof IntegerType) { ctx.f().add(new Mul(resultVar, op1, op2)); } else { ctx.f().add(new Fmul(resultVar, op1, op2)); } } else if (rightOp instanceof OrExpr) { ctx.f().add(new Or(resultVar, op1, op2)); } else if (rightOp instanceof RemExpr) { if (rightType instanceof IntegerType) { FunctionRef f = rightType == I64 ? LREM : IREM; result = callOrInvoke(ctx, f, ENV, op1, op2); } else { // float or double ctx.f().add(new Frem(resultVar, op1, op2)); } } else if (rightOp instanceof ShlExpr || rightOp instanceof ShrExpr || rightOp instanceof UshrExpr) { IntegerType type = (IntegerType) op1.getType(); int bits = type.getBits(); Variable t = ctx.f().newVariable(op2.getType()); ctx.f().add(new And(t, op2, new IntegerConstant(bits - 1, (IntegerType) op2.getType()))); Value shift = t.ref(); if (((IntegerType) shift.getType()).getBits() < bits) { Variable tmp = ctx.f().newVariable(type); ctx.f().add(new Zext(tmp, shift, type)); shift = tmp.ref(); } if (rightOp instanceof ShlExpr) { ctx.f().add(new Shl(resultVar, op1, shift)); } else if (rightOp instanceof ShrExpr) { ctx.f().add(new Ashr(resultVar, op1, shift)); } else { ctx.f().add(new Lshr(resultVar, op1, shift)); } } else if (rightOp instanceof SubExpr) { if (rightType instanceof IntegerType) { ctx.f().add(new Sub(resultVar, op1, op2)); } else { ctx.f().add(new Fsub(resultVar, op1, op2)); } } else if (rightOp instanceof XorExpr) { ctx.f().add(new Xor(resultVar, op1, op2)); } else if (rightOp instanceof XorExpr) { ctx.f().add(new Xor(resultVar, op1, op2)); } else if (rightOp instanceof CmplExpr) { FunctionRef f = op1.getType() == FLOAT ? FCMPL : DCMPL; ctx.f().add(new Call(resultVar, f, op1, op2)); } else if (rightOp instanceof CmpgExpr) { FunctionRef f = op1.getType() == FLOAT ? FCMPG : DCMPG; ctx.f().add(new Call(resultVar, f, op1, op2)); } else { throw new IllegalArgumentException("Unknown type for rightOp: " + rightOp.getClass()); } } else if (rightOp instanceof CastExpr) { Value op = immediate(ctx, (Immediate) ((CastExpr) rightOp).getOp()); soot.Type sootTargetType = ((CastExpr) rightOp).getCastType(); soot.Type sootSourceType = ((CastExpr) rightOp).getOp().getType(); if (sootTargetType instanceof PrimType) { Type targetType = getType(sootTargetType); Type sourceType = getType(sootSourceType); if (targetType instanceof IntegerType && sourceType instanceof IntegerType) { // op is at least I32 and has already been widened if source type had fewer bits then I32 IntegerType toType = (IntegerType) targetType; IntegerType fromType = (IntegerType) op.getType(); Variable v = ctx.f().newVariable(toType); if (fromType.getBits() < toType.getBits()) { // Widening if (isUnsigned(sootSourceType)) { ctx.f().add(new Zext(v, op, toType)); } else { ctx.f().add(new Sext(v, op, toType)); } } else if (fromType.getBits() == toType.getBits()) { ctx.f().add(new Bitcast(v, op, toType)); } else { // Narrow ctx.f().add(new Trunc(v, op, toType)); } result = widenToI32Value(ctx, v.ref(), isUnsigned(sootTargetType)); } else if (targetType instanceof FloatingPointType && sourceType instanceof IntegerType) { // we always to a signed conversion since if op is char it has already been zero extended to I32 Variable v = ctx.f().newVariable(targetType); ctx.f().add(new Sitofp(v, op, targetType)); result = v.ref(); } else if (targetType instanceof FloatingPointType && sourceType instanceof FloatingPointType) { Variable v = ctx.f().newVariable(targetType); if (targetType == FLOAT && sourceType == DOUBLE) { ctx.f().add(new Fptrunc(v, op, targetType)); } else if (targetType == DOUBLE && sourceType == FLOAT) { ctx.f().add(new Fpext(v, op, targetType)); } else { ctx.f().add(new Bitcast(v, op, targetType)); } result = v.ref(); } else { // F2I, F2L, D2I, D2L FunctionRef f = null; if (targetType == I32 && sourceType == FLOAT) { f = F2I; } else if (targetType == I64 && sourceType == FLOAT) { f = F2L; } else if (targetType == I32 && sourceType == DOUBLE) { f = D2I; } else if (targetType == I64 && sourceType == DOUBLE) { f = D2L; } Variable v = ctx.f().newVariable(targetType); ctx.f().add(new Call(v, f, op)); result = v.ref(); } // } else if (sootTargetType instanceof soot.ArrayType) { // soot.ArrayType arrayType = (ArrayType) sootTargetType; // if (arrayType.baseType instanceof PrimType) { // // } } else { result = callOrInvoke(ctx, NVM_BC_CHECKCAST, ENV, op, getString(getInternalName(sootTargetType)), getCaller(ctx)); // int dimensions = 0; // Trampoline trampoline = null; // soot.Type checkType = sootTargetType; // if (checkType instanceof soot.ArrayType) { // dimensions = ((soot.ArrayType) checkType).numDimensions; // trampoline = new Checkcast(getInternalName(((soot.ArrayType) checkType).baseType)); // } else { // trampoline = new Checkcast(getInternalName(checkType)); // } // addTrampoline(trampoline, new FunctionType(OBJECT_PTR, ENV_PTR, OBJECT_PTR, I32)); // callOrInvokeTrampoline(ctx, trampoline, result, ENV, op, new IntegerConstant(dimensions)); } } else if (rightOp instanceof InstanceOfExpr) { Value op = immediate(ctx, (Immediate) ((InstanceOfExpr) rightOp).getOp()); soot.Type checkType = ((InstanceOfExpr) rightOp).getCheckType(); result = callOrInvoke(ctx, NVM_BC_INSTANCEOF, ENV, op, getString(getInternalName(checkType)), getCaller(ctx)); // int dimensions = 0; // Trampoline trampoline = null; // soot.Type checkType = ((InstanceOfExpr) rightOp).getCheckType(); // if (checkType instanceof soot.ArrayType) { // dimensions = ((soot.ArrayType) checkType).numDimensions; // trampoline = new Instanceof(getInternalName(((soot.ArrayType) checkType).baseType)); // } else { // trampoline = new Instanceof(getInternalName(checkType)); // } // addTrampoline(trampoline, new FunctionType(I8, ENV_PTR, OBJECT_PTR, I32)); // callOrInvokeTrampoline(ctx, trampoline, result, ENV, op, new IntegerConstant(dimensions)); } else if (rightOp instanceof NewExpr) { result = callOrInvoke(ctx, NVM_BC_NEW, ENV, getString(getInternalName(((NewExpr) rightOp).getBaseType())), getCaller(ctx)); } else if (rightOp instanceof NewArrayExpr) { NewArrayExpr expr = (NewArrayExpr) rightOp; Value size = immediate(ctx, (Immediate) expr.getSize()); if (expr.getBaseType() instanceof PrimType) { result = callOrInvoke(ctx, getNewArray(expr.getBaseType()), ENV, size); } else { result = callOrInvoke(ctx, NVM_BC_NEW_OBJECT_ARRAY, ENV, size, getString(getInternalName(expr.getType())), getCaller(ctx)); } } else if (rightOp instanceof NewMultiArrayExpr) { NewMultiArrayExpr expr = (NewMultiArrayExpr) rightOp; for (int i = 0; i < expr.getSizeCount(); i++) { Value size = immediate(ctx, (Immediate) expr.getSize(i)); Variable ptr = ctx.f().newVariable(new PointerType(I32)); ctx.f().add(new Getelementptr(ptr, dims.ref(), 0, i)); ctx.f().add(new Store(size, ptr.ref())); } Variable dimsI32 = ctx.f().newVariable(new PointerType(I32)); ctx.f().add(new Bitcast(dimsI32, dims.ref(), dimsI32.getType())); result = callOrInvoke(ctx, NVM_BC_NEW_MULTI_ARRAY, ENV, new IntegerConstant(expr.getSizeCount()), dimsI32.ref(), getString(getInternalName(expr.getType())), getCaller(ctx)); } else if (rightOp instanceof InvokeExpr) { result = invokeExpr(ctx, stmt, (InvokeExpr) rightOp); } else if (rightOp instanceof LengthExpr) { Value op = immediate(ctx, (Immediate) ((LengthExpr) rightOp).getOp()); checkNull(ctx, op); Variable v = ctx.f().newVariable(I32); ctx.f().add(new Call(v, ARRAY_LENGTH, op)); result = v.ref(); } else if (rightOp instanceof NegExpr) { NegExpr expr = (NegExpr) rightOp; Value op = immediate(ctx, (Immediate) expr.getOp()); Type rightType = op.getType(); Variable v = ctx.f().newVariable(op.getType()); if (rightType instanceof IntegerType) { ctx.f().add(new Sub(v, new IntegerConstant(0, (IntegerType) rightType), op)); } else { ctx.f().add(new Fmul(v, new FloatingPointConstant(-1.0, (FloatingPointType) rightType), op)); } result = v.ref(); } else { throw new IllegalArgumentException("Unknown type for rightOp: " + rightOp.getClass()); } } else { throw new IllegalArgumentException("Unknown type for rightOp: " + rightOp.getClass()); } soot.Value leftOp = stmt.getLeftOp(); if (leftOp instanceof Local) { Local local = (Local) leftOp; VariableRef v = new VariableRef(local.getName(), new PointerType(getLocalType(leftOp.getType()))); ctx.f().add(new Store(result, v)); } else { Type leftType = getType(leftOp.getType()); Value narrowedResult = narrowFromI32Value(ctx, leftType, result); if (leftOp instanceof ArrayRef) { ArrayRef ref = (ArrayRef) leftOp; VariableRef base = (VariableRef) immediate(ctx, (Immediate) ref.getBase()); Value index = immediate(ctx, (Immediate) ref.getIndex()); checkNull(ctx, base); checkBounds(ctx, base, index); callOrInvoke(ctx, getArrayStore(leftOp.getType()), base, index, narrowedResult); } else if (leftOp instanceof InstanceFieldRef) { InstanceFieldRef ref = (InstanceFieldRef) leftOp; Value base = immediate(ctx, (Immediate) ref.getBase()); checkNull(ctx, base); if (canAccessDirectly(ctx, ref)) { ctx.f().add(new Store(narrowedResult, getInstanceFieldPtr(ctx.f(), base, ref.getField()))); } else { soot.Type runtimeType = ref.getBase().getType(); String targetClassName = getInternalName(ref.getFieldRef().declaringClass()); String runtimeClassName = runtimeType == NullType.v() ? targetClassName : getInternalName(runtimeType); Trampoline trampoline = new PutField(runtimeClassName, targetClassName, ref.getFieldRef().name(), getDescriptor(ref.getFieldRef().type())); addTrampoline(trampoline, new FunctionType(VOID, ENV_PTR, OBJECT_PTR, leftType)); callOrInvokeTrampoline(ctx, trampoline, ENV, base, narrowedResult); } } else if (leftOp instanceof StaticFieldRef) { StaticFieldRef ref = (StaticFieldRef) leftOp; if (canAccessDirectly(ctx, ref)) { ctx.f().add(new Store(narrowedResult, getClassFieldPtr(ctx.f(), ref.getField()))); } else { Trampoline trampoline = new PutStatic(getInternalName(ref.getFieldRef().declaringClass()), ref.getFieldRef().name(), getDescriptor(ref.getFieldRef().type())); addTrampoline(trampoline, new FunctionType(VOID, ENV_PTR, leftType)); callOrInvokeTrampoline(ctx, trampoline, ENV, narrowedResult); } } else { throw new IllegalArgumentException("Unknown type for leftOp: " + leftOp.getClass()); } } } private static boolean isUnsigned(soot.Type type) { return type.equals(CharType.v()); } private void return_(Context ctx, ReturnStmt stmt) { /* * op is an Immediate. */ Value op = immediate(ctx, (Immediate) stmt.getOp()); Value value = narrowFromI32Value(ctx, ctx.f().getType().getReturnType(), op); ctx.f().add(new Ret(value)); } private void returnVoid(Context ctx) { ctx.f().add(new Ret()); } private void if_(Context ctx, IfStmt stmt) { ConditionExpr condition = (ConditionExpr) stmt.getCondition(); Value op1 = immediate(ctx, (Immediate) condition.getOp1()); Value op2 = immediate(ctx, (Immediate) condition.getOp2()); Icmp.Condition c = null; if (condition instanceof EqExpr) { c = Icmp.Condition.eq; } else if (condition instanceof NeExpr) { c = Icmp.Condition.ne; } else if (condition instanceof GtExpr) { c = Icmp.Condition.sgt; } else if (condition instanceof LtExpr) { c = Icmp.Condition.slt; } else if (condition instanceof GeExpr) { c = Icmp.Condition.sge; } else if (condition instanceof LeExpr) { c = Icmp.Condition.sle; } Variable result = ctx.f().newVariable(Type.I1); ctx.f().add(new Icmp(result, c, op1, op2)); ctx.f().add(new Br(new VariableRef(result), ctx.f().newBasicBlockRef(new Label(stmt.getTarget())), ctx.f().newBasicBlockRef(new Label(ctx.getNextUnit())))); } private void lookupSwitch(Context ctx, LookupSwitchStmt stmt) { Map<IntegerConstant, BasicBlockRef> targets = new HashMap<IntegerConstant, BasicBlockRef>(); for (int i = 0; i < stmt.getTargetCount(); i++) { int value = stmt.getLookupValue(i); Unit target = stmt.getTarget(i); targets.put(new IntegerConstant(value), ctx.f().newBasicBlockRef(new Label(target))); } BasicBlockRef def = ctx.f().newBasicBlockRef(new Label(stmt.getDefaultTarget())); Value key = immediate(ctx, (Immediate) stmt.getKey()); ctx.f().add(new Switch(key, def, targets)); } private void tableSwitch(Context ctx, TableSwitchStmt stmt) { Map<IntegerConstant, BasicBlockRef> targets = new HashMap<IntegerConstant, BasicBlockRef>(); for (int i = stmt.getLowIndex(); i <= stmt.getHighIndex(); i++) { Unit target = stmt.getTarget(i - stmt.getLowIndex()); targets.put(new IntegerConstant(i), ctx.f().newBasicBlockRef(new Label(target))); } BasicBlockRef def = ctx.f().newBasicBlockRef(new Label(stmt.getDefaultTarget())); Value key = immediate(ctx, (Immediate) stmt.getKey()); ctx.f().add(new Switch(key, def, targets)); } private void goto_(Context ctx, GotoStmt stmt) { ctx.f().add(new Br(ctx.f().newBasicBlockRef(new Label(stmt.getTarget())))); } private void throw_(Context ctx, ThrowStmt stmt) { Value obj = immediate(ctx, (Immediate) stmt.getOp()); checkNull(ctx, obj); if (ctx.hasTrap(stmt)) { ctx.f().add(new Call(NVM_BC_EXCEPTION_SET, ENV, obj)); ctx.f().add(new Br(ctx.f().newBasicBlockRef(new Label(ctx.getCurrentTraps())))); ctx.recordCurrentTraps(); } else { ctx.f().add(new Call(NVM_BC_THROW, ENV, obj)); ctx.f().add(new Unreachable()); } } private void invoke(Context context, InvokeStmt stmt) { invokeExpr(context, stmt, stmt.getInvokeExpr()); } private void enterMonitor(Context ctx, EnterMonitorStmt stmt) { Value op = immediate(ctx, (Immediate) stmt.getOp()); checkNull(ctx, op); callOrInvoke(ctx, NVM_BC_MONITOR_ENTER, ENV, op); } private void exitMonitor(Context ctx, ExitMonitorStmt stmt) { Value op = immediate(ctx, (Immediate) stmt.getOp()); checkNull(ctx, op); callOrInvoke(ctx, NVM_BC_MONITOR_EXIT, ENV, op); } private static String getInternalName(soot.Type t) { if (t instanceof soot.ArrayType) { return getDescriptor(t); } else if (t instanceof soot.RefType) { RefType rt = (RefType) t; return rt.getClassName().replace('.', '/'); } else { throw new IllegalArgumentException(); } } private static String getInternalName(SootClass sc) { return sc.getName().replace('.', '/'); } private static String getDescriptor(soot.Type t) { if (t instanceof PrimType) { if (t.equals(BooleanType.v())) { return "Z"; } else if (t.equals(ByteType.v())) { return "B"; } else if (t.equals(ShortType.v())) { return "S"; } else if (t.equals(CharType.v())) { return "C"; } else if (t.equals(IntType.v())) { return "I"; } else if (t.equals(LongType.v())) { return "J"; } else if (t.equals(FloatType.v())) { return "F"; } else { // DoubleType return "D"; } } else if (t.equals(VoidType.v())) { return "V"; } else if (t instanceof soot.ArrayType) { soot.ArrayType at = (soot.ArrayType) t; return "[" + getDescriptor(at.getElementType()); } else { // RefType RefType rt = (RefType) t; return "L" + rt.getClassName().replace('.', '/') + ";"; } } private static String getDescriptor(SootMethod method) { return getDescriptor(method.makeRef()); } @SuppressWarnings("unchecked") private static String getDescriptor(SootMethodRef methodRef) { StringBuilder sb = new StringBuilder(); sb.append('('); for (soot.Type t : (List<soot.Type>) methodRef.parameterTypes()) { sb.append(getDescriptor(t)); } sb.append(')'); sb.append(getDescriptor(methodRef.returnType())); return sb.toString(); } private static boolean isNative(SootMethod sm) { if (sm.isNative()) { return true; } // TODO: Check for @Native annotation return false; } private static FunctionType getFunctionType(String desc) { List<Type> paramTypes = new ArrayList<Type>(); int i = 1; while (true) { char c = desc.charAt(i); paramTypes.add(getType(desc.substring(i, 1))); while (c == '[') { c = desc.charAt(++i); } if (c == 'L') { while (c != ';') { c = desc.charAt(++i); } } i++; } } private static FunctionType getFunctionType(SootMethod method) { return getFunctionType(method.makeRef()); } @SuppressWarnings("unchecked") private static FunctionType getFunctionType(SootMethodRef methodRef) { Type returnType = getType(methodRef.returnType()); Type[] paramTypes = new Type[(methodRef.isStatic() ? 1 : 2) + methodRef.parameterTypes().size()]; int i = 0; paramTypes[i++] = ENV_PTR; if (!methodRef.isStatic()) { paramTypes[i++] = OBJECT_PTR; } for (soot.Type t : (List<soot.Type>) methodRef.parameterTypes()) { paramTypes[i++] = getType(t); } return new FunctionType(returnType, paramTypes); } private static String mangleMethod(SootMethod method) { return mangleMethod(method.makeRef()); } @SuppressWarnings("unchecked") private static String mangleMethod(SootMethodRef methodRef) { return mangleMethod(getInternalName(methodRef.declaringClass()), methodRef.name(), methodRef.parameterTypes(), methodRef.returnType()); } private static String mangleMethod(String owner, String name, List<soot.Type> parameterTypes, soot.Type returnType) { StringBuilder sb = new StringBuilder(); sb.append(mangleString(owner)); sb.append("_"); sb.append(mangleString(name)); if (!parameterTypes.isEmpty()) { sb.append("__"); for (soot.Type parameterType : parameterTypes) { sb.append(mangleString(getDescriptor(parameterType))); } } sb.append("__"); sb.append(mangleString(getDescriptor(returnType))); return sb.toString(); } public static String mangleNativeMethod(String owner, String name) { return mangleNativeMethod(owner, name, null); } public static String mangleNativeMethod(String owner, String name, String desc) { StringBuilder sb = new StringBuilder(); sb.append("Java_"); sb.append(mangleNativeString(owner)); sb.append("_"); sb.append(mangleNativeString(name)); if (desc != null && !desc.startsWith("()")) { sb.append("__"); sb.append(mangleNativeString(desc.substring(1, desc.lastIndexOf(')')))); } return sb.toString(); } public static String mangleNativeString(String name) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); if (c == '_') { sb.append("_1"); } else if (c == ';') { sb.append("_2"); } else if (c == '[') { sb.append("_3"); } else if (c == '/') { sb.append("_"); } else if (c > 0x7f) { sb.append(String.format("_0%04x", (int) c)); } else { sb.append(c); } } return sb.toString(); } private static String mangleField(SootField field) { return mangleField(getInternalName(field.getDeclaringClass()), field.getName(), field.getType()); } private static String mangleField(String owner, String name, soot.Type type) { StringBuilder sb = new StringBuilder(); sb.append(mangleString(owner)); sb.append("_"); sb.append(mangleString(name)); sb.append("__"); sb.append(mangleString(getDescriptor(type))); return sb.toString(); } private static String mangleString(String name) { byte[] s; try { s = name.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length; i++) { byte c = s[i]; if (c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z') { sb.append((char) c); } else if (c == '/') { sb.append('_'); } else { sb.append('$'); sb.append(HEX_CHARS[(c >> 4) & 0xf]); sb.append(HEX_CHARS[c & 0xf]); } } return sb.toString(); } public static class HelloWorld { private void a(long descriptor) throws Exception { if (descriptor < 0) { throw new IOException(); } } public void b(long descriptor) throws Exception { a(descriptor); } } private static String getSootClasspath(Clazzes clazzes) { StringBuilder sb = new StringBuilder(); for (Path path : clazzes.getPaths()) { if (sb.length() > 0) { sb.append(File.pathSeparator); } try { sb.append(path.getFile().getCanonicalPath()); } catch (IOException e) { throw new RuntimeException(e); } } return sb.toString(); } public static void init(Clazzes clazzes, List<Clazz> changed) { Options.v().set_output_format(Options.output_format_jimple); Options.v().setPhaseOption("jap.npc", "enabled:true"); Options.v().setPhaseOption("wjap.ra", "enabled:true"); Options.v().setPhaseOption("jap.abc", "enabled:true"); Options.v().setPhaseOption("tag.an", "enabled:true"); Options.v().set_print_tags_in_output(true); Options.v().set_allow_phantom_refs(true); Options.v().set_soot_classpath(getSootClasspath(clazzes)); for (Clazz clazz : changed) { Scene.v().loadClassAndSupport(clazz.getClassName()).setApplicationClass(); } Scene.v().loadNecessaryClasses(); /* * Hack: Remove the DeadAssignmentEliminator since it removes LDC instructions * which would have thrown a NoClassDefFoundError. * TODO: Report this to soot as a bug? */ Pack pack = PackManager.v().getPack("jb"); for (Iterator<?> it = pack.iterator(); it.hasNext();) { Transform t = (Transform) it.next(); if ("jb.dae".equals(t.getPhaseName())) { it.remove(); } } pack.insertAfter(new Transform("jb.dae", new BodyTransformer() { @SuppressWarnings("rawtypes") @Override protected void internalTransform(Body b, String phaseName, Map options) { } }), "jb.cp"); // PackManager.v().runPacks(); } // public static void main(String[] args) throws Exception { // List<File> bootClassPathFiles = new ArrayList<File>(); // bootClassPathFiles.add(new File("../rt/target/nullvm-rt-0.1-SNAPSHOT-all.jar")); // bootClassPathFiles.add(new File("target/classes")); // List<File> classPathFiles = new ArrayList<File>(); //// classPathFiles.add(new File("target/classes")); // Clazzes clazzes = new Clazzes(bootClassPathFiles, classPathFiles); // SootClassCompiler.init(clazzes); // // for (Path path : clazzes.getPaths()) { // for (Clazz clazz : path.list()) { // if ("org.nullvm.compiler.SootClassCompiler$HelloWorld".equals(clazz.getClassName())) { // System.out.println("Compiling " + clazz.getClassName()); // SootClassCompiler compiler = new SootClassCompiler(); // compiler.compile(clazz, System.out); // SootClass sootClass = Scene.v().getSootClass(clazz.getClassName()); // } // } // } // } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
62464f4f8fdc5482d0f778c1c33fe654d6097997
e10669c5d38b62bc40893752891e2afcda2bfebd
/my-student-financial-account-impl/src/main/java/edu/wisc/student/finance/ChargeDao.java
01ece583f6c3e1df18db4d6758791d468adc69e8
[]
no_license
nblair/my-student-financial-account
e9d54d52b7b8bd5a0f98ec8fafbb8f5890135be0
e275c82395d68ba06156c5d91db962cbad069a6a
refs/heads/master
2021-01-20T23:54:34.553554
2015-05-20T19:03:55
2015-05-20T19:03:55
32,325,136
0
0
null
2015-03-16T13:02:42
2015-03-16T13:02:42
null
UTF-8
Java
false
false
692
java
/** * */ package edu.wisc.student.finance; import java.util.Collection; import edu.wisc.student.finance.v1.ChargeType; /** * Simple Data Access interface for Charges. * * This is not intended to be an exportable API; it is used underneath the * {@link ChargeService} implementation and has a simple focus on data access. * * Implementations of this interface are not to apply business logic or security. * * @author Nicholas Blair */ public interface ChargeDao { /** * * @param studentIdentifier * @return never null, but potentially empty, collection of charges for a specified student */ Collection<ChargeType> getCharges( String studentIdentifier ); }
[ "nicholas.blair@wisc.edu" ]
nicholas.blair@wisc.edu
46f8a5940e44a774c2dda2d07ab46c74f7e18458
345d99dac20ece771f77a5cfbea3de5054f1c65d
/src/Ex18.java
67e945fe7b4083d8eb0772fe04a257793f85037e
[]
no_license
mcanteroa98/ExercicisStrings
21a6177a091b3ee9adfdb370f39a37447c0a8413
0372ac4a72973543ed2606435cbfac4f89aa2fb9
refs/heads/master
2020-12-19T15:13:03.854257
2020-02-04T22:48:18
2020-02-04T22:48:18
235,323,337
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
/* 18. Write a Java program to create a unique identifier of a given string. Sample Output: The hash for Python Exercises. is 863132599 */ /** * * @author bataparato */ public class Ex18 { }
[ "bataparato@192.168.1.3" ]
bataparato@192.168.1.3
36c93ccb08b78c3b31d3d4bf58abaca3241febe3
c745ee1a5bcc48e87cabff1a251f35b1791209d7
/test/src/main/java/com/demo/test/detail/Customer.java
ebd9f9ca3d4a9b5629ec4652accd8f76af1ec0d1
[]
no_license
shubhamgoel23/workspace
342dd8c86e317bd8dfd51e3ae8be196d81bf96f6
bb87e002119cc02641069cc73fa000e0bd0daa5d
refs/heads/master
2023-01-28T09:54:37.823544
2020-12-08T11:08:00
2020-12-08T11:08:00
259,534,073
0
0
null
2020-12-08T11:08:01
2020-04-28T04:49:20
HTML
UTF-8
Java
false
false
58
java
package com.demo.test.detail; public class Customer { }
[ "shubham.goel@prod.hclpnp.com" ]
shubham.goel@prod.hclpnp.com
b61af4ed57671d4249d99d75ce9d03891582f1e1
5e245ad244d253ff7a36d1b7df4033afbf9aba45
/code-examples/src/main/java/enums/color/ColorWriter.java
d6dcc36c6567fc734be35bc6731c5b3308fd0432
[]
no_license
dane-king/CodeExamples
655c67f991f32d3558b33177dbb10e3e31bd4585
01ff18d3a4f479b7d8a3f3f42dceaee8ea883231
refs/heads/main
2023-02-27T22:12:12.038638
2023-02-27T15:46:09
2023-02-27T15:46:29
3,892,805
0
1
null
2023-02-09T22:24:46
2012-04-01T13:52:34
Java
UTF-8
Java
false
false
157
java
package enums.color; public class ColorWriter { private int hexColor; public void setColor(final Color color) { hexColor = color.getHexCode(); } }
[ "kingd9@gmail.com" ]
kingd9@gmail.com
c5034d26490247036b3ab42d002974f842b7ea2f
9e375882851089ca2841b455a83b05433745ba35
/src/sample/Model.java
fa09cef186dcb852a133530360a56b75c387e2c1
[]
no_license
glopezma/Calculator
1f050e24e785ab47c4f649e28d907b6613ac2d84
e289334b2884b9964dacec9c6a11b663b6048a92
refs/heads/master
2021-07-19T17:57:45.585067
2017-10-26T15:55:04
2017-10-26T15:55:04
108,421,052
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
package sample; public class Model { public float calculate(long num1, long num2, String op) { switch (op) { case "+": return num1 + num2; case "-": return num1 - num2; case "*": return num1 * num2; case "/": if(num2 == 0) { return 0; } else { return num1 / num2; } default: break; } return 0; } }
[ "galopezmatthews@gmail.com" ]
galopezmatthews@gmail.com
75982be76f28ab8a3b8af92beafff9b5400f7edb
e565b96e4ecd8d405f66dc8a5a41c74aef4eb785
/src/main/java/com/gemalto/hibernate/demo/PrimaryKeyDemo.java
63bb7ef74f4f5b5654b94668dbcf386c553395f3
[]
no_license
archit-chandra/SpringMVCHibernate2-SpringMVCMavenApp
d2cc3936daf8bfe1537e1bd027960cc4c7b8577f
91c529f2b9139608be76b3651fbf88c7532f4c23
refs/heads/master
2021-04-12T11:34:53.671753
2018-06-23T23:34:19
2018-06-23T23:34:19
126,712,921
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
package com.gemalto.hibernate.demo; import com.gemalto.hibernate.entity.Student; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class PrimaryKeyDemo { public static void main(String[] args) { // create session factory SessionFactory factory = new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(Student.class) .buildSessionFactory(); // create session Session session = factory.getCurrentSession(); try { // create 3 student objects System.out.println("Creating 3 student objects..."); Student student1 = new Student("John", "Doe", "john@gamil.com"); Student student2 = new Student("Mary", "Public", "mary@gamil.com"); Student student3 = new Student("Bonita", "Applebum", "bonita@gamil.com"); // start a transaction session.beginTransaction(); // save the student object session.save(student1); session.save(student2); session.save(student3); System.out.println("Saving the student..."); // commit the transaction session.getTransaction().commit(); System.out.println("Done!"); } finally { factory.close(); } } }
[ "architbiet@gmail.com" ]
architbiet@gmail.com
52e597241df1277529e6c9e43e8704f51a33709f
64eccad5638f7b36746e4ca26f11569357af232d
/app/src/main/java/cn/kavelcortex/bookpriceculculator/util/Adapter/BookPickerAdapter.java
11c74e8301929114b4055d813a05360302dbb7b4
[]
no_license
KavelCortex/BookPriceCalculator
1d6f2195a5cbf546d2d5d0802af2328cf5f0440a
c37ce19234cf57155993a59c58e74aaa28191e67
refs/heads/master
2021-01-13T01:23:39.071115
2015-09-10T13:31:35
2015-09-10T13:31:35
42,246,127
0
0
null
null
null
null
UTF-8
Java
false
false
4,101
java
/* * Copyright (c) 2015 KavelCortex * * 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 cn.kavelcortex.bookpriceculculator.util.Adapter; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.ToggleButton; import java.util.ArrayList; import java.util.Map; import cn.kavelcortex.bookpriceculculator.R; /** * Created by 嘉维 on 2015/9/3. */ public class BookPickerAdapter extends RecyclerView.Adapter<BookPickerAdapter.BookPickButtonViewHolder>{ ArrayList<Map<String,Object>> mData; ArrayList<View>mViewMap = new ArrayList<>(); ItemCheckedChangedListener mListener; String ITEM_LOCATOR; public BookPickerAdapter(){} public void setItemData(ArrayList<Map<String, Object>> data){ mData = data; } public void setTagForLocateItem(String TAG){ ITEM_LOCATOR = TAG; } public void setOnItemCheckedChangedListener(ItemCheckedChangedListener listener){ mListener = listener; } public void addData(int toPosition,Map<String,Object> mapData){ mData.add(toPosition, mapData); notifyItemInserted(toPosition); } public void addData(Map<String,Object> mapData){ mData.add(mapData); notifyItemInserted(mData.size()); } public void delData(int fromPosition){ mData.remove(fromPosition); notifyItemRemoved(fromPosition); } public void delData(){ int lastPosition = getItemCount(); mData.remove(lastPosition); notifyItemRemoved(lastPosition); } @Override public int getItemCount() {return mData.size();} public View getView(int position){ return mViewMap.get(position); } @Override public BookPickButtonViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.book_pick_button_layout, parent, false); return new BookPickButtonViewHolder(v,mListener); } @Override public void onBindViewHolder(BookPickButtonViewHolder holder, int position) { int bookPosition = (int)mData.get(position).get(ITEM_LOCATOR); String bookSerial =String.valueOf(bookPosition+1); holder.toggleButton.setText(bookSerial); holder.toggleButton.setTextOn(bookSerial); holder.toggleButton.setTextOff(bookSerial); holder.position = position; if(mViewMap.size()>position) mViewMap.remove(position); mViewMap.add(position,holder.toggleButton); } /** * Created by 嘉维 on 2015/9/4. */ public interface ItemCheckedChangedListener { void onCheckedChanged(CompoundButton compoundButton, boolean b, int position); } public static class BookPickButtonViewHolder extends RecyclerView.ViewHolder implements CompoundButton.OnCheckedChangeListener{ public ToggleButton toggleButton; public ItemCheckedChangedListener mListener; public int position; public BookPickButtonViewHolder(View v, ItemCheckedChangedListener listener){ super(v); toggleButton = (ToggleButton)v.findViewById(R.id.book_pick_button); this.mListener = listener; toggleButton.setOnCheckedChangeListener(this); } @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { mListener.onCheckedChanged(compoundButton, b, position); } } }
[ "wjw_wwasd@qq.com" ]
wjw_wwasd@qq.com
bb61ef1224fe1f9074e386c99dd001b607ef5151
5876a99492784e9bd68e595973d76257c9ba7f9f
/src/main/java/com/wondertek/mybatis/plugin/MybatisConfig.java
ab12ab1e5c176bd565c3fbaeb93d7f525f82bf80
[]
no_license
zbcstudy/spring-boot-mybatis
dec0bf60895fa1b9b191f823c37e733e3e26f7e0
597c1a3d7fc7edb00d8a888ccb8cf37b6fc1547e
refs/heads/master
2020-03-26T06:19:05.787282
2019-03-08T15:43:05
2019-03-08T15:43:05
144,599,149
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.wondertek.mybatis.plugin; import org.apache.ibatis.plugin.Interceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class MybatisConfig { // @Bean // public Interceptor getInterceptor() { // System.out.println("注册拦截器"); // return new FirstPlugin(); // } /** * * @return */ @Bean public Interceptor getInterceptor() { return new SqlStatsInterceptor(); } }
[ "1434756304@qq.com" ]
1434756304@qq.com
527dbe77b726994ae07766fbadd73a96d696bf49
5c8a4e1224054e96df772bcfc900edc6d7e36b8b
/src/com/binroot/collar/MyContacts.java
9633754d6860d5665192e32bf67e3496d4d20558
[]
no_license
ilovejs/Collar
2dd55ea3d1d0abb6c2c209982c9eec7cdb3a2475
c10ae19a3b952778211016f9d980b2b167af1162
refs/heads/master
2021-01-18T05:18:37.096307
2013-05-14T20:36:46
2013-05-14T20:36:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,459
java
package com.binroot.collar; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; import android.database.CursorIndexOutOfBoundsException; import android.provider.ContactsContract; import java.util.ArrayList; /** * Created with IntelliJ IDEA. * User: binroot * Date: 5/12/13 * Time: 3:49 PM * To change this template use File | Settings | File Templates. */ public class MyContacts { private final String DEBUG = "MyContacts"; private final String DELIMITER = ",,"; public static final int TOP_BIAS = 0; public static final int NO_BIAS = 1; public static final int BOTTOM_BIAS = 2; private static MyContacts ourInstance = null; private ArrayList<Person> contactsList = null; private Context context = null; public static MyContacts getInstance(Context context) { if(ourInstance == null) { ourInstance = new MyContacts(context); } return ourInstance; } private MyContacts(Context context) { this.context = context; updateContacts(); } public Person pop(int bias) { if(contactsList.isEmpty()) return new Person("NO CONTACT FOUND", "0"); Person retPerson = new Person(contactsList.get(0)); contactsList.remove(0); if(bias == MyContacts.NO_BIAS) { addContactRandomly(contactsList, retPerson); } else if(bias == MyContacts.BOTTOM_BIAS) { addContactBottomBiased(contactsList, retPerson); } else if(bias == MyContacts.TOP_BIAS) { addContactTopBiased(contactsList, retPerson); } saveStoredContacts(contactsList); return retPerson; } private void updateContacts() { ArrayList<Person> freshContactsList = getFreshContacts(); ArrayList<Person> mergedList = merge(freshContactsList); saveStoredContacts(mergedList); contactsList = new ArrayList<Person>(mergedList); } private ArrayList<Person> getFreshContacts() { Cursor cursor = context.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); ArrayList<Person> freshContactsList = new ArrayList<Person>(); while(!cursor.isAfterLast()) { int hasNumberColumnIndex = cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER); try { String hasNumber = cursor.getString(hasNumberColumnIndex); if(hasNumber.equals("1")) { int idColumnIndex = cursor.getColumnIndex(ContactsContract.Contacts._ID); int displayNameColumnIndex = cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME); String id = cursor.getString(idColumnIndex); String displayName = cursor.getString(displayNameColumnIndex); freshContactsList.add(new Person(displayName, id)); } } catch(CursorIndexOutOfBoundsException exception) {} cursor.moveToNext(); } return freshContactsList; } private ArrayList<Person> merge(ArrayList<Person> freshContactsList) { ArrayList<Person> staleContactsList = getStoredContacts(); ArrayList<Person> mergedList = new ArrayList<Person>(); // list of brand new users ArrayList<Person> newPersons = new ArrayList<Person>(); for(Person freshPerson : freshContactsList) { if(!staleContactsList.contains(freshPerson)) { newPersons.add(freshPerson); } } // randomly adds the new users for(Person newPerson : newPersons) { addContactRandomly(staleContactsList, newPerson); } // ignores stale people for(Person stalePerson : staleContactsList) { if(freshContactsList.contains(stalePerson)) { mergedList.add(stalePerson); } } return mergedList; } private void addContactRandomly(ArrayList<Person> list, Person p) { int rMin = 0; int rMax = list.size(); int pos = rMin + (int)(Math.random() * ((rMax - rMin) + 1)); list.add(pos, p); } private void addContactTopBiased(ArrayList<Person> list, Person p) { int start = 0; int end = list.size(); while(end-start > 1) { int flip = (int)(Math.random()*9); // [0, 9] if(flip <= 6) { // favor top/start end = end - (end-start)/2; } else { start = start + (end-start)/2; } } list.add(start, p); } private void addContactBottomBiased(ArrayList<Person> list, Person p) { int start = 0; int end = list.size(); while(end-start > 1) { int flip = (int)(Math.random()*9); // [0, 9] if(flip <= 3) { // favor bottom/end end = end - (end-start)/2; } else { start = start + (end-start)/2; } } list.add(end, p); } private void saveStoredContacts(ArrayList<Person> personList) { SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.CONTACTS_FILE, Context.MODE_PRIVATE); StringBuilder sb = new StringBuilder(); for(int i=0; i<personList.size(); i++) { sb.append(personList.get(i).displayName).append(DELIMITER).append(personList.get(i).id); if(i!=personList.size()-1) { sb.append(DELIMITER); } } sharedPreferences.edit().putString(Constants.CONTACTS_KEY, sb.toString()).commit(); } private ArrayList<Person> getStoredContacts() { SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.CONTACTS_FILE, Context.MODE_PRIVATE); String rawData = sharedPreferences.getString(Constants.CONTACTS_KEY,""); String [] rawDataParts = rawData.split(DELIMITER); ArrayList<Person> personList = new ArrayList<Person>(); if(rawDataParts.length>1) { for(int i=0; i<rawDataParts.length; i+=2) { String displayName = rawDataParts[i]; String id = rawDataParts[i+1]; personList.add(new Person(displayName, id)); } } return personList; } }
[ "nick722@gmail.com" ]
nick722@gmail.com
602651ec7ff6dcffb04a37d5e8ef7383b78f6987
fc90bad82e59abaee6e26b47b7921c28d1b4c22f
/src/main/java/com/muhacha/bpm/demos/springbootcamundademo/delegates/Notification.java
b550c09cb2b8cb196c249d4b271d819580cf4674
[]
no_license
cleophasmashiri/spring-boot-camunda-demo
bac2495d1ca4d2f3fcad755e6c4c342c3c36e7f9
dc57eacc80dff0bbba2d15b7f744a77b8f156503
refs/heads/master
2020-05-31T10:41:04.129353
2019-06-06T08:35:12
2019-06-06T08:35:12
190,245,846
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
package com.muhacha.bpm.demos.springbootcamundademo.delegates; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class Notification implements JavaDelegate { private final Logger LOGGER = LoggerFactory.getLogger(Notification.class); @Override public void execute(DelegateExecution delegateExecution) throws Exception { LOGGER.info("Notification sent"); } }
[ "cleophasmashiri@gmail.com" ]
cleophasmashiri@gmail.com
1f600f4e8028d6565b69183bb716f61a0161bbe8
aad0ba77ee93d5af96b1895365068e5a2fb8e645
/main/java/keegan/labstuff/world/MapGenBaseMeta.java
1b076814b49f50ad79384a3cc23f449abacdd798
[]
no_license
KeeganDeathman/LabStuff
88ccabfda844280e5d838c33702c82e7341a467b
3f5dff814ffc4ac3d0bbc300dd92366cc7fccdf8
refs/heads/master
2020-12-24T08:15:27.931723
2017-04-25T00:40:45
2017-04-25T00:40:45
15,520,243
0
0
null
null
null
null
UTF-8
Java
false
false
1,417
java
package keegan.labstuff.world; import net.minecraft.world.World; import net.minecraft.world.chunk.ChunkPrimer; import java.util.Random; public abstract class MapGenBaseMeta { /** * The number of Chunks to gen-check in any given direction. */ protected int range = 8; /** * The RNG used by the MapGen classes. */ protected Random rand = new Random(); /** * This world object. */ protected World worldObj; public void generate(World world, int chunkX, int chunkZ, ChunkPrimer primer) { this.worldObj = world; this.rand.setSeed(world.getSeed()); final long r0 = this.rand.nextLong(); final long r1 = this.rand.nextLong(); for (int x0 = chunkX - this.range; x0 <= chunkX + this.range; ++x0) { for (int y0 = chunkZ - this.range; y0 <= chunkZ + this.range; ++y0) { final long randX = x0 * r0; final long randZ = y0 * r1; this.rand.setSeed(randX ^ randZ ^ world.getSeed()); this.recursiveGenerate(world, x0, y0, chunkX, chunkZ, primer); } } } /** * Recursively called by generate() (generate) and optionally by itself. */ protected void recursiveGenerate(World world, int xChunkCoord, int zChunkCoord, int origXChunkCoord, int origZChunkCoord, ChunkPrimer primer) { } }
[ "keegandittmer@gmail.com" ]
keegandittmer@gmail.com
f6933d82e8b48a6c5ac71cfc80192bbfadde1d2d
3841f7991232e02c850b7e2ff6e02712e9128b17
/小浪底泥沙三维/EV_Xld/jni/src/JAVA/EV_MapControlWrapper/src/com/earthview/world/spatial2d/controls/ToolCircleSector.java
d27b64d3dd5fc2a99191c9de9bb65a408d949a5a
[]
no_license
15831944/BeijingEVProjects
62bf734f1cb0a8be6fed42cf6b207f9dbdf99e71
3b5fa4c4889557008529958fc7cb51927259f66e
refs/heads/master
2021-07-22T14:12:15.106616
2017-10-15T11:33:06
2017-10-15T11:33:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,513
java
package com.earthview.world.spatial2d.controls; import global.*; import com.earthview.world.base.*; import com.earthview.world.util.*; import com.earthview.world.spatial.geometry.*; import com.earthview.world.core.*; public class ToolCircleSector extends com.earthview.world.spatial2d.controls.NewNonPointTypeTool { static { GlobalClassFactoryMap.put("EarthView::World::Spatial2D::Controls::CToolCircleSector", new ToolCircleSectorClassFactory()); GlobalClassFactoryMap.put("EarthView::World::Spatial2D::Controls::JCToolCircleSectorProxy", new ToolCircleSectorClassFactory()); } /** * 默认构造函数 * @param */ public ToolCircleSector() { super(CreatedWhenConstruct.CWC_NotToCreate); Create("JCToolCircleSectorProxy", null, true); this.registerCallback(); if (!"com.earthview.world.spatial2d.controls.ToolCircleSector".equals(this.getClass().getName())) { this.setCustomExtend(true); } } native private long getToolBarType_void(long pNativeObject); /** * 获取工具栏类型 * @param * @return 工具栏类型 */ public long getToolBarType() { long returnValue = getToolBarType_void(this.nativeObject.pointer); return returnValue; } native private long getToolBarType_void_NoVirtual(long pNativeObject); protected long getToolBarType_NoVirtual() { long returnValue = getToolBarType_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private long getType_void(long pNativeObject); /** * 获取工具类型 * @param * @return 工具类型 */ public long getType() { long returnValue = getType_void(this.nativeObject.pointer); return returnValue; } native private long getType_void_NoVirtual(long pNativeObject); protected long getType_NoVirtual() { long returnValue = getType_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private String getName_void(long pNativeObject); /** * 获取工具名称 * @param * @return 工具名称 */ public String getName() { String returnValue = getName_void(this.nativeObject.pointer); return returnValue; } native private String getName_void_NoVirtual(long pNativeObject); protected String getName_NoVirtual() { String returnValue = getName_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private String getCategory_void(long pNativeObject); /** * 获取工具类别 * @param * @return 工具类别名称 */ public String getCategory() { String returnValue = getCategory_void(this.nativeObject.pointer); return returnValue; } native private String getCategory_void_NoVirtual(long pNativeObject); protected String getCategory_NoVirtual() { String returnValue = getCategory_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private String getToolTip_void(long pNativeObject); /** * 获取工具提示 * @param * @return 工具提示 */ public String getToolTip() { String returnValue = getToolTip_void(this.nativeObject.pointer); return returnValue; } native private String getToolTip_void_NoVirtual(long pNativeObject); protected String getToolTip_NoVirtual() { String returnValue = getToolTip_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private long getIcon_void(long pNativeObject); /** * 获取图标 * @param * @return 命令的图标 */ public com.earthview.world.display.Ibitmap getIcon() { long returnValue = getIcon_void(this.nativeObject.pointer); if(returnValue == 0L) { return null; } com.earthview.world.display.Ibitmap __returnValue = new com.earthview.world.display.Ibitmap(CreatedWhenConstruct.CWC_NotToCreate, "IBitmap"); __returnValue.setDelegate(true); InstancePointer __instancePointer = new InstancePointer(returnValue); __returnValue.setInstancePointer(__instancePointer); IClassFactory __returnValueClassFactory = GlobalClassFactoryMap.get(__returnValue.getCppInstanceTypeName()); if (__returnValueClassFactory != null) { __returnValue.setDelegate(true); __returnValue = (com.earthview.world.display.Ibitmap)__returnValueClassFactory.create(); __returnValue.setDelegate(true); __returnValue.bindNativeObject(__instancePointer, "IBitmap"); } return __returnValue; } native private long getIcon_void_NoVirtual(long pNativeObject); protected com.earthview.world.display.Ibitmap getIcon_NoVirtual() { long returnValue = getIcon_void_NoVirtual(this.nativeObject.pointer); if(returnValue == 0L) { return null; } com.earthview.world.display.Ibitmap __returnValue = new com.earthview.world.display.Ibitmap(CreatedWhenConstruct.CWC_NotToCreate, "IBitmap"); __returnValue.setDelegate(true); InstancePointer __instancePointer = new InstancePointer(returnValue); __returnValue.setInstancePointer(__instancePointer); IClassFactory __returnValueClassFactory = GlobalClassFactoryMap.get(__returnValue.getCppInstanceTypeName()); if (__returnValueClassFactory != null) { __returnValue.setDelegate(true); __returnValue = (com.earthview.world.display.Ibitmap)__returnValueClassFactory.create(); __returnValue.setDelegate(true); __returnValue.bindNativeObject(__instancePointer, "IBitmap"); } return __returnValue; } native private boolean isCheckable_void(long pNativeObject); /** * 是否可以选择 * @param * @return 如果可以选择,返回true,如果不可以选择,返回false */ public boolean isCheckable() { boolean returnValue = isCheckable_void(this.nativeObject.pointer); return returnValue; } native private boolean isCheckable_void_NoVirtual(long pNativeObject); protected boolean isCheckable_NoVirtual() { boolean returnValue = isCheckable_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private void activate_void(long pNativeObject); /** * 激活任务 * @param */ public void activate() { activate_void(this.nativeObject.pointer); } native private void activate_void_NoVirtual(long pNativeObject); protected void activate_NoVirtual() { activate_void_NoVirtual(this.nativeObject.pointer); } native private void deactivate_void(long pNativeObject); /** * 取消任务的激活状态 * @param */ public void deactivate() { deactivate_void(this.nativeObject.pointer); } native private void deactivate_void_NoVirtual(long pNativeObject); protected void deactivate_NoVirtual() { deactivate_void_NoVirtual(this.nativeObject.pointer); } native private int getCursor_void(long pNativeObject); /** * 获取鼠标光标 * @param * @return 鼠标光标值 */ public int getCursor() { int returnValue = getCursor_void(this.nativeObject.pointer); return returnValue; } native private int getCursor_void_NoVirtual(long pNativeObject); protected int getCursor_NoVirtual() { int returnValue = getCursor_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private boolean onMouseDown_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, int button, int shift, int x, int y); /** * 鼠标左键按下 * @param button 左键判定 * @param shift shift键判定 * @param x 鼠标左键按下时的x坐标 * @param y 鼠标左键按下时的y坐标 * @return 如果鼠标左键按下,返回true,如果没有按下,返回false */ public boolean onMouseDown(int button, int shift, int x, int y) { int buttonParamValue = button; int shiftParamValue = shift; int xParamValue = x; int yParamValue = y; boolean returnValue = onMouseDown_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, buttonParamValue, shiftParamValue, xParamValue, yParamValue); return returnValue; } native private boolean onMouseDown_ev_int32_ev_int32_ev_int32_ev_int32_NoVirtual(long pNativeObject, int button, int shift, int x, int y); protected boolean onMouseDown_NoVirtual(int button, int shift, int x, int y) { int buttonParamValue = button; int shiftParamValue = shift; int xParamValue = x; int yParamValue = y; boolean returnValue = onMouseDown_ev_int32_ev_int32_ev_int32_ev_int32_NoVirtual(this.nativeObject.pointer, buttonParamValue, shiftParamValue, xParamValue, yParamValue); return returnValue; } native private boolean onMouseMove_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, int button, int shift, int x, int y); /** * 鼠标移动 * @param button 左键判定 * @param shift shift键判定 * @param x 鼠标移动时的x坐标 * @param y 鼠标移动时的y坐标 * @return 如果鼠标移动,返回true,如果没有移动,返回false */ public boolean onMouseMove(int button, int shift, int x, int y) { int buttonParamValue = button; int shiftParamValue = shift; int xParamValue = x; int yParamValue = y; boolean returnValue = onMouseMove_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, buttonParamValue, shiftParamValue, xParamValue, yParamValue); return returnValue; } native private boolean onMouseMove_ev_int32_ev_int32_ev_int32_ev_int32_NoVirtual(long pNativeObject, int button, int shift, int x, int y); protected boolean onMouseMove_NoVirtual(int button, int shift, int x, int y) { int buttonParamValue = button; int shiftParamValue = shift; int xParamValue = x; int yParamValue = y; boolean returnValue = onMouseMove_ev_int32_ev_int32_ev_int32_ev_int32_NoVirtual(this.nativeObject.pointer, buttonParamValue, shiftParamValue, xParamValue, yParamValue); return returnValue; } native private boolean onMouseUp_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, int button, int shift, int x, int y); /** * 鼠标抬起 * @param button 左键判定 * @param shift shift键判定 * @param x 鼠标抬起时的x坐标 * @param y 鼠标抬起时的y坐标 * @return 如果鼠标抬起,返回true,如果没有抬起,返回false */ public boolean onMouseUp(int button, int shift, int x, int y) { int buttonParamValue = button; int shiftParamValue = shift; int xParamValue = x; int yParamValue = y; boolean returnValue = onMouseUp_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, buttonParamValue, shiftParamValue, xParamValue, yParamValue); return returnValue; } native private boolean onMouseUp_ev_int32_ev_int32_ev_int32_ev_int32_NoVirtual(long pNativeObject, int button, int shift, int x, int y); protected boolean onMouseUp_NoVirtual(int button, int shift, int x, int y) { int buttonParamValue = button; int shiftParamValue = shift; int xParamValue = x; int yParamValue = y; boolean returnValue = onMouseUp_ev_int32_ev_int32_ev_int32_ev_int32_NoVirtual(this.nativeObject.pointer, buttonParamValue, shiftParamValue, xParamValue, yParamValue); return returnValue; } native private boolean onDoubleClick_void(long pNativeObject); /** * 鼠标双击 * @param * @return 如果鼠标双击,返回true,如果没有双击,返回false */ public boolean onDoubleClick() { boolean returnValue = onDoubleClick_void(this.nativeObject.pointer); return returnValue; } native private boolean onDoubleClick_void_NoVirtual(long pNativeObject); protected boolean onDoubleClick_NoVirtual() { boolean returnValue = onDoubleClick_void_NoVirtual(this.nativeObject.pointer); return returnValue; } native private boolean update_CEvent(long pNativeObject, long e); /** * 操作更新 * @param e 操作事件 * @return 如果有操作更新,返回true,如果没有,返回false */ public boolean update(com.earthview.world.core.Event e) { long eParamValue = (e == null ? 0L : e.nativeObject.pointer); boolean returnValue = update_CEvent(this.nativeObject.pointer, eParamValue); return returnValue; } native private boolean update_CEvent_NoVirtual(long pNativeObject, long e); protected boolean update_NoVirtual(com.earthview.world.core.Event e) { long eParamValue = (e == null ? 0L : e.nativeObject.pointer); boolean returnValue = update_CEvent_NoVirtual(this.nativeObject.pointer, eParamValue); return returnValue; } public ToolCircleSector(CreatedWhenConstruct cwc) { super(CreatedWhenConstruct.CWC_NotToCreate); } public ToolCircleSector(CreatedWhenConstruct cwc, String classNameStr) { super(CreatedWhenConstruct.CWC_NotToCreate, classNameStr); } /** * 右键菜单事件触发 * @param x 光标位置x * @param y 光标位置y * @return 标识此事件是否已经被ITool处理过,true:处理过(不再向父控件传递此事件);false:未处理(父控件对象可以继续处理) */ public boolean onContextMenu(int x, int y) { return super.onContextMenu_NoVirtual(x, y); } public boolean onDoubleClick(int button, int shift, int x, int y) { return super.onDoubleClick_NoVirtual(button, shift, x, y); } /** * 键盘按下事件触发 * @param key 按下的键 * @param shift shift键是否同时被按下 * @return 标识此事件是否已经被ITool处理过,true:处理过(不再向父控件传递此事件);false:未处理(父控件对象可以继续处理) */ public boolean onKeyDown(int keyCode, int shift) { return super.onKeyDown_NoVirtual(keyCode, shift); } /** * 键盘弹起事件触发 * @param key 弹起的键 * @param shift shift键是否同时被释放 * @return 标识此事件是否已经被ITool处理过,true:处理过(不再向父控件传递此事件);false:未处理(父控件对象可以继续处理) */ public boolean onKeyUp(int keyCode, int shift) { return super.onKeyUp_NoVirtual(keyCode, shift); } /** * 鼠标滚轮滚动事件触发 * @param delta 滚动的幅度 * @param x 光标位置x * @param y 光标位置y * @param flag 标识位 * @return 标识此事件是否已经被ITool处理过,true:处理过(不再向父控件传递此事件);false:未处理(父控件对象可以继续处理) */ public boolean onMouseWheel(int delta, int x, int y, int flag) { return super.onMouseWheel_NoVirtual(delta, x, y, flag); } /** * 触屏接触事件触发 * @param touchEvent 事件参数 * @return 标识此事件是否已经被ITool处理过,true:处理过(不再向父控件传递此事件);false:未处理(父控件对象可以继续处理) */ public boolean onTouchDown(com.earthview.world.spatial.systemui.MotionEvent touchEvent) { return super.onTouchDown_NoVirtual(touchEvent); } /** * 触屏接触事件触发 * @param touchEvent 事件参数 * @return 标识此事件是否已经被ITool处理过,true:处理过(不再向父控件传递此事件);false:未处理(父控件对象可以继续处理) */ public boolean onTouchUp(com.earthview.world.spatial.systemui.MotionEvent touchEvent) { return super.onTouchUp_NoVirtual(touchEvent); } /** * 触屏接触事件触发 * @param touchEvent 事件参数 * @return 标识此事件是否已经被ITool处理过,true:处理过(不再向父控件传递此事件);false:未处理(父控件对象可以继续处理) */ public boolean onTouchMove(com.earthview.world.spatial.systemui.MotionEvent touchEvent) { return super.onTouchMove_NoVirtual(touchEvent); } /** * 当命令项按钮被点击的时候,调用该方法 * @param */ public void onClicked() { super.onClicked_NoVirtual(); } /** * 获取命令项是否被按下 * @param * @return 如果命令项被按下了则返回true,反之则否 */ public boolean getChecked() { return super.getChecked_NoVirtual(); } /** * 设置命令项是否按下 * @param checked 如果为true,则命令项被按下,反之则否 */ public void setChecked(boolean checked) { super.setChecked_NoVirtual(checked); } /** * 获取命令项是否可用 * @param * @return 如果命令项可用则返回true,反之则否 */ public boolean getEnabled() { return super.getEnabled_NoVirtual(); } /** * 设置命令项是否可用 * @param enabled 如果为true,则设置该命令项可用,反之则否 */ public void setEnabled(boolean enabled) { super.setEnabled_NoVirtual(enabled); } /** * 使命令项与指定的控件相关联 * @param ctrl 待关联的控件 */ public void create(com.earthview.world.spatial.atlas.Ispatialcontrol ref_ctrl) { super.create_NoVirtual(ref_ctrl); } native protected void register_activate_void(long pNativeObject, String method); native protected void register_deactivate_void(long pNativeObject, String method); native protected void register_getCursor_void(long pNativeObject, String method); native protected void register_onContextMenu_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onDoubleClick_void(long pNativeObject, String method); native protected void register_onDoubleClick_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onKeyDown_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onKeyUp_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onMouseDown_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onMouseMove_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onMouseUp_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onMouseWheel_ev_int32_ev_int32_ev_int32_ev_int32(long pNativeObject, String method); native protected void register_onTouchDown_MotionEvent(long pNativeObject, String method); native protected void register_onTouchUp_MotionEvent(long pNativeObject, String method); native protected void register_onTouchMove_MotionEvent(long pNativeObject, String method); native protected void register_getToolBarType_void(long pNativeObject, String method); native protected void register_getType_void(long pNativeObject, String method); native protected void register_getName_void(long pNativeObject, String method); native protected void register_getCategory_void(long pNativeObject, String method); native protected void register_getToolTip_void(long pNativeObject, String method); native protected void register_getIcon_void(long pNativeObject, String method); native protected void register_isCheckable_void(long pNativeObject, String method); native protected void register_onClicked_void(long pNativeObject, String method); native protected void register_getChecked_void(long pNativeObject, String method); native protected void register_setChecked_ev_bool(long pNativeObject, String method); native protected void register_getEnabled_void(long pNativeObject, String method); native protected void register_setEnabled_ev_bool(long pNativeObject, String method); native protected void register_create_ISpatialControl(long pNativeObject, String method); native protected void register_update_CEvent(long pNativeObject, String method); public void registerCallback(){ if (!this.nativeObject.equals(InstancePointer.ZERO)){ this.register_activate_void(this.nativeObject.pointer, "activate_void_callback"); this.register_deactivate_void(this.nativeObject.pointer, "deactivate_void_callback"); this.register_getCursor_void(this.nativeObject.pointer, "getCursor_void_callback"); this.register_onContextMenu_ev_int32_ev_int32(this.nativeObject.pointer, "onContextMenu_ev_int32_ev_int32_callback"); this.register_onDoubleClick_void(this.nativeObject.pointer, "onDoubleClick_void_callback"); this.register_onDoubleClick_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, "onDoubleClick_ev_int32_ev_int32_ev_int32_ev_int32_callback"); this.register_onKeyDown_ev_int32_ev_int32(this.nativeObject.pointer, "onKeyDown_ev_int32_ev_int32_callback"); this.register_onKeyUp_ev_int32_ev_int32(this.nativeObject.pointer, "onKeyUp_ev_int32_ev_int32_callback"); this.register_onMouseDown_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, "onMouseDown_ev_int32_ev_int32_ev_int32_ev_int32_callback"); this.register_onMouseMove_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, "onMouseMove_ev_int32_ev_int32_ev_int32_ev_int32_callback"); this.register_onMouseUp_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, "onMouseUp_ev_int32_ev_int32_ev_int32_ev_int32_callback"); this.register_onMouseWheel_ev_int32_ev_int32_ev_int32_ev_int32(this.nativeObject.pointer, "onMouseWheel_ev_int32_ev_int32_ev_int32_ev_int32_callback"); this.register_onTouchDown_MotionEvent(this.nativeObject.pointer, "onTouchDown_MotionEvent_callback"); this.register_onTouchUp_MotionEvent(this.nativeObject.pointer, "onTouchUp_MotionEvent_callback"); this.register_onTouchMove_MotionEvent(this.nativeObject.pointer, "onTouchMove_MotionEvent_callback"); this.register_getToolBarType_void(this.nativeObject.pointer, "getToolBarType_void_callback"); this.register_getType_void(this.nativeObject.pointer, "getType_void_callback"); this.register_getName_void(this.nativeObject.pointer, "getName_void_callback"); this.register_getCategory_void(this.nativeObject.pointer, "getCategory_void_callback"); this.register_getToolTip_void(this.nativeObject.pointer, "getToolTip_void_callback"); this.register_getIcon_void(this.nativeObject.pointer, "getIcon_void_callback"); this.register_isCheckable_void(this.nativeObject.pointer, "isCheckable_void_callback"); this.register_onClicked_void(this.nativeObject.pointer, "onClicked_void_callback"); this.register_getChecked_void(this.nativeObject.pointer, "getChecked_void_callback"); this.register_setChecked_ev_bool(this.nativeObject.pointer, "setChecked_ev_bool_callback"); this.register_getEnabled_void(this.nativeObject.pointer, "getEnabled_void_callback"); this.register_setEnabled_ev_bool(this.nativeObject.pointer, "setEnabled_ev_bool_callback"); this.register_create_ISpatialControl(this.nativeObject.pointer, "create_ISpatialControl_callback"); this.register_update_CEvent(this.nativeObject.pointer, "update_CEvent_callback"); } } public static ToolCircleSector fromBaseObject(BaseObject baseObj) { if (baseObj == null || InstancePointer.ZERO.equals(baseObj.nativeObject)) { return null; } ToolCircleSector obj = null; if(baseObj instanceof ToolCircleSector) { obj = (ToolCircleSector)baseObj; } else { obj = new ToolCircleSector(CreatedWhenConstruct.CWC_NotToCreate); obj.bindNativeObject(baseObj.nativeObject, "CToolCircleSector"); obj.increaseCast(); } return obj; } }
[ "yanguanqi@aliyun.com" ]
yanguanqi@aliyun.com
347838709a2fe82c36bd1c565328fedd9deb80c8
e590b52b0b52d022624c65e212d8a1caed87a60e
/personal-space/src/main/java/com/zss/personalspace/vo/CommentLikeVo.java
576b795576dad3b9d17767310b942753af3a7549
[]
no_license
ZSSXL/personal-website
f5c98d76ab7a6d3467770930d3af87dd709017a0
91ba7010fcde302a4e59071d503ed4eff3f1fb6a
refs/heads/master
2022-12-12T06:31:00.709683
2019-08-29T02:32:02
2019-08-29T02:32:02
201,632,193
0
0
null
2022-12-06T00:43:23
2019-08-10T13:13:05
JavaScript
UTF-8
Java
false
false
712
java
package com.zss.personalspace.vo; import lombok.Builder; import lombok.Data; /** * @author ZSS * @date 2019/8/19 13:04 * @description */ @Data @Builder public class CommentLikeVo { /** * 评论id */ private String commentId; /** * 评论所属 */ private String commentOf; /** * 评论者 */ private String commentAuthor; /** * 作者头像 */ private String headImg; /** * 评论内容 */ private String comment; /** * 点赞id */ private String likeId; /** * 点赞数量 */ private Integer likeCount; /** * 创建时间 */ private Long createTime; }
[ "1271130458@qq.com" ]
1271130458@qq.com
78cac727a5e5f22f371e274043395e5401226c1b
3a0c5d42d46750485bf60b63cb979c2a2af138f3
/src/doppler/DopplerSlider.java
5e4d50484469e80466a30a415044dd4eae46232d
[]
no_license
wieczorek1990/Doppler
f36649fd8ba492beae50c19817d48f71d43149cb
51ccdcbde14fad5d08b5e019aff8125c278aacd6
refs/heads/master
2020-06-12T09:09:37.839174
2013-01-14T17:36:26
2013-01-14T17:36:26
194,253,842
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package doppler; import javax.swing.JSlider; public abstract class DopplerSlider extends JSlider implements IDopplerSlider { private static final long serialVersionUID = 1624344153590545528L; protected DopplerExperimentPanel dopplerPanel; public DopplerSlider(DopplerExperimentPanel dopplerPanel) { this.dopplerPanel = dopplerPanel; } }
[ "wieczorek1990@gmail.com" ]
wieczorek1990@gmail.com
e318f4b61b3192f2c82bcddc0e7d897303866e8a
fb2b27f0638feaa8a435425a563910de48925931
/df_miniapp/classes/com/tt/miniapphost/placeholder/MiniappService3.java
c9078a66dc7378cd4fac7b7550d0b28ccd9ad542
[]
no_license
0moura/tiktok_source
168fdca45a76e9dc41a4667e41b7743c54692e45
dc2f1740f1f4adcb16448107e5c15fabc40ed8e5
refs/heads/master
2023-01-08T22:51:02.019984
2020-11-03T13:18:24
2020-11-03T13:18:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package com.tt.miniapphost.placeholder; import com.tt.miniapphost.MiniappHostService; public class MiniappService3 extends MiniappHostService {} /* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\tt\miniapphost\placeholder\MiniappService3.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
[ "augustgl@protonmail.ch" ]
augustgl@protonmail.ch
9034c60a1831a82bd5375500b8d287cb8ca223b8
949d4d9435d5d99a50016604b6b95a695e772703
/app/src/main/java/com/education/Faculty/API/Faculty/Friend.java
e161deaa6e19f567442b3e3a20d5d85974771324
[]
no_license
sandeep7788/SchoolFaculty
21e76a0cfa46cfb5d6ff1a41cae6e5a80f87a5a3
206a8b06b0746369cf11898e242ab14234dd811b
refs/heads/master
2023-04-15T17:20:42.643804
2020-06-25T06:27:33
2020-06-25T06:27:33
274,844,526
2
0
null
null
null
null
UTF-8
Java
false
false
1,699
java
package com.education.Faculty.API.Faculty; import android.os.Parcel; import android.os.Parcelable; public class Friend implements Parcelable { private String id; private String name; private boolean isSelected; /** * Create parcelable of friend */ public static final Parcelable.Creator<Friend> CREATOR = new Parcelable.Creator<Friend>() { public Friend createFromParcel(Parcel in) { return new Friend(in); } public Friend[] newArray(int size) { return new Friend[size]; } }; /** * Create Friend from Parcel object. * * @param in */ public Friend(Parcel in) { this.name = in.readString(); this.id = in.readString(); this.isSelected = in.readByte() != 0; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.name); dest.writeString( (this.id)); dest.writeByte((byte) (this.isSelected ? 1 : 0)); } public Friend(String id,String name) { this.name = name; this.id = id; // true is male, false is woman this.isSelected = false; // not selected when create } public String isId() { return id; } public void setid(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean isSelected() { return isSelected; } public void setSelected(boolean isSelected) { this.isSelected = isSelected; } }
[ "s.pareek7788@gmail.com" ]
s.pareek7788@gmail.com
3668b852ae601fc9b9a638f519a0f97963741a7c
e91e5bd6940046a692cf407bd236a7e709422c5a
/library/src/androidTest/java/com/lhk/library/ExampleInstrumentedTest.java
9c8cc3e8408008f1c055ee0a82839a7eacf4fb9b
[]
no_license
luhaikong/PullLoadMoreRecyclerViewDemo
8ad080d8ef1ba2bbc2bd6667abe0c67843aad0aa
b16898a6359f5aed43781a11e9635a89e63ba178
refs/heads/master
2021-01-11T06:36:45.971612
2017-01-03T09:14:41
2017-01-03T09:14:41
71,857,680
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package com.lhk.library; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.lhk.library.test", appContext.getPackageName()); } }
[ "1031350293@qq.com" ]
1031350293@qq.com
a8552a6bd6240fbdc28ffbb3f047bb5fb14bc21d
5d880487880079ad8994e1f7886fed0268d84c03
/spring-boot-secure/spring-boot-shiro/src/main/java/com/xbw/spring/boot/framework/shiro/filter/LogoutFilter.java
6475a94214a447f6a7618d23a10c06cc136632a6
[ "MIT" ]
permissive
alaxcc/spring-boot-showcase
4202c3b14c245f74d099777b2fbb7ecdbe2963a8
40e59a54c64a115290061534ad4f0be93d3ed73b
refs/heads/main
2023-08-14T10:52:35.212818
2021-09-29T08:17:17
2021-09-29T08:19:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,312
java
package com.xbw.spring.boot.framework.shiro.filter; import com.xbw.spring.boot.framework.shiro.realm.ShiroRealm; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.subject.Subject; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; /** * There are 3 ways to logout * 1. use chainDefinition.addPathDefinition("/logout", "logout"); * 2. use Controller /logout * 3. use LogoutFilter * @author: xbw */ public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter { @Override protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception { Subject subject = getSubject(request, response); DefaultWebSecurityManager securityManager = (DefaultWebSecurityManager) SecurityUtils.getSecurityManager(); ShiroRealm shiroRealm = (ShiroRealm) securityManager.getRealms().iterator().next(); PrincipalCollection principals = subject.getPrincipals(); shiroRealm.onLogout(principals); subject.logout(); String redirectUrl = getRedirectUrl(request, response, subject); issueRedirect(request, response, redirectUrl); return false; } }
[ "15621624+xbw@users.noreply.github.com" ]
15621624+xbw@users.noreply.github.com
19e97d4a9a9628e9306446d9f1b1d5f58b368299
3a18714506a78ff2fc9eb2282e7353c5eee954a8
/solution/Solution1st.java
933031af7407b323f485e079b74e6ad28388a4e6
[]
no_license
adityavats007/solutions
8c2441a3dd1d9b0173626c2359dffd0a0384a862
f5959265d3737d10b089d95a30b23b8adac91923
refs/heads/master
2021-05-03T15:45:50.967380
2018-02-06T16:17:42
2018-02-06T16:17:42
120,485,672
0
0
null
null
null
null
UTF-8
Java
false
false
3,191
java
/* IMPORTANT: Multiple classes and nested static classes are supported */ /* * uncomment this if you want to read input. //imports for BufferedReader import java.io.BufferedReader; import java.io.InputStreamReader; //import for Scanner and other utility classes import java.util.*; */ // Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail import java.util.*; class TestClass { public static void main(String args[] ) throws Exception { /* Sample code to perform I/O: * Use either of these methods for input //BufferedReader BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String name = br.readLine(); // Reading input from STDIN System.out.println("Hi, " + name + "."); // Writing output to STDOUT //Scanner Scanner s = new Scanner(System.in); String name = s.nextLine(); // Reading input from STDIN System.out.println("Hi, " + name + "."); // Writing output to STDOUT */ // Write your code here try{ Scanner s = new Scanner(System.in); int t,i,j,m; int pa,pr,nee,neu,k,n; long q; t=s.nextInt(); for(i=0;i<t;i++) { n=s.nextInt(); k=s.nextInt(); q=s.nextLong(); long max; long a[]=new long[n]; for(j=0;j<n;j++) a[j]=s.nextLong(); pa=n/k; nee=pa; pr=n%k; neu=0; if(pr>0) {pa=pa+1; nee=pa; neu=n-nee*k+nee; } //System.out.println("element is"+neu); long p[]=new long[k]; // z=0; for(j=0;j<k;j++) { int st,en; if(j!=k-1 || pr==0) { max=0; st=j*nee;en=st+nee; for(m=st;m<en;m++) { if(max<=a[m]) {max=a[m]; p[j]=max; } } } else if(j==k-1 && pr!=0) { max=0; st=j*nee; en=j*nee+neu; // System.out.println(st); //System.out.println(en); for(m=st;m<en;m++) { // System.out.println("hi there"); if(max<=a[m]) {max=a[m]; p[j]=max; } // System.out.println("hi there"); }} } long min=p[0]; for(m=0;m<k;m++) if(min>=p[m]) min=p[m]; if(min<q) System.out.println(min); else System.out.println("NO"); //for(m=0;m<k;m++) //System.out.print(p[m]); } } catch(Exception e){} } }
[ "adityavatsmfp@gmail.com" ]
adityavatsmfp@gmail.com
52c821c2a925a7b5524e98eb3727618ec78716f2
db6215d91c02554bce4ee49b99f7318ffbf18f2d
/server/server-ba/src/main/java/org/neurosystem/util/common/net/InetAddresses.java
aa791f771abaf12b5b3ceb895fdc24b56e54100c
[]
no_license
senhadjielrhazi/Project.FIX
79687c9807b906f3d06e70b390141004f8ecae0d
8f4511b76d043d4dff183023e1a62035a25b9760
refs/heads/master
2021-05-06T12:36:37.648093
2017-12-05T09:22:11
2017-12-05T09:22:11
113,158,583
0
0
null
null
null
null
UTF-8
Java
false
false
38,106
java
/* * Copyright (C) 2008 The Guava 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.neurosystem.util.common.net; import org.neurosystem.util.common.annotations.Beta; import org.neurosystem.util.common.base.MoreObjects; import org.neurosystem.util.common.base.Preconditions; import org.neurosystem.util.common.base.Splitter; import org.neurosystem.util.common.hash.Hashing; import org.neurosystem.util.common.io.ByteStreams; import org.neurosystem.util.common.primitives.Ints; import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Locale; import org.neurosystem.util.common.annotations.javax.Nullable; /** * Static utility methods pertaining to {@link InetAddress} instances. * * <p><b>Important note:</b> Unlike {@code InetAddress.getByName()}, the * methods of this class never cause DNS services to be accessed. For * this reason, you should prefer these methods as much as possible over * their JDK equivalents whenever you are expecting to handle only * IP address string literals -- there is no blocking DNS penalty for a * malformed string. * * <p>When dealing with {@link Inet4Address} and {@link Inet6Address} * objects as byte arrays (vis. {@code InetAddress.getAddress()}) they * are 4 and 16 bytes in length, respectively, and represent the address * in network byte order. * * <p>Examples of IP addresses and their byte representations: * <ul> * <li>The IPv4 loopback address, {@code "127.0.0.1"}.<br/> * {@code 7f 00 00 01} * * <li>The IPv6 loopback address, {@code "::1"}.<br/> * {@code 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01} * * <li>From the IPv6 reserved documentation prefix ({@code 2001:db8::/32}), * {@code "2001:db8::1"}.<br/> * {@code 20 01 0d b8 00 00 00 00 00 00 00 00 00 00 00 01} * * <li>An IPv6 "IPv4 compatible" (or "compat") address, * {@code "::192.168.0.1"}.<br/> * {@code 00 00 00 00 00 00 00 00 00 00 00 00 c0 a8 00 01} * * <li>An IPv6 "IPv4 mapped" address, {@code "::ffff:192.168.0.1"}.<br/> * {@code 00 00 00 00 00 00 00 00 00 00 ff ff c0 a8 00 01} * </ul> * * <p>A few notes about IPv6 "IPv4 mapped" addresses and their observed * use in Java. * <br><br> * "IPv4 mapped" addresses were originally a representation of IPv4 * addresses for use on an IPv6 socket that could receive both IPv4 * and IPv6 connections (by disabling the {@code IPV6_V6ONLY} socket * option on an IPv6 socket). Yes, it's confusing. Nevertheless, * these "mapped" addresses were never supposed to be seen on the * wire. That assumption was dropped, some say mistakenly, in later * RFCs with the apparent aim of making IPv4-to-IPv6 transition simpler. * * <p>Technically one <i>can</i> create a 128bit IPv6 address with the wire * format of a "mapped" address, as shown above, and transmit it in an * IPv6 packet header. However, Java's InetAddress creation methods * appear to adhere doggedly to the original intent of the "mapped" * address: all "mapped" addresses return {@link Inet4Address} objects. * * <p>For added safety, it is common for IPv6 network operators to filter * all packets where either the source or destination address appears to * be a "compat" or "mapped" address. Filtering suggestions usually * recommend discarding any packets with source or destination addresses * in the invalid range {@code ::/3}, which includes both of these bizarre * address formats. For more information on "bogons", including lists * of IPv6 bogon space, see: * * <ul> * <li><a target="_parent" * href="http://en.wikipedia.org/wiki/Bogon_filtering" * >http://en.wikipedia.org/wiki/Bogon_filtering</a> * <li><a target="_parent" * href="http://www.cymru.com/Bogons/ipv6.txt" * >http://www.cymru.com/Bogons/ipv6.txt</a> * <li><a target="_parent" * href="http://www.cymru.com/Bogons/v6bogon.html" * >http://www.cymru.com/Bogons/v6bogon.html</a> * <li><a target="_parent" * href="http://www.space.net/~gert/RIPE/ipv6-filters.html" * >http://www.space.net/~gert/RIPE/ipv6-filters.html</a> * </ul> * * @author Erik Kline * @since 5.0 */ @Beta public final class InetAddresses { private static final int IPV4_PART_COUNT = 4; private static final int IPV6_PART_COUNT = 8; private static final Splitter IPV4_SPLITTER = Splitter.on('.').limit(IPV4_PART_COUNT); private static final Inet4Address LOOPBACK4 = (Inet4Address) forString("127.0.0.1"); private static final Inet4Address ANY4 = (Inet4Address) forString("0.0.0.0"); private InetAddresses() {} /** * Returns an {@link Inet4Address}, given a byte array representation of the IPv4 address. * * @param bytes byte array representing an IPv4 address (should be of length 4) * @return {@link Inet4Address} corresponding to the supplied byte array * @throws IllegalArgumentException if a valid {@link Inet4Address} can not be created */ private static Inet4Address getInet4Address(byte[] bytes) { Preconditions.checkArgument(bytes.length == 4, "Byte array has invalid length for an IPv4 address: %s != 4.", bytes.length); // Given a 4-byte array, this cast should always succeed. return (Inet4Address) bytesToInetAddress(bytes); } /** * Returns the {@link InetAddress} having the given string representation. * * <p>This deliberately avoids all nameservice lookups (e.g. no DNS). * * @param ipString {@code String} containing an IPv4 or IPv6 string literal, e.g. * {@code "192.168.0.1"} or {@code "2001:db8::1"} * @return {@link InetAddress} representing the argument * @throws IllegalArgumentException if the argument is not a valid IP string literal */ public static InetAddress forString(String ipString) { byte[] addr = ipStringToBytes(ipString); // The argument was malformed, i.e. not an IP string literal. if (addr == null) { throw formatIllegalArgumentException("'%s' is not an IP string literal.", ipString); } return bytesToInetAddress(addr); } /** * Returns {@code true} if the supplied string is a valid IP string * literal, {@code false} otherwise. * * @param ipString {@code String} to evaluated as an IP string literal * @return {@code true} if the argument is a valid IP string literal */ public static boolean isInetAddress(String ipString) { return ipStringToBytes(ipString) != null; } private static byte[] ipStringToBytes(String ipString) { // Make a first pass to categorize the characters in this string. boolean hasColon = false; boolean hasDot = false; for (int i = 0; i < ipString.length(); i++) { char c = ipString.charAt(i); if (c == '.') { hasDot = true; } else if (c == ':') { if (hasDot) { return null; // Colons must not appear after dots. } hasColon = true; } else if (Character.digit(c, 16) == -1) { return null; // Everything else must be a decimal or hex digit. } } // Now decide which address family to parse. if (hasColon) { if (hasDot) { ipString = convertDottedQuadToHex(ipString); if (ipString == null) { return null; } } return textToNumericFormatV6(ipString); } else if (hasDot) { return textToNumericFormatV4(ipString); } return null; } private static byte[] textToNumericFormatV4(String ipString) { byte[] bytes = new byte[IPV4_PART_COUNT]; int i = 0; try { for (String octet : IPV4_SPLITTER.split(ipString)) { bytes[i++] = parseOctet(octet); } } catch (NumberFormatException ex) { return null; } return i == IPV4_PART_COUNT ? bytes : null; } private static byte[] textToNumericFormatV6(String ipString) { // An address can have [2..8] colons, and N colons make N+1 parts. String[] parts = ipString.split(":", IPV6_PART_COUNT + 2); if (parts.length < 3 || parts.length > IPV6_PART_COUNT + 1) { return null; } // Disregarding the endpoints, find "::" with nothing in between. // This indicates that a run of zeroes has been skipped. int skipIndex = -1; for (int i = 1; i < parts.length - 1; i++) { if (parts[i].length() == 0) { if (skipIndex >= 0) { return null; // Can't have more than one :: } skipIndex = i; } } int partsHi; // Number of parts to copy from above/before the "::" int partsLo; // Number of parts to copy from below/after the "::" if (skipIndex >= 0) { // If we found a "::", then check if it also covers the endpoints. partsHi = skipIndex; partsLo = parts.length - skipIndex - 1; if (parts[0].length() == 0 && --partsHi != 0) { return null; // ^: requires ^:: } if (parts[parts.length - 1].length() == 0 && --partsLo != 0) { return null; // :$ requires ::$ } } else { // Otherwise, allocate the entire address to partsHi. The endpoints // could still be empty, but parseHextet() will check for that. partsHi = parts.length; partsLo = 0; } // If we found a ::, then we must have skipped at least one part. // Otherwise, we must have exactly the right number of parts. int partsSkipped = IPV6_PART_COUNT - (partsHi + partsLo); if (!(skipIndex >= 0 ? partsSkipped >= 1 : partsSkipped == 0)) { return null; } // Now parse the hextets into a byte array. ByteBuffer rawBytes = ByteBuffer.allocate(2 * IPV6_PART_COUNT); try { for (int i = 0; i < partsHi; i++) { rawBytes.putShort(parseHextet(parts[i])); } for (int i = 0; i < partsSkipped; i++) { rawBytes.putShort((short) 0); } for (int i = partsLo; i > 0; i--) { rawBytes.putShort(parseHextet(parts[parts.length - i])); } } catch (NumberFormatException ex) { return null; } return rawBytes.array(); } private static String convertDottedQuadToHex(String ipString) { int lastColon = ipString.lastIndexOf(':'); String initialPart = ipString.substring(0, lastColon + 1); String dottedQuad = ipString.substring(lastColon + 1); byte[] quad = textToNumericFormatV4(dottedQuad); if (quad == null) { return null; } String penultimate = Integer.toHexString(((quad[0] & 0xff) << 8) | (quad[1] & 0xff)); String ultimate = Integer.toHexString(((quad[2] & 0xff) << 8) | (quad[3] & 0xff)); return initialPart + penultimate + ":" + ultimate; } private static byte parseOctet(String ipPart) { // Note: we already verified that this string contains only hex digits. int octet = Integer.parseInt(ipPart); // Disallow leading zeroes, because no clear standard exists on // whether these should be interpreted as decimal or octal. if (octet > 255 || (ipPart.startsWith("0") && ipPart.length() > 1)) { throw new NumberFormatException(); } return (byte) octet; } private static short parseHextet(String ipPart) { // Note: we already verified that this string contains only hex digits. int hextet = Integer.parseInt(ipPart, 16); if (hextet > 0xffff) { throw new NumberFormatException(); } return (short) hextet; } /** * Convert a byte array into an InetAddress. * * {@link InetAddress#getByAddress} is documented as throwing a checked * exception "if IP address is of illegal length." We replace it with * an unchecked exception, for use by callers who already know that addr * is an array of length 4 or 16. * * @param addr the raw 4-byte or 16-byte IP address in big-endian order * @return an InetAddress object created from the raw IP address */ private static InetAddress bytesToInetAddress(byte[] addr) { try { return InetAddress.getByAddress(addr); } catch (UnknownHostException e) { throw new AssertionError(e); } } /** * Returns the string representation of an {@link InetAddress}. * * <p>For IPv4 addresses, this is identical to * {@link InetAddress#getHostAddress()}, but for IPv6 addresses, the output * follows <a href="http://tools.ietf.org/html/rfc5952">RFC 5952</a> * section 4. The main difference is that this method uses "::" for zero * compression, while Java's version uses the uncompressed form. * * <p>This method uses hexadecimal for all IPv6 addresses, including * IPv4-mapped IPv6 addresses such as "::c000:201". The output does not * include a Scope ID. * * @param ip {@link InetAddress} to be converted to an address string * @return {@code String} containing the text-formatted IP address * @since 10.0 */ public static String toAddrString(InetAddress ip) { Preconditions.checkNotNull(ip); if (ip instanceof Inet4Address) { // For IPv4, Java's formatting is good enough. return ip.getHostAddress(); } Preconditions.checkArgument(ip instanceof Inet6Address); byte[] bytes = ip.getAddress(); int[] hextets = new int[IPV6_PART_COUNT]; for (int i = 0; i < hextets.length; i++) { hextets[i] = Ints.fromBytes( (byte) 0, (byte) 0, bytes[2 * i], bytes[2 * i + 1]); } compressLongestRunOfZeroes(hextets); return hextetsToIPv6String(hextets); } /** * Identify and mark the longest run of zeroes in an IPv6 address. * * <p>Only runs of two or more hextets are considered. In case of a tie, the * leftmost run wins. If a qualifying run is found, its hextets are replaced * by the sentinel value -1. * * @param hextets {@code int[]} mutable array of eight 16-bit hextets */ private static void compressLongestRunOfZeroes(int[] hextets) { int bestRunStart = -1; int bestRunLength = -1; int runStart = -1; for (int i = 0; i < hextets.length + 1; i++) { if (i < hextets.length && hextets[i] == 0) { if (runStart < 0) { runStart = i; } } else if (runStart >= 0) { int runLength = i - runStart; if (runLength > bestRunLength) { bestRunStart = runStart; bestRunLength = runLength; } runStart = -1; } } if (bestRunLength >= 2) { Arrays.fill(hextets, bestRunStart, bestRunStart + bestRunLength, -1); } } /** * Convert a list of hextets into a human-readable IPv6 address. * * <p>In order for "::" compression to work, the input should contain negative * sentinel values in place of the elided zeroes. * * @param hextets {@code int[]} array of eight 16-bit hextets, or -1s */ private static String hextetsToIPv6String(int[] hextets) { /* * While scanning the array, handle these state transitions: * start->num => "num" start->gap => "::" * num->num => ":num" num->gap => "::" * gap->num => "num" gap->gap => "" */ StringBuilder buf = new StringBuilder(39); boolean lastWasNumber = false; for (int i = 0; i < hextets.length; i++) { boolean thisIsNumber = hextets[i] >= 0; if (thisIsNumber) { if (lastWasNumber) { buf.append(':'); } buf.append(Integer.toHexString(hextets[i])); } else { if (i == 0 || lastWasNumber) { buf.append("::"); } } lastWasNumber = thisIsNumber; } return buf.toString(); } /** * Returns the string representation of an {@link InetAddress} suitable * for inclusion in a URI. * * <p>For IPv4 addresses, this is identical to * {@link InetAddress#getHostAddress()}, but for IPv6 addresses it * compresses zeroes and surrounds the text with square brackets; for example * {@code "[2001:db8::1]"}. * * <p>Per section 3.2.2 of * <a target="_parent" * href="http://tools.ietf.org/html/rfc3986#section-3.2.2" * >http://tools.ietf.org/html/rfc3986</a>, * a URI containing an IPv6 string literal is of the form * {@code "http://[2001:db8::1]:8888/index.html"}. * * <p>Use of either {@link InetAddresses#toAddrString}, * {@link InetAddress#getHostAddress()}, or this method is recommended over * {@link InetAddress#toString()} when an IP address string literal is * desired. This is because {@link InetAddress#toString()} prints the * hostname and the IP address string joined by a "/". * * @param ip {@link InetAddress} to be converted to URI string literal * @return {@code String} containing URI-safe string literal */ public static String toUriString(InetAddress ip) { if (ip instanceof Inet6Address) { return "[" + toAddrString(ip) + "]"; } return toAddrString(ip); } /** * Returns an InetAddress representing the literal IPv4 or IPv6 host * portion of a URL, encoded in the format specified by RFC 3986 section 3.2.2. * * <p>This function is similar to {@link InetAddresses#forString(String)}, * however, it requires that IPv6 addresses are surrounded by square brackets. * * <p>This function is the inverse of * {@link InetAddresses#toUriString(java.net.InetAddress)}. * * @param hostAddr A RFC 3986 section 3.2.2 encoded IPv4 or IPv6 address * @return an InetAddress representing the address in {@code hostAddr} * @throws IllegalArgumentException if {@code hostAddr} is not a valid * IPv4 address, or IPv6 address surrounded by square brackets */ public static InetAddress forUriString(String hostAddr) { Preconditions.checkNotNull(hostAddr); // Decide if this should be an IPv6 or IPv4 address. String ipString; int expectBytes; if (hostAddr.startsWith("[") && hostAddr.endsWith("]")) { ipString = hostAddr.substring(1, hostAddr.length() - 1); expectBytes = 16; } else { ipString = hostAddr; expectBytes = 4; } // Parse the address, and make sure the length/version is correct. byte[] addr = ipStringToBytes(ipString); if (addr == null || addr.length != expectBytes) { throw formatIllegalArgumentException("Not a valid URI IP literal: '%s'", hostAddr); } return bytesToInetAddress(addr); } /** * Returns {@code true} if the supplied string is a valid URI IP string * literal, {@code false} otherwise. * * @param ipString {@code String} to evaluated as an IP URI host string literal * @return {@code true} if the argument is a valid IP URI host */ public static boolean isUriInetAddress(String ipString) { try { forUriString(ipString); return true; } catch (IllegalArgumentException e) { return false; } } /** * Evaluates whether the argument is an IPv6 "compat" address. * * <p>An "IPv4 compatible", or "compat", address is one with 96 leading * bits of zero, with the remaining 32 bits interpreted as an * IPv4 address. These are conventionally represented in string * literals as {@code "::192.168.0.1"}, though {@code "::c0a8:1"} is * also considered an IPv4 compatible address (and equivalent to * {@code "::192.168.0.1"}). * * <p>For more on IPv4 compatible addresses see section 2.5.5.1 of * <a target="_parent" * href="http://tools.ietf.org/html/rfc4291#section-2.5.5.1" * >http://tools.ietf.org/html/rfc4291</a> * * <p>NOTE: This method is different from * {@link Inet6Address#isIPv4CompatibleAddress} in that it more * correctly classifies {@code "::"} and {@code "::1"} as * proper IPv6 addresses (which they are), NOT IPv4 compatible * addresses (which they are generally NOT considered to be). * * @param ip {@link Inet6Address} to be examined for embedded IPv4 compatible address format * @return {@code true} if the argument is a valid "compat" address */ public static boolean isCompatIPv4Address(Inet6Address ip) { if (!ip.isIPv4CompatibleAddress()) { return false; } byte[] bytes = ip.getAddress(); if ((bytes[12] == 0) && (bytes[13] == 0) && (bytes[14] == 0) && ((bytes[15] == 0) || (bytes[15] == 1))) { return false; } return true; } /** * Returns the IPv4 address embedded in an IPv4 compatible address. * * @param ip {@link Inet6Address} to be examined for an embedded IPv4 address * @return {@link Inet4Address} of the embedded IPv4 address * @throws IllegalArgumentException if the argument is not a valid IPv4 compatible address */ public static Inet4Address getCompatIPv4Address(Inet6Address ip) { Preconditions.checkArgument(isCompatIPv4Address(ip), "Address '%s' is not IPv4-compatible.", toAddrString(ip)); return getInet4Address(Arrays.copyOfRange(ip.getAddress(), 12, 16)); } /** * Evaluates whether the argument is a 6to4 address. * * <p>6to4 addresses begin with the {@code "2002::/16"} prefix. * The next 32 bits are the IPv4 address of the host to which * IPv6-in-IPv4 tunneled packets should be routed. * * <p>For more on 6to4 addresses see section 2 of * <a target="_parent" href="http://tools.ietf.org/html/rfc3056#section-2" * >http://tools.ietf.org/html/rfc3056</a> * * @param ip {@link Inet6Address} to be examined for 6to4 address format * @return {@code true} if the argument is a 6to4 address */ public static boolean is6to4Address(Inet6Address ip) { byte[] bytes = ip.getAddress(); return (bytes[0] == (byte) 0x20) && (bytes[1] == (byte) 0x02); } /** * Returns the IPv4 address embedded in a 6to4 address. * * @param ip {@link Inet6Address} to be examined for embedded IPv4 in 6to4 address * @return {@link Inet4Address} of embedded IPv4 in 6to4 address * @throws IllegalArgumentException if the argument is not a valid IPv6 6to4 address */ public static Inet4Address get6to4IPv4Address(Inet6Address ip) { Preconditions.checkArgument(is6to4Address(ip), "Address '%s' is not a 6to4 address.", toAddrString(ip)); return getInet4Address(Arrays.copyOfRange(ip.getAddress(), 2, 6)); } /** * A simple immutable data class to encapsulate the information to be found in a * Teredo address. * * <p>All of the fields in this class are encoded in various portions * of the IPv6 address as part of the protocol. More protocols details * can be found at: * <a target="_parent" href="http://en.wikipedia.org/wiki/Teredo_tunneling" * >http://en.wikipedia.org/wiki/Teredo_tunneling</a>. * * <p>The RFC can be found here: * <a target="_parent" href="http://tools.ietf.org/html/rfc4380" * >http://tools.ietf.org/html/rfc4380</a>. * * @since 5.0 */ @Beta public static final class TeredoInfo { private final Inet4Address server; private final Inet4Address client; private final int port; private final int flags; /** * Constructs a TeredoInfo instance. * * <p>Both server and client can be {@code null}, in which case the * value {@code "0.0.0.0"} will be assumed. * * @throws IllegalArgumentException if either of the {@code port} or the {@code flags} * arguments are out of range of an unsigned short */ // TODO: why is this public? public TeredoInfo( @Nullable Inet4Address server, @Nullable Inet4Address client, int port, int flags) { Preconditions.checkArgument((port >= 0) && (port <= 0xffff), "port '%s' is out of range (0 <= port <= 0xffff)", port); Preconditions.checkArgument((flags >= 0) && (flags <= 0xffff), "flags '%s' is out of range (0 <= flags <= 0xffff)", flags); this.server = MoreObjects.firstNonNull(server, ANY4); this.client = MoreObjects.firstNonNull(client, ANY4); this.port = port; this.flags = flags; } public Inet4Address getServer() { return server; } public Inet4Address getClient() { return client; } public int getPort() { return port; } public int getFlags() { return flags; } } /** * Evaluates whether the argument is a Teredo address. * * <p>Teredo addresses begin with the {@code "2001::/32"} prefix. * * @param ip {@link Inet6Address} to be examined for Teredo address format * @return {@code true} if the argument is a Teredo address */ public static boolean isTeredoAddress(Inet6Address ip) { byte[] bytes = ip.getAddress(); return (bytes[0] == (byte) 0x20) && (bytes[1] == (byte) 0x01) && (bytes[2] == 0) && (bytes[3] == 0); } /** * Returns the Teredo information embedded in a Teredo address. * * @param ip {@link Inet6Address} to be examined for embedded Teredo information * @return extracted {@code TeredoInfo} * @throws IllegalArgumentException if the argument is not a valid IPv6 Teredo address */ public static TeredoInfo getTeredoInfo(Inet6Address ip) { Preconditions.checkArgument(isTeredoAddress(ip), "Address '%s' is not a Teredo address.", toAddrString(ip)); byte[] bytes = ip.getAddress(); Inet4Address server = getInet4Address(Arrays.copyOfRange(bytes, 4, 8)); int flags = ByteStreams.newDataInput(bytes, 8).readShort() & 0xffff; // Teredo obfuscates the mapped client port, per section 4 of the RFC. int port = ~ByteStreams.newDataInput(bytes, 10).readShort() & 0xffff; byte[] clientBytes = Arrays.copyOfRange(bytes, 12, 16); for (int i = 0; i < clientBytes.length; i++) { // Teredo obfuscates the mapped client IP, per section 4 of the RFC. clientBytes[i] = (byte) ~clientBytes[i]; } Inet4Address client = getInet4Address(clientBytes); return new TeredoInfo(server, client, port, flags); } /** * Evaluates whether the argument is an ISATAP address. * * <p>From RFC 5214: "ISATAP interface identifiers are constructed in * Modified EUI-64 format [...] by concatenating the 24-bit IANA OUI * (00-00-5E), the 8-bit hexadecimal value 0xFE, and a 32-bit IPv4 * address in network byte order [...]" * * <p>For more on ISATAP addresses see section 6.1 of * <a target="_parent" href="http://tools.ietf.org/html/rfc5214#section-6.1" * >http://tools.ietf.org/html/rfc5214</a> * * @param ip {@link Inet6Address} to be examined for ISATAP address format * @return {@code true} if the argument is an ISATAP address */ public static boolean isIsatapAddress(Inet6Address ip) { // If it's a Teredo address with the right port (41217, or 0xa101) // which would be encoded as 0x5efe then it can't be an ISATAP address. if (isTeredoAddress(ip)) { return false; } byte[] bytes = ip.getAddress(); if ((bytes[8] | (byte) 0x03) != (byte) 0x03) { // Verify that high byte of the 64 bit identifier is zero, modulo // the U/L and G bits, with which we are not concerned. return false; } return (bytes[9] == (byte) 0x00) && (bytes[10] == (byte) 0x5e) && (bytes[11] == (byte) 0xfe); } /** * Returns the IPv4 address embedded in an ISATAP address. * * @param ip {@link Inet6Address} to be examined for embedded IPv4 in ISATAP address * @return {@link Inet4Address} of embedded IPv4 in an ISATAP address * @throws IllegalArgumentException if the argument is not a valid IPv6 ISATAP address */ public static Inet4Address getIsatapIPv4Address(Inet6Address ip) { Preconditions.checkArgument(isIsatapAddress(ip), "Address '%s' is not an ISATAP address.", toAddrString(ip)); return getInet4Address(Arrays.copyOfRange(ip.getAddress(), 12, 16)); } /** * Examines the Inet6Address to determine if it is an IPv6 address of one * of the specified address types that contain an embedded IPv4 address. * * <p>NOTE: ISATAP addresses are explicitly excluded from this method * due to their trivial spoofability. With other transition addresses * spoofing involves (at least) infection of one's BGP routing table. * * @param ip {@link Inet6Address} to be examined for embedded IPv4 client address * @return {@code true} if there is an embedded IPv4 client address * @since 7.0 */ public static boolean hasEmbeddedIPv4ClientAddress(Inet6Address ip) { return isCompatIPv4Address(ip) || is6to4Address(ip) || isTeredoAddress(ip); } /** * Examines the Inet6Address to extract the embedded IPv4 client address * if the InetAddress is an IPv6 address of one of the specified address * types that contain an embedded IPv4 address. * * <p>NOTE: ISATAP addresses are explicitly excluded from this method * due to their trivial spoofability. With other transition addresses * spoofing involves (at least) infection of one's BGP routing table. * * @param ip {@link Inet6Address} to be examined for embedded IPv4 client address * @return {@link Inet4Address} of embedded IPv4 client address * @throws IllegalArgumentException if the argument does not have a valid embedded IPv4 address */ public static Inet4Address getEmbeddedIPv4ClientAddress(Inet6Address ip) { if (isCompatIPv4Address(ip)) { return getCompatIPv4Address(ip); } if (is6to4Address(ip)) { return get6to4IPv4Address(ip); } if (isTeredoAddress(ip)) { return getTeredoInfo(ip).getClient(); } throw formatIllegalArgumentException("'%s' has no embedded IPv4 address.", toAddrString(ip)); } /** * Evaluates whether the argument is an "IPv4 mapped" IPv6 address. * * <p>An "IPv4 mapped" address is anything in the range ::ffff:0:0/96 * (sometimes written as ::ffff:0.0.0.0/96), with the last 32 bits * interpreted as an IPv4 address. * * <p>For more on IPv4 mapped addresses see section 2.5.5.2 of * <a target="_parent" * href="http://tools.ietf.org/html/rfc4291#section-2.5.5.2" * >http://tools.ietf.org/html/rfc4291</a> * * <p>Note: This method takes a {@code String} argument because * {@link InetAddress} automatically collapses mapped addresses to IPv4. * (It is actually possible to avoid this using one of the obscure * {@link Inet6Address} methods, but it would be unwise to depend on such * a poorly-documented feature.) * * @param ipString {@code String} to be examined for embedded IPv4-mapped IPv6 address format * @return {@code true} if the argument is a valid "mapped" address * @since 10.0 */ public static boolean isMappedIPv4Address(String ipString) { byte[] bytes = ipStringToBytes(ipString); if (bytes != null && bytes.length == 16) { for (int i = 0; i < 10; i++) { if (bytes[i] != 0) { return false; } } for (int i = 10; i < 12; i++) { if (bytes[i] != (byte) 0xff) { return false; } } return true; } return false; } /** * Coerces an IPv6 address into an IPv4 address. * * <p>HACK: As long as applications continue to use IPv4 addresses for * indexing into tables, accounting, et cetera, it may be necessary to * <b>coerce</b> IPv6 addresses into IPv4 addresses. This function does * so by hashing the upper 64 bits into {@code 224.0.0.0/3} * (64 bits into 29 bits). * * <p>A "coerced" IPv4 address is equivalent to itself. * * <p>NOTE: This function is failsafe for security purposes: ALL IPv6 * addresses (except localhost (::1)) are hashed to avoid the security * risk associated with extracting an embedded IPv4 address that might * permit elevated privileges. * * @param ip {@link InetAddress} to "coerce" * @return {@link Inet4Address} represented "coerced" address * @since 7.0 */ public static Inet4Address getCoercedIPv4Address(InetAddress ip) { if (ip instanceof Inet4Address) { return (Inet4Address) ip; } // Special cases: byte[] bytes = ip.getAddress(); boolean leadingBytesOfZero = true; for (int i = 0; i < 15; ++i) { if (bytes[i] != 0) { leadingBytesOfZero = false; break; } } if (leadingBytesOfZero && (bytes[15] == 1)) { return LOOPBACK4; // ::1 } else if (leadingBytesOfZero && (bytes[15] == 0)) { return ANY4; // ::0 } Inet6Address ip6 = (Inet6Address) ip; long addressAsLong = 0; if (hasEmbeddedIPv4ClientAddress(ip6)) { addressAsLong = getEmbeddedIPv4ClientAddress(ip6).hashCode(); } else { // Just extract the high 64 bits (assuming the rest is user-modifiable). addressAsLong = ByteBuffer.wrap(ip6.getAddress(), 0, 8).getLong(); } // Many strategies for hashing are possible. This might suffice for now. int coercedHash = Hashing.murmur3_32().hashLong(addressAsLong).asInt(); // Squash into 224/4 Multicast and 240/4 Reserved space (i.e. 224/3). coercedHash |= 0xe0000000; // Fixup to avoid some "illegal" values. Currently the only potential // illegal value is 255.255.255.255. if (coercedHash == 0xffffffff) { coercedHash = 0xfffffffe; } return getInet4Address(Ints.toByteArray(coercedHash)); } /** * Returns an integer representing an IPv4 address regardless of * whether the supplied argument is an IPv4 address or not. * * <p>IPv6 addresses are <b>coerced</b> to IPv4 addresses before being * converted to integers. * * <p>As long as there are applications that assume that all IP addresses * are IPv4 addresses and can therefore be converted safely to integers * (for whatever purpose) this function can be used to handle IPv6 * addresses as well until the application is suitably fixed. * * <p>NOTE: an IPv6 address coerced to an IPv4 address can only be used * for such purposes as rudimentary identification or indexing into a * collection of real {@link InetAddress}es. They cannot be used as * real addresses for the purposes of network communication. * * @param ip {@link InetAddress} to convert * @return {@code int}, "coerced" if ip is not an IPv4 address * @since 7.0 */ public static int coerceToInteger(InetAddress ip) { return ByteStreams.newDataInput(getCoercedIPv4Address(ip).getAddress()).readInt(); } /** * Returns an Inet4Address having the integer value specified by * the argument. * * @param address {@code int}, the 32bit integer address to be converted * @return {@link Inet4Address} equivalent of the argument */ public static Inet4Address fromInteger(int address) { return getInet4Address(Ints.toByteArray(address)); } /** * Returns an address from a <b>little-endian ordered</b> byte array * (the opposite of what {@link InetAddress#getByAddress} expects). * * <p>IPv4 address byte array must be 4 bytes long and IPv6 byte array * must be 16 bytes long. * * @param addr the raw IP address in little-endian byte order * @return an InetAddress object created from the raw IP address * @throws UnknownHostException if IP address is of illegal length */ public static InetAddress fromLittleEndianByteArray(byte[] addr) throws UnknownHostException { byte[] reversed = new byte[addr.length]; for (int i = 0; i < addr.length; i++) { reversed[i] = addr[addr.length - i - 1]; } return InetAddress.getByAddress(reversed); } /** * Returns a new InetAddress that is one less than the passed in address. * This method works for both IPv4 and IPv6 addresses. * * @param address the InetAddress to decrement * @return a new InetAddress that is one less than the passed in address * @throws IllegalArgumentException if InetAddress is at the beginning of its range * @since 18.0 */ public static InetAddress decrement(InetAddress address) { byte[] addr = address.getAddress(); int i = addr.length - 1; while (i >= 0 && addr[i] == (byte) 0x00) { addr[i] = (byte) 0xff; i--; } Preconditions.checkArgument(i >= 0, "Decrementing %s would wrap.", address); addr[i]--; return bytesToInetAddress(addr); } /** * Returns a new InetAddress that is one more than the passed in address. * This method works for both IPv4 and IPv6 addresses. * * @param address the InetAddress to increment * @return a new InetAddress that is one more than the passed in address * @throws IllegalArgumentException if InetAddress is at the end of its range * @since 10.0 */ public static InetAddress increment(InetAddress address) { byte[] addr = address.getAddress(); int i = addr.length - 1; while (i >= 0 && addr[i] == (byte) 0xff) { addr[i] = 0; i--; } Preconditions.checkArgument(i >= 0, "Incrementing %s would wrap.", address); addr[i]++; return bytesToInetAddress(addr); } /** * Returns true if the InetAddress is either 255.255.255.255 for IPv4 or * ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff for IPv6. * * @return true if the InetAddress is either 255.255.255.255 for IPv4 or * ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff for IPv6 * @since 10.0 */ public static boolean isMaximum(InetAddress address) { byte[] addr = address.getAddress(); for (int i = 0; i < addr.length; i++) { if (addr[i] != (byte) 0xff) { return false; } } return true; } private static IllegalArgumentException formatIllegalArgumentException( String format, Object... args) { return new IllegalArgumentException(String.format(Locale.ROOT, format, args)); } }
[ "senhadjielrhazi@gmail.com" ]
senhadjielrhazi@gmail.com
2b8f895a566de84179a7c2ab471610e3ff4d2f93
b4524cff0c165ec234d9e10413132ff8e275cb01
/src/assignment5/Critter4.java
4ee8b56e9ae57165f0b9c1ac749e47e8d55a4e23
[]
no_license
gn3544/CrittersPart2
203aee33ea51f616cc27eb033e043bfd82e6a6f4
bea3a3d42042ac62149b1c0a57eb583a32fb3fd5
refs/heads/master
2021-01-19T00:17:56.372932
2016-11-10T04:06:07
2016-11-10T04:06:07
73,026,216
0
0
null
null
null
null
UTF-8
Java
false
false
1,434
java
/* CRITTERS Critter4.java * EE422C Project 5 submission by * <Gaurav Nagar> * <gn3544> * <16480> * <Minkoo Park> * <mp32454> * <16480> * Slip days used: <0> * Fall 2016 */ package assignment5; import assignment5.Critter.CritterShape; public class Critter4 extends Critter{ boolean alreadyMoved; /** * Constructor that keeps track of if a MyCritterN object has moved */ public Critter4(){ alreadyMoved = false; } /** * MyCritterN object will run, walk, or reproduce randomly with equal chance */ @Override public void doTimeStep() { int random = getRandomInt(9); if (random < 3){ run(getRandomInt(8)); alreadyMoved = true; } else if (random < 6){ walk(getRandomInt(8)); alreadyMoved = true; } else if (random < 9){ reproduce(new Critter4(), getRandomInt(8)); } } /** * Runs if it hasn't moved before, else fights */ @Override public boolean fight(String opponent) { if (!alreadyMoved){ run(getRandomInt(8)); return false; } return true; } /** * Returns String characterization of MyCritterN */ public String toString() { return "4"; } @Override public CritterShape viewShape(){ return CritterShape.DIAMOND; } @Override public javafx.scene.paint.Color viewOutlineColor() { return javafx.scene.paint.Color.RED; } @Override public javafx.scene.paint.Color viewFillColor() { return javafx.scene.paint.Color.RED; } }
[ "gnagar1996@utexas.edu" ]
gnagar1996@utexas.edu
18f995eb0cbae566d29a5344b3766e22a917032f
97fd02f71b45aa235f917e79dd68b61c62b56c1c
/src/main/java/com/tencentcloudapi/tsf/v20180326/models/DescribeClustersResponse.java
291dccc21eecf34ead4303bce808cede66261207
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-java
7df922f7c5826732e35edeab3320035e0cdfba05
09fa672d75e5ca33319a23fcd8b9ca3d2afab1ec
refs/heads/master
2023-09-04T10:51:57.854153
2023-09-01T03:21:09
2023-09-01T03:21:09
129,837,505
537
317
Apache-2.0
2023-09-13T02:42:03
2018-04-17T02:58:16
Java
UTF-8
Java
false
false
3,430
java
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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.tencentcloudapi.tsf.v20180326.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class DescribeClustersResponse extends AbstractModel{ /** * Cluster分页信息 注意:此字段可能返回 null,表示取不到有效值。 */ @SerializedName("Result") @Expose private TsfPageClusterV2 Result; /** * 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ @SerializedName("RequestId") @Expose private String RequestId; /** * Get Cluster分页信息 注意:此字段可能返回 null,表示取不到有效值。 * @return Result Cluster分页信息 注意:此字段可能返回 null,表示取不到有效值。 */ public TsfPageClusterV2 getResult() { return this.Result; } /** * Set Cluster分页信息 注意:此字段可能返回 null,表示取不到有效值。 * @param Result Cluster分页信息 注意:此字段可能返回 null,表示取不到有效值。 */ public void setResult(TsfPageClusterV2 Result) { this.Result = Result; } /** * Get 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 * @return RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ public String getRequestId() { return this.RequestId; } /** * Set 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 * @param RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 */ public void setRequestId(String RequestId) { this.RequestId = RequestId; } public DescribeClustersResponse() { } /** * NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy, * and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy. */ public DescribeClustersResponse(DescribeClustersResponse source) { if (source.Result != null) { this.Result = new TsfPageClusterV2(source.Result); } if (source.RequestId != null) { this.RequestId = new String(source.RequestId); } } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamObj(map, prefix + "Result.", this.Result); this.setParamSimple(map, prefix + "RequestId", this.RequestId); } }
[ "tencentcloudapi@tencent.com" ]
tencentcloudapi@tencent.com
0ac228966d32aed5fe02f73583469de8c10e6c0c
818121ec569b2ace2a25d7c0b9fd5cdd01ba5b46
/src/com/leetcode/strings/RemoveKDigits.java
f196812ad61c6247084d95cadcecd2975a50ae70
[]
no_license
kirangurijala/Java_LC
ec44e9e8ea543372b4f53368f332c1bab6a6bf73
f5d0d3d32a1d83a7cfdba467dad9bb51d52b093e
refs/heads/main
2023-07-08T02:25:41.143472
2021-04-22T14:36:42
2021-04-22T14:36:42
331,473,336
0
0
null
null
null
null
UTF-8
Java
false
false
1,963
java
package com.leetcode.strings; import java.util.ArrayDeque; import java.util.Deque; /* https://leetcode.com/problems/remove-k-digits/ Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num. Example 1: Input: num = "1432219", k = 3 Output: "1219" Explanation: Remove the three digits 4, 3, and 2 to form the new number 1219 which is the smallest. Example 2: Input: num = "10200", k = 1 Output: "200" Explanation: Remove the leading 1 and the number is 200. Note that the output must not contain leading zeroes. Example 3: Input: num = "10", k = 2 Output: "0" Explanation: Remove all the digits from the number and it is left with nothing which is 0. Constraints: 1 <= k <= num.length <= 105 num consists of only digits. num does not have any leading zeros except for the zero itself. */ public class RemoveKDigits { public String removeKdigits(String num, int k) { //Remove the k digits from the tail. Deque<Character> dq=new ArrayDeque<>(); for(char ch:num.toCharArray()){ while(k>0 && !dq.isEmpty() && dq.peekLast()>ch){ k--; dq.removeLast(); } dq.addLast(ch); } //Remove the remaining digits from the tail. while(k>0){ k--; dq.removeLast(); } // Remove all zeros from the front of the DQ while(!dq.isEmpty() && dq.peekFirst()=='0'){ dq.removeFirst(); } if(dq.isEmpty()){ return "0"; } // Build the number from DQ StringBuilder sb=new StringBuilder(); for(char ch:dq){ sb.append(ch); } return sb.toString(); } public static void main(String[] args) { RemoveKDigits solution = new RemoveKDigits(); System.out.println(solution.removeKdigits("1432219",3)); } }
[ "Kirankumargurijala@gmail.com" ]
Kirankumargurijala@gmail.com
5c5427a465ca3502041e26278581170eed8c8506
79dfd9efa6100c7cfc0256eba1601cc14a490e53
/ListViewGridView/app/src/main/java/com/arikansproject/aaa/listviewgridviewkullanimi/MainActivity.java
7f5c99f2e45ee278f3ec2c67e0d22c9e4ac9d7f2
[]
no_license
ahmetesrefarikan1/StajCalismalari
d545331f5e176fec9c45ed201571ab9760db256d
b23a3a111489b64f619d252c6962d9453e1f786a
refs/heads/main
2023-09-03T23:49:51.854897
2021-10-11T21:06:28
2021-10-11T21:06:28
416,005,310
0
0
null
null
null
null
UTF-8
Java
false
false
1,440
java
package com.arikansproject.aaa.listviewgridviewkullanimi; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private ListView listView; private ArrayList<String>ulkeler=new ArrayList<>(); private ArrayAdapter<String>veriAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView=findViewById(R.id.listView); ulkeler.add("Tr"); ulkeler.add("En"); ulkeler.add("Sp"); ulkeler.add("Fr"); ulkeler.add("Gr"); ulkeler.add("Ir"); ulkeler.add("Nw"); veriAdapter=new ArrayAdapter<>(MainActivity.this,android.R.layout.simple_list_item_1,android.R.id.text1,ulkeler); listView.setAdapter(veriAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(),"Seçtiğiniz ülke :"+ulkeler.get(position),Toast.LENGTH_SHORT).show(); } }); } }
[ "ahmetarikan.1@yandex.com" ]
ahmetarikan.1@yandex.com
7d01591db133dbb3e0b31b13479a686db2fa8c2d
f9e2135cbd9181bb4706d0fa971590679b161811
/decompiled/sources/com/umeng/commonsdk/UMConfigureImpl.java
9b87c040204dd27c39b174f91a5a9c9dceba88cf
[]
no_license
altilunium/android-virus
b55d811505cae712c33194a181d93870b4bac1ce
a2b3c4f1ffeccba4ff89c0417a01f67670fc5bb9
refs/heads/main
2023-04-01T09:09:08.807010
2021-04-10T16:06:51
2021-04-10T16:06:51
356,600,140
1
1
null
null
null
null
UTF-8
Java
false
false
11,588
java
package com.umeng.commonsdk; import android.content.Context; import android.content.SharedPreferences; import com.umeng.commonsdk.framework.UMEnvelopeBuild; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class UMConfigureImpl { /* renamed from: a */ private static String f1040a = "delayed_transmission_flag_new"; /* renamed from: b */ private static CopyOnWriteArrayList f1041b = new CopyOnWriteArrayList(); /* renamed from: c */ private static int f1042c = 0; /* renamed from: d */ private static boolean f1043d = false; /* renamed from: e */ private static final int f1044e = 1000; /* renamed from: f */ private static ScheduledExecutorService f1045f; /* renamed from: g */ private static Context f1046g; /* renamed from: h */ private static int f1047h = 0; /* renamed from: i */ private static Runnable f1048i = new Runnable() { /* class com.umeng.commonsdk.UMConfigureImpl.RunnableC01391 */ public void run() { try { if (UMConfigureImpl.f1042c == 0 || UMConfigureImpl.f1047h >= 10) { if (!UMConfigureImpl.f1043d) { boolean unused = UMConfigureImpl.f1043d = true; UMConfigureImpl.m1104b(UMConfigureImpl.f1046g); } if (UMConfigureImpl.f1045f != null) { UMConfigureImpl.f1045f.shutdown(); ScheduledExecutorService unused2 = UMConfigureImpl.f1045f = null; } } UMConfigureImpl.m1110f(); } catch (Exception e) { } } }; /* renamed from: f */ static /* synthetic */ int m1110f() { int i = f1047h; f1047h = i + 1; return i; } public static void init(Context context) { if (context != null) { f1046g = context; try { if (f1042c >= 1) { if (!m1108d(context)) { UMEnvelopeBuild.setTransmissionSendFlag(false); m1105c(context); if (f1045f == null) { ScheduledExecutorService newScheduledThreadPool = Executors.newScheduledThreadPool(1); f1045f = newScheduledThreadPool; newScheduledThreadPool.scheduleAtFixedRate(f1048i, 0, 100, TimeUnit.MILLISECONDS); } } else { UMEnvelopeBuild.setTransmissionSendFlag(true); } return; } UMEnvelopeBuild.setTransmissionSendFlag(true); } catch (Exception e) { } } } /* access modifiers changed from: private */ /* JADX WARNING: Exception block dominator not found, dom blocks: [] */ /* renamed from: b */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static synchronized void m1104b(android.content.Context r2) { /* java.lang.Class<com.umeng.commonsdk.UMConfigureImpl> r2 = com.umeng.commonsdk.UMConfigureImpl.class monitor-enter(r2) r0 = 1 com.umeng.commonsdk.framework.UMEnvelopeBuild.setTransmissionSendFlag(r0) // Catch:{ Exception -> 0x002b, all -> 0x0028 } java.util.concurrent.CopyOnWriteArrayList r0 = com.umeng.commonsdk.UMConfigureImpl.f1041b // Catch:{ Exception -> 0x002b, all -> 0x0028 } if (r0 == 0) goto L_0x0027 int r0 = r0.size() // Catch:{ Exception -> 0x002b, all -> 0x0028 } if (r0 <= 0) goto L_0x0027 java.util.concurrent.CopyOnWriteArrayList r0 = com.umeng.commonsdk.UMConfigureImpl.f1041b // Catch:{ Exception -> 0x002b, all -> 0x0028 } java.util.Iterator r0 = r0.iterator() // Catch:{ Exception -> 0x002b, all -> 0x0028 } L_0x0017: boolean r1 = r0.hasNext() // Catch:{ Exception -> 0x002b, all -> 0x0028 } if (r1 == 0) goto L_0x0027 java.lang.Object r1 = r0.next() // Catch:{ Exception -> 0x002b, all -> 0x0028 } com.umeng.commonsdk.utils.onMessageSendListener r1 = (com.umeng.commonsdk.utils.onMessageSendListener) r1 // Catch:{ Exception -> 0x002b, all -> 0x0028 } r1.onMessageSend() // Catch:{ Exception -> 0x002b, all -> 0x0028 } goto L_0x0017 L_0x0027: goto L_0x002c L_0x0028: r0 = move-exception monitor-exit(r2) throw r0 L_0x002b: r0 = move-exception L_0x002c: monitor-exit(r2) return */ throw new UnsupportedOperationException("Method not decompiled: com.umeng.commonsdk.UMConfigureImpl.m1104b(android.content.Context):void"); } /* JADX WARNING: Exception block dominator not found, dom blocks: [] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static synchronized void registerMessageSendListener(com.umeng.commonsdk.utils.onMessageSendListener r2) { /* java.lang.Class<com.umeng.commonsdk.UMConfigureImpl> r0 = com.umeng.commonsdk.UMConfigureImpl.class monitor-enter(r0) java.util.concurrent.CopyOnWriteArrayList r1 = com.umeng.commonsdk.UMConfigureImpl.f1041b // Catch:{ Exception -> 0x0034, all -> 0x0031 } if (r1 == 0) goto L_0x000a r1.add(r2) // Catch:{ Exception -> 0x0034, all -> 0x0031 } L_0x000a: boolean r2 = com.umeng.commonsdk.framework.UMEnvelopeBuild.getTransmissionSendFlag() // Catch:{ Exception -> 0x0034, all -> 0x0031 } if (r2 == 0) goto L_0x0030 java.util.concurrent.CopyOnWriteArrayList r2 = com.umeng.commonsdk.UMConfigureImpl.f1041b // Catch:{ Exception -> 0x0034, all -> 0x0031 } if (r2 == 0) goto L_0x0030 int r2 = r2.size() // Catch:{ Exception -> 0x0034, all -> 0x0031 } if (r2 <= 0) goto L_0x0030 java.util.concurrent.CopyOnWriteArrayList r2 = com.umeng.commonsdk.UMConfigureImpl.f1041b // Catch:{ Exception -> 0x0034, all -> 0x0031 } java.util.Iterator r2 = r2.iterator() // Catch:{ Exception -> 0x0034, all -> 0x0031 } L_0x0020: boolean r1 = r2.hasNext() // Catch:{ Exception -> 0x0034, all -> 0x0031 } if (r1 == 0) goto L_0x0030 java.lang.Object r1 = r2.next() // Catch:{ Exception -> 0x0034, all -> 0x0031 } com.umeng.commonsdk.utils.onMessageSendListener r1 = (com.umeng.commonsdk.utils.onMessageSendListener) r1 // Catch:{ Exception -> 0x0034, all -> 0x0031 } r1.onMessageSend() // Catch:{ Exception -> 0x0034, all -> 0x0031 } goto L_0x0020 L_0x0030: goto L_0x0035 L_0x0031: r2 = move-exception monitor-exit(r0) throw r2 L_0x0034: r2 = move-exception L_0x0035: monitor-exit(r0) return */ throw new UnsupportedOperationException("Method not decompiled: com.umeng.commonsdk.UMConfigureImpl.registerMessageSendListener(com.umeng.commonsdk.utils.onMessageSendListener):void"); } /* JADX WARNING: Exception block dominator not found, dom blocks: [] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static synchronized void removeMessageSendListener(com.umeng.commonsdk.utils.onMessageSendListener r2) { /* java.lang.Class<com.umeng.commonsdk.UMConfigureImpl> r0 = com.umeng.commonsdk.UMConfigureImpl.class monitor-enter(r0) java.util.concurrent.CopyOnWriteArrayList r1 = com.umeng.commonsdk.UMConfigureImpl.f1041b // Catch:{ Exception -> 0x000e, all -> 0x000b } if (r1 == 0) goto L_0x000a r1.remove(r2) // Catch:{ Exception -> 0x000e, all -> 0x000b } L_0x000a: goto L_0x000f L_0x000b: r2 = move-exception monitor-exit(r0) throw r2 L_0x000e: r2 = move-exception L_0x000f: monitor-exit(r0) return */ throw new UnsupportedOperationException("Method not decompiled: com.umeng.commonsdk.UMConfigureImpl.removeMessageSendListener(com.umeng.commonsdk.utils.onMessageSendListener):void"); } /* JADX WARNING: Exception block dominator not found, dom blocks: [] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static synchronized void registerInterruptFlag() { /* java.lang.Class<com.umeng.commonsdk.UMConfigureImpl> r0 = com.umeng.commonsdk.UMConfigureImpl.class monitor-enter(r0) int r1 = com.umeng.commonsdk.UMConfigureImpl.f1042c // Catch:{ Exception -> 0x000d, all -> 0x000a } int r1 = r1 + 1 com.umeng.commonsdk.UMConfigureImpl.f1042c = r1 // Catch:{ Exception -> 0x000d, all -> 0x000a } goto L_0x000e L_0x000a: r1 = move-exception monitor-exit(r0) throw r1 L_0x000d: r1 = move-exception L_0x000e: monitor-exit(r0) return */ throw new UnsupportedOperationException("Method not decompiled: com.umeng.commonsdk.UMConfigureImpl.registerInterruptFlag():void"); } /* JADX WARNING: Exception block dominator not found, dom blocks: [] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static synchronized void removeInterruptFlag() { /* java.lang.Class<com.umeng.commonsdk.UMConfigureImpl> r0 = com.umeng.commonsdk.UMConfigureImpl.class monitor-enter(r0) int r1 = com.umeng.commonsdk.UMConfigureImpl.f1042c // Catch:{ Exception -> 0x000d, all -> 0x000a } int r1 = r1 + -1 com.umeng.commonsdk.UMConfigureImpl.f1042c = r1 // Catch:{ Exception -> 0x000d, all -> 0x000a } goto L_0x000e L_0x000a: r1 = move-exception monitor-exit(r0) throw r1 L_0x000d: r1 = move-exception L_0x000e: monitor-exit(r0) return */ throw new UnsupportedOperationException("Method not decompiled: com.umeng.commonsdk.UMConfigureImpl.removeInterruptFlag():void"); } /* renamed from: c */ private static void m1105c(Context context) { try { SharedPreferences sharedPreferences = context.getSharedPreferences(f1040a, 0); if (sharedPreferences != null) { SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putBoolean(f1040a, true); edit.commit(); } } catch (Throwable th) { } } /* renamed from: d */ private static boolean m1108d(Context context) { try { SharedPreferences sharedPreferences = context.getSharedPreferences(f1040a, 0); if (sharedPreferences != null) { return sharedPreferences.getBoolean(f1040a, false); } return false; } catch (Throwable th) { return false; } } }
[ "altilunium@tutanota.com" ]
altilunium@tutanota.com
38a3fa2a58545f714e1401e40f3c0c540ac9ad26
5afa5f129a4653a777bfdb2f41a35415ae6e8fda
/Android Client/src/sg/macbuntu/whs/HeritageSite.java
fa786d12cfc624d8bb54f658de16b23e84d07b1c
[]
no_license
geeknam/World-Heritage-Site
1b1f71b4a781e24fbb827a44f04fd2b0765a717c
27dd3d14f235f5e60024ba81775f3f4c257ed10b
refs/heads/master
2021-01-23T19:45:23.472411
2010-06-13T13:15:48
2010-06-13T13:15:48
718,401
0
2
null
null
null
null
UTF-8
Java
false
false
523
java
package sg.macbuntu.whs; public class HeritageSite { String name; String url; String geo; public HeritageSite(String name, String url, String geo) { this.name = name; this.url = url; this.geo = geo; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getGeo() { return geo; } public void setGeo(String geo) { this.geo = geo; } }
[ "emoinrp@gmail.com" ]
emoinrp@gmail.com
febfc9b51957d79d3640dcd63ab6961b7a2c8cd7
c83cd04472b651619062252a6c6b0388c42ac3a8
/3 GENERICS/p05_NullFinder/Main.java
c2dd174503664e6845ed492bf70c09236282ae94
[ "MIT" ]
permissive
TsvetanNikolov123/JAVA---OOP-Advanced
06bd7d28eaf2db26c802302aa919d7a47ab569d3
a2d1086e70dffc9de65927910e18b9dbb199f769
refs/heads/master
2021-06-04T19:43:38.367917
2019-09-17T06:24:07
2019-09-17T06:24:07
140,524,169
0
0
MIT
2020-10-13T16:06:27
2018-07-11T05:07:01
Java
UTF-8
Java
false
false
531
java
package p05_NullFinder; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { public static void main(String[] args) { List<Integer> integers = new ArrayList<>(); Collections.addAll(integers, 1, 2, null, 2, null); Iterable<Integer> integerNulls = ListUtils.getNullIndices(integers); // Iterable<String> strings = new ArrayList<>(); // Collections.addAll(strings, "a", null, "c"); } }
[ "tsdman1985@gmail.com" ]
tsdman1985@gmail.com
fe24d73fbd4e1ced7d70e175313ae3fa15d6ee3d
c66750ba174175c3085aebf25dde15110dc66485
/SRP/src/main/java/be/course/design/srp/opendataproject/bad/DataFileReader.java
e74deda6c59311d1cdef4b572ecbab7cf1e944e8
[]
no_license
facet-it/solid-design-code-examples
fe4a393ab1110709c49bcf08589aed1194406151
cd907aae054b47a4f0f1734b6857d8e47206e176
refs/heads/master
2021-09-10T00:49:25.801397
2021-09-05T18:55:47
2021-09-05T18:55:47
139,808,110
0
0
null
2020-10-13T18:00:48
2018-07-05T06:59:33
Java
UTF-8
Java
false
false
5,568
java
package be.course.design.srp.opendataproject.bad; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; public class DataFileReader { private static String UNKNOWN_CODE_ON_FIELD = "Onbekende veld - code combinatie: "; private static String UNKNOW_SEX_CODE = "Onbekende geslachts code. Moet 'm' of 'f' zijn"; private static String NO_NATIONALITY_CODE = "Geen nationaliteitscode"; private static String NO_MARITAL_STATUS_CODE = "Geen code voor burgelijke staat"; private static String ILLEGAL_AGE = "Ongeldige leeftijd"; private static String ILLEGAL_AMOUNT = "ongeldig aantal"; private DataFileParser fileParser = new DataFileParser(); private Function<String, PopulationStatisticsLine> lineConsumer = line -> this.parseLine(line); private List<LineError> errorLines = new ArrayList<>(); public void readFile(String fileName) { try (Stream<String> stream = Files.lines(Paths.get(fileName))) { errorLines.clear(); // we need to clear this every time we do a readfile otherwise results will mix. List<PopulationStatisticsLine> lines = stream.map(lineConsumer).collect(Collectors.toList()); } catch (IOException e) { System.out.println("Error occured: " + e.getMessage()); } } private PopulationStatisticsLine parseLine(String dataLine) { String[] tokens = dataLine.split(","); PopulationStatisticsLine line = new PopulationStatisticsLine(); try { line.setRefnisCodeGemeente(Integer.parseInt(tokens[0])); if (line.getRefnisCodeGemeente() > 100000) { errorLines.add(new LineError(UNKNOWN_CODE_ON_FIELD + "gemeente - " + line.getRefnisCodeGemeente(), line)); } } catch (NumberFormatException nfe) { errorLines.add(new LineError(nfe.getMessage(), line)); } line.setNaamGemeenteNl(tokens[1]); line.setNaamGemeenteFr(tokens[2]); try { line.setRefnisCodeArrondissement(Integer.parseInt(tokens[3])); if (line.getRefnisCodeArrondissement() > 100000) { errorLines.add(new LineError(UNKNOWN_CODE_ON_FIELD + "arrondissement - " + line.getRefnisCodeArrondissement(), line)); } } catch (NumberFormatException nfe) { errorLines.add(new LineError(nfe.getMessage(), line)); } line.setNaamArrondissementNl(tokens[4]); line.setNaamArrondissementNl(tokens[5]); try { line.setRefnisCodeProvincie(Integer.parseInt(tokens[6])); if (line.getRefnisCodeArrondissement() > 100000) { errorLines.add(new LineError(UNKNOWN_CODE_ON_FIELD + "provincie - " + line.getRefnisCodeProvincie(), line)); } } catch (NumberFormatException nfe) { errorLines.add(new LineError(nfe.getMessage(), line)); } line.setNaamProvincieNl(tokens[7]); line.setNaamProvincieFr(tokens[8]); try { line.setRefnisCodeGewest(Integer.parseInt(tokens[9])); if (line.getRefnisCodeArrondissement() > 100000) { errorLines.add(new LineError(UNKNOWN_CODE_ON_FIELD + "gewest - " + line.getRefnisCodeGewest(), line)); } } catch (NumberFormatException nfe) { errorLines.add(new LineError(nfe.getMessage(), line)); } line.setNaamGewestNl(tokens[10]); line.setNaamGewestFr(tokens[11]); line.setGeslacht(tokens[12]); if (!line.getGeslacht().toLowerCase().equals("m") || !line.getGeslacht().toLowerCase().equals("f")) { errorLines.add(new LineError(UNKNOW_SEX_CODE, line)); } line.setNationaliteitsCode(tokens[13]); if (line.getNationaliteitsCode() == null || line.getNationaliteitsCode() .equals("")) { errorLines.add(new LineError(NO_NATIONALITY_CODE, line)); } line.setNationaliteitFr(tokens[14]); line.setNationaliteitNl(tokens[15]); line.setCodeBurgerlijkeStaat(tokens[16]); if (line.getCodeBurgerlijkeStaat() == null || line.getCodeBurgerlijkeStaat() .equals("")) { errorLines.add(new LineError(NO_MARITAL_STATUS_CODE, line)); } line.setBurgerlijkeStaatFr(tokens[17]); line.setBurgerlijkeStaatNl(tokens[18]); line.setLeeftijd(Integer.parseInt(tokens[19])); if (line.getLeeftijd() < 1 || line.getLeeftijd() > 150) { errorLines.add(new LineError(ILLEGAL_AGE, line)); } line.setAantal(Integer.parseInt(tokens[20])); if (line.getAantal() < 1) { errorLines.add(new LineError(ILLEGAL_AMOUNT, line)); } line.setJaartal(tokens[21]); return line; } public void simpleReport() { System.out.println("The amount of errors in this file: " + this.errorLines.size()); System.out.println("----------------------------------------------"); errorLines.stream().forEach(line -> { System.out.println(line.getError()); System.out.println("-----------"); }); } }
[ "facet.it.be@gmail.com" ]
facet.it.be@gmail.com
2c9a5f1214d0504f70de96fa76478fc5466bb638
f9164be8106907a0c97a9f8a65cd5011f1b471e6
/src/main/java/imad/imad/imadWeb/repositories/AuthorRepository.java
ed5802e5f3a00476fe53d92333bae73c5ec3cd0b
[]
no_license
imadham/imadWeb
e0fbba580c78e45c3437e31728830fabddd2faad
bdfc9925951fdf080fdc4b2d8687556610550d72
refs/heads/master
2021-03-07T04:33:56.585962
2020-06-13T15:11:41
2020-06-13T15:11:41
246,245,964
0
0
null
null
null
null
UTF-8
Java
false
false
231
java
package imad.imad.imadWeb.repositories; import imad.imad.imadWeb.model.Author; import org.springframework.data.repository.CrudRepository; public interface AuthorRepository extends CrudRepository<Author, Long> { }
[ "imad.hamameh@gmail.com" ]
imad.hamameh@gmail.com
770e1067885886e9473d37665b6e9560ffc286c6
7c20e36b535f41f86b2e21367d687ea33d0cb329
/Capricornus/src/com/gopawpaw/erp/hibernate/c/ContMstr.java
3c9a38e27a8768289d421b79a950f9b7aa1757c6
[]
no_license
fazoolmail89/gopawpaw
50c95b924039fa4da8f309e2a6b2ebe063d48159
b23ccffce768a3d58d7d71833f30b85186a50cc5
refs/heads/master
2016-09-08T02:00:37.052781
2014-05-14T11:46:18
2014-05-14T11:46:18
35,091,153
1
1
null
null
null
null
UTF-8
Java
false
false
1,597
java
package com.gopawpaw.erp.hibernate.c; import java.util.Date; /** * ContMstr entity. @author MyEclipse Persistence Tools */ public class ContMstr extends AbstractContMstr implements java.io.Serializable { // Constructors /** default constructor */ public ContMstr() { } /** full constructor */ public ContMstr(ContMstrId id, String contDesc, Integer contCmtindx, Double contHeight, Double contWidth, Double contLength, String contHwlUm, Double contTareWeight, Double contMaxLoadWeight, String contWeightUm, Double contVolume, String contVolumeUm, String contSize, String contColor, String contClass, String contComposition, Boolean contReusable, Boolean contReturnable, String contReference1, String contReference2, String contReference3, String contReference4, String contReference5, Date contModDate, String contModUserid, String contUser1, String contUser2, String contQadc01, String contQadc02, Double contThickness, String contThicknessUm, Integer contOwner, String contIdMethod, Boolean contSpecialReqmnts, Double oidContMstr) { super(id, contDesc, contCmtindx, contHeight, contWidth, contLength, contHwlUm, contTareWeight, contMaxLoadWeight, contWeightUm, contVolume, contVolumeUm, contSize, contColor, contClass, contComposition, contReusable, contReturnable, contReference1, contReference2, contReference3, contReference4, contReference5, contModDate, contModUserid, contUser1, contUser2, contQadc01, contQadc02, contThickness, contThicknessUm, contOwner, contIdMethod, contSpecialReqmnts, oidContMstr); } }
[ "ahuaness@b3021582-c689-11de-ba9a-9db95b2bc6c5" ]
ahuaness@b3021582-c689-11de-ba9a-9db95b2bc6c5
699966b490f67fb99614d654b8f881408d9c8c53
3637f26c29be770bd9a74e3b21e29bf20d328993
/src/main/java/szilveszterandras/vspf/SocketObject.java
fe7379a2326ddec270eb95cf3f210743c52268c8
[]
no_license
szilveszterandras/vspf
c0e0b18a17f98f96a4b7690b5f50e091295570f5
ea30a7098ec38c04e16736c3fea406442820c7f2
refs/heads/master
2020-04-06T07:06:07.757058
2016-09-06T22:39:38
2016-09-06T22:39:38
64,608,748
0
0
null
null
null
null
UTF-8
Java
false
false
1,078
java
package szilveszterandras.vspf; public class SocketObject { private String topic; private String requestId; private String payload; private String token; public SocketObject() {}; public SocketObject(String topic, String requestId, String token, String payload) { this.topic = topic; this.requestId = requestId; this.token = token; this.payload = payload; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public String getRequestId() { return requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public String getPayload() { return payload; } public void setPayload(String payload) { this.payload = payload; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } @Override public String toString() { return String.format("Socket Message: topic: %s | requestId: %s | token: %s | payload: %s", topic, requestId, token, payload); } }
[ "szilveszter.andras@yahoo.com" ]
szilveszter.andras@yahoo.com
9e24c4f6a356797bb6606eac569ca14158373d1a
236d94f88732dd7b31d8f9c337792b58f4fef6c1
/Lab2.java
524b54ab47b7316867a39a2ebb2abffbe45f3e68
[]
no_license
erg52/Lab2
5c888d13b8ebd481a867140e7cf5a72b1e52a611
a36c6523e7feef3fb748651bda4390146064445c
refs/heads/master
2021-01-10T19:54:34.599573
2015-09-17T17:20:46
2015-09-17T17:20:46
42,670,596
0
0
null
null
null
null
UTF-8
Java
false
false
1,803
java
public class Lab2 { public static void main(String[] args) { System.out.println("As I was going to St. Ives"); System.out.println("I met a man with seven wives"); System.out.println("Each wife had seven sacks"); System.out.println("Each sack had seven cats"); System.out.println("Each cat had seven kits"); System.out.println("Kittens, cats, sacks, wives"); System.out.println("How many were going to St. Ives?"); // 1. Each of the following variable declarations has something // wrong with it. Uncomment the line and fix it. If your code // compiles, you are probably on the right track! // Assume that the original man is also going to St. Ives, so // the boolean variable manGoingToStIves should be true. boolean manGoingToStIves = true; short numWives = 8; int numSacksPerWife = 7; int numCatsPerSack = 7; int numKitsPerCat = 7; int total; // If the original man is going to St. Ives, then all are going // the narrator, original man, kitten, cats, sacks, wives. // If the original man is going AWAY from St. Ives, then the only // person going is the narrator if (manGoingToStIves) { // 2. Remember, if the original man is going to St. Ives, then // all of the wives, sacks, cats, and kittens are as well, along // with the narrator. // Calculate the number going to St. Ives total = 1+numWives*numSacksPerWife*numCatsPerSack*numKitsPerCat; } else { // Otherwise, only the narrator is going! total = 1; } // 3. Right before exiting, the system should print // "Number going to St. Ives is " and then, on the same line, // the number going to St. Ives (stored in the _total_ variable). // Add a statement or statements that will do this. System.out.println("Number going to St. Ives is "+ total); } }
[ "erg52@pitt.edu" ]
erg52@pitt.edu
0c1616f488da84c14d10a9435cc9e1bfef4b38af
aeabf31415868a66cd4947a512dd3c9410bd2928
/src/main/java/ru/tdv/soapclient/schemas/SetGFProperties.java
e17444a1967bfad297e7f24843e97b9cc0d8a5c0
[]
no_license
dasha5630/soapClient
dacedfa36ee1bff6d29b2043f95bc54645ebe617
d0dbe5ffbda18c98c245b4004b459c1a5d179bba
refs/heads/master
2022-08-04T13:18:43.466612
2020-05-16T15:17:29
2020-05-16T15:17:29
256,786,644
0
0
null
null
null
null
UTF-8
Java
false
false
3,185
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 // See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.04.18 at 06:19:32 PM MSK // package ru.tdv.soapclient.schemas; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="schemaID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;element name="IDs" type="{http://tempuri.org/}ArrayOfGuid" minOccurs="0"/&gt; * &lt;element name="properties" type="{http://tempuri.org/}ArrayOfRPropertySetItem1C" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "schemaID", "iDs", "properties" }) @XmlRootElement(name = "SetGFProperties") public class SetGFProperties { protected String schemaID; @XmlElement(name = "IDs") protected ArrayOfGuid iDs; protected ArrayOfRPropertySetItem1C properties; /** * Gets the value of the schemaID property. * * @return * possible object is * {@link String } * */ public String getSchemaID() { return schemaID; } /** * Sets the value of the schemaID property. * * @param value * allowed object is * {@link String } * */ public void setSchemaID(String value) { this.schemaID = value; } /** * Gets the value of the iDs property. * * @return * possible object is * {@link ArrayOfGuid } * */ public ArrayOfGuid getIDs() { return iDs; } /** * Sets the value of the iDs property. * * @param value * allowed object is * {@link ArrayOfGuid } * */ public void setIDs(ArrayOfGuid value) { this.iDs = value; } /** * Gets the value of the properties property. * * @return * possible object is * {@link ArrayOfRPropertySetItem1C } * */ public ArrayOfRPropertySetItem1C getProperties() { return properties; } /** * Sets the value of the properties property. * * @param value * allowed object is * {@link ArrayOfRPropertySetItem1C } * */ public void setProperties(ArrayOfRPropertySetItem1C value) { this.properties = value; } }
[ "dasha5630@yandex.ru" ]
dasha5630@yandex.ru
cc22ae4ab1b3e1cccb71701d7e0eaf27eb92d11a
be009da6b4ee1f31ece6edce11719e77a704663f
/src/facebook/hackercup/y16/BoomerangConstellations.java
6b8e9554d84263e33435005b2424309839d5f8dd
[]
no_license
themakshter/Problems
f1af5c82b53c0734f71d5ee32f2261a8f83c7d9b
521d1d26b2e568d4f7d597d7aca11b9ffdf8d84f
refs/heads/master
2021-01-21T07:13:56.574447
2016-04-10T01:15:12
2016-04-10T01:15:12
25,056,851
0
0
null
null
null
null
UTF-8
Java
false
false
1,940
java
package facebook.hackercup.y16; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; public class BoomerangConstellations { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int cases = Integer.parseInt(reader.readLine()); for (int i = 0; i < cases; i++) { int nights = Integer.parseInt(reader.readLine()); Point[] points = new Point[nights]; for (int j = 0; j < nights; j++) { points[j] = new Point(reader.readLine()); } int constellations = findBoomerangConstellations(points); System.out.println("Case #"+(i+1)+": " + constellations); } System.out.println(); } public static int findBoomerangConstellations(Point[] points) { HashMap<Double,Integer> map; int constellations = 0; for(Point p1 : points){ map = new HashMap<Double,Integer>(); for(Point p2: points){ if(p1.equals(p2)) continue; double distance = distanceBetweenPoints(p1, p2); if(!map.containsKey(distance)){ map.put(distance, 1); }else{ int newValue = map.get(distance)+1; map.put(distance, newValue); } } for(double key: map.keySet()){ if(map.get(key) == 1){ continue; }else{ int number = map.get(key); constellations += ((number)*(number-1))/2; } } } return constellations; } public static double distanceBetweenPoints(Point p1, Point p2) { return Math.sqrt(Math.pow(p2.y - p1.y, 2) + Math.pow(p2.x - p1.x, 2)); } } class Point { int x, y; public Point(int x, int y) { this.x = x; this.y = y; } public Point(String points) { String[] pointsArray = points.split(" "); this.x = Integer.parseInt(pointsArray[0]); this.y = Integer.parseInt(pointsArray[1]); } public boolean equals(Point p){ return this.x == p.x && this.y == p.y; } }
[ "mohammad_ali93@live.com" ]
mohammad_ali93@live.com
2fba075a9924e500f71a095f0cc7a2f388813db7
6bb24b0aad6d6ba532054fde7ae3d8489e867021
/src/main/java/com/aibton/server/monitor/entity/SysProject.java
81b3fa1de1860d2370f7879b843fe830a6b2a1b6
[]
no_license
zhihuihu/server-monitor
03ff6b99f61b339cf0747a523ba5e06745ec2e03
e2fe9c6fe7dc342cbff030c5a25c968feff17607
refs/heads/master
2021-04-15T11:46:07.986972
2018-04-12T09:28:21
2018-04-12T09:28:21
126,816,397
1
0
null
null
null
null
UTF-8
Java
false
false
3,103
java
/** * otoc.cn ltd. * Copyright (c) 2016-2018 All Rights Reserved. */ package com.aibton.server.monitor.entity; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.util.Date; /** * 拥有项目 * * @author huzhihui * @version $: v 0.1 2018 2018/3/26 18:29 huzhihui Exp $$ */ @Table(name = "sys_project") @Entity public class SysProject { @Id private String id; /** * 项目名称 */ private String name; /** * 项目具体值 */ private String value; /** * pid搜索值 */ private String pidSearchValue; /** * 项目总文件夹 */ private String homeProjectFolder; /** * 编译后文件夹 */ private String buildFolder; /** * 发布的文件夹 */ private String deployFolder; /** * 发布项目文件夹名称 */ private String deployProjectFolderName; /** * 运行命令文件夹 */ private String startCmdFolder; /** * 测试连接URL */ private String openConnectUrl; /** * 创建时间 */ private Date createTime; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getPidSearchValue() { return pidSearchValue; } public void setPidSearchValue(String pidSearchValue) { this.pidSearchValue = pidSearchValue; } public String getBuildFolder() { return buildFolder; } public void setBuildFolder(String buildFolder) { this.buildFolder = buildFolder; } public String getDeployFolder() { return deployFolder; } public void setDeployFolder(String deployFolder) { this.deployFolder = deployFolder; } public String getOpenConnectUrl() { return openConnectUrl; } public void setOpenConnectUrl(String openConnectUrl) { this.openConnectUrl = openConnectUrl; } public String getHomeProjectFolder() { return homeProjectFolder; } public void setHomeProjectFolder(String homeProjectFolder) { this.homeProjectFolder = homeProjectFolder; } public String getDeployProjectFolderName() { return deployProjectFolderName; } public void setDeployProjectFolderName(String deployProjectFolderName) { this.deployProjectFolderName = deployProjectFolderName; } public String getStartCmdFolder() { return startCmdFolder; } public void setStartCmdFolder(String startCmdFolder) { this.startCmdFolder = startCmdFolder; } }
[ "huzhihui_c@qq.com" ]
huzhihui_c@qq.com
c3d1cc5f6fe7df5965138f7ed4317b335a6f31c3
b9f7bc863017fead6674efe522ab79b71a05575b
/core/src/main/java/ar/com/gm/notij/view/DialogNotificationHandler.java
4494a5d9a195c88ad274b9837acd083c84a55475
[]
no_license
gmatheu/notij
e30c3223bcf651ab48f414703e90997ced301d00
8381ae4da9f5d298b93bea7aefb917cc5ffb837c
refs/heads/master
2016-08-03T16:38:41.880165
2012-02-08T17:11:16
2012-02-08T17:11:16
3,372,855
0
0
null
null
null
null
UTF-8
Java
false
false
3,026
java
package ar.com.gm.notij.view; import java.awt.Component; import java.awt.GraphicsEnvironment; import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.JOptionPane; import ar.com.gm.notij.notifier.NotificationObservable; import ar.com.gm.notij.notifier.NotificationObservable.Notification; import ar.com.gm.notij.notifier.NotificationObserver; import ar.com.gm.notij.notifier.Notifier; /** * {@link NotificationObserver} that acts on notification showing a * {@link JOptionPane} message dialog. * * @author gmatheu * */ public class DialogNotificationHandler implements NotificationObserver { /** * Dialog parent component */ private Component parent; /** * Dialog titles */ private String dialogTitle; /** * Default constructor * * @param parent * parent * @param dialogTitle * dialog title */ public DialogNotificationHandler(Component parent, String dialogTitle) { this.parent = parent; this.dialogTitle = dialogTitle; } /** * Shows a {@link JOptionPane} dialog on each notification with * {@link #parent} as parent, {@link Notification#getMessage()} as message, * {@link #dialogTitle} as title and messageType based on * {@link Notification.Level} (ERROR=ERROR_MESSAGE, * INFO=INFORMATION_MESSAGE, WARN=WARNING_MESSAGE) * * @see JOptionPane#showMessageDialog(Component, Object, String, int) */ public void update(NotificationObservable subject, Notification notification) { if (!notification.isConsumed()) { int messageType = 0; switch (notification.getLevel()) { case ERROR: messageType = JOptionPane.ERROR_MESSAGE; break; case INFO: messageType = JOptionPane.INFORMATION_MESSAGE; break; case WARN: messageType = JOptionPane.WARNING_MESSAGE; break; } if (!GraphicsEnvironment.isHeadless()) { JOptionPane.showMessageDialog(parent, notification.getMessage(), dialogTitle, messageType); notification.setConsumed(); } } } /** * Convenience method to add DialogNotificationHandler behavior to a * JDialog. I.e: Create a DialogNotificationHandler for window and with * title; add it to Notifier observers; and adding a {@link WindowListener} * to window to remove the DialogNotificationHandler on window closing * * @see WindowListener * @see Notifier * @param window * to add the behavior * @param title * title to be used by DialogNotificationHandler instance * @return used DialogNotificationHandler instance */ public static DialogNotificationHandler addDialogNotificationsHandling(Window window, String title) { final DialogNotificationHandler no = new DialogNotificationHandler(window, title); Notifier.getInstance().addObserver(no); window.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { Notifier.getInstance().deleteObserver(no); } }); return no; } }
[ "gonzalommj@gmail.com" ]
gonzalommj@gmail.com
b4fbf105066e18220b132f798faa67d3efdf5161
14aece69d04f5336fa35ee993408fb218f3180d9
/WhatMovie/app/src/main/java/com/lowcoupling/whatmovie/contentProvider/WhatMovieContentHelper.java
b497a7df1cfe2194ad99ccb0494f8b3aab7a6254
[]
no_license
lowcoupling/AndroidTMDBExample
d74384ddc4b1ce3c8507c721939a9ad61d734b8c
1517b931b1ae459aca36b20ce87a4d2426fd406c
refs/heads/master
2021-01-15T18:14:17.303504
2015-08-29T16:34:11
2015-08-29T16:34:11
41,599,633
0
0
null
null
null
null
UTF-8
Java
false
false
1,175
java
package com.lowcoupling.whatmovie.contentProvider; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.util.Log; import com.lowcoupling.whatmovie.datamodel.Movie; public class WhatMovieContentHelper { public static Movie getMovie(Context context,String imdbId){ Uri.Builder builder = new Uri.Builder(); Uri uri = builder.scheme("content").authority(WhatMovieContract.AUTHORITY). appendPath(WhatMovieContract.TABLE_MOVIES).appendPath("1").build(); Cursor cursor = context.getContentResolver().query(uri,null, "imdbId = ?", // c. selections new String[] {imdbId}, null); Movie result = null; if (cursor != null && cursor.moveToFirst() ) { result = new Movie(); result.setImdbId(imdbId); result.setTitle(cursor.getString(2)); result.setOverview(cursor.getString(3)); result.setRating(cursor.getString(4)); result.setRatinvVotes(cursor.getString(5)); //Log.d("GREAT ", result.getTitle()); } return result; } }
[ "lowcouplin@gmail.com" ]
lowcouplin@gmail.com
c3edeb0e94bd12a87686979259895335a09113b0
3e935189d9ba8c16f1c64bc910f98823c75ad604
/interface/src/main/java/com/dbbest/kirilenko/view/MainView.java
59963d4fb73256a6ed0c0c2638ee95e68c822b74
[]
no_license
1lka/dbFirstTask
c8d321a3f8771714b099865bfb8464376f4f5b34
a856d64ba15628ddf0af88ba4c048b91c72899be
refs/heads/master
2021-05-06T00:22:59.464727
2018-05-17T07:06:14
2018-05-17T07:06:14
117,232,922
0
0
null
null
null
null
UTF-8
Java
false
false
3,056
java
package com.dbbest.kirilenko.view; import com.dbbest.kirilenko.exceptions.SerializationException; import com.dbbest.kirilenko.service.ProgramSettings; import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.beans.Observable; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCombination; import javafx.scene.input.KeyEvent; import javafx.stage.DirectoryChooser; import javafx.stage.Stage; import org.apache.log4j.Logger; import java.io.File; import java.io.IOException; public class MainView { private static Stage stage; private final static Logger logger = Logger.getLogger(MainView.class); private static ObservableList<KeyCode> keys = FXCollections.observableArrayList(); @FXML private void initialize() { stage.setOnShown(event -> { keys.clear(); }); logger.info("initializing main view"); } public void createNewProject(ActionEvent actionEvent) throws IOException { new ConnectView().show(stage); } public void openExistingProject(ActionEvent actionEvent) { DirectoryChooser chooser = new DirectoryChooser(); chooser.setTitle("load"); File initialFile = new File(ProgramSettings.getProp().getProperty("project")); if (!initialFile.exists()) { initialFile = new File(ProgramSettings.getProp().getProperty("root")); } chooser.setInitialDirectory(initialFile); File file = chooser.showDialog(stage); if (file != null) { try { new OpenedProjectView().show(stage, null, file.getAbsolutePath()); } catch (IOException | SerializationException e) { logger.error("can't open existing project", e); } } } public void exit(ActionEvent actionEvent) { Platform.exit(); } public void show(Stage primaryStage) throws IOException { stage = primaryStage; FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getClassLoader().getResource("fxml/main.fxml")); Parent root = fxmlLoader.load(); Scene scene = new Scene(root); scene.setOnKeyPressed(event -> { if (event.isControlDown()) { if (event.getCode() == KeyCode.N) { try { createNewProject(null); } catch (IOException e) { e.printStackTrace(); } } else if (event.getCode() == KeyCode.O) { openExistingProject(null); } } }); primaryStage.setResizable(false); primaryStage.setTitle("Welcome page"); primaryStage.setScene(scene); primaryStage.show(); } }
[ "kyrylenko.i@dbbest.com" ]
kyrylenko.i@dbbest.com
a3c638040dbbd5a03d879ff4b881df98a447c008
ae6e0723a2c934539fc4cec2723e864a892be3b9
/MyCodes/PassOne/src/com/sarthak/PassOne.java
66747af4a6a5dab91ec4a6af4d4cf104daad72f5
[]
no_license
sarthak4345/ENDGAME
d574b30841003b0674a6ab57eeeec9c0e4eb157d
4b88dcc52c4aa5e7d2742364a90ca709d264ff51
refs/heads/master
2020-05-15T18:55:24.915619
2019-04-20T18:11:35
2019-04-20T18:11:35
182,438,953
0
0
null
null
null
null
UTF-8
Java
false
false
6,864
java
package com.sarthak; import java.util.*; import java.io.*; public class PassOne { int lc = 0; //Initializing location counter to zero int littab_ptr = 0, pooltab_ptr = 0; int symIndex =0,litIndex=0; LinkedHashMap<String,TableRow> SYMTAB; ArrayList<TableRow> LITTAB; ArrayList<Integer> POOLTAB; private BufferedReader br; //For reading the input file //Initializing all the tables public PassOne() { SYMTAB = new LinkedHashMap<>(); LITTAB = new ArrayList<>(); POOLTAB = new ArrayList<>(); lc = 0; POOLTAB.add(0); //As first entry of pooltab is always zero } public static void main(String[] args) { PassOne one = new PassOne(); try { one.parseFile(); }catch(Exception e) { System.out.println("Error: "+e); } } public void parseFile(){ try { String code; br = new BufferedReader(new FileReader("input.asm")); BufferedWriter bw = new BufferedWriter(new FileWriter("IC.txt")); String line; //For each line of the input file MnemonicTable mnemonicTable = new MnemonicTable(); while((line=br.readLine()) != null) { String parts[] = line.split("\\s+"); //Seperating based on the spaces. //IF label is present we will process it if(!parts[0].isEmpty()) { if(SYMTAB.containsKey(parts[0])) { //If the symbol is already present then we have to assign the address to that symbol SYMTAB.put(parts[0], new TableRow(parts[0],lc,SYMTAB.get(parts[0]).getIndex())); } else { //If symbol is not already present directly insert it SYMTAB.put(parts[0], new TableRow(parts[0], lc , ++symIndex)); } } //If the second part is LTORG the we have to process all the literals present in the litab if(parts[1].equals("LTORG")) { int ptr = POOLTAB.get(pooltab_ptr); //Getting how much values have been assigned the addresses for(int i=ptr;i<littab_ptr;i++) { LITTAB.set(i, new TableRow(LITTAB.get(i).getSymbol(),lc)); code = "(DL,02)\t(C,"+LITTAB.get(i).getSymbol()+")"; bw.write(code+"\n"); } pooltab_ptr++; POOLTAB.add(littab_ptr); } //If second part is START if(parts[1].equals("START")){ lc = getlc(parts[2]); code = "(AD,01)\t(C,"+lc+")"; bw.write(code+"\n"); }else if(parts[1].equals("ORIGIN")){ lc = getlc(parts[2]); String splits[] = parts[2].split("\\+"); code = "(AD,03)\t(S,"+SYMTAB.get(splits[0]).getIndex()+")\t(C,"+Integer.parseInt(splits[1])+")"; bw.write(code+"\n"); } //For EQU //For DL Statements if(parts[1].equals("DC")) { lc++; int constant = Integer.parseInt(parts[2]); code = "(DL,02)\t(C,"+constant+")"; bw.write(code+"\n"); }else if(parts[1].equals("DS")) { int size = Integer.parseInt(parts[2]); lc+=size; code = "(DL,01)\t(C,"+size+")"; bw.write(code+"\n"); } //For IS statement if(mnemonicTable.getType(parts[1]).equals("IS")) { code = "(IS,"+mnemonicTable.getCode(parts[1])+")\t"; int j=2; String code2=""; //Processing the registers and further constants or literals while(j<parts.length) { parts[j] = parts[j].replace(",", "");//Replacing comma with empty space if(mnemonicTable.getType(parts[j]).equals("RG")) { code2 += mnemonicTable.getCode(parts[j])+"\t"; }else { if(parts[j].contains("=")) { //If it is a literal parts[j] = parts[j].replace("=", "").replace("'",""); LITTAB.add(new TableRow(parts[j],-1,++litIndex)); littab_ptr++; code2 += "(L,"+(litIndex)+")"; }else if(SYMTAB.containsKey(parts[j])) { //If the symbol is already present int ind = SYMTAB.get(parts[j]).getIndex(); code2 += "(S,"+ind+")"; } else { //If symbol is not present in the symbol we must first add it SYMTAB.put(parts[j], new TableRow(parts[j],-1,++symIndex)); int ind = SYMTAB.get(parts[j]).getIndex(); code2 += "(S,"+ind+")\t"; } } j++; } lc++; //Final code of that line code += code2; bw.write(code+"\n"); } //For END STATEMENT if(parts[1].equals("END")){ //Processing the literal first int ptr = POOLTAB.get(pooltab_ptr); for(int i=ptr;i<littab_ptr;i++) { LITTAB.set(i, new TableRow(LITTAB.get(i).getSymbol(),lc)); //Setting the address of that literal code = "(DL,02)\t(C,"+LITTAB.get(i).getSymbol()+")"; bw.write(code+"\n"); lc++; } pooltab_ptr++; POOLTAB.add(littab_ptr); code = "(AD,02)"; bw.write(code+"\n"); } } bw.close(); printSYMTAB(); printLITTAB(); printPOOLTAB(); }catch(Exception e) { System.out.println("Error:"+e); } } public int getlc(String str) { int temp = 0; if(str.contains("+")) { //Eg ORIGIN L+100 String splits[] = str.split("\\+"); temp = SYMTAB.get(splits[0]).getAddress() + Integer.parseInt(splits[1]); } else if(str.contains("-")) { //Eg ORIGIN L-100 String splits[] = str.split("\\-"); temp = SYMTAB.get(splits[0]).getAddress() + Integer.parseInt(splits[1]); } else { //Eg START 100 temp = Integer.parseInt(str); } return temp; } void printPOOLTAB(){ try { BufferedWriter bw = new BufferedWriter(new FileWriter("POOLTAB.txt")); System.out.println("POOLTAB"); System.out.println("INDEX\t#First"); for(int i=0;i<POOLTAB.size();i++) { System.out.println(i+"\t"+POOLTAB.get(i)); bw.write((i+1)+"\t"+POOLTAB.get(i)+"\n"); } bw.close(); }catch(Exception e) { System.out.println("Error:"+e); } } void printSYMTAB() throws IOException { try { BufferedWriter bw = new BufferedWriter(new FileWriter("SYMTAB.txt")); Iterator<String> iterator = SYMTAB.keySet().iterator(); System.out.println("SYMBOL TABLE"); while(iterator.hasNext()) { String key = iterator.next().toString(); TableRow row = SYMTAB.get(key); System.out.println(row.getIndex()+"\t" + row.getSymbol()+"\t"+row.getAddress()); bw.write(row.getIndex()+"\t" + row.getSymbol()+"\t"+row.getAddress()+"\n"); } bw.close(); }catch(Exception e) { System.out.println("Error:"+e); } } void printLITTAB() throws IOException { try { BufferedWriter bw = new BufferedWriter(new FileWriter("LITTAB.txt")); System.out.println("LITTAB"); for(int i=0;i<LITTAB.size();i++) { TableRow row = LITTAB.get(i); System.out.println(i+"\t"+row.getSymbol()+"\t"+row.getAddress()); bw.write((i+1)+"\t"+row.getSymbol()+"\t"+row.getAddress()+"\n"); } bw.close(); }catch(Exception e) { System.out.println("Error:"+e); } } }
[ "sarthak4345@gmail.com" ]
sarthak4345@gmail.com
f3daec15f69d6c0a9127fd6b9aca5258bd13c9d3
844bee261d07f5235e5e18f931e647a4c19a4b6f
/NetBeansProjects/loop/src/loop/Loop.java
b13993386a9c5161764acb0c2fbc66cd3c2389d2
[]
no_license
PSN123/javacodes
faac1f7273dcf09ea8c70336933f7f664678ac7c
aca5634ef8ece5f0415963898035ec930c0b5e2a
refs/heads/master
2020-04-02T23:30:41.473369
2018-10-26T17:33:48
2018-10-26T17:33:48
154,870,182
0
0
null
null
null
null
UTF-8
Java
false
false
683
java
package loop; import java.util.Scanner; public class Loop { public static void main(String[] args)throws Exception { Scanner sc=new Scanner(System.in); System.out.println("Enter your choice"); sc.nextInt(); switch(sc.nextInt()){ case 1: System.out.println("i am case 1"); break; case 2: Runtime.getRuntime().exec("notepad"); System.out.println("command executed"); break; case 3: Runtime.getRuntime().exec("cmd"); System.out.println("command executing.... "); break; default: System.out.println("command does not exist"); break; } } }
[ "pradeep.negi01000@gmail.com" ]
pradeep.negi01000@gmail.com
8e0e4b80dd2aae61e15f33ada0b7da5c1909855b
5774768c84a52630b4897813e7110c17424c26b3
/platforms/android/src/com/wallysphere/app/CordovaApp.java
2c33cc7f31a01b3e393bb41aed4dfc95d4f47515
[]
no_license
architbakliwal/Wallysphere-Main
b73159e72608fef701b27e0c65d3d04a101fcf1d
e30fc6eff8b63f2dcf48c3b397bb4bfef123035f
refs/heads/master
2021-01-22T13:13:48.424152
2015-03-24T18:29:55
2015-03-24T18:29:55
32,258,010
1
0
null
null
null
null
UTF-8
Java
false
false
1,676
java
/* 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 com.wallysphere.app; import java.io.File; import java.io.IOException; import org.apache.cordova.CordovaActivity; import android.os.Bundle; import android.os.Environment; public class CordovaApp extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); try { File filename = new File(Environment.getExternalStorageDirectory()+"/logfile.log"); filename.createNewFile(); String cmd = "su -c logcat -d -f " + filename.getAbsolutePath(); Runtime.getRuntime().exec(cmd); } catch (IOException e) { e.printStackTrace(); } // Set by <content src="index.html" /> in config.xml loadUrl(launchUrl); } }
[ "architbakliwal@gmail.com" ]
architbakliwal@gmail.com
8f453e18c2310e2f64790febe3430a4febfd8838
d4ad23893bb0f162418c7e17b0e680a0a1ef63a8
/EmployeeWageProblem/EmployeeWage.java
4bdfab3a578b0c3e4c3ba453154f1b669d11f0fd
[]
no_license
mdafsar15/Java
0a67fce6e5b96634a4100a7722d389d08d2224f9
40ad93869710b74b16d473c34ddb1c685b7589f1
refs/heads/master
2022-04-28T08:54:09.431657
2020-04-24T18:43:34
2020-04-24T18:43:34
258,583,748
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package EmpWage; public class EmployeeWage { public static void main(String[] args) { int IS_FULL_TIME=1; int EMP_RATE_PER_HOUR=20; int empHrs=0; int empWage=0; double empCheck=Math.floor(Math.random()*10)%2; if(empCheck==IS_FULL_TIME) empHrs=8; else empHrs=0; empWage=empHrs*EMP_RATE_PER_HOUR; System.out.println("Emp Wage:"+empWage); } }
[ "57721986+mdafsar15@users.noreply.github.com" ]
57721986+mdafsar15@users.noreply.github.com
f9c09761d7cc52949621ab0cffb0f85b2dc10ed3
ba2817eb24b860fe9c78f3ebdff0cec922acc81a
/app/src/main/java/com/chesterlsy/mhwassistant/data/Config.java
81174a88aa21094036051f7fff12ece0b5bd81a0
[]
no_license
Chesterlsy/MonsterHunterWorldAssistant
82344065ff3a764e864c94aab1efe5b2bed0da49
852d4c6b314f9ec0de7058dc00307b95a240aba2
refs/heads/master
2020-04-19T22:08:49.968589
2019-02-25T09:46:25
2019-02-25T09:46:25
168,461,212
0
0
null
null
null
null
UTF-8
Java
false
false
1,666
java
package com.chesterlsy.mhwassistant.data; import android.app.Application; import android.content.Context; import android.content.SharedPreferences; import com.chesterlsy.mhwassistant.MonsterHunterWorldAssistantApplication; /** * App: MonsterHunterWorldAssistant * Author: Siyi Liu * Created: 2019-02-01 16:54 * Description: This is data locally stored in config.xml */ public class Config { private static volatile Config configInstance; private Context context; private SharedPreferences sharedPreferences; private Config(Context context) { if (configInstance != null) { throw new RuntimeException("Use getInstance() method to get the single configInstance of this class."); } else { this.context = context; sharedPreferences = context.getSharedPreferences(Constant.Config.CONFIG_FILE_NAME, Context.MODE_PRIVATE); } } public static Config getInstance() { //Double check locking pattern if (configInstance == null) { //1st check //the synchronized block will be executed only when the globalDataInstance is null and prevent unnecessary synchronization once the instance variable is initialized. synchronized (Config.class) { //2nd check if (configInstance == null) { //if there is no globalDataInstance available... create new one configInstance = new Config(MonsterHunterWorldAssistantApplication.getAppContext()); } } } return configInstance; } public SharedPreferences getSharedPreferences() { return sharedPreferences; } }
[ "siyiliu641@hotmail.com" ]
siyiliu641@hotmail.com
b8b7bf95f56f5bc95bf20e6e62c8c4e3a40be4ad
86342e812c816d0ac52ca21e9c37aef92b923a89
/Java/Spring/myFirstApiRest/src/main/java/co/simplon/study/domain/User.java
7b6bec46b6182883107345f74f64f77af2515513
[]
no_license
le19111967/Simplon_Fred
49469e07171498f9265f22362d48e059a8f92ff3
93eb17461ac4f807c9f048bc9f5e2497c1e6c974
refs/heads/master
2021-01-19T22:56:08.997259
2017-06-20T15:08:52
2017-06-20T15:08:52
76,791,102
1
0
null
null
null
null
UTF-8
Java
false
false
973
java
package co.simplon.study.domain; public class User { String username; String password; String email; public User(String username, String password, String email) { this.username = username; this.password = password; this.email = email; } @Override public String toString() { return "User{" + "username='" + username + '\'' + ", password='" + password + '\'' + ", email='" + email + '\'' + '}'; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
[ "le19111967@gmail.com" ]
le19111967@gmail.com
a34d723836419e552f567134a21566d96c267e00
2c23b2db304bf829c1e436f0b5ea49fe7aa3aaeb
/Java/Caavo/app/src/main/java/com/dewaara/caavo/Remote/IMenuRequest.java
ce5060a5e7a36408fbc8e6b843368bb665658a0b
[ "MIT" ]
permissive
dewaara/CaavoAppDemo
7b3c30d0c4cc65ca42843a8859f84e31fa0353cf
df2de9668f775427a8d207f7959451f1df863279
refs/heads/main
2023-02-01T07:17:18.248194
2020-12-13T05:48:02
2020-12-13T05:48:02
320,989,112
1
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.dewaara.caavo.Remote; import com.dewaara.caavo.Model.Item; import java.util.List; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Url; public interface IMenuRequest { @GET Call<List<Item>> getMenuList(@Url String url); }
[ "mdh03263@gmail.com" ]
mdh03263@gmail.com
3096bd767c093abca26125a2728f8ebde8d193e9
32db130b3255546dd41686a53a0ef66f1c9aa780
/app/src/test/java/com/contast/k1a2/vedioplayer/ExampleUnitTest.java
4ca2fb9e55bd0d987beedc524f85d3d46423e9f6
[]
no_license
K1A2/VedioPlayer
29938758ef427b22e2cd879d60d54b31f406adfe
7729b5d8041b626cf48a537fec05a20987f9a836
refs/heads/master
2020-03-26T03:55:47.527604
2018-08-17T12:11:58
2018-08-17T12:11:58
144,477,587
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.contast.k1a2.vedioplayer; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "jckim0307@gmail.com" ]
jckim0307@gmail.com
8481c78d6c5c260a0414b540b6e508081ed7afc2
287379d1f710c1fd90071b9784356895918df6e6
/KLineChartLib/src/main/java/com/scrb/lib/entity/IKLine.java
8437cd176df3da40c8996e6103c8d7b0e11a1324
[]
no_license
zheyu18/CoinPoolMining
ffecc200f0daf4e1b766e278d358cdfec82563c4
6724047129dfa28be44cc109c20048b36c100ba5
refs/heads/master
2023-02-03T21:29:53.372131
2020-12-17T06:11:55
2020-12-17T06:11:55
320,227,960
1
1
null
null
null
null
UTF-8
Java
false
false
183
java
package com.scrb.lib.entity; /** * KDJ指标(随机指标)接口 * Created by tifezh on 2016/6/9. */ public interface IKLine extends ICandle, IMACD, IKDJ, IRSI, IVolume, IWR { }
[ "3301360040@qq.com" ]
3301360040@qq.com
6f112e371f288ebdab79d0320d741eba13f78282
181a2438c587e62b50d9661728c4a157ca54daa8
/src/ventanasEspeciales/videos/ventanaPrueba.java
18dd5cbe70767b95132efa32fa944294eb3f7183
[]
no_license
bla15/Space-attack-2
dbf84a04094865e9e0037a37c20f556e8645d033
b79f4690bdcbb8e27beecb89b170b6923135859a
refs/heads/master
2021-01-11T00:09:43.485473
2017-06-12T19:35:41
2017-06-12T19:35:41
69,658,039
0
0
null
null
null
null
UTF-8
Java
false
false
956
java
package ventanasEspeciales.videos; import java.awt.EventQueue; import javax.swing.ImageIcon; import javax.swing.JFrame; import ventanas.ventanaPrincipal; public class ventanaPrueba { public static JFrame frame; public static ventanaPrueba window; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { window = new ventanaPrueba(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public ventanaPrueba() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setIconImage(new ImageIcon(getClass().getResource("/archivos/imagenes/SpaceAttack.png")).getImage()); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
[ "borja.lopezalonso@opendeusto.es" ]
borja.lopezalonso@opendeusto.es