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
5cf57e6ce8c53d983ff4a17f515c9b8e89031745
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14263-53-19-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/org/xwiki/velocity/internal/DefaultVelocityEngine_ESTest_scaffolding.java
8028970bc260bbb949e05f085d5f2b96c00a2ca3
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
453
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Apr 07 02:00:14 UTC 2020 */ package org.xwiki.velocity.internal; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class DefaultVelocityEngine_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
5fc678ea8f9eba1a0c57ab5bf3e9230f3f966831
c855f2ce4327a6cb9633a4ee98001758b7a9fc7f
/src/CodingTest/STUnitas_1.java
908c71c3f7e891e8a16b94fe80a48aa2f53a1b05
[]
no_license
ihwann/Algorithm_study
2de619873fee6c69d56ff7566854fb0fb9e6fa87
014d1ea5b1d36c93be29a306f50aecd4e62b1761
refs/heads/master
2022-04-30T06:01:37.215905
2022-04-11T09:07:15
2022-04-11T09:07:15
190,178,465
1
0
null
null
null
null
UTF-8
Java
false
false
1,217
java
package CodingTest; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; public class STUnitas_1 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int testCase = Integer.parseInt(br.readLine()); for (int i = 0; i < testCase; i++) { String[] inputData = br.readLine().split(" "); int a = Integer.parseInt(inputData[0]); int b = Integer.parseInt(inputData[1]); HashSet<Integer> hash = new HashSet<>(); ArrayList<Integer> arr = new ArrayList<>(); int start = a; while (!hash.contains(start)) { hash.add(start); arr.add(start); start = (start * a) % 10; } int size = arr.size(); int sub = b % size; int answer = 0; if (sub == 0) { answer = arr.get(size-1); } else { answer = arr.get(size-2); } System.out.println(answer); } } }
[ "kih3159@naver.com" ]
kih3159@naver.com
4c68dab38e75c5cf2f5a43502011beb90b0c7024
592eb3c39bbd5550c5406abdfd45f49c24e6fd6c
/autoweb/src/main/java/com/autosite/util/SiteConfigUtil.java
935937eae734c6605cc4a58db057463c4c92fc3c
[]
no_license
passionblue/autoweb
f77dc89098d59fddc48a40a81f2f2cf27cd08cfb
8ea27a5b83f02f4f0b66740b22179bea4d73709e
refs/heads/master
2021-01-17T20:33:28.634291
2016-06-17T01:38:45
2016-06-17T01:38:45
60,968,206
0
0
null
null
null
null
UTF-8
Java
false
false
2,611
java
package com.autosite.util; import java.util.Map; import com.autosite.db.Site; import com.autosite.db.SiteConfig; import com.autosite.theme.DefaultThemeManager; import com.jtrend.util.WebUtil; public class SiteConfigUtil { public static SiteConfig getDefaultSiteConfig() { DefaultThemeManager themeManager = DefaultThemeManager.getInstance(); Map fields = themeManager.getDefaultThemeFields(); SiteConfig config = new SiteConfig(); // config.setColorBorders("#ffffff"); // config.setColorSubmenuBg("#e1ebfd"); // config.setHomeColCount(5); // config.setWidth(1000); // config.setMenuWidth(125); // config.setAdWidth(125); // config.setMenuReverse(0); // config.setMidColumnWidth(250); // config.setShowMidColumn(0); // config.setShowMenuColumn(1); // config.setShowAdColumn(1); // // config.setShowTopMenu(1); // // config.setShowHomeMenu(1); // config.setShowHomeMid(0); // config.setShowHomeAd(1); // // config.setUseWysiwygContent(1); // config.setUseWysiwygPost(0); // // config.setBackgroundColor("#ffffff"); // // config.setFrontDisplayFeed(1); config.setColorBorders("#ffffff"); config.setColorSubmenuBg("#e1ebfd"); config.setHomeColCount(5); config.setWidth(1000); config.setMenuWidth(125); config.setAdWidth(125); config.setMenuReverse(0); config.setMidColumnWidth(250); config.setShowMidColumn(0); config.setShowMenuColumn(1); config.setShowAdColumn(1); config.setShowTopMenu(1); config.setShowHomeMenu(1); config.setShowHomeMid(0); config.setShowHomeAd(1); config.setUseWysiwygContent(1); config.setUseWysiwygPost(0); config.setBackgroundColor("#ffffff"); config.setFrontDisplayFeed(1); config.setUnderlyingDynamicPage(1); return config; } // If mysite.basesite.com, it returns "mysite" only for the child site. for the base site, returns null; public static String getSitePrefixForSubsite(Site site) { if (WebUtil.isNull(site.getSiteRegisterSite())) { return null; } String siteUrl = site.getSiteUrl(); String baseUrl = site.getSiteRegisterSite(); return siteUrl.replaceAll("."+baseUrl, ""); } }
[ "joshua@joshua-dell" ]
joshua@joshua-dell
0ef657fc0944516097955d0870652bd4f39bb6cf
26ffcd68ef7e1c04b52a6354b1dc26015d358958
/saa-web/src/main/java/br/unifor/saa/utils/Navigation.java
3bed5ff10f53c6ac9ac144bb4a88f4fe7f7da11e
[ "Apache-2.0" ]
permissive
MarceloRosa/Sistema-de-Avaliacao-de-Aulas
b1feffc5666c8e8e7319fe03043ace4ae4b92760
23ca3d167c22a6be175a972faf97777a47c2d3f2
refs/heads/master
2021-01-11T19:00:13.481175
2018-10-18T20:08:36
2018-10-18T20:08:36
79,288,592
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
package br.unifor.saa.utils; /** * @author patrick.cunha * */ public class Navigation { public static final String SUCESSO = "sucesso"; public static final String VOLTAR = "voltar"; public static final String ATUALIZA = "atualiza"; public static final String FRACASSO = "fracasso"; public static final String CADASTRO = "cadastro"; public static final String EXCLUIR = "excluir"; public static final String SAIR = "sair"; public static final String DETALHAR = "detalhar"; public static final String AVALIA = "avaliar"; public static final String MODERAR = "moderar"; public static final String AVALIADA = "avaliada"; public static final String HOME_PROFESSOR = "homeProfessor"; public static final String HOME_ALUNO = "homeAluno"; public static final String HOME_ADMINISTRADOR = "homeAdministrador"; }
[ "marcelorosa2@hotmail.com" ]
marcelorosa2@hotmail.com
d2492a5d7712becb7976221a1c0131adff342dfb
9a860c8cb06776da31ae78d75450403aa36ff395
/src/main/java/com/example/cursomc/resources/CategoriaResource.java
f77538ca060914942bcc8eb10cae90b9eac4e254
[]
no_license
DanielComp/cursomc
eb0ee7fcf990e5f3b961a616a2a30dff4401f5da
11a0b2d8cd4d3be41d5e72fbeaec418dd3451d79
refs/heads/master
2021-08-30T20:50:30.503117
2017-12-19T11:37:16
2017-12-19T11:37:16
114,708,855
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
package com.example.cursomc.resources; import java.util.ArrayList; import java.util.List; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.example.cursomc.domain.Categoria; @RestController @RequestMapping(value="/categorias") public class CategoriaResource { @RequestMapping(method=RequestMethod.GET) public List<Categoria> listar() { Categoria cat1 = new Categoria(1, "Informática"); Categoria cat2 = new Categoria(2, "Escritório"); List<Categoria> categorias = new ArrayList<>(); categorias.add(cat1); categorias.add(cat2); return categorias; } }
[ "danielnovato@gmail.com" ]
danielnovato@gmail.com
5ac31b480690391147f073d534334d836a3a30e5
e7ed417ceb13634a857e14e7b0f84ea4a11a8d9c
/WelcomeActivity/src/com/way/bean/MessageItem.java
3e2880ae4267144e309a1024777c4fe2184f3474
[]
no_license
mingmingazy/AndroidQQChat
bacbb186a8302e2aae6ec56ac6b6cc0d5ba6306a
72e7548571672ea8b0d31ebc95933e601b2dd57b
refs/heads/master
2020-12-26T03:10:47.042210
2014-07-08T05:40:43
2014-07-08T05:40:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,887
java
package com.way.bean; /** * * @author LuoYi * */ public class MessageItem { // Text public static final int MESSAGE_TYPE_TEXT = 1; // image public static final int MESSAGE_TYPE_IMG = 2; // file public static final int MESSAGE_TYPE_FILE = 3; private int msgType; private String name;// 消息来自 private long time;// 消息日期 private String message;// 消息内容 private int headImg; private boolean isComMeg = true;// 是否为收到的消息 private int isNew; public MessageItem() { // TODO Auto-generated constructor stub } public MessageItem(int msgType, String name, long date, String message, int headImg, boolean isComMeg, int isNew) { super(); this.msgType = msgType; this.name = name; this.time = date; this.message = message; this.headImg = headImg; this.isComMeg = isComMeg; this.isNew = isNew; } public int getMsgType() { return msgType; } public void setMsgType(int msgType) { this.msgType = msgType; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getDate() { return time; } public void setDate(long date) { this.time = date; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public int getHeadImg() { return headImg; } public void setHeadImg(int headImg) { this.headImg = headImg; } public boolean isComMeg() { return isComMeg; } public void setComMeg(boolean isComMeg) { this.isComMeg = isComMeg; } public static int getMessageTypeText() { return MESSAGE_TYPE_TEXT; } public static int getMessageTypeImg() { return MESSAGE_TYPE_IMG; } public static int getMessageTypeFile() { return MESSAGE_TYPE_FILE; } public int getIsNew() { return isNew; } public void setIsNew(int isNew) { this.isNew = isNew; } }
[ "zifeng328573112@qq.com" ]
zifeng328573112@qq.com
12ddc1bc511a4657ffc1441b51ba4f810a066ba5
b108b825ffdec76a6bd945e2911277959a33a6eb
/tzcs/src/main/java/com/hsfcompany/tzcs/dao/DaoSession.java
ca863d76643ed58d0b8986fafef3f7c3ebd38937
[]
no_license
liangchengcheng/ZSBPJ
87ba63f589121821697e5c8c90e9820484aa5762
5e48b3bef2b88d8dec9bce605681c3336c9e46c3
refs/heads/master
2020-04-04T05:50:55.475814
2018-12-12T07:49:13
2018-12-12T07:49:13
48,907,404
2
1
null
null
null
null
UTF-8
Java
false
false
1,146
java
package com.hsfcompany.tzcs.dao; import android.database.sqlite.SQLiteDatabase; import java.util.Map; import de.greenrobot.dao.AbstractDao; import de.greenrobot.dao.AbstractDaoSession; import de.greenrobot.dao.identityscope.IdentityScopeType; import de.greenrobot.dao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * {@inheritDoc} * * @see de.greenrobot.dao.AbstractDaoSession */ public class DaoSession extends AbstractDaoSession { private final DaoConfig userInfoDaoConfig; private final UserInfoDao userInfoDao; public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> daoConfigMap) { super(db); userInfoDaoConfig = daoConfigMap.get(UserInfoDao.class).clone(); userInfoDaoConfig.initIdentityScope(type); userInfoDao = new UserInfoDao(userInfoDaoConfig, this); registerDao(UserInfo.class, userInfoDao); } public void clear() { userInfoDaoConfig.getIdentityScope().clear(); } public UserInfoDao getUserInfoDao() { return userInfoDao; } }
[ "1038127753@qq.com" ]
1038127753@qq.com
4a0f31bcdaef3f1676a9bd8eb9bb76a02c577fc5
b0d93d1065e5a3d2a39075b8cfcca5626daa9cef
/src/main/java/kata/rpg/physics/BroadPhase.java
1c85a3454ff8fc4ca34a12db6c06509b8efc558e
[]
no_license
Danlestal/RPG-Kata
1eef8e97298434334a3bd1462f9e3517f96d378d
a074de6a4bdacaec4722b6f2e8c761746071c856
refs/heads/master
2020-04-20T07:16:11.959957
2019-03-18T08:43:26
2019-03-18T08:43:26
168,705,991
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
package kata.rpg.physics; import kata.rpg.components.PhysicsComponent; import java.util.List; public interface BroadPhase { List<Collision> detectCollisions(PhysicsComponent[] physComponents); }
[ "danielvazquez@MacBook-Pro-de-Daniel.local" ]
danielvazquez@MacBook-Pro-de-Daniel.local
256119ede08b8a22ea2c1d6b7daee6aceda0c7d9
e0ce65ca68416abe67d41f340e13d7d7dcec8e0f
/src/main/java/org/trypticon/luceneupgrader/lucene7/internal/lucene/index/SegmentCoreReaders.java
7401e2d7831696dbcc3c88ebd0e8a97a5310f1eb
[ "Apache-2.0" ]
permissive
arandomgal/lucene-one-stop-index-upgrader
943264c22e6cadfef13116f41766f7d5fb2d3a7c
4c8b35dcda9e57f0507de48d8519e9c31cb8efb6
refs/heads/main
2023-06-07T04:18:20.805332
2021-07-05T22:28:46
2021-07-05T22:28:46
383,277,257
0
0
null
null
null
null
UTF-8
Java
false
false
7,488
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 org.trypticon.luceneupgrader.lucene7.internal.lucene.index; import java.io.Closeable; import java.io.EOFException; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.NoSuchFileException; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import org.trypticon.luceneupgrader.lucene7.internal.lucene.codecs.Codec; import org.trypticon.luceneupgrader.lucene7.internal.lucene.codecs.FieldsProducer; import org.trypticon.luceneupgrader.lucene7.internal.lucene.codecs.NormsProducer; import org.trypticon.luceneupgrader.lucene7.internal.lucene.codecs.PointsReader; import org.trypticon.luceneupgrader.lucene7.internal.lucene.codecs.PostingsFormat; import org.trypticon.luceneupgrader.lucene7.internal.lucene.codecs.StoredFieldsReader; import org.trypticon.luceneupgrader.lucene7.internal.lucene.codecs.TermVectorsReader; import org.trypticon.luceneupgrader.lucene7.internal.lucene.index.IndexReader.CacheKey; import org.trypticon.luceneupgrader.lucene7.internal.lucene.index.IndexReader.ClosedListener; import org.trypticon.luceneupgrader.lucene7.internal.lucene.store.AlreadyClosedException; import org.trypticon.luceneupgrader.lucene7.internal.lucene.store.Directory; import org.trypticon.luceneupgrader.lucene7.internal.lucene.store.IOContext; import org.trypticon.luceneupgrader.lucene7.internal.lucene.util.CloseableThreadLocal; import org.trypticon.luceneupgrader.lucene7.internal.lucene.util.IOUtils; final class SegmentCoreReaders { // Counts how many other readers share the core objects // (freqStream, proxStream, tis, etc.) of this reader; // when coreRef drops to 0, these core objects may be // closed. A given instance of SegmentReader may be // closed, even though it shares core objects with other // SegmentReaders: private final AtomicInteger ref = new AtomicInteger(1); final FieldsProducer fields; final NormsProducer normsProducer; final StoredFieldsReader fieldsReaderOrig; final TermVectorsReader termVectorsReaderOrig; final PointsReader pointsReader; final Directory cfsReader; final String segment; final FieldInfos coreFieldInfos; // TODO: make a single thread local w/ a // Thingy class holding fieldsReader, termVectorsReader, // normsProducer final CloseableThreadLocal<StoredFieldsReader> fieldsReaderLocal = new CloseableThreadLocal<StoredFieldsReader>() { @Override protected StoredFieldsReader initialValue() { return fieldsReaderOrig.clone(); } }; final CloseableThreadLocal<TermVectorsReader> termVectorsLocal = new CloseableThreadLocal<TermVectorsReader>() { @Override protected TermVectorsReader initialValue() { return (termVectorsReaderOrig == null) ? null : termVectorsReaderOrig.clone(); } }; private final Set<IndexReader.ClosedListener> coreClosedListeners = Collections.synchronizedSet(new LinkedHashSet<IndexReader.ClosedListener>()); SegmentCoreReaders(Directory dir, SegmentCommitInfo si, IOContext context) throws IOException { final Codec codec = si.info.getCodec(); final Directory cfsDir; // confusing name: if (cfs) it's the cfsdir, otherwise it's the segment's directory. boolean success = false; try { if (si.info.getUseCompoundFile()) { cfsDir = cfsReader = codec.compoundFormat().getCompoundReader(dir, si.info, context); } else { cfsReader = null; cfsDir = dir; } segment = si.info.name; coreFieldInfos = codec.fieldInfosFormat().read(cfsDir, si.info, "", context); final SegmentReadState segmentReadState = new SegmentReadState(cfsDir, si.info, coreFieldInfos, context); final PostingsFormat format = codec.postingsFormat(); // Ask codec for its Fields fields = format.fieldsProducer(segmentReadState); assert fields != null; // ask codec for its Norms: // TODO: since we don't write any norms file if there are no norms, // kinda jaky to assume the codec handles the case of no norms file at all gracefully?! if (coreFieldInfos.hasNorms()) { normsProducer = codec.normsFormat().normsProducer(segmentReadState); assert normsProducer != null; } else { normsProducer = null; } fieldsReaderOrig = si.info.getCodec().storedFieldsFormat().fieldsReader(cfsDir, si.info, coreFieldInfos, context); if (coreFieldInfos.hasVectors()) { // open term vector files only as needed termVectorsReaderOrig = si.info.getCodec().termVectorsFormat().vectorsReader(cfsDir, si.info, coreFieldInfos, context); } else { termVectorsReaderOrig = null; } if (coreFieldInfos.hasPointValues()) { pointsReader = codec.pointsFormat().fieldsReader(segmentReadState); } else { pointsReader = null; } success = true; } catch (EOFException | FileNotFoundException e) { throw new CorruptIndexException("Problem reading index from " + dir, dir.toString(), e); } catch (NoSuchFileException e) { throw new CorruptIndexException("Problem reading index.", e.getFile(), e); } finally { if (!success) { decRef(); } } } int getRefCount() { return ref.get(); } void incRef() { int count; while ((count = ref.get()) > 0) { if (ref.compareAndSet(count, count+1)) { return; } } throw new AlreadyClosedException("SegmentCoreReaders is already closed"); } @SuppressWarnings("try") void decRef() throws IOException { if (ref.decrementAndGet() == 0) { Throwable th = null; try (Closeable finalizer = this::notifyCoreClosedListeners){ IOUtils.close(termVectorsLocal, fieldsReaderLocal, fields, termVectorsReaderOrig, fieldsReaderOrig, cfsReader, normsProducer, pointsReader); } } } private final IndexReader.CacheHelper cacheHelper = new IndexReader.CacheHelper() { private final IndexReader.CacheKey cacheKey = new IndexReader.CacheKey(); @Override public CacheKey getKey() { return cacheKey; } @Override public void addClosedListener(ClosedListener listener) { coreClosedListeners.add(listener); } }; IndexReader.CacheHelper getCacheHelper() { return cacheHelper; } private void notifyCoreClosedListeners() throws IOException { synchronized(coreClosedListeners) { IOUtils.applyToAll(coreClosedListeners, l -> l.onClose(cacheHelper.getKey())); } } @Override public String toString() { return "SegmentCoreReader(" + segment + ")"; } }
[ "ying.andrews@gmail.com" ]
ying.andrews@gmail.com
04f5d8aba1d3fb91de9d49a18a3cb4b68be6ced9
02ee88208f8eadff8ad0dfe5c116ab13eddbc1ef
/src/main/java/com/webmagic/web/util/DataFormatUtil.java
707536138125e04d1e54388639382a0a824c56ed
[]
no_license
shiqingwen/datawebmagic
32aa8bf492eb89032c8f3112e7f0d10731c5d272
70957f404176fd9da0571520a12e08437f3cfa41
refs/heads/master
2020-04-07T12:50:07.037702
2018-03-07T10:59:29
2018-03-07T10:59:29
124,213,145
0
0
null
null
null
null
UTF-8
Java
false
false
1,697
java
package com.webmagic.web.util; import org.apache.log4j.Logger; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 日期格式的格式化 * Created by sqw on 2017/7/21. */ public class DataFormatUtil { private static Logger logger = Logger.getLogger(DataFormatUtil.class); public static Date getData(String date){ Pattern pattern = Pattern.compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}"); Pattern pattern1 = Pattern.compile("[0-9]{4}[年][0-9]{1,2}[月][0-9]{1,2}[日]"); Pattern pattern2 = Pattern.compile("[0-9]{4}[/][0-9]{1,2}[/][0-9]{1,2}"); Matcher matcher = pattern.matcher(date); Matcher matcher1= pattern1.matcher(date); Matcher matcher2= pattern2.matcher(date); String dateStr = null; String str = null; if(matcher.find()){ dateStr = matcher.group(0); str =dateStr.toString(); } if(matcher1.find()){ dateStr = matcher1.group(0); str =dateStr.toString(); str = str.replace("年","-"); str = str.replace("月","-"); str = str.replace("日",""); } if(matcher2.find()){ dateStr = matcher2.group(0); str =dateStr.toString(); str = str.replace("/","-"); } try { SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); Date date1 = sdf.parse(str); return date1; } catch (ParseException e) { logger.error("格式化时间异常",e); } return null; } }
[ "1938681694@qq.com" ]
1938681694@qq.com
c7acbaa99431e6436082927a6659dbb508ed34a3
8a4cf46c51577e3fbec149e03eff85b1a4d0fd5b
/roncoo-education-user/roncoo-education-user-common/src/main/java/com/roncoo/education/user/common/interfaces/gateway/auth/AuthApiLecturerAudit.java
10f5c9b14d5204174a4539ba74cb8afda29d4bd7
[]
no_license
imanner/roncoo-education
0a50a85330e2fa0b3925b1338ceac6fe23a8d9bc
6665e3355846816f68ad9645a9b78c4146dcfbda
refs/heads/master
2020-04-12T23:25:08.309738
2018-12-20T06:57:42
2018-12-20T06:57:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,731
java
package com.roncoo.education.user.common.interfaces.gateway.auth; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.roncoo.education.user.common.bean.bo.auth.AuthLecturerAuditBO; import com.roncoo.education.user.common.bean.bo.auth.AuthLecturerAuditSaveBO; import com.roncoo.education.user.common.bean.dto.auth.AuthLecturerAuditViewDTO; import com.roncoo.education.util.base.Result; import io.swagger.annotations.ApiOperation; /** * 讲师信息-审核 * * @author wujing */ public interface AuthApiLecturerAudit { /** * 讲师信息修改接口 */ @ApiOperation(value = "讲师修改接口", notes = "修改讲师信息") @RequestMapping(value = "/auth/user/api/lecturer/audit/update", method = RequestMethod.POST) Result<Integer> update(@RequestBody AuthLecturerAuditBO authLecturerAuditBO); /** * 讲师信息查看接口 */ @ApiOperation(value = "讲师查看接口", notes = "根据讲师用户编号查看讲师信息") @RequestMapping(value = "/auth/user/api/lecturer/audit/view/{lecturerUserNo}", method = RequestMethod.POST) Result<AuthLecturerAuditViewDTO> view(@PathVariable(value = "lecturerUserNo") Long lecturerUserNo); /** * 讲师申请接口 * * @param authLecturerAuditSaveBO * @author wuyun */ @ApiOperation(value = "讲师申请接口", notes = "保存讲师信息接口,需要审核") @RequestMapping(value = "/auth/user/api/lecturer/audit/save", method = RequestMethod.POST) Result<Integer> save(@RequestBody AuthLecturerAuditSaveBO authLecturerAuditSaveBO); }
[ "297115770@qq.com" ]
297115770@qq.com
484f3d2c74c2e35784e552e70612cbff91dbd630
88368aeb0264595ec0e502321e271a7801c26f98
/src/main/java/pers/wtk/dao/AdminDao.java
66e1d475b1d1c756c6e35384419c1dbd78bcfff3
[]
no_license
Etherealss/MusicInformationMS
9782140b3201608d62b7c05096750c5e2d2434de
d45372ddf077b02dfd86347be98c4101949fd878
refs/heads/master
2023-06-26T05:18:14.705271
2021-07-22T15:21:17
2021-07-22T15:21:17
386,943,834
1
0
null
null
null
null
UTF-8
Java
false
false
703
java
package pers.wtk.dao; import org.apache.ibatis.annotations.Param; import java.util.List; /** * @author wtk * @description 管理员DAO * @date 2021-06-19 */ public interface AdminDao { /** * 获取用户权限 * @param userId * @return */ List<String> getUserPremissions(Long userId); /** * 添加用户权限 * @param userId * @param permission * @return */ boolean addUserPremission(@Param("userId") Long userId, @Param("permission") String permission); /** * 删除 * @param permission * @return */ boolean deleteUserPremission(@Param("userId") Long userId, @Param("permission") String permission); }
[ "1831669777@qq.com" ]
1831669777@qq.com
73fd040623873af2e5893b360221ca642d27c719
d5196529b6f81cb59dee441de865e9ff3366a532
/EverSportsPM/grails-app/utils/UtilsTest.java
c31cfb52034d226688253fcd06d49b16b0e573f9
[]
no_license
jdonee/eversportpm
7b209eca358c1ee336211deb7abebd5f04a113e5
1d70721a7d1a6806fefae0597b15d3bc10cea575
refs/heads/master
2016-09-08T01:57:01.627102
2012-01-13T09:14:57
2012-01-13T09:14:57
2,536,783
0
0
null
null
null
null
UTF-8
Java
false
false
33
java
public class UtilsTest { }
[ "jdonee.zeng@gmail.com" ]
jdonee.zeng@gmail.com
4c0df5ece07011b32874678191f7b31d682c33c5
2a61df94f48f428c58ad8e7be36c14b84bc1be36
/dbcigs/src/java/model/bean/PlanoChamada.java
2d6ebc5a7df04053965c775c617973d7dc4ab887
[]
no_license
andersonmedeiros/dbcigs
274db035fc5a167c508c14791747aa40b5f6198e
535799e4082ae657917d1e866f102706c77c2085
refs/heads/main
2023-02-26T13:14:20.759391
2021-02-01T14:44:52
2021-02-01T14:44:52
323,495,228
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model.bean; /** * * @author anderson */ public class PlanoChamada { private final Militar mil = new Militar(); }
[ "andersonandrade.30@gmail.com" ]
andersonandrade.30@gmail.com
9dbdb689c64814d15a98714800fd57d0430d2ab6
bc6b0667dd76713e535598e4c66a28467ee08cd9
/src/chapter5/bitwiseOperations/LowerCase.java
9813e983342c2b052d07ba8ad6ec889ba5c03431
[ "MIT" ]
permissive
VladimirMetodiev/JavaByH.Schildt
b166b81f60581774d0d5cba7e8be54d7762cf024
c19e309a2fd10595b60685ab2991bf8b69ebd7da
refs/heads/main
2023-06-01T05:29:54.984195
2021-07-11T12:17:02
2021-07-11T12:17:02
343,064,763
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package chapter5.bitwiseOperations; public class LowerCase { public static void main(String[] args) { char letter; for (int i = 0; i < 26; i++) { letter = (char) ('A' + i); System.out.print(letter); letter = (char) ((int) letter | 32); System.out.print(letter + " "); } } }
[ "iarilomail@gmail.com" ]
iarilomail@gmail.com
51910aba359452516d0f501560842fb2dc226348
8aec08de584d94bbf8e6e697b7047c91b029b623
/src/ex21jdbc/statment/InsertQuery.java
78ac0df2093dd74eb1a3352ea7be5719f0992d74
[]
no_license
TaeimShin/KJAVATest
1787503ac4600f9fdf4acf10fe967c6771bec5c7
0fe13271ebfd261196a3c5b5766a4109cd341314
refs/heads/main
2023-08-27T09:12:40.646383
2021-11-11T04:01:44
2021-11-11T04:01:44
419,917,932
0
0
null
null
null
null
UTF-8
Java
false
false
2,192
java
package ex21jdbc.statment; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class InsertQuery { Connection con; //DB 연결을 위한 객체 Statement stmt; //정적 쿼리문을 전송및 실행하기 위한 객체 //생성자 public InsertQuery() { try { //드라이버 로드 Class.forName("oracle.jdbc.OracleDriver"); //오라클 DB에 연결 : 정상적으로 연결되면 Connection객체 반환 con = DriverManager.getConnection( "jdbc:oracle:thin://@localhost:1521:xe","kosmo","1234"); System.out.println("오라클 연결성공"); } catch(ClassNotFoundException e) { //ojdbc6.jar파일이 없거나 연동되지 않았을때 예외발생 System.out.println("드라이버 로딩실패"); e.printStackTrace(); } catch(SQLException e) { // 커넥션URL이나 접속정보가 잘못되었을때 예외발생 System.out.println("DB연결실패"); } catch(Exception e) { System.out.println("알수없는예외발생"); } } //쿼리작성 및 전송, 실행 private void execute() { try { //Statement 객체 생성을 위한 메서드 호출 stmt = con.createStatement(); //쿼리문 작성 String sql = "INSERT INTO member VALUES" +" ('test7','7777','사오정',SYSDATE)"; //쿼리문 실행 및 결과값 반환 int affected = stmt.executeUpdate(sql); //insert문에 대한 결과 출력 System.out.println(affected +"행이 입력되었습니다."); } catch(SQLException e) { System.out.println("쿼리실행시 오류"); e.printStackTrace(); } finally { /* try문으로 진입했다면 예외가 발생하더라도 무조건 실행되는 구문으로 자원해제를 위한 close메서드를 호출한다. */ close(); } } private void close() { try { if(stmt!= null) stmt.close(); if(con!=null) con.close(); System.out.println("자원반납완료"); } catch(SQLException e) { System.out.println("자원반납시 오류가 발생하였습니다."); } } public static void main(String[] args) { InsertQuery iSQL = new InsertQuery(); iSQL.execute(); } }
[ "poroon7@gmail.com" ]
poroon7@gmail.com
764361a9e8a7675e77ccf2553b8b998a3a494203
2c4ef455c4337aba72141f3fd7aa666d661b96b2
/src/com/example/golftest/AudioService.java
61101e163b75f9aac9704de0c16ff3c8ca9f613d
[]
no_license
ningkai1983/GolfTest
5c2ea41f2fba0a2ad5c8f3acaea64909a2c66923
ea73d5cffe92cc678b79c54730ffaf034581c3d4
refs/heads/master
2020-05-16T14:13:30.962595
2013-04-30T07:52:18
2013-04-30T07:52:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,121
java
package com.example.golftest; import org.hermit.dsp.FFTTransformer; import org.hermit.dsp.Window.*; public class AudioService { public AudioService() { audioReader = new AudioReader(); // Allocate the spectrum data. spectrumData = new float[inputBlockSize / 2]; spectrumHist = new float[inputBlockSize / 2][historyLen]; spectrumIndex = 0; spectrumAnalyser = new FFTTransformer(inputBlockSize, windowFunction); } public void onDestroy() { measureStop(); } public float peakSpecRead(){ return peakSpec; } public final void doUpdate( long now ) { short[] buffer = null; synchronized (this) { if ( audioData != null && audioSequence > audioProcessed ) { //parentSurface.statsCount(1, (int) (audioSequence - audioProcessed - 1)); audioProcessed = audioSequence; buffer = audioData; } } // If we got data, process it without the lock. if (buffer != null) { processAudio(buffer); } if (readError != AudioReader.Listener.ERR_OK){} //processError(readError); } /* a default delay to run between ticks */ //private final long TICK_DELAY = 100; // The desired sampling rate for this analyser, in samples/sec. private int sampleRate = 8000; // Audio input block size, in samples. private int inputBlockSize = 512; // The desired decimation rate for this analyser. Only 1 in // sampleDecimate blocks will actually be processed. private int sampleDecimate = 1; // Buffered audio data, and sequence number of the latest block. private short[] audioData; private long audioSequence = 0; // If we got a read error, the error code. private int readError = AudioReader.Listener.ERR_OK; // Sequence number of the last block we processed. private long audioProcessed = 0; // The desired histogram averaging window. 1 means no averaging. private int historyLen = 4; // Our audio input device. private AudioReader audioReader; // Analysed audio spectrum data; history data for each frequency // in the spectrum; index into the history data; and buffer for // peak frequencies. private float[] spectrumData; private float[][] spectrumHist; private int spectrumIndex; // The selected windowing function. private Function windowFunction = Function.BLACKMAN_HARRIS; // Fourier Transform calculator we use for calculating the spectrum // and sonagram. private FFTTransformer spectrumAnalyser; private double chirpEnergy = 0; private double chirpEnergyNow = 0; private boolean raiseDetected = false; // The Nyquist frequency -- the highest frequency // represented in the spectrum data we will be plotting. private final int nyquistFreq = sampleRate/2; // spectrum at peak psd: public, to be changed to private private float peakSpec = 100; // the switch that if we want to detect wind direction private final boolean windDirect = false; // ******************************************************************** // // Audio Processing. // ******************************************************************** // /** * Handle audio input. This is called on the thread of the audio * reader. * * @param buffer Audio data that was just read. */ private final void receiveAudio(short[] buffer) { // Lock to protect updates to these local variables. See run(). synchronized (this) { audioData = buffer; ++audioSequence; } } /** * An error has occurred. The reader has been terminated. * * @param error ERR_XXX code describing the error. */ private void handleError(int error) { synchronized (this) { readError = error; } } public void measureStart() { audioProcessed = audioSequence = 0; readError = AudioReader.Listener.ERR_OK; audioReader.startReader(sampleRate, inputBlockSize * sampleDecimate, new AudioReader.Listener() { @Override public final void onReadComplete(short[] buffer) { receiveAudio(buffer); } @Override public void onReadError(int error) { handleError(error); } }); } private void measureStop() { if (audioReader != null) audioReader.stopReader(); } /** * Handle audio input. This is called on the thread of the * parent surface. * * @param buffer Audio data that was just read. */ private final void processAudio( short[] buffer ) { // Process the buffer. While reading it, it needs to be locked. synchronized (buffer) { // Calculate the power now, while we have the input // buffer; this is pretty cheap. final int len = buffer.length; spectrumAnalyser.setInput(buffer, len - inputBlockSize, inputBlockSize); // Tell the reader we're done with the buffer. buffer.notify(); } // Do the (expensive) transformation. // The transformer has its own state, no need to lock here. //long specStart = System.currentTimeMillis(); spectrumAnalyser.transform(); //long specEnd = System.currentTimeMillis(); //parentSurface.statsTime(0, (specEnd - specStart) * 1000); // Get the FFT output. // Get the FFT output. if (historyLen <= 1) { spectrumAnalyser.getResults(spectrumData); } else { spectrumIndex = spectrumAnalyser.getResults(spectrumData, spectrumHist, spectrumIndex); specPeakSearch(spectrumData); } } /** * find the peak from the spectrum. * * @param data An array of floats defining the signal power * at each frequency in the spectrum. * @param peakSpec Peak spectrum. * @param peakPower Peak power. */ private void specPeakSearch(float[] data) { final int len = data.length; // window averaged psd data double z = 0; // index of peak spec int peakSpecIndex = 0; int dataCounter = 0; // init maxSpec and maxSpecPower double maxSpecPower = -100000.0f; double averageSpecPower = 0.0f; // half of window width of spec peak search in Hz final float specWinWidthHz = 100; //threshold used to detect a peak in spectrum in dB //final float specPeakDetThredDb= 3; int specWinWidth = (int)(Math.floor(specWinWidthHz / nyquistFreq) * len); if (2*specWinWidth+1 > len - 1) specWinWidth = (int)Math.floor((len-1)/2) - 1; // Element 0 isn't a frequency bucket; skip it. for (int j = 1; j <= 2*specWinWidth+1; j++) { //init z: half of the window size z += (double) (Math.log10(data[j])); } // Element 0 isn't a frequency bucket; skip it. for (int i = 1+specWinWidth; i < (len-specWinWidth-1); ++i) { z -= (double)(Math.log10(data[i - specWinWidth])); z += (double)(Math.log10(data[i + specWinWidth + 1])); if (z > maxSpecPower) { maxSpecPower = z; peakSpecIndex = i; } averageSpecPower +=z; dataCounter ++; } averageSpecPower = (averageSpecPower -maxSpecPower)/ (dataCounter-1); if (maxSpecPower > averageSpecPower + 1) { chirpEnergy = 0.001*maxSpecPower + chirpEnergy*0.999; chirpEnergyNow = 0.1*maxSpecPower + chirpEnergyNow*0.9; raiseDetected = !windDirect || chirpEnergyNow > chirpEnergy; peakSpec = (raiseDetected ) ? ((float)peakSpecIndex / len) * nyquistFreq : 0; } else { peakSpec = 0; chirpEnergy = 0; chirpEnergyNow = 0; } } }
[ "kaining.usc@gmail.com" ]
kaining.usc@gmail.com
43f24d53deaa967394ded3bf347176679684a6dc
e455b112a11a44e17914f5177328b62c952a8fe3
/flood-spring-cloud-starter/flood-spring-cloud-starter-fegin/src/main/java/cn/flood/cloud/grpc/fegin/fallback/FloodFallbackFactory.java
c2aeb973a454195a25f7534e85fb23fa1a46538c
[ "Apache-2.0" ]
permissive
mmdai/flood-dependencies
97035978179228efe740dc8712996a8b5188b51a
586fa0db96dcfdd7bbdec064922f213df3250d21
refs/heads/master
2023-09-02T00:47:29.496481
2023-08-01T03:26:23
2023-08-01T03:26:23
203,513,950
5
3
Apache-2.0
2023-03-01T09:04:21
2019-08-21T05:39:54
Java
UTF-8
Java
false
false
847
java
package cn.flood.cloud.grpc.fegin.fallback; import feign.Target; import lombok.AllArgsConstructor; import org.springframework.cglib.proxy.Enhancer; import org.springframework.cloud.openfeign.FallbackFactory; /** * 默认 Fallback,避免写过多fallback类 * * @param <T> 泛型标记 * @author mmdai */ @AllArgsConstructor public class FloodFallbackFactory<T> implements FallbackFactory<T> { private final Target<T> target; @Override @SuppressWarnings("unchecked") public T create(Throwable cause) { final Class<T> targetType = target.type(); final String targetName = target.name(); Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(targetType); enhancer.setUseCache(true); enhancer.setCallback(new FloodFeignFallback<>(targetType, targetName, cause)); return (T) enhancer.create(); } }
[ "daiming123.happy@163.com" ]
daiming123.happy@163.com
c87a66ce688a7870fd77421f70caaa393b92ab42
6538de683b78fe1abe746b9b7a6648822274f0de
/src/main/java/net/opengis/gml/v_3_2_1/TimeTopologyComplexPropertyType.java
a11e6788d5ef2c735241edd3ec94106895588ea1
[]
no_license
CleanSpark/cs-te-ven
9355f8340c249290fc47eb831adfb2c862c26b35
88c81bc26747deba073ea2d5010178d00becb4a9
refs/heads/master
2016-08-13T02:05:44.142696
2016-02-24T23:07:53
2016-02-24T23:07:53
52,289,995
1
3
null
null
null
null
UTF-8
Java
false
false
9,216
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2016.02.05 at 11:06:51 AM PST // package net.opengis.gml.v_3_2_1; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import org.w3._1999.xlink.ActuateType; import org.w3._1999.xlink.ShowType; import org.w3._1999.xlink.TypeType; /** * gml:TimeTopologyComplexPropertyType provides for associating a gml:TimeTopologyComplex with an object. * * <p>Java class for TimeTopologyComplexPropertyType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="TimeTopologyComplexPropertyType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence minOccurs="0"> * &lt;element ref="{http://www.opengis.net/gml/3.2}TimeTopologyComplex"/> * &lt;/sequence> * &lt;attGroup ref="{http://www.opengis.net/gml/3.2}AssociationAttributeGroup"/> * &lt;attGroup ref="{http://www.opengis.net/gml/3.2}OwnershipAttributeGroup"/> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TimeTopologyComplexPropertyType", propOrder = { "timeTopologyComplex" }) public class TimeTopologyComplexPropertyType { @XmlElement(name = "TimeTopologyComplex") protected TimeTopologyComplexType timeTopologyComplex; @XmlAttribute(name = "nilReason") protected List<String> nilReason; @XmlAttribute(name = "remoteSchema", namespace = "http://www.opengis.net/gml/3.2") @XmlSchemaType(name = "anyURI") protected String remoteSchema; /** * * */ @XmlAttribute(name = "type", namespace = "http://www.w3.org/1999/xlink") public final static TypeType TYPE = TypeType.SIMPLE; @XmlAttribute(name = "href", namespace = "http://www.w3.org/1999/xlink") protected String href; @XmlAttribute(name = "role", namespace = "http://www.w3.org/1999/xlink") protected String role; @XmlAttribute(name = "arcrole", namespace = "http://www.w3.org/1999/xlink") protected String arcrole; @XmlAttribute(name = "title", namespace = "http://www.w3.org/1999/xlink") protected String title; @XmlAttribute(name = "show", namespace = "http://www.w3.org/1999/xlink") protected ShowType show; @XmlAttribute(name = "actuate", namespace = "http://www.w3.org/1999/xlink") protected ActuateType actuate; @XmlAttribute(name = "owns") protected java.lang.Boolean owns; /** * Gets the value of the timeTopologyComplex property. * * @return * possible object is * {@link TimeTopologyComplexType } * */ public TimeTopologyComplexType getTimeTopologyComplex() { return timeTopologyComplex; } /** * Sets the value of the timeTopologyComplex property. * * @param value * allowed object is * {@link TimeTopologyComplexType } * */ public void setTimeTopologyComplex(TimeTopologyComplexType value) { this.timeTopologyComplex = value; } public boolean isSetTimeTopologyComplex() { return (this.timeTopologyComplex!= null); } /** * Gets the value of the nilReason property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the nilReason property. * * <p> * For example, to add a new item, do as follows: * <pre> * getNilReason().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getNilReason() { if (nilReason == null) { nilReason = new ArrayList<String>(); } return this.nilReason; } public boolean isSetNilReason() { return ((this.nilReason!= null)&&(!this.nilReason.isEmpty())); } public void unsetNilReason() { this.nilReason = null; } /** * Gets the value of the remoteSchema property. * * @return * possible object is * {@link String } * */ public String getRemoteSchema() { return remoteSchema; } /** * Sets the value of the remoteSchema property. * * @param value * allowed object is * {@link String } * */ public void setRemoteSchema(String value) { this.remoteSchema = value; } public boolean isSetRemoteSchema() { return (this.remoteSchema!= null); } /** * Gets the value of the href property. * * @return * possible object is * {@link String } * */ public String getHref() { return href; } /** * Sets the value of the href property. * * @param value * allowed object is * {@link String } * */ public void setHref(String value) { this.href = value; } public boolean isSetHref() { return (this.href!= null); } /** * Gets the value of the role property. * * @return * possible object is * {@link String } * */ public String getRole() { return role; } /** * Sets the value of the role property. * * @param value * allowed object is * {@link String } * */ public void setRole(String value) { this.role = value; } public boolean isSetRole() { return (this.role!= null); } /** * Gets the value of the arcrole property. * * @return * possible object is * {@link String } * */ public String getArcrole() { return arcrole; } /** * Sets the value of the arcrole property. * * @param value * allowed object is * {@link String } * */ public void setArcrole(String value) { this.arcrole = value; } public boolean isSetArcrole() { return (this.arcrole!= null); } /** * Gets the value of the title property. * * @return * possible object is * {@link String } * */ public String getTitle() { return title; } /** * Sets the value of the title property. * * @param value * allowed object is * {@link String } * */ public void setTitle(String value) { this.title = value; } public boolean isSetTitle() { return (this.title!= null); } /** * Gets the value of the show property. * * @return * possible object is * {@link ShowType } * */ public ShowType getShow() { return show; } /** * Sets the value of the show property. * * @param value * allowed object is * {@link ShowType } * */ public void setShow(ShowType value) { this.show = value; } public boolean isSetShow() { return (this.show!= null); } /** * Gets the value of the actuate property. * * @return * possible object is * {@link ActuateType } * */ public ActuateType getActuate() { return actuate; } /** * Sets the value of the actuate property. * * @param value * allowed object is * {@link ActuateType } * */ public void setActuate(ActuateType value) { this.actuate = value; } public boolean isSetActuate() { return (this.actuate!= null); } /** * Gets the value of the owns property. * * @return * possible object is * {@link java.lang.Boolean } * */ public boolean isOwns() { if (owns == null) { return false; } else { return owns; } } /** * Sets the value of the owns property. * * @param value * allowed object is * {@link java.lang.Boolean } * */ public void setOwns(boolean value) { this.owns = value; } public boolean isSetOwns() { return (this.owns!= null); } public void unsetOwns() { this.owns = null; } }
[ "shane.yamamoto@yahoo.com" ]
shane.yamamoto@yahoo.com
8fae5994f8e7a652efe10e0ba72c1f299128c6d8
7db3e38ef835f4ddbcafd7f6bc51b83b5426e7d5
/simple-book-app/src/com/jdc/app/entity/SaleDetail.java
0867893b88b76d1db80252d4223234d312f03be7
[]
no_license
Nyan-Win-Naing/java-se-book-project
d76c5f3f868537f3b52804165b3b87405db09d20
0d3ad360aa658f07a4b880f1232223035b4d7e9a
refs/heads/master
2022-11-05T13:35:03.916920
2020-06-23T11:16:33
2020-06-23T11:16:33
274,064,295
0
0
null
null
null
null
UTF-8
Java
false
false
2,233
java
package com.jdc.app.entity; public class SaleDetail { private int id; private Book book; private Category category; private Author author; private Sale sale; private int quantity; private int unitPrice; private boolean delete; /* Test Code */ private String bookName; private int bookId; private int tax; public SaleDetail() { sale = new Sale(); } public int getTax() { return tax; } public void setTax(int tax) { this.tax = tax; } public int getBookId() { return bookId; } public void setBookId(int bookId) { this.bookId = bookId; } public String getBookName() { return bookName; } public void setBookName(String bookName) { this.bookName = bookName; } /* Test Code */ public boolean isDelete() { return delete; } public void setDelete(boolean delete) { this.delete = delete; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Category getCategory() { return category; } public void setCategory(Category category) { this.category = category; } public Book getBook() { return book; } public void setBook(Book book) { this.book = book; } public Author getAuthor() { return author; } public void setAuthor(Author author) { this.author = author; } public Sale getSale() { return sale; } public void setSale(Sale sale) { this.sale = sale; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public int getUnitPrice() { return unitPrice; } public void setUnitPrice(int unitPrice) { this.unitPrice = unitPrice; } public String getCategoryName() { return category.getName(); } public String getAuthorName() { return author.getName(); } // public String getBookName() { // return book.getName(); // } public int getSaleTax() { // return getSubTotal() * (10/100); // return getTax(); return sale.getTax(); } public int getSubTotal() { return getQuantity() * getUnitPrice(); } public int getTotal() { return getSubTotal() + getTax(); } }
[ "Nyan Win Naing@LAPTOP-MNCL68F3.lan" ]
Nyan Win Naing@LAPTOP-MNCL68F3.lan
4a8b071f3c061bf2e63a2d67b2a7f603c2c9af28
d674d809d0f5e46d7afa02a2ea0a8ff498ee7002
/src/剑指Offer/Offer33.java
74959af571d3f24c85f06c838917a9ccfe6aa5e6
[]
no_license
FisherWY/Leetcode
7047366f8d414d062e2832a38c23bc69f4f8d56f
2f9f5e325fa7e515ae0f947f54b915ee2c5eeaa8
refs/heads/master
2021-06-20T20:42:16.840818
2021-03-25T04:09:00
2021-03-25T04:09:00
197,300,714
1
0
null
null
null
null
UTF-8
Java
false
false
698
java
package 剑指Offer; public class Offer33 { public boolean verifyPostorder(int[] postorder) { return fun(postorder, 0, postorder.length - 1); } private boolean fun(int[] arr, int i, int j) { // 后序遍历,i为左子树起始位置,j为根节点 if (i >= j) { return true; } int m = i; while (arr[m] < arr[j]) { // 寻找左子树的根节点,左子树的值均小于根节点的值 m++; } int n = m; while (arr[n] > arr[j]) { // 验证右子树的值是否均大于根节点的值 n++; } return n == j && fun(arr, i, m - 1) && fun(arr, m, j - 1); } }
[ "32707008+FisherWY@users.noreply.github.com" ]
32707008+FisherWY@users.noreply.github.com
71c68195af98429421e507795dd6633aac437575
bb65c2e7eab4a522a919c23d14de0fdc43876335
/poker/test/Table/HandTest.java
e483227d6139ce4a4e335db1870b559aef4cd5e9
[]
no_license
olislawiec/TEXAS
b2dfebcdd8d9e2765fdee866800bccec249e0b89
eb127891432d2c8fa3139e8a3d066f444b627274
refs/heads/master
2021-03-27T09:11:23.693803
2016-01-02T11:47:51
2016-01-02T11:47:51
47,140,032
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
package Table; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import Table.Card; import Table.Hand; public class HandTest { Hand hand; @Before public void SetUp(){ hand=new Hand(); } @After public void tearDown() throws Exception { hand=null; } @Test public void addCardWorks() { int beforeLength=hand.cards.size(); hand.addCard(new Card(1,1,0)); int afterLength=hand.cards.size(); assertNotSame(beforeLength,afterLength); } @Test public void getCardWorks() { Card card = new Card(2,2,0); hand.addCard(card); assertEquals(card,hand.cards.get(hand.cards.size()-1)); } }
[ "dominik.kuszczak@gmail.com" ]
dominik.kuszczak@gmail.com
02aab10efb0e6deade6167245985a86016f8c10e
37d4e36b5dd2aecc220387dfe7ebc9eb5c5cb9ae
/src/test/java/com/springframework/receipe/ReceipeApplicationTests.java
b221d1c25b7bcd5eac973f293f0bfac350f8dd65
[]
no_license
unicobib/Spring-Recipe-Project
719bd04bbcfbebf019ba0d4ab70728c13d48bd7a
bc17ac62cd96cf29ff0b431e80609f18245b1dd9
refs/heads/master
2020-08-04T01:32:06.206438
2019-09-30T21:37:21
2019-09-30T21:37:21
211,953,951
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.springframework.receipe; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ReceipeApplicationTests { @Test public void contextLoads() { } }
[ "bibek.125060@gmail.com" ]
bibek.125060@gmail.com
0f74595e55db1338ebfa2d0f1379c13a36481055
d2c7893a967738a97583368dbf1e41caeb1d47c7
/aTalk/src/main/java/org/jivesoftware/smackx/rayo/HeaderExtension.java
d24113817e88bf469b0dbdcc1908705ce0e16591
[ "Apache-2.0" ]
permissive
cmeng-git/atalk-android
0b5a7f48d04ba0173852d2f2ccbe786830669603
a821544edc644fdb3f63402340051dc1e86c1c59
refs/heads/master
2023-07-08T08:58:44.604534
2023-07-07T14:24:52
2023-07-07T14:24:52
116,449,957
148
79
Apache-2.0
2023-03-28T10:31:34
2018-01-06T03:27:17
Java
UTF-8
Java
false
false
2,327
java
/* * Jitsi, the OpenSource Java VoIP and Instant Messaging client. * * 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.jivesoftware.smackx.rayo; import org.jivesoftware.smackx.AbstractExtensionElement; /** * Header packet extension optionally included in {@link RayoIqProvider.RayoIq}. Holds 'name' and * 'value' attributes. * * @author Pawel Domas */ public class HeaderExtension extends AbstractExtensionElement { /** * XML element name. */ public static final String ELEMENT = "header"; /** * The name of 'name' attribute. */ public static final String NAME_ATTR_NAME = "name"; /** * The name of 'value' attribute. */ public static final String VALUE_ATTR_NAME = "value"; /** * Creates new instance of <code>HeaderPacketExtension</code>. */ public HeaderExtension() { super(ELEMENT, RayoIqProvider.NAMESPACE); } /** * Return the value of 'name' attribute. * * @return the value of 'name' attribute. */ public String getName() { return getAttributeAsString(NAME_ATTR_NAME); } /** * Sets new value for 'name' attribute of this extension. * * @param name the new value to set for 'name' attribute. */ public void setName(String name) { setAttribute(NAME_ATTR_NAME, name); } /** * Returns the value of 'value' attribute. * * @return the value of 'value' attribute. */ public String getValue() { return getAttributeAsString(VALUE_ATTR_NAME); } /** * Sets new value for the 'value' attribute. * * @param value new value for the 'value' attribute to set. */ public void setValue(String value) { setAttribute(VALUE_ATTR_NAME, value); } }
[ "cmeng.gm@gmail.com" ]
cmeng.gm@gmail.com
7e36321fd9ce607b0a5b8ee8b9613ca9cef011b4
a6b662679155b06f356029b707ff5419c7dda588
/src/com/Josephus/chat/Register/transregister.java
3e8d20c5dbc8cdcbdda02241eece1272ca589285
[]
no_license
3547211923/test
7038bb202e4c3b3b275b2992632ee0ff9f6f11ad
c341999f00465e65f454a899d55e928fe81cb44c
refs/heads/master
2023-02-16T23:11:32.082015
2021-01-09T11:06:03
2021-01-09T11:06:03
328,135,220
0
0
null
null
null
null
UTF-8
Java
false
false
956
java
package com.Josephus.chat.Register; public class transregister { private String name; private String loginid; private String password; private String sex; private String birthday; private String email; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLoginid() { return loginid; } public void setLoginid(String loginid) { this.loginid = loginid; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
[ "黎锦涛@DESKTOP-M4GQKD6" ]
黎锦涛@DESKTOP-M4GQKD6
d5045ff4731012bbf7828bfe75f93e7931b505ea
a59f03b222eb72cee28018705ddd04f8b518cac7
/triana-types/src/main/java/triana/types/Document.java
c1ca027221ce5c75b7ecc1711a73a3c055c35368
[ "Apache-2.0" ]
permissive
Janix520/Triana
487c90a0d822d8a6338f940fb5e4740ba5bd069f
da48ffaa0183f59e3fe7c6dc59d9f91234e65809
refs/heads/master
2022-03-27T19:29:45.050728
2014-08-29T17:43:13
2014-08-29T17:43:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
82,320
java
/* * The University of Wales, Cardiff Triana Project Software License (Based * on the Apache Software License Version 1.1) * * Copyright (c) 2007 University of Wales, Cardiff. All rights reserved. * * Redistribution and use of the software in source and binary forms, with * or without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. 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. * * 3. The end-user documentation included with the redistribution, if any, * must include the following acknowledgment: "This product includes * software developed by the University of Wales, Cardiff for the Triana * Project (http://www.trianacode.org)." Alternately, this * acknowledgment may appear in the software itself, if and wherever * such third-party acknowledgments normally appear. * * 4. The names "Triana" and "University of Wales, Cardiff" must not be * used to endorse or promote products derived from this software * without prior written permission. For written permission, please * contact triana@trianacode.org. * * 5. Products derived from this software may not be called "Triana," nor * may Triana appear in their name, without prior written permission of * the University of Wales, Cardiff. * * 6. This software may not be sold, used or incorporated into any product * for sale to third parties. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 UNIVERSITY OF WALES, CARDIFF OR ITS 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. * * ------------------------------------------------------------------------ * * This software consists of voluntary contributions made by many * individuals on behalf of the Triana Project. For more information on the * Triana Project, please see. http://www.trianacode.org. * * This license is based on the BSD license as adopted by the Apache * Foundation and is governed by the laws of England and Wales. * */ package triana.types; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import triana.types.util.Str; /** * Document is a type which stores the contents of a Document in a String (or just encapsulates any string) with an * optional file name. There are parameters for marking special lines and special groups of characters, for * search-and-replace units to work with. In order to keep the line- and group-markers pointing to the same text after * the contents have been modified, use the methods <i>cutString</i>, <i>insertString</i>, and <i>replaceString</i>. To * replace the entire document and wipe out markers, use <i>setText()</i>. * <p/> * The markers for groups of characters are held in a FIFO stack, each element of which is an ArrayList of pairs of * integers, marking regions of the document. Each member of the stack contains regions that are refinements of * (<i>i.e.</i> contained within) the regions delineated in the previous element. The pointer <i>charGroups</i> points * to the most refined level, the pointer <i>domain</i> points to the next most refined level. Methos allow editing * units to select regions, refine them, edit them, retreat to the previous level of selection, etc. * * @author Ian Taylor * @author Bernard Schutz * @version $Revision: 4048 $ */ public class Document extends TrianaType implements AsciiComm { /** * Contains the optional file name (FileName is a TrianaType data type) under which this Document is stored. */ private FileName fname = null; /** * Holds a key to the Hashtable in TrianaType which will hold the Document. */ private String doc = "Document"; /** * Array of integers holding the line numbers of lines that have been marked. Allows search, replace, and display * units to refer to specific lines. */ private int[] lineNos = new int[1]; /** * Stack of ArrayLists of pairs (int[2]'s) of integers holding the character ranges that have been marked. The * elements of this list should be ArrayLists. Each ArrayList will contain int[2]'s. Each int[2] holds the indices * of the starting and ending characters of a single group of characters. Allows search, replace, and display units * to refer to specific groups of characters. */ private ArrayList charGroupStack = new ArrayList(1); /** * Pointer to the most recent entry in the stack <i>charGroupStack</i>, which is regarded as the current list of * selected character ranges. */ private ArrayList charGroups; /** * Pointer to the second-most recent entry in the stack <i>charGroupStack</i>, which is regarded as the domain from * within which the regions defined in <i>charGroups</i> were selected. */ private ArrayList domain; /* * The end-of-line marker used by this method. As its value is * static, it does not need to be copied with other parameters in the * copy methods. Its value is platform-dependent. */ private static String eol = System.getProperty("line.separator"); /* * Use to get debugging output. Allows a variety of writes to System.out. * Need to recompile Document to change this value. */ private boolean debug = false; /** * Creates a new empty Document, setting its state to <i>false</i>. */ public Document() { } /** * Creates a new Document with the contents set to the specified String. * * @param contents the String containing the contents of the Document. */ public Document(String contents) { setText(contents); } /** * Creates a new Document with the contents set to the specified String and with a String representing the full path * and name of the file which the Document was taken from. * * @param contents the String containing the contents of the Document. * @param fileAndPath the String containing the full pathname of the file where the Document came from. */ public Document(String contents, String fileAndPath) { setText(contents); fname = new FileName(fileAndPath); } /** * Creates a new Document with the contents set to the specified String and with a String representing the full path * and name of the file which the Document was taken from. * * @param contents the String containing the contents of the Document. * @param file the FileName object containing the file where the Document came from. */ public Document(String contents, FileName file) { setText(contents); fname = file; } /** * Creates a new Document with the contents set to the specified String, with the given name of the file from which * the Document was taken, and with the given directory for the Document. * * @param contents The contents of the Document. * @param file The name of the file where the Document came from. * @param directory The name of the directory where the Document came from. */ public Document(String contents, String file, String directory) { setText(contents); fname = new FileName(file, directory); } /** * @return String a reference to the contents of this Document */ public String getText() { Object res = getFromContainer(doc); if (res == null) { return ""; } return (String) res; } /** * Gets the whole stack of ArrayLists that denote character groups and their refinements. Used for copying but not * much else. There is no method to set this. * * @return ArrayList The stack of character group ArrayLists */ public ArrayList getCharGroupStack() { return charGroupStack; } /** * Sets the given String to be the contents of the object and eliminates any character group delimiters because they * are unlikely to be relevant to new text. If simple modifications of the text are desired, preserving groups, use * the methods <i>cutString</i>, <i>insertString</i>, <i>replaceString</i>, and <i>add</i>. Initially only one * character group is defined, spanning the whole document. The pointer domain is set to null since there is only * one element on the stack. * * @param newContents A string of the new contents */ public void setText(String newContents) { charGroups = new ArrayList(10); if (newContents.length() > 0) { insertIntoContainer(doc, newContents); int[] wholeDoc = {0, newContents.length() - 1}; charGroups.add(wholeDoc); } charGroupStack.add(charGroups); if (debug) { System.out.println( "Document.setText: added new level, total levels = " + String.valueOf(charGroupStack.size()) + "\nDocument.setText: here are the populations of the character group levels: "); } if (debug) { for (int k = 0; k < charGroupStack.size(); k++) { System.out.print(String.valueOf(((ArrayList) charGroupStack.get(k)).size()) + ", "); } } if (debug) { System.out.print("\n"); } if (debug) { System.out.println( "Document.setText: added new level, total levels = " + String.valueOf(charGroupStack.size()) + "\nDocument.setText: here are the populations of the character group levels: "); } if (debug) { for (int k = 0; k < charGroupStack.size(); k++) { System.out.print(String.valueOf(((ArrayList) charGroupStack.get(k)).size()) + ", "); } } if (debug) { System.out.print("\n"); } domain = null; updateObsoletePointers(); } /** * Returns the substring denoted by the given character positions, inclusive. This does not modify the document in * any way. * * @param start The location of the first character to be returned * @param end The location of the last character to be returned */ public String getString(int start, int end) { return getText().substring(start, end + 1); } /** * Removes and returns the character String between the two given index positions, including the two positions. * Returns null if either index is out of bounds. Readjusts all character group locations and interesting line * numbers after the given string, so that they point to the same text as before. Any groups with delimiters inside * the region to be cut are eliminated. * * @param start First character of string to be cut * @param end Last character of the string to be cut * @return The string that has been cut */ public String cutString(int start, int end) { if (debug) { System.out.println( "Document: cutting String in range (" + String.valueOf(start) + "," + String.valueOf(end) + ")"); } StringBuffer oldContents = new StringBuffer(getText()); String cut = oldContents.substring(start, end + 1); int cutlength = end - start + 1; insertIntoContainer(doc, oldContents.delete(start, end + 1).toString()); int[] delims = {0, getText().length() - 1}; ((ArrayList) charGroupStack.get(charGroupStack.size() - 1)).set(0, delims); if (debug) { System.out.println("Document.cutString: charGroupStack size = " + String.valueOf(charGroupStack.size()) + ", root element ArrayList has size = " + String .valueOf(((ArrayList) charGroupStack.get(charGroupStack.size() - 1)).size())); } updateObsoletePointers(); if (!existCharGroups()) { return cut; } if (debug) { System.out.println("Document.cutString has character groups."); } int nextGroup, startInGroup, endInGroup, nextOpening, nextClosing, lastGroupToRemove; for (int k = 0; k < charGroupStack.size() - 1; k++) { // iterate through all charGroups in stack except for basis one charGroups = (ArrayList) charGroupStack .get(k); // pretend that each stack element in turn is the "current" one if (debug) { System.out.println("Document.cutString: current stack element is k = " + String.valueOf(k) + ", contains the following groups:"); } if (debug) { System.out.println(listCharGroups(k)); } startInGroup = containedInCharGroup(start); endInGroup = containedInCharGroup(end); if (debug) { System.out.println("Document.cutString: string to be cut runs from " + String.valueOf(start) + " to " + String.valueOf(end) + ", and returns the following contained-in-group values -- for start, " + String.valueOf(startInGroup) + ", and for end, " + String.valueOf(endInGroup)); } if ((startInGroup == endInGroup) && (startInGroup != -1)) { // cut is within a group delims = (int[]) charGroups.get(startInGroup); if (debug) { System.out.println( "Document.cutString: delims of group containing cut: ( " + String.valueOf(delims[0]) + ", " + String.valueOf(delims[1]) + ")"); } if (debug) { System.out.println( "Document.cutString: before removal, current stack element is k = " + String.valueOf(k) + ", delims[1] = " + String.valueOf(delims[1]) + " and list contains the following groups:"); } if (debug) { System.out.println(listCharGroups(k)); } removeCharGroup(startInGroup); if (debug) { System.out.println( "Document.cutString: after removal, current stack element is k = " + String.valueOf(k) + ", delims[1] = " + String.valueOf(delims[1]) + " and list contains the following groups:"); } if (debug) { System.out.println(listCharGroups(k)); } if (cutlength > delims[1] - delims[0]) { // group was entirely removed nextGroup = startInGroup; } else { // some part of group remains, restore it to list delims[1] -= cutlength; if (debug) { System.out.println( "Document.cutString: now the group's delims are ( " + String.valueOf(delims[0]) + ", " + String.valueOf(delims[1]) + "), and size of charGroups is " + String .valueOf(charGroups.size())); } if (startInGroup < charGroups.size()) { charGroups.add(startInGroup, delims); } else { charGroups.add(delims); } nextGroup = startInGroup + 1; if (debug) { System.out.println( "Document.cutString: after placing new delims into charGroups we have size = " + String.valueOf(charGroups.size()) + " and nextGroup = " + String .valueOf(nextGroup)); } } } else { nextOpening = nextCharGroup(start); // the first group starting after cut begins nextClosing = nextCharGroup(end); // the first group starting after cut ends lastGroupToRemove = (nextClosing == -1) ? charGroups.size() - 1 : nextClosing - 1; if (startInGroup == -1) { // cut starts outside of a group if (endInGroup == -1) { // cut ends outside of a group if (nextOpening == nextClosing) { // no group in cut nextGroup = nextOpening; } else { // group(s) contained entirely within cut removeCharGroups(nextOpening, lastGroupToRemove); nextGroup = nextOpening; // remember that removeCharGroups() shifts groups down } } else { // cut starts outside of group, ends within a group removeCharGroups(nextOpening, endInGroup); nextGroup = nextOpening; // remember that removeCharGroups() shifts groups down } } else { // cut starts within a group if (endInGroup == -1) { // cut starts within a group, ends outside a group removeCharGroups(startInGroup, lastGroupToRemove); nextGroup = startInGroup; // remember that removeCharGroups() shifts groups down } else { // cut starts within a group, ends within a different group removeCharGroups(startInGroup, lastGroupToRemove); nextGroup = startInGroup; // remember that removeCharGroups() shifts groups down } } } if ((nextGroup >= 0) && (nextGroup < charGroups.size())) { if (debug) { System.out.println("Document.cutString: calling shiftCharGroups with arguments " + String.valueOf(start - end - 1) + " and " + String.valueOf(nextGroup)); } shiftCharGroups(start - end - 1, nextGroup); } if (debug) { System.out.println("Document.cutString: after cut, current stack element k = " + String.valueOf(k) + ", contains the following groups:"); } if (debug) { System.out.println(listCharGroups(k)); } } charGroups = (ArrayList) charGroupStack.get(0); // reset pointer to current charGroup ArrayList if (isLineNumber()) { int startLine = countLines(getText().substring(0, start)); int linesCut = countLines(cut); int nextInteresting = nextLineNo(startLine); if (nextInteresting != -1) { // there are interesting lines after the cut begins int endInteresting = nextLineNo(startLine + linesCut); int lastInteresting = lineNos.length - 1; if (endInteresting == -1) { deleteLineNumbers(nextInteresting, lastInteresting); // delete all lines above beginning of cut } else if (endInteresting > nextInteresting) { deleteLineNumbers(nextInteresting, endInteresting - 1); // delete intervening lines } shiftLineNumbers(-linesCut, nextInteresting); // remember that deleteLineNumbers() shifts lines down the list } } return cut; } /** * Inserts the given character String, starting at the given character index position. Readjusts all character * group locations and interesting line numbers after the character position, so that they point to the same text as * before. * * @param insertion The character String to be inserted * @param location Character index of the location of the insertion */ public void insertString(String insertion, int location) { if (debug) { System.out.println("Document.insertString: inserting String of length " + String.valueOf(insertion.length()) + " at location " + String.valueOf(location)); } if (location == getText().length()) { add(insertion); return; } int insertLength = insertion.length(); StringBuffer working = new StringBuffer(getText().length() + insertLength); insertIntoContainer(doc, working.append(getText()).insert(location, insertion).toString()); int[] delims = {0, getText().length() - 1}; ((ArrayList) charGroupStack.get(charGroupStack.size() - 1)).set(0, delims); updateObsoletePointers(); if (!existCharGroups()) { return; } int startInGroup, nextGroup; for (int k = 0; k < charGroupStack.size() - 1; k++) { // iterate through all charGroups in stack except for basis one charGroups = (ArrayList) charGroupStack .get(k); // pretend that each stack element in turn is the "current" one startInGroup = containedInCharGroup(location); if (startInGroup != -1) { // insertion is within an existing group ((int[]) charGroups.get(startInGroup))[1] += insertLength; } nextGroup = nextCharGroup(location); if ((nextGroup == startInGroup) && (nextGroup != -1)) { nextGroup++; } if (nextGroup != -1) { shiftCharGroups(insertLength, nextGroup); } } charGroups = (ArrayList) charGroupStack.get(0); // reset pointer to current charGroup ArrayList if (isLineNumber()) { int startLine = countLines(getText().substring(0, location)); int nextInteresting = nextLineNo(startLine); if (nextInteresting > -1) { int linesInserted = countLines(insertion); shiftLineNumbers(linesInserted, nextInteresting); } } } /** * Appends the given text to the existing Document. * * @param insertion the String to be appended */ public void add(String insertion) { int insertLength = insertion.length(); int oldLength = getText().length(); StringBuffer working = new StringBuffer(oldLength + insertLength); insertIntoContainer(doc, working.append(getText()).append(insertion).toString()); updateObsoletePointers(); ArrayList list; for (int k = 0; k < charGroupStack.size(); k++) { // iterate through all charGroups in stack including basis one if (debug) { System.out.println("Document.add: value of k = " + String.valueOf(k)); } list = (ArrayList) charGroupStack.get(k); if (debug) { System.out.println("Document.add: is list null?" + String.valueOf((list == null))); } if (debug) { System.out.println("Document.add: size of list = " + String.valueOf(list.size())); } int[] last = (int[]) list.get(list.size() - 1); if (last[1] == oldLength - 1) { last[1] += insertLength; } // change delim if it marks the last character of the old text } } /** * Appends the given text to the Document and appends a further line break afterwards. * * @param text the String to be appended */ public void addLine(String text) { add(text + eol); } /** * Replaces the characters between the two given positions, inclusive, by the given String and returns the String * that was replaced. Readjusts all character group locations after the replacement, so that they point to the same * text as before. Any groups with delimiters inside the region to be replaced are eliminated. Does this by calling * the <i>cutString</i> and <i>insertString</i> methods. * * @param start First character to be replaced * @param end Last character to be replaced * @param replacement The string that is to be inserted in place of the cut string * @return The portion of the document that was replaced */ public String replaceString(int start, int end, String replacement) { if (debug) { System.out.println( "Document: replacing String in range (" + String.valueOf(start) + "," + String.valueOf(end) + ")"); } String cut = cutString(start, end); insertString(replacement, start); return cut; } /** * Returns a string representation of the complete path and file name. Note that this method returns NULL if there * is no filename associated with this Document. * * @return String full path to file containing the Document */ public String getFile() { if (fname != null) { return fname.getFile(); } else { return null; } } /** * @return true if the file is a HTML file */ public boolean isTextHTML() { String text = getText(); if ((text.indexOf("<html>") != -1) || (text.indexOf("<HTML>") != -1)) { return true; } else { return false; } } /** * @return the FileName Object */ public FileName getFileRef() { return fname; } /** * Returns a String representation of the filename not including any path information. Note that this method returns * NULL if there is no filename associated with this Document. * * @return String filename (without path) of file containing Document */ public String getFileNoPath() { if (fname != null) { return fname.getFileNoPath(); } else { return null; } } /** * Returns a reference to the path for this file without its filename. Note that this method returns NULL if there * is no filename associated with this Document. * * @return String the path (without filename) of the file containing this Document */ public String getPath() { if (fname != null) { return fname.getPath(); } else { return null; } } /** * Sets an int[] array containing interesting line numbers within the file which units can use to display the file * at the appropriate place(s). For example, this function is called by the Grep unit. * * @param ln the set of line numbers of interest */ public void setLineNumbers(int ln[]) { lineNos = ln; } /** * Gets the int[] array of line numbers currently held for this Document. This is the array created by * <i>setLineNumbers</i>, not a list of all the line numbers. * * @return int[] the line number array */ public int[] getLineNumbers() { return lineNos; } /** * Tests whether there are interesting line numbers for this document. * * @return boolean <i>True</i> if there are non-zero line number markers */ public boolean isLineNumber() { return ((lineNos.length > 1) || (lineNos[0] > 0)); } /** * Gets the <i>n</i>th interesting line number held for this document. If there are not this many line numbers, * returns -1. * * @param n The index into the line-number array * @return int The desired line number */ public int getLineNumber(int n) { int l = -1; if (n < lineNos.length) { l = lineNos[n]; } return l; } /** * Adds an interesting line number to the line number array in the right order. * * @param n The line number to be added */ public void addLineNumber(int n) { int l = nextLineNo(n); if (lineNos[l] == n) { return; } int oldLength = lineNos.length; int[] newNos = new int[oldLength + 1]; if (l == -1) { System.arraycopy(lineNos, 0, newNos, 0, oldLength); newNos[oldLength + 1] = n; } else { if (l > 0) { System.arraycopy(lineNos, 0, newNos, 0, l); } newNos[l] = n; System.arraycopy(lineNos, l, newNos, l + 1, oldLength - l); } setLineNumbers(newNos); } /** * Deletes the line number at the given index location. * * @param l The index number of the line to be deleted */ public void deleteLineNumber(int l) { int oldLength = lineNos.length; int newLength = oldLength - 1; int[] newNos = new int[newLength]; if (l == 0) { System.arraycopy(lineNos, 1, newNos, 0, newLength); } else if (l == newLength) { System.arraycopy(lineNos, 0, newNos, 0, newLength); } else { System.arraycopy(lineNos, 0, newNos, 0, l); System.arraycopy(lineNos, l + 1, newNos, l, newLength - l); } } /** * Deletes the line number range defined by the given index locations. * * @param start The index number of the first line to be deleted * @param end The index number of the last line to be deleted */ public void deleteLineNumbers(int start, int end) { if (start == end) { deleteLineNumber(start); return; } int oldLength = lineNos.length; end = (end < oldLength) ? end : oldLength; int linesOut = end - start + 1; if (linesOut >= oldLength) { lineNos = new int[1]; return; } int newLength = oldLength - linesOut; int[] newNos = new int[newLength]; if (start == 0) { System.arraycopy(lineNos, end + 1, newNos, 0, newLength); } else if (end == oldLength - 1) { System.arraycopy(lineNos, 0, newNos, 0, newLength); } else { System.arraycopy(lineNos, 0, newNos, 0, start + 1); System.arraycopy(lineNos, end + 1, newNos, start + 1, newLength - start - 1); } } /** * Counts the number of lines in the given String. * * @param s The String to be examined * @return The number of end-of-line markers in the string */ public int countLines(String s) { int count = 0; int pos = -1; while ((pos = s.indexOf(eol, pos + 1)) != -1) { count++; } return count; } /** * Returns a String containing the interesting line numbers, each on a separate line. * * @return String The list of interesting line numbers */ public String listLineNumbers() { StringBuffer list = new StringBuffer(2 * lineNos.length); if (isLineNumber()) { for (int l = 0; l < lineNos.length; l++) { list.append(lineNos[l]).append(eol); } } return list.toString(); } /** * Returns a String containing the interesting line numbers and their lines, separated by a line-separator * (carriage-return). * * @return String The list of interesting line numbers */ public String listLineNumbersAndLines() { StringBuffer list = new StringBuffer(2 * lineNos.length); if (isLineNumber()) { int eolLength = eol.length(); int lastLine = 0; int loc1 = 0; int loc2 = 0; String t = getText(); if (!t.endsWith(eol)) { t += eol; } for (int l = 0; l < lineNos.length; l++) { while (lastLine <= lineNos[l]) { loc2 = t.indexOf(eol, loc2); lastLine++; } loc1 = t.lastIndexOf(eol, loc2 - 1); if (loc1 == -1) { loc1 = 0; } loc2 += eolLength; list.append(lineNos[l]).append(": ").append(t.substring(loc1, loc2)); } } return list.toString(); } /** * Adds a given constant <i>shift</i> to the interesting line numbers for this Document above the given index. This * allows one to ensure that the same lines are marked after lines are added to or removed from the text. * * @param shift The amount by which the line numbers are moved * @param index The first line number to be moved. */ public void shiftLineNumbers(int shift, int index) { for (int l = index; l < lineNos.length; l++) { lineNos[l] += shift; } } /** * Returns the index of the next interesting line number held in the array <i>lineNos</i> that is larger than the * given line number, or -1 if there is no interesting line number larger. * * @param n The line number where the search starts * @return The index of the first interesting line number above <i>n</i> */ public int nextLineNo(int n) { int l = 0; while (lineNos[l] < n) { l++; if (l == lineNos.length) { return -1; } } return l; } /** * Gets the current ArrayList of the current character groups for this Document. This is the ArrayList created by * <i>setCharGroups</i>. * * @return ArrayList the set of integer arrays holding character ranges */ public ArrayList getCharGroups() { return charGroups; } /** * Gets the integer array for the character group denoted by the given index. Returns null if the index is out of * bounds. * * @param index the index of the character group being sought */ public int[] getCharGroup(int index) { if ((index < 0) || (index >= charGroups.size())) { return null; } return (int[]) charGroups.get(index); } /** * Returns an ArrayList of the delimiters of the character groups that are entirely contained within the given index * values. Groups that start outside and finish inside or start inside and finish outside are not included. * * @param start The index of the first character in the search interval * @param end The index of the final character in the search interval * @return Contains int[2] pairs of delimiters of the character groups in the search interval, null if there are * none */ public ArrayList getCharGroups(int start, int end) { int n = nextCharGroup(start); if (n == -1) { return null; } ArrayList setOfGroups = new ArrayList(2); while ((n < charGroups.size()) && (getCharGroup(n)[1] <= end)) { setOfGroups.add(getCharGroup(n++)); } if (setOfGroups.size() == 0) { return null; } return setOfGroups; } /** * Gets an ArrayList of int[2]'s containing the indices of the first and last characters in all parts of the * document text that are not contained in the current charGroups but are contained in the current domain. This * allows units to search the domain to create further new charGroups at the same level as the current one. If the * domain is totally subdivided into groups, then the method returns null. * * @return ArrayList Contains int[2] pairs marking text in current domain not in current charGroups, or null */ public ArrayList getCharGroupsComplement() { int[] comp = new int[2]; int newListSize; if (domain == null) { newListSize = 100; } else { newListSize = 2 * domain.size(); } ArrayList complement = new ArrayList(newListSize); if (!existCharGroups()) { comp[0] = 0; comp[1] = getText().length() - 1; complement.add(comp); return complement; } ArrayList groups; int domainIndex = 0; int[] dom, cg; int[] delimiters; int j, k, m; if (debug) { if (domain == null) { System.out.println("Document.getCharGroupsComplement: domain pointer is null"); } } for (j = 0; j < domain.size(); j++) { dom = (int[]) domain.get(j); groups = getCharGroups(dom[0], dom[1]); if (groups == null) { delimiters = new int[2]; delimiters[0] = dom[0]; delimiters[1] = dom[1]; complement.add(delimiters); } else { /* First fill an array with all delimiters of the domain * and its contained groups in sequence */ delimiters = new int[2 * groups.size() + 2]; delimiters[0] = dom[0]; m = 1; for (k = 0; k < groups.size(); k++) { cg = (int[]) groups.get(k); delimiters[m++] = cg[0]; delimiters[m++] = cg[1]; } delimiters[m] = dom[1]; // now m is the last index of the delimiters array /* The candidates for ranges in the complement are the * successive index pairs, which indicate whether there * are gaps between groups. If there are no gaps then * eliminate these candidates by setting their index values * to -1. If there are gaps, readjust the delimiters to point * to the first and last elements of the gaps. */ if (delimiters[0] == delimiters[1]) { // if domain opener equals first group element, no gap delimiters[0] = -1; delimiters[1] = -1; } else { delimiters[1] -= 1; } // first gap starts with domain opener, closes before first element of group k = 2; while (k < m - 2) { // if middle pairs differ by one, no gap if (delimiters[k] + 1 == delimiters[k + 1]) { delimiters[k] = -1; delimiters[k + 1] = -1; } else { // for middle pairs, gap starts after last element of one group and ends before first element of the next delimiters[k] += 1; delimiters[k + 1] -= 1; } k += 2; } if (delimiters[m - 1] == delimiters[m]) { // if domain closer equals last group element, no gap delimiters[m - 1] = -1; delimiters[m] = -1; } else { delimiters[m - 1] += 1; } // last gap starts after the last group and ends on the domain closer /* Now scan the delimiter array, skipping over -1's, place * successive pairs into int[2] arrays, and store them into complement. */ k = 0; if (debug) { System.out.println("Document: delimiters array has length " + String.valueOf(delimiters.length) + " and the top value is m = " + String.valueOf(m)); } while (k < m) { if (debug) { System.out.println("Document: complement loop for k = " + String.valueOf(k)); } try { while (delimiters[k] == -1) { k++; } } catch (ArrayIndexOutOfBoundsException ex) { break; } if (k < m) { comp = new int[2]; comp[0] = delimiters[k++]; } while (delimiters[k] == -1) { k++; } comp[1] = delimiters[k++]; complement.add(comp); } } } if (complement.size() == 0) { return null; } return complement; } /** * Sets a new ArrayList into the stack of ArrayLists containing interesting character groups and makes this new one * the current one, making the previous one the domain. * * @param cg the set of integer arrays holding character ranges */ public void addCharGroupsLayer(ArrayList cg) { charGroupStack.add(0, cg); charGroups = cg; if (charGroupStack.size() > 1) { domain = (ArrayList) charGroupStack.get(1); } else { domain = null; } if (debug) { System.out.println("Document.addCharGroupsLayer: added new level, total levels = " + String.valueOf(charGroupStack.size()) + "\nDocument.addCharGroupsLayer: here are the populations of the character group levels: "); } if (debug) { for (int k = 0; k < charGroupStack.size(); k++) { System.out.print(String.valueOf(((ArrayList) charGroupStack.get(k)).size()) + ", "); } } if (debug) { System.out.print("\n"); } if (debug) { if (domain == null) { System.out.println("Document.addCharGroupsLayer: domain pointer is null"); } else { System.out.println("Document.addCharGroupsLayer: domain pointer set to level 1"); } } } /** * Replaces the current ArrayList of interesting character groups with this new one. If there is not layer apart * from the base layer, then this adds a new one. * * @param cg the set of integer arrays holding character ranges */ public void setCharGroups(ArrayList cg) { if (charGroupStack.size() > 1) { charGroupStack.set(0, cg); charGroups = cg; if (debug) { System.out.println("Document.setCharGroups: replaced current character Group. Ttotal levels = " + String.valueOf(charGroupStack.size()) + "\nDocument.setCharGroups: here are the populations of the character group levels: "); } if (debug) { for (int k = 0; k < charGroupStack.size(); k++) { System.out.print(String.valueOf(((ArrayList) charGroupStack.get(k)).size()) + ", "); } } if (debug) { System.out.print("\n"); } } else { if (debug) { System.out.println("Document.setCharGroups: called addCharGroupsLayer"); } addCharGroupsLayer(cg); } if (debug) { if (domain == null) { System.out.println("Document.setCharGroups: domain pointer is null"); } } } /** * Tests whether there are non-trivial character group lists, not just the lowest one, which includes all * characters. * * @return boolean <i>True</i> if there is more than one layer of character group lists */ public boolean existCharGroups() { return ((charGroupStack.size() > 1) && (charGroups.size() > 0)); } /** * Sets a new character group into the ArrayList charGroups. The group is delineated by the given start and end * character positions. It is placed in the ArrayList in the correct place to be in sequence with other character * groups as they appear in the text. If the range overlaps with one or more existing groups, the old groups are * eliminated. This only affects character group pointers; it does not change the document text string at all. * * @param start the integer beginning the range for this group * @param end the integer ending the range for this group */ public void setCharGroup(int start, int end) { if (charGroupStack.size() == 1) { if (debug) { System.out.println("Document.setCharGroup: called addCharGroupsLayer"); } addCharGroupsLayer(new ArrayList(1)); } int[] delim = {start, end}; if (!existCharGroups()) { charGroups.add(delim); return; } int startInGroup = containedInCharGroup(start); int endInGroup = containedInCharGroup(end, startInGroup); if ((startInGroup == endInGroup) && (startInGroup != -1)) { // new group is within a group charGroups.set(startInGroup, delim); } else { int nextOpening = nextCharGroup(start); int nextClosing = nextCharGroup(end); int lastGroupToRemove = (nextClosing == -1) ? charGroups.size() - 1 : nextClosing - 1; if (startInGroup == -1) { // new group starts outside of a group if (endInGroup == -1) { // new group ends outside of a group if (nextOpening == nextClosing) { // no group inside new group if (nextOpening == -1) { charGroups.add(delim); } else { charGroups.add(nextOpening, delim); } // remember that removeCharGroups() shifts groups down } else { // group(s) contained entirely within the new group removeCharGroups(nextOpening, lastGroupToRemove); if (nextOpening == -1) { charGroups.add(delim); } else { charGroups.add(nextOpening, delim); } // remember that removeCharGroups() shifts groups down } } else { // new group starts outside of a group, ends within a group removeCharGroups(nextOpening, endInGroup); if (nextOpening == -1) { charGroups.add(delim); } else { charGroups.add(nextOpening, delim); } // remember that removeCharGroups() shifts groups down } } else { // new group starts within a group if (endInGroup == -1) { // new group starts within a group, ends outside a group removeCharGroups(startInGroup, lastGroupToRemove); if (startInGroup == -1) { charGroups.add(delim); } else { charGroups.add(startInGroup, delim); } // remember that removeCharGroups() shifts groups down } else { // new group starts within a group, ends within a different group removeCharGroups(startInGroup, lastGroupToRemove); if (startInGroup == -1) { charGroups.add(delim); } else { charGroups.add(startInGroup, delim); } // remember that removeCharGroups() shifts groups down } } } } /** * Deletes the entry for the character group denoted by the given index. This only affects character group pointers; * it does not change the document text string at all. * * @param index the index of the character group being deleted */ public void removeCharGroup(int index) { if ((index >= 0) && (index < charGroups.size())) { charGroups.remove(index); } } /** * Deletes the int[2] arrays for all the character groups with index values between the two given values, inclusive. * This only affects character group pointers; it does not change the document text string at all. * * @param start the index of the first character group being deleted * @param finish the index of the final character group being deleted */ public void removeCharGroups(int start, int finish) { int lastGroup = charGroups.size() - 1; if (lastGroup == -1) { return; } if (finish > lastGroup) { finish = lastGroup; } if (start < 0) { return; } // method remove shifts elements to the left, so its argument is not incremented for (int g = start; g <= finish; g++) { charGroups.remove(start); } } /** * Removes the current ArrayList of character groups, sets the next one in the stack equal to the current one, * resets the domain pointer to the next one beyond that. Will not remove the last character group, which spans the * whole document; in this case the method returns null. * * @return ArrayList The removed ArrayList */ public ArrayList deleteCharGroups() { if (charGroupStack.size() == 1) { return null; } ArrayList removed = (ArrayList) charGroupStack.remove(0); if (debug) { System.out.println("Document.deleteCharGroups: deleted current level, total levels now = " + String.valueOf(charGroupStack.size()) + "\nDocument.deleteCharGroups: here are the populations of the character group levels: "); } if (debug) { for (int k = 0; k < charGroupStack.size(); k++) { System.out.print(String.valueOf(((ArrayList) charGroupStack.get(k)).size()) + ", "); } } if (debug) { System.out.print("\n"); } charGroups = (ArrayList) charGroupStack.get(0); if (charGroupStack.size() > 1) { domain = (ArrayList) charGroupStack.get(1); } else { domain = null; } return removed; } /** * Returns the pointer to the domain, which is the set of character groups just above the current set in the list. * The model assumes that the current set are obtained by refinement of the ones pointed to by <i>domain</i>. Thus, * an editing unit creating selections at the current level will search only within selections in the domain. There * is no method to set this pointer. That happens automatically when the stack of character group sets changes. * * @return ArrayList The list referenced by the domain pointer */ public ArrayList getDomain() { return domain; } /** * Adds the given constant <i>shift</i> to the locations of both delimiters of all the character groups above and * including the given character group. This allows resetting of the locations of the character groups after the * document has changed length. This only affects character group pointers; it does not change the document text * string at all. * * @param shift The amount to increment delimiters of character groups * @param firstGroup The index of the first group to be shifted */ public void shiftCharGroups(int shift, int firstGroup) { if (firstGroup < 0) { return; } int[] delims; int size = charGroups.size(); int g = firstGroup; while (g < size) { delims = (int[]) charGroups.get(g); delims[0] += shift; delims[1] += shift; g++; } } /** * Returns the index of the character group containing the given character position, starting the search of * character groups from the given group. If the given character is not contained in a group in the search, returns * -1. * * @param character The index in the document of the character being tested * @param firstGroup The index of the character group at which the search starts * @return The index of the character group containing the character, or -1 if there is none */ public int containedInCharGroup(int character, int firstGroup) { int size = charGroups.size(); int startGroup = (firstGroup < 0) ? 0 : firstGroup; if (size > startGroup) { int g = startGroup; while (character > ((int[]) charGroups.get(g))[1]) { g++; if (g == size) { return -1; } } if (character >= ((int[]) charGroups.get(g))[0]) { return g; } } return -1; } /** * Returns the index of the character group containing the given character position. If the given character is not * contained in a group in the search, returns -1. * * @param character The index in the document of the character being tested * @return The index of the character group containing the character, or -1 if there is none */ public int containedInCharGroup(int character) { return containedInCharGroup(character, 0); } /** * Returns the index of the first character group that starts at or after the given character position, starting the * search of character groups from the given group. If no character group is found in the search, returns -1. If the * given character is in a character group, the index of the next group is returned. * * @param character The index in the document of the character being tested * @param firstGroup The index of the character group at which the search starts * @return The index of the first character group starting after the character, or -1 if there is none */ public int nextCharGroup(int character, int firstGroup) { int size = charGroups.size(); int startGroup = (firstGroup < 0) ? 0 : firstGroup; if (size > startGroup) { int g = startGroup; while (character > ((int[]) charGroups.get(g))[0]) { g++; if (g == size) { return -1; } } return g; } return -1; } /** * Returns the index of the first character group that starts at or after the given character position. If no * character group is found in the search, returns -1. If the given character is in a character group, the index of * the next group is returned. * * @param character The index in the document of the character being tested * @return The index of the first character group starting after the character, or -1 if there is none */ public int nextCharGroup(int character) { return nextCharGroup(character, 0); } /** * Returns the index of the first character group that ends at or before the given character position, starting the * search of character groups backwards from the given group. * <p/> * If no character group is found in the search, returns -1. If the given character is at the end of a character * group, the index of that group is returned. If the given character is in a character group but is not the last * character of the group, the index of the next group before it is returned. * * @param character The index in the document of the character being tested * @param firstGroup The index of the character group at which the search starts * @return int The index of the first character group ending at or before the character, or -1 if there is none */ public int prevCharGroup(int character, int firstGroup) { int size = charGroups.size(); int startGroup = (firstGroup < 0) ? 0 : firstGroup; if (size > startGroup) { int g = startGroup; while (character < ((int[]) charGroups.get(g))[1]) { g--; if (g == -1) { return -1; } } return g; } return -1; } /** * Returns the index of the first character group that ends at or before the given character position. * <p/> * If no character group is found in the search, returns -1. If the given character is at the end of a character * group, the index of that group is returned. If the given character is in a character group but is not the last * character of the group, the index of the next group before it is returned. * * @param character The index in the document of the character being tested * @return int The index of the first character group ending at or before the character, or -1 if there is none */ public int prevCharGroup(int character) { return prevCharGroup(character, charGroups.size() - 1); } /** * Returns the index of the character group in the domain ArrayList which contains the character group of the * current charGroups ArrayList corresponding to the given index. * * @param cg The index of the character group in the current list * @return The index of the character group in the domain list that contains the given group */ public int domainOfCharGroup(int cg) { int character = ((int[]) charGroups.get(cg))[0]; int size = domain.size(); int startGroup = 0; if (size > startGroup) { int g = startGroup; while (character > ((int[]) domain.get(g))[1]) { g++; if (g == size) { return -1; } } if (character >= ((int[]) domain.get(g))[0]) { return g; } } return -1; } /** * Returns the substring defined by the character group of the given index. This does not modify the string or the * character group locations. * * @param group Index of the group to be returned * @return String The substring defined by the group */ public String getGroupString(int group) { int[] delims = getCharGroup(group); if (delims == null) { return null; } return getString(delims[0], delims[1]); } /** * Returns a String containing the character group delimiters for the element of the character group stack denoted * by the given index. The pairs are written all on one line. * * @param k The level in the character group stack to be written * @return The character group delimiters */ public String listCharGroups(int k) { ArrayList cg = (ArrayList) charGroupStack.get(k); int n = cg.size(); StringBuffer list = new StringBuffer(12 * n); int[] delims; for (int g = 0; g < n; g++) { delims = (int[]) cg.get(g); list.append("( ").append(delims[0]).append(", ").append(delims[1]).append(") "); } return list.append(eol).toString(); } /** * Returns a String containing the character group delimiters for the element of the character group stack at the * current level. The pairs are written all on one line. * * @return String The character group delimiters */ public String listCharGroups() { return listCharGroups(0); } /** * Returns a String containing the character group delimiters and their associated group Strings at the level given * by the integer argument. The groups are separated by blank lines. * * @param k The level in the character group stack to be written * @return The character group Strings and delimiters */ public String listGroupStrings(int k) { ArrayList cg = (ArrayList) charGroupStack.get(k); int n = cg.size(); StringBuffer list = new StringBuffer(100 * n); int[] delims; String t = getText(); for (int g = 0; g < n; g++) { delims = (int[]) cg.get(g); list.append("( ").append(delims[0]).append(", ").append(delims[1]).append("): "); list.append(t.substring(delims[0], delims[1] + 1)).append(eol).append(eol); } return list.toString(); } /** * Returns a String containing the character group Strings at the level given by the integer argument. The groups * are separated by blank lines. * * @param k The level in the character group stack to be written * @return The character group Strings */ public String listGroupStringsNoDelims(int k) { ArrayList cg = (ArrayList) charGroupStack.get(k); int n = cg.size(); StringBuffer list = new StringBuffer(100 * n); int[] delims; String t = getText(); for (int g = 0; g < n; g++) { delims = (int[]) cg.get(g); list.append(t.substring(delims[0], delims[1] + 1)).append(eol).append(eol); } return list.toString(); } /** * Returns a String containing the character group delimiters and their associated group Strings at the current * level. The groups are separated by blank lines. * * @return String The character group delimiters */ public String listGroupStrings() { return listGroupStrings(0); } /** * Removes and returns the character string denoted by the given character group index. Readjusts all subsequent * character group locations after the cut so that they point to the same text as before the removal. * * @param index Index of the character group to be cut * @return the string that has been cut */ public String cutGroupString(int index) { int[] delim = (int[]) charGroups.get(index); if (delim == null) { return null; } return cutString(delim[0], delim[1]); } /** * Inserts the given character String at the given character index position and marks it as a character group. * Readjusts all character group locations after the character position, so that they point to the same text as * before the insertion. If the insertion occurs within a character group, that group is eliminated and the * insertion is made into a new character group. If insertion into an existing group is desired, use instead the * method <i>insertString</i>. * * @param insertion The character String to be inserted * @param location Character index of the location of the insertion */ public void insertStringAsCharGroup(String insertion, int location) { int ownGroup = containedInCharGroup(location); if (ownGroup != -1) { removeCharGroup(ownGroup); } insertString(insertion, location); setCharGroup(location, location + insertion.length() - 1); } /** * Replaces the character group with the given index by the given String and returns the String that was removed. * Readjusts all character group locations after the replacement, so that they point to the same text as before. The * character group with the given index is readjusted in size to delimit the new replacement substring. * * @param index Index of the character group to be replaced * @param replacement The string that is to be inserted in place of the cut string * @return The portion of the document that was replaced */ public String replaceGroupString(int index, String replacement) { if ((replacement == null) || (replacement.length() == 0)) { return cutGroupString(index); } if (debug) { System.out.println( "Document.replaceGroupString: replacing group with index " + String.valueOf(index) + " and delims (" + String.valueOf(getCharGroup(index)[0]) + "'" + String.valueOf(getCharGroup(index)[1]) + ")"); } if (debug) { System.out.println( "Document.replaceGroupString: before replacement, list contains the following groups at current level:"); } if (debug) { System.out.println(listCharGroups(0)); } int[] delims = (int[]) charGroups.get(index); String cut = replaceString(delims[0], delims[1], replacement); setCharGroup(delims[0], delims[0] + replacement.length() - 1); if (debug) { System.out.println( "Document.replaceGroupString: after replacement, list contains the following groups at current level:"); } if (debug) { System.out.println(listCharGroups(0)); } return cut; } /** * Returns the filetype <i>i.e.</i> LOCAL (<i>i.e.</i> disk file) or HTTP, (on the internet). See FileName for * definitions of HTTP and LOCAL. * <p/> * If there is no file name attached to this Document then this returns the FileName.INVALID flag. * * @return int the filetype * @see triana.types.FileName */ public int getFileType() { if (fname != null) { return fname.getFileType(); } else { return FileName.INVALID; } } /** * Sets the FileName data object for this Document * * @param fn The full path to the given file */ public void setFile(FileName fn) { fname = fn; } /** * Sets the directory and file name from an input string containing the full path to the file. * * @param pn The full path to the given file */ public void setFile(String pn) { if ((pn == null) || (pn.startsWith("null"))) { return; } if (fname == null) { fname = new FileName(pn); } else { fname.setFile(pn); } } /** * @return int the length of this Document */ public int length() { return getText().length(); } /** * Finds the first occurence of the given String in the Document. It returns the position of the string or -1 if it * is not present. * * @param text The text to search for * @return the first position of the given string within the Document */ public int findNext(String text) { return getText().indexOf(text); } /** * Finds the first occurence of the given String after the given character position in the Document. It returns the * position of the string or -1 if it is not present. * * @param text The text to search for * @param start Index of first character of the search * @return the first position of the given string after start within the Document */ public int findNext(String text, int start) { return getText().indexOf(text, start); } /** * Finds the first occurence of the given String within the given character group in the Document. It returns the * position of the string or -1 if it is not present in the group. * * @param text The text to search for * @param group Index of character group of the search * @return the first position of the given string after start within the Document */ public int findNextInGroup(String text, int group) { int[] groupDelim = getCharGroup(group); int beginning = groupDelim[0]; int end = groupDelim[1] + 1; int location = getText().substring(beginning, end).indexOf(text); return (location == -1) ? -1 : location + beginning; } /** * Finds the first occurence of the given String within the given character group after the given location in the * Document. It returns the position of the string or -1 if it is not present in the group after the given location. * If the index start is not within the group, the method returns -2. * * @param text The text to search for * @param group Index of character group of the search * @param start Index of the first character of the search * @return the first position of the given string after start within the Document */ public int findNextInGroup(String text, int group, int start) { int[] groupDelim = getCharGroup(group); int beginning = groupDelim[0]; int end = groupDelim[1] + 1; if ((start < beginning) || (start >= end)) { return -2; } start -= beginning; int location = getText().substring(beginning, end).indexOf(text, start); return (location == -1) ? -1 : location + beginning; } /** * Removes the first occurence of the given String from the Document. It returns the position of the string or -1 if * it is not present. * * @param text The text to search for * @return the first position of the given string within the Document */ public int remove(String text) { int pos = findNext(text); if (pos == -1) { return pos; } cutString(pos, pos + text.length() - 1); return pos; } /** * Removes the first occurence of the given String after the given character location in the Document. It returns * the position of the string or -1 if it is not present. * * @param text The text to search for * @return the first position of the given string within the Document */ public int remove(String text, int start) { int pos = findNext(text, start); if (pos == -1) { return pos; } cutString(pos, pos + text.length() - 1); return pos; } /** * Finds the first occurence of the given String <i>text</i> in the Document and replaces it with the given String * <i>newText</i>. Returns -1 if the Document does not contain text. * * @param text The text to search for * @param newText The text to insert in place of text * @return the first position of the text within the Document */ public int replaceNext(String text, String newText) { int pos = findNext(text); if (pos == -1) { return pos; } replaceString(pos, pos + text.length() - 1, newText); return pos; } /** * Finds the first occurence of the given String <i>text</i> after the given character location in the Document and * replaces it with the given String <i>newText</i>. Returns -1 if the Document does not contain text. * * @param text The text to search for * @param newText The text to insert in place of text * @return the first position of the text within the Document */ public int replaceNext(String text, String newText, int start) { int pos = findNext(text, start); if (pos == -1) { return pos; } replaceString(pos, pos + text.length() - 1, newText); return pos; } /** * Replaces all occurences of the given String <i>text</i> with the given String <i>newText</i>. * * @param text The text to search for * @param newText The text to insert in place of text * @return int The number of replacements that were made */ public int replaceAll(String text, String newText) { int count = 0; int start = 0; while ((start = replaceNext(text, newText, start)) != -1) { ++count; } return count; } /** * Returns <i>true</i> if the specified object doc is the same type and has the same contents as this object, * including the path name and file name. Does not test character group pointers or line number lists. * * @return Boolean <i>true</i> if the argument is a Document with the same contents as this Document */ public boolean equals(Object doc) { if (!(doc instanceof Document)) { return false; } Document d = (Document) doc; if (!getText().equals(d.getText())) { return false; } if (fname != null) { if (!fname.equals(d.getFile())) { return false; } } return true; } /** * This is one of the most important methods of Triana data. types. It returns a copy of the type invoking it. This * <b>must</b> be overridden for every derived data type derived. If not, the data cannot be copied to be given to * other units. Copying must be done by value, not by reference. </p><p> To override, the programmer should not * invoke the <i>super.copyMe</i> method. Instead, create an object of the current type and call methods * <i>copyData</i> and <i>copyParameters</i>. If these have been written correctly, then they will do the copying. * The code should createTool, for type YourType: <PRE> YourType y = null; try { y = * (YourType)getClass().newInstance(); y.copyData( this ); y.copyParameters( this ); y.setLegend( this.getLegend() * ); } catch (IllegalAccessException ee) { System.out.println("Illegal Access: " + ee.getMessage()); } catch * (InstantiationException ee) { System.out.println("Couldn't be instantiated: " + ee.getMessage()); } return y; * </PRE> </p><p> The copied object's data should be identical to the original. The method here modifies only one * item: a String indicating that the object was created as a copy is added to the <i>description</i> StringVector. * * @return TrianaType Copy by value of the current Object except for an updated <i>description</i> */ public TrianaType copyMe() { Document d = null; try { d = (Document) getClass().newInstance(); d.copyData(this); d.copyParameters(this); } catch (IllegalAccessException ee) { System.out.println("Illegal Access: " + ee.getMessage()); } catch (InstantiationException ee) { System.out.println("Couldn't be instantiated: " + ee.getMessage()); } return d; } /** * Copies the Document by value from the given source, not by reference. * * @param source The Document object being copied */ public void copyData(TrianaType source) { setText(Str.copy(((Document) source).getText())); } /** * Copies modifiable parameters from the given source. * * @param source The Document object being copied */ public void copyParameters(TrianaType source) { super.copyParameters(source); if (((Document) source).getFileRef() != null) { setFile((FileName) (((Document) source).getFileRef().copyMe())); } if (((Document) source).isLineNumber()) { int[] lines = ((Document) source).getLineNumbers(); int[] newlines = new int[lines.length]; for (int i = 0; i < lines.length; ++i) { newlines[i] = lines[i]; } setLineNumbers(newlines); } ArrayList stack = ((Document) source).getCharGroupStack(); if (stack.size() > 1) { // if only one element in stack, it is the base group set up when the text was set in CopyData() ArrayList groups, newgroups; int[] delims, newdelims; int k, g; for (k = stack.size() - 2; k >= 0; k--) { // go backwards through stack to use addCharGroupsLayer to construct new stack groups = (ArrayList) stack.get(k); newgroups = new ArrayList(groups.size()); for (g = 0; g < groups.size(); ++g) { delims = (int[]) groups.get(g); newdelims = new int[2]; newdelims[0] = delims[0]; newdelims[1] = delims[1]; newgroups.add(newdelims); } addCharGroupsLayer(newgroups); } } } /** * Used when Triana types want to be able to send ASCII data to other programs using strings. This is used to * implement socket and to run other executables, written in C or other languages. With ASCII you don't have to * worry about ENDIAN'ness as the conversions are all done via text. This is obviously slower than binary * communication since you have to format the input and output within the other program. </p><p> This method must be * overridden in every subclass that defines new data or parameters. The overriding method should first call<<PRE> * super.outputToStream(dos) </PRE>to get output from superior classes, and then new parameters defined for the * current subclass must be output. Moreover, subclasses that first dimension their data arrays must explicitly * transfer these data arrays. * * @param dos The data output stream */ public void outputToStream(PrintWriter dos) throws IOException { dos.println(this.getFile()); if (isLineNumber()) { dos.println("Line numbers marked:"); dos.println(lineNos.length); dos.println(listLineNumbers()); } else { dos.println("No line numbers marked."); } dos.println(charGroupStack.size()); for (int k = 0; k < charGroupStack.size(); k++) { ArrayList cg = (ArrayList) charGroupStack.get(k); dos.println(k); dos.println(cg.size()); dos.println(listCharGroups(k)); } dos.println(this.getText().length()); dos.println(this.getText()); } /** * Used when Triana types want to be able to receive ASCII data from the output of other programs. This is used to * implement socket and to run other executables, written in C or other languages. With ASCII you don't have to * worry about ENDIAN'ness as the conversions are all done via text. This is obviously slower than binary * communication since you have to format the input and output within the other program. </p><p> This method must be * overridden in every subclass that defines new data or parameters. The overriding method should first call<PRE> * super.inputFromStream(dis) </PRE>to get input from superior classes, and then new parameters defined for the * current subclass must be input. Moreover, subclasses that first dimension their data arrays must explicitly * transfer these data arrays. * * @param dis The data input stream */ public void inputFromStream(BufferedReader dis) throws IOException { String line; setFile(dis.readLine()); if (dis.readLine().equals("Line numbers marked:")) { int lines = Str.strToInt(dis.readLine()); int[] lineNums = new int[lines]; for (int i = 0; i < lineNums.length; ++i) { lineNums[i] = Str.strToInt(dis.readLine()); } setLineNumbers(lineNums); } int stackLength = Str.strToInt(dis.readLine()); for (int k = 0; k < stackLength; k++) { int groups = Str.strToInt(dis.readLine()); int[] delims; String gp, nm; int s, e; ArrayList cG = new ArrayList(groups); for (int g = 0; g < groups; ++g) { gp = dis.readLine(); delims = new int[2]; s = gp.indexOf("("); e = gp.indexOf(","); nm = gp.substring(s, e).trim(); delims[0] = Integer.parseInt(nm); s = e + 1; e = gp.indexOf(")"); nm = gp.substring(s, e).trim(); delims[1] = Integer.parseInt(nm); cG.add(delims); } charGroupStack.set(k, cG); } int chars = Str.strToInt(dis.readLine()); StringBuffer doc = new StringBuffer(chars); while ((line = dis.readLine()) != null) { doc.append(line).append(eol); } setText(doc.toString()); } /** * Used to make the new types derived from TrianaType backward-compatible with older types. It must be called by any * method that modifies data in <i>dataContainer</i> or in any other variable that replaces a storage location used * previously by any type. It must be implemented (over-ridden) in any type that re-defines storage or access * methods to any variable. The implementation should assign the new variables to the obsolete ones, and ensure that * obsolete access methods retrieve data from the new locations. Any over-riding method should finish with the * line<PRE> super.updateObsoletePointers; </PRE> */ protected void updateObsoletePointers() { super.updateObsoletePointers(); } /** * Provides the toString method for completeness. Synonym for getText. * * @return String the contents of this Document */ public String toString() { return getText(); } }
[ "doctor.zob@gmail.com" ]
doctor.zob@gmail.com
d2acfbc79016b9dd25eb4a4ce93d9fca53ded6e7
a8bd8519a3870162ab99fcf8ad2fc3f919d3be60
/videos-api/src/main/java/com/video/controller/UserCRUDController.java
24b34a9e28498def75cca33ef91af62425d489fc
[]
no_license
unluckygod/WchatVideo-dev
219b4899afcbf6fa8134aa0ad10c650b224cb6f7
6f48e6d210304817b5112d740cc2cf3a6fb3103d
refs/heads/master
2020-12-08T18:56:25.304136
2019-05-17T06:25:47
2019-05-17T06:25:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,349
java
package com.video.controller; import com.video.pojo.Users; import com.video.crud.UserCRUDService; import com.video.utils.KJSONResult; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController @RequestMapping("/crud") public class UserCRUDController { @Resource private UserCRUDService userCRUDService; @RequestMapping("/save") public KJSONResult save() { Users user = new Users("1001", "test-saveuser-1001", "123456", "/path", "慕课网", null, null, null); userCRUDService.saveUser(user); return KJSONResult.ok(); } @RequestMapping("/update") public KJSONResult update() { Users user = new Users("1001", "test-saveuser-1111", "77777", "/path000", "慕课网好牛~", null, null, null); userCRUDService.updateUser(user); return KJSONResult.ok(); } @RequestMapping("/update2") public KJSONResult update2() { Users user = new Users("1001", null, "9999", "/path000999", "慕课网好牛十分牛~", null, null, null); userCRUDService.updateUser(user); return KJSONResult.ok(); } @RequestMapping("/delUser") public KJSONResult delUser() { userCRUDService.delete(); return KJSONResult.ok(); } }
[ "872978036@qq.com" ]
872978036@qq.com
0da81ac7aedd928df571c517c79cabc72e05571d
c6e59b4f5d6f842769c469b215e88b046b50331f
/src/main/java/example/strategypattern/strategies/api/Parser.java
153e9e9465a446f43e2e6635b6bf188fb0242069
[]
no_license
sventrap/StrategyPattern
1959aeb2c4403b48769f7449710e1845b0b47f7c
78546d295284dba270139cea64abc8ca91f30f4b
refs/heads/master
2021-05-01T23:27:05.210602
2018-02-09T17:31:43
2018-02-09T17:31:43
120,933,932
0
0
null
null
null
null
UTF-8
Java
false
false
111
java
package example.strategypattern.strategies.api; public interface Parser { public String parse(String pnr); }
[ "36009062+sventrap@users.noreply.github.com" ]
36009062+sventrap@users.noreply.github.com
7d26d417e450c377538cc5af0745bb6d3466dedc
556cd815c4b2c2a80830748c1edaa359ae5466ec
/cloud-providerconsul-payment8006/src/main/java/com/hao/springcloud/controller/PaymentController.java
c5f837513e715948752898b0d7b867f912e0a930
[]
no_license
GengTianHa0/cloud2020
0b4f9f8043cdc19409ced179a2ef4819c264f0db
1c094e830ed25895d30a4760c287e87c31bc88d0
refs/heads/master
2023-03-08T08:30:56.271210
2021-02-22T05:04:37
2021-02-22T05:04:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
583
java
package com.hao.springcloud.controller; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.UUID; @RestController @Slf4j public class PaymentController { @Value("${server.port}") private String serverPort; @RequestMapping(value = "/payment/consul") public String paymentconsul(){ return "springcloud with consul:"+serverPort+"\t"+ UUID.randomUUID().toString(); } }
[ "1240129167@qq.com" ]
1240129167@qq.com
a26c52db6151e8f96083c5c5f1557be1e4845b74
f584170a01e154a49ebb9658d5b1b926dae475a1
/WorldWeather/app/src/main/java/com/haringeymobile/ukweather/weather/WeatherInfoFragment.java
54fafdc7660e7edc9ba31cd26353c4795fa63453
[ "Apache-2.0" ]
permissive
1000D-TH/World-Weather
d678acba521436b1c7550b2aeb9e93036416cd92
95630e10bb86d1f95be3bc7a2b7dea0cfe5e7d7f
refs/heads/master
2021-05-17T02:05:46.427733
2020-04-07T09:30:21
2020-04-07T09:30:21
250,568,893
0
0
Apache-2.0
2020-03-27T15:20:12
2020-03-27T15:20:11
null
UTF-8
Java
false
false
7,559
java
package com.haringeymobile.ukweather.weather; import android.content.Context; import android.graphics.Bitmap; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.util.LruCache; import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.haringeymobile.ukweather.R; import com.haringeymobile.ukweather.data.objects.WeatherInformation; import com.haringeymobile.ukweather.weather.WeatherInfoType.IllegalWeatherInfoTypeArgumentException; import java.util.Date; /** * A fragment displaying a common weather information. */ public abstract class WeatherInfoFragment extends Fragment { public interface IconCacheRequestListener { /** * Obtains the memory cache storing weather icon bitmaps. */ LruCache<String, Bitmap> getIconMemoryCache(); } public static final String JSON_STRING = "json string"; protected static final String CITY_NAME = "city name"; protected TextView extraInfoTextView; protected TextView conditionsTextView; protected ImageView conditionsImageView; protected TextView temperatureTextView; protected TextView pressureTextView; protected TextView humidityTextView; protected TextView windTextView; private IconCacheRequestListener iconCacheRequestListener; protected WeatherInformationDisplayer weatherInformationDisplayer; /** * Creates and sets the required weather information fragment. * * @param weatherInfoType requested weather information type * @param cityName the name of the city for which the weather information was * requested and obtained * @param jsonString JSON weather information data in textual form * @return a fragment to display the requested weather information */ public static WeatherInfoFragment newInstance(WeatherInfoType weatherInfoType, String cityName, String jsonString) { WeatherInfoFragment weatherInfoFragment = createWeatherInfoFragment(weatherInfoType); Bundle args = getArgumentBundle(cityName, jsonString); weatherInfoFragment.setArguments(args); return weatherInfoFragment; } /** * Creates a fragment, corresponding to the requested weather information type. * * @param weatherInfoType requested weather information type * @return a correct type of weather information fragment */ private static WeatherInfoFragment createWeatherInfoFragment(WeatherInfoType weatherInfoType) { switch (weatherInfoType) { case CURRENT_WEATHER: return new WeatherCurrentInfoFragment(); case DAILY_WEATHER_FORECAST: return new WeatherDailyWeatherForecastChildFragment(); case THREE_HOURLY_WEATHER_FORECAST: return new WeatherThreeHourlyForecastChildSwipeFragment(); default: throw new IllegalWeatherInfoTypeArgumentException(weatherInfoType); } } /** * Obtains a bundle with the arguments, to be used to instantiate a new weather information * fragment. * * @param cityName the name of the city for which the weather information was requested and * obtained * @param jsonString JSON weather information data in textual form * @return an argument bundle */ private static Bundle getArgumentBundle(String cityName, String jsonString) { Bundle args = new Bundle(); args.putString(CITY_NAME, cityName); args.putString(JSON_STRING, jsonString); return args; } @Override public void onAttach(Context context) { super.onAttach(context); iconCacheRequestListener = (IconCacheRequestListener) context; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); weatherInformationDisplayer = new WeatherInformationDisplayer(getContext(), iconCacheRequestListener.getIconMemoryCache()); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_common_weather_info, container, false); getCommonViews(view); return view; } /** * Obtain the text and image views to be displayed in all types of weather information * fragments. * * @param view the root view for the fragment */ protected void getCommonViews(View view) { extraInfoTextView = (TextView) view.findViewById(R.id.city_extra_info_text_view); conditionsTextView = (TextView) view.findViewById(R.id.weather_conditions_text_view); conditionsImageView = (ImageView) view.findViewById(R.id.weather_conditions_image_view); temperatureTextView = (TextView) view.findViewById(R.id.temperature_text_view); pressureTextView = (TextView) view.findViewById(R.id.atmospheric_pressure_text_view); humidityTextView = (TextView) view.findViewById(R.id.humidity_text_view); windTextView = (TextView) view.findViewById(R.id.wind_text_view); } /** * Displays the specified weather information on the screen. * * @param weatherInformation various parameters describing weather */ public void displayWeather(WeatherInformation weatherInformation) { displayExtraInfo(weatherInformation); displayConditions(weatherInformation); displayWeatherNumericParametersText(weatherInformation); displayWindInfo(weatherInformation); } /** * Displays specific details, depending on the requested weather information type - typically, * a city name, and, if applicable, the date and time information. * * @param weatherInformation various parameters describing weather */ protected abstract void displayExtraInfo(WeatherInformation weatherInformation); /** * Describes and illustrates the weather. * * @param weatherInformation various parameters describing weather */ private void displayConditions(WeatherInformation weatherInformation) { weatherInformationDisplayer.displayConditions(weatherInformation, conditionsTextView, conditionsImageView); } /** * Displays weather temperature, pressure, and humidity. * * @param weatherInformation various parameters describing weather */ private void displayWeatherNumericParametersText(WeatherInformation weatherInformation) { weatherInformationDisplayer.displayWeatherNumericParametersText(weatherInformation, temperatureTextView, pressureTextView, humidityTextView); } /** * Displays wind speed and direction. * * @param weatherInformation various parameters describing weather */ private void displayWindInfo(WeatherInformation weatherInformation) { weatherInformationDisplayer.displayWindInfo(weatherInformation, windTextView); } protected String getDateString(Context context, Date date) { return DateFormat.getMediumDateFormat(context).format(date); } protected String getTimeString(Context context, Date date) { return DateFormat.getTimeFormat(context).format(date); } }
[ "haringeymobile@gmail.com" ]
haringeymobile@gmail.com
144d8a54acc45550c09c6936d237a09c1e942975
15a960e6d01adfdacea471d2821647bcf0e321b0
/metro-share/src/main/java/io/naraplatform/share/domain/file/FileSizeUnit.java
1b4653ea0ada3be2751020a0a3fd2e54682d5f88
[]
no_license
norimsu/tiny-metro
6fa2ea121ba465f075f085150b74a249c4824f11
658c25b77dd569443f0ddb3e16777a7c3693d94e
refs/heads/master
2020-10-01T11:04:06.824081
2018-05-11T05:22:15
2018-05-11T05:22:15
227,522,344
1
0
null
2019-12-12T04:47:35
2019-12-12T04:47:34
null
UTF-8
Java
false
false
358
java
package io.naraplatform.share.domain.file; public enum FileSizeUnit { // GB("GigaByte"), MB("MegaByte"), KB("KiloByte"), Byte("Byte"); private String fullName; private FileSizeUnit(String fullName) { // this.fullName = fullName; } public String fullName() { // return fullName; } }
[ "tsong@nextree.co.kr" ]
tsong@nextree.co.kr
e33f08770b1192fc361b5c5e50a7077abbb02c83
fb2cfb33f5056d57aae266c217c2b95b8363d161
/src/utils/FileParser.java
e09a5227976ea899acc9425dddd08b914122720e
[]
no_license
anuragreddy599/SE3-1
528800dd016d69b0068e27b71acb5bc95b0c105c
cf65daf359707985e03f68687b72460761a18f88
refs/heads/master
2020-12-24T10:11:02.035237
2016-07-07T04:01:00
2016-07-07T04:01:00
60,566,979
0
0
null
2016-07-07T17:30:13
2016-06-06T23:17:30
Java
UTF-8
Java
false
false
4,947
java
package utils; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import registers.CourseRegister; import registers.DegreeRegister; import registers.DegreeReqsRegister; import registers.FacultyRegister; import registers.GradSchoolRegister; import registers.SemesterRegister; import registers.StudentCourseRegister; import registers.StudentRegister; import registers.UniversityRegister; import com.opencsv.CSVReader; import registers.DegreePlanReqsRegister; public class FileParser { //private static FileParser fileParser = null; public FileParser() { } public List<String[]> parse(String url) throws IOException{ String csvFilename = url; CSVReader csvReader = new CSVReader(new FileReader(csvFilename)); List<String[]> content; content = csvReader.readAll(); csvReader.close(); return content; } public int saveUniversityInfo(List<String[]> content){ String uni[] = content.get(1); UniversityRegister uniReg=UniversityRegister.getInstance(); uniReg.addUniversity(uni[0], uni[1]); return 1; } public int saveGradSchoolInfo(List<String[]> content){ String gradSchool[] = content.get(1); GradSchoolRegister gradSchoolReg=GradSchoolRegister.getInstance(); gradSchoolReg.addGradSchool(gradSchool[1], gradSchool[0]); return 1; } public int saveSemestersInfo(List<String[]> content){ content.remove(0); int counter=0; for(String[] row:content){ SemesterRegister semReg=SemesterRegister.getInstance(); semReg.addSemester(row[0], row[1], row[2]); counter=counter+1; } return counter; } public int saveDegrees(List<String[]> content){ content.remove(0); int counter=0; for(String[] row:content){ DegreeRegister degreeReg=DegreeRegister.getInstance(); degreeReg.addDegree(row[0], row[1], row[2],row[3]); counter=counter+1; } return counter; } public int saveCourseInfo(List<String[]> content){ content.remove(0); int counter=0; for(String[] row:content){ //ArrayList<String> preReqs=convertToList(row[8].split(",")); //ArrayList<String> teachers=convertToList(row[9].split(",")); CourseRegister courseReg=CourseRegister.getInstance(); courseReg.addCourse(row[0], row[1], row[2],row[3],row[4],row[5],row[6], row[7],row[8],row[9]); counter=counter+1; } return counter; } public int saveFacultyInfo(List<String[]> content){ content.remove(0); int counter=0; for(String[] row:content){ FacultyRegister facultyReg=FacultyRegister.getInstance(); facultyReg.addFaculty(row[0], row[1], row[2],row[3],row[4],row[5],row[6], row[7],row[8]); counter=counter+1; } return counter; } public int saveStudentsInfo(List<String[]> content){ int counter=0; for(String[] row:content){ if(!(row[1].equalsIgnoreCase("MSE.ECE"))){ if(!(row[1].equalsIgnoreCase("MSE.ENGMGT"))){ StudentRegister studentReg=StudentRegister.getInstance(); studentReg.addStudent(row[0], row[1], row[2]); counter=counter+1; } } } return counter; } public int saveStudentCourseInfo(List<String[]> content){ int counter=0; for(String[] row:content){ if(CourseRegister.getInstance().getCourse(row[1])!=null){ StudentCourseRegister studentCourseReg=StudentCourseRegister.getInstance(); studentCourseReg.addStudentCourse(row[0], row[1], row[2],row[3],row[4]); counter=counter+1; } } return counter; } public void saveDegreeReqs(List<String[]> content){ content.remove(0); for(int i=0;i<content.size();i=i+3){ String row[]=content.get(i); String code=row[0]; String requiredHours=row[2]; ArrayList<String> requiredCourses=convertToList(row[4].split(",")); row=content.get(i+1); String electives1Hours=row[2]; ArrayList<String> electives1Courses=convertToList(row[4].split(",")); row=content.get(i+2); String electives2Hours=row[2]; ArrayList<String> electives2Courses=convertToList(row[4].split(",")); DegreeReqsRegister degreeReqsReg=DegreeReqsRegister.getInstance(); degreeReqsReg.addDegreeReqs(code, requiredHours, electives1Hours, electives2Hours, requiredCourses, electives1Courses, electives2Courses); } } private ArrayList<String> convertToList(String[] arr){ ArrayList<String> list=new ArrayList<String>(); if(arr!=null){ for(int i=0;i<arr.length;i++){ list.add(arr[i]); } return list; } else{ return null; } } public int saveDegreePlanReq(List<String[]> content){ content.remove(0); int counter=0; for(String[] row:content){ DegreePlanReqsRegister degPlanReg=DegreePlanReqsRegister.getInstance(); degPlanReg.addDegreePlanReqs(row[0], row[1], row[2],row[3],row[4]); counter=counter+1; } return counter; } }
[ "anurag.nimmala@eagles.oc.edu" ]
anurag.nimmala@eagles.oc.edu
76aeef37d345f02c0ea43024cd38a9a6cdcdc4b0
077ad1330f77172a59c7e7621c72bb653d9ff40a
/generator/src/test/java/com/graphicsfuzz/generator/semanticschanging/Expr2ArrayAccessMutationFinderTest.java
c31bcb86dac707d8fba2ba981d71e93a6441c5a6
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
google/graphicsfuzz
48e82803e0354c4a92dc913fe36b8f6bae2eaa11
aa32d4cb556647ddaaf2048815bd6bca07d1bdab
refs/heads/master
2023-08-22T18:28:49.278862
2022-03-10T09:08:51
2022-03-10T09:08:51
150,133,859
573
155
Apache-2.0
2023-09-06T18:14:58
2018-09-24T16:31:05
Java
UTF-8
Java
false
false
1,355
java
/* * Copyright 2019 The GraphicsFuzz Project 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 * * https://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.graphicsfuzz.generator.semanticschanging; import static org.junit.Assert.assertEquals; import com.graphicsfuzz.common.ast.TranslationUnit; import com.graphicsfuzz.common.util.ParseHelper; import com.graphicsfuzz.common.util.RandomWrapper; import org.junit.Test; public class Expr2ArrayAccessMutationFinderTest { @Test public void checkArraysFound() throws Exception { final String program = "#version 300 es\n" + "float input[10];" + "void main() {" + " float f;" + " f;" + "}"; final TranslationUnit tu = ParseHelper.parse(program); assertEquals(1, new Expr2ArrayAccessMutationFinder(tu, new RandomWrapper(0)).findMutations().size()); } }
[ "paulthomson@users.noreply.github.com" ]
paulthomson@users.noreply.github.com
7265afe4e027a03c9328d7bd9ebdd140d15bd89b
04d2e0d158bdbdbf9269b3093c49949edc86c5c5
/h2database-read-only/h2/src/main/org/h2/command/ddl/.svn/text-base/DropView.java.svn-base
dc2175f25a984b9994480f949814ebd16936c923
[]
no_license
nbronson/pepe
ce5497ccc31f3582050e1b0c20f9236ca716b5ab
d033a1b2da6654167ac806234e4ab4f8f2a9e904
refs/heads/master
2023-08-24T13:50:28.760320
2010-07-03T21:01:34
2010-07-03T21:01:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,099
/* * Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, * Version 1.0, and under the Eclipse Public License, Version 1.0 * (http://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.command.ddl; import org.h2.constant.ErrorCode; import org.h2.constraint.ConstraintReferential; import org.h2.engine.DbObject; import org.h2.engine.Right; import org.h2.engine.Session; import org.h2.message.DbException; import org.h2.schema.Schema; import org.h2.table.Table; import org.h2.table.TableView; /** * This class represents the statement * DROP VIEW */ public class DropView extends SchemaCommand { private String viewName; private boolean ifExists; private int dropAction = ConstraintReferential.CASCADE; public DropView(Session session, Schema schema) { super(session, schema); } public void setIfExists(boolean b) { ifExists = b; } public void setDropAction(int dropAction) { this.dropAction = dropAction; } public void setViewName(String viewName) { this.viewName = viewName; } public int update() { session.commit(true); Table view = getSchema().findTableOrView(session, viewName); if (view == null) { if (!ifExists) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } } else { if (!Table.VIEW.equals(view.getTableType())) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } session.getUser().checkRight(view, Right.ALL); if (dropAction == ConstraintReferential.RESTRICT) { for (DbObject child : view.getChildren()) { if (child instanceof TableView) { throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName()); } } } view.lock(session, true, true); session.getDatabase().removeSchemaObject(session, view); } return 0; } }
[ "jtamayo@cs.stanford.edu" ]
jtamayo@cs.stanford.edu
1826871d9cbe47f7db6c62c9cd5405dacd476437
5401175ad1405c8f80202cf19b6be91b94dab847
/HelloWorld/GenericTest/src/com/george/testGenerics/BoxDriver.java
9ca9e1fcec0eff22bf73db17b5eafe0cbd93e9e8
[]
no_license
GOrbel01/ExtraStuff
1c411560ce212fe317161df3352d6b17bad71b3e
653b54f883bc0af6f3e33e49f9b9407a82760382
refs/heads/master
2020-05-17T18:40:22.955560
2015-06-08T22:16:39
2015-06-08T22:16:39
25,179,986
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package com.george.testGenerics; /** * Created by Cloud on 01/12/2014. */ public class BoxDriver { public static void main(String[] args) { Box<? extends Number> numBox = new Box<Integer>(31); } }
[ "georgeOJava@gmail.com" ]
georgeOJava@gmail.com
5167c6c60c972faf1a51e5122d542f1ee1b2f8e8
ad55c1d2ed6c5791abcba00ff4a43bbe6afa3cbf
/admin/src/main/java/cn/swallowff/admin/listener/CustomApplicationListener.java
9b5bd29c1962cccf4c8adceb7c4e3d0f0a95c445
[]
no_license
swallowff/swear
47fe5b3cc4d0774353b298ac20bdaab7c404a701
ea4fcdfaf5f77a25cfe51ba111cc5dbd07cd272b
refs/heads/master
2022-06-04T08:31:18.194269
2019-11-04T12:31:14
2019-11-04T12:31:14
188,686,732
0
0
null
2022-05-20T21:14:09
2019-05-26T13:31:19
JavaScript
UTF-8
Java
false
false
1,527
java
package cn.swallowff.admin.listener; import cn.swallowff.admin.components.chat.ChatUserService; import cn.swallowff.admin.config.properties.SwearEnvProperties; import cn.swallowff.admin.util.SpringContextHolder; import cn.swallowff.modules.chat.core.SwearMsgHandler; import cn.swallowff.modules.chat.core.SwearSocketServerStarter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; /** * @author Administrator * @description * @create 2019/7/20 */ @Component public class CustomApplicationListener implements ApplicationListener<ApplicationReadyEvent> { @Autowired private SwearEnvProperties swearEnvProperties; @Override public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { //do something when spring application started //TODO 启动nio聊天服务 if (swearEnvProperties.isWebsocketOpen()){ SwearMsgHandler swearMsgHandler = SwearMsgHandler.me; swearMsgHandler.registerUserService(SpringContextHolder.getBean(ChatUserService.class)); try { SwearSocketServerStarter serverStarter = new SwearSocketServerStarter(swearEnvProperties.getWebsocketPort(),swearMsgHandler); serverStarter.doStart(); } catch (Exception e) { e.printStackTrace(); } } } }
[ "552395285@qq.com" ]
552395285@qq.com
5e9bee9bfa9a137e38071527e7cf35213004be0e
cd345c94ab891609c48a5aced06b5918bb3944b8
/app/build/generated/not_namespaced_r_class_sources/pocDebug/processPocDebugResources/r/com/google/firebase/remoteconfig/R.java
4a87da8610246814ea11171616285714927fc12f
[]
no_license
ewertonrichieri/SicrediNewSesame-V3-SEM_LOGO-Client
262b7c57c08795597f0d44add8099eb0abd3a40e
7fbbcdfc92aff2adaeace16afa0dff25749b1bc1
refs/heads/master
2023-01-05T03:15:38.234725
2020-08-11T18:46:02
2020-08-11T18:46:02
286,821,821
0
0
null
2020-11-06T17:20:54
2020-08-11T18:41:10
Java
UTF-8
Java
false
false
15,597
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package com.google.firebase.remoteconfig; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f03002a; public static final int coordinatorLayoutStyle = 0x7f0300fc; public static final int font = 0x7f03012f; public static final int fontProviderAuthority = 0x7f030132; public static final int fontProviderCerts = 0x7f030133; public static final int fontProviderFetchStrategy = 0x7f030134; public static final int fontProviderFetchTimeout = 0x7f030135; public static final int fontProviderPackage = 0x7f030136; public static final int fontProviderQuery = 0x7f030137; public static final int fontStyle = 0x7f030138; public static final int fontVariationSettings = 0x7f030139; public static final int fontWeight = 0x7f03013a; public static final int keylines = 0x7f030168; public static final int layout_anchor = 0x7f03016d; public static final int layout_anchorGravity = 0x7f03016e; public static final int layout_behavior = 0x7f03016f; public static final int layout_dodgeInsetEdges = 0x7f03019b; public static final int layout_insetEdge = 0x7f0301a7; public static final int layout_keyline = 0x7f0301a8; public static final int statusBarBackground = 0x7f030213; public static final int ttcIndex = 0x7f030275; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f050093; public static final int notification_icon_bg_color = 0x7f050094; public static final int ripple_material_light = 0x7f0500a9; public static final int secondary_text_default_material_light = 0x7f0500ab; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f06004e; public static final int compat_button_inset_vertical_material = 0x7f06004f; public static final int compat_button_padding_horizontal_material = 0x7f060050; public static final int compat_button_padding_vertical_material = 0x7f060051; public static final int compat_control_corner_material = 0x7f060052; public static final int compat_notification_large_icon_max_height = 0x7f060053; public static final int compat_notification_large_icon_max_width = 0x7f060054; public static final int notification_action_icon_size = 0x7f0600c0; public static final int notification_action_text_size = 0x7f0600c1; public static final int notification_big_circle_margin = 0x7f0600c2; public static final int notification_content_margin_start = 0x7f0600c3; public static final int notification_large_icon_height = 0x7f0600c4; public static final int notification_large_icon_width = 0x7f0600c5; public static final int notification_main_column_padding_top = 0x7f0600c6; public static final int notification_media_narrow_margin = 0x7f0600c7; public static final int notification_right_icon_size = 0x7f0600c8; public static final int notification_right_side_padding_top = 0x7f0600c9; public static final int notification_small_icon_background_padding = 0x7f0600ca; public static final int notification_small_icon_size_as_large = 0x7f0600cb; public static final int notification_subtext_size = 0x7f0600cc; public static final int notification_top_pad = 0x7f0600cd; public static final int notification_top_pad_large_text = 0x7f0600ce; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f0700bd; public static final int notification_bg = 0x7f0700be; public static final int notification_bg_low = 0x7f0700bf; public static final int notification_bg_low_normal = 0x7f0700c0; public static final int notification_bg_low_pressed = 0x7f0700c1; public static final int notification_bg_normal = 0x7f0700c2; public static final int notification_bg_normal_pressed = 0x7f0700c3; public static final int notification_icon_background = 0x7f0700c4; public static final int notification_template_icon_bg = 0x7f0700c5; public static final int notification_template_icon_low_bg = 0x7f0700c6; public static final int notification_tile_bg = 0x7f0700c7; public static final int notify_panel_notification_icon_bg = 0x7f0700c8; } public static final class id { private id() {} public static final int accessibility_action_clickable_span = 0x7f090015; public static final int accessibility_custom_action_0 = 0x7f090016; public static final int accessibility_custom_action_1 = 0x7f090017; public static final int accessibility_custom_action_10 = 0x7f090018; public static final int accessibility_custom_action_11 = 0x7f090019; public static final int accessibility_custom_action_12 = 0x7f09001a; public static final int accessibility_custom_action_13 = 0x7f09001b; public static final int accessibility_custom_action_14 = 0x7f09001c; public static final int accessibility_custom_action_15 = 0x7f09001d; public static final int accessibility_custom_action_16 = 0x7f09001e; public static final int accessibility_custom_action_17 = 0x7f09001f; public static final int accessibility_custom_action_18 = 0x7f090020; public static final int accessibility_custom_action_19 = 0x7f090021; public static final int accessibility_custom_action_2 = 0x7f090022; public static final int accessibility_custom_action_20 = 0x7f090023; public static final int accessibility_custom_action_21 = 0x7f090024; public static final int accessibility_custom_action_22 = 0x7f090025; public static final int accessibility_custom_action_23 = 0x7f090026; public static final int accessibility_custom_action_24 = 0x7f090027; public static final int accessibility_custom_action_25 = 0x7f090028; public static final int accessibility_custom_action_26 = 0x7f090029; public static final int accessibility_custom_action_27 = 0x7f09002a; public static final int accessibility_custom_action_28 = 0x7f09002b; public static final int accessibility_custom_action_29 = 0x7f09002c; public static final int accessibility_custom_action_3 = 0x7f09002d; public static final int accessibility_custom_action_30 = 0x7f09002e; public static final int accessibility_custom_action_31 = 0x7f09002f; public static final int accessibility_custom_action_4 = 0x7f090030; public static final int accessibility_custom_action_5 = 0x7f090031; public static final int accessibility_custom_action_6 = 0x7f090032; public static final int accessibility_custom_action_7 = 0x7f090033; public static final int accessibility_custom_action_8 = 0x7f090034; public static final int accessibility_custom_action_9 = 0x7f090035; public static final int action_container = 0x7f09003e; public static final int action_divider = 0x7f090040; public static final int action_image = 0x7f090041; public static final int action_text = 0x7f090047; public static final int actions = 0x7f090048; public static final int async = 0x7f090056; public static final int blocking = 0x7f09006a; public static final int bottom = 0x7f09006b; public static final int chronometer = 0x7f09009d; public static final int dialog_button = 0x7f0900c5; public static final int end = 0x7f0900d0; public static final int forever = 0x7f0900fa; public static final int icon = 0x7f09010f; public static final int icon_group = 0x7f090110; public static final int info = 0x7f09011d; public static final int italic = 0x7f090123; public static final int left = 0x7f090127; public static final int line1 = 0x7f09012c; public static final int line3 = 0x7f09012d; public static final int none = 0x7f090160; public static final int normal = 0x7f090161; public static final int notification_background = 0x7f090162; public static final int notification_main_column = 0x7f090163; public static final int notification_main_column_container = 0x7f090164; public static final int right = 0x7f090198; public static final int right_icon = 0x7f09019a; public static final int right_side = 0x7f09019b; public static final int start = 0x7f0901e2; public static final int tag_accessibility_actions = 0x7f0901f2; public static final int tag_accessibility_clickable_spans = 0x7f0901f3; public static final int tag_accessibility_heading = 0x7f0901f4; public static final int tag_accessibility_pane_title = 0x7f0901f5; public static final int tag_screen_reader_focusable = 0x7f0901f6; public static final int tag_transition_group = 0x7f0901f7; public static final int tag_unhandled_key_event_manager = 0x7f0901f8; public static final int tag_unhandled_key_listeners = 0x7f0901f9; public static final int text = 0x7f0901fd; public static final int text2 = 0x7f0901fe; public static final int time = 0x7f09020f; public static final int title = 0x7f090211; public static final int top = 0x7f090215; } public static final class integer { private integer() {} public static final int google_play_services_version = 0x7f0a0008; public static final int status_bar_notification_info_maxnum = 0x7f0a0016; } public static final class layout { private layout() {} public static final int custom_dialog = 0x7f0c0033; public static final int notification_action = 0x7f0c004f; public static final int notification_action_tombstone = 0x7f0c0050; public static final int notification_template_custom_big = 0x7f0c0057; public static final int notification_template_icon_group = 0x7f0c0058; public static final int notification_template_part_chronometer = 0x7f0c005c; public static final int notification_template_part_time = 0x7f0c005d; } public static final class string { private string() {} public static final int common_google_play_services_unknown_issue = 0x7f0f0104; public static final int status_bar_notification_info_overflow = 0x7f0f02d5; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f100151; public static final int TextAppearance_Compat_Notification_Info = 0x7f100152; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f100154; public static final int TextAppearance_Compat_Notification_Time = 0x7f100157; public static final int TextAppearance_Compat_Notification_Title = 0x7f100159; public static final int Widget_Compat_NotificationActionContainer = 0x7f100203; public static final int Widget_Compat_NotificationActionText = 0x7f100204; public static final int Widget_Support_CoordinatorLayout = 0x7f100233; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f03002a }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] CoordinatorLayout = { 0x7f030168, 0x7f030213 }; public static final int CoordinatorLayout_keylines = 0; public static final int CoordinatorLayout_statusBarBackground = 1; public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f03016d, 0x7f03016e, 0x7f03016f, 0x7f03019b, 0x7f0301a7, 0x7f0301a8 }; public static final int CoordinatorLayout_Layout_android_layout_gravity = 0; public static final int CoordinatorLayout_Layout_layout_anchor = 1; public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2; public static final int CoordinatorLayout_Layout_layout_behavior = 3; public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4; public static final int CoordinatorLayout_Layout_layout_insetEdge = 5; public static final int CoordinatorLayout_Layout_layout_keyline = 6; public static final int[] FontFamily = { 0x7f030132, 0x7f030133, 0x7f030134, 0x7f030135, 0x7f030136, 0x7f030137 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f03012f, 0x7f030138, 0x7f030139, 0x7f03013a, 0x7f030275 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "contato.ewertonrichieri@gmail.com" ]
contato.ewertonrichieri@gmail.com
5830d460ed7b79cc3e41e5e3c6eb2a126dc7cb25
cf8eb568c324ec04c2546d026dd7deb2d9030d8d
/src/test/java/ond/test/test/thread/ThreadCompleteListener.java
6f139dff3d4fa86c1f9bf46f6f4b11178d19b9aa
[]
no_license
abcdsds/selenium
6bd05b6aca76b895a5ff6a9c343580dcf4758fb4
7053e82204dde8210275ea1838d5b3669f4c0897
refs/heads/master
2022-12-20T11:59:21.863165
2020-02-11T08:31:31
2020-02-11T08:31:31
233,352,962
0
0
null
2022-12-16T01:01:41
2020-01-12T07:10:23
Java
UTF-8
Java
false
false
270
java
package ond.test.test.thread; import com.sun.jna.Pointer; import com.sun.jna.platform.win32.WinDef.HWND; public interface ThreadCompleteListener { void notifyOfThreadComplete(final Thread thread, HWND hwnd, final Pointer process) throws InterruptedException; }
[ "choiyurim2@naver.com" ]
choiyurim2@naver.com
8c29ee6e9d8a67c8dabe3c55196d76be3db7dada
b0485f1d045ec088f9d00e03651d0f344bc00d92
/app/src/main/java/com/example/eduardo/regalos/Pay.java
451ca015336ebc48c259323063344ce75c01ae5f
[]
no_license
JesusSinaloa/Regalos_App
34d448cb0a4a2cb07e87e6c9b1020219142923f2
4ccbec24547946b17f328cfe1948f791d529bc64
refs/heads/master
2020-05-28T07:23:41.942982
2019-11-06T20:04:01
2019-11-06T20:04:01
187,561,104
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package com.example.eduardo.regalos; import java.io.Serializable; public class Pay implements Serializable { private String IdPay; private String FechaPago; public Pay(String idPay, String fechaPago) { IdPay = idPay; FechaPago = fechaPago; } public String getIdPay() { return IdPay; } public void setIdPay(String idPay) { IdPay = idPay; } public String getFechaPago() { return FechaPago; } public void setFechaPago(String fechaPago) { FechaPago = fechaPago; } }
[ "Eduardo@tetragex.com" ]
Eduardo@tetragex.com
872bd017efd901e394d4aeac83b6ec803ab20be0
6bc81c551a4964a206f6d7497ea5563698b506f1
/minWordDist.java
f3562c3fb750fe063e21b578c79f1fbba69f102c
[]
no_license
albertcoder/Array-7
df837be8ba8f0354400fc43cc270104180fb50fe
dfe0326c13c8bceece51238cb94507335e9c598f
refs/heads/master
2022-11-29T07:59:06.233246
2020-08-12T08:03:38
2020-08-12T08:03:38
285,210,628
0
0
null
2020-08-05T07:13:39
2020-08-05T07:13:39
null
UTF-8
Java
false
false
627
java
//time complexity O(n) //space complexity O(1) class Solution { public int shortestDistance(String[] words, String word1, String word2) { if(words.length == 0 || words == null) return -1; int i1 = -1; int i2 = -1; int min = Integer.MAX_VALUE; for(int i = 0; i < words.length; i++){ if(word1.equals(words[i])){ i1 = i; } if(word2.equals(words[i])){ i2 = i; } if(i1 != -1 && i2 != -1){ min = Math.min(min, Math.abs(i1-i2)); } } return min; } }
[ "eralbert9191@gmail.com" ]
eralbert9191@gmail.com
2be394b0a07bc0f5148ac661e83dadb64253967c
d5faf8efd97cf5d3eb6494e6b56618bdb4192c8a
/src/main/java/com/via/testcases/common/HolidayTestFlowExecuter.java
ca9c7442aba44859839a925588ca980cc4c3440f
[]
no_license
vikashsingh10194/Web-Automation
6fc685c544d592dce5b19257b6148b866bb30ead
236c494570d4250ce8c7d19b7a8c8110d736e4b1
refs/heads/master
2020-04-02T02:56:10.639472
2018-10-20T18:41:49
2018-10-20T18:41:49
153,936,685
0
0
null
null
null
null
UTF-8
Java
false
false
2,535
java
package com.via.testcases.common; import java.util.Map; import lombok.AllArgsConstructor; import org.openqa.selenium.WebDriver; import org.testng.Assert; import com.via.appmodules.common.HomePageActions; import com.via.appmodules.holidays.GuestsDetailsInput; import com.via.appmodules.holidays.HolidaySearchAction; import com.via.appmodules.holidays.HolidaySearchResults; import com.via.appmodules.payment.Payment; import com.via.pageobjects.holidays.HolidayBookingDetails; import com.via.utils.Constant.VIA_COUNTRY; import com.via.utils.Log; import com.via.utils.PageHandler; import com.via.utils.RepositoryParser; @AllArgsConstructor public class HolidayTestFlowExecuter { private VIA_COUNTRY countryCode; private String testId; private WebDriver driver; private RepositoryParser repositoryParser; private final String TEST_SUITE = "B2C Holidays"; public void execute(Map<Integer, String> testData) { HomePageActions homePageAction = new HomePageActions(driver, repositoryParser, testId); String url = driver.getCurrentUrl(); boolean login = false; try { Log.startTestCase(testId); String loginDetails = testData.get(TestCaseExcelConstant.COL_LOGIN); if (VIA_COUNTRY.ID == countryCode || VIA_COUNTRY.TH == countryCode) { homePageAction.changeLanguageToEnglish(); } login = homePageAction.loginUser(countryCode, loginDetails); HolidayBookingDetails holidayDetails = HolidaySearchAction.execute(driver, repositoryParser, testData); boolean enquiryCheck = HolidaySearchResults.execute(testId, driver, repositoryParser, holidayDetails); if (!enquiryCheck) { double paymentFare = GuestsDetailsInput.execute(testId, driver, repositoryParser, holidayDetails); Payment payment = new Payment(testId, countryCode, driver, repositoryParser); payment.execute(driver, paymentFare, testData); } Log.endTestCase(testId); } catch (Exception e) { //PageHandler.sendFailureMessageSlack(countryCode, TEST_SUITE, testId, e.getMessage()); Log.error(e.getMessage()); Assert.fail(testId + " failed"); } finally { if (driver != null) { if (login) { try { Thread.sleep(2 * 1000); } catch (Exception e) { } driver.navigate().to(url); homePageAction.signOut(); login = false; } driver.close(); driver.quit(); } Log.endTestCase(testId); } } }
[ "vikashsingh.10194@gmail.com" ]
vikashsingh.10194@gmail.com
622aa309fc73b238d2be8fd3ac3f11b450b9fb9a
1e5d7fc50a91c4f7fd2acdfa54f267507ff8c6a1
/src/main/java/edu/uci/ics/chrisr6/service/basic/utilities/CredentialValidation.java
d6061d3de72ceb741dfd46870ae74a951d0439e4
[]
no_license
RodriguezDev/Commonality-Backend
85e966a62f6583f5389fdcd341c5f2f80d419008
7be5bc89fc87bb956079c35bb223426d2b8ffb18
refs/heads/master
2020-11-24T17:18:50.123146
2020-02-19T21:40:30
2020-02-19T21:40:30
228,268,797
0
0
null
null
null
null
UTF-8
Java
false
false
2,336
java
package edu.uci.ics.chrisr6.service.basic.utilities; import edu.uci.ics.chrisr6.service.basic.models.GeneralResponseModel; import javax.ws.rs.core.Response.Status; public class CredentialValidation { public CredentialValidation() {} public int isValidEmail(String email) { if(!emailHasValidFormat(email)) return -101; if (!emailHasValidLength(email)) return -100; return 0; } public int isValidPassword(char[] password) { if (!passwordNotEmpty(password)) return -102; if (!passwordHasValidLength(password)) return -102; if (!passwordHasValidCharacters(password)) return -103; return 0; } public Status getStatus(GeneralResponseModel responseModel) { int resultCode = responseModel.getResultCode(); switch (resultCode) { case -103: case -102: case -101: case -100: case -3: case -2: return Status.BAD_REQUEST; default: return Status.OK; } } private boolean emailHasValidLength(String email) { return email.length() > 0 && email.length() <= 50; } private boolean emailHasValidFormat(String email) { if (email.contains("@") && email.contains(".")) return email.indexOf('@') < email.lastIndexOf('.') && email.indexOf('@') != 0; return false; } private boolean passwordNotEmpty(char[] password) { return password != null && password.length > 0; } private boolean passwordHasValidLength(char[] password) { return password.length >= 7 && password.length <= 16; } private boolean passwordHasValidCharacters(char[] password) { boolean upper = false; boolean lower = false; boolean digit = false; boolean special = false; for (char c: password) { if (Character.isDigit(c)) { digit = true; } else if (Character.isUpperCase(c)) { upper = true; } else if (Character.isLowerCase(c)) { lower = true; } else { special = true; } } return upper && lower && digit && special; } }
[ "chrismail627@gmail.com" ]
chrismail627@gmail.com
f07d57a3ad4244f40f5e87d64c5105be4bcbc22d
7a11ae03981c72525da3fb65b4f8b7df80e9f790
/core/src/test/java/com/intendia/gwt/autorest/client/TypeTokenTest.java
b1f7a974b14f6f3e7f8695fb248a983d0ab82504
[ "Apache-2.0" ]
permissive
tedynaidenov/autorest
20fb48acc0870e123303459ce9bc353f01aec57d
19ae850b2f47cf66214255f4c042763c14994595
refs/heads/master
2020-04-06T10:17:20.462304
2019-02-13T14:49:26
2019-02-13T14:49:26
157,374,892
0
1
Apache-2.0
2018-11-13T12:13:36
2018-11-13T12:13:35
null
UTF-8
Java
false
false
2,353
java
package com.intendia.gwt.autorest.client; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; import java.util.List; import java.util.Map; import org.junit.Test; public class TypeTokenTest { public static final java.util.List<java.util.Map<java.lang.String, java.lang.Integer[]>>[] TEST_FIELD = null; @Test public void simpleTest() { assertThat(TypeToken.of(String.class).stringify(), equalTo("java.lang.String")); assertThat(new TypeToken<Integer>(Integer.class) {}.stringify(), equalTo("java.lang.Integer")); } @Test public void arrayTest() { assertThat(TypeToken.of(String[].class).stringify(), equalTo("java.lang.String[]")); } @Test public void genericTest() { assertThat( new TypeToken<List<Map<String, Integer[]>>>( List.class, new TypeToken<Map<String, Integer>>(Map.class, TypeToken.of(String.class), TypeToken.of(Integer[].class))) .stringify(), equalTo("java.util.List<java.util.Map<java.lang.String, java.lang.Integer[]>>")); } @Test public void genericTestArray() { assertThat( new TypeToken<List<Map<String, Integer[]>>[]>( null, new TypeToken<List<Map<String, Integer[]>>>( List.class, new TypeToken<Map<String, Integer>>(Map.class, TypeToken.of(String.class), TypeToken.of(Integer[].class)))) .stringify(), equalTo("java.util.List<java.util.Map<java.lang.String, java.lang.Integer[]>>[]")); } @Test public void genericJRETest() { assertThat( new TypeToken<List<Map<String, Integer[]>>>() {} .stringify(), equalTo("java.util.List<java.util.Map<java.lang.String, java.lang.Integer[]>>")); assertThat( new TypeToken<List<Map<String, Integer[]>>>( List.class, new TypeToken<Map<String, Integer>>(Map.class, TypeToken.of(String.class), TypeToken.of(Integer[].class))), equalTo(new TypeToken<List<Map<String, Integer[]>>>() {})); try { assertThat( TypeToken.of(TypeTokenTest.class.getDeclaredField("TEST_FIELD").getGenericType()).stringify(), equalTo("java.util.List<java.util.Map<java.lang.String, java.lang.Integer[]>>[]")); } catch (NoSuchFieldException | SecurityException e) { throw new RuntimeException(e); } } }
[ "ivan.markov@honeywell.com" ]
ivan.markov@honeywell.com
e87fbba004eda82484e1caf4d0c71fbac087abfc
a5b00c96960d6fa380c6df898f7986485a8c1ae6
/axle-core/src/main/java/org/axle/core/AbstractApiAction.java
6578682ddea99548b13c2dd71129230823cf9289
[]
no_license
achilles-liu/axle
4318b5d9c85e513d584fa511215a6979426e4c0d
390eb46978609c576d9c230a9dd97ee0b5faa94b
refs/heads/master
2020-03-30T10:34:20.645785
2018-11-08T06:46:33
2018-11-08T06:46:33
151,125,894
1
0
null
null
null
null
UTF-8
Java
false
false
3,868
java
package org.axle.core; import java.lang.reflect.Field; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.axle.core.annotation.ApiAction; import org.axle.core.annotation.IoParam; import org.axle.core.deserialize.TypeDeserialize; import org.axle.core.deserialize.TypeDeserializeChain; import org.axle.core.formatter.Formatter; import org.axle.core.request.Request; import org.axle.core.response.Response; import org.axle.core.util.ActionUtil; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.util.AntPathMatcher; /** * axle-core * <description>@param <K> * <description>@param <V></description> * @author Johnny Liu * @date 2018-09-30 * @param <K> * @param <V> */ public abstract class AbstractApiAction<K extends Request,V extends Response> implements ApplicationContextAware{ protected ApplicationContext applicationContext; AntPathMatcher antPathMatcher = new AntPathMatcher(); protected Class<?> findActualClass(String actualUrl,Map<String,Object> paramMap){ String[] beanNames = this.applicationContext.getBeanNamesForAnnotation(ApiAction.class); Class<?> actualType = null; for(String beanName : beanNames) { Class<?> beanType = this.applicationContext.getType(beanName); ApiAction apiAction = beanType.getAnnotation(ApiAction.class); String url = apiAction.url(); // XXX extract the incoming parameter in request uri. if(antPathMatcher.match(url, actualUrl.substring(4))){ Map<String, String> urlVar = antPathMatcher.extractUriTemplateVariables(url, actualUrl.substring(4)); paramMap.putAll(urlVar); actualType = beanType; break; } // XXX without the uri parameter. if(url.equals(actualUrl)) { actualType = beanType; break; } } return actualType; } @SuppressWarnings("unchecked") protected K extractParam(HttpServletRequest request) throws Exception { TypeDeserialize deser = this.applicationContext.getBean(TypeDeserializeChain.class).chain(); String path = request.getServletPath(); Map<String,Object> rawParamMap = ActionUtil.extractFromRequest(request); Class<?> beanType = findActualClass(path,rawParamMap); if(beanType == null) throw new RuntimeException("unknown request uri"); ApiAction apiAction = beanType.getAnnotation(ApiAction.class); IoParam ioParam = apiAction.io(); Class<?> inParamType = ioParam.in(); // XXX should it retrieve the fields of ancestor class here? Field[] fileds = inParamType.getDeclaredFields(); Object target = inParamType.newInstance(); // XXX convert to the actual type. // TODO How to valid the field? How to use <code>Parameter</code> annotation? for(Field field : fileds) { deser.deserialize(target, field, rawParamMap.get(field.getName())); } return (K) target; } protected String execute(HttpServletRequest request, HttpServletResponse response){ ApiReceipt.Builder apiRecBuilder = new ApiReceipt.Builder().code(-1).message("success"); try { K param = extractParam(request); param.setUuid(ActionUtil.uuid()); V val = command(param); if(val != null) val.setUuid(param.getUuid()); apiRecBuilder.code(0); apiRecBuilder.data(val); } catch (Exception e) { apiRecBuilder.message(e.getMessage()); } Formatter formatter = this.applicationContext.getBean(Formatter.class); return formatter.format(apiRecBuilder.builder()); }; protected abstract V command(K request); public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if(this.applicationContext == null) this.applicationContext = applicationContext; } }
[ "LIUTIANJIN541@pingan.com.cn" ]
LIUTIANJIN541@pingan.com.cn
0ed8160ec14ef212fe6bd58f2df88f8c2e1e428b
9c51f4382c1ae704bd120d44d90c439b480e4a92
/src/main/java/iuh/se/dhktpm11a/helper/Entity.java
c871f12a7ba594bb76ab9c08afa4a8e8dbf9baca
[]
no_license
ngtheson988883/XDPM_DHKTPM11A_Nhom10
367ff70118eee7d19d3562953180baed54c71cb9
f73ee0e8fe307a7af67164c008bf6c6b19888b74
refs/heads/master
2020-04-01T02:24:53.668283
2018-10-31T13:52:27
2018-10-31T13:52:27
152,777,913
0
0
null
null
null
null
UTF-8
Java
false
false
432
java
package iuh.se.dhktpm11a.helper; public enum Entity { Disk{ @Override public String getPrefixId() { return "DN-"; } }, Customer{ @Override public String getPrefixId() { return "CN-"; } }, Title { @Override public String getPrefixId() { return "TN-"; } }; public abstract String getPrefixId(); }
[ "ngthe.son988883@gmail.com" ]
ngthe.son988883@gmail.com
cdc0aa0a4bab511d5fc6374455491b452c29bc50
75be08f65a35d54478123b7b05adb093a29e23d8
/src/LinkedIntList.java
0a0767f35f3b82274d7f7a367c9ae739e616112f
[]
no_license
meintte/DatastructuresAndAlgorithms
96ff21ee20d87800cb581def6aadff348983c958
e4478d6b927d9838001093b9f203987496f663c6
refs/heads/master
2021-01-17T11:56:43.317150
2016-08-19T16:11:44
2016-08-19T16:11:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
293
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author andreas */ public class LinkedIntList { int value; public LinkedIntList next; }
[ "umbach@gmail.com" ]
umbach@gmail.com
f2173160aa1723b01e1372701f03cfa58ac95b39
28d74264fa506d8959d45da15ba5e3eb66e34be1
/src/DirReduction/app/DirReduction.java
b77e1157cc13e6de334be133cf08e2931aa36867
[]
no_license
IlyaNakhaichuk/CodewarsRepository
bf5625fff41ab4973a62c3ed030df91b1a4b12e6
48a8eaf89060238f88ad69c6da9a640b79e066c3
refs/heads/master
2020-05-16T10:31:23.147433
2019-06-17T13:29:08
2019-06-17T13:29:08
182,987,342
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package DirReduction.app; /*public class DirReduction{ public static String[] dirReduc(String[] arr) { return new String[]{new String( String.valueOf( arr ))}; } } */
[ "ilya.nakhaichuk@gmail.com" ]
ilya.nakhaichuk@gmail.com
17838954477752da70a9f210b84dffc94b2426ff
55167b5b16bd69a5d80a44a4685178fe8846827d
/src/main/java/com/question/second/comparator/IDComparator.java
5fcea6f41f20bf5b44b2a163ef29d22360402f10
[]
no_license
tigadev/tpgquestions
3e8f404ea5d3a75259730320538e07571f4e0176
6af5b21ebb42b8372522eeb065b3dd7d08c80692
refs/heads/master
2021-01-21T05:36:23.021749
2017-08-30T21:27:05
2017-08-30T21:27:05
101,929,245
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package com.question.second.comparator; import com.question.second.StudentDTO; import java.util.Comparator; //created by adzam on 31/8/2017 public class IDComparator implements Comparator<StudentDTO> { @Override public int compare(StudentDTO o1, StudentDTO o2) { return o1.getId() - o2.getId(); } }
[ "abduladzam@ebworx.com" ]
abduladzam@ebworx.com
4df5d5c814990182bb019e8d591a3ae9a93406b6
a4601fae9be62fc99f5197bfad32a091da8a24a7
/src/test/java/org/test/PetShop.java
caa52126c5515ec783d056bdffa1ddcecc556559
[]
no_license
Baktha-8197/Junit-Framework
b85a80ed2ba7f833e58bda725c0dfad0a330706a
a7dff668efe89021a24c184a6d09b76b25672fff
refs/heads/master
2023-07-27T05:30:51.342842
2021-09-03T13:25:29
2021-09-03T13:25:29
402,706,834
0
0
null
2021-09-03T13:25:30
2021-09-03T08:54:50
Java
UTF-8
Java
false
false
2,191
java
package org.test; import java.util.Date; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.pet.CredentialPage; import org.pet.FrontPage; import org.pet.HomePage; import org.pet.PaymentPage; import org.pet.PricePage; import org.pet.ProductIdName; import org.pet.ShoppingPage; public class PetShop extends BaseClass { @BeforeClass public static void browserLaunch() { getDriver(); launchUrl("https://petstore.octoperf.com/"); } @AfterClass public static void closeDriver() { close(); } @Before public void BeforeEnterTime() { Date date=new Date(); System.out.println(date); } @After public void afterEnterTime() { Date date=new Date(); System.out.println(date); } @Test public void test1() { //FrontPage FrontPage page1=new FrontPage(); btnClick(page1.getBtnEnter()); } @Test public void test2() { //HomePage HomePage page2=new HomePage(); btnClickJs(page2.getBtnimgFish()); //ProductIdPage ProductIdName page3=new ProductIdName(); btnClickJs(page3.getBtnAngel()); //PricePage PricePage page4=new PricePage(); btnClickJs(page4.getBtnAddToCart()); //ShoppingPage ShoppingPage page5=new ShoppingPage(); doubleClick(page5.getTxtQuantity()); enterText(page5.getTxtQuantity(), "4"); btnClick(page5.getBtnProceed()); //CredentialPage CredentialPage page=new CredentialPage(); enterText(page.getTxtUsername(), "Bakthavachalam"); doubleClick(page.getTxtPassword()); enterText(page.getTxtPassword(), "Sathiyavani@1"); btnClick(page.getBtnSign()); //PaymentPage implicitWait(); btnClickJs(page2.getBtnimgFish()); //ProductIdPage btnClickJs(page3.getBtnAngel()); //PricePage btnClickJs(page4.getBtnAddToCart()); //ShoppingPage doubleClick(page5.getTxtQuantity()); enterText(page5.getTxtQuantity(), "4"); btnClick(page5.getBtnProceed()); PaymentPage page6=new PaymentPage(); btnClick(page6.getBtnCkeckBox()); btnClick(page6.getBtnContinue()); btnClick(page6.getBtnContinue1()); btnClick(page6.getBtnConfirm()); String text = getText(page6.getPrintOrderNo()); System.out.println(text); } }
[ "kbaktha8197@gmail.com" ]
kbaktha8197@gmail.com
473391ff73b4092d6c5fb462a5d742a50e3cefd4
1ea278b54aacbe6384335e89564df975ab535f21
/src/cn/myxingxing/ysulibrary/event/LendHistoryEvent.java
f458341344fdea5fffbc80a78840dcd2dae4ab60
[]
no_license
kirawise/Ysulibrary
eed05e805b60c7e9c6bbdb7313dd9b96e23dd7a3
fc18799bb3f9ad40426c4ad4ea3ceec7af3981c2
refs/heads/master
2021-01-14T08:09:41.978040
2016-09-02T10:03:14
2016-09-02T10:03:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package cn.myxingxing.ysulibrary.event; public class LendHistoryEvent { private int info; public LendHistoryEvent(int info) { this.info = info; } public int getInfo() { return info; } }
[ "myxingxing66@126.com" ]
myxingxing66@126.com
b105e252370cbe4d3c2632cd13e17996b3bfa8c7
3f4f2f045b2a426e9ef91863e12458f47c0d7ce1
/URA_Multiplus_V2/WEB-INF/src/flow/subflow/OuvirProcedimentos/Retorno.java
65a13bb58e3b1fcfaa841c2aef7346971e9a532b
[]
no_license
gtau/URA_Multiplus
786de99c9a68aa625597c139a19ec7d0ca8348be
a001d543ad71d8c4c5be492cc34111eb37a59414
refs/heads/master
2016-09-14T00:13:23.053748
2016-05-03T20:43:33
2016-05-03T20:43:33
56,319,735
1
0
null
null
null
null
UTF-8
Java
false
false
562
java
package flow.subflow.OuvirProcedimentos; /** * This servlet is the exit point of a subflow. The base class handles * the logic for forwarding to the next servlet. * Last generated by Orchestration Designer at: 2016-APR-29 09:38:36 PM */ public class Retorno extends com.avaya.sce.runtime.SubflowReturn { //{{START:CLASS:FIELDS //}}END:CLASS:FIELDS /** * Default constructor * Last generated by Orchestration Designer at: 2016-APR-29 09:38:36 PM */ public Retorno() { //{{START:CLASS:CONSTRUCTOR super(); //}}END:CLASS:CONSTRUCTOR } }
[ "gabrieltau@365ti.com.br" ]
gabrieltau@365ti.com.br
b0514de9723c3850da3c342d2fdc33cab8f7204d
1b90a71985a5fef0a281297b4079bc82809f05ed
/vehicleRegistrationManagement/src/main/java/com/vehicleregistration/service/StateService.java
1c9be1cc13fafddbbb46c15f8b14ad6dff4a0782
[]
no_license
anand2techie/CoreJava
725a6c188e066c6936afd67185ed3328f2ae7f24
53738dfd2dfd0dea521d13d690db263a38c8abf5
refs/heads/master
2021-01-01T17:29:09.581662
2018-04-29T12:22:26
2018-04-29T12:22:26
98,082,145
0
0
null
null
null
null
UTF-8
Java
false
false
130
java
package com.vehicleregistration.service; import org.springframework.stereotype.Service; @Service public class StateService { }
[ "ananthkec@gmail.com" ]
ananthkec@gmail.com
8894255fd405087d63847f958d860912143183e6
8d3746a3310bbcf14ac5d6414af31be27878a526
/src/test/java/com/ixpert/sb/userregistration1/Userregistration1ApplicationTests.java
417eb8d15230b784ea388336007045a9aa7c06cc
[]
no_license
iXpert/UserRegistration1
cab5811079dabf152ab2ab601f91c82e44f75ee3
57f9fb16565950c2361a3a50002a866f45122435
refs/heads/master
2020-04-11T14:24:11.808047
2018-12-15T00:09:38
2018-12-15T00:09:38
161,853,742
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.ixpert.sb.userregistration1; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class Userregistration1ApplicationTests { @Test public void contextLoads() { } }
[ "El7aga3isha" ]
El7aga3isha
d6046b20e18ea920ef2f3bdc88a8c9b8518fae36
ce8afc9981be5f7d78cfa8a0243c9d059818d1b3
/services/hrdb/src/com/auto_hlyknyxrjx/hrdb/service/HrdbProcedureExecutorService.java
ed4291759eff5547bfa5e50d5314bf653adcf658
[]
no_license
wavemakerapps/Auto_hlyKNYXrJX
cfde669f7f842bae333ce643b7c43955412df191
af5387daabcdce34f4b1c3aa975d80898d5f737d
refs/heads/master
2021-09-01T12:21:56.176761
2017-12-27T00:30:39
2017-12-27T00:30:39
115,464,690
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
/*Copyright (c) 2015-2016 wavemaker.com All Rights Reserved. This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with wavemaker.com*/ package com.auto_hlyknyxrjx.hrdb.service; /*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ public interface HrdbProcedureExecutorService { }
[ "automate1@wavemaker.com" ]
automate1@wavemaker.com
cdd116ee18f74cd6cf25fba25f6ae3ab7492aa9d
3509d43f2cbd2466d832c7b1e26e4f5bf4585945
/app/src/main/java/com/example/administrator/github_own/presenter/SingleUserPublicActivityPresenter.java
2f06caed1e465fb048193c6adb0359330a158d1a
[]
no_license
a1401601741/github_own
ddf3b894ad076862d154631a506695021fd1846c
64b65ce803e251e75eb682e020d25759c8d014f3
refs/heads/master
2021-01-01T19:41:33.937665
2017-07-28T13:38:47
2017-07-28T13:38:47
98,425,858
0
0
null
null
null
null
UTF-8
Java
false
false
553
java
package com.example.administrator.github_own.presenter; import com.example.administrator.github_own.base.RxPresenter; import com.example.administrator.github_own.contract.SingleUserAboutContract; import com.example.administrator.github_own.contract.SingleUserPublicActivityContract; /** * Created by Administrator on 2017/7/26 0026. */ public class SingleUserPublicActivityPresenter extends RxPresenter<SingleUserPublicActivityContract.View> implements SingleUserPublicActivityContract.Presenter<SingleUserPublicActivityContract.View> { }
[ "a1401601741@gmail.com" ]
a1401601741@gmail.com
bdbe1b414dd8b4a25a2376e92e798e60a9f55998
b6ef5358573e0109a73fe90c9bd9951e6f109115
/src/main/java/com/lichenxing/routingdatasource/routing/domain/RoutingChatMessage.java
c68b4a7a87e7dc4c3d8ccd426b0d97111009c122
[]
no_license
sheepstarli/demo-routing-datasource
7f86f1e90dab0eac7406a1e23e5a2831bcadf7d0
2e438a1dd1d907c5d856a8fc35f864c9d34ba974
refs/heads/master
2021-09-01T13:30:24.846057
2017-12-27T07:46:05
2017-12-27T07:46:05
97,630,066
0
5
null
null
null
null
UTF-8
Java
false
false
858
java
package com.lichenxing.routingdatasource.routing.domain; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import javax.persistence.*; import java.util.Date; /** * ChatMessage * * @author Chenxing Li * @date 18/07/2017 20:45 */ @Data @Table(name = "chat_message") @Entity public class RoutingChatMessage { @Id @Column(name = "msgId") private String msgId; @Column(name = "tenantId") private Integer tenantId; @Column(name = "body") @Convert(converter = BodyMessageAttributeConverter.class) private BodyMessage body; @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone = "GMT+8") @Column(name = "updatedAt") private Date updatedAt; @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone = "GMT+8") @Column(name = "createdAt") private Date createdAt; }
[ "licx@easemob.com" ]
licx@easemob.com
5bd8a49528ae1d7ff7a05c2e19edbf04e0f279cf
f5d0b6ba644465cc6aea830c2a4091ccb73a3d94
/src/Day26/ArrayReview.java
e4d39f845578fbc43b2e9bd7fe4269660dc9e4ee
[]
no_license
zemmus77/IdeaProjects
49041af595d229835fb22e451b253790d42e9938
251d530b73d9febbc8e3cfcca809e7f1b2fba70a
refs/heads/master
2023-05-11T20:43:34.497538
2020-04-05T19:54:50
2020-04-05T19:54:50
229,624,221
0
0
null
2023-05-09T18:23:51
2019-12-22T20:11:27
Java
UTF-8
Java
false
false
2,170
java
package Day26; public class ArrayReview { public static void main(String[] args) { // DAY 26 : // // // Array : // is an object that can hold multiple items| elements of same type // array has fixed size, // once created with certain size , it can not be changed // we can change the value inside the array // // Default value for array item if it is empty // // byte short int long -->> 0 // float double --> 0.0 // char --- '' empty character // boolean --->> false // // what about non-primitive type : reference type // String ---> null // // // 3 ways to create an array object and assign it to variable int[] myNumbers = new int[4]; // 4 is item count // we assign value using array variable and it's index myNumbers[0] = 10; myNumbers[1] = 40; myNumbers[2] = 30; myNumbers[3] = 7; // how do we get the size of an array int size = myNumbers.length; // 4 int lastIndex = size - 1; //myNumbers.length-1 // How do we get last item of any array // i want to save last item into a variable //int lastItemValue = myNumbers[3] ; //int lastItemValue = myNumbers[lastIndex] ; int lastItemValue = myNumbers[myNumbers.length - 1]; // print third item System.out.println("third item value " + myNumbers[2]); // 30 // 1.1 i WANT TO add 1 to the second item value myNumbers[1] = myNumbers[1] + 1; System.out.println("new value of second item " + myNumbers[1]); // 1.2 i WANT TO double the second item value myNumbers[1] = myNumbers[1] * 2; System.out.println("new value of second item afetr doubling " + myNumbers[1]); // 1.3 I want to assign 3rd item value to // sum of first and second item myNumbers[2] = myNumbers[0] + myNumbers[1]; System.out.println("new value of third item " + myNumbers[2]); // just change my int array data type to int to avoid issues // 1.4 Swap the first item value with last item value } }
[ "muhammedoff@gmail.com" ]
muhammedoff@gmail.com
eeb07425051b87ed86b7762076c2a6147f8acc03
e4b8c1d67ec36c8421264619f193a1430cc7da06
/springboot-resttemplate/src/main/java/com/example/resttemplate/configuration/RestGetUriTemplateHandler.java
5953f4db58605983c1bf9111c1d5e8f90790fec6
[ "Apache-2.0" ]
permissive
u014427391/springbootexamples
5078a7bb7c1b5b626f59338fb0abb69a9314ed06
76523706f09ef4111782cf8702f7c46413727c62
refs/heads/master
2023-08-17T02:11:10.190760
2023-08-14T14:47:35
2023-08-14T14:47:35
217,474,195
44
40
Apache-2.0
2020-10-23T09:18:45
2019-10-25T07:15:48
Java
UTF-8
Java
false
false
1,137
java
package com.example.resttemplate.configuration; import lombok.extern.slf4j.Slf4j; import org.springframework.web.util.DefaultUriBuilderFactory; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriTemplateHandler; import java.net.URI; import java.util.Map; @Slf4j public class RestGetUriTemplateHandler implements UriTemplateHandler { private UriTemplateHandler uriTemplateHandler = new DefaultUriBuilderFactory(); @Override public URI expand(String uriTemplate, Map<String, ?> uriVariables) { UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl(uriTemplate); for (Map.Entry<String, ?> entry : uriVariables.entrySet()) { builder.queryParam(entry.getKey(), entry.getValue()); } String uriString = builder.toUriString(); log.info("uriString:[{}]" , uriString); return uriTemplateHandler.expand(uriString , uriVariables); } @Override public URI expand(String uriTemplate, Object... uriVariables) { return uriTemplateHandler.expand(uriTemplate, uriVariables); } }
[ "362330721@qq.com" ]
362330721@qq.com
664f1e7bd2ef9481274664b52369b186c4efbc84
79ee092946ab6faba1a5942793c5d76c03134241
/app/src/main/java/co/com/ceiba/mobile/pruebadeingreso/rest/PostsClient.java
72bb609408a59348cb32d4685d725c6d8224050d
[]
no_license
georgedavid1990/ceiba_test
95f12a9d2fa7a54dbe4e40de431934a6ad1d8c0d
32a6dc94b9d389cf91c0aa5991b27c5a5101bbbc
refs/heads/master
2020-06-02T04:37:14.963263
2019-06-09T18:08:26
2019-06-09T18:08:26
191,038,755
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package co.com.ceiba.mobile.pruebadeingreso.rest; import java.util.List; import co.com.ceiba.mobile.pruebadeingreso.rest.result.PostResult; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; public interface PostsClient { @GET(Endpoints.GET_POSTS) Call<List<PostResult>> getPosts(); @GET(Endpoints.GET_POSTS) Call<List<PostResult>> getPostsByUser(@Query("userId") int userId); }
[ "zibordes@hotmail.com" ]
zibordes@hotmail.com
c2cf8e9e0ba19537e2f83a59e04d895dd409420c
21b9de0595af3ef8934d079a752a9bfe8cdcd0e2
/phone-book-application/src/main/java/com/reverside/phonebook/model/CustomUserDetails.java
134f97b2d6be9fa953b542105c5ff177ffb145c4
[]
no_license
murukaimberi/phoneapp
07b2e1fa0c474ab8043f023751763741a6c12edd
97c7ab3f4e3cad1f5ef63c886dadaa69e1820a80
refs/heads/master
2022-06-19T13:33:34.656336
2019-03-11T12:26:35
2019-03-11T12:26:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,095
java
package com.reverside.phonebook.model; import java.util.Collection; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.UserDetails; public class CustomUserDetails extends User implements UserDetails { private static final long serialVersionUID = 1L; public CustomUserDetails() { super(); } public CustomUserDetails(User user) { super(user); } @Override public Collection<? extends GrantedAuthority> getAuthorities() { String[] roles = getRoles() .stream() .map(role -> role.getRole()) .toArray(String[] :: new); Collection<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList(roles); return authorities; } @Override public boolean isAccountNonExpired() { return isActive(); } @Override public boolean isAccountNonLocked() { return isActive(); } @Override public boolean isCredentialsNonExpired() { return isActive(); } @Override public boolean isEnabled() { return isActive(); } }
[ "rmmatsama@gmail.com" ]
rmmatsama@gmail.com
f0325beda94c8abdfb1e6d13aa3bdd54b33f9a83
4eac378f5beb04afd82662def0fb7544c8ebd1f2
/Mmbank/Mmbank/src/main/java/com/moneymoney/app/Mmbank/service/AccountServiceImpl.java
bb9c98a01701495e30274cdc3c776bcaa65fcae4
[]
no_license
harishchinna/Mmbankzuul
d457f4c2f8da7a0b88178a34f9c4313c2ed2495a
0dc1b3ef8b317d1c7d8553200e1f467c0583d228
refs/heads/master
2020-04-18T10:45:28.143589
2019-01-31T09:16:38
2019-01-31T09:16:38
167,477,629
0
0
null
null
null
null
UTF-8
Java
false
false
1,423
java
package com.moneymoney.app.Mmbank.service; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.moneymoney.app.Mmbank.accounts.BankAccount; import com.moneymoney.app.Mmbank.accounts.SavingsAccount; import com.moneymoney.app.Mmbank.repository.AccountRepository; @Service public class AccountServiceImpl implements AccountService { @Autowired private AccountRepository repository; @Override public void addNewAccount(SavingsAccount savingsAccount) { repository.save(savingsAccount); } @Override public List<BankAccount> getAllAccounts() { return repository.findAll(); } @Override public Optional<BankAccount> getById(int accountNumber) { Optional<BankAccount> account = repository.findById(accountNumber); /* System.out.println(account); */ return account; } @Override public void updateAccount(SavingsAccount savingsAccount) { repository.save(savingsAccount); } @Override public void deleteAccount(int accountNumber) { repository.deleteById(accountNumber); } @Override public void updateBalance(BankAccount account) { repository.save(account); } @Override public Double getCurrentBalance(int accountNumber) { Optional<BankAccount> account= repository.findById(accountNumber); double balance= account.get().getCurrentBalance(); return balance; } }
[ "javvaji.harish@capgemini.com" ]
javvaji.harish@capgemini.com
a450129e45573a0de87ca428928442e7b439d90d
e57c2810d88de0b93c76cd104e33f0565fdbc4f2
/VarCont/src/main/java/br/com/fatec/VarCont/Repository/UsuarioRepository.java
9239c7e1557bc78b63ea4b1bd7f2be2663b398eb
[]
no_license
ViniOkamoto/VarCont
209e2b25e871ab663b6942aac15f778db554f857
2918f5df02fd08fe554be70233590246584300bd
refs/heads/master
2020-09-06T07:13:21.509019
2020-06-08T21:24:42
2020-06-08T21:24:42
220,360,372
1
1
null
null
null
null
UTF-8
Java
false
false
993
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.com.fatec.VarCont.Repository; /** * * @author OkamotoPc */ import br.com.fatec.VarCont.DataSource.Models.Usuario; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @Repository public interface UsuarioRepository extends JpaRepository<Usuario, Long> { @Query("SELECT u FROM Usuario u WHERE u.email = :email and u.senha = :senha") public Usuario findByEmailAndPassword(@Param("email") String email, @Param("senha") String senha); @Query("SELECT u FROM Usuario u WHERE u.email = :email") public Optional<Usuario> findByEmail(@Param("email") String email); }
[ "leo_kamoto@outlook.com" ]
leo_kamoto@outlook.com
cf0e469d4b6042edff65af558393b4864ab581a1
c7dce2cfc44669bab02d04280aa320a906f932eb
/Try and Catch/src/Main.java
ef9f5ee5f486640ae8fec51561de3379c77bc578
[]
no_license
osmanemin/Java
73833af7ddce900dcc40d92328d11577693e702f
0ab8bf587f17194316ac9f238a505af27ba47fc1
refs/heads/master
2023-01-18T18:44:54.437860
2020-11-28T18:02:45
2020-11-28T18:02:45
316,792,491
0
0
null
null
null
null
UTF-8
Java
false
false
818
java
public class Main { public static void main(String[] args) { //int a = 30 / 0; // int[] a = {1,2,3,4,5,6}; //System.out.println(a[10]); try { int b = 30 / 0; // Aritmetic Exception } catch(ArithmeticException e){ System.out.println("bir sayı sıfıra bölünemez"); } System.out.println("Burası çalışıyor "); try{ int[] a = {1,2,3}; System.out.println(a[5]); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Array in boyutunun aştınız"); } System.out.println("Burası çalışıyor "); } }
[ "osmaneminusta@gmail.com" ]
osmaneminusta@gmail.com
81c14005dafe494f911d8795b9e4641c315df9d5
d6de3bd8574333a697d8f9c607e95fda7d1163c1
/ahome-titanium/src/main/java/com/ait/toolkit/titanium/mobile/client/core/events/ui/DoubleTapEvent.java
4df1cabba9a332d7948c1c74c90b0424c7080039
[]
no_license
dikalo/ahome-titanium
c565a489778d5301a9517d3b7bf9331c0d7103e6
48104da303de2f8704728e199ac97e26b9a29fb2
refs/heads/master
2021-06-01T03:57:55.840203
2016-07-27T00:36:55
2016-07-27T00:36:55
30,990,755
0
1
null
null
null
null
UTF-8
Java
false
false
2,350
java
/* Copyright (c) 2014 Ahomé Innovation Technologies. 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.ait.toolkit.titanium.mobile.client.core.events.ui; import com.ait.toolkit.titanium.mobile.client.core.handlers.ui.DoubleTapHandler; import com.ait.toolkit.titanium.mobile.client.ui.Point; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.event.dom.client.DomEvent.Type; public class DoubleTapEvent extends InteractionEvent{ public static String EVENT_NAME = "doubletap"; /** * UiBinder implementations */ private static Type<DoubleTapHandler> TYPE = new Type<DoubleTapHandler>(EVENT_NAME, null); public static Type<DoubleTapHandler> getType() { return TYPE; } public static Type<DoubleTapHandler> getAssociatedType() { return TYPE; } protected DoubleTapEvent() { } private DoubleTapEvent(JavaScriptObject jso) { this.jsObj = jso; } public native double getX() /*-{ var jso = this.@com.ait.toolkit.core.client.JsObject::getJsObj()(); return jso.x; }-*/; public native double getY() /*-{ var jso = this.@com.ait.toolkit.core.client.JsObject::getJsObj()(); return jso.y; }-*/; private native double _getGlobalX() /*-{ var jso = this.@com.ait.toolkit.core.client.JsObject::getJsObj()(); return jso.globalPoint.x; }-*/; private native double _getGlobalY() /*-{ var jso = this.@com.ait.toolkit.core.client.JsObject::getJsObj()(); return jso.globalPoint.y; }-*/; public Point getGlobalPoint() { return new Point(_getGlobalX(), _getGlobalY()); } public native boolean bubbles() /*-{ var jso = this.@com.ait.toolkit.core.client.JsObject::getJsObj()(); return jso.bubbles; }-*/; public native boolean bubbleCanceled() /*-{ var jso = this.@com.ait.toolkit.core.client.JsObject::getJsObj()(); return jso.cancelBubble; }-*/; }
[ "alainekambi@alaineksmacbook.fritz.box" ]
alainekambi@alaineksmacbook.fritz.box
5f0f73ff59773aaa5c17a5d55d44aa4545450213
0c558cc7a3f321ed262aef9ededf9e0e506479a0
/src/main/java/com/graduation/oa/common/util/PageInfoSon.java
4e1ac27d79e849962f6cab8de5f1efd88ce1b9ef
[]
no_license
nupraz/oa-server
ae85fa3d8cc6d08da1267705cb906433101e04b1
29e5479a9191bb95f3dfa0209755bbad20c63971
refs/heads/master
2020-11-23T18:58:24.025156
2019-12-26T09:53:14
2019-12-26T09:53:14
227,778,189
0
0
null
null
null
null
UTF-8
Java
false
false
12,633
java
package com.graduation.oa.common.util; import com.graduation.oa.data.empOrderEntity.EmpOrderInfo; import com.github.pagehelper.PageInfo; import java.util.List; public class PageInfoSon<T> extends PageInfo<T> { @CommentAnno("补助金额统计") private double subsidySum; @CommentAnno("差旅工作量 售前工作量") private double numSum; @CommentAnno("差旅出差次数") private long totalSize; @CommentAnno("出差") private long count1; @CommentAnno("请假") private long count2; @CommentAnno("缺卡") private long count3; @CommentAnno("迟到/早退") private long count4; @CommentAnno("调休") private long count5; @CommentAnno("外出") private long count6; @CommentAnno("加班次数") private long count7; @CommentAnno("加班时间") private long count8; @CommentAnno("订餐费用sum") private long priceSum; @CommentAnno("订餐总数") private long orderCount; @CommentAnno("总不加班工作量") private String allWorkLoad; @CommentAnno("总加班工作量") private String allAddWorkLoad; @CommentAnno("总工作量") private String allSum; public String getAllWorkLoad() { return allWorkLoad; } public void setAllWorkLoad(String allWorkLoad) { this.allWorkLoad = allWorkLoad; } public String getAllAddWorkLoad() { return allAddWorkLoad; } public void setAllAddWorkLoad(String allAddWorkLoad) { this.allAddWorkLoad = allAddWorkLoad; } public String getAllSum() { return allSum; } public void setAllSum(String allSum) { this.allSum = allSum; } public long getOrderCount() { return orderCount; } public void setOrderCount(long orderCount) { this.orderCount = orderCount; } public long getPriceSum() { return priceSum; } public void setPriceSum(long priceSum) { this.priceSum = priceSum; } public double getNumSum() { return numSum; } public void setNumSum(double numSum) { this.numSum = numSum; } public double getSubsidySum() { return subsidySum; } public void setSubsidySum(double subsidySum) { this.subsidySum = subsidySum; } public static <T> PageInfoSon<T> convertPageInfo2PageSon(PageInfo<T> pageInfo, PageInfo<T> pageInfoAll) { PageInfoSon<T> tpageInfoSon = new PageInfoSon<>(); tpageInfoSon.setEndRow(pageInfo.getEndRow()); tpageInfoSon.setHasNextPage(pageInfo.isHasNextPage()); tpageInfoSon.setHasPreviousPage(pageInfo.isHasPreviousPage()); tpageInfoSon.setIsFirstPage(pageInfo.isIsFirstPage()); tpageInfoSon.setIsLastPage(pageInfo.isIsLastPage()); tpageInfoSon.setList(pageInfo.getList()); tpageInfoSon.setNavigateFirstPage(pageInfo.getNavigateFirstPage()); tpageInfoSon.setNavigateLastPage(pageInfo.getNavigateLastPage()); tpageInfoSon.setNavigatepageNums(pageInfo.getNavigatepageNums()); tpageInfoSon.setNavigatePages(pageInfo.getNavigatePages()); tpageInfoSon.setNextPage(pageInfo.getNextPage()); tpageInfoSon.setPageNum(pageInfo.getPageNum()); tpageInfoSon.setPages(pageInfo.getPages()); tpageInfoSon.setPageSize(pageInfo.getPageSize()); tpageInfoSon.setPrePage(pageInfo.getPrePage()); tpageInfoSon.setSize(pageInfo.getSize()); tpageInfoSon.setStartRow(pageInfo.getStartRow()); tpageInfoSon.setTotal(pageInfo.getTotal()); if (!(tpageInfoSon.getList() != null && tpageInfoSon.getList().size() > 0)){ return tpageInfoSon; } T t = tpageInfoSon.getList().get(0); List<T> listPageInfo = pageInfoAll.getList(); /*if (t instanceof PresaleSupportInfo) { //如果是售前信息 instancePresalesupportInfo(tpageInfoSon, listPageInfo); } if (t instanceof EmpTravel) { //如果是 instanceEmpTravel(tpageInfoSon, listPageInfo); } if (t instanceof EmpAttend) { instanceEmpAttend(tpageInfoSon,listPageInfo); }*/ if (t instanceof EmpOrderInfo) { instanceEmpOrderInfo(tpageInfoSon,listPageInfo); } /*if (t instanceof EmpDailyDTO){ instanceEmpDailyDTO(tpageInfoSon,listPageInfo); }*/ return tpageInfoSon; } /*private static <T> void instanceEmpDailyDTO(PageInfoSon<T> tpageInfoSon, List<T> listPageInfo) { if (listPageInfo != null && listPageInfo.size() > 0) { BigDecimal workLoadTemp = new BigDecimal(0.00); BigDecimal addWorkLoadTemp = new BigDecimal(0.00); for (T t : listPageInfo) { EmpDailyDTO empDailyDTO = (EmpDailyDTO) t; String workLoad = empDailyDTO.getWorkLoad(); if (workLoad != null && !"".equals(workLoad)) { BigDecimal v = new BigDecimal(0.00); try { v = new BigDecimal(workLoad); } catch (NumberFormatException e) { System.out.println("工作量数据有问题!"); } workLoadTemp = workLoadTemp.add(v); } String addWorkLoad = empDailyDTO.getAddWorkLoad(); if (addWorkLoad != null && !"".equals(addWorkLoad)) { BigDecimal v = new BigDecimal(0.00); try { v = new BigDecimal(addWorkLoad); }catch (NumberFormatException e){ System.out.println("加班工作量数据有问题!"); } addWorkLoadTemp = addWorkLoadTemp.add(v); } } BigDecimal allWorkLoadTemp = workLoadTemp.add(addWorkLoadTemp); tpageInfoSon.setAllAddWorkLoad(String.valueOf(addWorkLoadTemp)); tpageInfoSon.setAllWorkLoad(String.valueOf(workLoadTemp)); tpageInfoSon.setAllSum(String.valueOf(allWorkLoadTemp)); } }*/ private static <T> void instanceEmpOrderInfo(PageInfoSon<T> tpageInfoSon, List<T> list) { if (list != null && list.size() > 0) { tpageInfoSon.setOrderCount(list.size()); if (tpageInfoSon.getPriceSum() == 0) tpageInfoSon.setPriceSum(0); if (list.get(0) instanceof EmpOrderInfo) { Integer priceSum = 0; for (T t : list) { EmpOrderInfo t1 = (EmpOrderInfo) t; try { priceSum = priceSum + Integer.parseInt(t1.getPrice()); } catch (Exception e) { continue; } if (priceSum == null) priceSum = 0; tpageInfoSon.setPriceSum(priceSum); } } } } /*private static <T> void instancePresalesupportInfo(PageInfoSon<T> tpageInfoSon, List<T> list) { if (tpageInfoSon.getNumSum() == 0) tpageInfoSon.setNumSum(0); if (list != null && list.size() > 0) { if (list.get(0) instanceof PresaleSupportInfo) { for (T t : list) { PresaleSupportInfo t1 = (PresaleSupportInfo) t; double numSum = tpageInfoSon.getNumSum(); Integer workLoad = t1.getWorkLoad(); if (workLoad == null) workLoad = 0; tpageInfoSon.setNumSum(numSum + workLoad); } } } }*/ /*private static <T> void instanceEmpTravel(PageInfoSon<T> tpageInfoSon, List<T> list) { if (list != null && list.size() > 0) { tpageInfoSon.setTotalSize(list.size()); if (tpageInfoSon.getNumSum() == 0) tpageInfoSon.setNumSum(0); if (tpageInfoSon.getSubsidySum() == 0) tpageInfoSon.setSubsidySum(0); if (list.get(0) instanceof EmpTravel) { for (T t : list) { EmpTravel t1 = (EmpTravel) t; double numSum = tpageInfoSon.getNumSum(); double subsidyTotal = tpageInfoSon.getSubsidySum(); Double workLoad = 0.0; Double subsidy = 0.0; try { workLoad = Double.parseDouble(t1.getDays()); subsidy = t1.getTotalAmount().doubleValue(); } catch (Exception e) { continue; } if (workLoad == null) workLoad = 0.0; tpageInfoSon.setNumSum(numSum + workLoad); tpageInfoSon.setSubsidySum(subsidyTotal + subsidy); } } } }*/ public long getTotalSize() { return totalSize; } public void setTotalSize(long totalSize) { this.totalSize = totalSize; } public long getCount1() { return count1; } public void setCount1(long count1) { this.count1 = count1; } public long getCount2() { return count2; } public void setCount2(long count2) { this.count2 = count2; } public long getCount3() { return count3; } public void setCount3(long count3) { this.count3 = count3; } public long getCount4() { return count4; } public void setCount4(long count4) { this.count4 = count4; } public long getCount5() { return count5; } public void setCount5(long count5) { this.count5 = count5; } public long getCount6() { return count6; } public void setCount6(long count6) { this.count6 = count6; } public long getCount7() { return count7; } public void setCount7(long count7) { this.count7 = count7; } public long getCount8() { return count8; } public void setCount8(long count8) { this.count8 = count8; } /*private static <T> void instanceEmpAttend(PageInfoSon<T> tpageInfoSon, List<T> list) { long count1 = 0; // @CommentAnno("请假") long count2 = 0; // @("缺卡") long count3 = 0; // @CommentAnno("迟到/早退") long count4 = 0; // @CommentAnno("调休") long count5 = 0; // @CommentAnno("外出") long count6 = 0; // @CommentAnno("加班次数") long count7 = 0; // @CommentAnno("加班时间") long count8 = 0; if (tpageInfoSon.getNumSum() == 0) tpageInfoSon.setNumSum(0); if (list != null && list.size() > 0) { if (list.get(0) instanceof EmpAttend) { List<EmpAttend> collect = list.stream().map(s -> (EmpAttend) s).collect(Collectors.toList()); for (EmpAttend empAttend : collect) { String onDuty = empAttend.getOnDuty(); if (!StringUtils.isEmpty(onDuty)) { if (onDuty.endsWith("出差")) { count1++; } else if (onDuty.endsWith("请假")) { count2++; } else if (onDuty.endsWith("缺卡")) { count3++; } else if (onDuty.endsWith("调休")) { count5++; } else if (onDuty.endsWith("外出")) { count6++; } } Integer earlyMinute = empAttend.getEarlyMinute(); Integer lateMinute = empAttend.getLateMinute(); if ((earlyMinute!=null&&lateMinute!=null)&&(earlyMinute > 0 || lateMinute > 0)) { count4++; } Integer overtimeMinute = empAttend.getOvertimeMinute(); if (overtimeMinute!=null&&overtimeMinute > 0) { count7++; count8+=overtimeMinute; } tpageInfoSon.setCount1(count1); tpageInfoSon.setCount2(count2); tpageInfoSon.setCount3(count3); tpageInfoSon.setCount4(count4); tpageInfoSon.setCount5(count5); tpageInfoSon.setCount6(count6); tpageInfoSon.setCount7(count7); tpageInfoSon.setCount8(count8); } } } }*/ }
[ "lijiabing@bestvike.com" ]
lijiabing@bestvike.com
0ae6132fdfdfbd07064b84823f6771d3c3afeb1f
435b07c1d49cf553b6f8d473afd8e7d4331fe49e
/src/uspg/edu/EjemploPolimorfismo.java
12fffbca602dcefdc9b5963185b03abbfbc83728
[]
no_license
andreacetino/EjemploPolimorfismo
e36fe6db408922859267944f96fe4869cc649886
4a63da333369e742d90a57c71870c4e1d14f40b2
refs/heads/master
2022-12-12T19:29:45.201730
2020-09-05T21:49:14
2020-09-05T21:49:14
293,154,484
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package uspg.edu; /** * * @author Maria */ public class EjemploPolimorfismo { /** * @param args the command line arguments */ public static void main(String[] args) { Gallina gallina = new Gallina("Plumas", "omnivora",4); Serpiente serpiente = new Serpiente("Luci","Carnivoro", 6); gallina.Alimentarse(); serpiente.Alimentarse(); } }
[ "andriuscetinus@gmail.com" ]
andriuscetinus@gmail.com
89d6bb4fe6945b07aee4d047612940313fa65110
5100d82fbc0b94681101a172e935d1d47ed1ff11
/food-delivery-service-novice/src/main/java/datastore/DataStore.java
846f7b38fac627da3dc941702d3b9ec2901ee8a2
[]
no_license
ericdemo07/LowLevelDesign_Practice
3c9d708fe3fa3d0f2ec97f40e83c2d9d96e8cfc7
1d2321159b6a34cfd244219adec9295b61ddffeb
refs/heads/main
2023-08-25T04:30:41.023558
2021-10-15T17:54:56
2021-10-15T17:54:56
397,342,707
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package datastore; public class DataStore { private final RestaurantDatastore restaurantDatastore; private final UserDatastore userDatastore; public DataStore() { restaurantDatastore = new RestaurantDatastore(); userDatastore = new UserDatastore(); } }
[ "ericdemo07@gmail.com" ]
ericdemo07@gmail.com
53cd2a53fd0a4df120295b37db1f846960fa1ba3
f231fd7cb34b042a91addf2e96468cc08ab785e3
/courses/coursera-sandiego-algorithms/data-structures/assignment004/set_range_sum/SetRangeSum.java
566f493979da18693c2a8ed92d6774dabac92dba
[ "Apache-2.0" ]
permissive
xunilrj/sandbox
f1a0d7a1af536bea217bc713e748f04819c2480b
d65076ba487b8bf170368c9e0a0d23e0575fc09f
refs/heads/master
2023-05-10T09:27:59.541942
2023-04-26T15:39:25
2023-04-26T15:39:25
64,613,121
8
5
Apache-2.0
2023-03-07T01:57:24
2016-07-31T20:12:02
C++
UTF-8
Java
false
false
7,616
java
import java.io.*; import java.util.*; public class SetRangeSum { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; // Splay tree implementation // Vertex of a splay tree class Vertex { int key; // Sum of all the keys in the subtree - remember to update // it after each operation that changes the tree. long sum; Vertex left; Vertex right; Vertex parent; Vertex(int key, long sum, Vertex left, Vertex right, Vertex parent) { this.key = key; this.sum = sum; this.left = left; this.right = right; this.parent = parent; } } void update(Vertex v) { if (v == null) return; v.sum = v.key + (v.left != null ? v.left.sum : 0) + (v.right != null ? v.right.sum : 0); if (v.left != null) { v.left.parent = v; } if (v.right != null) { v.right.parent = v; } } void smallRotation(Vertex v) { Vertex parent = v.parent; if (parent == null) { return; } Vertex grandparent = v.parent.parent; if (parent.left == v) { Vertex m = v.right; v.right = parent; parent.left = m; } else { Vertex m = v.left; v.left = parent; parent.right = m; } update(parent); update(v); v.parent = grandparent; if (grandparent != null) { if (grandparent.left == parent) { grandparent.left = v; } else { grandparent.right = v; } } } void bigRotation(Vertex v) { if (v.parent.left == v && v.parent.parent.left == v.parent) { // Zig-zig smallRotation(v.parent); smallRotation(v); } else if (v.parent.right == v && v.parent.parent.right == v.parent) { // Zig-zig smallRotation(v.parent); smallRotation(v); } else { // Zig-zag smallRotation(v); smallRotation(v); } } // Makes splay of the given vertex and returns the new root. Vertex splay(Vertex v) { if (v == null) return null; while (v.parent != null) { if (v.parent.parent == null) { smallRotation(v); break; } bigRotation(v); } return v; } class VertexPair { Vertex left; Vertex right; VertexPair() { } VertexPair(Vertex left, Vertex right) { this.left = left; this.right = right; } } // Searches for the given key in the tree with the given root // and calls splay for the deepest visited node after that. // Returns pair of the result and the new root. // If found, result is a pointer to the node with the given key. // Otherwise, result is a pointer to the node with the smallest // bigger key (next value in the order). // If the key is bigger than all keys in the tree, // then result is null. VertexPair find(Vertex root, int key) { Vertex v = root; Vertex last = root; Vertex next = null; while (v != null) { if (v.key >= key && (next == null || v.key < next.key)) { next = v; } last = v; if (v.key == key) { break; } if (v.key < key) { v = v.right; } else { v = v.left; } } root = splay(last); return new VertexPair(next, root); } VertexPair split(Vertex root, int key) { VertexPair result = new VertexPair(); VertexPair findAndRoot = find(root, key); root = findAndRoot.right; result.right = findAndRoot.left; if (result.right == null) { result.left = root; return result; } result.right = splay(result.right); result.left = result.right.left; result.right.left = null; if (result.left != null) { result.left.parent = null; } update(result.left); update(result.right); return result; } Vertex merge(Vertex left, Vertex right) { if (left == null) return right; if (right == null) return left; while (right.left != null) { right = right.left; } right = splay(right); right.left = left; update(right); return right; } // Code that uses splay tree to solve the problem Vertex root = null; void insert(int x) { Vertex left = null; Vertex right = null; Vertex new_vertex = null; VertexPair leftRight = split(root, x); left = leftRight.left; right = leftRight.right; if (right == null || right.key != x) { new_vertex = new Vertex(x, x, null, null, null); } root = merge(merge(left, new_vertex), right); } void erase(int x) { // Implement erase yourself } boolean find(int x) { // Implement find yourself return false; } long sum(int from, int to) { VertexPair leftMiddle = split(root, from); Vertex left = leftMiddle.left; Vertex middle = leftMiddle.right; VertexPair middleRight = split(middle, to + 1); middle = middleRight.left; Vertex right = middleRight.right; long ans = 0; // Complete the implementation of sum return ans; } public static final int MODULO = 1000000001; void solve() throws IOException { int n = nextInt(); int last_sum_result = 0; for (int i = 0; i < n; i++) { char type = nextChar(); switch (type) { case '+' : { int x = nextInt(); insert((x + last_sum_result) % MODULO); } break; case '-' : { int x = nextInt(); erase((x + last_sum_result) % MODULO); } break; case '?' : { int x = nextInt(); out.println(find((x + last_sum_result) % MODULO) ? "Found" : "Not found"); } break; case 's' : { int l = nextInt(); int r = nextInt(); long res = sum((l + last_sum_result) % MODULO, (r + last_sum_result) % MODULO); out.println(res); last_sum_result = (int)(res % MODULO); } } } } SetRangeSum() throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main(String[] args) throws IOException { new SetRangeSum(); } String nextToken() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (Exception e) { eof = true; return null; } } return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } char nextChar() throws IOException { return nextToken().charAt(0); } }
[ "xunilrj@hotmail.com" ]
xunilrj@hotmail.com
7b949c3c553cfcdc3959d9082342282f1fc6aed7
20d4dad7ed347259252d18fa4510a09c5b0b46f5
/src/main/java/helper/GenericModel.java
355c1e41b9e424bc3cbbf2221d0b9b0e939e78d0
[]
no_license
tlhoang1211/WDC_Assignment
9c50e25d7134265826b4e542cf2f25b6890ce27e
68ac30a8954eb357bbe5b2bf65b1f57d304932b1
refs/heads/master
2023-05-24T09:38:05.186431
2021-06-11T11:53:02
2021-06-11T11:53:02
376,008,731
0
0
null
null
null
null
UTF-8
Java
false
false
30,415
java
package helper; import entity.SqlCondition; import annotation.Column; import annotation.Entity; import annotation.Id; import java.lang.reflect.Field; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class GenericModel<T> { private Class<T> clazz; public GenericModel(Class<T> clazz){ if (!clazz.isAnnotationPresent(Entity.class)){ System.err.printf("Class %s không được đăng ký làm việc với database.",clazz.getSimpleName()); return; } this.clazz = clazz; } // lưu thông tin đối tượng kiểu T public boolean save(T obj) { try { // Lấy ra giá trị của annotation @Entity vì cần những thông tin liên quan đến tableName. Entity entityInfor = clazz.getAnnotation(Entity.class); // Build lên câu query string. StringBuilder strQuery = new StringBuilder(); // Build chuỗi chứa giá trị các trường tương ứng. StringBuilder fieldValues = new StringBuilder(); fieldValues.append(SqlConstant.OPEN_PARENTHESES); // Xây dựng câu lệnh insert theo tên bảng, theo tên các field cùa đối tượng truyền vào. strQuery.append(SqlConstant.INSERT_INTO); // insert into strQuery.append(SqlConstant.SPACE); // strQuery.append(entityInfor.tableName()); // giangvien strQuery.append(SqlConstant.SPACE); // strQuery.append(SqlConstant.OPEN_PARENTHESES); // ( for (Field field : clazz.getDeclaredFields()) { // check xem trường có phải là @Column không. if (!field.isAnnotationPresent(Column.class)) { // bỏ qua trong trường hợp không được đánh là @Column. continue; } // cần set bằng true để có thể set, get giá trị của field trong một object nào đó. field.setAccessible(true); // lấy thông tin column để check tên trường, kiểu giá trị của trường. // Không lấy danh sách column theo tên field mà lấy theo annotation đặt tại field đó. Column columnInfor = field.getAnnotation(Column.class); // check xem trường có phải là id không. if (field.isAnnotationPresent(Id.class)) { // lấy thông tin id. Id idInfor = field.getAnnotation(Id.class); if (idInfor.autoIncrement()) { // trường hợp đây là trường tự tăng, thì next sang trường tiếp theo. continue; } } if (!columnInfor.auto()){ continue; } strQuery.append(columnInfor.columnName()); // nối tên trường. strQuery.append(SqlConstant.COMMON); //, strQuery.append(SqlConstant.SPACE); // // nhanh trí, xử lý luôn phần value, tránh sử dụng 2 vòng lặp. // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName()) || field.getType().getSimpleName().equals(Date.class.getSimpleName()) || field.getType().getSimpleName().equals(double.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } // lấy ra thông tin giá trị của trường đó tại obj truyền vào. fieldValues.append(field.get(obj)); // field.setAccessible(true); // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName()) || field.getType().getSimpleName().equals(Date.class.getSimpleName()) || field.getType().getSimpleName().equals(double.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } fieldValues.append(SqlConstant.COMMON); //, fieldValues.append(SqlConstant.SPACE); // } strQuery.setLength(strQuery.length() - 2); // trường hợp là field cuối cùng thì bỏ dấu , và khoảng trắng đi. fieldValues.setLength(fieldValues.length() - 2); strQuery.append(SqlConstant.CLOSE_PARENTHESES); // ) fieldValues.append(SqlConstant.CLOSE_PARENTHESES); // ) strQuery.append(SqlConstant.SPACE); strQuery.append(SqlConstant.VALUES); // values strQuery.append(SqlConstant.SPACE); strQuery.append(fieldValues); // nối giá trị các trường vào. System.out.println("lệnh insert \n"); System.out.println(strQuery.toString()); return ConnectionHelper.getConnection().createStatement().execute(strQuery.toString()); } catch (IllegalAccessException | SQLException e) { System.err.printf("Có lỗi xảy ra trong quá trình làm việc với database. Error %s.\n", e.getMessage()); } return true; } public List<T> findAll() { List<T> result = new ArrayList<>(); // khởi tạo một danh sách rỗng. Entity entityInfor = clazz.getAnnotation(Entity.class); StringBuilder stringQuery = new StringBuilder(); stringQuery.append(SqlConstant.SELECT_ASTERISK); // select * stringQuery.append(SqlConstant.SPACE); stringQuery.append(SqlConstant.FROM); // from stringQuery.append(SqlConstant.SPACE); stringQuery.append(entityInfor.tableName()); // tableName try { PreparedStatement preparedStatement = ConnectionHelper.getConnection().prepareStatement(stringQuery.toString()); // thực thi câu lệnh select * from. // trả về ResultSet (nó thêm thằng con trỏ) ResultSet resultSet = preparedStatement.executeQuery(); Field[] fields = clazz.getDeclaredFields(); // while (resultSet.next()) { // trỏ đến các bản ghi cho đến khi trả về false. T obj = clazz.newInstance(); // khởi tạo ra đối tượng cụ thể của class T. for (Field field : fields) { // check nếu không là @Column if (!field.isAnnotationPresent(Column.class)) { continue; } field.setAccessible(true); // lấy thông tin column để check tên trường, kiểu giá trị của trường. Column columnInfor = field.getAnnotation(Column.class); // tuỳ thuộc vào kiểu dữ liệu của trường, lấy giá trị ra theo các hàm khác nhau. // phải bổ sung các kiểu dữ liệu cần thiết. switch (field.getType().getSimpleName()) { case SqlConstant.PRIMITIVE_INT: // set giá trị của trường đó cho đối tượng mới tạo ở trên. field.set(obj, resultSet.getInt(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_STRING: field.set(obj, resultSet.getString(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_DOUBLE: field.set(obj, resultSet.getDouble(columnInfor.columnName())); break; } } // đối tượng obj kiểu T đã có đầy đủ giá trị. // add vào trong danh sách trả về. result.add(obj); } } catch (SQLException | InstantiationException | IllegalAccessException e) { System.err.printf("Có lỗi xảy ra trong quá trình làm việc với database. Error %s.\n", e.getMessage()); } return result; } public List<T> findAll(int page , int perPage) { List<T> result = new ArrayList<>(); // khởi tạo một danh sách rỗng. Entity entityInfor = clazz.getAnnotation(Entity.class); StringBuilder stringQuery = new StringBuilder(); stringQuery.append(SqlConstant.SELECT_ASTERISK); // select * stringQuery.append(SqlConstant.SPACE); stringQuery.append(SqlConstant.FROM); // from stringQuery.append(SqlConstant.SPACE); stringQuery.append(entityInfor.tableName()); // tableName stringQuery.append(SqlConstant.SPACE); stringQuery.append(SqlConstant.LIMIT); stringQuery.append(SqlConstant.SPACE); stringQuery.append(page * perPage); stringQuery.append(SqlConstant.COMMON); stringQuery.append(perPage); System.out.println(stringQuery.toString()); try { PreparedStatement preparedStatement = ConnectionHelper.getConnection().prepareStatement(stringQuery.toString()); // thực thi câu lệnh select * from. // trả về ResultSet (nó thêm thằng con trỏ) ResultSet resultSet = preparedStatement.executeQuery(); Field[] fields = clazz.getDeclaredFields(); // while (resultSet.next()) { // trỏ đến các bản ghi cho đến khi trả về false. T obj = clazz.newInstance(); // khởi tạo ra đối tượng cụ thể của class T. for (Field field : fields) { // check nếu không là @Column if (!field.isAnnotationPresent(Column.class)) { continue; } field.setAccessible(true); // lấy thông tin column để check tên trường, kiểu giá trị của trường. Column columnInfor = field.getAnnotation(Column.class); // tuỳ thuộc vào kiểu dữ liệu của trường, lấy giá trị ra theo các hàm khác nhau. // phải bổ sung các kiểu dữ liệu cần thiết. switch (field.getType().getSimpleName()) { case SqlConstant.PRIMITIVE_INT: // set giá trị của trường đó cho đối tượng mới tạo ở trên. field.set(obj, resultSet.getInt(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_STRING: field.set(obj, resultSet.getString(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_DOUBLE: field.set(obj, resultSet.getDouble(columnInfor.columnName())); break; case SqlConstant.DATE: field.set(obj,resultSet.getDate(columnInfor.columnName())); break; } } // đối tượng obj kiểu T đã có đầy đủ giá trị. // add vào trong danh sách trả về. result.add(obj); } } catch (SQLException | InstantiationException | IllegalAccessException e) { System.err.printf("Có lỗi xảy ra trong quá trình làm việc với database. Error %s.\n", e.getMessage()); } return result; } public T findById(String id) { Entity entity = clazz.getAnnotation(Entity.class); StringBuilder stringBuilder = new StringBuilder(); StringBuilder fieldValues = new StringBuilder(); stringBuilder.append(SqlConstant.SELECT_ASTERISK); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(SqlConstant.FROM); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(entity.tableName()); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(SqlConstant.WHERE); stringBuilder.append(SqlConstant.SPACE); for (Field field : clazz.getDeclaredFields()) { // check xem trường có phải là @Column không. if (!field.isAnnotationPresent(Column.class)) { // bỏ qua trong trường hợp không được đánh là @Column. continue; } // cần set bằng true để có thể set, get giá trị của field trong một object nào đó. field.setAccessible(true); Column columnInfor = field.getAnnotation(Column.class); if (field.isAnnotationPresent(Id.class)) { // lấy thông tin id. stringBuilder.append(columnInfor.columnName()); // nối tên trường. stringBuilder.append(SqlConstant.SPACE); // stringBuilder.append(SqlConstant.EQUAL); // stringBuilder.append(SqlConstant.SPACE); // // nhanh trí, xử lý luôn phần value, tránh sử dụng 2 vòng lặp. // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } // lấy ra thông tin giá trị của trường đó tại obj truyền vào. fieldValues.append(id); // field.setAccessible(true); // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } fieldValues.append(SqlConstant.SPACE); // stringBuilder.append(fieldValues); // } } try { PreparedStatement preparedStatement = ConnectionHelper.getConnection().prepareStatement(stringBuilder.toString()); // thực thi câu lệnh select * from. // trả về ResultSet (nó thêm thằng con trỏ) ResultSet resultSet = preparedStatement.executeQuery(); Field[] fields = clazz.getDeclaredFields(); // while (resultSet.next()) { // trỏ đến các bản ghi cho đến khi trả về false. T obj = clazz.newInstance(); // khởi tạo ra đối tượng cụ thể của class T. for (Field field : fields) { // check nếu không là @Column if (!field.isAnnotationPresent(Column.class)) { continue; } field.setAccessible(true); // lấy thông tin column để check tên trường, kiểu giá trị của trường. Column columnInfor = field.getAnnotation(Column.class); // tuỳ thuộc vào kiểu dữ liệu của trường, lấy giá trị ra theo các hàm khác nhau. // phải bổ sung các kiểu dữ liệu cần thiết. switch (field.getType().getSimpleName()) { case SqlConstant.PRIMITIVE_INT: // set giá trị của trường đó cho đối tượng mới tạo ở trên. field.set(obj, resultSet.getInt(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_STRING: field.set(obj, resultSet.getString(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_DOUBLE: field.set(obj, resultSet.getDouble(columnInfor.columnName())); break; case SqlConstant.DATE: field.set(obj,resultSet.getDate(columnInfor.columnName())); break; } } // đối tượng obj kiểu T đã có đầy đủ giá trị. // add vào trong danh sách trả về. return obj; } } catch (SQLException | InstantiationException | IllegalAccessException e) { System.err.printf("Có lỗi xảy ra trong quá trình làm việc với database. Error %s.\n", e.getMessage()); } System.out.println(stringBuilder.toString()); return null; } public T update(String id,T obj) throws InstantiationException, IllegalAccessException, SQLException { // Lấy ra giá trị của annotation @Entity vì cần những thông tin liên quan đến tableName. Entity entityInfor = clazz.getAnnotation(Entity.class); // Build lên câu query string. StringBuilder strQuery = new StringBuilder(); StringBuilder fieldValues = new StringBuilder(); // Xây dựng câu lệnh update theo tên bảng, theo tên các field cùa đối tượng truyền vào. strQuery.append(SqlConstant.UPDATE); // insert into strQuery.append(SqlConstant.SPACE); // strQuery.append(entityInfor.tableName()); // giangvien strQuery.append(SqlConstant.SPACE); // strQuery.append(SqlConstant.SET); // strQuery.append(SqlConstant.SPACE); // for (Field field : clazz.getDeclaredFields()) { // check xem trường có phải là @Column không. if (!field.isAnnotationPresent(Column.class)) { // bỏ qua trong trường hợp không được đánh là @Column. continue; } // cần set bằng true để có thể set, get giá trị của field trong một object nào đó. field.setAccessible(true); // lấy thông tin column để check tên trường, kiểu giá trị của trường. // Không lấy danh sách column theo tên field mà lấy theo annotation đặt tại field đó. Column columnInfor = field.getAnnotation(Column.class); if (!columnInfor.auto()){ continue; } // check xem trường có phải là id không. if (!field.isAnnotationPresent(Id.class)) { strQuery.append(columnInfor.columnName()); // nối tên trường. strQuery.append(SqlConstant.SPACE); // strQuery.append(SqlConstant.EQUAL); //, strQuery.append(SqlConstant.SPACE); // // nhanh trí, xử lý luôn phần value, tránh sử dụng 2 vòng lặp. // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName()) || field.getType().getSimpleName().equals(Date.class.getSimpleName()) || field.getType().getSimpleName().equals(double.class.getSimpleName())) { strQuery.append(SqlConstant.QUOTE); } strQuery.append(field.get(obj)); // fieldValues.append(field.get(obj)); // field.setAccessible(true); // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName()) || field.getType().getSimpleName().equals(Date.class.getSimpleName()) || field.getType().getSimpleName().equals(double.class.getSimpleName())) { strQuery.append(SqlConstant.QUOTE); } strQuery.append(SqlConstant.COMMON); // nối giá trị các trường vào. strQuery.append(SqlConstant.SPACE); // nối giá trị các trường vào. } } strQuery.setLength(strQuery.length() - 2); strQuery.append(SqlConstant.SPACE); strQuery.append(SqlConstant.WHERE); // nối giá trị các trường vào. strQuery.append(SqlConstant.SPACE); for (Field field1 : clazz.getDeclaredFields()) { // check xem trường có phải là @Column không. if (!field1.isAnnotationPresent(Column.class)) { // bỏ qua trong trường hợp không được đánh là @Column. continue; } // cần set bằng true để có thể set, get giá trị của field trong một object nào đó. field1.setAccessible(true); Column columnInfor = field1.getAnnotation(Column.class); if (field1.isAnnotationPresent(Id.class)) { // lấy thông tin id. strQuery.append(columnInfor.columnName()); // nối tên trường. strQuery.append(SqlConstant.SPACE); // strQuery.append(SqlConstant.EQUAL); // strQuery.append(SqlConstant.SPACE); // // nhanh trí, xử lý luôn phần value, tránh sử dụng 2 vòng lặp. // check kiểu của trường, nếu là string thì thêm dấu ' if (field1.getType().getSimpleName().equals(String.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } // lấy ra thông tin giá trị của trường đó tại obj truyền vào. fieldValues.append(id); // field.setAccessible(true); // check kiểu của trường, nếu là string thì thêm dấu ' if (field1.getType().getSimpleName().equals(String.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } fieldValues.append(SqlConstant.SPACE); // strQuery.append(fieldValues); // } } System.out.println("lệnh update \n"); System.out.println(strQuery.toString()); ConnectionHelper.getConnection().createStatement().execute(strQuery.toString()); return obj; } public boolean delete(String id) throws SQLException { try{ Entity entity = clazz.getAnnotation(Entity.class); StringBuilder stringBuilder = new StringBuilder(); StringBuilder fieldValues = new StringBuilder(); stringBuilder.append(SqlConstant.DELETE); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(SqlConstant.FROM); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(entity.tableName()); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(SqlConstant.WHERE); stringBuilder.append(SqlConstant.SPACE); for (Field field : clazz.getDeclaredFields()) { // check xem trường có phải là @Column không. if (!field.isAnnotationPresent(Column.class)) { // bỏ qua trong trường hợp không được đánh là @Column. continue; } // cần set bằng true để có thể set, get giá trị của field trong một object nào đó. field.setAccessible(true); Column columnInfor = field.getAnnotation(Column.class); if (field.isAnnotationPresent(Id.class)) { // lấy thông tin id. stringBuilder.append(columnInfor.columnName()); // nối tên trường. stringBuilder.append(SqlConstant.SPACE); // stringBuilder.append(SqlConstant.EQUAL); // stringBuilder.append(SqlConstant.SPACE); // // nhanh trí, xử lý luôn phần value, tránh sử dụng 2 vòng lặp. // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } // lấy ra thông tin giá trị của trường đó tại obj truyền vào. fieldValues.append(id); // field.setAccessible(true); // check kiểu của trường, nếu là string thì thêm dấu ' if (field.getType().getSimpleName().equals(String.class.getSimpleName())) { fieldValues.append(SqlConstant.QUOTE); } fieldValues.append(SqlConstant.SPACE); // stringBuilder.append(fieldValues); // } } System.out.println(stringBuilder.toString()); return ConnectionHelper.getConnection().createStatement().execute(stringBuilder.toString()); }catch (SQLException e){ System.err.printf("Có lỗi xảy ra trong quá trình làm việc với database. Error %s.\n", e.getMessage()); } return false; } public T findByColumns(HashMap<String, SqlCondition> hashMap){ Entity entity = clazz.getAnnotation(Entity.class); StringBuilder stringBuilder = new StringBuilder(); StringBuilder fieldValues = new StringBuilder(); stringBuilder.append(SqlConstant.SELECT_ASTERISK); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(SqlConstant.FROM); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(entity.tableName()); stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(SqlConstant.WHERE); stringBuilder.append(SqlConstant.SPACE); for (Field field : clazz.getDeclaredFields()) { // check xem trường có phải là @Column không. if (!field.isAnnotationPresent(Column.class)) { // bỏ qua trong trường hợp không được đánh là @Column. continue; } // cần set bằng true để có thể set, get giá trị của field trong một object nào đó. field.setAccessible(true); Column columnInfor = field.getAnnotation(Column.class); if (hashMap.containsKey(columnInfor.columnName())){ stringBuilder.append(columnInfor.columnName()); // nối tên trường. stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(hashMap.get(columnInfor.columnName()).getExpression()); stringBuilder.append(SqlConstant.SPACE); if (field.getType().getSimpleName().equals(String.class.getSimpleName())) { stringBuilder.append(SqlConstant.QUOTE); } stringBuilder.append(hashMap.get(columnInfor.columnName()).getValue()); if (field.getType().getSimpleName().equals(String.class.getSimpleName())) { stringBuilder.append(SqlConstant.QUOTE); } hashMap.remove(columnInfor.columnName()); if (hashMap.size() != 0){ stringBuilder.append(SqlConstant.SPACE); stringBuilder.append(SqlConstant.AND); stringBuilder.append(SqlConstant.SPACE); } } } try { PreparedStatement preparedStatement = ConnectionHelper.getConnection().prepareStatement(stringBuilder.toString()); // thực thi câu lệnh select * from. // trả về ResultSet (nó thêm thằng con trỏ) ResultSet resultSet = preparedStatement.executeQuery(); Field[] fields = clazz.getDeclaredFields(); // while (resultSet.next()) { // trỏ đến các bản ghi cho đến khi trả về false. T obj = clazz.newInstance(); // khởi tạo ra đối tượng cụ thể của class T. for (Field field : fields) { // check nếu không là @Column if (!field.isAnnotationPresent(Column.class)) { continue; } field.setAccessible(true); // lấy thông tin column để check tên trường, kiểu giá trị của trường. Column columnInfor = field.getAnnotation(Column.class); // tuỳ thuộc vào kiểu dữ liệu của trường, lấy giá trị ra theo các hàm khác nhau. // phải bổ sung các kiểu dữ liệu cần thiết. switch (field.getType().getSimpleName()) { case SqlConstant.PRIMITIVE_INT: // set giá trị của trường đó cho đối tượng mới tạo ở trên. field.set(obj, resultSet.getInt(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_STRING: field.set(obj, resultSet.getString(columnInfor.columnName())); break; case SqlConstant.PRIMITIVE_DOUBLE: field.set(obj, resultSet.getDouble(columnInfor.columnName())); break; case SqlConstant.DATE: field.set(obj,resultSet.getDate(columnInfor.columnName())); break; } } // đối tượng obj kiểu T đã có đầy đủ giá trị. // add vào trong danh sách trả về. return obj; } } catch (SQLException | InstantiationException | IllegalAccessException e) { System.err.printf("Có lỗi xảy ra trong quá trình làm việc với database. Error %s.\n", e.getMessage()); } System.out.println(stringBuilder.toString()); return null; } }
[ "46571690+tlhoang1211@users.noreply.github.com" ]
46571690+tlhoang1211@users.noreply.github.com
92cc58ecb172c2a6f82ff83b72161e9c9a526475
67fb5c5cf11e4a864ce849f14e0a42c60612beed
/access-service/src/main/java/com/teenthofabud/laundromat/infrastructure/access/operation/service/OperationService.java
cb29124e994134557bb98ab3a2fb1199ddae9199
[]
no_license
anirbandas18/laundromat-infrastructure-services
08e8ee34429658151aca65fbc090a67a4f7191ed
d54b97894579dd9efbd1983380afe53f31f77e03
refs/heads/main
2023-07-17T15:55:29.661229
2021-08-23T15:21:02
2021-08-23T15:21:02
398,782,543
0
0
null
null
null
null
UTF-8
Java
false
false
1,141
java
package com.teenthofabud.laundromat.infrastructure.access.operation.service; import com.teenthofabud.core.common.data.form.PatchOperationForm; import com.teenthofabud.laundromat.infrastructure.access.operation.data.OperationException; import com.teenthofabud.laundromat.infrastructure.access.operation.data.OperationForm; import com.teenthofabud.laundromat.infrastructure.access.operation.data.OperationVo; import org.springframework.stereotype.Service; import java.util.List; import java.util.Set; @Service public interface OperationService { public Set<OperationVo> retrieveAllByNaturalOrdering(); public OperationVo retrieveDetailsById(long id) throws OperationException; public List<OperationVo> retrieveAllMatchingDetailsByName(String name) throws OperationException; public Long createOperation(OperationForm form) throws OperationException; public void updateOperation(Long id, OperationForm form) throws OperationException; public void deleteOperation(Long id) throws OperationException; public void applyPatchOnOperation(Long id, List<PatchOperationForm> patches) throws OperationException; }
[ "anirbanstifler@gmail.com" ]
anirbanstifler@gmail.com
683de139f69177ed3b5a73702db00db2c396a674
d8cb63b174c8d37138eb524d5cd866443c39b12f
/CWH19PracticeSet.java
95c879ebc1cf7f1c9f5e4f2d833a86d41731e58c
[]
no_license
Dhavalkurkutiya/Java-Tutorial
fb875ebd0500a7006e4ca49f9d23b5ef6dd1a3cc
4567bad6a14cd497383aa8a9a56a4d4e8364ec99
refs/heads/master
2023-02-17T10:19:31.498010
2021-01-17T16:46:32
2021-01-17T16:46:32
330,435,479
0
0
null
null
null
null
UTF-8
Java
false
false
3,239
java
package com.dhavalkurkutiya; import java.util.Scanner; public class CWH19PracticeSet { public static void main(String[] args) { System.out.println("Java PracticeSet Tutorials"); // Question_1 /* int a = 10; if (a == 11) { System.out.println("I am a 11"); } else{ System.out.println(" I am a not 11"); } */ // Question_2 /* byte m1,m2,m3; Scanner sc = new Scanner(System.in); System.out.println("Enter your marks in Physics"); m1 = sc.nextByte(); System.out.println("Enter your marks in Chemistry"); m2 = sc.nextByte(); System.out.println("Enter your marks in Mathematics"); m3 = sc.nextByte(); float avg = (m1 + m2 + m3)/3.0f; System.out.println("You average " + avg + "% Percentage"); if (avg>40 && m1>33 && m2>33 && m3>33) { System.out.println("Congratulations you tha Pass"); } else{ System.out.println("Sorry you not a Pass"); } */ // Question_3 /* Scanner sc = new Scanner(System.in); System.out.println("Enter in income in lakhs"); float income = sc.nextFloat(); float tax = 0; if (income<2.5){ tax = tax + 0; } else if (income>2.5f && income<5f){ tax = tax + 0.05f * (income - 2.5f); } else if (income>5f && income<=10f){ tax = tax + 0.05f * (5.0f - 2.5f); tax = tax + 0.02f * (income - 5.0f); } else if (income<10f){ tax = tax + 0.05f * (5.0f - 2.5f); tax = tax + 0.02f * (10.0f - 5.0f); tax = tax + 0.03f * (income - 10.0f); } System.out.println("Tha total text pay by Employed: " + tax); */ // Question_3 /* Scanner sc = new Scanner(System.in); int day = sc.nextInt(); switch (day) { case 1: System.out.println("Monday"); break; case 2: System.out.println("Tuesday"); break; case 3: System.out.println("Wednesday"); break; case 4: System.out.println("Thursday"); case 5: System.out.println("Friday"); break; case 6: System.out.println("Saturday"); break; case 7: System.out.println("Sunday"); break; } */ // Question_4 Scanner s = new Scanner(System.in); System.out.print("Enter any year:"); int year = s.nextInt(); boolean flag = false; if (year % 400 == 0) { flag = true; } else if (year % 100 == 0) { flag = false; } else if (year % 4 == 0) { flag = true; } else { flag = false; } if (flag) { System.out.println("Year " + year + " is a Leap Year"); } else { System.out.println("Year " + year + " is not a Leap Year"); } // Question_5 /* Scanner sc = new Scanner(System.in); System.out.println("Enter any Website Example:google.com"); String website = sc.next(); if (website.endsWith(".org")){ System.out.println("This website Organization"); } else if(website.endsWith(".com")){ System.out.println("This website Commesyal"); } else if(website.endsWith(".in")){ System.out.println("This website India"); } */ } }
[ "kurkutiyadhaval30@gmail.com" ]
kurkutiyadhaval30@gmail.com
88d73730e1a7cbcce5a0f3e478bf7c8f33a17b30
ff8d3455acce9917399dbb85f695e664336645ed
/src/main/java/com/covid/dashboard/exception/PasswordIncorrectException.java
48f66ea1e3be3ba599b678c51f218d80208010ce
[ "MIT" ]
permissive
nquillin91/covid_dashboard_backend
cf63d061330fd94a483a570b09535662f88e2b38
7e608874c903882ee93cdf0f4e11f58a3e32576e
refs/heads/master
2023-03-21T00:18:50.953796
2021-03-20T05:32:53
2021-03-20T05:32:53
344,969,279
0
0
null
null
null
null
UTF-8
Java
false
false
254
java
package com.covid.dashboard.exception; public class PasswordIncorrectException extends Exception { private static final long serialVersionUID = 9085786805969353508L; public PasswordIncorrectException(String errorMessage) { super(errorMessage); } }
[ "nquillin91@gmail.com" ]
nquillin91@gmail.com
57f0a893cabe709d00a66fbf9c4dfb62626a80d4
8dd3d9d51f9b2e81a0b00cc44db5503e6de0ed93
/src/test/java/com/ThoughtWorks/DDD/account/domain/UserTest.java
969b725589c4a3204fdd2167b0fdb152fd9e8d11
[ "MIT" ]
permissive
DDD-MicroService-Kata/petstore-account
a25b193b3db28e1ed69529c105d140b60dd88440
e8d8fb08d4978395d1ddb4dd335bb850a046fbba
refs/heads/master
2021-08-23T15:26:59.313824
2017-12-05T12:09:37
2017-12-05T12:09:37
112,363,968
0
0
null
null
null
null
UTF-8
Java
false
false
1,740
java
package com.ThoughtWorks.DDD.account.domain; import org.junit.Before; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; public class UserTest { private User customer; private String initEmailAddress; private String initPhoneNumber; @Before public void setUp() throws Exception { initEmailAddress = "james@gmail.com"; initPhoneNumber = "13200001111"; customer = new User("James", "Merson", new Contacts(initPhoneNumber, initEmailAddress)); } @Test public void should_be_able_to_change_the_user_email_address() throws Exception { String newEmailAddress = "james.merson@gmail.com"; assertThat(customer.changeEmailAddressTo(newEmailAddress)).isTrue(); assertThat(customer.getContacts().getEmailAddress()).isEqualTo(newEmailAddress); } @Test public void should_not_be_allowed_to_change_given_email_address_same_as_before() throws Exception { assertThat(customer.changeEmailAddressTo(initEmailAddress)).isFalse(); assertThat(customer.getContacts().getEmailAddress()).isEqualTo(initEmailAddress); } @Test public void should_be_able_to_change_the_user_phone_number() throws Exception { String newPhoneNumber = "12311110000"; assertThat(customer.changePhoneNumberTo(newPhoneNumber)).isTrue(); assertThat(customer.getContacts().getPhoneNumber()).isEqualTo(newPhoneNumber); } @Test public void should_not_be_allowed_to_change_given_phone_number_same_as_before() throws Exception { assertThat(customer.changePhoneNumberTo(initPhoneNumber)).isFalse(); assertThat(customer.getContacts().getPhoneNumber()).isEqualTo(initPhoneNumber); } }
[ "qianyan@thoughtworks.com" ]
qianyan@thoughtworks.com
d38f13a19fd7fed258462a6e00c042e2daf1a5ed
529020ab9f3a7f26a85961758e8fd8f2dea0b005
/app/src/main/java/com/alexchurkin/truckremote/TruckRemote.java
6e4473084154b73aff736ae8ae5e57f28b6982bf
[ "Apache-2.0" ]
permissive
alexChurkin/TruckRemoteControl
11987853f78a21acf1d22044dc690d7e2b5c73b2
b3b31893b4db24602bcaaeb96c17cd710a9a1b33
refs/heads/master
2022-05-06T06:49:49.705912
2021-11-20T12:01:37
2021-11-20T12:01:37
218,829,068
11
5
null
null
null
null
UTF-8
Java
false
false
726
java
package com.alexchurkin.truckremote; import static com.alexchurkin.truckremote.helpers.LogMan.logD; import androidx.multidex.MultiDexApplication; import com.alexchurkin.truckremote.helpers.AdManager; import com.alexchurkin.truckremote.helpers.BillingMan; import com.alexchurkin.truckremote.helpers.Prefs; import com.alexchurkin.truckremote.helpers.Toaster; public class TruckRemote extends MultiDexApplication { public static BillingMan billingMan; @Override public void onCreate() { super.onCreate(); logD(">> Application: onCreate"); Prefs.initialize(this); Toaster.initialize(this); AdManager.init(this); billingMan = BillingMan.getInstance(this); } }
[ "churkindev@gmail.com" ]
churkindev@gmail.com
b15e334cbcd4838e2af2859c7b13e4097fd41037
95fa566ac7e1d0eefd5297756f458831c6421fd7
/part2/Chapter5/SampleDrawer/app/src/main/java/com/example/drawer/Fragment6.java
e3e51eefef0bb5199f5c9e60cbd89434e4b9ae94
[]
no_license
DahamLeee/Practice_Android
dc6a4f1ec99a0add5ee93337f3c779b77a79a92d
a93fdfb7a201f326ccf7f9a9547f3f233da78158
refs/heads/master
2020-05-03T10:39:51.475094
2019-11-27T07:42:58
2019-11-27T07:42:58
178,583,861
0
0
null
null
null
null
UTF-8
Java
false
false
558
java
package com.example.drawer; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class Fragment6 extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment6, container, false); } }
[ "dlek1011@gmail.com" ]
dlek1011@gmail.com
cfa12a96de6db780de80c6201bbab235f8563940
81074b368bcaa88f4b370201a5eb3f527dae60a7
/apps/sluzbenik/team9/src/main/java/projectXML/team9/soap/TXSLTDocumentDTO.java
27cad57275e7f11ef5e57b3443d0ca667281ca55
[]
no_license
jelenac11/XML_Tim10
2491780d416064acdeb1bf86151c96f9c4e71655
739f1f492b01e92f942ff38c70c120e7e9db2b36
refs/heads/main
2023-03-02T21:08:53.132878
2021-02-06T23:00:20
2021-02-06T23:00:20
307,840,406
0
0
null
2021-02-06T22:49:31
2020-10-27T22:11:58
HTML
UTF-8
Java
false
false
500
java
package projectXML.team9.soap; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "xsltRoot", propOrder = { "xslt" }) @Getter @Setter @NoArgsConstructor public class TXSLTDocumentDTO { @XmlElement(required = true) String xslt; }
[ "52001925+jelenac11@users.noreply.github.com" ]
52001925+jelenac11@users.noreply.github.com
3b3d61d02c0eb3ff1f8f8f2c92b821820659ce0e
4324a5f22b22fcc44a4f96b1ae87a68ac28525f8
/src/main/java/com/helloaws/ec2/hello/HomeController.java
7449f7644b73423d5c671fe7cbf66a2d74654bb1
[]
no_license
qoxogus/hello-aws
b657b53e315a0dc206b64f013281f981930e595a
7a9f549c79aff4a717347c83311413902fcf67be
refs/heads/master
2023-03-30T03:26:14.263825
2021-04-06T10:48:24
2021-04-06T10:48:24
355,139,763
0
0
null
null
null
null
UTF-8
Java
false
false
297
java
package com.helloaws.ec2.hello; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class HomeController { @GetMapping("/hello") public String hello() { return "Hello World!"; } }
[ "a01034367055@gmail.com" ]
a01034367055@gmail.com
cd718ffee7f2463594926e826e9f57d5279e8ff8
cf52b3064d536af626339ddd30b28c0b8e15aaee
/gameserver/src/main/java/org/l2junity/gameserver/model/skills/conditiontypes/CannotUseInTransformSkillCondition.java
81c203454b552038a98004062e85f53cd0a6573b
[]
no_license
LegacyofAden/emu-ungp
7aaa7d9fd60698cb784d8c2c1eaaa20ef0a8d59b
b76dc91157e43d67f886b6926afd11b110ed5dce
refs/heads/master
2021-01-01T18:21:03.529671
2017-04-08T23:08:37
2017-04-08T23:08:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
/* * Copyright (C) 2004-2015 L2J Unity * * This file is part of L2J Unity. * * L2J Unity is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * L2J Unity is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.l2junity.gameserver.model.skills.conditiontypes; import org.l2junity.gameserver.model.StatsSet; import org.l2junity.gameserver.model.WorldObject; import org.l2junity.gameserver.model.actor.Creature; import org.l2junity.gameserver.model.skills.ISkillCondition; import org.l2junity.gameserver.model.skills.Skill; /** * @author Sdw */ public class CannotUseInTransformSkillCondition implements ISkillCondition { private final int _transformId; public CannotUseInTransformSkillCondition(StatsSet params) { _transformId = params.getInt("transformId", -1); } @Override public boolean canUse(Creature caster, Skill skill, WorldObject target) { return (_transformId > 0) ? caster.getTransformationId() != _transformId : !caster.isTransformed(); } }
[ "RaaaGEE@users.noreply.github.com" ]
RaaaGEE@users.noreply.github.com
fa6ed543b393a010004b0999262590ada983fd61
cb514e6b1640d939c2603314b786cf29214e2acc
/crawler3/src/main/java/domain/models/manufacturers/Emtek.java
789924d5ec745d80b8bdcd5dae2ca774a7504b5e
[]
no_license
davidmcnight/demo
91dd4a4b00ca0c9d502ec8eb4b0d40f9222683f3
90c32e65495529083816e22849a0795aecb9261c
refs/heads/master
2022-01-08T00:57:54.625967
2019-06-19T23:55:29
2019-06-19T23:55:29
192,604,657
0
0
null
null
null
null
UTF-8
Java
false
false
11,055
java
package domain.models.manufacturers; import com.sun.beans.decoder.ElementHandler; import config.Config; import controllers.SpecBooksController; import domain.models.ICrawler; import domain.models.Manufacturer; import domain.models.Product; import domain.services.ProductService; import edu.uci.ics.crawler4j.crawler.Page; import edu.uci.ics.crawler4j.url.WebURL; import helpers.ElementPatterns; import helpers.StringManipulation; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.*; import org.apache.poi.util.StringUtil; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.json.JSONObject; import org.jsoup.Connection; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.openqa.selenium.json.Json; import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; import java.util.Iterator; public class Emtek extends Manufacturer implements ICrawler { public int manufacturer_id = 206; public ArrayList<String> getSeeds() { ArrayList<String> seeds = new ArrayList<String>(); seeds.add("https://emtek.com/bath-hardware/sandcast-bronze-towel-ring"); return seeds; } @Override public boolean shouldVisit(Page referringPage, WebURL url) { String href = url.getURL().toLowerCase(); if(href.contains("plus.google.com") || href.contains("myFoldersNotLoggedIn") || href.contains("product.language") || href.contains("facebook") || href.contains("designservice") || href.contains("smartbim") || href.contains("youtube") || href.contains("add-to-cart") || href.contains("blog") ){ return false; }else { if(href.contains("emtek.com")){ return super.shouldVisit(referringPage, url); } } return false; } @Override public void visit(Page page) { try { Document document = Jsoup.connect(page.getWebURL().getURL()).userAgent(Config.USER_AGENT).followRedirects(true). timeout(0). get();; String url = document.location(); System.out.println(String.valueOf(SpecBooksController.PAGE_COUNTER) + ") " + document.location()); SpecBooksController.PAGE_COUNTER++; ArrayList<Product> products = new ArrayList<Product>(); if(!document.select(".detailsection").isEmpty()) { FileInputStream file = new FileInputStream(new File("price-sheets/emtek-2.xlsx")); Workbook workbook = new XSSFWorkbook(file); Sheet sheet = workbook.getSheetAt(0); //product Product product = new Product(); product.setUrl(document.location()); FileInputStream finishFile = new FileInputStream(new File("finish-code-files/emtek-fc.xlsx")); Workbook finishBook = new XSSFWorkbook(finishFile); Sheet finishSheet = finishBook.getSheetAt(0); JSONObject finishJson = new JSONObject(); for (Row row2 : finishSheet) { Cell key = row2.getCell(1); Cell value = row2.getCell(0); finishJson.put(key.getStringCellValue().trim(), value.getStringCellValue().trim()); } JSONObject imageSrcs = new JSONObject(); Elements images = document.select(".bs-background img"); if(!images.isEmpty()){ for (Element image: images){ String src = image.attr("abs:src"); String[] imgMnAr = src.split("_"); if(imgMnAr[imgMnAr.length - 1].toUpperCase().contains("OS") ||imgMnAr[imgMnAr.length - 1].toUpperCase().contains("emtek")){ String imgMn = imgMnAr[imgMnAr.length - 2].split("\\.")[0].trim() + imgMnAr[imgMnAr.length - 1].split("\\.")[0].trim(); imgMn = imgMn.replace("OS","").trim(); imgMn = imgMn.replace("emtek","").trim(); imageSrcs.put(imgMn.trim().replace("OS", "").trim(), src); }else { String imgMn = imgMnAr[imgMnAr.length - 1].split("\\.")[0].trim(); imageSrcs.put(imgMn.replace("OS","").trim(), src); } } } ArrayList<String> productCodes = new ArrayList<String>(); Elements codesHtml = document.select("#codes"); if(!codesHtml.isEmpty()){ String[] codes = codesHtml.text().split(" "); for (String code : codes){ if (StringUtils.isNumeric(code)){ productCodes.add(code); // productCodes.add("BTB" + code); // productCodes.add("C" + code); // productCodes.add("W" + code); // productCodes.add("F13" + code); // productCodes.add("F20" + code); // productCodes.add("F" + code); } } } // System.exit(0); // // if(!codesHtml.isEmpty()){ // String[] lines = codesHtml.html().split("<br>"); // for (String line : lines){ // if(line.contains(":")){ // productCodes.add(line.split(":")[1].replace("</p>", "").trim()); // } // } // } Elements specs = document.select("#specs a"); if(!specs.isEmpty()){ for (Element spec: specs){ if(spec.text().toLowerCase().contains("install")){ product.setInstallationDocument(spec.attr("abs:href")); } if(spec.text().toLowerCase().contains("spec")){ product.setSpecificationDocument(spec.attr("abs:href")); } } } for (String pc: productCodes){ int counter = 1; for (Row row : sheet) { if(counter != 1){ DataFormatter formatter = new DataFormatter(); String val = formatter.formatCellValue(row.getCell(0)); String name = formatter.formatCellValue(row.getCell(1)); String price = String.valueOf(row.getCell(2).toString()).trim(); String sku = val; if(sku.startsWith(pc)){ // Product finishProduct = new Product(product); finishProduct.setName(name); finishProduct.setImageLink(""); finishProduct.setListPrice(price); finishProduct.setModelNumber(sku); Iterator<String> keys = imageSrcs.keys(); // System.out.println(name); // System.out.println(sku); // System.out.println(imageSrcs); // System.out.println("_________________________________________________________________"); finishProduct.setImageLink(""); while(keys.hasNext()) { String key = keys.next(); if(name.toLowerCase().contains(key.toLowerCase())){ if(imageSrcs.has(key)){ finishProduct.setImageLink(imageSrcs.getString(key)); }else { finishProduct.setImageLink(images.first().attr("abs:src")); } } } if(finishProduct.getImageLink().length() < 5){ finishProduct.setImageLink(images.first().attr("abs:src")); } Iterator<String> finishKeys = finishJson.keys(); while(finishKeys.hasNext()) { String finishKey = finishKeys.next(); if(finishProduct.getName().toLowerCase().contains(finishKey.toLowerCase())){ if(finishJson.has(finishKey)){ String finishName = finishJson.getString(finishKey); finishName = finishName.toLowerCase(); finishName = StringManipulation.capitalCase(finishName); finishProduct.setName(finishProduct.getName().replace(finishKey, finishName)); finishProduct.setFinishes(finishName); } } } products.add(finishProduct); } } counter++; } } for (Product p : products){ System.out.println("PRODUCT..............."); System.out.println(p); // if(!ProductService.doesSkuExist(p.getModelNumber(), this.manufacturer_id)){ Thread thread = new Thread(); Thread th= new Thread(thread); th.start(); Thread.sleep(500); ProductService.createProduct(p, this.manufacturer_id); // }else { // System.out.println(p.getModelNumber() + ": exists for that manufacturer."); // } } // System.exit(0); System.out.println("_________________________________________"); SpecBooksController.PRODUCT_COUNTER++; // if (SpecBooksController.PRODUCT_COUNTER > 1) { // System.exit(0); // } } } catch (Exception e) { e.printStackTrace(); } } }
[ "specbooks@Roberts-MBP-899.attlocal.net" ]
specbooks@Roberts-MBP-899.attlocal.net
d7ff798741bfe1c8ad5a106196d0d03761ada371
62086a5702431bcfcb4c1edba9d6e174eaf70272
/src/main/java/com/attendee/attendee/sms/SmsService.java
3a9e52aa57f4cce33fae6d841b3cfd9ba1e5f03f
[]
no_license
christbiz86/project-attendees
ed6dc27991efe23753c95089a701be5cc038247b
80543d5a02bb02ef3b5a3de180ff8b65af507d77
refs/heads/master
2020-06-28T09:01:06.482949
2019-10-08T07:17:27
2019-10-08T07:17:27
200,193,454
0
0
null
2019-08-26T04:13:56
2019-08-02T08:06:54
Java
UTF-8
Java
false
false
1,633
java
package com.attendee.attendee.sms; import org.springframework.stereotype.Service; import com.aliyuncs.CommonRequest; import com.aliyuncs.CommonResponse; import com.aliyuncs.DefaultAcsClient; import com.aliyuncs.IAcsClient; import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.exceptions.ServerException; import com.aliyuncs.http.MethodType; import com.aliyuncs.profile.DefaultProfile; @Service public class SmsService { private static final String domain = "dysmsapi.ap-southeast-1.aliyuncs.com"; private static final String regionId="ap-southeast-1"; private static final String accessKeyId = "LTAIgIip5nffvLF5"; private static final String accessKeySecret = "HhLtxTftFss1tEevTDMQRmbxyFwJue"; public void sendSms(Sms sms) throws Exception{ DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); IAcsClient client = new DefaultAcsClient(profile); CommonRequest request = new CommonRequest(); request.setMethod(MethodType.POST); request.setDomain(domain); request.setVersion("2018-05-01"); request.setAction("SendMessageToGlobe"); request.putQueryParameter("To", sms.getPhoneNumber()); request.putQueryParameter("Message", sms.getMessage()); try { CommonResponse response = client.getCommonResponse(request); System.out.println(response.getData()); } catch (ServerException e) { e.printStackTrace(); throw new Exception(e.getMessage()); } catch (ClientException e) { e.printStackTrace(); throw new Exception(e.getMessage()); } } }
[ "agungdamassaputra@gmail.com" ]
agungdamassaputra@gmail.com
d97193b4aa56601587edf6026aebc5787cc2fbf7
8f84b92a84c5a2f5a640ca0a7cbba3cfa957154d
/mediatek/packages/apps/RCSe/core/src/com/orangelabs/rcs/core/ims/service/richcall/video/VideoSdpBuilder.java
4d1991f5f2fc47d9f4f106bf0f3a7373d73227b3
[ "BSD-2-Clause", "Apache-2.0", "NIST-PD" ]
permissive
Al3XKOoL/MT65x2_kernel_lk
c7a23c2d41fb4c593d1bb9054a15d3b51ffaa224
51fe3f27e90e42dbdebae928e6b787f82bee4ddc
refs/heads/master
2021-01-18T10:25:35.483668
2015-03-25T07:17:37
2015-03-25T07:17:37
32,857,246
0
4
null
2015-03-25T10:16:26
2015-03-25T10:16:26
null
UTF-8
Java
false
false
6,970
java
/******************************************************************************* * Software Name : RCS IMS Stack * * Copyright (C) 2010 France Telecom S.A. * * 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.orangelabs.rcs.core.ims.service.richcall.video; import java.util.Vector; import com.orangelabs.rcs.core.ims.network.sip.SipUtils; import com.orangelabs.rcs.core.ims.protocol.rtp.RtpUtils; import com.orangelabs.rcs.core.ims.protocol.sdp.MediaDescription; import com.orangelabs.rcs.service.api.client.media.MediaCodec; import com.orangelabs.rcs.service.api.client.media.video.VideoCodec; import com.orangelabs.rcs.utils.logger.Logger; /** * Builds the Video SDP * * @author Deutsche Telekom */ public class VideoSdpBuilder { /** * Extension attribute name, RFC5285 */ public static final String ATTRIBUTE_EXTENSION = "extmap"; /** * The logger */ private static Logger logger = Logger.getLogger(VideoSdpBuilder.class.getName()); /** * Build SDP offer without the orientation extension ordered by the * preferred codec * * @param supportedCodecs Codecs to create SDP * @param localRtpPort Local RTP port * @return SDP offer */ public static String buildSdpOfferWithoutOrientation(MediaCodec[] supportedCodecs, int localRtpPort) { StringBuilder result = new StringBuilder(); // Create video codec list Vector<VideoCodec> codecs = new Vector<VideoCodec>(); for (int i = 0; i < supportedCodecs.length; i++) { codecs.add(new VideoCodec(supportedCodecs[i])); } result.append("m=video " + localRtpPort + " RTP/AVP"); for (VideoCodec codec : codecs) { result.append(" ").append(codec.getPayload()); } result.append(SipUtils.CRLF); int framerate = 0; for (VideoCodec codec : codecs) { if (codec.getFramerate() > framerate) { framerate = codec.getFramerate(); } } if (framerate > 0) { result.append("a=framerate:" + framerate + SipUtils.CRLF); } for (VideoCodec codec : codecs) { result.append("a=rtpmap:" + codec.getPayload() + " " + codec.getCodecName() + "/" + codec.getClockRate() + SipUtils.CRLF); if (codec.getWidth() != 0 && codec.getHeight() != 0) { result.append("a=framesize:" + codec.getPayload() + " " + codec.getWidth() + "-" + codec.getHeight() + SipUtils.CRLF); } result.append("a=fmtp:" + codec.getPayload() + " " + codec.getCodecParams() + SipUtils.CRLF); } return result.toString(); } /** * Build SDP offer without the orientation extension ordered by the * preferred codec * * @param supportedCodecs Codecs to create SDP * @param localRtpPort Local RTP port * @return SDP offer */ public static String buildSdpOfferWithOrientation(MediaCodec[] supportedCodecs, int localRtpPort) { StringBuilder sdp = new StringBuilder(buildSdpOfferWithoutOrientation(supportedCodecs, localRtpPort)) .append("a=").append(ATTRIBUTE_EXTENSION).append(':').append(RtpUtils.RTP_DEFAULT_EXTENSION_ID) .append(" " + SdpOrientationExtension.VIDEO_ORIENTATION_URI).append(SipUtils.CRLF); return sdp.toString(); } /** * Create the SDP part for a given codec * * @param codec Media codec * @param localRtpPort Local RTP port * @return SDP */ private static String buildSdpWithoutOrientation(MediaCodec codec, int localRtpPort) { if (codec == null) { logger.info("Invalid codec"); return ""; } VideoCodec videoCodec = new VideoCodec(codec); StringBuilder sdp = new StringBuilder() .append("m=video ").append(localRtpPort).append(" RTP/AVP ") .append(videoCodec.getPayload()).append(SipUtils.CRLF) .append("a=rtpmap:").append(videoCodec.getPayload()).append(" ") .append(videoCodec.getCodecName()).append("/") .append(videoCodec.getClockRate()).append(SipUtils.CRLF); if (videoCodec.getWidth() != 0 && videoCodec.getHeight() != 0) { sdp.append("a=framesize:").append(videoCodec.getPayload()).append(" ") .append(videoCodec.getWidth()).append("-").append(videoCodec.getHeight()) .append(SipUtils.CRLF); } if (videoCodec.getFramerate() != 0) { sdp.append("a=framerate:").append(videoCodec.getFramerate()).append(SipUtils.CRLF); } sdp.append("a=fmtp:").append(videoCodec.getPayload()).append(" ") .append(videoCodec.getCodecParams()).append(SipUtils.CRLF); return sdp.toString(); } /** * Create the SDP part with orientation extension for a given codec * * @param codec Media Codec * @param localRtpPort Local RTP Port * @param extensionId * @return SDP */ private static String buildSdpWithOrientationExtension(MediaCodec codec, int localRtpPort, int extensionId) { StringBuilder sdp = new StringBuilder(buildSdpWithoutOrientation(codec, localRtpPort)) .append("a=").append(ATTRIBUTE_EXTENSION).append(':').append(extensionId) .append(" " + SdpOrientationExtension.VIDEO_ORIENTATION_URI).append(SipUtils.CRLF); return sdp.toString(); } /** * Builds the {@link MediaCodec} SDP for a SIP INVITE response. If the SIP * INVITE SDP doesn't have the orientation extension then the response SDP * also shouldn't have. * * @param codec Media Codec * @param localRtpPort Local RTP Port * @param videoMedia Invite video media * @return SDP answer */ public static String buildSdpAnswer(MediaCodec codec, int localRtpPort, MediaDescription inviteVideoMedia) { if (inviteVideoMedia != null) { SdpOrientationExtension extension = SdpOrientationExtension.create(inviteVideoMedia); if (extension != null) { return buildSdpWithOrientationExtension(codec, localRtpPort, extension.getExtensionId()); } } return buildSdpWithoutOrientation(codec, localRtpPort); } }
[ "inspektor.po13@gmail.com" ]
inspektor.po13@gmail.com
9a4c5bf0ffde0373f7b1a5784c5105ca372bf239
d6e4df45aa8ad0a968ba11d2c66dcae5544a1d5f
/app/src/main/java/com/haitian/servicestaffapp/utils/permisson/PermissionInterface.java
a3d758e7d17630232520224a9f1fdb18a6f68054
[]
no_license
zps18075713849/ServiceStaffApp
5917862b7f7ea4121a752ba069502d0089da2b53
98b98b0a45b8ab999865d176b19fa216e0247330
refs/heads/main
2023-06-03T04:38:17.442804
2021-06-22T01:24:25
2021-06-22T01:24:25
346,547,481
0
1
null
null
null
null
UTF-8
Java
false
false
345
java
package com.haitian.servicestaffapp.utils.permisson; /** * Created by chong.han on 2018/10/29. */ public interface PermissionInterface { /** * 请求权限成功回调 */ void requestPermissionsSuccess(int callBackCode); /** * 请求权限失败回调 */ void requestPermissionsFail(int callBackCode); }
[ "1452607642@qq.com" ]
1452607642@qq.com
759ceec8383448ab3e95922b8d299c23ab874f11
957237559c65893aa416e2cd1067279ce1d0edb5
/app/src/main/java/kr/co/tjoeun/myinfo/myInfoActivity.java
4bff7e8f6ff0fb2d41d9193dd0c96e38952c4837
[]
no_license
chdltms1/myTest
4c5d6754ddf4a73a390afb89028e589e2ccd80cd
273d8c09751df6f739bc1338b5dfc7c81252a498
refs/heads/master
2021-03-31T16:46:23.685045
2020-03-18T02:33:12
2020-03-18T02:33:12
248,120,740
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package kr.co.tjoeun.myinfo; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class myInfoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_info); } }
[ "61855480+chdltms1@users.noreply.github.com" ]
61855480+chdltms1@users.noreply.github.com
4c0db771897c0dc40beb0ac8daa3e0b8ab9d9101
12a187679c1773a4ffd24ad5ea5e04fc59c58ed8
/a2-starter/constructor example/Course.java
fac38d3eb0ed0e3f0569f5570f4069dec813d9c2
[]
no_license
karom134/Data-Struggle
6fdcedbffc7afacef63774f1b53d3163db9e4180
cbe9bde589098b4b6873e6ee22994d38fe759b09
refs/heads/master
2020-08-28T06:57:34.768168
2019-11-14T13:28:57
2019-11-14T13:28:57
214,961,179
0
0
null
null
null
null
UTF-8
Java
false
false
4,259
java
// Assignment 2, Task 2.2 // Name: Natdanai Angumnuaysiri 6180519 // Collaborators: friends // Time Spent: 6:00 hrs import java.util.ArrayList; import java.util.List; /** * Put your name and student id */ public class Course { // Do not modify these private String name; private double assignmentWeightPercentage; private double quizWeightPercentage; private double midtermWeightPercentage; private double finalWeightPercentage; private List<GradeBook> gradeBooks; // Creates a course with default grading scheme: // - assignment 50% // - quiz 10% // - midterm 20% // - final 20% public Course(String name) { // IMPLEMENT THIS this.name = name; assignmentWeightPercentage = 50; quizWeightPercentage = 10; midtermWeightPercentage = 20; finalWeightPercentage = 20; gradeBooks = new ArrayList<>(); } // Creates a course with a given grading scheme public Course(String name, double a, double q, double m, double f) { // IMPLEMENT THIS this.name = name; this.assignmentWeightPercentage = a; this.quizWeightPercentage = q; this.midtermWeightPercentage = m; this.finalWeightPercentage = f; gradeBooks = new ArrayList<>(); } // Add a grade book to the course // You must also update the course reference in the grade book object. public void addGradebook(GradeBook gradebook) { // IMPLEMENT THIS gradebook.setCourse(name,assignmentWeightPercentage,quizWeightPercentage, midtermWeightPercentage,finalWeightPercentage);{ gradeBooks.add(gradebook); } } // Returns a List of all grade book objects public List<GradeBook> getAllGradeBooks() { // IMPLEMENT THIS return gradeBooks; } // Return the average term score across all students // You should make a call to getTermAverage() in each student's gradebook. // If no students, return -1 public double getClassAverage(int numAssignmentDrop, int numQuizDrop) { // IMPLEMENT THIS double sum = 0.0; for(int i = 0; i<gradeBooks.size();i++){ sum += (gradeBooks.get(i)).getTermAverage(numAssignmentDrop, numQuizDrop); } return sum/gradeBooks.size(); } // Return the average term score across all students (no assignment/quiz dropping) // You should make a call to getTermAverage() in each student's gradebook. // If no students, return -1 public double getClassAverage() { // IMPLEMENT THIS return getClassAverage(0,0); } // Add missing methods here. public double getAssignmentWeightPercentage(){ return assignmentWeightPercentage; } public double getQuizWeightPercentage(){ return quizWeightPercentage; } public double getMidtermWeightPercentage() { return midtermWeightPercentage; } public double getFinalWeightPercentage() { return finalWeightPercentage; } // Do not modify this public static void main(String[] args) { // Create a course with the default grading scheme Course course = new Course("Java"); // Add two grade books GradeBook book1 = new GradeBook(); GradeBook book2 = new GradeBook(); course.addGradebook(book1); course.addGradebook(book2); System.out.println("Class average:" + course.getClassAverage()); // first student book1.setAssignmentScore(1, 100); book1.setAssignmentScore(2, 100); book1.setAssignmentScore(3, 0); book1.setQuizScore(1,100); book1.setQuizScore(2,80); book1.setMidtermScore(100); book1.setFinalScore(100); // second student book2.setAssignmentScore(1, 90); book2.setAssignmentScore(2, 0); book2.setAssignmentScore(3, 90); book2.setQuizScore(1,80); book2.setQuizScore(2,100); book2.setMidtermScore(100); book2.setFinalScore(100); System.out.println("Class average:" + course.getClassAverage()); System.out.println("Class average:" + course.getClassAverage(1, 1)); } }
[ "karom.voa@student.mahidol.edu" ]
karom.voa@student.mahidol.edu
300082b2c39460f3341a2fc16361bbe9dcfdb42d
3561d5987bb5b27f1f0d810f8ab25d4bb703dfde
/src/main/java/com/example/hibernate/config/HibernateConfig.java
25e838d793055b86fab3c3cc0ffb2f7ff10d3ff1
[]
no_license
Darosy/spring-boot
d63d1082ecb24796a096df07d426dccecb7ec7ec
f5de5ed7ba51f4deedfd937b5795b061cecc4241
refs/heads/master
2020-04-22T20:33:23.288718
2019-03-04T01:54:28
2019-03-04T01:54:28
170,645,132
0
0
null
null
null
null
UTF-8
Java
false
false
4,659
java
package com.example.hibernate.config; import org.apache.commons.dbcp2.BasicDataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.orm.hibernate5.HibernateTransactionManager; import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.Database; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.stereotype.Component; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; import java.util.Properties; @Component @Configuration @EnableTransactionManagement @PropertySource("application.properties") public class HibernateConfig { @Autowired private Environment env; @Bean public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(dataSource()); sessionFactory.setPackagesToScan(env.getProperty("entitymanager.packagesToScan")); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; } @Bean public DataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(env.getProperty("spring.datasource.driver-class-name")); dataSource.setUrl(env.getProperty("spring.datasource.url")); dataSource.setUsername(env.getProperty("spring.datasource.username")); dataSource.setPassword(env.getProperty("spring.datasource.password")); return dataSource; } @Bean public PlatformTransactionManager hibernateTransactionManager() { HibernateTransactionManager transactionManager = new HibernateTransactionManager(); transactionManager.setSessionFactory(sessionFactory().getObject()); return transactionManager; } private final Properties hibernateProperties() { Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); hibernateProperties.setProperty("spring.jpa.properties.hibernate.dialect", env.getProperty("spring.jpa.properties.hibernate.dialect")); hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("spring.jpa.show-sql")); hibernateProperties.setProperty("spring.jpa.generate-ddl", env.getProperty("spring.jpa.generate-ddl")); return hibernateProperties; } @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setDatabase(Database.MYSQL); vendorAdapter.setGenerateDdl(true); LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setPackagesToScan(env.getProperty("entitymanager.packagesToScan")); em.setPersistenceUnitName("name"); em.setDataSource(dataSource()); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; } private Properties additionalProperties() { Properties properties = new Properties(); properties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("spring.jpa.hibernate.ddl-auto")); properties.setProperty("hibernate.dialect", env.getProperty("spring.jpa.properties.hibernate.dialect")); properties.setProperty("hibernate.show_sql", env.getProperty("spring.jpa.show-sql")); return properties; } @Bean @ConditionalOnMissingBean(JpaTransactionManager.class) public JpaTransactionManager transactionManager(@Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) { JpaTransactionManager transactionManager = new JpaTransactionManager(); transactionManager.setEntityManagerFactory(entityManagerFactory); return transactionManager; } }
[ "darosy.imam@gmail.com" ]
darosy.imam@gmail.com
4faab6cd5eec78373d7a110d9addeb288fc8a425
27e8cc6686aafe4dc1ed8aa0e64ec73e438b9f6e
/mannajobadminauth/src/main/java/com/mannajob/domain/Criteria.java
0e7622dda74724f5a005a1d4223d7c556e0eedef
[]
no_license
elonable16/mannajobadminauth
296d70e3a88d5f4e06a4d5b98dbea13936124e63
26c7fac63cd8e74bc5e136cb25a04c2bb158782d
refs/heads/master
2023-01-21T09:23:10.500082
2020-11-30T03:50:05
2020-11-30T03:50:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
280
java
package com.mannajob.domain; import lombok.Data; @Data public class Criteria { private int pageNum; private int amount; public Criteria() { this(1,10); } public Criteria(int pageNum, int amount) { this.pageNum = pageNum; this.amount = amount; } }
[ "rlohaa@gmail.com" ]
rlohaa@gmail.com
19346f515f1b88986be515ed2416a9e109d511d5
a741d82fb5ee0203161455353587ffcc902ef351
/aylson-dao/src/main/java/com/aylson/dc/sys/vo/CouponActivityVo.java
0e52eba991a547b98c5918979b495aaea16fb153
[]
no_license
xiaofeifei321/aylson-parent
b48121272d5e92a1acc4b671ab7af63aa6c06b0b
3749a0f1ef45851b4aa513b324ef23a04e4421d3
refs/heads/master
2022-12-23T20:15:51.598455
2019-08-29T11:30:13
2019-08-29T11:30:13
204,696,341
0
0
null
null
null
null
UTF-8
Java
false
false
844
java
package com.aylson.dc.sys.vo; import com.aylson.dc.sys.po.CouponActivity; public class CouponActivityVo extends CouponActivity { private static final long serialVersionUID = 454577187134709521L; private String startTimeStr; //活动开始时间 private String endTimeStr; //活动结束时间 private String curAuditOpinion; //当前审核意见 public String getStartTimeStr() { return startTimeStr; } public void setStartTimeStr(String startTimeStr) { this.startTimeStr = startTimeStr; } public String getEndTimeStr() { return endTimeStr; } public void setEndTimeStr(String endTimeStr) { this.endTimeStr = endTimeStr; } public String getCurAuditOpinion() { return curAuditOpinion; } public void setCurAuditOpinion(String curAuditOpinion) { this.curAuditOpinion = curAuditOpinion; } }
[ "874189630@qq.com" ]
874189630@qq.com
7b03adb3048018a777dfe6a7ff07882d7e839b2a
62ab212d0b534eaca97b9e4d7eec3831e539c757
/src/br/ucsal/processodesoftware/repositorio/ConnectionFactory.java
d9ef148b228c4c7defda31d6735437d7ea2f96f3
[ "Apache-2.0" ]
permissive
ezequiassam/AtendimentoClinicaMedica
a648f5bf588cf3e8645f36cc0fe988bd74d7da61
face0089eb510d493dd08ad14280a3902706c78f
refs/heads/master
2021-01-19T10:31:57.992848
2017-05-18T03:33:17
2017-05-18T03:33:17
87,874,034
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package br.ucsal.processodesoftware.repositorio; import java.sql.Connection; import java.sql.DriverManager; public class ConnectionFactory { public static Connection connection; static{ try { Class.forName("org.hsqldb.jdbc.JDBCDriver"); connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/banco", "SA",""); } catch (Exception e) { e.printStackTrace(); } } public static Connection getConnection(){ return connection; } }
[ "ezequias sampaio" ]
ezequias sampaio
8906f3332fbb59bb500e3b3384451da8c89089a1
8c604e804cf5e1e85661a204960fbda5e9c76b66
/wegas-core/src/main/java/com/wegas/core/IndentLogger.java
64a4283504e6d64239c6c8d8f1a695a135e3a044
[ "MIT" ]
permissive
Heigvd/Wegas
70a3723e021e6ba24badf0e9f9a8b88e86254ae0
2b7d9c369b1dcc0c751ddfb6e8ab19bdb4f87893
refs/heads/master
2023-09-01T05:19:32.371274
2023-08-25T10:12:47
2023-08-25T11:26:08
3,102,131
29
13
MIT
2023-09-06T09:40:06
2012-01-04T13:31:04
JavaScript
UTF-8
Java
false
false
1,342
java
/** * Wegas * http://wegas.albasim.ch * * Copyright (c) 2013-2021 School of Management and Engineering Vaud, Comem, MEI * Licensed under the MIT License */ package com.wegas.core; import org.slf4j.Logger; public class IndentLogger { private static final String SEP = " "; private int indentLevel = 0; private final Logger logger; public IndentLogger(Logger logger) { this.logger = logger; } public void info(String msg, Object... args) { logger.info(this.buildMessage(msg), args); } public void error(String msg, Object... args) { logger.error(this.buildMessage(msg), args); } public void debug(String msg, Object... args) { logger.debug(this.buildMessage(msg), args); } public void warn(String msg, Object... args) { logger.warn(this.buildMessage(msg), args); } public void trace(String msg, Object... args) { logger.trace(this.buildMessage(msg), args); } private String buildMessage(String msg) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < indentLevel; i++) { sb.append(SEP); } sb.append(msg); return sb.toString(); } public void indent() { indentLevel++; } public void unindent() { indentLevel--; } }
[ "maxence.laurent@gmail.com" ]
maxence.laurent@gmail.com
acb4b0299fe52749dddb6d62862e8bb8d4a3bd10
b06acf556b750ac1fa5b28523db7188c05ead122
/IfcXML/src/org/tech/iai/ifc/xml/ifc/_2x3/final_/IfcInternalOrExternalEnumType.java
6d570417a262896c3a5e7aa84c82eaa2326103dc
[]
no_license
christianharrington/MDD
3500afbe5e1b1d1a6f680254095bb8d5f63678ba
64beecdaed65ac22b0047276c616c269913afd7f
refs/heads/master
2021-01-10T21:42:53.686724
2012-12-17T03:27:05
2012-12-17T03:27:05
6,157,471
1
0
null
null
null
null
UTF-8
Java
false
false
5,182
java
/** */ package org.tech.iai.ifc.xml.ifc._2x3.final_; import java.math.BigInteger; import java.util.List; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Ifc Internal Or External Enum Type</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getValue <em>Value</em>}</li> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getId <em>Id</em>}</li> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getPath <em>Path</em>}</li> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getPos <em>Pos</em>}</li> * </ul> * </p> * * @see org.tech.iai.ifc.xml.ifc._2x3.final_.FinalPackage#getIfcInternalOrExternalEnumType() * @model extendedMetaData="name='IfcInternalOrExternalEnum_._type' kind='simple'" * @generated */ public interface IfcInternalOrExternalEnumType extends EObject { /** * Returns the value of the '<em><b>Value</b></em>' attribute. * The literals are from the enumeration {@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnum}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Value</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Value</em>' attribute. * @see org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnum * @see #setValue(IfcInternalOrExternalEnum) * @see org.tech.iai.ifc.xml.ifc._2x3.final_.FinalPackage#getIfcInternalOrExternalEnumType_Value() * @model unsettable="true" * extendedMetaData="name=':0' kind='simple'" * @generated */ IfcInternalOrExternalEnum getValue(); /** * Sets the value of the '{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getValue <em>Value</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Value</em>' attribute. * @see org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnum * @see #getValue() * @generated */ void setValue(IfcInternalOrExternalEnum value); /** * Returns the value of the '<em><b>Id</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Id</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Id</em>' attribute. * @see #setId(String) * @see org.tech.iai.ifc.xml.ifc._2x3.final_.FinalPackage#getIfcInternalOrExternalEnumType_Id() * @model id="true" dataType="org.eclipse.emf.ecore.xml.type.ID" * extendedMetaData="kind='attribute' name='id'" * @generated */ String getId(); /** * Sets the value of the '{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getId <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Id</em>' attribute. * @see #getId() * @generated */ void setId(String value); /** * Returns the value of the '<em><b>Path</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Path</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Path</em>' attribute. * @see #setPath(List) * @see org.tech.iai.ifc.xml.ifc._2x3.final_.FinalPackage#getIfcInternalOrExternalEnumType_Path() * @model dataType="org.eclipse.emf.ecore.xml.type.NMTOKENS" many="false" * extendedMetaData="kind='attribute' name='path'" * @generated */ List<String> getPath(); /** * Sets the value of the '{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getPath <em>Path</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Path</em>' attribute. * @see #getPath() * @generated */ void setPath(List<String> value); /** * Returns the value of the '<em><b>Pos</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Pos</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Pos</em>' attribute. * @see #setPos(List) * @see org.tech.iai.ifc.xml.ifc._2x3.final_.FinalPackage#getIfcInternalOrExternalEnumType_Pos() * @model dataType="org.iso.standard._10303.part._28.version._2.xmlschema.common.PosType" many="false" * extendedMetaData="kind='attribute' name='pos'" * @generated */ List<BigInteger> getPos(); /** * Sets the value of the '{@link org.tech.iai.ifc.xml.ifc._2x3.final_.IfcInternalOrExternalEnumType#getPos <em>Pos</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Pos</em>' attribute. * @see #getPos() * @generated */ void setPos(List<BigInteger> value); } // IfcInternalOrExternalEnumType
[ "christian@harrington.dk" ]
christian@harrington.dk
2f85f3f21c9d6938014bebb4d8655dccc2bf0a1b
20deb9a426ab96943aee547dd6a8f296b3eb1231
/Projects/Parcial/src/exceptions/InvalidSecondName.java
ca850ada7ff1282501ea8d56ce63fc6ebe292718
[]
no_license
ScSixto/Final_Project
648a07fb6cdc6e05f20f0b99f9a26317b2dc3219
d533483cfed80b10a44ad46e24cd24f08445811e
refs/heads/master
2020-12-19T22:43:53.017901
2020-02-06T01:17:36
2020-02-06T01:17:36
235,871,311
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package exceptions; public class InvalidSecondName extends Exception{ private static final long serialVersionUID = 1L; public static final String MESSAGE = "El Nombre ingresado es invalido."; public InvalidSecondName(String message){ super(MESSAGE + " " + message); } public InvalidSecondName(){ super(MESSAGE); } }
[ "sixto.santamaria@uptc.edu.co" ]
sixto.santamaria@uptc.edu.co
d4bf4dcd44e80c40cdebdcea7f97d8ab58120846
22515859a67bc0b2d6036ef070cacea42debde88
/s2/HMIN233/3_mouvement/tp/2_GenetiquexNeurocontrolleurs/neurocontroleurs/EvoAgentStudent/src/evoagentsimulation/evoagent2dsimulator/bot/elements/S_Battery.java
a0869f1972db020fbc06cf9ba3264a9a37c07175
[]
no_license
DocAmaroo/M1Aigle
ef49b5772cc16ec3328305099d560d8a299cdd48
490423a7e735d212a63eaf3f3a8e8148335efe9e
refs/heads/master
2023-07-14T23:53:16.141713
2021-09-09T12:47:57
2021-09-09T12:47:57
293,884,656
0
0
null
null
null
null
UTF-8
Java
false
false
2,055
java
/******************************************************************************* * * EvoAgentStudent : A simulation platform for agents using neurocontrollers * * Copyright (c) 2020 Suro François (suro@lirmm.fr) * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <https://www.gnu.org/licenses/>. *******************************************************************************/ package evoagentsimulation.evoagent2dsimulator.bot.elements; import org.jbox2d.common.Vec2; import evoagentsimulation.evoagent2dsimulator.bot.BotBody2D; public class S_Battery extends Sensor{ double decay = 0.00005; double value = 0.4; double initValue = 0.4; public void setDecay(double in) { decay = in; } public S_Battery(Vec2 lp, float la, BotBody2D b) { super(lp, la, b); } public S_Battery(Vec2 lp, float la, BotBody2D b, double d) { super(lp, la, b); decay = d; } public S_Battery(Vec2 lp, float la, BotBody2D b, double d, double initv) { super(lp, la, b); decay = d; initValue = initv; } public double getValue() { value = value - decay; return value; } @Override public double getNormalizedValue() { normalizedValue = Math.ceil(Math.max(getValue(),0.0)*100)/100; return normalizedValue; } @Override public void reset() { value = initValue; } public void recharge(double amount) { value+=amount; value= Math.min(value,1.0); } }
[ "c.tom34270@gmail.com" ]
c.tom34270@gmail.com
36d3f886d887e61fb0f122bca54f2b8ad1e0f1fc
c649ceaaf065d7073bc8fdec7a4a635e08445d59
/src/main/java/com/veri5/backend/developer_assignment/Deck/CardDeck.java
5798006766622c823d0151e7805f41aa252c1cea
[]
no_license
arshdev7/veri5_dev_assignment
60d496a7a902523f6bc75c9062e29d7c6eece978
b5a2db85395a6b60c1bec4f0f527e19aee197cc1
refs/heads/master
2021-02-13T06:04:21.024697
2020-03-03T15:18:52
2020-03-03T15:18:52
244,669,058
0
0
null
null
null
null
UTF-8
Java
false
false
3,599
java
package com.veri5.backend.developer_assignment.Deck; import com.veri5.backend.developer_assignment.Deck.DeckExceptions.NumberOfCardsNotMentionedException; import com.veri5.backend.developer_assignment.Deck.Utility.Constants; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; public class CardDeck{ private static final List<Card> demoDeck = new ArrayList<>(); //Initialize the demo deck with all the card value and suits static { for (Card.Suit eachSuit : Card.Suit.values()){ for (Card.Value eachValue : Card.Value.values()){ demoDeck.add(new Card(eachValue, eachSuit)); } } } public static List<Card> newDeck(){ return new ArrayList<>(demoDeck); } //Shuffle all the cards public static void shuffle(List<Card> myDeck){ if(myDeck != null && myDeck.size() == Constants.CARDS_IN_DECK) { Collections.shuffle(myDeck); }else{ myDeck = CardDeck.newDeck(); Collections.shuffle(myDeck); } } //Method to print all the cards public static void print(List<Card> myDeck){ if(myDeck != null && myDeck.size() > 0 && myDeck.size() <= Constants.CARDS_IN_DECK) { for (int i=0; i<myDeck.size(); i++){ System.out.println(i+". "+myDeck.get(i).toString()); } } } public static Card getOneCard(List<Card> myDeck) { Card card = null; try { card = CardDeck.getCards(Constants.ONE, myDeck).get(Constants.ZERO); } catch (NumberOfCardsNotMentionedException e) { System.out.println(e.toString()); } return card; } //Gives specified cards at random and removes the picked cards from the Deck public static List<Card> getCards(int numberOfCards, List<Card> myDeck) throws NumberOfCardsNotMentionedException { CardDeck.shuffle(myDeck); List<Card> pickedCards = new ArrayList<>(); if(numberOfCards == Constants.ONE){ Card pickedCard = myDeck.get(Constants.ZERO); pickedCards.add(pickedCard); myDeck.remove(pickedCard); return pickedCards; } if(numberOfCards > Constants.ZERO && numberOfCards < Constants.CARDS_IN_DECK) { Random rand = new Random(); for (int i = Constants.ZERO; i < numberOfCards; i++) { Card selectedCard = myDeck.get(rand.nextInt(Constants.CARDS_IN_DECK - i)); pickedCards.add(selectedCard); myDeck.remove(selectedCard); } }else { throw new NumberOfCardsNotMentionedException("Invalid number of cards provided"); } return pickedCards; } //Method to add a card to the deck public static boolean addOneCard(Card card, List<Card> myDeck){ List<Card> toAddCards = new ArrayList<>(); if(card != null) { toAddCards.add(card); } return addCardsToDeck(toAddCards, myDeck); } //Method to add multiple cards to deck public static boolean addCardsToDeck(List<Card> toAddCards, List<Card> myDeck){ if(toAddCards != null && toAddCards.size()>0 && (toAddCards.size() + myDeck.size() <= Constants.CARDS_IN_DECK)){ for(Card eachCard : toAddCards){ if(!myDeck.contains(eachCard)){ myDeck.add(eachCard); } } }else{ return false; } return true; } }
[ "arshworkmail@gmail.com" ]
arshworkmail@gmail.com
2ddbb1ec15cc9050039e7b37ffa02e989b85e04f
2d3d94352bbbfe920dc43c95cefa19dd0be6e8a5
/flink/src/main/java/com/test/flink/TestCollect.java
77fa0fc936c23eedb6163fd4c39f2687e63fd761
[]
no_license
shenfl/test
42649c2b4ef4397c99b56ed0a46beeff92a783d0
c2abe2b34b06945822726c6601c3e1d37a187219
refs/heads/master
2022-12-23T12:47:05.752131
2021-05-20T16:09:22
2021-05-20T16:09:22
137,750,493
0
1
null
2022-12-15T23:39:41
2018-06-18T12:43:46
Java
UTF-8
Java
false
false
7,568
java
package com.test.flink; import org.apache.flink.api.common.restartstrategy.RestartStrategies; import org.apache.flink.api.common.time.Time; import org.apache.flink.streaming.api.TimeCharacteristic; import org.apache.flink.streaming.api.collector.selector.OutputSelector; import org.apache.flink.streaming.api.datastream.ConnectedStreams; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.datastream.SplitStream; import org.apache.flink.streaming.api.environment.CheckpointConfig; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.api.functions.co.CoFlatMapFunction; import org.apache.flink.streaming.api.functions.sink.SinkFunction; import org.apache.flink.streaming.api.functions.source.ParallelSourceFunction; import org.apache.flink.streaming.api.functions.source.SourceFunction; import org.apache.flink.util.Collector; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.TimeUnit; /** * Created by shenfl on 2018/9/28 * 用connect算子传递配置流 * https://github.com/streaming-olap/training/blob/master/flink-api-example/src/main/java/Main.java */ public class TestCollect { public static void main(String[] args) throws Exception { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); if (true) { // 设置checkpoint env.enableCheckpointing(60000); CheckpointConfig checkpointConf = env.getCheckpointConfig(); checkpointConf.setMinPauseBetweenCheckpoints(30000L); checkpointConf.setCheckpointTimeout(10000L); checkpointConf.enableExternalizedCheckpoints(CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION); } else { // non checkpoint env.setRestartStrategy(RestartStrategies.fixedDelayRestart( Integer.MAX_VALUE, // number of restart attempts Time.of(5, TimeUnit.SECONDS) // delay )); } //为什么要 broadcast ? //配置流 DataStream<String> configDataStream = env.addSource(new SocketSource()) .broadcast(); DataStream<Record> dataStream = env.addSource(new ConnectSource()); ConnectedStreams<Record, String> connectedStreams = dataStream.connect(configDataStream); DataStream<Record> flatMapDataStream = connectedStreams.flatMap(new CoFlatMapFunction<Record, String, Record>() { private String config; @Override public void flatMap1(Record record, Collector<Record> collector) throws Exception { /* * * * 处理业务逻辑 * * */ if (config.equals("0")) { collector.collect(record); } else if(config.equals("1")) { collector.collect(record); } System.out.println("Received config"); } @Override public void flatMap2(String s, Collector<Record> collector) throws Exception { /* * 处理配置 */ config = s; System.out.println(s); } }); SplitStream<Record> splitStream = dataStream.split(new OutputSelector<Record>() { @Override public Iterable<String> select(Record record) { List<String> output = new ArrayList<String>(); String biz = "" + record.getBizId(); output.add(biz); return output; } }); splitStream.select("1").addSink(new SinkFunction<Record>() { @Override public void invoke(Record record) throws Exception { System.out.println(record); } }); splitStream.select("2").addSink(new SinkFunction<Record>() { @Override public void invoke(Record record) throws Exception { System.out.println(record); } }); env.execute(); } static class ConnectSource implements ParallelSourceFunction<Record> { private static Random random = new Random(); /** * * 产生数据 */ @Override public void run(SourceContext<Record> sourceContext) throws Exception { while (true) { /* * v1 业务线 * v2 业务Id * v3 业务属性值 * v4 时间戳 * .... */ Random random = new Random(100); Record record = new Record(); for (int i = 0 ; i < 4 ; i++) { record.setBizName("" + i); record.setBizId(i); record.setAttr(Integer.valueOf(random.nextInt() / 10)); record.setData("json string or other"); record.setTimestamp(new Long(System.currentTimeMillis()) / 1000); sourceContext.collect(record); } Thread.sleep(200); } } /** * 关闭资源 */ @Override public void cancel() { } } static class SocketSource implements SourceFunction<String> { private volatile boolean running = true; @Override public void run(SourceContext<String> sourceContext) throws Exception { while (running) { try { String response = SocketSource.sendGet("http://172.17.40.234:13080/partition/getMetrics", ""); sourceContext.collect(response); } catch (Exception e) { //TODO } Thread.sleep(60000); } } @Override public void cancel() { running = false; } public static String sendGet(String url, String param) throws Exception { String result = ""; BufferedReader in = null; try { String e = url + param; URL realUrl = new URL(e); URLConnection connection = realUrl.openConnection(); connection.setConnectTimeout(3000); connection.connect(); String line; for(in = new BufferedReader(new InputStreamReader(connection.getInputStream())); (line = in.readLine()) != null; result = result + line) { ; } } catch (Exception var15) { var15.printStackTrace(); throw new Exception("发送GET请求出现异常!" + var15); } finally { try { if(in != null) { in.close(); } } catch (Exception var14) { var14.printStackTrace(); throw new Exception("关闭网络请求异常!" + var14); } } return result; } } }
[ "shenfeilong@souche.com" ]
shenfeilong@souche.com
d5ff589d63e8ebbd948a49905608d26eac4786e6
c32fa60570b1cdb64eb9f901dbf6c6ea9981e7c0
/src/com/policecom/adapter/HorizontalListView.java
dabcb0c58e42d0021ec513bbf11f38ef51628115
[]
no_license
skaudrey/police
3aad7d3f92b173c24378a1240683d023b7b838ab
0b2b8689cc8aec4c4dec6c46ad00565411255c71
refs/heads/master
2021-01-19T08:01:53.643579
2017-04-08T00:03:27
2017-04-08T00:03:27
87,595,491
0
0
null
null
null
null
UTF-8
Java
false
false
10,052
java
package com.policecom.adapter; /* * HorizontalListView.java v1.5 * * * The MIT License * Copyright (c) 2011 Paul Soucy (paul@dev-smart.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ import java.util.LinkedList; import java.util.Queue; import android.content.Context; import android.database.DataSetObserver; import android.graphics.Rect; import android.util.AttributeSet; import android.view.GestureDetector; import android.view.GestureDetector.OnGestureListener; import android.view.MotionEvent; import android.view.View; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.Scroller; public class HorizontalListView extends AdapterView<ListAdapter> { public boolean mAlwaysOverrideTouch = true; protected ListAdapter mAdapter; private int mLeftViewIndex = -1; private int mRightViewIndex = 0; protected int mCurrentX; protected int mNextX; private int mMaxX = Integer.MAX_VALUE; private int mDisplayOffset = 0; protected Scroller mScroller; private GestureDetector mGesture; private Queue<View> mRemovedViewQueue = new LinkedList<View>(); private OnItemSelectedListener mOnItemSelected; private OnItemClickListener mOnItemClicked; private OnItemLongClickListener mOnItemLongClicked; private boolean mDataChanged = false; public HorizontalListView(Context context, AttributeSet attrs) { super(context, attrs); initView(); } private synchronized void initView() { mLeftViewIndex = -1; mRightViewIndex = 0; mDisplayOffset = 0; mCurrentX = 0; mNextX = 0; mMaxX = Integer.MAX_VALUE; mScroller = new Scroller(getContext()); mGesture = new GestureDetector(getContext(), mOnGesture); } @Override public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener) { mOnItemSelected = listener; } @Override public void setOnItemClickListener(AdapterView.OnItemClickListener listener) { mOnItemClicked = listener; } private DataSetObserver mDataObserver = new DataSetObserver() { @Override public void onChanged() { synchronized(HorizontalListView.this){ mDataChanged = true; } invalidate(); requestLayout(); } @Override public void onInvalidated() { reset(); invalidate(); requestLayout(); } }; @Override public ListAdapter getAdapter() { return mAdapter; } @Override public View getSelectedView() { //TODO: implement return null; } @Override public void setAdapter(ListAdapter adapter) { if(mAdapter != null) { mAdapter.unregisterDataSetObserver(mDataObserver); } mAdapter = adapter; mAdapter.registerDataSetObserver(mDataObserver); reset(); } private synchronized void reset(){ initView(); removeAllViewsInLayout(); requestLayout(); } @Override public void setSelection(int position) { //TODO: implement } private void addAndMeasureChild(final View child, int viewPos) { LayoutParams params = child.getLayoutParams(); if(params == null) { params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); } addViewInLayout(child, viewPos, params, true); child.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST)); } @Override protected synchronized void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if(mAdapter == null){ return; } if(mDataChanged){ int oldCurrentX = mCurrentX; initView(); removeAllViewsInLayout(); mNextX = oldCurrentX; mDataChanged = false; } if(mScroller.computeScrollOffset()){ int scrollx = mScroller.getCurrX(); mNextX = scrollx; } if(mNextX <= 0){ mNextX = 0; mScroller.forceFinished(true); } if(mNextX >= mMaxX) { mNextX = mMaxX; mScroller.forceFinished(true); } int dx = mCurrentX - mNextX; removeNonVisibleItems(dx); fillList(dx); positionItems(dx); mCurrentX = mNextX; if(!mScroller.isFinished()){ post(new Runnable(){ @Override public void run() { requestLayout(); } }); } } private void fillList(final int dx) { int edge = 0; View child = getChildAt(getChildCount()-1); if(child != null) { edge = child.getRight(); } fillListRight(edge, dx); edge = 0; child = getChildAt(0); if(child != null) { edge = child.getLeft(); } fillListLeft(edge, dx); } private void fillListRight(int rightEdge, final int dx) { while(rightEdge + dx < getWidth() && mRightViewIndex < mAdapter.getCount()) { View child = mAdapter.getView(mRightViewIndex, mRemovedViewQueue.poll(), this); addAndMeasureChild(child, -1); rightEdge += child.getMeasuredWidth(); if(mRightViewIndex == mAdapter.getCount()-1) { mMaxX = mCurrentX + rightEdge - getWidth(); } if (mMaxX < 0) { mMaxX = 0; } mRightViewIndex++; } } private void fillListLeft(int leftEdge, final int dx) { while(leftEdge + dx > 0 && mLeftViewIndex >= 0) { View child = mAdapter.getView(mLeftViewIndex, mRemovedViewQueue.poll(), this); addAndMeasureChild(child, 0); leftEdge -= child.getMeasuredWidth(); mLeftViewIndex--; mDisplayOffset -= child.getMeasuredWidth(); } } private void removeNonVisibleItems(final int dx) { View child = getChildAt(0); while(child != null && child.getRight() + dx <= 0) { mDisplayOffset += child.getMeasuredWidth(); mRemovedViewQueue.offer(child); removeViewInLayout(child); mLeftViewIndex++; child = getChildAt(0); } child = getChildAt(getChildCount()-1); while(child != null && child.getLeft() + dx >= getWidth()) { mRemovedViewQueue.offer(child); removeViewInLayout(child); mRightViewIndex--; child = getChildAt(getChildCount()-1); } } private void positionItems(final int dx) { if(getChildCount() > 0){ mDisplayOffset += dx; int left = mDisplayOffset; for(int i=0;i<getChildCount();i++){ View child = getChildAt(i); int childWidth = child.getMeasuredWidth(); child.layout(left, 0, left + childWidth, child.getMeasuredHeight()); left += childWidth + child.getPaddingRight(); } } } public synchronized void scrollTo(int x) { mScroller.startScroll(mNextX, 0, x - mNextX, 0); requestLayout(); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { boolean handled = super.dispatchTouchEvent(ev); handled |= mGesture.onTouchEvent(ev); return handled; } protected boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { synchronized(HorizontalListView.this){ mScroller.fling(mNextX, 0, (int)-velocityX, 0, 0, mMaxX, 0, 0); } requestLayout(); return true; } protected boolean onDown(MotionEvent e) { mScroller.forceFinished(true); return true; } private OnGestureListener mOnGesture = new GestureDetector.SimpleOnGestureListener() { @Override public boolean onDown(MotionEvent e) { return HorizontalListView.this.onDown(e); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return HorizontalListView.this.onFling(e1, e2, velocityX, velocityY); } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { synchronized(HorizontalListView.this){ mNextX += (int)distanceX; } requestLayout(); return true; } @Override public boolean onSingleTapConfirmed(MotionEvent e) { for(int i=0;i<getChildCount();i++){ View child = getChildAt(i); if (isEventWithinView(e, child)) { if(mOnItemClicked != null){ mOnItemClicked.onItemClick(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId( mLeftViewIndex + 1 + i )); } if(mOnItemSelected != null){ mOnItemSelected.onItemSelected(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId( mLeftViewIndex + 1 + i )); } break; } } return true; } @Override public void onLongPress(MotionEvent e) { int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i); if (isEventWithinView(e, child)) { if (mOnItemLongClicked != null) { mOnItemLongClicked.onItemLongClick(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId(mLeftViewIndex + 1 + i)); } break; } } } private boolean isEventWithinView(MotionEvent e, View child) { Rect viewRect = new Rect(); int[] childPosition = new int[2]; child.getLocationOnScreen(childPosition); int left = childPosition[0]; int right = left + child.getWidth(); int top = childPosition[1]; int bottom = top + child.getHeight(); viewRect.set(left, top, right, bottom); return viewRect.contains((int) e.getRawX(), (int) e.getRawY()); } }; }
[ "Skaudrey@163.com" ]
Skaudrey@163.com
bfb0593cc8e0fbdbd9d473dd2433489214ff001f
c73cdd289b67c06f83fbd7526deb6689cd8ff842
/h.Automation/src/exercise/Invokeapp/FirefoxBrowserVersion.java
b698f128fe816280d38bfff86190c62950baebb4
[]
no_license
HariChandraB/Selenium
fc8a94e4aa287bfef4bd43214ea60ec99089f768
730c4f30b05816271a4e06ab2df53450e805687a
refs/heads/master
2020-03-24T06:00:57.857597
2018-07-25T23:10:54
2018-07-25T23:10:54
142,513,084
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
package exercise.Invokeapp; import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.RemoteWebDriver; public class FirefoxBrowserVersion { public static void main(String[] args) { // TODO Auto-generated method stub String path = "D:\\Selenium_drivers\\geckodriver.exe"; System.setProperty("webdriver.gecko.driver", path); WebDriver driver = new FirefoxDriver(); Capabilities capb = ((RemoteWebDriver) driver).getCapabilities(); String browserName = capb.getBrowserName(); String browserVersion = capb.getVersion(); System.out.println("Browser Name :" + browserName + "\nBrowser Version :" + browserVersion + "\nTitile :" + (driver.getCurrentUrl())); } }
[ "harihrps@gmail.com" ]
harihrps@gmail.com
0c1ba528fc5dd03f2a320844e48c88fe5f877ff3
7d8c64f1f09e13043f14a5a235c4e61272a77506
/sources/org/appcelerator/titanium/view/TiBackgroundColorWrapper.java
525a87db9a80ed2a5cc9dcea33e6a5aa29f4fe31
[]
no_license
AlexKohanim/QuickReturn
168530c2ef4035faff817a901f1384ed8a554f73
1ce10de7020951d49f80b66615fe3537887cea80
refs/heads/master
2022-06-25T19:00:59.818761
2020-05-08T20:11:14
2020-05-08T20:11:14
262,418,565
0
1
null
null
null
null
UTF-8
Java
false
false
6,408
java
package org.appcelerator.titanium.view; import android.annotation.TargetApi; import android.graphics.Paint; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.ShapeDrawable; import android.os.Build.VERSION; import android.view.View; import android.view.ViewParent; import java.lang.reflect.Field; import org.appcelerator.kroll.common.Log; public class TiBackgroundColorWrapper { private static final String COLOR_DRAWABLE_STATE_VAR = "mState"; private static final String COLOR_DRAWABLE_USE_COLOR_VAR = "mUseColor"; private static final String ERR_BACKGROUND_COLOR = "Unable to determine the current background color. Transparent will be returned as the color value."; private static final boolean IS_HONEYCOMB_OR_GREATER = (VERSION.SDK_INT >= 11); private static final String TAG = TiBackgroundColorWrapper.class.getSimpleName(); private static boolean cdBackgroundReflectionReady = false; private static Field cdBackgroundStateColorField = null; private static Field cdBackgroundStateField = null; private final View view; public TiBackgroundColorWrapper(View view2) { this.view = view2; } public static TiBackgroundColorWrapper wrap(View v) { return new TiBackgroundColorWrapper(v); } private Drawable findNearestBackgroundDrawable(View view2) { Drawable backgroundDrawable = null; View checkView = view2; while (backgroundDrawable == null && checkView != null) { backgroundDrawable = checkView.getBackground(); if (backgroundDrawable != null) { backgroundDrawable = backgroundDrawable.getCurrent(); if (backgroundDrawable instanceof LayerDrawable) { LayerDrawable layerDrawable = (LayerDrawable) backgroundDrawable; int layerCount = layerDrawable.getNumberOfLayers(); if (layerCount > 0) { backgroundDrawable = layerDrawable.getDrawable(layerCount - 1); if (backgroundDrawable != null) { backgroundDrawable = backgroundDrawable.getCurrent(); } } } } if (backgroundDrawable == null) { ViewParent parent = checkView.getParent(); checkView = null; if (parent instanceof View) { checkView = (View) parent; } } } return backgroundDrawable; } public int getBackgroundColor() { if (this.view == null) { Log.m44w(TAG, "View was not set. Unable to determine the current background color. Returning Color.TRANSPARENT."); return 0; } Drawable backgroundDrawable = findNearestBackgroundDrawable(this.view); if (backgroundDrawable == null) { Log.m44w(TAG, ERR_BACKGROUND_COLOR); return 0; } else if (backgroundDrawable instanceof ColorDrawable) { return getColorFromColorDrawable((ColorDrawable) backgroundDrawable); } else { if (backgroundDrawable instanceof TiGradientDrawable) { int[] gradientColors = ((TiGradientDrawable) backgroundDrawable).getColors(); if (gradientColors.length > 0) { return gradientColors[gradientColors.length - 1]; } Log.m44w(TAG, ERR_BACKGROUND_COLOR); return 0; } if (backgroundDrawable instanceof ShapeDrawable) { Paint paint = ((ShapeDrawable) backgroundDrawable).getPaint(); if (paint != null) { return paint.getColor(); } } Log.m44w(TAG, ERR_BACKGROUND_COLOR); return 0; } } private void initColorDrawableReflection(ColorDrawable colorDrawable) { cdBackgroundReflectionReady = true; try { cdBackgroundStateField = ColorDrawable.class.getDeclaredField(COLOR_DRAWABLE_STATE_VAR); cdBackgroundStateField.setAccessible(true); try { cdBackgroundStateColorField = cdBackgroundStateField.getType().getDeclaredField(COLOR_DRAWABLE_USE_COLOR_VAR); cdBackgroundStateColorField.setAccessible(true); } catch (Exception e) { Log.m34e(TAG, "Reflection failed while trying to determine background color of view.", (Throwable) e); cdBackgroundStateColorField = null; } } catch (Exception e2) { Log.m34e(TAG, "Reflection failed while trying to determine background color of view.", (Throwable) e2); cdBackgroundStateField = null; } } private int getColorFromColorDrawable(ColorDrawable colorDrawable) { if (IS_HONEYCOMB_OR_GREATER) { return getColorFromColorDrawableHC(colorDrawable); } if (!cdBackgroundReflectionReady) { initColorDrawableReflection(colorDrawable); } if (cdBackgroundStateField == null || cdBackgroundStateColorField == null) { Log.m44w(TAG, ERR_BACKGROUND_COLOR); return 0; } try { Object colorStatusInstance = cdBackgroundStateField.get(colorDrawable); if (colorStatusInstance == null) { Log.m44w(TAG, ERR_BACKGROUND_COLOR); return 0; } boolean z = false; try { return cdBackgroundStateColorField.getInt(colorStatusInstance); } catch (Exception e) { Log.m46w(TAG, ERR_BACKGROUND_COLOR, (Throwable) e); return z; } } catch (Exception e2) { Log.m46w(TAG, ERR_BACKGROUND_COLOR, (Throwable) e2); return 0; } } @TargetApi(11) private int getColorFromColorDrawableHC(ColorDrawable colorDrawable) { return colorDrawable.getColor(); } public void setBackgroundColor(int value) { if (this.view == null) { Log.m44w(TAG, "Wrapped view is null. Cannot set background color."); } else { this.view.setBackgroundColor(value); } } }
[ "akohanim@sfsu.edu" ]
akohanim@sfsu.edu
5b5f4183863dd29ba06d0c7da867d6a9c699e47e
272c16a79cc952e5c69b6532887a5f7374b9ed61
/src/test/java/com/grasshopper/businesssolution/BusinessSolutionApplicationTests.java
ebd3dabd82dabe446160ec23fd5641c64f35587d
[]
no_license
anisul/jwt-auth-example
54ef95c51a74aad42c10217b29225ad2f774cca6
6f3dbce4c768ee6995a919a97c7d5eea153c6ad0
refs/heads/master
2021-05-17T18:35:14.790854
2020-03-29T00:22:02
2020-03-29T00:22:02
250,921,135
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package com.grasshopper.businesssolution; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class BusinessSolutionApplicationTests { @Test void contextLoads() { } }
[ "anisul.iut@gmail.com" ]
anisul.iut@gmail.com
f00d89f9bab93fe987d7e5d9cdfaa87fe1cada0c
0ef40a9ca309debf5974db218adc194481c1f5c8
/app/src/main/java/com/example/taskapp/ui/profile/ProfileFragment.java
d3f21f40b3fc36d506abd3378f3d0546e0a29246
[]
no_license
argen23/TaskApp
13c615226509790f72457cbf28795a108675e0fd
752b3f1e1924501a1c1513d58f525aba08617902
refs/heads/master
2023-08-16T06:31:19.886153
2021-09-17T17:41:35
2021-09-17T17:41:35
397,936,547
0
0
null
null
null
null
UTF-8
Java
false
false
4,152
java
package com.example.taskapp.ui.profile; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import androidx.activity.result.ActivityResult; import androidx.activity.result.ActivityResultCallback; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.example.taskapp.R; import com.example.taskapp.room.Prefs; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.textfield.TextInputEditText; import com.google.firebase.firestore.FirebaseFirestore; public class ProfileFragment extends Fragment { private ImageView ava; private Uri uri; private Prefs prefs; private TextInputEditText et_username, et_number; private FloatingActionButton fab; FirebaseFirestore db = FirebaseFirestore.getInstance(); @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); prefs = new Prefs(requireContext()); setHasOptionsMenu(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_profile, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ava = view.findViewById(R.id.avatar_img); fab = view.findViewById(R.id.image_fab); et_number = view.findViewById(R.id.et_number); et_username = view.findViewById(R.id.et_username); et_username.setText(prefs.getName()); et_number.setText(prefs.getNumber()); fab.setOnClickListener(v -> { openGallery(); }); } ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() { @Override public void onActivityResult(ActivityResult result) { if (result.getResultCode() == Activity.RESULT_OK) { uri = result.getData().getData(); prefs.saveImageUri(String.valueOf(uri)); ava.setImageURI(uri); } } }); public void openGallery() { Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setType("image/*"); someActivityResultLauncher.launch(intent); } @Override public void onStart() { super.onStart(); if (prefs.getImageUri() != null) uri = Uri.parse(prefs.getImageUri()); Glide.with(requireContext()).load(uri).circleCrop().into(ava); } @Override public void onStop() { super.onStop(); prefs.saveUserName(et_username.getText().toString()); prefs.saveNumber(et_number.getText().toString()); } @Override public void onResume() { super.onResume(); Glide.with(requireContext()).load(uri).circleCrop().into(ava); } @Override public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.toolbar_menu, menu); } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == R.id.menu_delete) { prefs.delete(requireContext()); return true; } return super.onOptionsItemSelected(item); } }
[ "argenomarbekov192@gmail.com" ]
argenomarbekov192@gmail.com
b65eb762e0e428fb2e531d01dd6f0c30e2b98a9e
70f52d96c8e1d94d723242dced88863dd183c9e7
/jsp05_struts/src/main/java/model/member/dao/MemberDAO.java
46596068b88420dd3b7057b5ba72dc7dff25b8e8
[]
no_license
earlyway/210525jsp05
a9e2a8fb88c7ccf4b672dba0c0773841e293a3e4
2afb374c66d803ee63b524d18517f28f5dbc1114
refs/heads/master
2023-05-02T16:28:47.233601
2021-05-25T09:24:20
2021-05-25T09:24:20
370,635,805
0
0
null
null
null
null
UTF-8
Java
false
false
2,721
java
package model.member.dao; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.ibatis.session.SqlSession; import config.MybatisManager; import model.member.dto.MemberDTO; public class MemberDAO { public MemberDTO loginCheck(MemberDTO dto) { SqlSession session= MybatisManager.getInstance().openSession(); MemberDTO m = session.selectOne("member.loginCheck", dto); session.close(); return m; } public List<MemberDTO> getMemberList(String searchkey, String search){ SqlSession session= MybatisManager.getInstance().openSession(); List<MemberDTO> list=null; if(searchkey.equals("name_userid")) { list = session.selectList("member.memberListAll", search); }else { Map<String, Object> map = new HashMap<>(); map.put("searchkey", searchkey); map.put("search", search); list= session.selectList("member.memberList", map); } return list; } public void memberInsert(MemberDTO dto) { SqlSession session= MybatisManager.getInstance().openSession(); session.insert("member.memberInsert", dto); session.commit(); session.close(); } public int getMemberCount(String searchkey,String search) { SqlSession session= MybatisManager.getInstance().openSession(); int count=0; if(searchkey.equals("name_userid")) { count=session.selectOne("member.memberCountAll", search); }else { Map<String, Object> map = new HashMap<>(); map.put("searchkey", searchkey); map.put("search", search); count = session.selectOne("member.memberCount", map); } return count; } public MemberDTO getMember(String userid) { SqlSession session= MybatisManager.getInstance().openSession(); return session.selectOne("member.memberDetail", userid); } public void memberUpdate(MemberDTO dto) { SqlSession session = MybatisManager.getInstance().openSession(); session.update("member.memberUpdate",dto); session.commit(); session.close(); } public void memberDelete(String userid) { SqlSession session= MybatisManager.getInstance().openSession(); session.delete("member.memberDelete", userid); session.commit(); session.close(); } public void memberJoin(MemberDTO dto) { SqlSession session= MybatisManager.getInstance().openSession(); session.insert("memberJoin", dto); session.commit(); session.close(); } public boolean useridCheck(String userid) { SqlSession session= MybatisManager.getInstance().openSession(); int count=session.selectOne("useridCheck",userid); if(count == 0) { return true; }else { return false; } } }
[ "tjoeun706-05@DESKTOP-KLJ7C3T" ]
tjoeun706-05@DESKTOP-KLJ7C3T