blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
3ee8660217756b2e9f55ad995ee0df8f576f61f6
Java
theguy951357/intro_oop201
/robots/src/edu/unca/csci201/Car.java
UTF-8
404
3.078125
3
[]
no_license
package edu.unca.csci201; public class Car { private int mileage; private int tank; private String model; public Car(int mileage, int tank, String model) { this.mileage = mileage; this.tank = tank; this.model = model; } public int getMileage() { return mileage; } public int getTank() { return tank; } public String getModel() { return model; } }
true
2d297f7a3723665ac74f214cdf6a349c8e68ffb5
Java
DeblaSamples/SinaWeiboAlbum
/CoBoxWeiboAblum/src/com/cocoonshu/sina/weibo/network/auth/Unauthorize.java
UTF-8
1,577
2.25
2
[]
no_license
package com.cocoonshu.sina.weibo.network.auth; import org.json.JSONException; import org.json.JSONObject; import com.cocoonshu.network.HttpAPI; import com.cocoonshu.network.HttpMethod; import com.cocoonshu.sina.weibo.Account; import com.cocoonshu.sina.weibo.Weibo; import com.cocoonshu.sina.weibo.network.WeiboAPI; import com.cocoonshu.sina.weibo.util.Debugger; /** * https://api.weibo.com/oauth2/revokeoauth2 * ?access_token=fahkjefwa6987fg21109r2g1h0c12 * @author Cocoonshu * @date 2016-01-14 */ public class Unauthorize extends HttpAPI { private static final String TAG = "Unauthorize"; public Unauthorize() { setMethod(HttpMethod.POST); setApiHost(WeiboAPI.API_URL); setApiInterface(WeiboAPI.API_REVOKE_OAUTH2); setParameterValue(WeiboAPI.PARAM_ACCESS_TOKEN, ""); } public void setAccount(Account account) { setParameterValue( WeiboAPI.PARAM_ACCESS_TOKEN, Weibo.getInstance().getAccountManager().getAccessToken()); } @Override public Object parseResponse(String responseContent, Object... inParams) { String result = ""; Debugger.i(TAG, "[parseResponse] Response: " + responseContent); if (responseContent != null && !responseContent.isEmpty()) { try { JSONObject jsonRoot = new JSONObject(responseContent); result = jsonRoot.optString(WeiboAPI.JSON.KEY_RESULT); } catch (JSONException e) { e.printStackTrace(); } } return result; } }
true
8a9383b6f88b4bd935b370ecaece043cf01f39b2
Java
victerpaul/Java-Programs---Java-Concepts-Demo
/MethodWithReturnValue.java
UTF-8
267
3.0625
3
[]
no_license
class Test { int x,y; public int sum(int x, int y) { return x+y; } } class MethodWithReturnValue { public static void main(String a[]) { int result; Test mat=new Test(); result = mat.sum(11,22); System.out.print(result); } }
true
9de2cca8016ffd08f9b55f9793e5e18f2b727b36
Java
Te4o/MyLibrary
/src/main/java/com/softserve/academy/model/Comment.java
UTF-8
1,473
2.4375
2
[]
no_license
/** *Comment.java * *created at Nov 15, 2015 * *@author Vasil Sokolov <vasilsokolov@abv.bg> * * Copyright (c) 2015 . All Rights Reserved. */ package com.softserve.academy.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.Size; @Entity @Table(name = "comments") public class Comment { @Id @Column(name = "comment_id", nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer comment_id; @Size(min = 3, max = 1000) @Column(name = "comment", nullable = false) private String comment; @ManyToOne @JoinColumn(name = "id_books") private Book book; @ManyToOne @JoinColumn(name = "id_users") private User user; public Integer getComment_id() { return comment_id; } public void setComment_id(Integer comment_id) { this.comment_id = comment_id; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Book getBook() { return book; } public void setBook(Book book) { this.book = book; } /** * @return the user */ public User getUser() { return user; } /** * @param user the user to set */ public void setUser(User user) { this.user = user; } }
true
e1f07bd9d3522a3b21ecc44f6999792e619ad5ab
Java
yhysmile/pzjuser
/customer-service/src/main/java/com/pzj/common/util/MQUtil.java
UTF-8
4,065
2.40625
2
[ "Apache-2.0" ]
permissive
package com.pzj.common.util; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.alibaba.rocketmq.client.exception.MQClientException; import com.alibaba.rocketmq.client.producer.DefaultMQProducer; import com.alibaba.rocketmq.client.producer.MQProducer; import com.alibaba.rocketmq.client.producer.SendResult; import com.alibaba.rocketmq.client.producer.SendStatus; import com.alibaba.rocketmq.common.message.Message; /** * Created by Administrator on 2016-12-26. */ public class MQUtil { private final static Logger logger = LoggerFactory.getLogger(MQUtil.class); private DefaultMQProducer producer; private String serviceAddress; private String productName = "CustomerProduct"; private int minPoolSize = 1; private int maxPoolSize = 10; private long keepAliveTime = 300L; private TimeUnit unit = TimeUnit.SECONDS; private BlockingQueue<Runnable> workQueue= null; private ThreadPoolExecutor threadPool; public MQUtil(){} public MQUtil(String productName, String serviceAddress, int maxPoolSize, int minPoolSize, int keepAliveTime){ setProductName(productName); setServiceAddress(serviceAddress); setMaxPoolSize(maxPoolSize); setMinPoolSize(minPoolSize); setKeepAliveTime(keepAliveTime); init(); } public void init(){ try { initProducer(); initThreadPool(); } catch (MQClientException e) { logger.error("消息生成者启动失败:" + e.getMessage(), e); } } private static class SendMsgTask implements Runnable { private final static Logger logger = LoggerFactory.getLogger(SendMsgTask.class); private MQProducer producer; private Message message; private SendMsgTask(MQProducer producer, Message message){ this.producer = producer; this.message = message; } @Override public void run() { try { logger.debug("发送消息开始:{}" + message.toString()); SendResult result = producer.send(message); if (result.getSendStatus() != SendStatus.SEND_OK){ logger.error("发送消息失败:{}" + result.toString()); } } catch (Throwable throwable) { logger.error("发送消息失败:" + throwable.getMessage(), throwable); } } } private void initProducer() throws MQClientException { producer = new DefaultMQProducer(productName); producer.setNamesrvAddr(this.serviceAddress); //producer.setInstanceName("rmq-instance"); producer.start(); } private void initThreadPool(){ workQueue = new LinkedBlockingDeque<>(); threadPool = new ThreadPoolExecutor(minPoolSize, maxPoolSize, keepAliveTime, unit, workQueue); } public void send(Message msg) { SendMsgTask task = new SendMsgTask(producer, msg); threadPool.execute(task); } public String getServiceAddress() { return serviceAddress; } public void setServiceAddress(String serviceAddress) { this.serviceAddress = serviceAddress; } public int getMinPoolSize() { return minPoolSize; } public void setMinPoolSize(int minPoolSize) { this.minPoolSize = minPoolSize; } public int getMaxPoolSize() { return maxPoolSize; } public void setMaxPoolSize(int maxPoolSize) { this.maxPoolSize = maxPoolSize; } public long getKeepAliveTime() { return keepAliveTime; } public void setKeepAliveTime(long keepAliveTime) { this.keepAliveTime = keepAliveTime; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } }
true
f1c3b9d858f7b08659142048b12206d2f339a869
Java
remicaumette/arion
/arion-core/src/main/java/com/arionmc/arioncore/api/nms/TitleBuilder.java
UTF-8
2,246
3.21875
3
[]
no_license
package com.arionmc.arioncore.api.nms; public class TitleBuilder { private String title; private String subtitle; private int fadeIn; private int stay; private int fadeOut; public TitleBuilder() { } /** * Défini le titre. * * @param title Le titre. * @return Le builder. */ public TitleBuilder withTitle(String title) { this.title = title; return this; } /** * Défini le sous-titre. * * @param subtitle Le sous-titre. * @return Le builder. */ public TitleBuilder withSubtitle(String subtitle) { this.subtitle = subtitle; return this; } /** * Défini la durée de la transition d'entrée. * * @param fadeIn La durée de la transition d'entrée. * @return Le builder. */ public TitleBuilder withFadeIn(int fadeIn) { this.fadeIn = fadeIn; return this; } /** * Défini la durée de l'affichage. * * @param stay La durée de l'affichage. * @return Le builder. */ public TitleBuilder withStay(int stay) { this.stay = stay; return this; } /** * Défini la durée de la transition de sortie. * * @param fadeOut La durée de la transition de sortie. * @return Le builder. */ public TitleBuilder withFadeOut(int fadeOut) { this.fadeOut = fadeOut; return this; } /** * @return Le title. */ public Title build() { if (title == null && subtitle == null) { throw new IllegalArgumentException("title or subtitle can't be empty!"); } return new Title() { @Override public String getTitle() { return title; } @Override public String getSubtitle() { return subtitle; } @Override public int getFadeIn() { return fadeIn; } @Override public int getStay() { return stay; } @Override public int getFadeOut() { return fadeOut; } }; } }
true
3fc264123475d2df22fc7a7d4eeee55ab89adab6
Java
leonkielstra/BPEL-to-BPMN-converter
/src/test/java/factories/BPMNBuilderFactory.java
UTF-8
445
1.796875
2
[ "Apache-2.0" ]
permissive
package factories; import org.bpel2bpmn.utilities.builders.BPMNBuilder; import org.camunda.bpm.model.bpmn.instance.Definitions; public class BPMNBuilderFactory { public static BPMNBuilder create() { BPMNBuilder builder = new BPMNBuilder(); Definitions definitions = builder.createDefinitions("bpel-to-bpmn-testsuite"); builder.createExecutableProcess(definitions, "testProcess"); return builder; } }
true
4d5873b9dfa0fa6fcb3fb38039c539abad143866
Java
jbescos/helidon
/nima/webserver/webserver/src/main/java/io/helidon/nima/webserver/LoomServer.java
UTF-8
8,927
1.820313
2
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LGPL-2.0-or-later", "LicenseRef-scancode-philippe-de-muyter", "LGPL-2.1-or-later", "LicenseRef-scancode-unicode", "LicenseRef-scancode-warranty-disclaimer", "EPL-1.0", "Classpath-exception-2.0", "LicenseRef-scancode-protobuf", "APSL-1.0", "GCC-exception-3.1", "EPL-2.0", "CC0-1.0", "CDDL-1.0", "LicenseRef-scancode-unknown-license-reference", "APSL-2.0", "MIT", "GPL-3.0-only", "GPL-1.0-or-later", "CC-PDDC", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LGPL-2.1-only", "LicenseRef-scancode-generic-export-compliance" ]
permissive
/* * Copyright (c) 2022 Oracle and/or its affiliates. * * 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 io.helidon.nima.webserver; import java.lang.management.ManagementFactory; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; import io.helidon.common.Version; import io.helidon.common.context.Context; import io.helidon.nima.http.encoding.ContentEncodingContext; import io.helidon.nima.http.media.MediaContext; import io.helidon.nima.webserver.http.DirectHandlers; import io.helidon.nima.webserver.spi.ServerConnectionProvider; class LoomServer implements WebServer { private static final System.Logger LOGGER = System.getLogger(LoomServer.class.getName()); private static final String EXIT_ON_STARTED_KEY = "exit.on.started"; private final Map<String, ServerListener> listeners; private final AtomicBoolean running = new AtomicBoolean(); private final Lock lifecycleLock = new ReentrantLock(); private final ExecutorService executorService; private volatile List<ListenerFuture> startFutures; private boolean alreadyStarted = false; private final Context context; LoomServer(Builder builder, DirectHandlers simpleHandlers) { List<ServerConnectionProvider> connectionProviders = builder.connectionProviders(); Map<String, Router> routers = builder.routers(); Map<String, ListenerConfiguration.Builder> sockets = builder.socketBuilders(); Set<String> socketNames = new HashSet<>(routers.keySet()); socketNames.addAll(sockets.keySet()); Map<String, ServerListener> listeners = new HashMap<>(socketNames.size()); Router defaultRouter = routers.get(DEFAULT_SOCKET_NAME); if (defaultRouter == null) { defaultRouter = Router.empty(); } MediaContext mediaContext = builder.mediaContext(); ContentEncodingContext contentEncodingContext = builder.contentEncodingContext(); for (String socketName : socketNames) { Router router = routers.get(socketName); if (router == null) { router = defaultRouter; } ListenerConfiguration.Builder socketBuilder = sockets.get(socketName); ListenerConfiguration socketConfig; if (socketBuilder == null) { socketConfig = ListenerConfiguration.create(socketName); } else { socketConfig = socketBuilder.build(); } listeners.put(socketName, new ServerListener(this, connectionProviders, socketName, socketConfig, router, simpleHandlers, mediaContext, contentEncodingContext)); } this.listeners = Map.copyOf(listeners); this.executorService = Executors.newThreadPerTaskExecutor(Thread.ofVirtual() .allowSetThreadLocals(true) .inheritInheritableThreadLocals(false) .factory()); this.context = builder.context(); } @Override public WebServer start() { try { lifecycleLock.lockInterruptibly(); } catch (InterruptedException e) { throw new RuntimeException("Interrupted", e); } try { if (running.compareAndSet(false, true)) { if (alreadyStarted) { running.set(false); throw new IllegalStateException("Server cannot be stopped and restarted, please create a new server"); } alreadyStarted = true; startIt(); } } finally { lifecycleLock.unlock(); } return this; } @Override public WebServer stop() { try { lifecycleLock.lockInterruptibly(); } catch (InterruptedException e) { throw new RuntimeException("Interrupted", e); } try { if (running.get()) { stopIt(); } } finally { lifecycleLock.unlock(); } return this; } @Override public boolean isRunning() { return running.get(); } @Override public int port(String socketName) { if (!running.get()) { return -1; } ServerListener listener = listeners.get(socketName); return listener == null ? -1 : listener.port(); } @Override public boolean hasTls(String socketName) { return false; } @Override public Context context() { return context; } private void stopIt() { parallel("stop", ServerListener::stop); running.set(false); LOGGER.log(System.Logger.Level.INFO, "Níma server stopped all channels."); } private void startIt() { long now = System.currentTimeMillis(); boolean result = parallel("start", ServerListener::start); if (!result) { LOGGER.log(System.Logger.Level.ERROR, "Níma server failed to start, shutting down"); parallel("stop", ServerListener::stop); if (startFutures != null) { startFutures.forEach(future -> future.future().cancel(true)); } return; } Runtime.getRuntime() .addShutdownHook(new Thread(() -> { listeners.values().forEach(ServerListener::stop); if (startFutures != null) { startFutures.forEach(future -> future.future().cancel(true)); } }, "shutdown-hook")); now = System.currentTimeMillis() - now; long uptime = ManagementFactory.getRuntimeMXBean().getUptime(); LOGGER.log(System.Logger.Level.INFO, "Helidon Níma " + Version.VERSION); LOGGER.log(System.Logger.Level.INFO, "Started all channels in " + now + " milliseconds. " + uptime + " milliseconds since JVM startup. " + "Java " + Runtime.version()); if ("!".equals(System.getProperty(EXIT_ON_STARTED_KEY))) { LOGGER.log(System.Logger.Level.INFO, String.format("Exiting, -D%s set.", EXIT_ON_STARTED_KEY)); System.exit(0); } } // return false if anything fails private boolean parallel(String taskName, Consumer<ServerListener> task) { boolean result = true; List<ListenerFuture> futures = new LinkedList<>(); for (ServerListener listener : listeners.values()) { futures.add(new ListenerFuture(listener, executorService.submit(() -> { Thread.currentThread().setName(taskName + " " + listener); task.accept(listener); }))); } for (ListenerFuture listenerFuture : futures) { try { listenerFuture.future().get(); } catch (InterruptedException e) { LOGGER.log(System.Logger.Level.ERROR, "Failed to start listener, interrupted: " + listenerFuture.listener.configuredAddress(), e); result = false; } catch (ExecutionException e) { LOGGER.log(System.Logger.Level.ERROR, "Failed to start listener: " + listenerFuture.listener.configuredAddress(), e); result = false; } } this.startFutures = futures; return result; } private record ListenerFuture(ServerListener listener, Future<?> future) { } }
true
68191d39d33ef7595d89749dc5d95329a73a4955
Java
woniukeji/JianGuo_Server
/src/com/jianguo/sql/T_hobby_Sql.java
UTF-8
6,080
2.21875
2
[]
no_license
package com.jianguo.sql; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.jianguo.bean.T_hobby_time_Bean; import com.jianguo.bean.T_hobby_type_Bean; import com.jianguo.util.DButil; public class T_hobby_Sql { public static boolean check_type(String login_id,String type){ Connection conn=DButil.getCon(); boolean b = true; PreparedStatement pstmt = null; ResultSet rs = null; try { String sql = "select * from t_hobby_type where login_id=? and type=?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, login_id); pstmt.setString(2, type); rs = pstmt.executeQuery(); b = rs.next(); pstmt.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } return b; } public static int insert_type(String login_id,String type){ int num=0; Connection conn=DButil.getCon(); String sql="insert into t_hobby_type(login_id,type) values(?,?)"; PreparedStatement pst=DButil.getPstm(conn, sql); try { pst.setString(1, login_id); pst.setString(2, type); num=pst.executeUpdate(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ DButil.close(conn); DButil.psClose(pst); } return num; } public static int insert_time(String login_id,String time){ int num=0; Connection conn=DButil.getCon(); String sql="insert into t_hobby_time(login_id,time) values(?,?)"; PreparedStatement pst=DButil.getPstm(conn, sql); try { pst.setString(1, login_id); pst.setString(2, time); num=pst.executeUpdate(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ DButil.close(conn); DButil.psClose(pst); } return num; } public static List<T_hobby_type_Bean> select_type(String login_id){ List<T_hobby_type_Bean> list=new ArrayList<T_hobby_type_Bean>(); ResultSet rs=null; Connection conn=DButil.getCon(); String sql = "select * from t_hobby_type where login_id=?"; PreparedStatement psmt = DButil.getPstm(conn, sql); try { psmt.setString(1,login_id); rs=psmt.executeQuery(); while(rs.next()){ T_hobby_type_Bean t_hobby_type = new T_hobby_type_Bean(); t_hobby_type.setId(rs.getInt("id")); t_hobby_type.setLogin_id(rs.getInt("login_id")); t_hobby_type.setType(rs.getInt("type")); list.add(t_hobby_type); } psmt.close(); conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ DButil.close(conn); } return list; } public static List<T_hobby_type_Bean> select_lll(String type){ List<T_hobby_type_Bean> list=new ArrayList<T_hobby_type_Bean>(); ResultSet rs=null; Connection conn=DButil.getCon(); String sql = "select * from t_hobby_type where type=0 or type=?"; // String sql = "select b.login_id FROM t_hobby_type b where b.login_id in(SELECT a.login_id from t_hobby_time a where a.time='"+time+"') AND b.type in("+type+",0)"; PreparedStatement psmt = DButil.getPstm(conn, sql); try { // psmt.setInt(1,time); psmt.setString(1,type); rs=psmt.executeQuery(); while(rs.next()){ T_hobby_type_Bean t_hobby_type = new T_hobby_type_Bean(); t_hobby_type.setId(rs.getInt("id")); t_hobby_type.setLogin_id(rs.getInt("login_id")); t_hobby_type.setType(rs.getInt("type")); list.add(t_hobby_type); } psmt.close(); conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ DButil.close(conn); } return list; } public static List<T_hobby_time_Bean> select_time(String login_id){ List<T_hobby_time_Bean> list=new ArrayList<T_hobby_time_Bean>(); ResultSet rs=null; Connection conn=DButil.getCon(); String sql = "select * from t_hobby_time where login_id=?"; PreparedStatement psmt = DButil.getPstm(conn, sql); try { psmt.setString(1,login_id); rs=psmt.executeQuery(); while(rs.next()){ T_hobby_time_Bean t_hobby_time = new T_hobby_time_Bean(); t_hobby_time.setId(rs.getInt("id")); t_hobby_time.setLogin_id(rs.getInt("login_id")); t_hobby_time.setTime(rs.getInt("time")); list.add(t_hobby_time); } psmt.close(); conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ DButil.close(conn); } return list; } public static T_hobby_time_Bean select_time_aa(String login_id){ ResultSet rs=null; T_hobby_time_Bean t_hobby_time = new T_hobby_time_Bean(); Connection conn=DButil.getCon(); String sql = "select * from t_hobby_time where login_id=?"; PreparedStatement psmt = DButil.getPstm(conn, sql); try { psmt.setString(1,login_id); rs=psmt.executeQuery(); while(rs.next()){ t_hobby_time.setId(rs.getInt("id")); t_hobby_time.setLogin_id(rs.getInt("login_id")); t_hobby_time.setTime(rs.getInt("time")); } psmt.close(); conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ DButil.close(conn); } return t_hobby_time; } public static int delete_type(String login_id){ int num=0; PreparedStatement pstmt = null; Connection conn=DButil.getCon(); try { String sql = "delete from t_hobby_type where login_id=?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, login_id); num = pstmt.executeUpdate(); pstmt.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } return num; } public static int delete_time(String login_id){ int num=0; PreparedStatement pstmt = null; Connection conn=DButil.getCon(); try { String sql = "delete from t_hobby_time where login_id=?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, login_id); num = pstmt.executeUpdate(); pstmt.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } return num; } }
true
30f720ac3f23e7e54f4042223181dabe6ee4222e
Java
thomascherickal/hedera-services
/hedera-node/src/test/java/com/hedera/services/context/properties/ScreenedSysFilePropsTest.java
UTF-8
6,542
1.960938
2
[ "Apache-2.0" ]
permissive
package com.hedera.services.context.properties; /*- * ‌ * Hedera Services Node * ​ * Copyright (C) 2018 - 2021 Hedera Hashgraph, LLC * ​ * 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. * ‍ */ import com.hedera.services.state.merkle.MerkleToken; import com.hederahashgraph.api.proto.java.ServicesConfigurationList; import com.hederahashgraph.api.proto.java.Setting; import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.Map; import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.BDDMockito.mock; import static org.mockito.BDDMockito.verify; class ScreenedSysFilePropsTest { Logger log; ScreenedSysFileProps subject; @BeforeEach public void setup() { log = mock(Logger.class); ScreenedSysFileProps.log = log; subject = new ScreenedSysFileProps(); } @Test public void delegationWorks() { // given: subject.from121 = Map.of("tokens.maxPerAccount", 42); // expect: assertEquals(Set.of("tokens.maxPerAccount"), subject.allPropertyNames()); assertEquals(42, subject.getProperty("tokens.maxPerAccount")); assertTrue(subject.containsProperty("tokens.maxPerAccount")); assertFalse(subject.containsProperty("nonsense")); } @Test public void ignoresNonGlobalDynamic() { // when: subject.screenNew(withJust("notGlobalDynamic", "42")); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.MISPLACED_PROP_TPL, "notGlobalDynamic")); } @Test public void warnsOfUnparseableGlobalDynamic() { // when: subject.screenNew(withJust("tokens.maxPerAccount", "ABC")); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.UNPARSEABLE_PROP_TPL, "ABC", "tokens.maxPerAccount", "NumberFormatException")); } @Test public void incorporatesStandardGlobalDynamic() { // setup: var oldMap = subject.from121; // when: subject.screenNew(withJust("tokens.maxPerAccount", "42")); // then: assertEquals(Map.of("tokens.maxPerAccount", 42), subject.from121); // and: assertNotSame(oldMap, subject.from121); } @Test public void incorporatesLegacyGlobalDynamic() { // when: subject.screenNew(withJust("configAccountNum", "42")); // then: assertEquals(1, subject.from121.size()); assertEquals(42L, subject.from121.get("ledger.maxAccountNum")); // and: verify(log).warn(String.format( ScreenedSysFileProps.DEPRECATED_PROP_TPL, "configAccountNum", "ledger.maxAccountNum")); } @Test public void incorporatesLegacyGlobalDynamicWithTransform() { // when: subject.screenNew(withJust("defaultFeeCollectionAccount", "0.0.98")); // then: assertEquals(1, subject.from121.size()); assertEquals(98L, subject.from121.get("ledger.fundingAccount")); // and: verify(log).warn(String.format( ScreenedSysFileProps.DEPRECATED_PROP_TPL, "defaultFeeCollectionAccount", "ledger.fundingAccount")); } @Test public void warnsOfUnparseableWhitelist() { // given: var unparseableValue = "CryptoCreate,CryptoTransfer,Oops"; // when: subject.screenNew(withJust("scheduling.whitelist", unparseableValue)); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.UNPARSEABLE_PROP_TPL, unparseableValue, "scheduling.whitelist", "IllegalArgumentException")); } @Test public void warnsOfUnusableWhitelist() { // given: var unusableValue = "CryptoCreate,CryptoTransfer,CryptoGetAccountBalance"; // when: subject.screenNew(withJust("scheduling.whitelist", unusableValue)); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.UNUSABLE_PROP_TPL, unusableValue, "scheduling.whitelist")); } @Test public void warnsOfUnusableMaxTokenNameUtf8Bytes() { // setup: String unsupportableValue = "" + (MerkleToken.UPPER_BOUND_TOKEN_NAME_UTF8_BYTES + 1); // when: subject.screenNew(withJust("tokens.maxTokenNameUtf8Bytes", unsupportableValue)); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.UNUSABLE_PROP_TPL, unsupportableValue, "tokens.maxTokenNameUtf8Bytes")); } @Test public void warnsOfUnusableMaxTokenSymbolUtf8Bytes() { // setup: String unsupportableValue = "" + (MerkleToken.UPPER_BOUND_SYMBOL_UTF8_BYTES + 1); // when: subject.screenNew(withJust("tokens.maxSymbolUtf8Bytes", unsupportableValue)); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.UNUSABLE_PROP_TPL, unsupportableValue, "tokens.maxSymbolUtf8Bytes")); } @Test public void warnsOfUnusableGlobalDynamic() { // when: subject.screenNew(withJust("rates.intradayChangeLimitPercent", "-1")); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.UNUSABLE_PROP_TPL, "-1", "rates.intradayChangeLimitPercent")); } @Test public void warnsOfUntransformableGlobalDynamic() { // when: subject.screenNew(withJust("defaultFeeCollectionAccount", "abc")); // then: assertTrue(subject.from121.isEmpty()); // and: verify(log).warn(String.format( ScreenedSysFileProps.UNTRANSFORMABLE_PROP_TPL, "abc", "defaultFeeCollectionAccount", "IllegalArgumentException")); } private ServicesConfigurationList withJust(String name, String value) { return ServicesConfigurationList.newBuilder() .addNameValue(from(name, value)) .build(); } private Setting from(String name, String value) { return Setting.newBuilder().setName(name).setValue(value).build(); } }
true
77c13a1aa68ba09221f3368b0981ad49e4bb7d2b
Java
KkukYang/bitWeb
/WebProject_20201103/src/main/java/ajax/sawon/db/SawonDao.java
UTF-8
4,412
2.59375
3
[]
no_license
package ajax.sawon.db; import oracle.db.OracleConnect; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class SawonDao { OracleConnect db; public SawonDao() { db = OracleConnect.getInstance(); } public void insertSawon(SawonDto dto) { Connection conn = null; PreparedStatement pstmt = null; String sql = "insert into sawon (num,name,driver,gender,address,birthday) " + "values (seq1.nextval,?,?,?,?,?)"; conn = db.getConnection(); try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, dto.getName()); pstmt.setString(2, dto.getDriver()); pstmt.setString(3, dto.getGender()); pstmt.setString(4, dto.getAddress()); pstmt.setString(5, dto.getBirthday()); pstmt.execute(); } catch (SQLException ex) { ex.printStackTrace(); } finally { db.dbClose(pstmt, conn); } } public List<SawonDto> getSawonList() { List<SawonDto> list = new ArrayList<SawonDto>(); ResultSet rs = null; Connection conn = null; PreparedStatement pstmt = null; String sql = "select * from sawon order by num asc"; conn = db.getConnection(); try { pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); while (rs.next()) { SawonDto dto = new SawonDto(); dto.setNum(rs.getString("num")); dto.setName(rs.getString("name")); dto.setDriver(rs.getString("driver")); dto.setGender(rs.getString("gender")); dto.setAddress(rs.getString("address")); dto.setBirthday(rs.getString("birthday")); list.add(dto); } } catch (SQLException ex) { ex.printStackTrace(); } finally { db.dbClose(rs, pstmt, conn); } return list; } public SawonDto getData(String num) { SawonDto dto = new SawonDto(); ResultSet rs = null; Connection conn = null; PreparedStatement pstmt = null; String sql = "select * from sawon where num=?"; conn = db.getConnection(); try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, num); rs = pstmt.executeQuery(); rs.next(); dto.setNum(rs.getString("num")); dto.setName(rs.getString("name")); dto.setDriver(rs.getString("driver")); dto.setGender(rs.getString("gender")); dto.setAddress(rs.getString("address")); dto.setBirthday(rs.getString("birthday")); } catch (SQLException ex) { ex.printStackTrace(); } finally { db.dbClose(rs, pstmt, conn); } return dto; } public void updateSawon(SawonDto dto) { Connection conn = null; PreparedStatement pstmt = null; String sql = "update sawon set name=?,driver=?,gender=?,address=?,birthday=? where num=?"; conn = db.getConnection(); System.out.println("updateSawon:" + dto.getNum()); try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, dto.getName()); pstmt.setString(2, dto.getDriver()); pstmt.setString(3, dto.getGender()); pstmt.setString(4, dto.getAddress()); pstmt.setString(5, dto.getBirthday()); pstmt.setString(6, dto.getNum()); pstmt.execute(); } catch (SQLException ex) { ex.printStackTrace(); } finally { db.dbClose(pstmt, conn); } } public void deleteSawon(String num) { Connection conn = null; PreparedStatement pstmt = null; String sql = "delete from sawon where num=?"; conn = db.getConnection(); System.out.println("num:" + num); try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, num); pstmt.execute(); } catch (SQLException ex) { ex.printStackTrace(); } finally { db.dbClose(pstmt, conn); } } }
true
4ff05e729bcdf31083fb3b4e53adea107e446b5c
Java
sevrukandrey/carsReader
/src/test/java/com/playtika/automation/web/CarsReaderControllerIntegrationTest.java
UTF-8
2,300
2.3125
2
[]
no_license
package com.playtika.automation.web; import com.playtika.automation.service.CarsReaderService; import org.apache.commons.io.FileUtils; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import static org.mockito.Mockito.verify; import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @WebMvcTest(CarsReaderController.class) public class CarsReaderControllerIntegrationTest { @Autowired private MockMvc mockMvc; @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); @MockBean private CarsReaderService service; private String fileLocation; @Before public void init() throws IOException { List<String> expected = new ArrayList<>(); expected.add("Audy,q1,green,2010,aa1010aa,0937746730,100"); File file = createFileWithData(expected, "test.txt"); fileLocation = getFileLocation(file); } @Test public void shouldAddCar() throws Exception { mockMvc.perform(post("/file") .contentType(APPLICATION_JSON_UTF8_VALUE) .content(fileLocation)) .andExpect(status().isOk()); verify(service).resolveCarFromFile(fileLocation); } public File createFileWithData(List<String> expected, String name) throws IOException { File tempFile = tempFolder.newFile(name); FileUtils.writeLines(tempFile, expected); return tempFile; } private String getFileLocation(File file) throws MalformedURLException { return file.toURI().toURL().toString(); } }
true
0db1cc8c1df253a20c2ef7615a810a853552e18f
Java
gusbru/PlotInJava
/src/sample/MonteCarloIntegral.java
UTF-8
1,017
2.890625
3
[]
no_license
package sample; import javafx.scene.chart.XYChart; import java.util.Random; public class MonteCarloIntegral implements Runnable { private final double BOLTZMANN_K = 1.38064E-23; private XYChart.Series data; private double temperature, mass, vmin, vmax; private int numberOfPoints; private Random random; public MonteCarloIntegral(XYChart.Series data, double mass, double temperature, int numberOfPoints, double vmin, double vmax, Random random) { this.data = data; this.mass = mass; this.temperature = temperature; this.numberOfPoints = numberOfPoints; this.vmin = vmin; this.vmax = vmax; this.random = random; Thread thread = new Thread(this); thread.start(); } @Override public void run() { double gi, G; // convert mass from au to kg mass *= 1.66053904E-27; double extraTerm = (Math.PI / 8.0) * Math.pow((mass / (BOLTZMANN_K * temperature)), 3.0); } }
true
afd3c790de4808b59bf777f95042dd8ffc6a7872
Java
Kevin-Sim/Sudoku
/src/ea/EA.java
UTF-8
3,433
3.015625
3
[]
no_license
package ea; import java.util.ArrayList; import java.util.Random; import sudoku.Gui; import sudoku.SudokuChecker; public class EA { static Random rnd = Parameters.rnd; public static void main(String[] args) { ArrayList<Individual> population = new ArrayList<>(); for (int i = 0; i < Parameters.populationSize; i++) { Individual ind = new Individual(true); population.add(ind); } Individual best = getBest(population); int gen = 0; while (gen < 100000000 && best.fitness > 0) { gen++; Individual parent1 = select(population); Individual parent2 = select(population); Individual child = crossover(parent1, parent2); child = mutate(child); evaluate(child); replace(child, population); best = getBest(population); System.out.println("" + gen + "\t" + best.fitness); } // fix but doesn't guarantee solvable for (int row = 0; row < 9; row++) { for (int col = 0; col < 9; col++) { if (SudokuChecker.getConflicts(row, col, best.chromosome) > 0) { best.chromosome[row][col] = 0; } } } best.fitness = SudokuChecker.getFitness(best.chromosome); for (int row = 0; row < 9; row++) { for (int col = 0; col < 9; col++) { System.out.print(best.chromosome[row][col] + "\t"); } System.out.println(); } System.out.println(best.fitness); SudokuChecker.board = best.chromosome; Gui.main(null); } private static void replace(Individual child, ArrayList<Individual> population) { int worstIdx = getWorstIdx(population); if(child.fitness < population.get(worstIdx).fitness) { population.set(worstIdx, child); } } private static int getWorstIdx(ArrayList<Individual> population) { int worstFitness = population.get(0).fitness; int worstIdx = 0; for(int i = 1; i < population.size(); i++) { if(population.get(i).fitness > worstFitness) { worstFitness = population.get(i).fitness; worstIdx = i; } } return worstIdx; } private static void evaluate(Individual child) { child.fitness = SudokuChecker.getFitness(child.chromosome); } private static Individual mutate(Individual child) { for (int row = 0; row < 9; row++) { for (int col = 0; col < 9; col++) { if(rnd.nextDouble() > Parameters.mutationProbability) { child.chromosome[row][col] = 1 + rnd.nextInt(9); } } } return child; } private static Individual crossover(Individual parent1, Individual parent2) { Individual child = new Individual(false); int r = rnd.nextInt(9); int c = rnd.nextInt(9); Individual currentParent = parent1; for (int row = 0; row < 9; row++) { for (int col = 0; col < 9; col++) { if (row == r && col == c) { currentParent = parent2; } child.chromosome[row][col] = currentParent.chromosome[row][col]; } } return child; } private static Individual select(ArrayList<Individual> population) { Individual best = population.get(rnd.nextInt(population.size())); for (int i = 1; i < Parameters.tournamentSize; i++) { Individual candidate = population.get(rnd.nextInt(population.size())); if (candidate.fitness < best.fitness) { best = candidate; } } return best.copy(); } private static Individual getBest(ArrayList<Individual> population) { Individual best = population.get(0); for (int i = 1; i < population.size(); i++) { if (population.get(i).fitness < best.fitness) { best = population.get(i); } } return best.copy(); } }
true
9b79c5bd0c9053aa75a609f2e46dc536cb776354
Java
Sagot86/TestProject
/arrays/src/main/java/array/Element.java
UTF-8
249
1.851563
2
[]
no_license
package array; import lombok.Data; import lombok.RequiredArgsConstructor; /** * Element. * * @author Igor_Orlov */ @Data @RequiredArgsConstructor public class Element { private final int xCoordinate; private final int yCoordinate; }
true
d343dc658acc53a8259938bc1239d9f73a73b440
Java
health-program/hangfeng
/src/main/java/com/paladin/hf/model/org/OrgUnit.java
UTF-8
2,133
1.882813
2
[]
no_license
package com.paladin.hf.model.org; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Id; import com.paladin.framework.common.UnDeleteBaseModel; public class OrgUnit extends UnDeleteBaseModel { public final static int UNIT_TYPE_AGENCY = 1; public final static int UNIT_TYPE_ASSESS_TEAM = 2; public final static int UNIT_TYPE_DEPARTMENT = 3; @Id @Column(name = "uid") @GeneratedValue(generator = "UUID") private String uid; private String unitName; private String unitDescription; private String parentUnitId; private Integer unitType; private Integer agencyType; private Integer sort; private String districtCode; private String contact; private String contactPhone; public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getUnitName() { return unitName; } public void setUnitName(String unitName) { this.unitName = unitName; } public String getUnitDescription() { return unitDescription; } public void setUnitDescription(String unitDescription) { this.unitDescription = unitDescription; } public String getParentUnitId() { return parentUnitId; } public void setParentUnitId(String parentUnitId) { this.parentUnitId = parentUnitId; } public Integer getUnitType() { return unitType; } public void setUnitType(Integer unitType) { this.unitType = unitType; } public String getDistrictCode() { return districtCode; } public void setDistrictCode(String districtCode) { this.districtCode = districtCode; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getContactPhone() { return contactPhone; } public void setContactPhone(String contactPhone) { this.contactPhone = contactPhone; } public Integer getAgencyType() { return agencyType; } public void setAgencyType(Integer agencyType) { this.agencyType = agencyType; } public Integer getSort() { return sort; } public void setSort(Integer sort) { this.sort = sort; } }
true
2a8f424bf7b7a3001bc0570b91539d4b78731057
Java
manxist256/MovingBit
/src/Practice/ReplaceAll0With5.java
UTF-8
726
3.25
3
[ "Apache-2.0" ]
permissive
/* * 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 Practice; import java.util.Scanner; /** * * @author mankank */ public class ReplaceAll0With5 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); int[] array = new int[String.valueOf(num).length()]; int ptr = array.length - 1; while (num > 0) { array[ptr] = num % 10 == 0 ? 5 : num % 10; num /= 10; ptr--; } for (int i : array) { System.out.print(i); } } }
true
5dec25edb181ffbfdcd1e44db859127374095631
Java
swaroop-m/OnlineShopping
/src/main/java/com/cg/onlineshopping/service/IAddressService.java
UTF-8
650
2.015625
2
[]
no_license
package com.cg.onlineshopping.service; /* * @Author: Shrestha Chowdhury (JEEFSI_Uni41) * Code starts here */ import java.util.List; import org.springframework.stereotype.Service; import com.cg.onlineshopping.entities.Address; @Service public interface IAddressService { public Address addAddress(Address add);// add address method public Address updateAddress(Address add);//update address method public Address removeAddress(Integer id); //remove address method public List<Address> viewAllAddress();//view all address method public Address viewAddress(int id);//view address method /* * @Author: Shrestha Chowdhury (JEEFSI_Uni41) * Code ends here */ }
true
179a65226a8fca44934ba494b23689ebbde9d917
Java
leon4evil/MaMusicList
/app/src/main/java/com/example/tuill/mamusiclist/AllowStorageReadin.java
UTF-8
1,985
2.125
2
[]
no_license
package com.example.tuill.mamusiclist; import android.Manifest; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import static com.example.tuill.mamusiclist.MainActivity.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE; /** * A simple {@link Fragment} subclass. */ public class AllowStorageReadin extends DialogFragment { public AllowStorageReadin() { // Required empty public constructor } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage("This Application needs access to your storage to display your playlist") .setPositiveButton("Accept", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // FIRE ZE MISSILES! Activity fromActivity = getActivity(); ActivityCompat.requestPermissions(fromActivity,new String[] {Manifest.permission.READ_EXTERNAL_STORAGE},MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE); } }) .setNegativeButton("No way Bro!", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); // Create the AlertDialog object and return it return builder.create(); } }
true
0baa198c3ad25ece13be44b5cf50280a7e16b375
Java
goldenboy777/TangledMaze
/src/me/tangledmaze/gorgeousone/utils/Constants.java
UTF-8
825
2.171875
2
[ "MIT" ]
permissive
package me.tangledmaze.gorgeousone.utils; import org.bukkit.ChatColor; import org.bukkit.Material; public class Constants { public static final String insufficientPerms = ChatColor.RED + "You do not have the Permission for this command.", buildPerm = "tm.build", vipPerm = "tm.build.vip", staffPerm = "tm.build.staff", wandPerm = "tm.build.getwand", mazeTpPerm = "tm.mazetp"; public static final String prefix = ChatColor.DARK_GREEN + "[" + ChatColor.GREEN + "TM" + ChatColor.DARK_GREEN + "] " + ChatColor.YELLOW; public static final Material MAZE_BORDER = Material.REDSTONE_BLOCK, MAZE_EXIT = Material.EMERALD_BLOCK, MAZE_MAIN_EXIT = Material.DIAMOND_BLOCK, SELECTION_CORNER = Material.LAPIS_BLOCK, SELECTION_BORDER = Material.GOLD_BLOCK; }
true
ff7b58911e357eb9feb7289d1d4b821e1bd20a00
Java
itwospace/NaTicket
/app/src/main/java/com/NaTicket/n/holidays/Holiday_Filters_Activity.java
UTF-8
11,608
1.921875
2
[]
no_license
package com.NaTicket.n.holidays; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.TextView; import com.crystal.crystalrangeseekbar.interfaces.OnRangeSeekbarChangeListener; import com.crystal.crystalrangeseekbar.widgets.CrystalRangeSeekbar; import com.NaTicket.n.R; import com.NaTicket.n.common.pojo.Currency_Utils; import com.NaTicket.n.custom.FontTypeface; import com.NaTicket.n.holidays.pojo.AvailableHolidayPackagesDTO; import com.NaTicket.n.holidays.pojo.Holiday_Filters_DTO; import com.NaTicket.n.utils.BackActivity; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; /** * Created by Nagarjuna on 12/19/2017. */ public class Holiday_Filters_Activity extends BackActivity implements View.OnClickListener{ String Currency_Symbol,Currency; Currency_Utils currency_utils; CrystalRangeSeekbar rangeSeekbar; Boolean Filter; ArrayList<AvailableHolidayPackagesDTO> availableHolidaysDTOs; CheckBox zerostar,onestar,twostar,threestar,fourstar,fivestar; TextView Apply,ClearFilter,tvmin,tvmax; LinearLayout zero_layout,one_layout,two_layout,three_layout,four_layout,five_layout; private ArrayList<Double> Amount=new ArrayList<>(); private ArrayList<Integer> Stars=new ArrayList<>(); private ArrayList<String> Subcategory=new ArrayList<>(); LinearLayout Check_box_layout; ArrayList<String> Selected_Sub = new ArrayList<String>(); Holiday_Filters_DTO filterdeatils; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.holiday_filters_activity); currency_utils=new Currency_Utils(this); Currency=currency_utils.getCurrencyValue("Currency"); filterdeatils= (Holiday_Filters_DTO) getIntent().getSerializableExtra("Filteredlist"); availableHolidaysDTOs=(ArrayList<AvailableHolidayPackagesDTO>) getIntent().getSerializableExtra("Holidayslist"); init(); Onres(); Currency_Symbol=currency_utils.getCurrencyValue("Currency_Symbol"); TextView toolbartitle=(TextView)findViewById(R.id.toolbartitle); inittoolbar(); toolbartitle.setText("Filters"); rangeSeekbar.setOnRangeSeekbarChangeListener(new OnRangeSeekbarChangeListener() { @Override public void valueChanged(Number minValue, Number maxValue) { tvmin.setText(Currency_Symbol+String.valueOf(minValue)+""); tvmax.setText(Currency_Symbol+String.valueOf(maxValue)+""); } }); getdatatoset(); } public void getdatatoset(){ String CurrValue=currency_utils.getCurrencyValue("Currency_Value"); for (int i = 0; i < availableHolidaysDTOs.size(); i++) { Subcategory.add(availableHolidaysDTOs.get(i).getSubCategory()); Stars.add(availableHolidaysDTOs.get(i).getHotelRating()); Amount.add((Double.valueOf(availableHolidaysDTOs.get(i).getFareDetails().get(0).getAdultFare()))*Double.parseDouble(CurrValue)); } Amountmethod(); Starsmethod(); ///Delete Duplicates HashSet<String> hashSet = new HashSet<String>(); hashSet.addAll(Subcategory); Subcategory.clear(); Subcategory.addAll(hashSet); if (Subcategory.contains("")){ Subcategory.remove(""); } SetSubcategorylist(Subcategory,Check_box_layout); } private void init(){ Apply= (TextView) findViewById(R.id.Apply); ClearFilter= (TextView) findViewById(R.id.Clear_filter); rangeSeekbar= (CrystalRangeSeekbar) findViewById(R.id.rangeSeekbar); tvmin= (TextView) findViewById(R.id.min_value); tvmax= (TextView) findViewById(R.id.max_value); zerostar= (CheckBox) findViewById(R.id.zero_star_check); onestar= (CheckBox) findViewById(R.id.one_star_check); twostar= (CheckBox) findViewById(R.id.two_star_check); threestar=(CheckBox) findViewById(R.id.three_star_check); fourstar= (CheckBox) findViewById(R.id.four_star_checked); fivestar= (CheckBox) findViewById(R.id.five_star_checked); zero_layout= (LinearLayout) findViewById(R.id.zero_layout); one_layout= (LinearLayout) findViewById(R.id.one_layout); two_layout= (LinearLayout) findViewById(R.id.two_layout); three_layout= (LinearLayout) findViewById(R.id.three_layout); four_layout= (LinearLayout) findViewById(R.id.four_layout); five_layout= (LinearLayout) findViewById(R.id.five_layout); Check_box_layout= (LinearLayout) findViewById(R.id.check_box_layout); Apply.setOnClickListener(this); ClearFilter.setOnClickListener(this); } private void Starsmethod(){ if (Stars.contains(51)){ zero_layout.setVisibility(View.VISIBLE); }else { zero_layout.setVisibility(View.GONE); } if (Stars.contains(52)){ one_layout.setVisibility(View.VISIBLE); }else { one_layout.setVisibility(View.GONE); } if (Stars.contains(53)){ two_layout.setVisibility(View.VISIBLE); }else { two_layout.setVisibility(View.GONE); } if (Stars.contains(54)){ three_layout.setVisibility(View.VISIBLE); }else { three_layout.setVisibility(View.GONE); } if (Stars.contains(55)){ four_layout.setVisibility(View.VISIBLE); }else { four_layout.setVisibility(View.GONE); } if (Stars.contains(56)){ five_layout.setVisibility(View.VISIBLE); }else { five_layout.setVisibility(View.GONE); } } private void SetSubcategorylist(ArrayList<String> SubCategory,LinearLayout Check_box_layout){ if(SubCategory.size()>0){ CheckBox[] checkBoxes = new CheckBox[SubCategory.size()]; for(int i=0;i<SubCategory.size();i++){ final CheckBox checkBox = new CheckBox(Holiday_Filters_Activity.this); FontTypeface fontTypeface=new FontTypeface(Holiday_Filters_Activity.this); checkBox.setTypeface(fontTypeface.getTypefaceAndroid()); checkBox.setText(""+SubCategory.get(i)+""); Check_box_layout.addView(checkBox); checkBoxes[i] = checkBox; if (filterdeatils!=null){ if (filterdeatils.getSelected_Sub().contains(checkBox.getText().toString())){ checkBox.setChecked(true); Selected_Sub.add(checkBox.getText().toString()); } } checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (Selected_Sub.contains(checkBox.getText().toString())){ Selected_Sub.remove(checkBox.getText().toString()); System.out.println("Selected box "+checkBox.getText().toString()); }else { Selected_Sub.add(checkBox.getText().toString()); System.out.println("Selected box "+checkBox.getText().toString()); } } }); } } } private int roundup(double value){ double dAbs = Math.abs(value); int amt2 = (int) dAbs; double result = dAbs - (double) amt2; int finalrate; if (result<0.5){ finalrate= (int) Math.floor(value); }else { finalrate= (int) Math.ceil(value); } return finalrate; } private void Amountmethod(){ double minimum= Collections.min(Amount); double maximum= Collections.max(Amount); rangeSeekbar.setMinValue(roundup(minimum)); rangeSeekbar.setMaxValue(roundup(maximum)); String min= String.valueOf(roundup(minimum)); String max= String.valueOf(roundup(maximum)); tvmin.setText(Currency_Symbol+min+""); tvmax.setText(Currency_Symbol+max+""); System.out.println("Min Rate:: "+minimum); System.out.println("Max RAte:: "+maximum); } @Override public void onClick(View view) { switch(view.getId()){ case R.id.Apply: Filter=true; ischecked(); Intent ip=new Intent(); ip.putExtra("Filter",Filter); ip.putExtra("Filteredlist",filterdeatils); setResult(1,ip); finish(); break; case R.id.Clear_filter: Filter=false; Intent i = new Intent(); i.putExtra("Filter",Filter); setResult(1,i); finish(); break; } } private void ischecked(){ filterdeatils=new Holiday_Filters_DTO(); if (zerostar.isChecked()){ filterdeatils.setzero_star(0); }else { filterdeatils.setzero_star(6); } if (onestar.isChecked()){ filterdeatils.setone_star(1); }else { filterdeatils.setone_star(6); } if (twostar.isChecked()){ filterdeatils.settwo_star(2); }else { filterdeatils.settwo_star(6); } if (threestar.isChecked()){ filterdeatils.setthree_star(3); }else { filterdeatils.setthree_star(6); } if (fourstar.isChecked()){ filterdeatils.setfour_star(4); }else { filterdeatils.setfour_star(6); } if (fivestar.isChecked()){ filterdeatils.setfive_star(5); }else { filterdeatils.setfive_star(6); } filterdeatils.setMin_Rate(Integer.parseInt(String.valueOf(rangeSeekbar.getSelectedMinValue()))); filterdeatils.setMax_Rate(Integer.parseInt(String.valueOf(rangeSeekbar.getSelectedMaxValue()))); filterdeatils.setSelected_Sub(Selected_Sub); } private void Onres(){ if (filterdeatils!=null){ if (filterdeatils.getzero_star()==0){ zerostar.setChecked(true); } if (filterdeatils.getone_star()==1){ onestar.setChecked(true); } if (filterdeatils.gettwo_star()==2){ twostar.setChecked(true); } if (filterdeatils.getthree_star()==3){ threestar.setChecked(true); } if (filterdeatils.getfour_star()==4){ fourstar.setChecked(true); } if (filterdeatils.getfive_star()==5){ fivestar.setChecked(true); } /* rangeSeekbar.setMinStartValue(filterdeatils.getMin_Rate()); rangeSeekbar.apply(); rangeSeekbar.setMaxStartValue(filterdeatils.getMax_Rate()); rangeSeekbar.apply(); tvmin.setText(filterdeatils.getMin_Rate()); tvmax.setText(filterdeatils.getMax_Rate());*/ } } }
true
e1044817a10607e93156f4be79e1f8b194fbb095
Java
easleydp/brew-pilot
/Java/tempctrl/src/main/java/com/easleydp/tempctrl/util/StringUtils.java
UTF-8
2,315
3.296875
3
[ "MIT" ]
permissive
package com.easleydp.tempctrl.util; import java.util.*; import java.util.stream.*; public class StringUtils { public static String substringBetween(String str, String before, String after) { int i = str.indexOf(before); int j = str.indexOf(after, i + before.length()); if (i == -1) throw new RuntimeException("String " + str + " did not contain " + before); if (j == -1) throw new RuntimeException("String " + str + " did not contain " + after); return str.substring(i + before.length(), j); } public static String substringAfter(String str, String before) { int i = str.indexOf(before); if (i == -1) throw new RuntimeException("String " + str + " did not contain " + before); return str.substring(i + before.length()); } /** @returns string such as "19 hours, 31 minutes" */ public static String friendlyUptime(int uptimeMins) { int mins = uptimeMins; if (mins < 60) return mins == 0 ? "0 minutes" : minutesPart(mins); int hours = mins / 60; mins -= hours * 60; if (hours < 24) return joinTimeParts(hoursPart(hours), minutesPart(mins)); int days = hours / 24; hours -= days * 24; if (days < 7) return joinTimeParts(daysPart(days), hoursPart(hours), minutesPart(mins)); int weeks = days / 7; days -= weeks * 7; return joinTimeParts(weeksPart(weeks), daysPart(days), hoursPart(hours), minutesPart(mins)); } private static String weeksPart(int weeks) { return nPart(weeks, "week"); } private static String daysPart(int days) { return nPart(days, "day"); } private static String hoursPart(int hours) { return nPart(hours, "hour"); } private static String minutesPart(int mins) { return nPart(mins, "minute"); } private static String nPart(int n, String name) { if (n == 0) return null; return n + " " + (n == 1 ? name : name + 's'); } private static String joinTimeParts(String... parts) { return Arrays.stream(parts) .filter(p -> p != null) .collect(Collectors.joining(", ")); } }
true
cb2ca26e708b01c18f6805194bf39524fd3e1b57
Java
Romo4ka-bot/java_lab_2020_semester3
/05. WebApp/src/main/java/ru/itis/javalab/repositories/UsersRepositoryJdbcTemplateImpl.java
UTF-8
5,627
2.359375
2
[]
no_license
package ru.itis.javalab.repositories; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import ru.itis.javalab.models.User; import javax.sql.DataSource; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; @Repository(value = "UsersRepositoryJdbcTemplateImpl") public class UsersRepositoryJdbcTemplateImpl implements UsersRepository { private JdbcTemplate jdbcTemplate; private NamedParameterJdbcTemplate namedParameterJdbcTemplate; //language=SQL private static final String SQL_SELECT_BY_ID = "select * from driver where id = ?"; //language=SQL private static final String SQL_SELECT_ALL_WITH_PAGES = "select * from driver order by id limit :limit offset :offset;"; //language=SQL private static final String SQL_SELECT_ALL = "select * from driver"; //language=SQL private static final String SQL_SELECT_BY_AGE = "select * from driver where age = ?"; //language=SQL private static final String SQL_INSERT_USER = "insert into users(firstName, lastName, age, uuid, password) " + "values(:firstName, :lastName, :age, :uuid, :password);"; //language=SQL private static final String SQL_UPDATE = "update users set username = ?, age = ?, uuid = ?, password = ?, first_name = ?, last_name = ? where id = ?"; //language=SQL private static final String SQL_SELECT_BY_UUID = "select * from users where uuid = ?"; //language=SQL private static final String SQL_SELECT_BY_USERNAME = "select * from users where username = ?"; private RowMapper<User> userRowMapper = (row, i) -> User.builder() .id(row.getLong("id")) .firstName(row.getString("first_name")) .lastName(row.getString("last_name")) .username(row.getString("username")) .age(row.getInt("age")) .uuid(row.getString("uuid")) .password(row.getString("password")) .build(); public UsersRepositoryJdbcTemplateImpl(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); } @Override public List<User> findAllByAge(Integer age) { return jdbcTemplate.query(SQL_SELECT_BY_AGE, userRowMapper, age); } @Override public Optional<User> findFirstByFirstnameAndLastname(String firstName, String lastName) { return Optional.empty(); } @Override public Optional<User> findByUuid(String uuid) { User user; try { user = jdbcTemplate.queryForObject(SQL_SELECT_BY_UUID, userRowMapper, uuid); } catch (EmptyResultDataAccessException e) { user = null; } return Optional.ofNullable(user); } @Override public User findAllByUsername(String username) { return jdbcTemplate.queryForObject(SQL_SELECT_BY_USERNAME, userRowMapper, username); } @Override public List<User> findAll() { return jdbcTemplate.query(SQL_SELECT_ALL, userRowMapper); } @Override public List<User> findAll(int page, int size) { Map<String, Object> params = new HashMap<>(); params.put("limit", size); params.put("offset", page * size); return namedParameterJdbcTemplate.query(SQL_SELECT_ALL_WITH_PAGES, params, userRowMapper); } @Override public Optional<User> findById(Long id) { User user; try { user = jdbcTemplate.queryForObject(SQL_SELECT_BY_ID, userRowMapper, id); } catch (EmptyResultDataAccessException e) { user = null; } return Optional.ofNullable(user); } @Override public void save(User entity) {} @Override public Long saveUser(User entity) { String firstName = entity.getFirstName(); String lastName = entity.getLastName(); Integer age = entity.getAge(); String uuid = entity.getUuid(); String password = entity.getPassword(); Map<String, Object> map = new HashMap<>(); map.put("firstName", firstName); map.put("lastname", lastName); map.put("age", age); map.put("uuid", uuid); map.put("password", password); SqlParameterSource sqlParameterSource = new MapSqlParameterSource(map); KeyHolder keyHolder = new GeneratedKeyHolder(); namedParameterJdbcTemplate.update(SQL_INSERT_USER, sqlParameterSource, keyHolder); return (Long) keyHolder.getKey(); } @Override public void update(User entity) { Long id = entity.getId(); String username = entity.getUsername(); String firstName = entity.getFirstName(); String lastName = entity.getLastName(); Integer age = entity.getAge(); String uuid = entity.getUuid(); String password = entity.getPassword(); jdbcTemplate.update(SQL_UPDATE, username, age, uuid, password, firstName, lastName, id); } @Override public void deleteById(Long id) { } @Override public void delete(User entity) { } }
true
ff042dc74eea0b45564ce300c814434a1d1a7ac1
Java
whlee21/gaia
/gaia-shared/src/main/java/gaia/crawl/datasource/DataSourceAPI.java
UTF-8
3,952
1.648438
2
[]
no_license
package gaia.crawl.datasource; import java.util.Date; import java.util.Map; public interface DataSourceAPI { public static final String URL = "url"; public static final String EXCLUDE_PATHS = "exclude_paths"; public static final String INCLUDE_PATHS = "include_paths"; public static final String CRAWL_BOUNDS = "bounds"; public static final String MAX_BYTES = "max_bytes"; public static final String MAX_THREADS = "max_threads"; public static final String INDEX_DIRECTORIES = "index_directories"; public static final String REMOVE_OLD_DOCS = "remove_old_docs"; public static final String MAX_DOCS = "max_docs"; public static final String CRAWL_DEPTH = "crawl_depth"; public static final String DISPLAY_NAME = "name"; public static final String DS_TYPE = "type"; public static final String CRAWLER_TYPE = "crawler"; public static final String COLLECTION = "collection"; public static final String CATEGORY = "category"; public static final String FIELD_MAPPING = "mapping"; public static final String ID = "id"; public static final String PATH = "path"; public static final String USERNAME = "username"; public static final String PASSWORD = "password"; public static final String WINDOWSDOMAIN = "windows_domain"; public static final String AUTHENTICATION = "auth"; public static final String PROXY_HOST = "proxy_host"; public static final String PROXY_PORT = "proxy_port"; public static final String PROXY_USERNAME = "proxy_username"; public static final String PROXY_PASSWORD = "proxy_password"; public static final String PARSING = "parsing"; public static final String INDEXING = "indexing"; public static final String CACHING = "caching"; public static final String COMMIT_WITHIN = "commit_within"; public static final String COMMIT_ON_FINISH = "commit_on_finish"; public static final String VERIFY_ACCESS = "verify_access"; public static final String FS_CRAWL_HOME = "filesystem.crawl.home"; public static final String IGNORE_ROBOTS = "ignore_robots"; public static final String FOLLOW_LINKS = "follow_links"; public static final String ADD_FAILED_DOCS = "add_failed_docs"; public static final String USE_DIRECT_SOLR = "use_direct_solr"; public static final String OUTPUT_ARGS = "output_args"; public static final String OUTPUT_TYPE = "output_type"; public static final String ENABLE_SECURITY_TRIMMING = "enable_security_trimming"; public static final String MAX_RETRIES = "max_retries"; public Date getCreateDate(); public void setCreateDate(Date paramDate); public Date getLastModified(); public void setLastModified(Date paramDate); public String getCategory(); public void setCategory(String paramString); public DataSourceId getDataSourceId(); public void setDataSourceId(DataSourceId paramDataSourceId); public String getDisplayName(); public void setDisplayName(String paramString); public void setCrawlerType(String paramString); public String getCrawlerType(); public String getType(); public String getCollection(); public void setCollection(String paramString); public FieldMapping getFieldMapping(); public void setFieldMapping(FieldMapping paramFieldMapping); public Map<String, Object> getProperties(); public Object getProperty(String paramString); public Object getProperty(String paramString, Object paramObject); public Object setProperty(String paramString, Object paramObject); public void setProperties(Map<String, Object> paramMap); public int getInt(String paramString); public int getInt(String paramString, int paramInt); public long getLong(String paramString); public long getLong(String paramString, long paramLong); public String getString(String paramString); public String getString(String paramString1, String paramString2); public boolean getBoolean(String paramString); public boolean getBoolean(String paramString, boolean paramBoolean); public static enum Bounds { tree, host, domain, none; } }
true
d4b711f23aaa172ce092c7107e0de17aef925c2a
Java
luojiangyu/gouwu
/src/main/java/com/ljy/dao/UserMapper.java
UTF-8
193
1.679688
2
[]
no_license
package com.ljy.dao; import org.springframework.stereotype.Repository; import com.ljy.vo.User; @Repository public interface UserMapper { public User checkUserInfo(User user); }
true
9bdc0bf73edbb0118f94e296bb6d34278ff3f44c
Java
matiasezequieI/POO_PATTERNS
/src/visitor/Items.java
UTF-8
100
1.75
2
[]
no_license
package visitor; public interface Items { public int aceitar(CarrinhoVisitor visitor); }
true
b11f96c3b0bda2ef96ba1c71077836bb51bfb95e
Java
DjVidiX/TAS-FirstProject
/Marek/Klient.java
UTF-8
1,686
2.828125
3
[]
no_license
import java.net.MalformedURLException; import java.rmi.Naming; import java.rmi.NotBoundException; import java.rmi.RMISecurityManager; import java.rmi.RemoteException; import java.util.*; public class Klient { private int id; private String ready; private Interfejs interf = null; private List<Player> players_list = new LinkedList<Player>(); public static void main(String[] args) { if (args.length != 2) { System.out .println("parametry: //host/nazwa nazwa_użytkownika"); System.exit(0); } String file_name = args[0]; String user_name = args[1]; if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } try { Klient k = new Klient(); k.interf = (Interfejs) Naming.lookup(file_name); k.id = k.interf.registryClient(user_name); k.players_list = k.interf.getClientList(); System.out.println("Gdy bedziesz gotów, by rozpocząć grę, wpisz \"r\"\n"); Scanner in = new Scanner(System.in); k.ready = in.next(); k.interf.SetReady(k.id); boolean ready_all = false; while (!ready_all) { for(int i = 0; i < k.players_list.size(); i++) { if (!k.players_list.get(i).isReady()) break; if (i == k.players_list.size() - 1 && k.players_list.get(i).isReady()) ready_all = true; } } //k.interf.GiveAnswer(k.id); } catch (MalformedURLException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } catch (NotBoundException e) { e.printStackTrace(); } } }
true
de86a02c4afa622bddc7d9f596f96f601b3a65e6
Java
surachman/iconos-tarakan
/pk-ejb/src/java/com/pelindo/ebtos/ejb/remote/DeliveryOperationRemote.java
UTF-8
1,301
1.757813
2
[]
no_license
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.pelindo.ebtos.ejb.remote; import javax.ejb.Remote; /** * * @author R. Seno Anggoro A */ @Remote public interface DeliveryOperationRemote { public void handleDeliveryConfirm(com.pelindo.ebtos.model.db.ServiceContDischarge serviceContDischarge, com.pelindo.ebtos.model.db.Equipment equipment) throws com.pelindo.ebtos.exception.TimeSelectionNotValidException, com.pelindo.ebtos.exception.ContainerNotMovableException; public void handleDeliveryConfirmCancelLoading(com.pelindo.ebtos.model.db.CancelLoadingService cancelLoadingService, com.pelindo.ebtos.model.db.Equipment equipment) throws com.pelindo.ebtos.exception.ContainerNotMovableException, com.pelindo.ebtos.exception.TimeSelectionNotValidException; public void handleCancelDeliveryConfirm(com.pelindo.ebtos.model.db.ServiceContDischarge serviceContDischarge, com.pelindo.ebtos.model.db.Equipment equipment) throws com.pelindo.ebtos.exception.LocationNotAvailableException; public void handleCancelDeliveryConfirmCancelLoading(com.pelindo.ebtos.model.db.CancelLoadingService cancelLoadingService, com.pelindo.ebtos.model.db.Equipment equipment) throws com.pelindo.ebtos.exception.LocationNotAvailableException; }
true
f7deb2830039422eeddc6806e8ed91d29450c4d5
Java
vklonin/QA_GURU_3_0
/src/test/java/Task2.java
UTF-8
1,108
2.140625
2
[]
no_license
import com.codeborne.selenide.*; import org.junit.jupiter.api.Test; import static com.codeborne.selenide.Condition.*; import static com.codeborne.selenide.Selectors.*; import static com.codeborne.selenide.Selenide.*; public class Task2 { @Test void checkSoftAssertion(){ // open Selenide link in git with elements open("https://github.com"); $(byName("q")).val("selenide").pressEnter(); $("em").shouldHave(text("selenide")).click(); // check if it is what we expected $("h1").shouldHave(text("selenide / selenide")); //find wiki link and follow $(byText("Wiki")).click(); // check if it is what we expected $("h1",2).shouldHave(text("Welcome to the selenide wiki!")); //find SofAssertion link and go for it $(byText("SoftAssertions")).click(); // check if it is what we expected $("h1",1).shouldHave(text("SoftAssertions")); // check for JUnit code sample $(withText("Using JUnit5")).parent().sibling(0).shouldHave(cssClass("highlight-source-java")); } }
true
a1593b74e3b04d0d2bb2cc226d90872fd324083a
Java
KevenDvorianoff/Comixaire
/src/main/java/com/github/brokenswing/comixaire/controller/StatsController.java
UTF-8
1,452
2.21875
2
[]
no_license
package com.github.brokenswing.comixaire.controller; import com.github.brokenswing.comixaire.di.InjectValue; import com.github.brokenswing.comixaire.exception.InternalException; import com.github.brokenswing.comixaire.facades.clients.ClientsFacade; import com.github.brokenswing.comixaire.facades.item.LibraryItemFacade; import com.github.brokenswing.comixaire.facades.loans.LoansFacade; import com.github.brokenswing.comixaire.javafx.Alerts; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.text.Text; import java.net.URL; import java.util.ResourceBundle; public class StatsController implements Initializable { @FXML private Text libraryItemsCounter; @FXML private Text clientsCounter; @FXML private Text loansCounter; @InjectValue private LibraryItemFacade libraryItemFacade; @InjectValue private ClientsFacade clientsFacade; @InjectValue private LoansFacade loansFacade; @Override public void initialize(URL location, ResourceBundle resources) { try { libraryItemsCounter.setText(Integer.toString(libraryItemFacade.countAll())); clientsCounter.setText(Integer.toString(clientsFacade.countAll())); loansCounter.setText(Integer.toString(loansFacade.countAll())); } catch (InternalException e) { e.printStackTrace(); Alerts.exception(e); } } }
true
580e298afe1fb448226d7606750cb0472f073385
Java
plibin/regadb
/jhivgensim/src/net/sf/hivgensim/queries/framework/QueryOutput.java
UTF-8
442
2.4375
2
[]
no_license
package net.sf.hivgensim.queries.framework; import net.sf.hivgensim.queries.output.ToObjectList; public abstract class QueryOutput<DataType, OutputType> implements IQuery<DataType>{ private OutputType out; public QueryOutput(OutputType out){ this.out = out; } public void output(ToObjectList<DataType> list){ for(DataType t : list.getList()){ process(t); } close(); } public OutputType getOut() { return out; } }
true
6f1fecf32ee316b564266e319843faa23f52cdae
Java
league-level4-student/level4-module4-codeavenger1
/src/asdf/PigLatin.java
UTF-8
1,381
3.15625
3
[]
no_license
package asdf; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class PigLatin { public static void main(String[] args) { PigLatin pig = new PigLatin(); pig.main2(); pig.isLetter('a'); } public static void main2() { JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.add(panel); frame.show(); JTextField text1 = new JTextField(10); JButton button = new JButton(); JTextField text2 = new JTextField(10); panel.add(text1); panel.add(button); panel.add(text2); button.setLabel("Translate"); frame.pack(); } private static boolean isLetter(char c) { return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); } public String translate(String s) { String latin = ""; int i = 0; while (i < s.length()) { while (i < s.length() && !isLetter(s.charAt(i))) { latin = latin + s.charAt(i); i++; } if (i>=s.length()) break; int begin = i; while (i < s.length() && isLetter(s.charAt(i))) { i++; } int end = i; latin = latin + pigWord(s.substring(begin, end)); } return latin; } private static int firstVowel(String word) { word = word.toLowerCase(); for (int i=0; i < word.length(); i++) if (word.charAt(i)=='a' || word.charAt(i)=='e' || word.charAt(i)=='i' || word.charAt(i)=='o' || word.charAt(i)=='u') return i; return 0; } }
true
63ee1d02a450e09b177fb9d73cf5ce8d35ed7e39
Java
AfonyaAnf/TestMagnit
/app/src/main/java/com/example/alexey/test/db/StationEntityDao.java
UTF-8
1,416
2.09375
2
[]
no_license
package com.example.alexey.test.db; import android.arch.lifecycle.LiveData; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Insert; import android.arch.persistence.room.OnConflictStrategy; import android.arch.persistence.room.Query; import com.example.alexey.test.model.entity.StationEntity; import java.util.List; /** * Created by alexey on 23.07.18. */ @Dao public interface StationEntityDao { @Query("SELECT * FROM station") LiveData<List<StationEntity>> getAll(); @Query("SELECT * FROM station WHERE isFrom = 1 AND stationTitle LIKE :search ORDER BY cityId") LiveData<List<StationEntity>> getFromStations(String search); @Query("SELECT * FROM station WHERE isTo = 1 AND stationTitle LIKE :search ORDER BY cityId") LiveData<List<StationEntity>> getToStations(String search); @Query("SELECT * FROM station WHERE stationId = :id") LiveData<StationEntity> getById(long id); @Query("SELECT Count(*) FROM station") int getCountRows(); @Insert(onConflict = OnConflictStrategy.IGNORE) List<Long> insertAll(List<StationEntity> city); @Query("UPDATE station SET isFrom = 1 WHERE stationId = :stationId;") void setStationFromFlag(long stationId); @Query("UPDATE station SET isTo = 1 WHERE stationId = :stationId;") void setStationToFlag(long stationId); @Query("DELETE FROM station") void deleteAll(); }
true
505d341ab0184b6911db3f5f2f9619217606fcef
Java
fracz/refactor-extractor
/results-java/androidannotations--androidannotations/d1be16f9705a4ac907924b6f1b3748d3e1dd6a48/after/UiThreadExecutor.java
UTF-8
2,590
2.515625
3
[]
no_license
/** * Copyright (C) 2010-2015 eBusiness Information, Excilys Group * * 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.androidannotations.api; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.os.Handler; /** * This class provide operations for * {@link org.androidannotations.annotations.UiThread UiThread} tasks. */ public class UiThreadExecutor { private static final Map<String, List<Runnable>> TASKS = new HashMap<String, List<Runnable>>(); private static final Map<Runnable, Handler> HANDLERS = new HashMap<Runnable, Handler>(); private UiThreadExecutor() { // should not be instantiated } /** * Store a new task in the map for providing cancellation. This method is * used by AndroidAnnotations and not intended to be called by clients. * * @param id * the identifier of the task * @param task * the task itself * @param handler * the {@link Handler} which runs the task */ public static synchronized void addTask(String id, Runnable task, Handler handler) { List<Runnable> runnables = TASKS.get(id); if (runnables == null) { runnables = new ArrayList<Runnable>(); TASKS.put(id, runnables); } runnables.add(task); HANDLERS.put(task, handler); } /** * Cancel all tasks having the specified <code>id</code>. * * @param id * the cancellation identifier */ public static synchronized void cancelAll(String id) { List<Runnable> runnables = TASKS.remove(id); if (runnables != null) { for (Runnable runnable : runnables) { HANDLERS.remove(runnable).removeCallbacks(runnable); } } } public static synchronized void done(String id, Runnable runnable) { Handler handler = HANDLERS.remove(runnable); if (handler != null) { List<Runnable> runnables = TASKS.get(id); runnables.remove(runnable); // potentially empty array stays in map for reducing garbage // collecting - // it is highly possible, that array will be reused at the next // addTask call } } }
true
62ae60702b3005ca4bb2fe79549ee6ba5b84aca1
Java
fportillo/jaxb-poc
/src/main/java/br/com/almana/domain/City.java
UTF-8
1,289
2.5
2
[]
no_license
package br.com.almana.domain; 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.XmlRootElement; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class City { @XmlElement private String name; @XmlAttribute private FederationUnit fedUnit; public String getName() { return name; } public void setName(String name) { this.name = name; } public FederationUnit getFedUnit() { return fedUnit; } public void setFedUnit(FederationUnit fedUnit) { this.fedUnit = fedUnit; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); return builder.append(fedUnit).append(name).hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; City other = (City) obj; EqualsBuilder builder = new EqualsBuilder(); return builder.append(fedUnit, other.getFedUnit()) .append(name, other.getName()).isEquals(); } }
true
d5170872ea909a12e6c9c2c39007f2dd40087c82
Java
wangchao550586585/Head-First-Design-Patterns
/src/BehavioralPattern/L_State/a/GumballMachine.java
UTF-8
2,353
3.4375
3
[]
no_license
package BehavioralPattern.L_State.a; public class GumballMachine { // 存储糖果机4状态,糖果售空,没有25分(糖果25/1个),有25分,出售 final static int SOLD_OUT = 0; final static int NO_QUARTER = 1; final static int HAS_QURATER = 2; final static int SOLD = 3; // 跟踪当前状态,默认没糖果 int state = SOLD_OUT; // 追踪机器糖果数目 int count = 0; public GumballMachine(int count) { this.count = count; if (count > 0) state = NO_QUARTER; } public void insertQuarter() { if (state == HAS_QURATER) { System.out.println("不能再投入25分"); } else if (state == NO_QUARTER) { state = HAS_QURATER; System.out.println("你投入了25分"); } else if (state == SOLD_OUT) { System.out.println("糖果售空,不能插入25分"); } else if (state == SOLD) { System.out.println("请等待"); } } public void ejectQuarter() { if (state == HAS_QURATER) { System.out.println("退回25分"); state = NO_QUARTER; } else if (state == NO_QUARTER) { System.out.println("没有钱,无法退回"); } else if (state == SOLD_OUT) {// 糖果售空,无法投入钱,也就无法退出钱 System.out.println("无法退回"); } else if (state == SOLD) {// 已经出售糖果,无法退回钱 System.out.println("无法退回"); } } public void turnCrank() { if (state == SOLD) { System.out.println("别想骗机器拿2次糖果"); } else if (state == NO_QUARTER) { System.out.println("请先投入25分"); } else if (state == SOLD_OUT) { System.out.println("售空,无法给予糖果"); } else if (state == HAS_QURATER) { System.out.println("已售出"); state = SOLD; dispense(); } } public void dispense() { if (state == SOLD) { System.out.println("正在售出糖果"); count--; if (count == 0) { System.out.println("糖果已经售完"); state = SOLD_OUT; } else { state = NO_QUARTER; } }// 下面这些都不应该发生 else if (state == NO_QUARTER) { System.out.println("需要投入钱"); } else if (state == SOLD_OUT) { System.out.println("没糖果出售"); } else if (state == HAS_QURATER) { System.out.println("没有糖果出售"); } } @Override public String toString() { return "GumballMachine [state=" + state + ", count=" + count + "]"; } }
true
6412d656d318c52715b8b64ed791b4e5842a402f
Java
rhythmic-zone/v2.0
/cloud/src/main/java/com/medzone/cloud/defender/ConnectivityReceiver.java
UTF-8
1,103
2.140625
2
[]
no_license
/** * */ package com.medzone.cloud.defender; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * @author ChenJunQi. * */ public class ConnectivityReceiver extends BroadcastReceiver { private ConnectivityManager connectivityManager; private NetworkInfo info; @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); info = connectivityManager.getActiveNetworkInfo(); if (info != null && info.isAvailable()) { String name = info.getTypeName(); Intent mIntent = new Intent(BroadCastUtil.ACTION_NET_CONNECTED); mIntent.putExtra("extra", name); context.sendBroadcast(mIntent); } else { Intent mIntent = new Intent( BroadCastUtil.ACTION_NET_DISCONNECTED); context.sendBroadcast(mIntent); } } } }
true
561fcf7e3b8bc7dee260bea56ece9e673343919b
Java
ktc45622/WaterQuality
/src/java/database/DataFilter.java
UTF-8
6,754
2.015625
2
[]
no_license
/* BSD 3-Clause License * * Copyright (c) 2017, Louis Jenkins <LouisJenkinsCS@hotmail.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Louis Jenkins, Bloomsburg University nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package database; import async.DataReceiver; import common.DataValue; import com.github.davidmoten.rx.jdbc.Database; import io.reactivex.Flowable; import io.reactivex.Observable; import java.sql.Timestamp; import java.time.Duration; import java.time.Instant; import java.time.Period; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import org.apache.log4j.BasicConfigurator; import org.javatuples.Pair; /** * In-memory RCU data filter. See 'CacheBundle' javadoc for explanation for reasoning behind * choosing RCU and how it works. * @author Louis Jenkins */ public class DataFilter { public AtomicReference<Set<Long>> filter = new AtomicReference<>(new TreeSet<>()); public static Map<Long, DataFilter> INSTANCES = new ConcurrentHashMap<>(); static { init(); } private final long id; /** * Initialize all filters (for each identifier in the database). If a filter already * exists for that data parameter, it will restore it. */ public static void init() { Database db = Database.from(Web_MYSQL_Helper.getConnection()); /** * L.J: If during initialization it ever fails to start, look here into replacing * with a normoal jdbc operation. Its the only place we have rxjava-jdbc still in use. * Reminder: Initialization error occurs in {@literal <clinit> or <init>} */ db.select("select id from data_parameters") .getAs(Long.class) .flatMap(id -> db.select("select time from data_filter where parameter_id = " + id) .getAs(Long.class) .toList() .map(list -> { Set<Long> set = new TreeSet<>(); set.addAll(list); return set; }) .timeout(30, TimeUnit.SECONDS) .onErrorReturn((Throwable t) -> { DatabaseManager.LogError("Error occurred while restoring data filter for id: " + id + " of type: " + t.getClass().getName() + "\nMessage: " + t.getMessage()); return new TreeSet<>(); }) .map((Set<Long> timestamps) -> Pair.with(id, timestamps)) ) .toMap((Pair<Long, Set<Long>> pair) -> pair.getValue0(), (Pair<Long, Set<Long>> pair) -> new DataFilter(pair.getValue0(), pair.getValue1())) .toBlocking() .subscribe(INSTANCES::putAll); } private DataFilter(long id, Set<Long> set) { this.id = id; if (set != null) { filter.set(set); } } public static DataFilter getFilter(long id) { if (!INSTANCES.containsKey(id)) { DataFilter dataFilter = new DataFilter(id, null); INSTANCES.putIfAbsent(id, dataFilter); System.out.println("Created filter for id: " + id); return dataFilter; } return INSTANCES.get(id); } /** * Uses a RCU (Read-Copy-Update) synchronization strategy to update the filter. * This approach allows the filter to be used by clients, locally, without needing * to access the database, while also allowing concurrent writes (and since technically * we will only have one concurrent writer, contention is no issue; in the case of contention * it is still safe, as it is linearizable at the Compare-And-Set operation, and the loser just * gets to start over). * @param times Set of new times to delete */ public void add(Set<Long> times) { while (true) { // Read... Set<Long> currentFilter = filter.get(); if (currentFilter.containsAll(times)) { System.out.println("Contains all items, skipping..."); return; } // Copy.. Set<Long> localFilter = new TreeSet<>(currentFilter); localFilter.addAll(times); // Update... if (filter.compareAndSet(currentFilter, localFilter)) { break; } } DatabaseManager.insertFilteredData(id, filter.get()); } public Observable<DataValue> filter(Observable<DataValue> data) { Set<Long> currentFilter = filter.get(); return data.filter((DataValue dv) -> !currentFilter.contains(dv.getTimestamp().toEpochMilli())); } public Flowable<DataValue> filter(Flowable<DataValue> data) { Set<Long> currentFilter = filter.get(); return data.filter((DataValue dv) -> !currentFilter.contains(dv.getTimestamp().toEpochMilli())); } }
true
acdb17aafd2d64942cd4bf1cf7f6cb95ff71b6bb
Java
hhiden/kafka-tests
/annotated-processor/src/main/java/com/redhat/processor/container/MessageHandlerApplication.java
UTF-8
3,042
2.8125
3
[]
no_license
package com.redhat.processor.container; import com.redhat.processor.annotations.MessageProcessor; import eu.infomas.annotation.AnnotationDetector; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; /** * This class provides an entry point that scans for all of the message processor * objects in the classpath and starts them all up. * @author hhiden */ public class MessageHandlerApplication { private static final Logger logger = Logger.getLogger(MessageHandlerApplication.class.getName()); private ArrayList<MessageHandlerContainer> containers = new ArrayList<>(); public MessageHandlerApplication() { } public void start(){ findAndInstantiateMessageProcessors(); startMessageHandlerContainers(); } public void shutdown(){ stopMessageHandlerContainers(); } private void findAndInstantiateMessageProcessors(){ logger.info("Scanning for MessageProcessors..."); try { AnnotationDetector.TypeReporter reporter = new AnnotationDetector.TypeReporter() { @Override public void reportTypeAnnotation(Class<? extends Annotation> annotation, String className) { logger.info("Found processor class: " + className); try { Class processorClass = Class.forName(className); final Object processor = processorClass.newInstance(); logger.info("Instantiated: " + processor.getClass().getSimpleName()); final MessageHandlerContainer container = new MessageHandlerContainer(processor); containers.add(container); } catch (Exception e){ logger.log(Level.SEVERE, "Error creating processor class; " + e.getMessage(), e.getMessage()); } } @Override public Class<? extends Annotation>[] annotations() { return new Class[]{MessageProcessor.class}; } }; AnnotationDetector detector = new AnnotationDetector(reporter); detector.detect(); } catch (Exception e){ e.printStackTrace(); } } private void startMessageHandlerContainers(){ logger.info("Starting containers"); for(MessageHandlerContainer c : containers){ c.start(); } } private void stopMessageHandlerContainers(){ for(MessageHandlerContainer c : containers){ c.shutdown(); } } public static void main(String[] args){ MessageHandlerApplication app = new MessageHandlerApplication(); app.start(); Runtime.getRuntime().addShutdownHook(new Thread(() -> { app.shutdown(); System.out.println("SHUTDOWN"); })); } }
true
4799f75f2eca9259f09ac1e050efa73089afd49b
Java
NexusLinkTeam/2DoList
/app/src/main/java/com/jacob/www/a2dolist/ui/adapter/GroupAdapter.java
UTF-8
5,007
1.898438
2
[]
no_license
package com.jacob.www.a2dolist.ui.adapter; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.jacob.www.a2dolist.R; import com.jacob.www.a2dolist.ui.activity.ChatActivity; import com.jacob.www.a2dolist.util.SharePreferenceManager; import java.util.HashMap; import java.util.List; import java.util.Map; import cn.jpush.im.android.api.JMessageClient; import cn.jpush.im.android.api.callback.GetGroupInfoCallback; import cn.jpush.im.android.api.model.GroupInfo; import cn.jpush.im.android.api.model.UserInfo; import de.hdodenhof.circleimageview.CircleImageView; /** * Created by ASUS-NB on 2017/9/5. */ public class GroupAdapter extends RecyclerView.Adapter<GroupAdapter.GroupViewHolder> { private Context mContext; private List<Long> mGroupList; private Map<Long, String> mGroupName = new HashMap<>(); private String groupName; public GroupAdapter(Context context,List<Long> list){ mGroupList = list; mContext = context; } @Override public GroupViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View rootView = LayoutInflater.from(mContext).inflate(R.layout.item_real_group,parent,false); return new GroupViewHolder(rootView); } @Override public void onBindViewHolder(final GroupViewHolder holder, int position) { final Long groupId = mGroupList.get(position); JMessageClient.getGroupInfo(groupId, new GetGroupInfoCallback() { @Override public void gotResult(int i, String s, GroupInfo groupInfo) { if(i==0){ if (TextUtils.isEmpty(groupInfo.getGroupName())) { List<UserInfo> groupMembers = groupInfo.getGroupMembers(); StringBuilder builder = new StringBuilder(); if (groupMembers.size() <= 5) { groupName = getGroupName(groupMembers, builder); } else { List<UserInfo> newGroupMember = groupMembers.subList(0, 5); groupName = getGroupName(newGroupMember, builder); } } else { groupName = groupInfo.getGroupName(); } mGroupName.put(groupId, groupName); holder.groupName.setText(groupName); SharedPreferences sharedPreferences = mContext.getSharedPreferences("groupId",Context.MODE_PRIVATE); String task = sharedPreferences.getString(groupId+"",""); if(task.equals("")) holder.lastMsg.setText("最近任务:暂无"); else holder.lastMsg.setText("最近任务:"+task); // holder.groupAvatar.setImageResource(R.drawable.group); } } }); } @Override public int getItemCount() { return mGroupList.size(); } private String getGroupName(List<UserInfo> groupMembers, StringBuilder builder) { for (UserInfo info : groupMembers) { String noteName = info.getNotename(); if (TextUtils.isEmpty(noteName)) { noteName = info.getNickname(); if (TextUtils.isEmpty(noteName)) { noteName = info.getUserName(); } } builder.append(noteName); builder.append(","); } return builder.substring(0, builder.lastIndexOf(",")); } class GroupViewHolder extends RecyclerView.ViewHolder{ TextView groupName,convNum,lastMsg; CircleImageView groupAvatar; LinearLayout linearLayout; public GroupViewHolder(View itemView) { super(itemView); linearLayout = itemView.findViewById(R.id.container); groupAvatar = itemView.findViewById(R.id.avatar_group); groupName = itemView.findViewById(R.id.name_group); convNum = itemView.findViewById(R.id.conver_num); lastMsg = itemView.findViewById(R.id.text_history_last); linearLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setClass(mContext,ChatActivity.class); Log.e("onClick","ChatActivity"+getPosition()+":"+mGroupList.get(getPosition())); intent.putExtra("groupId",mGroupList.get(getPosition())); mContext.startActivity(intent); } }); } } }
true
eda3996d070fdde9831ac8559448950209859663
Java
HaochengLEE/JavaCore
/src/main/java/com/oo/Interface/INet.java
UTF-8
621
2.953125
3
[]
no_license
package com.oo.Interface; /** * @author lihaocheng * @create 2019-02-02 11:52 AM **/ public interface INet { public void network(); //接口中的常量,默认public static final int time = 123; //default:默认方法,可以带方法体 可以在实现类中重写,并可以通过接口引用调用 default void connection(){ System.out.println("It is a formal connection"); } //static:静态方法 可以带方法体 不可以在实现类中重写,可以通过接口名调用 static void safe(){ System.out.println("protect your phone"); } }
true
787a6c6aeb71653059ccbb479535d1045f2f9ba6
Java
ErikVergani/Java-POO
/src/Aula4/trianguloCalculo.java
UTF-8
428
3.09375
3
[ "MIT" ]
permissive
package Aula4; public class trianguloCalculo { double ladoA = 0; double ladoB = 0; double ladoC = 0; public double calcularPerimetro() { double perimetro = ladoA + ladoB + ladoC; return perimetro; } public double calcularArea() { double sp = calcularPerimetro() / 2; double area = Math.sqrt(sp * (sp - ladoA) * (sp - ladoB) * (sp - ladoC)); return area; } }
true
3508f4569d81d1eb3fa395067bf1b9a4368cc76f
Java
WorstCase00/Music
/src/main/java/mst/music/scoring/ScoringModel.java
UTF-8
3,097
2.46875
2
[]
no_license
package mst.music.scoring; import be.tarsos.dsp.AudioEvent; import be.tarsos.dsp.pitch.PitchDetectionResult; import mst.music.scoring.calc.ScoreCalculation; import mst.music.track.TrackDefinition; import mst.music.track.TrackingState; import org.slf4j.LoggerFactory; public class ScoringModel { private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ScoringModel.class); private final ScoringView view; private final ScoreCalculation scoreCalculation; private TrackingState.State state; private TrackDefinition definition; private int beatsPerMinute; private double startTimestamp; private double endTimestamp; private Score currentScore; public ScoringModel(ScoringView scoringView, ScoreCalculation scoreCalculation) { this.view = scoringView; this.scoreCalculation = scoreCalculation; this.state = TrackingState.State.WAITING; } public void refresh() { currentScore = Score.EMPTY; state = TrackingState.State.WAITING; view.updateScoreBar(0f); view.updateCurrentScore(0f); } public void setTrackDefinitions(TrackDefinition trackDefinition) { scoreCalculation.setDefinition(trackDefinition); this.definition = trackDefinition; } public void setBeatsPerMinute(int beatsPerMinute) { scoreCalculation.setBeatsPerMinute(beatsPerMinute); this.beatsPerMinute = beatsPerMinute; } public void addPitchDetectionResult(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) { if (state.equals(TrackingState.State.WAITING)) { handleInWaiting(pitchDetectionResult, audioEvent); } else if (state.equals(TrackingState.State.TRACKING)) { handleInTracking(pitchDetectionResult, audioEvent); } } float getCurrentScore() { return currentScore.getValue(); } private void handleInTracking(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) { LOGGER.debug("ts: {}", audioEvent.getTimeStamp()); if (audioEvent.getEndTimeStamp() > endTimestamp) { LOGGER.debug("set state to done"); state = TrackingState.State.DONE; } else { int currentIndex = definition.calculateCurrentNoteIndex((long) ((audioEvent.getTimeStamp() - startTimestamp) * 1000), beatsPerMinute); LOGGER.debug("set current note index to: {}", currentIndex); currentScore = scoreCalculation.add(pitchDetectionResult, audioEvent); view.updateScoreBar(currentScore.getPercentage()); view.updateCurrentScore(currentScore.getValue()); } } private void handleInWaiting(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) { if(pitchDetectionResult.getPitch() != -1) { LOGGER.debug("set state to tracking"); state = TrackingState.State.TRACKING; startTimestamp = audioEvent.getTimeStamp(); endTimestamp = audioEvent.getTimeStamp() + definition.getBeatCount() / beatsPerMinute * 60; scoreCalculation.reset(); currentScore = scoreCalculation.add(pitchDetectionResult, audioEvent); LOGGER.debug("end timestamp: {}", endTimestamp); } } public RunResult getCurrentRunResults() { return new DefaultRunResult( definition, beatsPerMinute, currentScore.getValue() ); } }
true
d8bb79351760cd4c320d962a8f847aebe0eea8d1
Java
susann/SpellFlow-DOCs
/SpellFlowEditor.diagram_snippet/src/SpellFlowLanguage/diagram/helperClasses/actions/GotoReferences.java
UTF-8
233
1.632813
2
[]
no_license
package SpellFlowLanguage.diagram.helperClasses.actions; import org.eclipse.jface.action.MenuManager; public class GotoReferences extends MenuManager { public GotoReferences() { super(); this.setMenuText("References"); } }
true
62a534c938af91eaa9446d7cf143c9749a2659f7
Java
jiusan2016/resources
/filter/SessionFilter.java
UTF-8
2,256
1.867188
2
[]
no_license
package com.chngenesis.startrek.filter; import java.io.IOException; import java.util.Date; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.chngenesis.nebula.entity.session.SessionCache; import com.chngenesis.startrek.util.Constants.SessionCaChePlatform; import com.chngenesis.startrek.util.SessionUtil; public class SessionFilter implements Filter { public void destroy() { } public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Origin", "http://localhost:63342"); response.setHeader("Access-Control-Allow-Methods", "GET,POST"); String sessionId = SessionUtil.getSessionId(request); SessionCache sessionCache = null; sessionCache = SessionUtil.getSessionCache(sessionId); if (sessionCache == null) { SessionUtil.saveNewSession(sessionId, SessionCaChePlatform.HIS); } else { long oldDate = sessionCache.getLastTime().getTime(); long newDate = new Date().getTime(); long num = newDate - oldDate; int number = (int) (num / (60 * 1000)); if (number > 30) { SessionUtil.delSession(sessionCache.getSessionKey()); SessionUtil.saveNewSession(sessionId, SessionCaChePlatform.HIS); } else { sessionCache.setLastTime(new Date()); SessionUtil.UpdateSessionAttr(sessionCache); } } request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); filterChain.doFilter(servletRequest, servletResponse); Cookie cookie = new Cookie("JSESSIONID", sessionId); cookie.setPath("/"); response.addCookie(cookie); } public void init(FilterConfig arg0) throws ServletException { } }
true
06254cf7eb997eb5bdb7cd40add72de03092c4a9
Java
devx001/personal_java
/DecoratorFood/src/componentes/ComboBasico.java
UTF-8
477
2.234375
2
[]
no_license
/* * 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 componentes; /** * * @author Alejo */ public class ComboBasico extends Combo{ public ComboBasico() { descripcion="Porción de Papas Fritas, " + "salsas, Queso, Hamburguesa sencilla, Gaseosa"; } @Override public int valor() { return 6200; } }
true
b7c358714c22fb2679323dc3ee5fb30ccb3afef7
Java
kma952727/marketProject
/src/main/java/com/example/demo/service/ProductService.java
UTF-8
1,753
2.140625
2
[]
no_license
package com.example.demo.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.example.demo.config.FileUtils; import com.example.demo.mapper.ProductMapper; import com.example.demo.model.Product; import com.example.demo.model.ProductImage; import lombok.extern.slf4j.Slf4j; @Slf4j @Service @Transactional public class ProductService { @Autowired private ProductMapper productMapper; @Autowired private FileUtils fileUtils; public void upload_product(Product product, List<ProductImage> productImages) { fileUtils.saveFileToDisk(product.getProductImages(), productImages); productMapper.insertProduct(product); productMapper.insertProductImage(productImages, product.getProductId()); } public List<Product> getProductList(int index, String type){ List<Product> productList = productMapper.selectProducts(index, type); return productList; } public List<Product> getProductList(String keyword){ List<Product> productList = productMapper.searchProducts(keyword); return productList; } public Product getProduct(int productId) { return productMapper.selectProductById(productId); } public void countHits(int productId) { productMapper.countHits(productId); } public boolean likeProduct(Long accountId, int index) { String alreayLike = isExistsProductLike(accountId, index); if(alreayLike.equals("y")) { productMapper.updateProductLike(accountId, index); return true; } return false; } private String isExistsProductLike(Long accountId, int productId) { return productMapper.selectProductLike(accountId, productId); } }
true
b48901d71db9ea98bf73f902983deb0f8b9eb4bb
Java
kittiphongaum/KeepWordTeachV3
/src/main/java/com/cs/bru/model/DateofTeach.java
UTF-8
5,342
1.9375
2
[]
no_license
package com.cs.bru.model; import com.cs.bru.bean.SumTsdPsd; import com.cs.bru.bean.TeachSeachBean1; public class DateofTeach { private int dtimeId; private String dateofteachId; private int weekofyearDft; private String dayofyearDft; private String monthofyearDft; private String yearofteachDft; private int tudsadeeDft ; private int prtibadDft ; private int summyhourDft; private int moneyDft; private String statusBase; private int statusDateofteach; private String subjectDft; private String holidayDft; private String specialteachingStartdateday; private String specialteachingStopdateday; private String specialteachingStarttimeday; private String specialteachingStoptimeday; private String special; private String userDft; private Teach teach; private Subject subject; private User user; private TableTeaching tableTeaching; private Month month; private DegreeStuden degreeStuden; private SumTsdPsd sumTsdPsd; private TeachSeachBean1 teachSeachBean1; public int getDtimeId() { return dtimeId; } public void setDtimeId(int dtimeId) { this.dtimeId = dtimeId; } public String getDateofteachId() { return dateofteachId; } public void setDateofteachId(String dateofteachId) { this.dateofteachId = dateofteachId; } public int getWeekofyearDft() { return weekofyearDft; } public void setWeekofyearDft(int weekofyearDft) { this.weekofyearDft = weekofyearDft; } public String getDayofyearDft() { return dayofyearDft; } public void setDayofyearDft(String dayofyearDft) { this.dayofyearDft = dayofyearDft; } public String getMonthofyearDft() { return monthofyearDft; } public void setMonthofyearDft(String monthofyearDft) { this.monthofyearDft = monthofyearDft; } public String getYearofteachDft() { return yearofteachDft; } public void setYearofteachDft(String yearofteachDft) { this.yearofteachDft = yearofteachDft; } public int getTudsadeeDft() { return tudsadeeDft; } public void setTudsadeeDft(int tudsadeeDft) { this.tudsadeeDft = tudsadeeDft; } public int getPrtibadDft() { return prtibadDft; } public void setPrtibadDft(int prtibadDft) { this.prtibadDft = prtibadDft; } public int getSummyhourDft() { return summyhourDft; } public void setSummyhourDft(int ssm) { this.summyhourDft = ssm; } public String getSubjectDft() { return subjectDft; } public void setSubjectDft(String subjectDft) { this.subjectDft = subjectDft; } public String getUserDft() { return userDft; } public void setUserDft(String userDft) { this.userDft = userDft; } public Subject getSubject() { return subject; } public void setSubject(Subject subject) { this.subject = subject; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public String getHolidayDft() { return holidayDft; } public void setHolidayDft(String holidayDft) { this.holidayDft = holidayDft; } public int getMoneyDft() { return moneyDft; } public void setMoneyDft(int moneyDft) { this.moneyDft = moneyDft; } public String getStatusBase() { return statusBase; } public void setStatusBase(String statusBase) { this.statusBase = statusBase; } public TableTeaching getTableTeaching() { return tableTeaching; } public void setTableTeaching(TableTeaching tableTeaching) { this.tableTeaching = tableTeaching; } public Month getMonth() { return month; } public void setMonth(Month month) { this.month = month; } public Teach getTeach() { return teach; } public void setTeach(Teach teach) { this.teach = teach; } public int getStatusDateofteach() { return statusDateofteach; } public void setStatusDateofteach(int statusDateofteach) { this.statusDateofteach = statusDateofteach; } public DegreeStuden getDegreeStuden() { return degreeStuden; } public void setDegreeStuden(DegreeStuden degreeStuden) { this.degreeStuden = degreeStuden; } public SumTsdPsd getSumTsdPsd() { return sumTsdPsd; } public void setSumTsdPsd(SumTsdPsd sumTsdPsd) { this.sumTsdPsd = sumTsdPsd; } public String getSpecialteachingStartdateday() { return specialteachingStartdateday; } public void setSpecialteachingStartdateday(String specialteachingStartdateday) { this.specialteachingStartdateday = specialteachingStartdateday; } public String getSpecialteachingStopdateday() { return specialteachingStopdateday; } public void setSpecialteachingStopdateday(String specialteachingStopdateday) { this.specialteachingStopdateday = specialteachingStopdateday; } public String getSpecialteachingStarttimeday() { return specialteachingStarttimeday; } public void setSpecialteachingStarttimeday(String specialteachingStarttimeday) { this.specialteachingStarttimeday = specialteachingStarttimeday; } public String getSpecialteachingStoptimeday() { return specialteachingStoptimeday; } public void setSpecialteachingStoptimeday(String specialteachingStoptimeday) { this.specialteachingStoptimeday = specialteachingStoptimeday; } public String getSpecial() { return special; } public void setSpecial(String special) { this.special = special; } public TeachSeachBean1 getTeachSeachBean1() { return teachSeachBean1; } public void setTeachSeachBean1(TeachSeachBean1 teachSeachBean1) { this.teachSeachBean1 = teachSeachBean1; } }
true
7e44af6b7600cc0694ce198ac52c02fc5ee64ed3
Java
Vosec/RDBproject
/InsertGenerator/src/entity/Jizda.java
UTF-8
1,038
2.421875
2
[]
no_license
package entity; import java.sql.Timestamp; public class Jizda implements Entity { private String linka; private String spz; private String cislo_rp; private Timestamp cas; public Jizda(String linka, String spz, String cislo_rp, Timestamp cas) { this.linka = linka; this.spz = spz; this.cislo_rp = cislo_rp; this.cas = cas; } public String getLinka() { return linka; } public void setLinka(String linka) { this.linka = linka; } public String getSpz() { return spz; } public void setSpz(String spz) { this.spz = spz; } public String getCislo_rp() { return cislo_rp; } public void setCislo_rp(String cislo_rp) { this.cislo_rp = cislo_rp; } public Timestamp getCas() { return cas; } public void setCas(Timestamp cas) { this.cas = cas; } @Override public String toString() { return " INSERT INTO Jizda(linka, spz, cislo_rp, cas) VALUES ('" + this.linka + "','" + this.spz + "','" + this.cislo_rp + "','" + this.cas + "')"; } }
true
82fe8831a26c564d5759d6c1877a3b35db5c2f57
Java
Tomislav776/Foodzye
/app/src/main/java/com/example/tomipc/foodzye/adapter/FoodAdapter.java
UTF-8
3,122
2.625
3
[]
no_license
package com.example.tomipc.foodzye.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.TextView; import com.example.tomipc.foodzye.R; import com.example.tomipc.foodzye.model.Food; import java.util.ArrayList; public class FoodAdapter extends ArrayAdapter<Food>{ int resource; ArrayList<Food> items, tempItems, suggestions; public FoodAdapter(Context context, int ResourceId,ArrayList<Food> AllFood) { super(context, ResourceId, AllFood); resource = ResourceId; items = AllFood; tempItems = new ArrayList<Food>(items); suggestions = new ArrayList<Food>(); } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(getContext()); view = inflater.inflate(resource, parent, false); } Food food = items.get(position); if (food != null) { TextView lblName = (TextView) view.findViewById(R.id.foodName2); if (lblName != null) lblName.setText(food.name); } return view; } @Override public Filter getFilter() { return nameFilter; } /** * Custom Filter implementation for custom suggestions we provide. */ Filter nameFilter = new Filter() { @Override public CharSequence convertResultToString(Object resultValue) { String str = ((Food) resultValue).name; return str; } @Override protected FilterResults performFiltering(CharSequence constraint) { if (constraint != null) { suggestions.clear(); for (Food food : tempItems) { if (food.name.toLowerCase().startsWith(constraint.toString().toLowerCase())) { suggestions.add(food); } } FilterResults filterResults = new FilterResults(); filterResults.values = suggestions; filterResults.count = suggestions.size(); return filterResults; } else { return new FilterResults(); } } @Override protected void publishResults(CharSequence constraint, FilterResults results) { ArrayList<Food> filterList = (ArrayList<Food>) results.values; if (results != null && results.count > 0) { clear(); for (Food food : filterList) { add(food); notifyDataSetChanged(); } } if(results.count == 0){ clear(); Food addNew = new Food("There is no such food. Click me if you want to add it."); add(addNew); notifyDataSetChanged(); } } }; }
true
458079e80c41ae7920f617373bde68c8d0d2f926
Java
wcm-io-qa/wcm-io-qa-galenium
/modules/icing/src/main/java/io/wcm/qa/glnm/junit/seljup/ViewportWidthProvider.java
UTF-8
1,467
1.90625
2
[ "Apache-2.0" ]
permissive
/* * #%L * wcm.io * %% * Copyright (C) 2020 wcm.io * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ package io.wcm.qa.glnm.junit.seljup; import static java.util.Arrays.stream; import java.util.function.Function; import java.util.stream.Collectors; import org.junit.jupiter.params.support.AnnotationConsumer; import io.wcm.qa.glnm.junit.combinatorial.CombinableProvider; class ViewportWidthProvider extends AbstractConsumingCombinableProvider< Integer, ViewportWidths, ViewportWidthExtension> implements CombinableProvider, AnnotationConsumer<ViewportWidths> { @Override protected Function<Integer, ViewportWidthExtension> extensionProducer() { return ViewportWidthExtension::new; } @Override protected Integer[] valuesFromAnnotation(ViewportWidths t) { return stream(t.value()) .boxed() .collect(Collectors.toList()) .toArray(new Integer[0]); } }
true
75ba97c8db7a7cf05c9547206b2b8f44b53a0442
Java
jacobacon/Time-Manage
/src/main/java/com/jacobacon/timemanage/server/shiro/UserDAO.java
UTF-8
2,256
2.375
2
[ "Apache-2.0" ]
permissive
package com.jacobacon.timemanage.server.shiro; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.googlecode.objectify.ObjectifyService; import com.googlecode.objectify.Work; import com.googlecode.objectify.cmd.Query; import static com.googlecode.objectify.ObjectifyService.ofy; import java.util.ArrayList; import java.util.List; public class UserDAO extends BaseDAO<User> { private static final Logger log = LoggerFactory.getLogger(UserDAO.class); // Register the User Entity with Objectify static { ObjectifyService.register(User.class); ObjectifyService.register(UserCounter.class); } // Call the BaseDAO constructor. public UserDAO() { super(User.class); log.debug("User DAO Initialized."); } public User saveUser(final User user, final Boolean changeCount) { return ofy().transact(new Work<User>() { @Override public User run() { put(user); if (changeCount) { changeCount(1L); } return user; } }); } public User deleteUser(final User user) { return ofy().transact(new Work<User>() { @Override public User run() { delete(user.getName()); changeCount(-1L); return user; } }); } public User findUser(String username) { return get(username); } public List<User> getUsers() { List<User> users; Query<User> query = ofy().load().type(User.class); users = new ArrayList<User>(query.list()); return users; } public List<String> getUserList(){ List<String> userList = new ArrayList<String>(); Query<User> query = ofy().load().type(User.class); for(int i = 0; i < query.list().size(); i++){ userList.add(query.list().get(i).getName()); } return userList; } public long getCount() { UserCounterDAO dao = new UserCounterDAO(); UserCounter count = dao.get(UserCounter.COUNTER_ID); return (count == null) ? 0 : count.getCount(); } public void changeCount(final long delta) { UserCounterDAO dao = new UserCounterDAO(); UserCounter count = dao.get(UserCounter.COUNTER_ID); if (count == null) { count = new UserCounter(UserCounter.COUNTER_ID); } count.changeCount(delta); dao.put(count); } }
true
1deb0ad1fa70cd6d53379973ea9c3c1b65656460
Java
schelrobin/geppetto
/org.cloudsmith.geppetto.pp.dsl.tests/src/org/cloudsmith/geppetto/pp/dsl/tests/TestFailingSerialization.java
UTF-8
6,659
2.25
2
[]
no_license
/** * Copyright (c) 2011 Cloudsmith Inc. and other contributors, as listed below. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Cloudsmith * */ package org.cloudsmith.geppetto.pp.dsl.tests; import org.cloudsmith.geppetto.pp.PuppetManifest; import org.cloudsmith.geppetto.pp.dsl.formatting.PPFormatter; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.formatting.impl.FormattingConfig; import org.eclipse.xtext.resource.XtextResource; /** * Tests for expressions not covered by separate test classes. * */ public class TestFailingSerialization extends AbstractPuppetTests { // @formatter:off static final String Sample_Relationship = "file {\n" + // "\t'file1' :\n" + // "} -> file {\n" + // "\t'file2' :\n" + // "} -> file {\n" + // "\t'file3' :\n" + // "}"; static final String Sample_Assignment1 = "$x = false"; static final String Sample_Assignment2 = "$x[a] = false"; static final String Sample_Append = "$x += false"; static final String Sample_Match1 = "$x =~ /[a-z]*/"; static final String Sample_Match2 = "$x !~ /[a-z]*/"; static final String Sample_ClassDefinition = "class testClass {\n}"; static final String Sample_If = // "if $a == 1 {\n" + // "\ttrue\n" + // "}\n" + // "else {\n" + // "\tfalse\n" + // "}\n" + // "if $a == 1 {\n" + // "\ttrue\n" + // "}\n" + // "elsif $b < -3 {\n" + // "\tfalse\n" + // "}\n" + // "else {\n" + // "\ttrue\n" + // "}"; // @formatter:on private String doubleQuote(String s) { return '"' + s + '"'; } /** * No matter how formatter tries to add linewrapping there is none in the formatted result. * * @see PPFormatter#assignmentExpressionConfiguration(FormattingConfig c) */ public void test_Serialize_AssignmentExpression() throws Exception { String code = "$a = 1\n$b = 2"; XtextResource r = getResourceFromString(code); String s = serializeFormatted(r.getContents().get(0)); assertEquals("serialization should produce specified result", code, s); } /** * No matter how formatter tries to add linewrapping there is none in the formatted result. * * @see PPFormatter#functionCallConfiguration(FormattingConfig c) */ public void test_Serialize_CallAndDefine() throws Exception { String code = "$a = include('a')\ndefine a {\n}"; XtextResource r = getResourceFromString(code); String s = serializeFormatted(r.getContents().get(0)); assertEquals("serialization should produce specified result", code, s); } /** * Due to issues in the formatter, this test may hit a bug that inserts whitespace * between quotes and string - no workaround found - needs to be fixed in Xtext formatter. * Also see {@link #test_Serialize_DoubleQuotedString_2()} * * Problem caused by validation producing a warning that a single String is not a top level * expression. (Not reasonable to screw up formatting though). * * @see #test_Serialize_DoubleQuotedString_2() for a non failing tests. * * * @throws Exception */ public void test_Serialize_DoubleQuotedString_1() throws Exception { String original = "before${var}/after${1+2}$$${$var}"; String code = doubleQuote(original); XtextResource r = getResourceFromString(code); EObject result = r.getContents().get(0); assertTrue("Should be a PuppetManifest", result instanceof PuppetManifest); result = ((PuppetManifest) result).getStatements().get(0); String s = serializeFormatted(r.getContents().get(0)); assertEquals("Serialization of interpolated string should produce same result", code, s); } /** * This serialization does not fail. * * @see #test_Serialize_DoubleQuotedString_1() for failing variant */ public void test_Serialize_DoubleQuotedString_2() throws Exception { String original = "before${var}/after${1+2}$$${$var}"; String code = "$a = " + doubleQuote(original); XtextResource r = getResourceFromString(code); EObject result = r.getContents().get(0); assertTrue("Should be a PuppetManifest", result instanceof PuppetManifest); String s = serialize(r.getContents().get(0)); assertEquals("Serialization of interpolated string should produce same result", code, s); } /** * Formatter seems to not switch back to non hidden state after import "". * If changed to '' string it behaves differently. * */ public void test_Serialize_DqStringFollowedByDefine() throws Exception { String code = "import \"foo\"\ndefine b {\n\t$a = 1\n}"; XtextResource r = getResourceFromString(code); String s = serializeFormatted(r.getContents().get(0)); assertEquals("serialization should produce specified result", code, s); } /** * No matter how formatter tries to add linewrapping there is none in the formatted result. * * @see PPFormatter#importExpressionConfiguration(FormattingConfig c) * @see #test_Serialize_ImportExpression2() - for different failing result */ public void test_Serialize_ImportExpression1() throws Exception { String code = "import \"a\"\nimport \"b\""; XtextResource r = getResourceFromString(code); String s = serializeFormatted(r.getContents().get(0)); assertEquals("serialization should produce specified result", code, s); } /** * No matter how formatter tries to add linewrapping there is none in the formatted result. * Note that result is different than in {@link #test_Serialize_ImportExpression1()} due to issue * with the different use of hidden() for DQ string. * * @see PPFormatter#importExpressionConfiguration(FormattingConfig c) * @see #test_Serialize_ImportExpression1() - for different failing result */ public void test_Serialize_ImportExpression2() throws Exception { String code = "import 'a'\nimport 'b'"; XtextResource r = getResourceFromString(code); String s = serializeFormatted(r.getContents().get(0)); assertEquals("serialization should produce specified result", code, s); } /** * Should add linewrap between the two expressions. * (This rule should trigger for tests like {@link #test_Serialize_AssignmentExpression()} BTW). * * @see PPFormatter#manifestConfiguration(FormattingConfig c) * @throws Exception */ public void test_Serialize_ManifestStatements() throws Exception { String code = "include 'a'\na"; XtextResource r = getResourceFromString(code); String s = serializeFormatted(r.getContents().get(0)); assertEquals("serialization should produce specified result", code, s); } }
true
b858a6f6c51b9a7a98165bde625bebf8b85e8801
Java
dananjaya123/click_computer_parts-system
/Server/src/lk/ijse/gdse/computerParts/entity/UserSeting.java
UTF-8
1,054
2.609375
3
[]
no_license
package lk.ijse.gdse.computerParts.entity; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class UserSeting { @Id String name; String password; String solt; public UserSeting() { } public UserSeting(String name, String password, String solt) { this.name = name; this.password = password; this.solt = solt; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getSolt() { return solt; } public void setSolt(String solt) { this.solt = solt; } @Override public String toString() { return "UserSeting{" + "name='" + name + '\'' + ", password='" + password + '\'' + ", solt='" + solt + '\'' + '}'; } }
true
54ec9188d0ee4275629f2362fd4845b7d4775125
Java
Yogiraj24/iijnmApp
/src/com/hp/supplier/dto/Contactsreferences.java
UTF-8
53,791
1.96875
2
[]
no_license
/* * This source file was generated by FireStorm/DAO. * * If you purchase a full license for FireStorm/DAO you can customize this header file. * * For more information please visit http://www.codefutures.com/products/firestorm */ package com.hp.supplier.dto; import com.hp.supplier.dao.*; import com.hp.supplier.factory.*; import com.hp.supplier.exceptions.*; import java.io.Serializable; import java.util.*; import java.util.Date; public class Contactsreferences implements Serializable { /** * This attribute maps to the column id in the contactsreferences table. */ protected int id; /** * This attribute represents whether the attribute id has been modified since being read from the database. */ protected boolean idModified = false; /** * This attribute maps to the column supplier_id in the contactsreferences table. */ protected int supplierId; /** * This attribute represents whether the attribute supplierId has been modified since being read from the database. */ protected boolean supplierIdModified = false; /** * This attribute maps to the column is_HP_trader in the contactsreferences table. */ protected String isHpTrader; /** * This attribute represents whether the attribute isHpTrader has been modified since being read from the database. */ protected boolean isHpTraderModified = false; /** * This attribute maps to the column contract_title in the contactsreferences table. */ protected String contractTitle; /** * This attribute represents whether the attribute contractTitle has been modified since being read from the database. */ protected boolean contractTitleModified = false; /** * This attribute maps to the column contract_ref in the contactsreferences table. */ protected String contractRef; /** * This attribute represents whether the attribute contractRef has been modified since being read from the database. */ protected boolean contractRefModified = false; /** * This attribute maps to the column expiry_date in the contactsreferences table. */ protected String expiryDate; /** * This attribute represents whether the attribute expiryDate has been modified since being read from the database. */ protected boolean expiryDateModified = false; /** * This attribute maps to the column hp_contract_mgr in the contactsreferences table. */ protected String hpContractMgr; /** * This attribute represents whether the attribute hpContractMgr has been modified since being read from the database. */ protected boolean hpContractMgrModified = false; /** * This attribute maps to the column div_name_1 in the contactsreferences table. */ protected String divName1; /** * This attribute represents whether the attribute divName1 has been modified since being read from the database. */ protected boolean divName1Modified = false; /** * This attribute maps to the column contact_name_1 in the contactsreferences table. */ protected String contactName1; /** * This attribute represents whether the attribute contactName1 has been modified since being read from the database. */ protected boolean contactName1Modified = false; /** * This attribute maps to the column site_location_1 in the contactsreferences table. */ protected String siteLocation1; /** * This attribute represents whether the attribute siteLocation1 has been modified since being read from the database. */ protected boolean siteLocation1Modified = false; /** * This attribute maps to the column last_meeting_date_1 in the contactsreferences table. */ protected Date lastMeetingDate1; /** * This attribute represents whether the attribute lastMeetingDate1 has been modified since being read from the database. */ protected boolean lastMeetingDate1Modified = false; /** * This attribute maps to the column approx_service_period_1 in the contactsreferences table. */ protected String approxServicePeriod1; /** * This attribute represents whether the attribute approxServicePeriod1 has been modified since being read from the database. */ protected boolean approxServicePeriod1Modified = false; /** * This attribute maps to the column div_name_2 in the contactsreferences table. */ protected String divName2; /** * This attribute represents whether the attribute divName2 has been modified since being read from the database. */ protected boolean divName2Modified = false; /** * This attribute maps to the column hp_contact_name_2 in the contactsreferences table. */ protected String hpContactName2; /** * This attribute represents whether the attribute hpContactName2 has been modified since being read from the database. */ protected boolean hpContactName2Modified = false; /** * This attribute maps to the column site_location_2 in the contactsreferences table. */ protected String siteLocation2; /** * This attribute represents whether the attribute siteLocation2 has been modified since being read from the database. */ protected boolean siteLocation2Modified = false; /** * This attribute maps to the column last_meeting_date_2 in the contactsreferences table. */ protected Date lastMeetingDate2; /** * This attribute represents whether the attribute lastMeetingDate2 has been modified since being read from the database. */ protected boolean lastMeetingDate2Modified = false; /** * This attribute maps to the column approx_service_period_2 in the contactsreferences table. */ protected String approxServicePeriod2; /** * This attribute represents whether the attribute approxServicePeriod2 has been modified since being read from the database. */ protected boolean approxServicePeriod2Modified = false; /** * This attribute maps to the column div_name_3 in the contactsreferences table. */ protected String divName3; /** * This attribute represents whether the attribute divName3 has been modified since being read from the database. */ protected boolean divName3Modified = false; /** * This attribute maps to the column hp_contact_name_3 in the contactsreferences table. */ protected String hpContactName3; /** * This attribute represents whether the attribute hpContactName3 has been modified since being read from the database. */ protected boolean hpContactName3Modified = false; /** * This attribute maps to the column site_location_3 in the contactsreferences table. */ protected String siteLocation3; /** * This attribute represents whether the attribute siteLocation3 has been modified since being read from the database. */ protected boolean siteLocation3Modified = false; /** * This attribute maps to the column last_meeting_date_3 in the contactsreferences table. */ protected Date lastMeetingDate3; /** * This attribute represents whether the attribute lastMeetingDate3 has been modified since being read from the database. */ protected boolean lastMeetingDate3Modified = false; /** * This attribute maps to the column approx_service_period_3 in the contactsreferences table. */ protected String approxServicePeriod3; /** * This attribute represents whether the attribute approxServicePeriod3 has been modified since being read from the database. */ protected boolean approxServicePeriod3Modified = false; /** * This attribute maps to the column organization_1 in the contactsreferences table. */ protected String organization1; /** * This attribute represents whether the attribute organization1 has been modified since being read from the database. */ protected boolean organization1Modified = false; /** * This attribute maps to the column hp_contact_name_1 in the contactsreferences table. */ protected String hpContactName1; /** * This attribute represents whether the attribute hpContactName1 has been modified since being read from the database. */ protected boolean hpContactName1Modified = false; /** * This attribute maps to the column contact_title_1 in the contactsreferences table. */ protected String contactTitle1; /** * This attribute represents whether the attribute contactTitle1 has been modified since being read from the database. */ protected boolean contactTitle1Modified = false; /** * This attribute maps to the column email_address_1 in the contactsreferences table. */ protected String emailAddress1; /** * This attribute represents whether the attribute emailAddress1 has been modified since being read from the database. */ protected boolean emailAddress1Modified = false; /** * This attribute maps to the column organization_2 in the contactsreferences table. */ protected String organization2; /** * This attribute represents whether the attribute organization2 has been modified since being read from the database. */ protected boolean organization2Modified = false; /** * This attribute maps to the column contact_name_2 in the contactsreferences table. */ protected String contactName2; /** * This attribute represents whether the attribute contactName2 has been modified since being read from the database. */ protected boolean contactName2Modified = false; /** * This attribute maps to the column contact_title_2 in the contactsreferences table. */ protected String contactTitle2; /** * This attribute represents whether the attribute contactTitle2 has been modified since being read from the database. */ protected boolean contactTitle2Modified = false; /** * This attribute maps to the column email_address_2 in the contactsreferences table. */ protected String emailAddress2; /** * This attribute represents whether the attribute emailAddress2 has been modified since being read from the database. */ protected boolean emailAddress2Modified = false; /** * This attribute maps to the column organization_3 in the contactsreferences table. */ protected String organization3; /** * This attribute represents whether the attribute organization3 has been modified since being read from the database. */ protected boolean organization3Modified = false; /** * This attribute maps to the column contact_name_3 in the contactsreferences table. */ protected String contactName3; /** * This attribute represents whether the attribute contactName3 has been modified since being read from the database. */ protected boolean contactName3Modified = false; /** * This attribute maps to the column contact_title_3 in the contactsreferences table. */ protected String contactTitle3; /** * This attribute represents whether the attribute contactTitle3 has been modified since being read from the database. */ protected boolean contactTitle3Modified = false; /** * This attribute maps to the column email_address_3 in the contactsreferences table. */ protected String emailAddress3; /** * This attribute represents whether the attribute emailAddress3 has been modified since being read from the database. */ protected boolean emailAddress3Modified = false; /** * This attribute maps to the column date_created in the contactsreferences table. */ protected Date dateCreated; /** * This attribute represents whether the attribute dateCreated has been modified since being read from the database. */ protected boolean dateCreatedModified = false; /** * This attribute maps to the column date_modified in the contactsreferences table. */ protected Date dateModified; /** * This attribute represents whether the attribute dateModified has been modified since being read from the database. */ protected boolean dateModifiedModified = false; /** * Method 'Contactsreferences' * */ public Contactsreferences() { } /** * Method 'getId' * * @return int */ public int getId() { return id; } /** * Method 'setId' * * @param id */ public void setId(int id) { this.id = id; this.idModified = true; } /** * Sets the value of idModified */ public void setIdModified(boolean idModified) { this.idModified = idModified; } /** * Gets the value of idModified */ public boolean isIdModified() { return idModified; } /** * Method 'getSupplierId' * * @return int */ public int getSupplierId() { return supplierId; } /** * Method 'setSupplierId' * * @param supplierId */ public void setSupplierId(int supplierId) { this.supplierId = supplierId; this.supplierIdModified = true; } /** * Sets the value of supplierIdModified */ public void setSupplierIdModified(boolean supplierIdModified) { this.supplierIdModified = supplierIdModified; } /** * Gets the value of supplierIdModified */ public boolean isSupplierIdModified() { return supplierIdModified; } /** * Method 'getIsHpTrader' * * @return String */ public String getIsHpTrader() { return isHpTrader; } /** * Method 'setIsHpTrader' * * @param isHpTrader */ public void setIsHpTrader(String isHpTrader) { this.isHpTrader = isHpTrader; this.isHpTraderModified = true; } /** * Sets the value of isHpTraderModified */ public void setIsHpTraderModified(boolean isHpTraderModified) { this.isHpTraderModified = isHpTraderModified; } /** * Gets the value of isHpTraderModified */ public boolean isIsHpTraderModified() { return isHpTraderModified; } /** * Method 'getContractTitle' * * @return String */ public String getContractTitle() { return contractTitle; } /** * Method 'setContractTitle' * * @param contractTitle */ public void setContractTitle(String contractTitle) { this.contractTitle = contractTitle; this.contractTitleModified = true; } /** * Sets the value of contractTitleModified */ public void setContractTitleModified(boolean contractTitleModified) { this.contractTitleModified = contractTitleModified; } /** * Gets the value of contractTitleModified */ public boolean isContractTitleModified() { return contractTitleModified; } /** * Method 'getContractRef' * * @return String */ public String getContractRef() { return contractRef; } /** * Method 'setContractRef' * * @param contractRef */ public void setContractRef(String contractRef) { this.contractRef = contractRef; this.contractRefModified = true; } /** * Sets the value of contractRefModified */ public void setContractRefModified(boolean contractRefModified) { this.contractRefModified = contractRefModified; } /** * Gets the value of contractRefModified */ public boolean isContractRefModified() { return contractRefModified; } /** * Method 'getExpiryDate' * * @return String */ public String getExpiryDate() { return expiryDate; } /** * Method 'setExpiryDate' * * @param expiryDate */ public void setExpiryDate(String expiryDate) { this.expiryDate = expiryDate; this.expiryDateModified = true; } /** * Sets the value of expiryDateModified */ public void setExpiryDateModified(boolean expiryDateModified) { this.expiryDateModified = expiryDateModified; } /** * Gets the value of expiryDateModified */ public boolean isExpiryDateModified() { return expiryDateModified; } /** * Method 'getHpContractMgr' * * @return String */ public String getHpContractMgr() { return hpContractMgr; } /** * Method 'setHpContractMgr' * * @param hpContractMgr */ public void setHpContractMgr(String hpContractMgr) { this.hpContractMgr = hpContractMgr; this.hpContractMgrModified = true; } /** * Sets the value of hpContractMgrModified */ public void setHpContractMgrModified(boolean hpContractMgrModified) { this.hpContractMgrModified = hpContractMgrModified; } /** * Gets the value of hpContractMgrModified */ public boolean isHpContractMgrModified() { return hpContractMgrModified; } /** * Method 'getDivName1' * * @return String */ public String getDivName1() { return divName1; } /** * Method 'setDivName1' * * @param divName1 */ public void setDivName1(String divName1) { this.divName1 = divName1; this.divName1Modified = true; } /** * Sets the value of divName1Modified */ public void setDivName1Modified(boolean divName1Modified) { this.divName1Modified = divName1Modified; } /** * Gets the value of divName1Modified */ public boolean isDivName1Modified() { return divName1Modified; } /** * Method 'getContactName1' * * @return String */ public String getContactName1() { return contactName1; } /** * Method 'setContactName1' * * @param contactName1 */ public void setContactName1(String contactName1) { this.contactName1 = contactName1; this.contactName1Modified = true; } /** * Sets the value of contactName1Modified */ public void setContactName1Modified(boolean contactName1Modified) { this.contactName1Modified = contactName1Modified; } /** * Gets the value of contactName1Modified */ public boolean isContactName1Modified() { return contactName1Modified; } /** * Method 'getSiteLocation1' * * @return String */ public String getSiteLocation1() { return siteLocation1; } /** * Method 'setSiteLocation1' * * @param siteLocation1 */ public void setSiteLocation1(String siteLocation1) { this.siteLocation1 = siteLocation1; this.siteLocation1Modified = true; } /** * Sets the value of siteLocation1Modified */ public void setSiteLocation1Modified(boolean siteLocation1Modified) { this.siteLocation1Modified = siteLocation1Modified; } /** * Gets the value of siteLocation1Modified */ public boolean isSiteLocation1Modified() { return siteLocation1Modified; } /** * Method 'getLastMeetingDate1' * * @return Date */ public Date getLastMeetingDate1() { return lastMeetingDate1; } /** * Method 'setLastMeetingDate1' * * @param lastMeetingDate1 */ public void setLastMeetingDate1(Date lastMeetingDate1) { this.lastMeetingDate1 = lastMeetingDate1; this.lastMeetingDate1Modified = true; } /** * Sets the value of lastMeetingDate1Modified */ public void setLastMeetingDate1Modified(boolean lastMeetingDate1Modified) { this.lastMeetingDate1Modified = lastMeetingDate1Modified; } /** * Gets the value of lastMeetingDate1Modified */ public boolean isLastMeetingDate1Modified() { return lastMeetingDate1Modified; } /** * Method 'getApproxServicePeriod1' * * @return String */ public String getApproxServicePeriod1() { return approxServicePeriod1; } /** * Method 'setApproxServicePeriod1' * * @param approxServicePeriod1 */ public void setApproxServicePeriod1(String approxServicePeriod1) { this.approxServicePeriod1 = approxServicePeriod1; this.approxServicePeriod1Modified = true; } /** * Sets the value of approxServicePeriod1Modified */ public void setApproxServicePeriod1Modified(boolean approxServicePeriod1Modified) { this.approxServicePeriod1Modified = approxServicePeriod1Modified; } /** * Gets the value of approxServicePeriod1Modified */ public boolean isApproxServicePeriod1Modified() { return approxServicePeriod1Modified; } /** * Method 'getDivName2' * * @return String */ public String getDivName2() { return divName2; } /** * Method 'setDivName2' * * @param divName2 */ public void setDivName2(String divName2) { this.divName2 = divName2; this.divName2Modified = true; } /** * Sets the value of divName2Modified */ public void setDivName2Modified(boolean divName2Modified) { this.divName2Modified = divName2Modified; } /** * Gets the value of divName2Modified */ public boolean isDivName2Modified() { return divName2Modified; } /** * Method 'getHpContactName2' * * @return String */ public String getHpContactName2() { return hpContactName2; } /** * Method 'setHpContactName2' * * @param hpContactName2 */ public void setHpContactName2(String hpContactName2) { this.hpContactName2 = hpContactName2; this.hpContactName2Modified = true; } /** * Sets the value of hpContactName2Modified */ public void setHpContactName2Modified(boolean hpContactName2Modified) { this.hpContactName2Modified = hpContactName2Modified; } /** * Gets the value of hpContactName2Modified */ public boolean isHpContactName2Modified() { return hpContactName2Modified; } /** * Method 'getSiteLocation2' * * @return String */ public String getSiteLocation2() { return siteLocation2; } /** * Method 'setSiteLocation2' * * @param siteLocation2 */ public void setSiteLocation2(String siteLocation2) { this.siteLocation2 = siteLocation2; this.siteLocation2Modified = true; } /** * Sets the value of siteLocation2Modified */ public void setSiteLocation2Modified(boolean siteLocation2Modified) { this.siteLocation2Modified = siteLocation2Modified; } /** * Gets the value of siteLocation2Modified */ public boolean isSiteLocation2Modified() { return siteLocation2Modified; } /** * Method 'getLastMeetingDate2' * * @return Date */ public Date getLastMeetingDate2() { return lastMeetingDate2; } /** * Method 'setLastMeetingDate2' * * @param lastMeetingDate2 */ public void setLastMeetingDate2(Date lastMeetingDate2) { this.lastMeetingDate2 = lastMeetingDate2; this.lastMeetingDate2Modified = true; } /** * Sets the value of lastMeetingDate2Modified */ public void setLastMeetingDate2Modified(boolean lastMeetingDate2Modified) { this.lastMeetingDate2Modified = lastMeetingDate2Modified; } /** * Gets the value of lastMeetingDate2Modified */ public boolean isLastMeetingDate2Modified() { return lastMeetingDate2Modified; } /** * Method 'getApproxServicePeriod2' * * @return String */ public String getApproxServicePeriod2() { return approxServicePeriod2; } /** * Method 'setApproxServicePeriod2' * * @param approxServicePeriod2 */ public void setApproxServicePeriod2(String approxServicePeriod2) { this.approxServicePeriod2 = approxServicePeriod2; this.approxServicePeriod2Modified = true; } /** * Sets the value of approxServicePeriod2Modified */ public void setApproxServicePeriod2Modified(boolean approxServicePeriod2Modified) { this.approxServicePeriod2Modified = approxServicePeriod2Modified; } /** * Gets the value of approxServicePeriod2Modified */ public boolean isApproxServicePeriod2Modified() { return approxServicePeriod2Modified; } /** * Method 'getDivName3' * * @return String */ public String getDivName3() { return divName3; } /** * Method 'setDivName3' * * @param divName3 */ public void setDivName3(String divName3) { this.divName3 = divName3; this.divName3Modified = true; } /** * Sets the value of divName3Modified */ public void setDivName3Modified(boolean divName3Modified) { this.divName3Modified = divName3Modified; } /** * Gets the value of divName3Modified */ public boolean isDivName3Modified() { return divName3Modified; } /** * Method 'getHpContactName3' * * @return String */ public String getHpContactName3() { return hpContactName3; } /** * Method 'setHpContactName3' * * @param hpContactName3 */ public void setHpContactName3(String hpContactName3) { this.hpContactName3 = hpContactName3; this.hpContactName3Modified = true; } /** * Sets the value of hpContactName3Modified */ public void setHpContactName3Modified(boolean hpContactName3Modified) { this.hpContactName3Modified = hpContactName3Modified; } /** * Gets the value of hpContactName3Modified */ public boolean isHpContactName3Modified() { return hpContactName3Modified; } /** * Method 'getSiteLocation3' * * @return String */ public String getSiteLocation3() { return siteLocation3; } /** * Method 'setSiteLocation3' * * @param siteLocation3 */ public void setSiteLocation3(String siteLocation3) { this.siteLocation3 = siteLocation3; this.siteLocation3Modified = true; } /** * Sets the value of siteLocation3Modified */ public void setSiteLocation3Modified(boolean siteLocation3Modified) { this.siteLocation3Modified = siteLocation3Modified; } /** * Gets the value of siteLocation3Modified */ public boolean isSiteLocation3Modified() { return siteLocation3Modified; } /** * Method 'getLastMeetingDate3' * * @return Date */ public Date getLastMeetingDate3() { return lastMeetingDate3; } /** * Method 'setLastMeetingDate3' * * @param lastMeetingDate3 */ public void setLastMeetingDate3(Date lastMeetingDate3) { this.lastMeetingDate3 = lastMeetingDate3; this.lastMeetingDate3Modified = true; } /** * Sets the value of lastMeetingDate3Modified */ public void setLastMeetingDate3Modified(boolean lastMeetingDate3Modified) { this.lastMeetingDate3Modified = lastMeetingDate3Modified; } /** * Gets the value of lastMeetingDate3Modified */ public boolean isLastMeetingDate3Modified() { return lastMeetingDate3Modified; } /** * Method 'getApproxServicePeriod3' * * @return String */ public String getApproxServicePeriod3() { return approxServicePeriod3; } /** * Method 'setApproxServicePeriod3' * * @param approxServicePeriod3 */ public void setApproxServicePeriod3(String approxServicePeriod3) { this.approxServicePeriod3 = approxServicePeriod3; this.approxServicePeriod3Modified = true; } /** * Sets the value of approxServicePeriod3Modified */ public void setApproxServicePeriod3Modified(boolean approxServicePeriod3Modified) { this.approxServicePeriod3Modified = approxServicePeriod3Modified; } /** * Gets the value of approxServicePeriod3Modified */ public boolean isApproxServicePeriod3Modified() { return approxServicePeriod3Modified; } /** * Method 'getOrganization1' * * @return String */ public String getOrganization1() { return organization1; } /** * Method 'setOrganization1' * * @param organization1 */ public void setOrganization1(String organization1) { this.organization1 = organization1; this.organization1Modified = true; } /** * Sets the value of organization1Modified */ public void setOrganization1Modified(boolean organization1Modified) { this.organization1Modified = organization1Modified; } /** * Gets the value of organization1Modified */ public boolean isOrganization1Modified() { return organization1Modified; } /** * Method 'getHpContactName1' * * @return String */ public String getHpContactName1() { return hpContactName1; } /** * Method 'setHpContactName1' * * @param hpContactName1 */ public void setHpContactName1(String hpContactName1) { this.hpContactName1 = hpContactName1; this.hpContactName1Modified = true; } /** * Sets the value of hpContactName1Modified */ public void setHpContactName1Modified(boolean hpContactName1Modified) { this.hpContactName1Modified = hpContactName1Modified; } /** * Gets the value of hpContactName1Modified */ public boolean isHpContactName1Modified() { return hpContactName1Modified; } /** * Method 'getContactTitle1' * * @return String */ public String getContactTitle1() { return contactTitle1; } /** * Method 'setContactTitle1' * * @param contactTitle1 */ public void setContactTitle1(String contactTitle1) { this.contactTitle1 = contactTitle1; this.contactTitle1Modified = true; } /** * Sets the value of contactTitle1Modified */ public void setContactTitle1Modified(boolean contactTitle1Modified) { this.contactTitle1Modified = contactTitle1Modified; } /** * Gets the value of contactTitle1Modified */ public boolean isContactTitle1Modified() { return contactTitle1Modified; } /** * Method 'getEmailAddress1' * * @return String */ public String getEmailAddress1() { return emailAddress1; } /** * Method 'setEmailAddress1' * * @param emailAddress1 */ public void setEmailAddress1(String emailAddress1) { this.emailAddress1 = emailAddress1; this.emailAddress1Modified = true; } /** * Sets the value of emailAddress1Modified */ public void setEmailAddress1Modified(boolean emailAddress1Modified) { this.emailAddress1Modified = emailAddress1Modified; } /** * Gets the value of emailAddress1Modified */ public boolean isEmailAddress1Modified() { return emailAddress1Modified; } /** * Method 'getOrganization2' * * @return String */ public String getOrganization2() { return organization2; } /** * Method 'setOrganization2' * * @param organization2 */ public void setOrganization2(String organization2) { this.organization2 = organization2; this.organization2Modified = true; } /** * Sets the value of organization2Modified */ public void setOrganization2Modified(boolean organization2Modified) { this.organization2Modified = organization2Modified; } /** * Gets the value of organization2Modified */ public boolean isOrganization2Modified() { return organization2Modified; } /** * Method 'getContactName2' * * @return String */ public String getContactName2() { return contactName2; } /** * Method 'setContactName2' * * @param contactName2 */ public void setContactName2(String contactName2) { this.contactName2 = contactName2; this.contactName2Modified = true; } /** * Sets the value of contactName2Modified */ public void setContactName2Modified(boolean contactName2Modified) { this.contactName2Modified = contactName2Modified; } /** * Gets the value of contactName2Modified */ public boolean isContactName2Modified() { return contactName2Modified; } /** * Method 'getContactTitle2' * * @return String */ public String getContactTitle2() { return contactTitle2; } /** * Method 'setContactTitle2' * * @param contactTitle2 */ public void setContactTitle2(String contactTitle2) { this.contactTitle2 = contactTitle2; this.contactTitle2Modified = true; } /** * Sets the value of contactTitle2Modified */ public void setContactTitle2Modified(boolean contactTitle2Modified) { this.contactTitle2Modified = contactTitle2Modified; } /** * Gets the value of contactTitle2Modified */ public boolean isContactTitle2Modified() { return contactTitle2Modified; } /** * Method 'getEmailAddress2' * * @return String */ public String getEmailAddress2() { return emailAddress2; } /** * Method 'setEmailAddress2' * * @param emailAddress2 */ public void setEmailAddress2(String emailAddress2) { this.emailAddress2 = emailAddress2; this.emailAddress2Modified = true; } /** * Sets the value of emailAddress2Modified */ public void setEmailAddress2Modified(boolean emailAddress2Modified) { this.emailAddress2Modified = emailAddress2Modified; } /** * Gets the value of emailAddress2Modified */ public boolean isEmailAddress2Modified() { return emailAddress2Modified; } /** * Method 'getOrganization3' * * @return String */ public String getOrganization3() { return organization3; } /** * Method 'setOrganization3' * * @param organization3 */ public void setOrganization3(String organization3) { this.organization3 = organization3; this.organization3Modified = true; } /** * Sets the value of organization3Modified */ public void setOrganization3Modified(boolean organization3Modified) { this.organization3Modified = organization3Modified; } /** * Gets the value of organization3Modified */ public boolean isOrganization3Modified() { return organization3Modified; } /** * Method 'getContactName3' * * @return String */ public String getContactName3() { return contactName3; } /** * Method 'setContactName3' * * @param contactName3 */ public void setContactName3(String contactName3) { this.contactName3 = contactName3; this.contactName3Modified = true; } /** * Sets the value of contactName3Modified */ public void setContactName3Modified(boolean contactName3Modified) { this.contactName3Modified = contactName3Modified; } /** * Gets the value of contactName3Modified */ public boolean isContactName3Modified() { return contactName3Modified; } /** * Method 'getContactTitle3' * * @return String */ public String getContactTitle3() { return contactTitle3; } /** * Method 'setContactTitle3' * * @param contactTitle3 */ public void setContactTitle3(String contactTitle3) { this.contactTitle3 = contactTitle3; this.contactTitle3Modified = true; } /** * Sets the value of contactTitle3Modified */ public void setContactTitle3Modified(boolean contactTitle3Modified) { this.contactTitle3Modified = contactTitle3Modified; } /** * Gets the value of contactTitle3Modified */ public boolean isContactTitle3Modified() { return contactTitle3Modified; } /** * Method 'getEmailAddress3' * * @return String */ public String getEmailAddress3() { return emailAddress3; } /** * Method 'setEmailAddress3' * * @param emailAddress3 */ public void setEmailAddress3(String emailAddress3) { this.emailAddress3 = emailAddress3; this.emailAddress3Modified = true; } /** * Sets the value of emailAddress3Modified */ public void setEmailAddress3Modified(boolean emailAddress3Modified) { this.emailAddress3Modified = emailAddress3Modified; } /** * Gets the value of emailAddress3Modified */ public boolean isEmailAddress3Modified() { return emailAddress3Modified; } /** * Method 'getDateCreated' * * @return Date */ public Date getDateCreated() { return dateCreated; } /** * Method 'setDateCreated' * * @param dateCreated */ public void setDateCreated(Date dateCreated) { this.dateCreated = dateCreated; this.dateCreatedModified = true; } /** * Sets the value of dateCreatedModified */ public void setDateCreatedModified(boolean dateCreatedModified) { this.dateCreatedModified = dateCreatedModified; } /** * Gets the value of dateCreatedModified */ public boolean isDateCreatedModified() { return dateCreatedModified; } /** * Method 'getDateModified' * * @return Date */ public Date getDateModified() { return dateModified; } /** * Method 'setDateModified' * * @param dateModified */ public void setDateModified(Date dateModified) { this.dateModified = dateModified; this.dateModifiedModified = true; } /** * Sets the value of dateModifiedModified */ public void setDateModifiedModified(boolean dateModifiedModified) { this.dateModifiedModified = dateModifiedModified; } /** * Gets the value of dateModifiedModified */ public boolean isDateModifiedModified() { return dateModifiedModified; } /** * Method 'equals' * * @param _other * @return boolean */ public boolean equals(Object _other) { if (_other == null) { return false; } if (_other == this) { return true; } if (!(_other instanceof Contactsreferences)) { return false; } final Contactsreferences _cast = (Contactsreferences) _other; if (id != _cast.id) { return false; } if (idModified != _cast.idModified) { return false; } if (supplierId != _cast.supplierId) { return false; } if (supplierIdModified != _cast.supplierIdModified) { return false; } if (isHpTrader == null ? _cast.isHpTrader != isHpTrader : !isHpTrader.equals( _cast.isHpTrader )) { return false; } if (isHpTraderModified != _cast.isHpTraderModified) { return false; } if (contractTitle == null ? _cast.contractTitle != contractTitle : !contractTitle.equals( _cast.contractTitle )) { return false; } if (contractTitleModified != _cast.contractTitleModified) { return false; } if (contractRef == null ? _cast.contractRef != contractRef : !contractRef.equals( _cast.contractRef )) { return false; } if (contractRefModified != _cast.contractRefModified) { return false; } if (expiryDate == null ? _cast.expiryDate != expiryDate : !expiryDate.equals( _cast.expiryDate )) { return false; } if (expiryDateModified != _cast.expiryDateModified) { return false; } if (hpContractMgr == null ? _cast.hpContractMgr != hpContractMgr : !hpContractMgr.equals( _cast.hpContractMgr )) { return false; } if (hpContractMgrModified != _cast.hpContractMgrModified) { return false; } if (divName1 == null ? _cast.divName1 != divName1 : !divName1.equals( _cast.divName1 )) { return false; } if (divName1Modified != _cast.divName1Modified) { return false; } if (contactName1 == null ? _cast.contactName1 != contactName1 : !contactName1.equals( _cast.contactName1 )) { return false; } if (contactName1Modified != _cast.contactName1Modified) { return false; } if (siteLocation1 == null ? _cast.siteLocation1 != siteLocation1 : !siteLocation1.equals( _cast.siteLocation1 )) { return false; } if (siteLocation1Modified != _cast.siteLocation1Modified) { return false; } if (lastMeetingDate1 == null ? _cast.lastMeetingDate1 != lastMeetingDate1 : !lastMeetingDate1.equals( _cast.lastMeetingDate1 )) { return false; } if (lastMeetingDate1Modified != _cast.lastMeetingDate1Modified) { return false; } if (approxServicePeriod1 == null ? _cast.approxServicePeriod1 != approxServicePeriod1 : !approxServicePeriod1.equals( _cast.approxServicePeriod1 )) { return false; } if (approxServicePeriod1Modified != _cast.approxServicePeriod1Modified) { return false; } if (divName2 == null ? _cast.divName2 != divName2 : !divName2.equals( _cast.divName2 )) { return false; } if (divName2Modified != _cast.divName2Modified) { return false; } if (hpContactName2 == null ? _cast.hpContactName2 != hpContactName2 : !hpContactName2.equals( _cast.hpContactName2 )) { return false; } if (hpContactName2Modified != _cast.hpContactName2Modified) { return false; } if (siteLocation2 == null ? _cast.siteLocation2 != siteLocation2 : !siteLocation2.equals( _cast.siteLocation2 )) { return false; } if (siteLocation2Modified != _cast.siteLocation2Modified) { return false; } if (lastMeetingDate2 == null ? _cast.lastMeetingDate2 != lastMeetingDate2 : !lastMeetingDate2.equals( _cast.lastMeetingDate2 )) { return false; } if (lastMeetingDate2Modified != _cast.lastMeetingDate2Modified) { return false; } if (approxServicePeriod2 == null ? _cast.approxServicePeriod2 != approxServicePeriod2 : !approxServicePeriod2.equals( _cast.approxServicePeriod2 )) { return false; } if (approxServicePeriod2Modified != _cast.approxServicePeriod2Modified) { return false; } if (divName3 == null ? _cast.divName3 != divName3 : !divName3.equals( _cast.divName3 )) { return false; } if (divName3Modified != _cast.divName3Modified) { return false; } if (hpContactName3 == null ? _cast.hpContactName3 != hpContactName3 : !hpContactName3.equals( _cast.hpContactName3 )) { return false; } if (hpContactName3Modified != _cast.hpContactName3Modified) { return false; } if (siteLocation3 == null ? _cast.siteLocation3 != siteLocation3 : !siteLocation3.equals( _cast.siteLocation3 )) { return false; } if (siteLocation3Modified != _cast.siteLocation3Modified) { return false; } if (lastMeetingDate3 == null ? _cast.lastMeetingDate3 != lastMeetingDate3 : !lastMeetingDate3.equals( _cast.lastMeetingDate3 )) { return false; } if (lastMeetingDate3Modified != _cast.lastMeetingDate3Modified) { return false; } if (approxServicePeriod3 == null ? _cast.approxServicePeriod3 != approxServicePeriod3 : !approxServicePeriod3.equals( _cast.approxServicePeriod3 )) { return false; } if (approxServicePeriod3Modified != _cast.approxServicePeriod3Modified) { return false; } if (organization1 == null ? _cast.organization1 != organization1 : !organization1.equals( _cast.organization1 )) { return false; } if (organization1Modified != _cast.organization1Modified) { return false; } if (hpContactName1 == null ? _cast.hpContactName1 != hpContactName1 : !hpContactName1.equals( _cast.hpContactName1 )) { return false; } if (hpContactName1Modified != _cast.hpContactName1Modified) { return false; } if (contactTitle1 == null ? _cast.contactTitle1 != contactTitle1 : !contactTitle1.equals( _cast.contactTitle1 )) { return false; } if (contactTitle1Modified != _cast.contactTitle1Modified) { return false; } if (emailAddress1 == null ? _cast.emailAddress1 != emailAddress1 : !emailAddress1.equals( _cast.emailAddress1 )) { return false; } if (emailAddress1Modified != _cast.emailAddress1Modified) { return false; } if (organization2 == null ? _cast.organization2 != organization2 : !organization2.equals( _cast.organization2 )) { return false; } if (organization2Modified != _cast.organization2Modified) { return false; } if (contactName2 == null ? _cast.contactName2 != contactName2 : !contactName2.equals( _cast.contactName2 )) { return false; } if (contactName2Modified != _cast.contactName2Modified) { return false; } if (contactTitle2 == null ? _cast.contactTitle2 != contactTitle2 : !contactTitle2.equals( _cast.contactTitle2 )) { return false; } if (contactTitle2Modified != _cast.contactTitle2Modified) { return false; } if (emailAddress2 == null ? _cast.emailAddress2 != emailAddress2 : !emailAddress2.equals( _cast.emailAddress2 )) { return false; } if (emailAddress2Modified != _cast.emailAddress2Modified) { return false; } if (organization3 == null ? _cast.organization3 != organization3 : !organization3.equals( _cast.organization3 )) { return false; } if (organization3Modified != _cast.organization3Modified) { return false; } if (contactName3 == null ? _cast.contactName3 != contactName3 : !contactName3.equals( _cast.contactName3 )) { return false; } if (contactName3Modified != _cast.contactName3Modified) { return false; } if (contactTitle3 == null ? _cast.contactTitle3 != contactTitle3 : !contactTitle3.equals( _cast.contactTitle3 )) { return false; } if (contactTitle3Modified != _cast.contactTitle3Modified) { return false; } if (emailAddress3 == null ? _cast.emailAddress3 != emailAddress3 : !emailAddress3.equals( _cast.emailAddress3 )) { return false; } if (emailAddress3Modified != _cast.emailAddress3Modified) { return false; } if (dateCreated == null ? _cast.dateCreated != dateCreated : !dateCreated.equals( _cast.dateCreated )) { return false; } if (dateCreatedModified != _cast.dateCreatedModified) { return false; } if (dateModified == null ? _cast.dateModified != dateModified : !dateModified.equals( _cast.dateModified )) { return false; } if (dateModifiedModified != _cast.dateModifiedModified) { return false; } return true; } /** * Method 'hashCode' * * @return int */ public int hashCode() { int _hashCode = 0; _hashCode = 29 * _hashCode + id; _hashCode = 29 * _hashCode + (idModified ? 1 : 0); _hashCode = 29 * _hashCode + supplierId; _hashCode = 29 * _hashCode + (supplierIdModified ? 1 : 0); if (isHpTrader != null) { _hashCode = 29 * _hashCode + isHpTrader.hashCode(); } _hashCode = 29 * _hashCode + (isHpTraderModified ? 1 : 0); if (contractTitle != null) { _hashCode = 29 * _hashCode + contractTitle.hashCode(); } _hashCode = 29 * _hashCode + (contractTitleModified ? 1 : 0); if (contractRef != null) { _hashCode = 29 * _hashCode + contractRef.hashCode(); } _hashCode = 29 * _hashCode + (contractRefModified ? 1 : 0); if (expiryDate != null) { _hashCode = 29 * _hashCode + expiryDate.hashCode(); } _hashCode = 29 * _hashCode + (expiryDateModified ? 1 : 0); if (hpContractMgr != null) { _hashCode = 29 * _hashCode + hpContractMgr.hashCode(); } _hashCode = 29 * _hashCode + (hpContractMgrModified ? 1 : 0); if (divName1 != null) { _hashCode = 29 * _hashCode + divName1.hashCode(); } _hashCode = 29 * _hashCode + (divName1Modified ? 1 : 0); if (contactName1 != null) { _hashCode = 29 * _hashCode + contactName1.hashCode(); } _hashCode = 29 * _hashCode + (contactName1Modified ? 1 : 0); if (siteLocation1 != null) { _hashCode = 29 * _hashCode + siteLocation1.hashCode(); } _hashCode = 29 * _hashCode + (siteLocation1Modified ? 1 : 0); if (lastMeetingDate1 != null) { _hashCode = 29 * _hashCode + lastMeetingDate1.hashCode(); } _hashCode = 29 * _hashCode + (lastMeetingDate1Modified ? 1 : 0); if (approxServicePeriod1 != null) { _hashCode = 29 * _hashCode + approxServicePeriod1.hashCode(); } _hashCode = 29 * _hashCode + (approxServicePeriod1Modified ? 1 : 0); if (divName2 != null) { _hashCode = 29 * _hashCode + divName2.hashCode(); } _hashCode = 29 * _hashCode + (divName2Modified ? 1 : 0); if (hpContactName2 != null) { _hashCode = 29 * _hashCode + hpContactName2.hashCode(); } _hashCode = 29 * _hashCode + (hpContactName2Modified ? 1 : 0); if (siteLocation2 != null) { _hashCode = 29 * _hashCode + siteLocation2.hashCode(); } _hashCode = 29 * _hashCode + (siteLocation2Modified ? 1 : 0); if (lastMeetingDate2 != null) { _hashCode = 29 * _hashCode + lastMeetingDate2.hashCode(); } _hashCode = 29 * _hashCode + (lastMeetingDate2Modified ? 1 : 0); if (approxServicePeriod2 != null) { _hashCode = 29 * _hashCode + approxServicePeriod2.hashCode(); } _hashCode = 29 * _hashCode + (approxServicePeriod2Modified ? 1 : 0); if (divName3 != null) { _hashCode = 29 * _hashCode + divName3.hashCode(); } _hashCode = 29 * _hashCode + (divName3Modified ? 1 : 0); if (hpContactName3 != null) { _hashCode = 29 * _hashCode + hpContactName3.hashCode(); } _hashCode = 29 * _hashCode + (hpContactName3Modified ? 1 : 0); if (siteLocation3 != null) { _hashCode = 29 * _hashCode + siteLocation3.hashCode(); } _hashCode = 29 * _hashCode + (siteLocation3Modified ? 1 : 0); if (lastMeetingDate3 != null) { _hashCode = 29 * _hashCode + lastMeetingDate3.hashCode(); } _hashCode = 29 * _hashCode + (lastMeetingDate3Modified ? 1 : 0); if (approxServicePeriod3 != null) { _hashCode = 29 * _hashCode + approxServicePeriod3.hashCode(); } _hashCode = 29 * _hashCode + (approxServicePeriod3Modified ? 1 : 0); if (organization1 != null) { _hashCode = 29 * _hashCode + organization1.hashCode(); } _hashCode = 29 * _hashCode + (organization1Modified ? 1 : 0); if (hpContactName1 != null) { _hashCode = 29 * _hashCode + hpContactName1.hashCode(); } _hashCode = 29 * _hashCode + (hpContactName1Modified ? 1 : 0); if (contactTitle1 != null) { _hashCode = 29 * _hashCode + contactTitle1.hashCode(); } _hashCode = 29 * _hashCode + (contactTitle1Modified ? 1 : 0); if (emailAddress1 != null) { _hashCode = 29 * _hashCode + emailAddress1.hashCode(); } _hashCode = 29 * _hashCode + (emailAddress1Modified ? 1 : 0); if (organization2 != null) { _hashCode = 29 * _hashCode + organization2.hashCode(); } _hashCode = 29 * _hashCode + (organization2Modified ? 1 : 0); if (contactName2 != null) { _hashCode = 29 * _hashCode + contactName2.hashCode(); } _hashCode = 29 * _hashCode + (contactName2Modified ? 1 : 0); if (contactTitle2 != null) { _hashCode = 29 * _hashCode + contactTitle2.hashCode(); } _hashCode = 29 * _hashCode + (contactTitle2Modified ? 1 : 0); if (emailAddress2 != null) { _hashCode = 29 * _hashCode + emailAddress2.hashCode(); } _hashCode = 29 * _hashCode + (emailAddress2Modified ? 1 : 0); if (organization3 != null) { _hashCode = 29 * _hashCode + organization3.hashCode(); } _hashCode = 29 * _hashCode + (organization3Modified ? 1 : 0); if (contactName3 != null) { _hashCode = 29 * _hashCode + contactName3.hashCode(); } _hashCode = 29 * _hashCode + (contactName3Modified ? 1 : 0); if (contactTitle3 != null) { _hashCode = 29 * _hashCode + contactTitle3.hashCode(); } _hashCode = 29 * _hashCode + (contactTitle3Modified ? 1 : 0); if (emailAddress3 != null) { _hashCode = 29 * _hashCode + emailAddress3.hashCode(); } _hashCode = 29 * _hashCode + (emailAddress3Modified ? 1 : 0); if (dateCreated != null) { _hashCode = 29 * _hashCode + dateCreated.hashCode(); } _hashCode = 29 * _hashCode + (dateCreatedModified ? 1 : 0); if (dateModified != null) { _hashCode = 29 * _hashCode + dateModified.hashCode(); } _hashCode = 29 * _hashCode + (dateModifiedModified ? 1 : 0); return _hashCode; } /** * Method 'createPk' * * @return ContactsreferencesPk */ public ContactsreferencesPk createPk() { return new ContactsreferencesPk(id, supplierId); } /** * Method 'toString' * * @return String */ public String toString() { StringBuffer ret = new StringBuffer(); ret.append( "com.hp.supplier.dto.Contactsreferences: " ); ret.append( "id=" + id ); ret.append( ", supplierId=" + supplierId ); ret.append( ", isHpTrader=" + isHpTrader ); ret.append( ", contractTitle=" + contractTitle ); ret.append( ", contractRef=" + contractRef ); ret.append( ", expiryDate=" + expiryDate ); ret.append( ", hpContractMgr=" + hpContractMgr ); ret.append( ", divName1=" + divName1 ); ret.append( ", contactName1=" + contactName1 ); ret.append( ", siteLocation1=" + siteLocation1 ); ret.append( ", lastMeetingDate1=" + lastMeetingDate1 ); ret.append( ", approxServicePeriod1=" + approxServicePeriod1 ); ret.append( ", divName2=" + divName2 ); ret.append( ", hpContactName2=" + hpContactName2 ); ret.append( ", siteLocation2=" + siteLocation2 ); ret.append( ", lastMeetingDate2=" + lastMeetingDate2 ); ret.append( ", approxServicePeriod2=" + approxServicePeriod2 ); ret.append( ", divName3=" + divName3 ); ret.append( ", hpContactName3=" + hpContactName3 ); ret.append( ", siteLocation3=" + siteLocation3 ); ret.append( ", lastMeetingDate3=" + lastMeetingDate3 ); ret.append( ", approxServicePeriod3=" + approxServicePeriod3 ); ret.append( ", organization1=" + organization1 ); ret.append( ", hpContactName1=" + hpContactName1 ); ret.append( ", contactTitle1=" + contactTitle1 ); ret.append( ", emailAddress1=" + emailAddress1 ); ret.append( ", organization2=" + organization2 ); ret.append( ", contactName2=" + contactName2 ); ret.append( ", contactTitle2=" + contactTitle2 ); ret.append( ", emailAddress2=" + emailAddress2 ); ret.append( ", organization3=" + organization3 ); ret.append( ", contactName3=" + contactName3 ); ret.append( ", contactTitle3=" + contactTitle3 ); ret.append( ", emailAddress3=" + emailAddress3 ); ret.append( ", dateCreated=" + dateCreated ); ret.append( ", dateModified=" + dateModified ); return ret.toString(); } }
true
7b74eff4c1f5849169657e7313dbd3ae934e5710
Java
tanvipnabar/AndroidNEW
/AppFirst/src/com/appfirst/datatypes/PolledDataData.java
UTF-8
1,666
2.046875
2
[]
no_license
/* * Copyright 2009-2011 AppFirst, Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.appfirst.datatypes; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * @author Bin Liu * */ public class PolledDataData extends BaseResourceData{ /** * @param jsonObject */ public PolledDataData(JSONObject jsonObject) { // TODO Auto-generated constructor stub setTime(BaseResourceData.getIntField("time", jsonObject)); status = BaseResourceData.getStringField("status", jsonObject); text = BaseResourceData.getStringField("text", jsonObject); values = BaseResourceData.getJSONObjectField("values", jsonObject); } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getText() { return text; } public void setText(String text) { this.text = text; } public JSONObject getValues() { return values; } public void setValues(JSONObject values) { this.values = values; } private String status; private String text; private JSONObject values; }
true
6f3bb76ca47fa374780ebb6e75c4e69aea053944
Java
MonikaFoks/ProdCons
/Producer.java
UTF-8
648
3.015625
3
[]
no_license
package Lab5; class Producer extends Thread { private char stuff = 'A'; private Bufor bufor; private int id; private boolean paused; public void play() { paused = false; } public void pause() { paused = true; } public Producer(Bufor bufor, int id) { this.bufor = bufor; this.id = id; } public void run() { if (stuff > 'Z') stuff = 'A'; bufor.put(id, stuff++); try { sleep((int)(Math.random() * 1000.0D) + 200); } catch (InterruptedException e) {} while (paused) { try { sleep(5L); } catch (InterruptedException e) {} } } }
true
9fae5a64c8ec03cff218f834ddc771af7b7c3e5c
Java
cheers32/tradepartner
/AlgosRef/src/Q150_Q199/Q155.java
UTF-8
1,771
3.734375
4
[]
no_license
package Q150_Q199; import java.util.Stack; public class Q155 { static class MinStack { // 2N space, constant time Stack<Integer> stack; Stack<Integer> min; /** initialize your data structure here. */ public MinStack() { // easy solution, 2N space, constant time stack = new Stack<>(); min = new Stack<>(); } public void push(int x) { if(min.isEmpty() || x<=min.peek()) { // this <= is critical, because it needs to push duplicate mins in to min stack min.push(x); } stack.push(x); } public void pop() { if(stack.isEmpty()) return; int top = stack.pop(); if(top==min.peek()) // very important, if using Integer, must use equals min.pop(); } public int top() { if(stack.isEmpty()) return 0; return stack.peek(); } public int getMin() { if(min.isEmpty()) return 0; return min.peek(); } } public static void main(String[] args) { Q155.MinStack ms = new Q155.MinStack(); System.out.println(ms.top()); ms.push(512); //System.out.println(ms.getMin()); ms.push(-1024); //System.out.println(ms.getMin()); //ms.push(-1024); //System.out.println(ms.getMin()); ms.push(512); System.out.println(ms.getMin()); ms.pop(); System.out.println(ms.getMin()); ms.pop(); System.out.println(ms.getMin()); ms.pop(); System.out.println(ms.getMin()); ms.pop(); System.out.println(ms.getMin()); } }
true
c927970a7bde58be1662255636b1a97c60d9a7dd
Java
falcondb/Misc
/Java-projects/lintcode/MyArray.java
UTF-8
3,585
3.859375
4
[]
no_license
public class MyArray { public static void main(String[] args) { int[] d = { -11, 12, 3, 17, 5 }; System.out.println(new MyArray().firstMissingPositive(d, d.length)); } /* * Given an array and a value, remove all instances of that value in place * and return the new length. * * The order of elements can be changed. It doesn't matter what you leave * beyond the new length. */ public int removeElement(int[] A, int elem) { int i = 0; for (int j = 0; j < A.length; j++) { if (A[j] != elem) { A[i] = A[j]; i++; } } return i; } /* * Remove Duplicates from Sorted Array */ public static int removeDuplicatesNaive(int[] A) { if (A.length < 2) return A.length; int j = 0; int i = 1; while (i < A.length) { if (A[i] == A[j]) { i++; } else { j++; A[j] = A[i]; i++; } } return j + 1; } /* * First Missing Positive Given an unsorted integer array, find the first * missing positive integer. */ public int firstMissingPositive(int A[], int n) { int i = 0; int temp = 0; while (i < n) { if (A[i] != (i + 1) && A[i] >= 1 && A[i] <= n && A[A[i] - 1] != A[i]) { temp = A[i]; A[i] = A[A[i] - 1]; A[A[i] - 1] = temp; } else i++; } for (i = 0; i < n; ++i) if (A[i] != (i + 1)) return i + 1; return n + 1; } /* * Search Insert Position Given a sorted array and a target value, return * the index if the target is found. If not, return the index where it would * be if it were inserted in order. You may assume no duplicates in the * array. */ public int searchInsert(int[] A, int target) { if (A == null || A.length == 0) return 0; return searchInsert(A, target, 0, A.length - 1); } public int searchInsert(int[] A, int target, int start, int end) { int mid = (start + end) / 2; if (target == A[mid]) return mid; else if (target < A[mid]) return start < mid ? searchInsert(A, target, start, mid - 1) : start; else return end > mid ? searchInsert(A, target, mid + 1, end) : (end + 1); } public int[] searchRange(int[] A, int target) { // Start typing your Java solution below // DO NOT write main() function if (A == null || A.length == 0) return null; int[] res = new int[2]; res[0] = searchMaxLessThan(A, target, 0, A.length - 1); res[1] = searchMaxLessThan(A, target + 1, 0, A.length - 1); if (res[0] == res[1]) { res[0] = -1; res[1] = -1; } else { res[0]++; } return res; } /* * Search for a Range */ public int searchMaxLessThan(int[] A, int target, int start, int end) { if (start == end) return A[start] < target ? start : start - 1; if (start == end - 1) return A[end] < target ? end : (A[start] < target ? start : start - 1); int mid = (start + end) / 2; if (A[mid] >= target) { end = mid - 1; } else { start = mid; } return searchMaxLessThan(A, target, start, end); } /* * Merge Sorted Array * * Given two sorted integer arrays A and B, merge B into A as one sorted array. * */ public void merge(int A[], int m, int B[], int n) { while(m > 0 && n > 0){ if(A[m-1] > B[n-1]){ A[m+n-1] = A[m-1]; m--; }else{ A[m+n-1] = B[n-1]; n--; } } while(n > 0){ A[m+n-1] = B[n-1]; n--; } } }
true
e38660ec05ae91fe527fa2d888536718de4259cc
Java
bakshidwarak/DSAndAlgo
/src/leetcode/sorttransformedarray/SortTransformedArray.java
UTF-8
1,368
3.96875
4
[]
no_license
package leetcode.sorttransformedarray; /** * 360. Sort Transformed Array Medium * * 199 * * 59 * * Favorite * * Share Given a sorted array of integers nums and integer values a, b and c. * Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x * in the array. * * The returned array must be in sorted order. * * Expected time complexity: O(n) * * Example 1: * * Input: nums = [-4,-2,2,4], a = 1, b = 3, c = 5 Output: [3,9,15,33] Example 2: * * Input: nums = [-4,-2,2,4], a = -1, b = 3, c = 5 Output: [-23,-5,1,7] * * @author dwaraknathbs * */ public class SortTransformedArray { public int[] sortTransformedArray(int[] nums, int a, int b, int c) { int[] result = new int[nums.length]; int start = 0; int end = nums.length - 1; int i = start; int j = end; while (start <= end) { int fromFirst = calc(nums[start], a, b, c); int fromLast = calc(nums[end], a, b, c); if (a <= 0) { if (fromFirst > fromLast) { result[i++] = fromLast; end--; } else { result[i++] = fromFirst; start++; } } else { if (fromFirst > fromLast) { result[j--] = fromFirst; start++; } else { result[j--] = fromLast; end--; } } } return result; } public int calc(int num, int a, int b, int c) { return a * num * num + b * num + c; } }
true
6a686002e016bddbc0fb6fa05117cbe027c35bea
Java
raybrm/IPL
/2BIN/PAE/projet-ae-groupe-01/src/main/java/be/ipl/pae/biz/devis/DevisImpl.java
UTF-8
3,623
2.296875
2
[]
no_license
package be.ipl.pae.biz.devis; import be.ipl.pae.biz.EtatAmenagements; import java.time.LocalDate; public class DevisImpl implements DevisBiz, Cloneable { private int idDevis; private int idClient; private LocalDate dateDevis; private double montantTotal; private int dureeTravaux; private int photoPrefere; private EtatAmenagements etat; private LocalDate dateDebutTravaux; private boolean visibiliteAmenagement; /** * Constructeur vide. */ public DevisImpl() {} /** * Constructeur. */ public DevisImpl(int idDevis, int idClient, LocalDate dateDevis, double montantTotal, int dureeTravaux, boolean visibiliteAmenagement) { this.idDevis = idDevis; this.idClient = idClient; this.dateDevis = dateDevis; this.montantTotal = montantTotal; this.dureeTravaux = dureeTravaux; this.visibiliteAmenagement = visibiliteAmenagement; } /** * Constructeur. */ public DevisImpl(int idDevis, int idClient, LocalDate dateDevis, double montantTotal, int dureeTravaux, int photoPrefere, EtatAmenagements etat, LocalDate dateDebutTravaux, boolean visibiliteAmenagement) { this.idDevis = idDevis; this.idClient = idClient; this.dateDevis = dateDevis; this.montantTotal = montantTotal; this.dureeTravaux = dureeTravaux; this.photoPrefere = photoPrefere; this.etat = etat; this.dateDebutTravaux = dateDebutTravaux; this.visibiliteAmenagement = visibiliteAmenagement; } @Override public int getIdDevis() { return idDevis; } @Override public int getIdClient() { return idClient; } @Override public LocalDate getDateDevis() { return dateDevis; } @Override public void setDateDevis(LocalDate dateDevis) { this.dateDevis = dateDevis; } @Override public double getMontantTotal() { return montantTotal; } @Override public void setMontantTotal(double montantTotal) { this.montantTotal = montantTotal; } @Override public int getDureeTravaux() { return dureeTravaux; } @Override public void setDureeTravaux(int dureeTravaux) { this.dureeTravaux = dureeTravaux; } @Override public int getPhotoPrefere() { return photoPrefere; } @Override public void setPhotoPrefere(int photoPrefere) { this.photoPrefere = photoPrefere; } @Override public EtatAmenagements getEtat() { return etat; } @Override public void setEtat(EtatAmenagements etat) { this.etat = etat; } @Override public LocalDate getDateDebutTravaux() { return dateDebutTravaux; } @Override public void setDateDebutTravaux(LocalDate dateDebutTravaux) { this.dateDebutTravaux = dateDebutTravaux; } @Override public boolean isVisibiliteAmenagement() { return visibiliteAmenagement; } @Override public void setVisibiliteAmenagement(boolean visibiliteAmenagement) { this.visibiliteAmenagement = visibiliteAmenagement; } @Override public void setIdDevis(int idDevis) { this.idDevis = idDevis; } @Override public void setIdClient(int idClient) { this.idClient = idClient; } @Override public DevisImpl clone() { try { return (DevisImpl) super.clone(); } catch (CloneNotSupportedException exception) { exception.printStackTrace(); } return null; } @Override public boolean verifierDateDebutTravaux() { return dateDevis.isBefore(dateDebutTravaux); } @Override public boolean verifierMontantTotal() { return montantTotal > 0; } @Override public boolean verifierDureeTravaux() { return dureeTravaux > 0; } }
true
79a3cabd646fef0657c17dde4f08b140234dd212
Java
Horsmann/toobee
/de.unidue.ltl.toobee.twitter/src/test/java/de/unidue/ltl/toobee/twitterUtils/TestRawJsonReaderLocalFileSystem.java
UTF-8
4,464
2.171875
2
[]
no_license
package de.unidue.ltl.toobee.twitterUtils; import static org.apache.uima.fit.factory.CollectionReaderFactory.createReader; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; import org.apache.uima.UIMAException; import org.apache.uima.collection.CollectionReader; import org.apache.uima.fit.factory.JCasFactory; import org.apache.uima.fit.util.JCasUtil; import org.apache.uima.jcas.JCas; import org.junit.Before; import org.junit.Test; import de.unidue.ltl.toobee.twitterUtils.type.RawTweet; public class TestRawJsonReaderLocalFileSystem { private File tweetPlainText; private File tweetGzip; private File tweetBzip2; private File tweetNeedUnescaping; private File folderMultipleFiles; @Before public void setUp() throws IOException { tweetPlainText = new File("src/test/resources/singleTweet.txt"); tweetGzip = new File("src/test/resources/singleTweet.txt.gz"); tweetBzip2 = new File("src/test/resources/singleTweet.txt.bz2"); tweetNeedUnescaping = new File("src/test/resources/needEscaping.json.gz"); folderMultipleFiles = new File("src/test/resources/"); } @Test public void testUnescaping() throws UIMAException, IOException { String payload = readDocumentText(tweetNeedUnescaping, false, true); assertTrue(payload.contains("#عمي_خليفة")); } @Test public void testRawTweetAnnotation() throws UIMAException, IOException { JCas jcas = getCas(tweetPlainText); String payload = readDocumentText(tweetPlainText, false, false); assertEquals(1, JCasUtil.select(jcas, RawTweet.class).size()); RawTweet raw = JCasUtil.selectSingle(jcas, RawTweet.class); assertTrue(raw.getRawTweet().contains(payload)); } @Test public void testPayloadExtractionPlain() throws UIMAException, IOException { String payload = readDocumentText(tweetPlainText, false, false); assertEquals("Let's get this ink next weekend @B_Penn03", payload); } @Test public void testPayloadExtractionPlainWithNormalization() throws UIMAException, IOException { String payload = readDocumentText(tweetPlainText, true, false); assertEquals("Let's get this ink next weekend", payload); } @Test public void testPayloadExtractionGzip() throws UIMAException, IOException { String payload = readDocumentText(tweetGzip, false, false); assertEquals("Let's get this ink next weekend @B_Penn03", payload); } @Test public void testPayloadExtractionBzip2() throws UIMAException, IOException { String payload = readDocumentText(tweetBzip2, false, false); assertEquals("Let's get this ink next weekend @B_Penn03", payload); } @Test public void testReadFolderWithMixedFiles() throws UIMAException, IOException { CollectionReader reader = createReader(RawJsonTweetReaderFIFO.class, RawJsonTweetReaderFIFO.PARAM_SOURCE_LOCATION, folderMultipleFiles.getAbsolutePath(), RawJsonTweetReaderFIFO.PARAM_PATTERNS, new String[] { "*.gz", "*.txt", "*.bz2", "*.zip" }); int count = 0; while (reader.hasNext()) { count++; } assertEquals(7, count); } private String readDocumentText(File input, boolean normalize, boolean unescape) throws UIMAException, IOException { CollectionReader reader = createReader(RawJsonTweetReaderFIFO.class, RawJsonTweetReaderFIFO.PARAM_SOURCE_LOCATION, input.getAbsolutePath(), RawJsonTweetReaderFIFO.PARAM_UNESCAPE_JAVA, unescape, RawJsonTweetReaderFIFO.PARAM_REMOVE_TWITTER_PHENOMENONS, normalize); JCas jcas = JCasFactory.createJCas(); reader.hasNext(); reader.getNext(jcas.getCas()); return jcas.getDocumentText(); } private JCas getCas(File input) throws UIMAException, IOException { CollectionReader reader = createReader(RawJsonTweetReaderFIFO.class, RawJsonTweetReaderFIFO.PARAM_SOURCE_LOCATION, input.getAbsolutePath()); JCas jcas = JCasFactory.createJCas(); reader.hasNext(); reader.getNext(jcas.getCas()); return jcas; } }
true
9e061f057979e89a4fdaaeffc0e8d056b9869a7d
Java
EricSchilha/GdxThreeCI
/core/src/gdx/threeci/GamMain.java
UTF-8
891
2.8125
3
[]
no_license
package gdx.threeci; import com.badlogic.gdx.Game; import com.badlogic.gdx.scenes.scene2d.Stage; public class GamMain extends Game { ScrMenu scrMenu; ScrPlay scrPlay; ScrGameover scrGameover; int nScreen; // 0 for menu, 1 for play, and 2 for game over public void updateState(int _nScreen) { nScreen = _nScreen; if (nScreen == 0) { setScreen(scrMenu); } else if (nScreen == 1) { setScreen(scrPlay); } else if (nScreen == 2) { setScreen(scrGameover); } } @Override public void create() { nScreen = 0; // notice that "this" is passed to each screen. Each screen now has access to methods within the "game" master program scrMenu = new ScrMenu(this); scrPlay = new ScrPlay(this); scrGameover = new ScrGameover(this); updateState(2); } @Override public void render() { super.render(); } @Override public void dispose() { super.dispose(); } }
true
53b3accf0df3374c8cb6682f4dbb5dcb9e3b415f
Java
naltang/bug_practice
/bug.java
UTF-8
3,269
3.421875
3
[ "MIT" ]
permissive
import java.util.Scanner; class Bug { public static void bug_stack_overflow() { } public static void bug_buffer_overflow() { } public static void bug_arithmetic_overflow() { } public static void bug_arithmetic_underflow() { } public static void bug_loss_of_arithmetic_precision() { } public static void bug_infinite_loop() { int n; n = 1; while (n < 10) { n = 2; } } public static void bug_null_pointer_exception() { } public static void bug_divide_by_zero() { int n1, n2; n1 = 0; n2 = 1 / n1; } public static void bug_use_of_uninitialized_variable() { } public static void bug_off_by_one() { } public static void bug_out_of_memory() { } public static void bug_deadlock() { } public static void bug_unprotected_critical_section() { } public static void bug_unreachable_code() { } public static void main(String[] args) { String sUserInput; Scanner scanner; scanner = new Scanner(System.in); do { System.out.println(" a) Stack overflow"); System.out.println(" b) Buffer overflow"); System.out.println(" c) Arithmetic overflow"); System.out.println(" d) Arithmetic underflow"); System.out.println(" e) Loss of arithmetic precision"); System.out.println(" f) Infinite loop"); System.out.println(" g) Null pointer exception"); System.out.println(" h) Divide by zero exception"); System.out.println(" i) Use of uninitialized variable"); System.out.println(" j) off-by-one error"); System.out.println(" k) Out of memory error"); System.out.println(" l) Deadlock"); System.out.println(" m) Unprotected critical section"); System.out.println(" n) Unreachable code"); System.out.print("Select Bug Type:"); sUserInput = scanner.nextLine(); if (sUserInput.length() != 1) { sUserInput = ""; continue; } switch(sUserInput.charAt(0)) { case 'a': bug_stack_overflow(); break; case 'b': bug_buffer_overflow(); break; case 'c': bug_arithmetic_overflow(); break; case 'd': bug_arithmetic_underflow(); break; case 'e': bug_loss_of_arithmetic_precision(); break; case 'f': bug_infinite_loop(); break; case 'g': bug_null_pointer_exception(); break; case 'h': bug_divide_by_zero(); break; case 'i': bug_use_of_uninitialized_variable(); break; case 'j': bug_off_by_one(); break; case 'k': bug_out_of_memory(); break; case 'l': bug_deadlock(); break; case 'm': bug_unprotected_critical_section(); break; case 'n': bug_unreachable_code(); break; default: sUserInput = ""; } } while (sUserInput.length() == 0); } }
true
8c165f4ef37ba1dd070f0e0128c9400dcfd63529
Java
p524/Tuboroidon524
/Tuboroid/src/info/narazaki/android/tuboroid/FlickDetector.java
UTF-8
1,752
2.546875
3
[]
no_license
package info.narazaki.android.tuboroid; import android.app.Activity; import android.view.MotionEvent; import android.view.ViewConfiguration; import android.view.GestureDetector.OnGestureListener; public abstract class FlickDetector { // フリックで戻る // # もっとマシなやりかたがありそう public abstract static class OnFlickListener implements OnGestureListener { private boolean handled; private Activity activity; private final static int touchSlop = ViewConfiguration.getTouchSlop(); public OnFlickListener(Activity a) { activity = a; } public abstract boolean onFlickLeft(); public abstract boolean onFlickRight(); @Override public boolean onDown(MotionEvent e) { handled = false; return false; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (e1 == null || e2 == null) return false; if (Math.abs(e2.getX() - e1.getX()) > touchSlop) { float x = Math.abs(velocityX); float y = Math.abs(velocityY); if (x > y*3 && x > activity.getResources().getDisplayMetrics().widthPixels) { if (Math.abs(e1.getX()-e2.getX()) > Math.abs(e1.getY()-e2.getY())) { handled = (velocityX > 0 ? onFlickRight() : onFlickLeft()); if (handled) { e2.setAction(MotionEvent.ACTION_CANCEL); } return handled; } } } return false; } @Override public void onLongPress(MotionEvent e) { } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return false; } @Override public void onShowPress(MotionEvent e) { } @Override public boolean onSingleTapUp(MotionEvent e) { return handled; } } }
true
373c53f43370d47aa780fb9f325fd83ff2f29fd6
Java
josecarloscanova/spf4j
/spf4j-avro/src/main/java/org/spf4j/avro/schema/SchemasWithClasses.java
UTF-8
1,461
2.71875
3
[]
no_license
package org.spf4j.avro.schema; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.HashMap; import java.util.Map; import org.apache.avro.Schema; /** * A visitor that recursively visits a schema and returns a map like: * java class name -> Schema * for every Schema encountered that has a java class implementation. * @author zoly */ //CHECKSTYLE IGNORE MissingSwitchDefault FOR NEXT 200 LINES public final class SchemasWithClasses implements SchemaVisitor<Map<String, Schema>> { private final Map<String, Schema> schemas = new HashMap<>(); @Override @SuppressFBWarnings("SF_SWITCH_NO_DEFAULT") public SchemaVisitorAction visitTerminal(final Schema schema) { switch (schema.getType()) { case FIXED: case ENUM: schemas.put(Schemas.getJavaClassName(schema), schema); break; } return SchemaVisitorAction.CONTINUE; } @Override public SchemaVisitorAction visitNonTerminal(final Schema schema) { if (schema.getType() == Schema.Type.RECORD) { schemas.put(Schemas.getJavaClassName(schema), schema); } return SchemaVisitorAction.CONTINUE; } @Override public SchemaVisitorAction afterVisitNonTerminal(final Schema terminal) { return SchemaVisitorAction.CONTINUE; } @Override public Map<String, Schema> get() { return schemas; } @Override public String toString() { return "SchemasWithClasses{" + "schemas=" + schemas + '}'; } }
true
86c4fe166707818f41fd7629477f237de28c37af
Java
viralpatelsait/Week05LabMyLogin
/src/java/services/AccountService.java
UTF-8
766
2.59375
3
[]
no_license
/* * 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 services; import java.util.ArrayList; import models.User; /** * * @author 834171 */ public class AccountService { private String betty,adam,password; public AccountService(){ this.adam="adam"; this.betty="betty"; this.password="password"; } public User login(String username, String password){ if((username.equals(this.adam) || username.equals(this.betty)) && password.equals(this.password)){ return new User(username,password); } return null; } }
true
52beb43ce89862f401b13324c971d34dcfc20286
Java
tadeucruz/projectrisc
/src/br/pucminas/tadeucruz/risc/Memoria.java
UTF-8
2,700
2.453125
2
[]
no_license
/* This file is part of ProjectRisc. ProjectRisc 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. ProjectRisc 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 ProjectRisc. If not, see <http://www.gnu.org/licenses/>. Copyright 2008 tadeucruz<contato@tadeucruz.com> */ package br.pucminas.tadeucruz.risc; import java.util.Vector; public class Memoria { private String Reg00 = "0000"; private String Reg01 = "0000"; private String Reg02 = "0000"; private String Reg03 = "0000"; private String Reg04 = "0000"; private String Reg05 = "0000"; private String Reg06 = "0000"; private String Reg07 = "0000"; private Vector<String> memoria = new Vector<String>(100); private String valornamemoria = ""; public String getValornamemoria() { return valornamemoria; } public void setValornamemoria(String ra, String rb) { this.valornamemoria = valornamemoria + ra + " - " + rb + "\n"; } public void limparMemoria() { this.valornamemoria = ""; } public Vector<String> getMemoria() { return memoria; } public void setMemoria(int pos, String valor) { memoria.add(pos, valor); } public String getReg00() { return Reg00; } public void setReg00(String Reg00) { this.Reg00 = Reg00; } public String getReg01() { return Reg01; } public void setReg01(String Reg01) { this.Reg01 = Reg01; } public String getReg02() { return Reg02; } public void setReg02(String Reg02) { this.Reg02 = Reg02; } public String getReg03() { return Reg03; } public void setReg03(String Reg03) { this.Reg03 = Reg03; } public String getReg04() { return Reg04; } public void setReg04(String Reg04) { this.Reg04 = Reg04; } public String getReg05() { return Reg05; } public void setReg05(String Reg05) { this.Reg05 = Reg05; } public String getReg06() { return Reg06; } public void setReg06(String Reg06) { this.Reg06 = Reg06; } public String getReg07() { return Reg07; } public void setReg07(String Reg07) { this.Reg07 = Reg07; } }
true
154d0020764065f7eee7f5a29914e8133447ec5c
Java
jonesmaXd/BonusMembers2
/src/main/java/no/ntnu/oblig2/GoldMembership.java
UTF-8
770
2.96875
3
[]
no_license
package no.ntnu.oblig2; public class GoldMembership extends Membership{ private final float POINTS_SCALING_FACTOR_LEVEL_1 = 1.3f; private final float POINTS_SCALING_FACTOR_LEVEL_2 = 1.5f; public GoldMembership(int points) { super(points); } @Override public int registerPoints(int bonusPointBalance, int newPoints) { if(bonusPointBalance < 90000) { bonusPointBalance += Math.round(newPoints + POINTS_SCALING_FACTOR_LEVEL_1); } else if(bonusPointBalance >= 90000){ bonusPointBalance += Math.round(newPoints + POINTS_SCALING_FACTOR_LEVEL_2); } return bonusPointBalance; } public String getMembershipName(){ return "Gold"; } }
true
e53a14ec66109ad4ce269c1e5d90bc278ef51b7c
Java
it114112tm1415fyp/client-android
/app/src/main/java/it114112tm1415fyp/com/client_android/ShipmentLocationList_Adapter.java
UTF-8
2,731
2.421875
2
[]
no_license
package it114112tm1415fyp.com.client_android; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import java.util.ArrayList; import java.util.TreeSet; public class ShipmentLocationList_Adapter extends BaseAdapter { private static final int TYPE_ITEM = 0; private static final int TYPE_SEPARATOR = 1; private ArrayList<String> locationList = new ArrayList<>(); private TreeSet<Integer> sectionHeader = new TreeSet<>(); private LayoutInflater mInflater; public ShipmentLocationList_Adapter(Context context) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public void addItem(final String item) { locationList.add(item); notifyDataSetChanged(); } public void addSectionHeaderItem(final String item) { locationList.add(item); sectionHeader.add(locationList.size() - 1); notifyDataSetChanged(); } @Override public int getItemViewType(int position) { return sectionHeader.contains(position) ? TYPE_SEPARATOR : TYPE_ITEM; } @Override public int getViewTypeCount() { return 2; } @Override public int getCount() { return locationList.size(); } @Override public String getItem(int position) { return locationList.get(position); } @Override public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { int rowType = getItemViewType(position); switch (rowType) { case TYPE_ITEM: if (convertView == null) { convertView = mInflater.inflate(R.layout.choose_location_list_item, null); } // TextView tv_num = (TextView) convertView // .findViewById(R.id.user_address_item_num); //tv_num.setText("Address " + position + 1); TextView tv_address = (TextView) convertView.findViewById(R.id.user_address_item_address); tv_address.setText(locationList.get(position)); break; case TYPE_SEPARATOR: if (convertView == null) { convertView = mInflater.inflate(R.layout.listview_section_header, null); } TextView tv_header = (TextView) convertView.findViewById(R.id.tv_listview_section_header); tv_header.setText(locationList.get(position)); break; } return convertView; } }
true
a48b4e724507b8abbf6fe95bb0fabcb8f134909b
Java
jbplevin/android_project
/MyFoodTracker/app/src/main/java/com/example/user/myfoodtracker/LogItemDao.java
UTF-8
959
2.0625
2
[]
no_license
package com.example.user.myfoodtracker; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.Query; import android.arch.persistence.room.TypeConverter; import android.arch.persistence.room.Update; import java.util.List; import com.example.user.myfoodtracker.LogItem; /** * Created by user on 29/01/2018. */ @Dao public interface LogItemDao { @Query("SELECT * FROM logs") List<LogItem> getAll(); @Query("SELECT * from logs where logItemId = :logItemId") LogItem findById(int logItemId); @Query("SELECT COUNT(*) from logs") int countLogItems(); @Insert void insertAll(LogItem... logItems); @Insert long insertLogItem(LogItem logItem); @Update void updateLogItems(LogItem logItems); @Delete void delete(LogItem logItems); @Query("DELETE FROM logs") void deleteAll(); }
true
57a23c8e03231cd598f239a51ae2a53e8e72eb68
Java
stphung/azura
/src/experiment/physics/objects/SphericalMass.java
UTF-8
113
1.65625
2
[]
no_license
package experiment.physics.objects; public interface SphericalMass extends PointMass { double getRadius(); }
true
64fa2ad2596f0e2f7ebb8762d6f6fa594c1d775a
Java
seungmi9191/chapter01
/src/com/javaex/ex01/Ex02.java
UTF-8
393
3.0625
3
[]
no_license
package com.javaex.ex01; public class Ex02 { public static void main(String[] args) { double var01 = 3.14; float var02 = 3.14f; System.out.println(var01); System.out.println(var02); double var03=0.123456789123456789111235488565453215; float var04=0.123456789123456789111235488565453215f; System.out.println(var03); System.out.println(var04); } }
true
dad860577928f051569f583c952958879c1e6b9d
Java
yunlei/sjtu-database-mla
/src/Parse/Yylex.java
UTF-8
77,481
2.515625
3
[]
no_license
package Parse; import ErrorMsg.ErrorMsg; class Yylex { private final int YY_BUFFER_SIZE = 512; private final int YY_F = -1; private final int YY_NO_STATE = -1; private final int YY_NOT_ACCEPT = 0; private final int YY_START = 1; private final int YY_END = 2; private final int YY_NO_ANCHOR = 4; private final int YY_BOL = 128; private final int YY_EOF = 129; StringBuffer string = new StringBuffer(); private java_cup.runtime.Symbol nextToken(int kind, Object value) { return new java_cup.runtime.Symbol(kind, yychar, yychar+yylength(),value); } private java_cup.runtime.Symbol nextToken(int kind){ return nextToken(kind,yytext()); } private java.io.BufferedReader yy_reader; private int yy_buffer_index; private int yy_buffer_read; private int yy_buffer_start; private int yy_buffer_end; private char yy_buffer[]; private int yychar; private boolean yy_at_bol; private int yy_lexical_state; Yylex (java.io.Reader reader) { this (); if (null == reader) { throw (new Error("Error: Bad input stream initializer.")); } yy_reader = new java.io.BufferedReader(reader); } Yylex (java.io.InputStream instream) { this (); if (null == instream) { throw (new Error("Error: Bad input stream initializer.")); } yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream)); } private Yylex () { yy_buffer = new char[YY_BUFFER_SIZE]; yy_buffer_read = 0; yy_buffer_index = 0; yy_buffer_start = 0; yy_buffer_end = 0; yychar = 0; yy_at_bol = true; yy_lexical_state = YYINITIAL; } private boolean yy_eof_done = false; private final int STRING = 1; private final int YYINITIAL = 0; private final int yy_state_dtrans[] = { 0, 159 }; private void yybegin (int state) { yy_lexical_state = state; } private int yy_advance () throws java.io.IOException { int next_read; int i; int j; if (yy_buffer_index < yy_buffer_read) { return yy_buffer[yy_buffer_index++]; } if (0 != yy_buffer_start) { i = yy_buffer_start; j = 0; while (i < yy_buffer_read) { yy_buffer[j] = yy_buffer[i]; ++i; ++j; } yy_buffer_end = yy_buffer_end - yy_buffer_start; yy_buffer_start = 0; yy_buffer_read = j; yy_buffer_index = j; next_read = yy_reader.read(yy_buffer, yy_buffer_read, yy_buffer.length - yy_buffer_read); if (-1 == next_read) { return YY_EOF; } yy_buffer_read = yy_buffer_read + next_read; } while (yy_buffer_index >= yy_buffer_read) { if (yy_buffer_index >= yy_buffer.length) { yy_buffer = yy_double(yy_buffer); } next_read = yy_reader.read(yy_buffer, yy_buffer_read, yy_buffer.length - yy_buffer_read); if (-1 == next_read) { return YY_EOF; } yy_buffer_read = yy_buffer_read + next_read; } return yy_buffer[yy_buffer_index++]; } private void yy_move_end () { if (yy_buffer_end > yy_buffer_start && '\n' == yy_buffer[yy_buffer_end-1]) yy_buffer_end--; if (yy_buffer_end > yy_buffer_start && '\r' == yy_buffer[yy_buffer_end-1]) yy_buffer_end--; } private boolean yy_last_was_cr=false; private void yy_mark_start () { yychar = yychar + yy_buffer_index - yy_buffer_start; yy_buffer_start = yy_buffer_index; } private void yy_mark_end () { yy_buffer_end = yy_buffer_index; } private void yy_to_mark () { yy_buffer_index = yy_buffer_end; yy_at_bol = (yy_buffer_end > yy_buffer_start) && ('\r' == yy_buffer[yy_buffer_end-1] || '\n' == yy_buffer[yy_buffer_end-1] || 2028/*LS*/ == yy_buffer[yy_buffer_end-1] || 2029/*PS*/ == yy_buffer[yy_buffer_end-1]); } private java.lang.String yytext () { return (new java.lang.String(yy_buffer, yy_buffer_start, yy_buffer_end - yy_buffer_start)); } private int yylength () { return yy_buffer_end - yy_buffer_start; } private char[] yy_double (char buf[]) { int i; char newbuf[]; newbuf = new char[2*buf.length]; for (i = 0; i < buf.length; ++i) { newbuf[i] = buf[i]; } return newbuf; } private final int YY_E_INTERNAL = 0; private final int YY_E_MATCH = 1; private java.lang.String yy_error_string[] = { "Error: Internal error.\n", "Error: Unmatched input.\n" }; private void yy_error (int code,boolean fatal) { java.lang.System.out.print(yy_error_string[code]); java.lang.System.out.flush(); if (fatal) { throw new Error("Fatal Error.\n"); } } private int[][] unpackFromString(int size1, int size2, String st) { int colonIndex = -1; String lengthString; int sequenceLength = 0; int sequenceInteger = 0; int commaIndex; String workString; int res[][] = new int[size1][size2]; for (int i= 0; i < size1; i++) { for (int j= 0; j < size2; j++) { if (sequenceLength != 0) { res[i][j] = sequenceInteger; sequenceLength--; continue; } commaIndex = st.indexOf(','); workString = (commaIndex==-1) ? st : st.substring(0, commaIndex); st = st.substring(commaIndex+1); colonIndex = workString.indexOf(':'); if (colonIndex == -1) { res[i][j]=Integer.parseInt(workString); continue; } lengthString = workString.substring(colonIndex+1); sequenceLength=Integer.parseInt(lengthString); workString=workString.substring(0,colonIndex); sequenceInteger=Integer.parseInt(workString); res[i][j] = sequenceInteger; sequenceLength--; } } return res; } private int yy_acpt[] = { /* 0 */ YY_NOT_ACCEPT, /* 1 */ YY_NO_ANCHOR, /* 2 */ YY_NO_ANCHOR, /* 3 */ YY_NO_ANCHOR, /* 4 */ YY_NO_ANCHOR, /* 5 */ YY_NO_ANCHOR, /* 6 */ YY_NO_ANCHOR, /* 7 */ YY_NO_ANCHOR, /* 8 */ YY_NO_ANCHOR, /* 9 */ YY_NO_ANCHOR, /* 10 */ YY_NO_ANCHOR, /* 11 */ YY_NO_ANCHOR, /* 12 */ YY_NO_ANCHOR, /* 13 */ YY_NO_ANCHOR, /* 14 */ YY_NO_ANCHOR, /* 15 */ YY_NO_ANCHOR, /* 16 */ YY_NO_ANCHOR, /* 17 */ YY_NO_ANCHOR, /* 18 */ YY_NO_ANCHOR, /* 19 */ YY_NO_ANCHOR, /* 20 */ YY_NO_ANCHOR, /* 21 */ YY_NO_ANCHOR, /* 22 */ YY_NO_ANCHOR, /* 23 */ YY_NO_ANCHOR, /* 24 */ YY_NO_ANCHOR, /* 25 */ YY_NO_ANCHOR, /* 26 */ YY_NO_ANCHOR, /* 27 */ YY_NO_ANCHOR, /* 28 */ YY_NO_ANCHOR, /* 29 */ YY_NO_ANCHOR, /* 30 */ YY_NO_ANCHOR, /* 31 */ YY_NO_ANCHOR, /* 32 */ YY_NO_ANCHOR, /* 33 */ YY_NO_ANCHOR, /* 34 */ YY_NO_ANCHOR, /* 35 */ YY_NO_ANCHOR, /* 36 */ YY_NO_ANCHOR, /* 37 */ YY_NO_ANCHOR, /* 38 */ YY_NO_ANCHOR, /* 39 */ YY_NO_ANCHOR, /* 40 */ YY_NO_ANCHOR, /* 41 */ YY_NO_ANCHOR, /* 42 */ YY_NO_ANCHOR, /* 43 */ YY_NO_ANCHOR, /* 44 */ YY_NO_ANCHOR, /* 45 */ YY_NO_ANCHOR, /* 46 */ YY_NO_ANCHOR, /* 47 */ YY_NO_ANCHOR, /* 48 */ YY_NO_ANCHOR, /* 49 */ YY_NO_ANCHOR, /* 50 */ YY_NO_ANCHOR, /* 51 */ YY_NO_ANCHOR, /* 52 */ YY_NO_ANCHOR, /* 53 */ YY_NO_ANCHOR, /* 54 */ YY_NO_ANCHOR, /* 55 */ YY_NO_ANCHOR, /* 56 */ YY_NO_ANCHOR, /* 57 */ YY_NO_ANCHOR, /* 58 */ YY_NO_ANCHOR, /* 59 */ YY_NO_ANCHOR, /* 60 */ YY_NO_ANCHOR, /* 61 */ YY_NO_ANCHOR, /* 62 */ YY_NO_ANCHOR, /* 63 */ YY_NO_ANCHOR, /* 64 */ YY_NO_ANCHOR, /* 65 */ YY_NO_ANCHOR, /* 66 */ YY_NO_ANCHOR, /* 67 */ YY_NO_ANCHOR, /* 68 */ YY_NO_ANCHOR, /* 69 */ YY_NO_ANCHOR, /* 70 */ YY_NO_ANCHOR, /* 71 */ YY_NO_ANCHOR, /* 72 */ YY_NO_ANCHOR, /* 73 */ YY_NO_ANCHOR, /* 74 */ YY_NO_ANCHOR, /* 75 */ YY_NO_ANCHOR, /* 76 */ YY_NO_ANCHOR, /* 77 */ YY_NO_ANCHOR, /* 78 */ YY_NO_ANCHOR, /* 79 */ YY_NO_ANCHOR, /* 80 */ YY_NO_ANCHOR, /* 81 */ YY_NO_ANCHOR, /* 82 */ YY_NO_ANCHOR, /* 83 */ YY_NO_ANCHOR, /* 84 */ YY_NO_ANCHOR, /* 85 */ YY_NO_ANCHOR, /* 86 */ YY_NO_ANCHOR, /* 87 */ YY_NO_ANCHOR, /* 88 */ YY_NO_ANCHOR, /* 89 */ YY_NO_ANCHOR, /* 90 */ YY_NO_ANCHOR, /* 91 */ YY_NO_ANCHOR, /* 92 */ YY_NO_ANCHOR, /* 93 */ YY_NO_ANCHOR, /* 94 */ YY_NO_ANCHOR, /* 95 */ YY_NO_ANCHOR, /* 96 */ YY_NO_ANCHOR, /* 97 */ YY_NO_ANCHOR, /* 98 */ YY_NO_ANCHOR, /* 99 */ YY_NO_ANCHOR, /* 100 */ YY_NO_ANCHOR, /* 101 */ YY_NO_ANCHOR, /* 102 */ YY_NO_ANCHOR, /* 103 */ YY_NO_ANCHOR, /* 104 */ YY_NO_ANCHOR, /* 105 */ YY_NO_ANCHOR, /* 106 */ YY_NO_ANCHOR, /* 107 */ YY_NO_ANCHOR, /* 108 */ YY_NO_ANCHOR, /* 109 */ YY_NO_ANCHOR, /* 110 */ YY_NO_ANCHOR, /* 111 */ YY_NO_ANCHOR, /* 112 */ YY_NO_ANCHOR, /* 113 */ YY_NO_ANCHOR, /* 114 */ YY_NO_ANCHOR, /* 115 */ YY_NO_ANCHOR, /* 116 */ YY_NO_ANCHOR, /* 117 */ YY_NO_ANCHOR, /* 118 */ YY_NO_ANCHOR, /* 119 */ YY_NO_ANCHOR, /* 120 */ YY_NO_ANCHOR, /* 121 */ YY_NO_ANCHOR, /* 122 */ YY_NO_ANCHOR, /* 123 */ YY_NO_ANCHOR, /* 124 */ YY_NO_ANCHOR, /* 125 */ YY_NO_ANCHOR, /* 126 */ YY_NO_ANCHOR, /* 127 */ YY_NO_ANCHOR, /* 128 */ YY_NO_ANCHOR, /* 129 */ YY_NO_ANCHOR, /* 130 */ YY_NO_ANCHOR, /* 131 */ YY_NO_ANCHOR, /* 132 */ YY_NO_ANCHOR, /* 133 */ YY_NO_ANCHOR, /* 134 */ YY_NO_ANCHOR, /* 135 */ YY_NO_ANCHOR, /* 136 */ YY_NO_ANCHOR, /* 137 */ YY_NO_ANCHOR, /* 138 */ YY_NO_ANCHOR, /* 139 */ YY_NO_ANCHOR, /* 140 */ YY_NO_ANCHOR, /* 141 */ YY_NO_ANCHOR, /* 142 */ YY_NO_ANCHOR, /* 143 */ YY_NO_ANCHOR, /* 144 */ YY_NO_ANCHOR, /* 145 */ YY_NO_ANCHOR, /* 146 */ YY_NO_ANCHOR, /* 147 */ YY_NO_ANCHOR, /* 148 */ YY_NO_ANCHOR, /* 149 */ YY_NO_ANCHOR, /* 150 */ YY_NO_ANCHOR, /* 151 */ YY_NO_ANCHOR, /* 152 */ YY_NO_ANCHOR, /* 153 */ YY_NO_ANCHOR, /* 154 */ YY_NO_ANCHOR, /* 155 */ YY_NOT_ACCEPT, /* 156 */ YY_NO_ANCHOR, /* 157 */ YY_NOT_ACCEPT, /* 158 */ YY_NO_ANCHOR, /* 159 */ YY_NOT_ACCEPT, /* 160 */ YY_NO_ANCHOR, /* 161 */ YY_NO_ANCHOR, /* 162 */ YY_NO_ANCHOR, /* 163 */ YY_NO_ANCHOR, /* 164 */ YY_NO_ANCHOR, /* 165 */ YY_NO_ANCHOR, /* 166 */ YY_NO_ANCHOR, /* 167 */ YY_NO_ANCHOR, /* 168 */ YY_NO_ANCHOR, /* 169 */ YY_NO_ANCHOR, /* 170 */ YY_NO_ANCHOR, /* 171 */ YY_NO_ANCHOR, /* 172 */ YY_NO_ANCHOR, /* 173 */ YY_NO_ANCHOR, /* 174 */ YY_NO_ANCHOR, /* 175 */ YY_NO_ANCHOR, /* 176 */ YY_NO_ANCHOR, /* 177 */ YY_NO_ANCHOR, /* 178 */ YY_NO_ANCHOR, /* 179 */ YY_NO_ANCHOR, /* 180 */ YY_NO_ANCHOR, /* 181 */ YY_NO_ANCHOR, /* 182 */ YY_NO_ANCHOR, /* 183 */ YY_NO_ANCHOR, /* 184 */ YY_NO_ANCHOR, /* 185 */ YY_NO_ANCHOR, /* 186 */ YY_NO_ANCHOR, /* 187 */ YY_NO_ANCHOR, /* 188 */ YY_NO_ANCHOR, /* 189 */ YY_NO_ANCHOR, /* 190 */ YY_NO_ANCHOR, /* 191 */ YY_NO_ANCHOR, /* 192 */ YY_NO_ANCHOR, /* 193 */ YY_NO_ANCHOR, /* 194 */ YY_NO_ANCHOR, /* 195 */ YY_NO_ANCHOR, /* 196 */ YY_NO_ANCHOR, /* 197 */ YY_NO_ANCHOR, /* 198 */ YY_NO_ANCHOR, /* 199 */ YY_NO_ANCHOR, /* 200 */ YY_NO_ANCHOR, /* 201 */ YY_NO_ANCHOR, /* 202 */ YY_NO_ANCHOR, /* 203 */ YY_NO_ANCHOR, /* 204 */ YY_NO_ANCHOR, /* 205 */ YY_NO_ANCHOR, /* 206 */ YY_NO_ANCHOR, /* 207 */ YY_NO_ANCHOR, /* 208 */ YY_NO_ANCHOR, /* 209 */ YY_NO_ANCHOR, /* 210 */ YY_NO_ANCHOR, /* 211 */ YY_NO_ANCHOR, /* 212 */ YY_NO_ANCHOR, /* 213 */ YY_NO_ANCHOR, /* 214 */ YY_NO_ANCHOR, /* 215 */ YY_NO_ANCHOR, /* 216 */ YY_NO_ANCHOR, /* 217 */ YY_NO_ANCHOR, /* 218 */ YY_NO_ANCHOR, /* 219 */ YY_NO_ANCHOR, /* 220 */ YY_NO_ANCHOR, /* 221 */ YY_NO_ANCHOR, /* 222 */ YY_NO_ANCHOR, /* 223 */ YY_NO_ANCHOR, /* 224 */ YY_NO_ANCHOR, /* 225 */ YY_NO_ANCHOR, /* 226 */ YY_NO_ANCHOR, /* 227 */ YY_NO_ANCHOR, /* 228 */ YY_NO_ANCHOR, /* 229 */ YY_NO_ANCHOR, /* 230 */ YY_NO_ANCHOR, /* 231 */ YY_NO_ANCHOR, /* 232 */ YY_NO_ANCHOR, /* 233 */ YY_NO_ANCHOR, /* 234 */ YY_NO_ANCHOR, /* 235 */ YY_NO_ANCHOR, /* 236 */ YY_NO_ANCHOR, /* 237 */ YY_NO_ANCHOR, /* 238 */ YY_NO_ANCHOR, /* 239 */ YY_NO_ANCHOR, /* 240 */ YY_NO_ANCHOR, /* 241 */ YY_NO_ANCHOR, /* 242 */ YY_NO_ANCHOR, /* 243 */ YY_NO_ANCHOR, /* 244 */ YY_NO_ANCHOR, /* 245 */ YY_NO_ANCHOR, /* 246 */ YY_NO_ANCHOR, /* 247 */ YY_NO_ANCHOR, /* 248 */ YY_NO_ANCHOR, /* 249 */ YY_NO_ANCHOR, /* 250 */ YY_NO_ANCHOR, /* 251 */ YY_NO_ANCHOR, /* 252 */ YY_NO_ANCHOR, /* 253 */ YY_NO_ANCHOR, /* 254 */ YY_NO_ANCHOR, /* 255 */ YY_NO_ANCHOR, /* 256 */ YY_NO_ANCHOR, /* 257 */ YY_NO_ANCHOR, /* 258 */ YY_NO_ANCHOR, /* 259 */ YY_NO_ANCHOR, /* 260 */ YY_NO_ANCHOR, /* 261 */ YY_NO_ANCHOR, /* 262 */ YY_NO_ANCHOR, /* 263 */ YY_NO_ANCHOR, /* 264 */ YY_NO_ANCHOR, /* 265 */ YY_NO_ANCHOR, /* 266 */ YY_NO_ANCHOR, /* 267 */ YY_NO_ANCHOR, /* 268 */ YY_NO_ANCHOR, /* 269 */ YY_NO_ANCHOR, /* 270 */ YY_NO_ANCHOR, /* 271 */ YY_NO_ANCHOR, /* 272 */ YY_NO_ANCHOR, /* 273 */ YY_NO_ANCHOR, /* 274 */ YY_NO_ANCHOR, /* 275 */ YY_NO_ANCHOR, /* 276 */ YY_NO_ANCHOR, /* 277 */ YY_NO_ANCHOR, /* 278 */ YY_NO_ANCHOR, /* 279 */ YY_NO_ANCHOR, /* 280 */ YY_NO_ANCHOR, /* 281 */ YY_NO_ANCHOR, /* 282 */ YY_NO_ANCHOR, /* 283 */ YY_NO_ANCHOR, /* 284 */ YY_NO_ANCHOR, /* 285 */ YY_NO_ANCHOR, /* 286 */ YY_NO_ANCHOR, /* 287 */ YY_NO_ANCHOR, /* 288 */ YY_NO_ANCHOR, /* 289 */ YY_NO_ANCHOR, /* 290 */ YY_NO_ANCHOR, /* 291 */ YY_NO_ANCHOR, /* 292 */ YY_NO_ANCHOR, /* 293 */ YY_NO_ANCHOR, /* 294 */ YY_NO_ANCHOR, /* 295 */ YY_NO_ANCHOR, /* 296 */ YY_NO_ANCHOR, /* 297 */ YY_NO_ANCHOR, /* 298 */ YY_NO_ANCHOR, /* 299 */ YY_NO_ANCHOR, /* 300 */ YY_NO_ANCHOR, /* 301 */ YY_NO_ANCHOR, /* 302 */ YY_NO_ANCHOR, /* 303 */ YY_NO_ANCHOR, /* 304 */ YY_NO_ANCHOR, /* 305 */ YY_NO_ANCHOR, /* 306 */ YY_NO_ANCHOR, /* 307 */ YY_NO_ANCHOR, /* 308 */ YY_NO_ANCHOR, /* 309 */ YY_NO_ANCHOR, /* 310 */ YY_NO_ANCHOR, /* 311 */ YY_NO_ANCHOR, /* 312 */ YY_NO_ANCHOR, /* 313 */ YY_NO_ANCHOR, /* 314 */ YY_NO_ANCHOR, /* 315 */ YY_NO_ANCHOR, /* 316 */ YY_NO_ANCHOR, /* 317 */ YY_NO_ANCHOR, /* 318 */ YY_NO_ANCHOR, /* 319 */ YY_NO_ANCHOR, /* 320 */ YY_NO_ANCHOR, /* 321 */ YY_NO_ANCHOR, /* 322 */ YY_NO_ANCHOR, /* 323 */ YY_NO_ANCHOR, /* 324 */ YY_NO_ANCHOR, /* 325 */ YY_NO_ANCHOR, /* 326 */ YY_NO_ANCHOR, /* 327 */ YY_NO_ANCHOR, /* 328 */ YY_NO_ANCHOR, /* 329 */ YY_NO_ANCHOR, /* 330 */ YY_NO_ANCHOR, /* 331 */ YY_NO_ANCHOR, /* 332 */ YY_NO_ANCHOR, /* 333 */ YY_NO_ANCHOR, /* 334 */ YY_NO_ANCHOR, /* 335 */ YY_NO_ANCHOR, /* 336 */ YY_NO_ANCHOR, /* 337 */ YY_NO_ANCHOR, /* 338 */ YY_NO_ANCHOR, /* 339 */ YY_NO_ANCHOR, /* 340 */ YY_NO_ANCHOR, /* 341 */ YY_NO_ANCHOR, /* 342 */ YY_NO_ANCHOR, /* 343 */ YY_NO_ANCHOR, /* 344 */ YY_NO_ANCHOR, /* 345 */ YY_NO_ANCHOR, /* 346 */ YY_NO_ANCHOR, /* 347 */ YY_NO_ANCHOR, /* 348 */ YY_NO_ANCHOR, /* 349 */ YY_NO_ANCHOR, /* 350 */ YY_NO_ANCHOR, /* 351 */ YY_NO_ANCHOR, /* 352 */ YY_NO_ANCHOR, /* 353 */ YY_NO_ANCHOR, /* 354 */ YY_NO_ANCHOR, /* 355 */ YY_NO_ANCHOR, /* 356 */ YY_NO_ANCHOR, /* 357 */ YY_NO_ANCHOR, /* 358 */ YY_NO_ANCHOR, /* 359 */ YY_NO_ANCHOR, /* 360 */ YY_NO_ANCHOR, /* 361 */ YY_NO_ANCHOR, /* 362 */ YY_NO_ANCHOR, /* 363 */ YY_NO_ANCHOR, /* 364 */ YY_NO_ANCHOR, /* 365 */ YY_NO_ANCHOR, /* 366 */ YY_NO_ANCHOR, /* 367 */ YY_NO_ANCHOR, /* 368 */ YY_NO_ANCHOR, /* 369 */ YY_NO_ANCHOR, /* 370 */ YY_NO_ANCHOR, /* 371 */ YY_NO_ANCHOR, /* 372 */ YY_NO_ANCHOR, /* 373 */ YY_NO_ANCHOR, /* 374 */ YY_NO_ANCHOR, /* 375 */ YY_NO_ANCHOR, /* 376 */ YY_NO_ANCHOR, /* 377 */ YY_NO_ANCHOR, /* 378 */ YY_NO_ANCHOR, /* 379 */ YY_NO_ANCHOR, /* 380 */ YY_NO_ANCHOR, /* 381 */ YY_NO_ANCHOR, /* 382 */ YY_NO_ANCHOR, /* 383 */ YY_NO_ANCHOR, /* 384 */ YY_NO_ANCHOR, /* 385 */ YY_NO_ANCHOR, /* 386 */ YY_NO_ANCHOR, /* 387 */ YY_NO_ANCHOR, /* 388 */ YY_NO_ANCHOR, /* 389 */ YY_NO_ANCHOR, /* 390 */ YY_NO_ANCHOR, /* 391 */ YY_NO_ANCHOR, /* 392 */ YY_NO_ANCHOR, /* 393 */ YY_NO_ANCHOR, /* 394 */ YY_NO_ANCHOR, /* 395 */ YY_NO_ANCHOR, /* 396 */ YY_NO_ANCHOR, /* 397 */ YY_NO_ANCHOR, /* 398 */ YY_NO_ANCHOR, /* 399 */ YY_NO_ANCHOR, /* 400 */ YY_NO_ANCHOR, /* 401 */ YY_NO_ANCHOR, /* 402 */ YY_NO_ANCHOR, /* 403 */ YY_NO_ANCHOR, /* 404 */ YY_NO_ANCHOR, /* 405 */ YY_NO_ANCHOR, /* 406 */ YY_NO_ANCHOR, /* 407 */ YY_NO_ANCHOR, /* 408 */ YY_NO_ANCHOR, /* 409 */ YY_NO_ANCHOR, /* 410 */ YY_NO_ANCHOR, /* 411 */ YY_NO_ANCHOR, /* 412 */ YY_NO_ANCHOR, /* 413 */ YY_NO_ANCHOR, /* 414 */ YY_NO_ANCHOR, /* 415 */ YY_NO_ANCHOR, /* 416 */ YY_NO_ANCHOR, /* 417 */ YY_NO_ANCHOR, /* 418 */ YY_NO_ANCHOR, /* 419 */ YY_NO_ANCHOR, /* 420 */ YY_NO_ANCHOR, /* 421 */ YY_NO_ANCHOR, /* 422 */ YY_NO_ANCHOR, /* 423 */ YY_NO_ANCHOR, /* 424 */ YY_NO_ANCHOR, /* 425 */ YY_NO_ANCHOR, /* 426 */ YY_NO_ANCHOR, /* 427 */ YY_NO_ANCHOR, /* 428 */ YY_NO_ANCHOR, /* 429 */ YY_NO_ANCHOR, /* 430 */ YY_NO_ANCHOR, /* 431 */ YY_NO_ANCHOR, /* 432 */ YY_NO_ANCHOR, /* 433 */ YY_NO_ANCHOR, /* 434 */ YY_NO_ANCHOR, /* 435 */ YY_NO_ANCHOR, /* 436 */ YY_NO_ANCHOR, /* 437 */ YY_NO_ANCHOR, /* 438 */ YY_NO_ANCHOR, /* 439 */ YY_NO_ANCHOR, /* 440 */ YY_NO_ANCHOR, /* 441 */ YY_NO_ANCHOR, /* 442 */ YY_NO_ANCHOR, /* 443 */ YY_NO_ANCHOR, /* 444 */ YY_NO_ANCHOR, /* 445 */ YY_NO_ANCHOR, /* 446 */ YY_NO_ANCHOR, /* 447 */ YY_NO_ANCHOR, /* 448 */ YY_NO_ANCHOR, /* 449 */ YY_NO_ANCHOR, /* 450 */ YY_NO_ANCHOR, /* 451 */ YY_NO_ANCHOR, /* 452 */ YY_NO_ANCHOR, /* 453 */ YY_NO_ANCHOR, /* 454 */ YY_NO_ANCHOR, /* 455 */ YY_NO_ANCHOR, /* 456 */ YY_NO_ANCHOR, /* 457 */ YY_NO_ANCHOR, /* 458 */ YY_NO_ANCHOR, /* 459 */ YY_NO_ANCHOR, /* 460 */ YY_NO_ANCHOR, /* 461 */ YY_NO_ANCHOR, /* 462 */ YY_NO_ANCHOR, /* 463 */ YY_NO_ANCHOR, /* 464 */ YY_NO_ANCHOR, /* 465 */ YY_NO_ANCHOR, /* 466 */ YY_NO_ANCHOR, /* 467 */ YY_NO_ANCHOR, /* 468 */ YY_NO_ANCHOR, /* 469 */ YY_NO_ANCHOR, /* 470 */ YY_NO_ANCHOR, /* 471 */ YY_NO_ANCHOR, /* 472 */ YY_NO_ANCHOR, /* 473 */ YY_NO_ANCHOR, /* 474 */ YY_NO_ANCHOR, /* 475 */ YY_NO_ANCHOR, /* 476 */ YY_NO_ANCHOR, /* 477 */ YY_NO_ANCHOR, /* 478 */ YY_NO_ANCHOR, /* 479 */ YY_NO_ANCHOR, /* 480 */ YY_NO_ANCHOR, /* 481 */ YY_NO_ANCHOR, /* 482 */ YY_NO_ANCHOR, /* 483 */ YY_NO_ANCHOR, /* 484 */ YY_NO_ANCHOR, /* 485 */ YY_NO_ANCHOR, /* 486 */ YY_NO_ANCHOR, /* 487 */ YY_NO_ANCHOR, /* 488 */ YY_NO_ANCHOR, /* 489 */ YY_NO_ANCHOR, /* 490 */ YY_NO_ANCHOR, /* 491 */ YY_NO_ANCHOR, /* 492 */ YY_NO_ANCHOR, /* 493 */ YY_NO_ANCHOR }; private int yy_cmap[] = unpackFromString(1,130, "67:8,51:2,53,67:2,52,67:18,51,67,69,67:2,62,67,54,65,66,60,58,63,59,50,61,4" + "8:10,67,64,56,55,57,67:2,1,11,10,6,4,16,23,22,15,47,18,2,17,7,12,13,47,5,9," + "3,19,20,21,14,8,47,67,68,67:2,49,67,24,34,33,29,27,39,46,45,38,47,41,25,40," + "30,35,36,47,28,32,26,42,43,44,37,31,47,67:5,0:2")[0]; private int yy_rmap[] = unpackFromString(1,494, "0,1,2,3,1,4,1:2,5,6,1:9,7,8:2,9,8,10,11,8:2,12,8,13,1:4,8:9,14,8:13,15,8:4," + "16,8:3,17,8:10,18,8:69,19,1,20,1:4,21,22,16,23,24,25,26,27,28,29,30,31,32,3" + "3,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,5" + "8,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,8" + "3,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,1" + "06,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124," + "125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143" + ",144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,16" + "2,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,1" + "81,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199," + "200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218" + ",219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,23" + "7,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,2" + "56,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274," + "275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293" + ",294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,31" + "2,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,3" + "31,332,333,334,335,8,336,337,338,339,340,341,342,343,344,345,346,347,348,34" + "9,350,351,352,353,354,355,356,357")[0]; private int yy_nxt[][] = unpackFromString(358,70, "1,2,156,158,422,453,466,272,471,273,476,160,161,477,471,162,478,274,275,276" + ",479,480,481,482,163,483,164,484,485,486,277,471,278,487,165,166,488,471,16" + "7,489,279,280,281,490,491,492,493,471,3,-1,4,5,155,5,6,7,8,9,10,11,12,13,14" + ",15,16,17,18,-1:74,471,168,471:3,169,170,471,19,471:9,282,171,471:29,-1:68," + "3,-1,157,-1:70,5,-1,5,-1:71,32,-1,33,-1:67,34,-1:15,471:9,39,471:39,-1:21,4" + "71:49,-1:21,471:5,336,471:43,-1:21,471:2,44,471:2,339,471:2,340,429,471:39," + "-1:21,471:32,53,471:16,-1:21,471:28,354,471:20,-1:21,471:25,58,471:2,357,47" + "1:2,358,436,471:16,-1:21,471:11,71,471:37,-1:21,471:34,82,471:14,-1:68,63,-" + "1:22,471:4,447,471:44,-1:21,471:27,450,471:21,-1:21,148:51,-1:3,148:13,-1,1" + "48,-1:26,151,-1,152,-1,153,-1:38,154,-1:53,31,-1:17,471:14,283,471:34,-1:21" + ",284,471:3,285,471:6,20,471:37,-1:20,1,148:51,-1:2,149,148:13,150,148,-1,47" + "1:7,21,471:3,297,471:37,-1:21,471:4,22,471,23,471:5,424,471:36,-1:21,471:6," + "24,471:42,-1:21,471:24,179,471:3,180,181,471,25,471:9,306,182,471:6,-1:21,4" + "71:23,308,471:3,309,471:6,26,471:14,-1:21,471:30,27,471:3,321,471:14,-1:21," + "471:27,28,471,29,471:5,431,471:13,-1:21,471:29,30,471:19,-1:21,471,35,330,4" + "71:46,-1:21,471:5,36,471:43,-1:21,471:5,37,471,38,471:41,-1:21,471:22,40,47" + "1:26,-1:21,471:2,41,471:46,-1:21,471,472,42,471:46,-1:21,471:16,43,471:32,-" + "1:21,471:13,45,471:35,-1:21,471:6,46,471:42,-1:21,471:7,47,471:41,-1:21,471" + ":3,48,471:45,-1:21,471:24,49,348,471:23,-1:21,471:28,50,471:20,-1:21,471:28" + ",51,471,52,471:18,-1:21,471:45,54,471:3,-1:21,471:25,55,471:23,-1:21,471:24" + ",473,56,471:23,-1:21,471:39,57,471:9,-1:21,471:36,59,471:12,-1:21,471:29,60" + ",471:19,-1:21,471:30,61,471:18,-1:21,471:26,62,471:22,-1:21,471:11,64,471:3" + "7,-1:21,471:3,65,471:45,-1:21,471:3,66,471:45,-1:21,471:9,67,471:39,-1:21,4" + "71:12,68,471:36,-1:21,471,69,471:47,-1:21,471:4,70,471:44,-1:21,471:16,72,4" + "71:32,-1:21,471:20,73,471:28,-1:21,471:21,74,471:27,-1:21,471:34,75,471:14," + "-1:21,471:26,76,471:22,-1:21,471:26,77,471:22,-1:21,471:32,78,471:16,-1:21," + "471:35,79,471:13,-1:21,471:24,80,471:24,-1:21,471:27,81,471:21,-1:21,471:39" + ",83,471:9,-1:21,471:43,84,471:5,-1:21,471:44,85,471:4,-1:21,471:4,86,471:44" + ",-1:21,471:3,87,471:45,-1:21,471:2,88,471:46,-1:21,471:17,89,471:31,-1:21,4" + "71:4,90,471:44,-1:21,471:13,91,471:35,-1:21,471:3,92,471:45,-1:21,471:2,93," + "471:46,-1:21,471:6,94,471:42,-1:21,471:3,95,471:45,-1:21,471:2,96,471:46,-1" + ":21,471:12,97,471:36,-1:21,471:27,98,471:21,-1:21,471:26,99,471:22,-1:21,47" + "1:25,100,471:23,-1:21,471:40,101,471:8,-1:21,471:27,102,471:21,-1:21,471:36" + ",103,471:12,-1:21,471:26,104,471:22,-1:21,471:25,105,471:23,-1:21,471:29,10" + "6,471:19,-1:21,471:26,107,471:22,-1:21,471:25,108,471:23,-1:21,471:35,109,4" + "71:13,-1:21,471:3,110,471:45,-1:21,471:8,111,471:40,-1:21,471:3,112,471:45," + "-1:21,471:2,113,471:46,-1:21,471:3,114,471:45,-1:21,471:6,115,471:42,-1:21," + "471:2,116,471:46,-1:21,471:3,117,471:45,-1:21,471:8,118,471:40,-1:21,471:22" + ",119,471:26,-1:21,471:26,120,471:22,-1:21,471:31,121,471:17,-1:21,471:26,12" + "2,471:22,-1:21,471:25,123,471:23,-1:21,471:26,124,471:22,-1:21,471:29,125,4" + "71:19,-1:21,471:25,126,471:23,-1:21,471:26,127,471:22,-1:21,471:31,128,471:" + "17,-1:21,471:45,129,471:3,-1:21,471:2,130,471:46,-1:21,471:6,131,471:42,-1:" + "21,471:7,132,471:41,-1:21,471:6,133,471:42,-1:21,471:25,134,471:23,-1:21,47" + "1:29,135,471:19,-1:21,471:30,136,471:18,-1:21,471:29,137,471:19,-1:21,471:3" + ",138,471:45,-1:21,471:3,139,471:45,-1:21,471:2,140,471:46,-1:21,471:26,141," + "471:22,-1:21,471:26,142,471:22,-1:21,471:25,143,471:23,-1:21,471:2,144,471:" + "46,-1:21,471:25,145,471:23,-1:21,471:8,146,471:40,-1:21,471:31,147,471:17,-" + "1:21,471:11,172,471:6,293,471:30,-1:21,471:3,173,471:14,174,471:30,-1:21,17" + "5,471:13,176,471:34,-1:21,471:3,177,471:45,-1:21,471:6,454,471,178,471:3,30" + "1,471:36,-1:21,471:34,183,471:6,317,471:7,-1:21,471:26,184,471:14,185,471:7" + ",-1:21,471:23,186,471:13,187,471:11,-1:21,471:26,188,471:22,-1:21,471:29,45" + "7,471,189,471:3,325,471:13,-1:21,471:2,190,471:46,-1:21,471:17,191,471:31,-" + "1:21,471:10,331,471:38,-1:21,471:18,192,471:30,-1:21,471:9,332,471:39,-1:21" + ",471:14,425,471:34,-1:21,471:15,455,471:33,-1:21,471:2,437,471:46,-1:21,471" + ",467,471:6,193,471:6,460,471:33,-1:21,471:11,194,471:37,-1:21,471:8,333,471" + ":40,-1:21,471,195,471:47,-1:21,471:3,469,471:45,-1:21,471:18,334,471:30,-1:" + "21,196,471:2,335,471:45,-1:21,471:11,456,471:37,-1:21,471,341,471:47,-1:21," + "471:11,197,471:37,-1:21,471:4,439,471:44,-1:21,471:5,474,471:43,-1:21,471:3" + ",198,471:45,-1:21,471:2,199,471:46,-1:21,471:19,438,471:29,-1:21,346,471:10" + ",347,471:37,-1:21,471:25,200,471:23,-1:21,471:40,201,471:8,-1:21,471:33,349" + ",471:15,-1:21,471:41,202,471:7,-1:21,471:32,350,471:16,-1:21,471:37,432,471" + ":11,-1:21,471:38,458,471:10,-1:21,471:25,441,471:23,-1:21,471:24,468,471:6," + "203,471:6,463,471:10,-1:21,471:34,204,471:14,-1:21,471:31,351,471:17,-1:21," + "471:24,205,471:24,-1:21,471:26,470,471:22,-1:21,471:41,352,471:7,-1:21,471:" + "23,206,471:2,353,471:22,-1:21,471:34,459,471:14,-1:21,471:24,359,471:24,-1:" + "21,471:34,207,471:14,-1:21,471:27,443,471:21,-1:21,471:28,475,471:20,-1:21," + "471:26,208,471:22,-1:21,471:25,209,471:23,-1:21,471:42,442,471:6,-1:21,471:" + "23,364,471:10,365,471:14,-1:21,471:3,210,471:45,-1:21,471,211,471:47,-1:21," + "366,471:48,-1:21,471:2,461,471:46,-1:21,471:6,212,471:42,-1:21,471:9,213,47" + "1:39,-1:21,471:3,214,471:45,-1:21,471:14,373,471:34,-1:21,471:16,374,471:32" + ",-1:21,471:3,215,471:45,-1:21,471:3,375,471:45,-1:21,471:8,216,471:40,-1:21" + ",217,471:48,-1:21,471:11,218,471:37,-1:21,471:18,379,471:30,-1:21,471:4,219" + ",471:44,-1:21,471:6,220,471:42,-1:21,471:18,221,471:30,-1:21,471:26,222,471" + ":22,-1:21,471:24,223,471:24,-1:21,471:23,381,471:25,-1:21,471:25,464,471:23" + ",-1:21,471:29,224,471:19,-1:21,471:32,225,471:16,-1:21,471:26,226,471:22,-1" + ":21,471:37,388,471:11,-1:21,471:39,389,471:9,-1:21,471:26,227,471:22,-1:21," + "471:26,390,471:22,-1:21,471:31,228,471:17,-1:21,471:23,229,471:25,-1:21,471" + ":34,230,471:14,-1:21,471:41,394,471:7,-1:21,471:27,231,471:21,-1:21,471:29," + "232,471:19,-1:21,471:41,233,471:7,-1:21,471:12,234,471:36,-1:21,471:2,235,4" + "71:46,-1:21,471:4,446,471:44,-1:21,471:10,445,471:38,-1:21,471:2,236,471:46" + ",-1:21,471:9,237,471:39,-1:21,471:2,238,471:46,-1:21,471:11,239,471:37,-1:2" + "1,399,471:48,-1:21,471:4,240,471:44,-1:21,471:3,400,471:45,-1:21,471:14,401" + ",471:34,-1:21,471:2,241,471:46,-1:21,471:3,242,471:45,-1:21,471:6,243,471:4" + "2,-1:21,471:35,244,471:13,-1:21,471:25,245,471:23,-1:21,471:27,449,471:21,-" + "1:21,471:33,448,471:15,-1:21,471:25,246,471:23,-1:21,471:32,247,471:16,-1:2" + "1,471:25,248,471:23,-1:21,471:34,249,471:14,-1:21,471:23,405,471:25,-1:21,4" + "71:27,250,471:21,-1:21,471:26,406,471:22,-1:21,471:37,407,471:11,-1:21,471:" + "25,251,471:23,-1:21,471:26,252,471:22,-1:21,471:29,253,471:19,-1:21,471,254" + ",471:47,-1:21,471:6,410,471:42,-1:21,255,471:48,-1:21,471:4,256,471:44,-1:2" + "1,471:16,411,471:32,-1:21,471:22,257,471:26,-1:21,471:24,258,471:24,-1:21,4" + "71:29,414,471:19,-1:21,471:23,259,471:25,-1:21,471:27,260,471:21,-1:21,471:" + "39,415,471:9,-1:21,471:45,261,471:3,-1:21,471:8,262,471:40,-1:21,471:10,263" + ",471:38,-1:21,471:9,264,471:39,-1:21,471:3,417,471:45,-1:21,471:31,265,471:" + "17,-1:21,471:33,266,471:15,-1:21,471:32,267,471:16,-1:21,471:26,419,471:22," + "-1:21,471:9,420,471:39,-1:21,471:6,268,471:42,-1:21,471:32,421,471:16,-1:21" + ",471:29,269,471:19,-1:21,471:3,270,471:45,-1:21,471:26,271,471:22,-1:21,471" + ":8,286,471:4,287,471:35,-1:21,471:14,338,471:34,-1:21,471:2,337,471:46,-1:2" + "1,471:8,367,471:40,-1:21,471:3,345,471:45,-1:21,471:11,342,471:37,-1:21,471" + ",344,471:47,-1:21,471:4,376,471:44,-1:21,471:37,356,471:11,-1:21,471:25,355" + ",471:23,-1:21,471:31,382,471:17,-1:21,471:26,363,471:22,-1:21,471:34,360,47" + "1:14,-1:21,471:24,362,471:24,-1:21,471:27,391,471:21,-1:21,369,471:48,-1:21" + ",471:14,380,471:34,-1:21,471:3,377,471:45,-1:21,471:18,396,471:30,-1:21,471" + ":23,384,471:25,-1:21,471:37,395,471:11,-1:21,471:26,392,471:22,-1:21,471:41" + ",402,471:7,-1:21,408,471:48,-1:21,471:3,451,471:45,-1:21,471:14,409,471:34," + "-1:21,471:23,412,471:25,-1:21,471:26,452,471:22,-1:21,471:37,413,471:11,-1:" + "21,471:6,416,471:42,-1:21,471:29,418,471:19,-1:21,471:3,288,471:45,-1:21,47" + "1:14,343,471:34,-1:21,471:3,368,471:45,-1:21,471,462,471:47,-1:21,471:37,36" + "1,471:11,-1:21,471:26,383,471:22,-1:21,471:24,465,471:24,-1:21,440,471:48,-" + "1:21,471:14,397,471:34,-1:21,471:3,398,471:45,-1:21,471:23,444,471:25,-1:21" + ",471:37,403,471:11,-1:21,471:26,404,471:22,-1:21,289,471:2,290,291,471:9,29" + "2,471:34,-1:21,471:3,370,471:45,-1:21,471:26,385,471:22,-1:21,372,471:48,-1" + ":21,471:23,387,471:25,-1:21,471:3,371,471:45,-1:21,471:26,386,471:22,-1:21," + "378,471:48,-1:21,471:23,393,471:25,-1:21,471:4,294,471:6,295,471:9,296,471:" + "27,-1:21,471:4,423,471:44,-1:21,298,427,471:2,299,471:6,300,471:37,-1:21,42" + "8,471:13,302,471:34,-1:21,471:14,303,471:6,426,471:27,-1:21,304,471:48,-1:2" + "1,471:4,305,471:44,-1:21,471:37,307,471:11,-1:21,471:31,310,471:4,311,471:1" + "2,-1:21,471:26,312,471:22,-1:21,471:23,313,471:2,314,315,471:9,316,471:11,-" + "1:21,471:27,318,471:6,319,471:9,320,471:4,-1:21,471:27,430,471:21,-1:21,471" + ":23,322,434,471:2,323,471:6,324,471:14,-1:21,471:23,435,471:13,326,471:11,-" + "1:21,471:37,327,471:6,433,471:4,-1:21,471:23,328,471:25,-1:21,471:27,329,47" + "1:21,-1:20"); public java_cup.runtime.Symbol nextToken () throws java.io.IOException { int yy_lookahead; int yy_anchor = YY_NO_ANCHOR; int yy_state = yy_state_dtrans[yy_lexical_state]; int yy_next_state = YY_NO_STATE; int yy_last_accept_state = YY_NO_STATE; boolean yy_initial = true; int yy_this_accept; yy_mark_start(); yy_this_accept = yy_acpt[yy_state]; if (YY_NOT_ACCEPT != yy_this_accept) { yy_last_accept_state = yy_state; yy_mark_end(); } while (true) { if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL; else yy_lookahead = yy_advance(); yy_next_state = YY_F; yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]]; if (YY_EOF == yy_lookahead && true == yy_initial) { { if(yy_state ==STRING) return nextToken(sym.ERROR); else return nextToken(sym.EOF); } } if (YY_F != yy_next_state) { yy_state = yy_next_state; yy_initial = false; yy_this_accept = yy_acpt[yy_state]; if (YY_NOT_ACCEPT != yy_this_accept) { yy_last_accept_state = yy_state; yy_mark_end(); } } else { if (YY_NO_STATE == yy_last_accept_state) { throw (new Error("Lexical Error: Unmatched Input.")); } else { yy_anchor = yy_acpt[yy_last_accept_state]; if (0 != (YY_END & yy_anchor)) { yy_move_end(); } yy_to_mark(); switch (yy_last_accept_state) { case 1: case -2: break; case 2: { return nextToken(sym.NAME,yytext()); } case -3: break; case 3: { return nextToken(sym.INTVALUE,new Integer(yytext())); } case -4: break; case 4: { return nextToken(sym.DOT); } case -5: break; case 5: { } case -6: break; case 6: { string.setLength(0);yybegin(STRING); } case -7: break; case 7: { return nextToken(sym.EQ); } case -8: break; case 8: { return nextToken(sym.LT); } case -9: break; case 9: { return nextToken(sym.GT); } case -10: break; case 10: { return nextToken(sym.PLUS); } case -11: break; case 11: { return nextToken(sym.MINUS); } case -12: break; case 12: { return nextToken(sym.TIMES); } case -13: break; case 13: { return nextToken(sym.DIVIDE); } case -14: break; case 14: { return nextToken(sym.MOD); } case -15: break; case 15: { return nextToken(sym.COMMA); } case -16: break; case 16: { return nextToken(sym.SEMICOLON); } case -17: break; case 17: { return nextToken(sym.LPAREN); } case -18: break; case 18: { return nextToken(sym.RPAREN); } case -19: break; case 19: { return nextToken(sym.AS); } case -20: break; case 20: {return nextToken(sym.TO);} case -21: break; case 21: { return nextToken(sym.BY); } case -22: break; case 22: { return nextToken(sym.OR); } case -23: break; case 23: { return nextToken(sym.ON); } case -24: break; case 24: { return nextToken(sym.IN); } case -25: break; case 25: { return nextToken(sym.AS); } case -26: break; case 26: {return nextToken(sym.TO);} case -27: break; case 27: { return nextToken(sym.BY); } case -28: break; case 28: { return nextToken(sym.OR); } case -29: break; case 29: { return nextToken(sym.ON); } case -30: break; case 30: { return nextToken(sym.IN); } case -31: break; case 31: { } case -32: break; case 32: { return nextToken(sym.LE); } case -33: break; case 33: { return nextToken(sym.NEQ); } case -34: break; case 34: { return nextToken(sym.GE); } case -35: break; case 35: { return nextToken(sym.ALL); } case -36: break; case 36: { return nextToken(sym.ADD); } case -37: break; case 37: { return nextToken(sym.AND); } case -38: break; case 38: { return nextToken(sym.ANY); } case -39: break; case 39: { return nextToken(sym.ASC); } case -40: break; case 40: { return nextToken(sym.AVG); } case -41: break; case 41: { return nextToken(sym.NOT); } case -42: break; case 42: { return nextToken(sym.SET); } case -43: break; case 43: { return nextToken(sym.SUM); } case -44: break; case 44: { return nextToken(sym.INT); } case -45: break; case 45: { return nextToken(sym.MAX); } case -46: break; case 46: { return nextToken(sym.MIN); } case -47: break; case 47: { return nextToken(sym.KEY); } case -48: break; case 48: { return nextToken(sym.USE); } case -49: break; case 49: { return nextToken(sym.ALL); } case -50: break; case 50: { return nextToken(sym.ADD); } case -51: break; case 51: { return nextToken(sym.AND); } case -52: break; case 52: { return nextToken(sym.ANY); } case -53: break; case 53: { return nextToken(sym.ASC); } case -54: break; case 54: { return nextToken(sym.AVG); } case -55: break; case 55: { return nextToken(sym.NOT); } case -56: break; case 56: { return nextToken(sym.SET); } case -57: break; case 57: { return nextToken(sym.SUM); } case -58: break; case 58: { return nextToken(sym.INT); } case -59: break; case 59: { return nextToken(sym.MAX); } case -60: break; case 60: { return nextToken(sym.MIN); } case -61: break; case 61: { return nextToken(sym.KEY); } case -62: break; case 62: { return nextToken(sym.USE); } case -63: break; case 63: { return nextToken(sym.FLOATVALUE,Double.valueOf((yytext()))); } case -64: break; case 64: { return nextToken(sym.AUTO); } case -65: break; case 65: { return nextToken(sym.LIKE); } case -66: break; case 66: { return nextToken(sym.TRUE); } case -67: break; case 67: { return nextToken(sym.DESC); } case -68: break; case 68: { return nextToken(sym.DROP); } case -69: break; case 69: { return nextToken(sym.NULL); } case -70: break; case 70: { return nextToken(sym.CHAR); } case -71: break; case 71: { return nextToken(sym.INTO); } case -72: break; case 72: { return nextToken(sym.FROM); } case -73: break; case 73: { return nextToken(sym.VIEW); } case -74: break; case 74: {return nextToken(sym.WITH);} case -75: break; case 75: { return nextToken(sym.AUTO); } case -76: break; case 76: { return nextToken(sym.LIKE); } case -77: break; case 77: { return nextToken(sym.TRUE); } case -78: break; case 78: { return nextToken(sym.DESC); } case -79: break; case 79: { return nextToken(sym.DROP); } case -80: break; case 80: { return nextToken(sym.NULL); } case -81: break; case 81: { return nextToken(sym.CHAR); } case -82: break; case 82: { return nextToken(sym.INTO); } case -83: break; case 83: { return nextToken(sym.FROM); } case -84: break; case 84: { return nextToken(sym.VIEW); } case -85: break; case 85: {return nextToken(sym.WITH);} case -86: break; case 86: { return nextToken(sym.ALTER); } case -87: break; case 87: { return nextToken(sym.TABLE); } case -88: break; case 88: { return nextToken(sym.COUNT); } case -89: break; case 89: { return nextToken(sym.CHECK); } case -90: break; case 90: { return nextToken(sym.ORDER); } case -91: break; case 91: { return nextToken(sym.INDEX); } case -92: break; case 92: { return nextToken(sym.FALSE); } case -93: break; case 93: { return nextToken(sym.FLOAT); } case -94: break; case 94: { return nextToken(sym.UNION); } case -95: break; case 95: { return nextToken(sym.WHERE); } case -96: break; case 96: {return nextToken(sym.GRANT);} case -97: break; case 97: { return nextToken(sym.GROUP); } case -98: break; case 98: { return nextToken(sym.ALTER); } case -99: break; case 99: { return nextToken(sym.TABLE); } case -100: break; case 100: { return nextToken(sym.COUNT); } case -101: break; case 101: { return nextToken(sym.CHECK); } case -102: break; case 102: { return nextToken(sym.ORDER); } case -103: break; case 103: { return nextToken(sym.INDEX); } case -104: break; case 104: { return nextToken(sym.FALSE); } case -105: break; case 105: { return nextToken(sym.FLOAT); } case -106: break; case 106: { return nextToken(sym.UNION); } case -107: break; case 107: { return nextToken(sym.WHERE); } case -108: break; case 108: {return nextToken(sym.GRANT);} case -109: break; case 109: { return nextToken(sym.GROUP); } case -110: break; case 110: { return nextToken(sym.ESCAPE); } case -111: break; case 111: { return nextToken(sym.EXISTS); } case -112: break; case 112: { return nextToken(sym.DELETE); } case -113: break; case 113: { return nextToken(sym.SELECT); } case -114: break; case 114: { return nextToken(sym.CREATE); } case -115: break; case 115: {return nextToken(sym.OPTION);} case -116: break; case 116: { return nextToken(sym.INSERT); } case -117: break; case 117: { return nextToken(sym.UPDATE); } case -118: break; case 118: { return nextToken(sym.VALUES); } case -119: break; case 119: { return nextToken(sym.HAVING); } case -120: break; case 120: { return nextToken(sym.ESCAPE); } case -121: break; case 121: { return nextToken(sym.EXISTS); } case -122: break; case 122: { return nextToken(sym.DELETE); } case -123: break; case 123: { return nextToken(sym.SELECT); } case -124: break; case 124: { return nextToken(sym.CREATE); } case -125: break; case 125: {return nextToken(sym.OPTION);} case -126: break; case 126: { return nextToken(sym.INSERT); } case -127: break; case 127: { return nextToken(sym.UPDATE); } case -128: break; case 128: { return nextToken(sym.VALUES); } case -129: break; case 129: { return nextToken(sym.HAVING); } case -130: break; case 130: { return nextToken(sym.DEFAULT); } case -131: break; case 131: { return nextToken(sym.BOOLEAN); } case -132: break; case 132: { return nextToken(sym.PRIMARY); } case -133: break; case 133: {return nextToken(sym.FOREIGN);} case -134: break; case 134: { return nextToken(sym.DEFAULT); } case -135: break; case 135: { return nextToken(sym.BOOLEAN); } case -136: break; case 136: { return nextToken(sym.PRIMARY); } case -137: break; case 137: {return nextToken(sym.FOREIGN);} case -138: break; case 138: { return nextToken(sym.DATABASE); } case -139: break; case 139: {return nextToken(sym.DESCRIBE);} case -140: break; case 140: { return nextToken(sym.DISTINCT); } case -141: break; case 141: { return nextToken(sym.DATABASE); } case -142: break; case 142: {return nextToken(sym.DESCRIBE);} case -143: break; case 143: { return nextToken(sym.DISTINCT); } case -144: break; case 144: { return nextToken(sym.INCREMENT); } case -145: break; case 145: { return nextToken(sym.INCREMENT); } case -146: break; case 146: {return nextToken(sym.REFERENCES);} case -147: break; case 147: {return nextToken(sym.REFERENCES);} case -148: break; case 148: { string.append( yytext() ); } case -149: break; case 149: { yybegin(YYINITIAL); return nextToken(sym.STRING,string.toString());} case -150: break; case 150: { string.append('\\'); } case -151: break; case 151: { string.append('\t'); } case -152: break; case 152: { string.append('\r'); } case -153: break; case 153: { string.append('\n'); } case -154: break; case 154: { string.append('\"'); } case -155: break; case 156: { return nextToken(sym.NAME,yytext()); } case -156: break; case 158: { return nextToken(sym.NAME,yytext()); } case -157: break; case 160: { return nextToken(sym.NAME,yytext()); } case -158: break; case 161: { return nextToken(sym.NAME,yytext()); } case -159: break; case 162: { return nextToken(sym.NAME,yytext()); } case -160: break; case 163: { return nextToken(sym.NAME,yytext()); } case -161: break; case 164: { return nextToken(sym.NAME,yytext()); } case -162: break; case 165: { return nextToken(sym.NAME,yytext()); } case -163: break; case 166: { return nextToken(sym.NAME,yytext()); } case -164: break; case 167: { return nextToken(sym.NAME,yytext()); } case -165: break; case 168: { return nextToken(sym.NAME,yytext()); } case -166: break; case 169: { return nextToken(sym.NAME,yytext()); } case -167: break; case 170: { return nextToken(sym.NAME,yytext()); } case -168: break; case 171: { return nextToken(sym.NAME,yytext()); } case -169: break; case 172: { return nextToken(sym.NAME,yytext()); } case -170: break; case 173: { return nextToken(sym.NAME,yytext()); } case -171: break; case 174: { return nextToken(sym.NAME,yytext()); } case -172: break; case 175: { return nextToken(sym.NAME,yytext()); } case -173: break; case 176: { return nextToken(sym.NAME,yytext()); } case -174: break; case 177: { return nextToken(sym.NAME,yytext()); } case -175: break; case 178: { return nextToken(sym.NAME,yytext()); } case -176: break; case 179: { return nextToken(sym.NAME,yytext()); } case -177: break; case 180: { return nextToken(sym.NAME,yytext()); } case -178: break; case 181: { return nextToken(sym.NAME,yytext()); } case -179: break; case 182: { return nextToken(sym.NAME,yytext()); } case -180: break; case 183: { return nextToken(sym.NAME,yytext()); } case -181: break; case 184: { return nextToken(sym.NAME,yytext()); } case -182: break; case 185: { return nextToken(sym.NAME,yytext()); } case -183: break; case 186: { return nextToken(sym.NAME,yytext()); } case -184: break; case 187: { return nextToken(sym.NAME,yytext()); } case -185: break; case 188: { return nextToken(sym.NAME,yytext()); } case -186: break; case 189: { return nextToken(sym.NAME,yytext()); } case -187: break; case 190: { return nextToken(sym.NAME,yytext()); } case -188: break; case 191: { return nextToken(sym.NAME,yytext()); } case -189: break; case 192: { return nextToken(sym.NAME,yytext()); } case -190: break; case 193: { return nextToken(sym.NAME,yytext()); } case -191: break; case 194: { return nextToken(sym.NAME,yytext()); } case -192: break; case 195: { return nextToken(sym.NAME,yytext()); } case -193: break; case 196: { return nextToken(sym.NAME,yytext()); } case -194: break; case 197: { return nextToken(sym.NAME,yytext()); } case -195: break; case 198: { return nextToken(sym.NAME,yytext()); } case -196: break; case 199: { return nextToken(sym.NAME,yytext()); } case -197: break; case 200: { return nextToken(sym.NAME,yytext()); } case -198: break; case 201: { return nextToken(sym.NAME,yytext()); } case -199: break; case 202: { return nextToken(sym.NAME,yytext()); } case -200: break; case 203: { return nextToken(sym.NAME,yytext()); } case -201: break; case 204: { return nextToken(sym.NAME,yytext()); } case -202: break; case 205: { return nextToken(sym.NAME,yytext()); } case -203: break; case 206: { return nextToken(sym.NAME,yytext()); } case -204: break; case 207: { return nextToken(sym.NAME,yytext()); } case -205: break; case 208: { return nextToken(sym.NAME,yytext()); } case -206: break; case 209: { return nextToken(sym.NAME,yytext()); } case -207: break; case 210: { return nextToken(sym.NAME,yytext()); } case -208: break; case 211: { return nextToken(sym.NAME,yytext()); } case -209: break; case 212: { return nextToken(sym.NAME,yytext()); } case -210: break; case 213: { return nextToken(sym.NAME,yytext()); } case -211: break; case 214: { return nextToken(sym.NAME,yytext()); } case -212: break; case 215: { return nextToken(sym.NAME,yytext()); } case -213: break; case 216: { return nextToken(sym.NAME,yytext()); } case -214: break; case 217: { return nextToken(sym.NAME,yytext()); } case -215: break; case 218: { return nextToken(sym.NAME,yytext()); } case -216: break; case 219: { return nextToken(sym.NAME,yytext()); } case -217: break; case 220: { return nextToken(sym.NAME,yytext()); } case -218: break; case 221: { return nextToken(sym.NAME,yytext()); } case -219: break; case 222: { return nextToken(sym.NAME,yytext()); } case -220: break; case 223: { return nextToken(sym.NAME,yytext()); } case -221: break; case 224: { return nextToken(sym.NAME,yytext()); } case -222: break; case 225: { return nextToken(sym.NAME,yytext()); } case -223: break; case 226: { return nextToken(sym.NAME,yytext()); } case -224: break; case 227: { return nextToken(sym.NAME,yytext()); } case -225: break; case 228: { return nextToken(sym.NAME,yytext()); } case -226: break; case 229: { return nextToken(sym.NAME,yytext()); } case -227: break; case 230: { return nextToken(sym.NAME,yytext()); } case -228: break; case 231: { return nextToken(sym.NAME,yytext()); } case -229: break; case 232: { return nextToken(sym.NAME,yytext()); } case -230: break; case 233: { return nextToken(sym.NAME,yytext()); } case -231: break; case 234: { return nextToken(sym.NAME,yytext()); } case -232: break; case 235: { return nextToken(sym.NAME,yytext()); } case -233: break; case 236: { return nextToken(sym.NAME,yytext()); } case -234: break; case 237: { return nextToken(sym.NAME,yytext()); } case -235: break; case 238: { return nextToken(sym.NAME,yytext()); } case -236: break; case 239: { return nextToken(sym.NAME,yytext()); } case -237: break; case 240: { return nextToken(sym.NAME,yytext()); } case -238: break; case 241: { return nextToken(sym.NAME,yytext()); } case -239: break; case 242: { return nextToken(sym.NAME,yytext()); } case -240: break; case 243: { return nextToken(sym.NAME,yytext()); } case -241: break; case 244: { return nextToken(sym.NAME,yytext()); } case -242: break; case 245: { return nextToken(sym.NAME,yytext()); } case -243: break; case 246: { return nextToken(sym.NAME,yytext()); } case -244: break; case 247: { return nextToken(sym.NAME,yytext()); } case -245: break; case 248: { return nextToken(sym.NAME,yytext()); } case -246: break; case 249: { return nextToken(sym.NAME,yytext()); } case -247: break; case 250: { return nextToken(sym.NAME,yytext()); } case -248: break; case 251: { return nextToken(sym.NAME,yytext()); } case -249: break; case 252: { return nextToken(sym.NAME,yytext()); } case -250: break; case 253: { return nextToken(sym.NAME,yytext()); } case -251: break; case 254: { return nextToken(sym.NAME,yytext()); } case -252: break; case 255: { return nextToken(sym.NAME,yytext()); } case -253: break; case 256: { return nextToken(sym.NAME,yytext()); } case -254: break; case 257: { return nextToken(sym.NAME,yytext()); } case -255: break; case 258: { return nextToken(sym.NAME,yytext()); } case -256: break; case 259: { return nextToken(sym.NAME,yytext()); } case -257: break; case 260: { return nextToken(sym.NAME,yytext()); } case -258: break; case 261: { return nextToken(sym.NAME,yytext()); } case -259: break; case 262: { return nextToken(sym.NAME,yytext()); } case -260: break; case 263: { return nextToken(sym.NAME,yytext()); } case -261: break; case 264: { return nextToken(sym.NAME,yytext()); } case -262: break; case 265: { return nextToken(sym.NAME,yytext()); } case -263: break; case 266: { return nextToken(sym.NAME,yytext()); } case -264: break; case 267: { return nextToken(sym.NAME,yytext()); } case -265: break; case 268: { return nextToken(sym.NAME,yytext()); } case -266: break; case 269: { return nextToken(sym.NAME,yytext()); } case -267: break; case 270: { return nextToken(sym.NAME,yytext()); } case -268: break; case 271: { return nextToken(sym.NAME,yytext()); } case -269: break; case 272: { return nextToken(sym.NAME,yytext()); } case -270: break; case 273: { return nextToken(sym.NAME,yytext()); } case -271: break; case 274: { return nextToken(sym.NAME,yytext()); } case -272: break; case 275: { return nextToken(sym.NAME,yytext()); } case -273: break; case 276: { return nextToken(sym.NAME,yytext()); } case -274: break; case 277: { return nextToken(sym.NAME,yytext()); } case -275: break; case 278: { return nextToken(sym.NAME,yytext()); } case -276: break; case 279: { return nextToken(sym.NAME,yytext()); } case -277: break; case 280: { return nextToken(sym.NAME,yytext()); } case -278: break; case 281: { return nextToken(sym.NAME,yytext()); } case -279: break; case 282: { return nextToken(sym.NAME,yytext()); } case -280: break; case 283: { return nextToken(sym.NAME,yytext()); } case -281: break; case 284: { return nextToken(sym.NAME,yytext()); } case -282: break; case 285: { return nextToken(sym.NAME,yytext()); } case -283: break; case 286: { return nextToken(sym.NAME,yytext()); } case -284: break; case 287: { return nextToken(sym.NAME,yytext()); } case -285: break; case 288: { return nextToken(sym.NAME,yytext()); } case -286: break; case 289: { return nextToken(sym.NAME,yytext()); } case -287: break; case 290: { return nextToken(sym.NAME,yytext()); } case -288: break; case 291: { return nextToken(sym.NAME,yytext()); } case -289: break; case 292: { return nextToken(sym.NAME,yytext()); } case -290: break; case 293: { return nextToken(sym.NAME,yytext()); } case -291: break; case 294: { return nextToken(sym.NAME,yytext()); } case -292: break; case 295: { return nextToken(sym.NAME,yytext()); } case -293: break; case 296: { return nextToken(sym.NAME,yytext()); } case -294: break; case 297: { return nextToken(sym.NAME,yytext()); } case -295: break; case 298: { return nextToken(sym.NAME,yytext()); } case -296: break; case 299: { return nextToken(sym.NAME,yytext()); } case -297: break; case 300: { return nextToken(sym.NAME,yytext()); } case -298: break; case 301: { return nextToken(sym.NAME,yytext()); } case -299: break; case 302: { return nextToken(sym.NAME,yytext()); } case -300: break; case 303: { return nextToken(sym.NAME,yytext()); } case -301: break; case 304: { return nextToken(sym.NAME,yytext()); } case -302: break; case 305: { return nextToken(sym.NAME,yytext()); } case -303: break; case 306: { return nextToken(sym.NAME,yytext()); } case -304: break; case 307: { return nextToken(sym.NAME,yytext()); } case -305: break; case 308: { return nextToken(sym.NAME,yytext()); } case -306: break; case 309: { return nextToken(sym.NAME,yytext()); } case -307: break; case 310: { return nextToken(sym.NAME,yytext()); } case -308: break; case 311: { return nextToken(sym.NAME,yytext()); } case -309: break; case 312: { return nextToken(sym.NAME,yytext()); } case -310: break; case 313: { return nextToken(sym.NAME,yytext()); } case -311: break; case 314: { return nextToken(sym.NAME,yytext()); } case -312: break; case 315: { return nextToken(sym.NAME,yytext()); } case -313: break; case 316: { return nextToken(sym.NAME,yytext()); } case -314: break; case 317: { return nextToken(sym.NAME,yytext()); } case -315: break; case 318: { return nextToken(sym.NAME,yytext()); } case -316: break; case 319: { return nextToken(sym.NAME,yytext()); } case -317: break; case 320: { return nextToken(sym.NAME,yytext()); } case -318: break; case 321: { return nextToken(sym.NAME,yytext()); } case -319: break; case 322: { return nextToken(sym.NAME,yytext()); } case -320: break; case 323: { return nextToken(sym.NAME,yytext()); } case -321: break; case 324: { return nextToken(sym.NAME,yytext()); } case -322: break; case 325: { return nextToken(sym.NAME,yytext()); } case -323: break; case 326: { return nextToken(sym.NAME,yytext()); } case -324: break; case 327: { return nextToken(sym.NAME,yytext()); } case -325: break; case 328: { return nextToken(sym.NAME,yytext()); } case -326: break; case 329: { return nextToken(sym.NAME,yytext()); } case -327: break; case 330: { return nextToken(sym.NAME,yytext()); } case -328: break; case 331: { return nextToken(sym.NAME,yytext()); } case -329: break; case 332: { return nextToken(sym.NAME,yytext()); } case -330: break; case 333: { return nextToken(sym.NAME,yytext()); } case -331: break; case 334: { return nextToken(sym.NAME,yytext()); } case -332: break; case 335: { return nextToken(sym.NAME,yytext()); } case -333: break; case 336: { return nextToken(sym.NAME,yytext()); } case -334: break; case 337: { return nextToken(sym.NAME,yytext()); } case -335: break; case 338: { return nextToken(sym.NAME,yytext()); } case -336: break; case 339: { return nextToken(sym.NAME,yytext()); } case -337: break; case 340: { return nextToken(sym.NAME,yytext()); } case -338: break; case 341: { return nextToken(sym.NAME,yytext()); } case -339: break; case 342: { return nextToken(sym.NAME,yytext()); } case -340: break; case 343: { return nextToken(sym.NAME,yytext()); } case -341: break; case 344: { return nextToken(sym.NAME,yytext()); } case -342: break; case 345: { return nextToken(sym.NAME,yytext()); } case -343: break; case 346: { return nextToken(sym.NAME,yytext()); } case -344: break; case 347: { return nextToken(sym.NAME,yytext()); } case -345: break; case 348: { return nextToken(sym.NAME,yytext()); } case -346: break; case 349: { return nextToken(sym.NAME,yytext()); } case -347: break; case 350: { return nextToken(sym.NAME,yytext()); } case -348: break; case 351: { return nextToken(sym.NAME,yytext()); } case -349: break; case 352: { return nextToken(sym.NAME,yytext()); } case -350: break; case 353: { return nextToken(sym.NAME,yytext()); } case -351: break; case 354: { return nextToken(sym.NAME,yytext()); } case -352: break; case 355: { return nextToken(sym.NAME,yytext()); } case -353: break; case 356: { return nextToken(sym.NAME,yytext()); } case -354: break; case 357: { return nextToken(sym.NAME,yytext()); } case -355: break; case 358: { return nextToken(sym.NAME,yytext()); } case -356: break; case 359: { return nextToken(sym.NAME,yytext()); } case -357: break; case 360: { return nextToken(sym.NAME,yytext()); } case -358: break; case 361: { return nextToken(sym.NAME,yytext()); } case -359: break; case 362: { return nextToken(sym.NAME,yytext()); } case -360: break; case 363: { return nextToken(sym.NAME,yytext()); } case -361: break; case 364: { return nextToken(sym.NAME,yytext()); } case -362: break; case 365: { return nextToken(sym.NAME,yytext()); } case -363: break; case 366: { return nextToken(sym.NAME,yytext()); } case -364: break; case 367: { return nextToken(sym.NAME,yytext()); } case -365: break; case 368: { return nextToken(sym.NAME,yytext()); } case -366: break; case 369: { return nextToken(sym.NAME,yytext()); } case -367: break; case 370: { return nextToken(sym.NAME,yytext()); } case -368: break; case 371: { return nextToken(sym.NAME,yytext()); } case -369: break; case 372: { return nextToken(sym.NAME,yytext()); } case -370: break; case 373: { return nextToken(sym.NAME,yytext()); } case -371: break; case 374: { return nextToken(sym.NAME,yytext()); } case -372: break; case 375: { return nextToken(sym.NAME,yytext()); } case -373: break; case 376: { return nextToken(sym.NAME,yytext()); } case -374: break; case 377: { return nextToken(sym.NAME,yytext()); } case -375: break; case 378: { return nextToken(sym.NAME,yytext()); } case -376: break; case 379: { return nextToken(sym.NAME,yytext()); } case -377: break; case 380: { return nextToken(sym.NAME,yytext()); } case -378: break; case 381: { return nextToken(sym.NAME,yytext()); } case -379: break; case 382: { return nextToken(sym.NAME,yytext()); } case -380: break; case 383: { return nextToken(sym.NAME,yytext()); } case -381: break; case 384: { return nextToken(sym.NAME,yytext()); } case -382: break; case 385: { return nextToken(sym.NAME,yytext()); } case -383: break; case 386: { return nextToken(sym.NAME,yytext()); } case -384: break; case 387: { return nextToken(sym.NAME,yytext()); } case -385: break; case 388: { return nextToken(sym.NAME,yytext()); } case -386: break; case 389: { return nextToken(sym.NAME,yytext()); } case -387: break; case 390: { return nextToken(sym.NAME,yytext()); } case -388: break; case 391: { return nextToken(sym.NAME,yytext()); } case -389: break; case 392: { return nextToken(sym.NAME,yytext()); } case -390: break; case 393: { return nextToken(sym.NAME,yytext()); } case -391: break; case 394: { return nextToken(sym.NAME,yytext()); } case -392: break; case 395: { return nextToken(sym.NAME,yytext()); } case -393: break; case 396: { return nextToken(sym.NAME,yytext()); } case -394: break; case 397: { return nextToken(sym.NAME,yytext()); } case -395: break; case 398: { return nextToken(sym.NAME,yytext()); } case -396: break; case 399: { return nextToken(sym.NAME,yytext()); } case -397: break; case 400: { return nextToken(sym.NAME,yytext()); } case -398: break; case 401: { return nextToken(sym.NAME,yytext()); } case -399: break; case 402: { return nextToken(sym.NAME,yytext()); } case -400: break; case 403: { return nextToken(sym.NAME,yytext()); } case -401: break; case 404: { return nextToken(sym.NAME,yytext()); } case -402: break; case 405: { return nextToken(sym.NAME,yytext()); } case -403: break; case 406: { return nextToken(sym.NAME,yytext()); } case -404: break; case 407: { return nextToken(sym.NAME,yytext()); } case -405: break; case 408: { return nextToken(sym.NAME,yytext()); } case -406: break; case 409: { return nextToken(sym.NAME,yytext()); } case -407: break; case 410: { return nextToken(sym.NAME,yytext()); } case -408: break; case 411: { return nextToken(sym.NAME,yytext()); } case -409: break; case 412: { return nextToken(sym.NAME,yytext()); } case -410: break; case 413: { return nextToken(sym.NAME,yytext()); } case -411: break; case 414: { return nextToken(sym.NAME,yytext()); } case -412: break; case 415: { return nextToken(sym.NAME,yytext()); } case -413: break; case 416: { return nextToken(sym.NAME,yytext()); } case -414: break; case 417: { return nextToken(sym.NAME,yytext()); } case -415: break; case 418: { return nextToken(sym.NAME,yytext()); } case -416: break; case 419: { return nextToken(sym.NAME,yytext()); } case -417: break; case 420: { return nextToken(sym.NAME,yytext()); } case -418: break; case 421: { return nextToken(sym.NAME,yytext()); } case -419: break; case 422: { return nextToken(sym.NAME,yytext()); } case -420: break; case 423: { return nextToken(sym.NAME,yytext()); } case -421: break; case 424: { return nextToken(sym.NAME,yytext()); } case -422: break; case 425: { return nextToken(sym.NAME,yytext()); } case -423: break; case 426: { return nextToken(sym.NAME,yytext()); } case -424: break; case 427: { return nextToken(sym.NAME,yytext()); } case -425: break; case 428: { return nextToken(sym.NAME,yytext()); } case -426: break; case 429: { return nextToken(sym.NAME,yytext()); } case -427: break; case 430: { return nextToken(sym.NAME,yytext()); } case -428: break; case 431: { return nextToken(sym.NAME,yytext()); } case -429: break; case 432: { return nextToken(sym.NAME,yytext()); } case -430: break; case 433: { return nextToken(sym.NAME,yytext()); } case -431: break; case 434: { return nextToken(sym.NAME,yytext()); } case -432: break; case 435: { return nextToken(sym.NAME,yytext()); } case -433: break; case 436: { return nextToken(sym.NAME,yytext()); } case -434: break; case 437: { return nextToken(sym.NAME,yytext()); } case -435: break; case 438: { return nextToken(sym.NAME,yytext()); } case -436: break; case 439: { return nextToken(sym.NAME,yytext()); } case -437: break; case 440: { return nextToken(sym.NAME,yytext()); } case -438: break; case 441: { return nextToken(sym.NAME,yytext()); } case -439: break; case 442: { return nextToken(sym.NAME,yytext()); } case -440: break; case 443: { return nextToken(sym.NAME,yytext()); } case -441: break; case 444: { return nextToken(sym.NAME,yytext()); } case -442: break; case 445: { return nextToken(sym.NAME,yytext()); } case -443: break; case 446: { return nextToken(sym.NAME,yytext()); } case -444: break; case 447: { return nextToken(sym.NAME,yytext()); } case -445: break; case 448: { return nextToken(sym.NAME,yytext()); } case -446: break; case 449: { return nextToken(sym.NAME,yytext()); } case -447: break; case 450: { return nextToken(sym.NAME,yytext()); } case -448: break; case 451: { return nextToken(sym.NAME,yytext()); } case -449: break; case 452: { return nextToken(sym.NAME,yytext()); } case -450: break; case 453: { return nextToken(sym.NAME,yytext()); } case -451: break; case 454: { return nextToken(sym.NAME,yytext()); } case -452: break; case 455: { return nextToken(sym.NAME,yytext()); } case -453: break; case 456: { return nextToken(sym.NAME,yytext()); } case -454: break; case 457: { return nextToken(sym.NAME,yytext()); } case -455: break; case 458: { return nextToken(sym.NAME,yytext()); } case -456: break; case 459: { return nextToken(sym.NAME,yytext()); } case -457: break; case 460: { return nextToken(sym.NAME,yytext()); } case -458: break; case 461: { return nextToken(sym.NAME,yytext()); } case -459: break; case 462: { return nextToken(sym.NAME,yytext()); } case -460: break; case 463: { return nextToken(sym.NAME,yytext()); } case -461: break; case 464: { return nextToken(sym.NAME,yytext()); } case -462: break; case 465: { return nextToken(sym.NAME,yytext()); } case -463: break; case 466: { return nextToken(sym.NAME,yytext()); } case -464: break; case 467: { return nextToken(sym.NAME,yytext()); } case -465: break; case 468: { return nextToken(sym.NAME,yytext()); } case -466: break; case 469: { return nextToken(sym.NAME,yytext()); } case -467: break; case 470: { return nextToken(sym.NAME,yytext()); } case -468: break; case 471: { return nextToken(sym.NAME,yytext()); } case -469: break; case 472: { return nextToken(sym.NAME,yytext()); } case -470: break; case 473: { return nextToken(sym.NAME,yytext()); } case -471: break; case 474: { return nextToken(sym.NAME,yytext()); } case -472: break; case 475: { return nextToken(sym.NAME,yytext()); } case -473: break; case 476: { return nextToken(sym.NAME,yytext()); } case -474: break; case 477: { return nextToken(sym.NAME,yytext()); } case -475: break; case 478: { return nextToken(sym.NAME,yytext()); } case -476: break; case 479: { return nextToken(sym.NAME,yytext()); } case -477: break; case 480: { return nextToken(sym.NAME,yytext()); } case -478: break; case 481: { return nextToken(sym.NAME,yytext()); } case -479: break; case 482: { return nextToken(sym.NAME,yytext()); } case -480: break; case 483: { return nextToken(sym.NAME,yytext()); } case -481: break; case 484: { return nextToken(sym.NAME,yytext()); } case -482: break; case 485: { return nextToken(sym.NAME,yytext()); } case -483: break; case 486: { return nextToken(sym.NAME,yytext()); } case -484: break; case 487: { return nextToken(sym.NAME,yytext()); } case -485: break; case 488: { return nextToken(sym.NAME,yytext()); } case -486: break; case 489: { return nextToken(sym.NAME,yytext()); } case -487: break; case 490: { return nextToken(sym.NAME,yytext()); } case -488: break; case 491: { return nextToken(sym.NAME,yytext()); } case -489: break; case 492: { return nextToken(sym.NAME,yytext()); } case -490: break; case 493: { return nextToken(sym.NAME,yytext()); } case -491: break; default: yy_error(YY_E_INTERNAL,false); case -1: } yy_initial = true; yy_state = yy_state_dtrans[yy_lexical_state]; yy_next_state = YY_NO_STATE; yy_last_accept_state = YY_NO_STATE; yy_mark_start(); yy_this_accept = yy_acpt[yy_state]; if (YY_NOT_ACCEPT != yy_this_accept) { yy_last_accept_state = yy_state; yy_mark_end(); } } } } } }
true
6763c6525609d83976ea71a7f70689ea82e444bc
Java
calculon102/breakout-clone
/src/de/pixelgerecht/breakout/subject/ScoreText.java
UTF-8
1,192
2.4375
2
[]
no_license
package de.pixelgerecht.breakout.subject; import static de.pixelgerecht.breakout.config.BreakoutConfigs.HUD_FONT_NAME; import static de.pixelgerecht.breakout.config.BreakoutConfigs.HUD_FONT_SIZE; import static de.pixelgerecht.breakout.config.BreakoutConfigs.HUD_SCORE_COLOR; import static de.pixelgerecht.breakout.config.BreakoutConfigs.HUD_SCORE_ID; import static de.pixelgerecht.breakout.config.BreakoutConfigs.HUD_SCORE_POSITION; import de.pixelgerecht.breakout.session.Session; import de.pixelgerecht.gameengine.representation.Layer; import de.pixelgerecht.gameengine.representation.Text; import de.pixelgerecht.gameengine.representation.TextAlign; import de.pixelgerecht.gameengine.subjects.GameEntity; public interface ScoreText extends BreakoutSubject { static ScoreText newInstance(Layer forLayer, Session session) { final Text scoreText = Text.of(HUD_FONT_NAME, HUD_FONT_SIZE, HUD_SCORE_COLOR, TextAlign.RIGHT, "Score: " + session.score()); session.setOnScoreChange((prev, now) -> scoreText.setContent("Score: " + now)); final GameEntity scoreEntity = GameEntity.simple(HUD_SCORE_ID, forLayer, HUD_SCORE_POSITION, scoreText); return new ScoreTextImpl(scoreEntity); } }
true
a88ad5c7081895d87d4cb87eeb632be6bb8b51a3
Java
mrmattherndon/Project2
/Geo/src/Group.java
UTF-8
1,261
3.671875
4
[]
no_license
/** *This class abstracts a "group" into an object that is capable of accepting an arbitrary number of Info objects as constructor arguments. * </P> * @version 1.0 */ public class Group { /* *An instance variable of Group, is an array of Info of arbitrary length*/ private Info[] Info; /* *Another instance variable of Group, useful for identifying what kind of group a particular Group object is representing*/ protected String groupingName; public Group(Info[] Info,String groupingName) { } /** * Retrieves the Info object corresponding to the "id" given. * @param A char, the id of the data to grab * @return A String object containing the data member asked for. */ public String getSpecificInfo(char id){ return null; } /** * Builds an infoObject based on the parameters passed to it. * @param The data as a String, the id of the object type to be created. * @return A specific CountryInfo object. */ public static Info buildInfoObject(String data,char id){ return null; } /** * Builds a formatted string representation of the object. Useful for debugging. * @param No parameters. * @return A formatted string object of all the data members. */ public String getString(){ return null; } }
true
786a2a0f155386bcd92663b09d9d46962e1edae2
Java
Davey1-2/BasicArena-main
/src/main/java/cz/educanet/arena/data/GladiatorDatabase.java
UTF-8
1,438
3.109375
3
[ "MIT" ]
permissive
package cz.educanet.arena.data; import cz.educanet.arena.logic.Gladiator; import java.io.*; /** * Utils class that saves and loads gladiators. */ public class GladiatorDatabase { /** * @param filename path to the gladiator file. * @return loaded Gladiator */ public static Gladiator loadGladiator(String filename) { Gladiator gladiator = new Gladiator(); try { BufferedReader br = new BufferedReader(new FileReader(filename)); gladiator.setName(br.readLine().split(">")[1]); gladiator.setHp(Integer.parseInt(br.readLine().split(">")[1])); br.close(); } catch (IOException e) { e.printStackTrace(); } return gladiator; } /** * Saves the gladiator. * @param filename path to save too. * @param gladiator Gladiator to save. */ public static void saveGladiator(String filename, Gladiator gladiator) { try { BufferedWriter bw = new BufferedWriter(new FileWriter(filename)); bw.write("jmeno gladiatora >" + gladiator.getName() ); bw.newLine(); bw.write("zivoty gladiatora >" + gladiator.getHp() ); bw.newLine(); bw.write("damage > random every round "); bw.newLine(); bw.close(); } catch (IOException e) { e.printStackTrace(); } } }
true
4dbff98d0dc4e0da34c320d2639ac45ce4d44185
Java
Jiganesh/Java
/Learning Java/Reduce.java
UTF-8
208
2.921875
3
[]
no_license
import java.util.stream.IntStream; public class Reduce{ public static void main(String[] args) { int [] x = {1,2,3,4,5}; System.out.println(IntStream.of(x).reduce(0,(a,b)-> a+b)); } }
true
9394eaa1497f70788e68dca7beeb76188215aca9
Java
ChiRains/forest
/orderform/orderform-component/src/main/java/com/qcloud/component/orderform/service/RefundOrderService.java
UTF-8
780
1.882813
2
[]
no_license
package com.qcloud.component.orderform.service; import java.util.List; import com.qcloud.component.orderform.model.RefundOrder; import com.qcloud.component.orderform.model.query.RefundOrderQuery; import com.qcloud.pirates.data.Page; public interface RefundOrderService { public boolean add(RefundOrder refundOrder); public RefundOrder get(Long id); public boolean delete(Long id); public boolean update(RefundOrder refundOrder); boolean update(Long id, int state); public Page<RefundOrder> page(RefundOrderQuery query, int start, int count); public List<RefundOrder> listAll(); public List<RefundOrder> listBySubOrder(Long subOrderId); List<RefundOrder> list4ExpireState(int state, int start, int size); }
true
c7cdb09b82c7429c316505256048ff3405bcc34f
Java
aolarte/test-harness
/java/lang/src/main/java/com/andresolarte/harness/lang/algo/BinarySearchTree.java
UTF-8
5,096
3.53125
4
[]
no_license
package com.andresolarte.harness.lang.algo; import java.util.Arrays; public class BinarySearchTree { class Node { final int data; Node left; Node right; public Node(int data) { this.data = data; left = null; right = null; } } public Node root; public BinarySearchTree() { this.root = null; } public boolean find(int id) { return findNode(id) != null; } public Node[] findNode(int id) { Node currentNode = null; Node nextNode = root; while (nextNode != null) { if (nextNode.data == id) { return Arrays.asList(currentNode, nextNode).toArray(new Node[2]); } if (nextNode.data > id) { currentNode = nextNode; nextNode = nextNode.left; } else { currentNode = nextNode; nextNode = nextNode.right; } } return null; } public boolean delete(int id) { Node[] node = findNode(id); Node parent = node[0]; Node nodeToDelete = node[1]; if (nodeToDelete.left == null && nodeToDelete.right == null) { //Leaf node if (parent.left == nodeToDelete) { parent.left = null; } else { parent.right = null; } } else if (nodeToDelete.left == null || nodeToDelete.right == null) { //One child, graft child onto parent if (parent.left == nodeToDelete) { parent.left = nodeToDelete.left != null ? nodeToDelete.left : nodeToDelete.right; } else { parent.right = nodeToDelete.left != null ? nodeToDelete.left : nodeToDelete.right; } } else { //Two children //Successor is the node which will replace the deleted node. //Successor is the smaller node in the right sub tree of the node to be deleted. Node successor = getSuccessor(nodeToDelete); if (nodeToDelete == root) { root = successor; } else if (parent.left == nodeToDelete) { parent.left = successor; } else { parent.right = successor; } successor.left = nodeToDelete.left; } return false; } public void insert(int id) { if (root == null) { root = new Node(id); } else { Node currentNode = root; boolean done = false; while (!done) { if (currentNode.data > id) { //go left if (currentNode.left == null) { currentNode.left = new Node(id); done = true; } else { currentNode = currentNode.left; } } else { //go right if (currentNode.right == null) { currentNode.right = new Node(id); done = true; } else { currentNode = currentNode.right; } } } } } public Node getSuccessor(Node deleleNode) { Node successsor = null; Node successsorParent = null; Node current = deleleNode.right; while (current != null) { successsorParent = successsor; successsor = current; current = current.left; } //check if successor has the right child, it cannot have left child for sure // if it does have the right child, add it to the left of successorParent. if (successsor != deleleNode.right) { successsorParent.left = successsor.right; successsor.right = deleleNode.right; } return successsor; } public void display() { if (root != null) { System.out.print("[ "); display(root); System.out.println(" ]"); } } public void display(Node root) { if (root != null) { display(root.left); System.out.print(" " + root.data); display(root.right); } } public static void main(String arg[]) { BinarySearchTree b = new BinarySearchTree(); verify(b.find(5) == false); b.insert(5); verify(b.find(5) == true); b.insert(3); verify(b.find(3) == true); b.display(); b.insert(4); b.display(); b.insert(6); b.insert(9); b.display(); b.delete(6); b.display(); b.insert(8); b.insert(15); b.insert(12); b.insert(16); b.display(); b.delete(9); b.display(); } private static void verify(boolean condition) { if (!condition) { throw new RuntimeException(); } } }
true
8e0ee24acd51d91a3d86c8a07997aaf840d5e06d
Java
sanseongKo/codingtest
/src/baekjun/Joseputh.java
UTF-8
547
2.796875
3
[]
no_license
package baekjun; import java.util.LinkedList; import java.util.Queue; public class Joseputh { public static void main(String[] args) { } public static int[] solution(int n, int m) { int[] result = new int[m]; Queue<Integer> que = new LinkedList<Integer>(); int l = 1; int k = 0; int tmp = 0; for(int i = 1 ; i<=m ; i++) { que.add(i); } while(que.size() != 0) { if(l == n) { result[k] = que.poll(); k++; l = 1; }else { tmp = que.poll(); que.add(tmp); l++; } } return result; } }
true
eb2de57f9d5bf24a1d632d6ff6e839d7cb6aaef8
Java
liyunlog0621/Spring
/batch/src/main/java/com/lyl/batch/restart/RestartReader.java
UTF-8
5,262
2.46875
2
[]
no_license
//package com.lyl.batch.restart; // //import com.lyl.batch.model.City; //import org.springframework.batch.item.ExecutionContext; //import org.springframework.batch.item.ItemStreamException; //import org.springframework.batch.item.ItemStreamReader; //import org.springframework.batch.item.NonTransientResourceException; //import org.springframework.batch.item.ParseException; //import org.springframework.batch.item.UnexpectedInputException; //import org.springframework.batch.item.file.FlatFileItemReader; //import org.springframework.batch.item.file.mapping.DefaultLineMapper; //import org.springframework.batch.item.file.mapping.FieldSetMapper; //import org.springframework.batch.item.file.transform.DelimitedLineTokenizer; //import org.springframework.batch.item.file.transform.FieldSet; //import org.springframework.core.io.ClassPathResource; //import org.springframework.lang.Nullable; //import org.springframework.stereotype.Component; //import org.springframework.validation.BindException; // ///** // * Date:2018/12/17 0017 下午 3:22 // * // * @author :liyunlong // * @Description: // * @UpdateDate: 2018/12/17 0017 下午 3:22 // */ //@Component //public class RestartReader implements ItemStreamReader<City> { // /** // * 文件读取 // */ // private FlatFileItemReader<City> reader = new FlatFileItemReader<>(); // /** // * 当前读到第几行 // */ // private Long curLine = 0L; // /** // * // */ // private Boolean restart = false; // /** // * 执行的上下文 来向数据库中执行数据 // */ // private ExecutionContext executionContext; // // /** // * 读取/写入数据的规则 // * // * @return // * @throws Exception // * @throws UnexpectedInputException // * @throws ParseException // * @throws NonTransientResourceException // */ // // public RestartReader() { // reader.setResource(new ClassPathResource("error.txt")); // // DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); // tokenizer.setNames("id", "name", "countryCode", "district", "population"); // //解析后的数据映射为对象 // DefaultLineMapper<City> mapper = new DefaultLineMapper<>(); // mapper.setLineTokenizer(tokenizer); // // mapper.setFieldSetMapper(new FieldSetMapper<City>() { // @Override // public City mapFieldSet(FieldSet fieldSet) throws BindException { // City city = new City(); // city.setCountryCode(fieldSet.readString("countryCode")); // city.setDistrict(fieldSet.readString("district")); // city.setId(fieldSet.readInt("id")); // city.setName(fieldSet.readString("name")); // city.setPopulation(fieldSet.readLong("population")); // return city; // } // }); // mapper.afterPropertiesSet(); // reader.setLineMapper(mapper); // // } // // @Nullable // @Override // public City read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { // // City city = null; // this.curLine++; // if (restart) { // //如果是重启(出现错误之后),则从chunk记录开始读取 // reader.setLinesToSkip(this.curLine.intValue() - 1); // //将重启值置为false,否则将会重复读取 // restart = false; // System.out.println("Start reading from line: " + this.curLine); // } // reader.open(this.executionContext); // city = reader.read(); // if (city != null && this.curLine == 3) { // throw new RuntimeException("Something Wrong!"); // } // return city; // } // // /** // * 在开始读取之前调用 // */ // @Override // public void open(ExecutionContext executionContext) throws ItemStreamException { // // 获取当前执行上下文 // this.executionContext = executionContext; // if (executionContext.containsKey("curLine")) { // // 如果执行上下文存在 cutLine,则证明执行为 重启后执行 // this.curLine = executionContext.getLong("curLine"); // // 将重启值置为 true // this.restart = true; // } else { // // 第一次执行,向执行上下文中打入 curLine 记录(会记录进数据库) // this.curLine = 0L; // executionContext.put("curLine", 0L); // System.out.println("Start reading from line: " + (this.curLine + 1)); // } // } // // // /** // * update:在chunk后执行,用于修改数据库中对ExecutionContext的记录 // * // * @param executionContext // * @throws ItemStreamException // */ // @Override // public void update(ExecutionContext executionContext) throws ItemStreamException { // executionContext.put("curLine", this.curLine); // System.out.println("Reading line: " + (this.curLine + 1)); // } // // /** // * 读取/写入 结束后执行 // * // * @throws ItemStreamException // */ // @Override // public void close() throws ItemStreamException { // // } //}
true
7b8a2d085d588b0bb599c9abfd26a64879af0d29
Java
LosMoros/JavaRepo
/minitest/src/test/java/minitest/FizzBuzzTest.java
UTF-8
1,322
2.90625
3
[]
no_license
package minitest; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; public class FizzBuzzTest { FizzBuzz testObject; @Before public void setUp() throws Exception { testObject = new FizzBuzz(); } @After public void tearDown() throws Exception { } //test number is divisible by 3 @Test public final void testMyFizzBuzz1Case1() { System.out.println("3:" + testObject.myFizzBuzz1(3)); assertEquals(testObject.myFizzBuzz1(3), "Fizz"); } //test number is divisible by 5 @Test public final void testMyFizzBuzz1Case2() { System.out.println("5:" + testObject.myFizzBuzz1(5)); assertEquals(testObject.myFizzBuzz1(5), "Buzz"); } //test number is divisible by 3 and 5 @Test public final void testMyFizzBuzz1Case4() { System.out.println("15:" + testObject.myFizzBuzz1(15)); assertEquals(testObject.myFizzBuzz1(15), "FizzBuzz"); } //test minus number, border test @Test public final void testMyFizzBuzz1Case5() { System.out.println("-1:" + testObject.myFizzBuzz1(-1)); assertEquals(testObject.myFizzBuzz1(-1), "-1"); } //test number 0, exception test @Test public final void testMyFizzBuzz1Case6() { System.out.println("0:" + testObject.myFizzBuzz1(0)); assertEquals(testObject.myFizzBuzz1(0), "FizzBuzz"); } }
true
37b39fbd375c13e209d6cb8230b99b42b9cdaeb8
Java
wangsiyue/HR
/src/main/java/com/yc/biz/impl/ConfigPublicCharBizImpl.java
UTF-8
2,159
2
2
[]
no_license
package com.yc.biz.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.yc.bean.ConfigFileFirstKind; import com.yc.bean.ConfigFileSecondKind; import com.yc.bean.ConfigFileThirdKind; import com.yc.bean.ConfigPublicChar; import com.yc.biz.ConfigFileFirstKindBiz; import com.yc.biz.ConfigFileSecondKindBiz; import com.yc.biz.ConfigFileThirdKindBiz; import com.yc.biz.ConfigPublicCharBiz; import com.yc.dao.BasicMybatisDao; @Service public class ConfigPublicCharBizImpl implements ConfigPublicCharBiz { private BasicMybatisDao basicMybatisDao; @Resource(name="basicMybatisDaoImpl") public void setBasicMybatisDao(BasicMybatisDao basicMybatisDao) { this.basicMybatisDao = basicMybatisDao; } //查询方法 public List find() { return this.basicMybatisDao.select(new ConfigPublicChar(), "findAll"); } //查看所有公共字段 @Override public List findAllProfession() { return this.basicMybatisDao.select(new ConfigPublicChar(), "findAllProfession"); } //添加公共字段 @Override public Integer addConfigPublicChar(ConfigPublicChar configPublicChar) { return this.basicMybatisDao.insert(configPublicChar, "addConfigPublicChar"); } //添加薪酬项目 @Override public Integer addSalaryProject(ConfigPublicChar configPublicChar) { return this.basicMybatisDao.insert(configPublicChar, "addSalaryProject"); } //修改薪酬项目 @Override public Integer updSalaryProjectById(ConfigPublicChar configPublicChar) { return this.basicMybatisDao.update(configPublicChar, "updSalaryProjectById"); } @Override public Integer delSalaryProjectById(ConfigPublicChar configPublicChar) { return this.basicMybatisDao.delete(configPublicChar, "delSalaryProjectById"); } ////////////// @Override public List<ConfigPublicChar> findAllByattribute_kind() { return this.basicMybatisDao.select(new ConfigPublicChar(), "findAllByattribute_kind"); } @Override public List<ConfigPublicChar> findAllGrade() { return this.basicMybatisDao.select(new ConfigPublicChar(), "findAllGrade"); } }
true
2147f95ec1c22e80e39ea19923675e2b0559d751
Java
caoshen/bluetooth
/speex/src/main/java/io/github/caoshen/speex/Speex.java
UTF-8
430
2.21875
2
[]
no_license
package io.github.caoshen.speex; /** * @author caoshen * @date 2020/11/20 */ public class Speex { static { System.loadLibrary("speex"); } public native int open(int compression); public native int getFrameSize(); public native int decode(byte[] encoded, short lin[], int size); public native int encode(short lin[], int offset, byte[] encoded, int size); public native void close(); }
true
9830ee4b15d1796e677261d9770084ae418e4fd5
Java
dujuejue/leetcodeAnswer
/src/code/Test187.java
UTF-8
609
3.0625
3
[]
no_license
package code; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Test187 { public List<String> findRepeatedDnaSequences(String s) { List<String> result = new ArrayList<>(); Set<String> set1 = new HashSet<>(); Set<String> set2 = new HashSet<>(); for (int i = 0; i < s.length() - 9; i++) { if (!set1.add(s.substring(i,i+10))){ set2.add(s.substring(i,i+10)); } } for (String s1 : set2) { result.add(s1); } return result; } }
true
493b46acabe9b8ce28659abb5ae860aac2259c92
Java
Rishabh8721/vaccine-check
/app/src/main/java/com/floplabs/vaccinecheck/model/CowinData.java
UTF-8
513
2.359375
2
[]
no_license
package com.floplabs.vaccinecheck.model; import java.util.List; public class CowinData { private List<Center> centers; public CowinData(List<Center> centers) { this.centers = centers; } public List<Center> getCenters() { return centers; } public void setCenters(List<Center> centers) { this.centers = centers; } @Override public String toString() { return "CowinData{" + "centers=" + centers + '}'; } }
true
347391ebf9aaa9ec9bc24fa20621c719a7975b5d
Java
tobasschu/bucketservice
/src/test/java/de/tschumacher/bucketservice/service/S3ServiceTest.java
UTF-8
1,952
1.820313
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2017 Tobias Schumacher * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package de.tschumacher.bucketservice.service; import static org.junit.Assert.assertNotNull; import org.junit.Before; import org.junit.Test; import de.tschumacher.bucketservice.service.download.S3DownloadService; import de.tschumacher.bucketservice.service.information.S3InformationService; import de.tschumacher.bucketservice.service.modification.S3ModificationService; import de.tschumacher.bucketservice.service.upload.S3UploadService; public class S3ServiceTest extends CommonS3ServiceTest { private S3Service service = null; @Override @Before public void setUp() { super.setUp(); this.service = new DefaultS3Service(this.amazonS3, this.bucketName); } @Test public void downloadServiceTest() { final S3DownloadService downloadService = this.service.downloadService(); assertNotNull(downloadService); } @Test public void informationServiceTest() { final S3InformationService informationService = this.service.informationService(); assertNotNull(informationService); } @Test public void modificationServiceTest() { final S3ModificationService modificationService = this.service.modificationService(); assertNotNull(modificationService); } @Test public void uploadServiceTest() { final S3UploadService uploadService = this.service.uploadService(); assertNotNull(uploadService); } }
true
6138f31769fbcf1ca88938660c8a776f90e1dc3a
Java
wwkjddyh/oa
/platform/src/main/java/com/oa/platform/web/handler/GlobalExceptionHandler.java
UTF-8
1,952
2.46875
2
[]
no_license
package com.oa.platform.web.handler; import com.oa.platform.biz.FileBiz; import com.oa.platform.common.StatusCode; import com.oa.platform.exception.PlatformException; import com.oa.platform.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ui.Model; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; import java.util.Map; /** * RestController 增强器(主要处理全局异常) */ @Slf4j @RestControllerAdvice public class GlobalExceptionHandler { private final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); /** * 应用到所有@RequestMapping注解方法,在其执行之前初始化数据绑定器 * @param binder */ @InitBinder public void initBinder(WebDataBinder binder) { log.info("binder.getFieldDefaultPrefix {}" , binder.getFieldDefaultPrefix()); log.info("binder.getFieldMarkerPrefix {}", binder.getFieldMarkerPrefix()); } /** * 把值绑定到Model中,使全局@RequestMapping可以获取到该值 * @param model */ @ModelAttribute public void addAttributes(Model model) { //model.addAttribute("ProjectName", "InsectControl"); //model.addAttribute("ProjectBuilder", "Feng Jianbo"); } /** * 全局异常捕捉处理 * @param throwable 异常 * @return */ @ExceptionHandler(value = Exception.class) @ResponseBody public Map<String, Object> errorException(Throwable throwable) { log.error("API 异常抛出:{} ", throwable); String throwMessage = throwable.getMessage(); if (throwable instanceof PlatformException) { throwMessage = ((PlatformException)throwable).getMessage(); } return StringUtil.getResultVo(StatusCode.INTERNAL_SERVER_ERROR, "INTERNAL_SERVER_ERROR", throwMessage); } }
true
4a59b7fb39389ff62316a12406ba55acfa571d5a
Java
LiewJunTung/Travel-Companion
/app/src/main/java/com/liewjuntung/travelcompanion/models/pixabay/PixabayResult.java
UTF-8
581
2.265625
2
[]
no_license
package com.liewjuntung.travelcompanion.models.pixabay; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Popular Movie App * Created by jtlie on 9/16/2016. */ public class PixabayResult { @SerializedName("total") private int total; @SerializedName("totalHits") private int totalHits; @SerializedName("hits") private List<Hit> hits; public int getTotal() { return total; } public int getTotalHits() { return totalHits; } public List<Hit> getHits() { return hits; } }
true
9cc74aef2e86e9a70f62f65147b8906a3882a167
Java
qianghuanbaby/chart-room2
/src/main/java/com/qh/client/entity/User.java
UTF-8
319
1.734375
2
[]
no_license
package com.qh.client.entity; import lombok.Data; import java.util.Set; /** * Author:qh * Created:2019/8/24 * 实体类,用户操作的 */ @Data public class User { private Integer id; private String userName; private String password; private String brief; private Set<String> userNames; }
true
87d27b1336e872ff20c689840b46127c2d6db1b3
Java
capSAR273/kiji-enron-emails
/mr/src/main/java/org/kiji/enronemail/produce/SentimentProducer.java
UTF-8
3,871
2
2
[]
no_license
/** * (c) Copyright 2013 WibiData, Inc. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * 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.kiji.enronemail.produce; import java.io.IOException; import java.util.Map; import org.apache.avro.Schema; import org.apache.hadoop.fs.Path; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.kiji.mapreduce.KijiContext; import org.kiji.mapreduce.kvstore.KeyValueStore; import org.kiji.mapreduce.kvstore.KeyValueStoreReader; import org.kiji.mapreduce.kvstore.RequiredStores; import org.kiji.mapreduce.kvstore.lib.TextFileKeyValueStore; import org.kiji.mapreduce.produce.KijiProducer; import org.kiji.mapreduce.produce.ProducerContext; import org.kiji.schema.KijiColumnName; import org.kiji.schema.KijiDataRequest; import org.kiji.schema.KijiDataRequestBuilder; import org.kiji.schema.KijiRowData; /** * This producer copies data from the column "family:qualifier" to the column * "family:outputqualifier" without modification, assuming both are encoded as bytes. */ public class SentimentProducer extends KijiProducer { private static final Logger LOG = LoggerFactory.getLogger(SentimentProducer.class); private KijiColumnName mInputColumn = new KijiColumnName("info:body"); private KijiColumnName mOutputColumn = new KijiColumnName("features:sentiment"); private Schema schema = Schema.create(Schema.Type.FLOAT); /** * {@inheritDoc} */ @Override public void setup(KijiContext context) { } @Override public Map<String, KeyValueStore<?, ?>> getRequiredStores() { // Note that it's ok to specify a path to an HDFS dir, not just one file. return RequiredStores.just("sentiment", TextFileKeyValueStore.builder() .withDelimiter("\t") .withInputPath(new Path("/tmp/AFINN-111.txt")) .withDistributedCache(false) .build()); } /** * {@inheritDoc} */ @Override public KijiDataRequest getDataRequest() { KijiDataRequestBuilder builder = KijiDataRequest.builder(); builder.newColumnsDef().withMaxVersions(Integer.MAX_VALUE) .add(mInputColumn.getFamily(), mInputColumn.getQualifier()); return builder.build(); } /** * {@inheritDoc} */ @Override public String getOutputColumn() { return mOutputColumn.toString(); } /** * {@inheritDoc} */ @Override public void produce(KijiRowData input, ProducerContext context) throws IOException { KeyValueStoreReader<String, String> sentimentStore = context.getStore("sentiment"); String body = input.getMostRecentValue(mInputColumn.getFamily(), mInputColumn.getQualifier()).toString(); // replace all non word characters with spaces body = body.replaceAll("\\W", " "); body = body.toLowerCase(); String[] words = body.split(" "); float score = 0.0f; float numWords = 0.0f; for (String word : words) { word = word.trim(); if (sentimentStore.containsKey(word)) { numWords++; score += Float.valueOf(sentimentStore.get(word)); } } long timestamp = System.currentTimeMillis(); if (numWords > 0) { score = score / numWords; context.put(timestamp, score); } else { context.put(timestamp, 0.0f); } } public static void main(String[] args) { } }
true
2cc53d19e1946876f485dea12eef79b85d0e6c73
Java
StoyanZhulev/SoftUni
/Java/Java Fundamentals/JavaOOP Advanced/Exercises/Ex05_Reflection/src/Pr03_BarracksWars/core/CommandInterpreter.java
UTF-8
1,149
2.9375
3
[]
no_license
package Pr03_BarracksWars.core; import Pr03_BarracksWars.contracts.Executable; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class CommandInterpreter implements Pr03_BarracksWars.contracts.CommandInterpreter{ private static final String COMMAND_PACKAGE = "Pr03_BarracksWars.core.commands."; private static final String COMMANDNAME_SUFFIX = "Command"; public CommandInterpreter() { } @Override @SuppressWarnings("unchecked") public Executable interpretCommand(Object data, String commandName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { char cmdFirstLetter = commandName.toUpperCase().charAt(0); Class<Executable> cmdClass = (Class<Executable>) Class.forName(COMMAND_PACKAGE + cmdFirstLetter + commandName.substring(1) + COMMANDNAME_SUFFIX); Constructor<Executable> constructor = cmdClass.getDeclaredConstructor(String[].class); constructor.setAccessible(true); return constructor.newInstance(data); } }
true
18e230b21266e1047e653584ebb422a1e0f52d40
Java
elrimo/ServeurPFE
/src/main/java/com/pfe/localisation/service/PointAccesService.java
UTF-8
361
1.65625
2
[]
no_license
package com.pfe.localisation.service; import java.util.List; import com.pfe.localisation.object.Pointacces; public interface PointAccesService { void ajoutAP(Pointacces pa); Pointacces findAPById(int id); List<Pointacces> findAllAP(); void updateAP(Pointacces etage); void deleteAP(Pointacces etage); Pointacces findByAdresseMac(String adressemac); }
true
8510a923aa2a6d5e382154cbd88cd0635773a9c5
Java
yllture/sharing_gradle
/bloggertest/.svn/pristine/f7/f76449bc60793fca2ffa96a234cc38d3544fa4ec.svn-base
UTF-8
4,094
2.09375
2
[]
no_license
//package com.neuedu.controller; // //import com.paypal.api.payments.Links; //import com.paypal.api.payments.Payment; //import com.paypal.base.rest.PayPalRESTException; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.stereotype.Controller; //import org.springframework.ui.Model; //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMethod; //import org.springframework.web.bind.annotation.RequestParam; //import com.neuedu.config.PaypalPaymentIntent; //import com.neuedu.config.PaypalPaymentMethod; //import com.neuedu.entity.User; //import com.neuedu.service.PaypalService; //import com.neuedu.service.UserService; //import com.neuedu.Utils.URLUtils; // //import javax.annotation.Resource; //import javax.servlet.http.HttpServletRequest; // //@Controller //@RequestMapping(value = "paypal") //public class PaypalController { // // @Autowired // UserService userservice; // // @Resource // private PaypalService paypalService; // public static final String PAYPAL_SUCCESS_URL = "paypal/pay/success"; // public static final String PAYPAL_CANCEL_URL = "palpal/pay/cancel"; // // private Logger log = LoggerFactory.getLogger(PaypalController.class); // //// @RequestMapping(method = RequestMethod.GET) //// public String index(){ //// return "pay"; //// } //// method = RequestMethod.POST, // @RequestMapping("/pay") // public String pay(@RequestParam("userid") int userid, // @RequestParam("type") int type, // HttpServletRequest request){ // // String cancelUrl = URLUtils.getBaseURl(request) + "/" + PAYPAL_CANCEL_URL; // String successUrl = URLUtils.getBaseURl(request) + "/" + PAYPAL_SUCCESS_URL+"?userid="+userid+"&type="+type; // double price = 0; // if(type==1)price=10.00; // if(type==2)price=19.80; // if(type==3)price=49.00; // if(type==4)price=98.00; // try { // Payment payment = paypalService.createPayment( // price, // "USD", // PaypalPaymentMethod.paypal, // PaypalPaymentIntent.sale, // "payment description", // cancelUrl, // successUrl); // for(Links links : payment.getLinks()){ // if(links.getRel().equals("approval_url")){ // return "redirect:" + links.getHref(); // } // } // } catch (PayPalRESTException e) { // log.error(e.getMessage()); // } // return "redirect:/"; // } // // @RequestMapping( "/pay/cancel") // public String cancelPay(){ // log.info("cancle"); // return "cancel"; // } // // @RequestMapping("/pay/success") // public String successPay(@RequestParam("userid") int payerId,@RequestParam("type") int type,Model model){ // //@RequestParam("paymentId") String paymentId, // int integral=0; // if(type==1)integral=100; // if(type==2)integral=200; // if(type==3)integral=500; // if(type==4)integral=1000; // User user=new User(); // user.setUserid(payerId); // User reuser =userservice.selectUserByPrimaryKey(user); // reuser.setIntegral(reuser.getIntegral()+integral); // int retu = userservice.updateUserSelective(reuser); //// try { //// Payment payment = paypalService.executePayment(paymentId, payerId); //// if(payment.getState().equals("approved")){ //// return "success"; //// } //// } catch (PayPalRESTException e) { //// log.error(e.getMessage()); //// } // model.addAttribute("currentuser", reuser); // return "shopmarket/publishbankrecord"; // } // // // // @RequestMapping(value = "topay") // public String topay(){ // // return "pay"; // } // // // //}
true
71fa22a28c8024b75e77e625eb9466a9b1ae5bbe
Java
Tencent/bk-base
/src/datahub/cache/base/src/main/java/com/tencent/bk/base/datahub/cache/CacheUtils.java
UTF-8
4,245
2.265625
2
[ "MIT" ]
permissive
/* * Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. * * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. * * BK-BASE 蓝鲸基础平台 is licensed under the MIT License. * * License for BK-BASE 蓝鲸基础平台: * -------------------------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.tencent.bk.base.datahub.cache; import com.tencent.bk.base.datahub.databus.commons.utils.LogUtils; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.HashSet; import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class CacheUtils { private static final Logger log = LoggerFactory.getLogger(CacheUtils.class); private static final String PATTERN = "^((0|1\\d?\\d?|2[0-4]?\\d?|25[0-5]?|[3-9]\\d?)\\.){3}(0|1\\d?\\d?|2[0-4]?\\d?|25[0-5]?|[3-9]\\d?)$"; static { // JVM会缓存DNS的解析,默认是永久,这里调整为60s,一定程度上规避dns对应的服务器发生变化 System.setProperty("sun.net.inetaddr.ttl", "60"); } /** * 将字符串解析为int类型返回,发生异常时,返回默认值 * * @param strVal 字符串 * @param defaultVal 默认值 * @return int */ public static int parseInt(String strVal, int defaultVal) { try { return Integer.parseInt(strVal); } catch (Exception ignore) { LogUtils.warn(log, "unable to parse string value to int: " + strVal); } return defaultVal; } /** * 将字符串解析为long类型返回,发生异常时,返回默认值 * * @param strVal 字符串 * @param defaultVal 默认值 * @return long */ public static long parseLong(String strVal, long defaultVal) { try { return Long.parseLong(strVal); } catch (Exception ignore) { LogUtils.warn(log, "unable to parse string value to long: " + strVal); } return defaultVal; } /** * 将指定的主机列表(可能包含域名)解析为主机的IP集合。 将域名对应的IP地址加入到集合中。 * * @param hosts 主机列表,逗号分隔,可能包含域名。 * @return 主机列表解析出来的IP地址集合。 */ public static Set<String> parseHosts(String hosts) { Set<String> hostSet = new HashSet<>(); for (String host : StringUtils.split(hosts, ",")) { if (PATTERN.matches(host)) { hostSet.add(host); } else { try { // 将解析出的所有ip地址添加到集合中 for (InetAddress addr : InetAddress.getAllByName(host)) { hostSet.add(addr.getHostAddress()); } } catch (UnknownHostException ignore) { LogUtils.warn(log, "failed to resolve host {} to ip", host); break; } } } return hostSet; } }
true
27c5cc712c78e1bd120f682b9e38f2d2605516c5
Java
tumastic/mytest
/hm62_mybatis_class1_tp1/src/main/java/com/itheima/dao/UserDAO.java
UTF-8
289
1.921875
2
[]
no_license
package com.itheima.dao; import com.itheima.entity.UserInfo; import java.util.List; /** * 数据层接口 */ public interface UserDAO { /** * 查询所有的方法 * @return * @throws Exception */ public List<UserInfo> findAllUsers()throws Exception; }
true
920a2e53ee6b8309a0961c7778d333cef9dcb092
Java
veerwang/javatest
/9_file_dir/FileOperation.java
UTF-8
972
2.859375
3
[]
no_license
import java.io.*; import java.io.OutputStreamWriter; public class FileOperation { static String Version = "V1.00"; public static void Create_File(String filename) { File file = new File(filename); if ( file.exists() ) { file.delete(); } else { try { file.createNewFile(); } catch ( Exception e ) { e.printStackTrace(); } } } public static void main (String[] argv) { System.out.println("System Version: "+Version); Create_File("firstboot"); File file = new File("landi-properties"); if ( file.exists() ) { file.delete(); System.out.println("delete file OK"); } else { try { file.createNewFile(); OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream("test"),"GBK"); String v = new String("time_zone = Asian/Shanghai".getBytes(),"GBK"); System.out.println(v); out.write(v); out.flush(); out.close(); } catch ( Exception e ) { e.printStackTrace(); } } } }
true
b31f0719938e126741664ddc3889c58bf1645872
Java
CHINA-LOONG/ElinDriverSchool
/app/src/main/java/com/elin/elindriverschool/activity/StuForOrderActivity.java
UTF-8
14,037
1.773438
2
[]
no_license
package com.elin.elindriverschool.activity; import android.app.DatePickerDialog; import android.content.DialogInterface; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AlertDialog; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.DatePicker; import android.widget.ImageView; import android.widget.TextView; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.listener.OnItemChildClickListener; import com.elin.elindriverschool.R; import com.elin.elindriverschool.adapter.BusRideAdapter; import com.elin.elindriverschool.adapter.StuForOrderAdapter; import com.elin.elindriverschool.application.BaseApplication; import com.elin.elindriverschool.decoration.DividerItemDecoration; import com.elin.elindriverschool.model.BusRideBean; import com.elin.elindriverschool.model.BusStuBean; import com.elin.elindriverschool.model.Constant; import com.elin.elindriverschool.model.MyDriveStudentBean; import com.elin.elindriverschool.model.StuForOrderBean; import com.elin.elindriverschool.model.TestSiteBean; import com.elin.elindriverschool.util.MobilePhoneUtils; import com.elin.elindriverschool.util.MyOkHttpClient; import com.elin.elindriverschool.util.ToastUtils; import com.google.gson.Gson; import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import static com.elin.elindriverschool.activity.MyDriveStudentActivity.MEDIA_TYPE_JSON; import static com.elin.elindriverschool.fragment.FragmentMsg.MEDIA_TYPE_MARKDOWN; public class StuForOrderActivity extends BaseActivity implements SwipeRefreshLayout.OnRefreshListener, BaseQuickAdapter.RequestLoadMoreListener{ @Bind(R.id.imv_cus_title_back) ImageView imvCusTitleBack; @Bind(R.id.tv_cus_title_name) TextView tvCusTitleName; @Bind(R.id.tv_cus_title_right) TextView tvCusTitleRight; @Bind(R.id.tv_test_date) TextView tvTestDate; @Bind(R.id.tv_examination_room) TextView tvExaminationRoom; @Bind(R.id.tv_test_person_sub) TextView tvTestPersonSub; @Bind(R.id.tv_test_person_query) TextView tvTestPersonQuery; @Bind(R.id.rv_test_person) RecyclerView rvTestPerson; @Bind(R.id.srl_test_person) SwipeRefreshLayout srlTestPerson; private Map<String, String> parmasMap = new HashMap<>(); private String responseJson; private String busDate;//班车乘坐日期 private int sub = 0;//科目 private Gson gson = new Gson(); private StuForOrderAdapter adapter; private List<StuForOrderBean.DataBean> data_list = new ArrayList<>(); private String[] subArray; private String orderSite;//考试场地 private int yearT,monthT,dayT;//今天的时间 private String testSiteJson; private TestSiteBean testSiteBean; private String[] testSites; private String orderSub = 0+""; private int pageNum = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_stu_for_order); ButterKnife.bind(this); tvCusTitleName.setText("驾考学员统计"); adapter = new StuForOrderAdapter(data_list,this); adapter.openLoadAnimation(); adapter.setOnLoadMoreListener(this); srlTestPerson.setOnRefreshListener(this); srlTestPerson.setColorSchemeResources(android.R.color.holo_red_light); rvTestPerson.setLayoutManager(new LinearLayoutManager(this)); rvTestPerson.setAdapter(adapter); rvTestPerson.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST)); subArray = getResources().getStringArray(R.array.sub); adapter.setEmptyView(R.layout.layout_bg_nodata,rvTestPerson); loadData(pageNum+""); rvTestPerson.addOnItemTouchListener(new OnItemChildClickListener() { @Override public void onSimpleItemChildClick(BaseQuickAdapter adapter, View view, int position) { StuForOrderBean.DataBean bean = (StuForOrderBean.DataBean) adapter.getItem(position); MobilePhoneUtils.makeCall(bean.getStu_phone(), bean.getOrder_name(), StuForOrderActivity.this); } }); } @OnClick({R.id.imv_cus_title_back, R.id.tv_test_date, R.id.tv_examination_room, R.id.tv_test_person_sub, R.id.tv_test_person_query}) public void onClick(View view) { switch (view.getId()) { case R.id.imv_cus_title_back: finish(); break; case R.id.tv_test_date: Calendar cal = Calendar.getInstance(); yearT = cal.get(Calendar.YEAR); monthT = cal.get(Calendar.MONTH); dayT = cal.get(Calendar.DATE); DatePickerDialog startDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { if(monthOfYear<9&&dayOfMonth<10){ busDate = year + "-0" + (monthOfYear + 1) + "-0" + dayOfMonth; }else if(monthOfYear<9){ busDate = year + "-0" + (monthOfYear + 1) + "-" + dayOfMonth; }else if(dayOfMonth<10){ busDate = year + "-" + (monthOfYear + 1) + "-0" + dayOfMonth; }else { busDate = year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; } tvTestDate.setText(busDate); } },yearT,monthT,dayT); DatePicker startDialogDatePicker = startDialog.getDatePicker(); try { startDialogDatePicker.setMinDate(new Date().getTime()); } catch (Exception e) { e.printStackTrace(); } startDialog.show(); break; case R.id.tv_examination_room: getTestSites(); break; case R.id.tv_test_person_sub: getTestSub(); break; case R.id.tv_test_person_query: onRefresh(); break; } } //获取考试科目 private void getTestSub() { final String[] subArray = getResources().getStringArray(R.array.sub); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("选择考试科目") .setItems(subArray, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { tvTestPersonSub.setText(subArray[i]); orderSub = i+""; } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }) .create().show(); } private void loadData(String num) { srlTestPerson.setRefreshing(true); parmasMap.put("token", BaseApplication.getInstance().getToken()); parmasMap.put("order_date", busDate); parmasMap.put("order_sub", orderSub); parmasMap.put("pageno", num); parmasMap.put("pagesize", "20"); parmasMap.put("self_flag", "1"); parmasMap.put("order_site",orderSite); Request request = new Request.Builder() .url(Constant.ServerURL + Constant.GET_STU_FOR_ORDER) .post(RequestBody.create(MEDIA_TYPE_MARKDOWN, new Gson().toJson(parmasMap))) .build(); Call call = new MyOkHttpClient(this).newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { mHandler.sendEmptyMessage(3); } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()) { responseJson = String.valueOf(response.body().string()); mHandler.sendEmptyMessage(2); call.cancel(); } } }); } //获取考试场地 private void getTestSites() { Map<String, String> map = new HashMap<>(); map.put("school_id", BaseApplication.getInstance().getSchoolId()); Request request = new Request.Builder() .url(Constant.ServerURL + Constant.GET_TEST_SITES) .post(RequestBody.create(MEDIA_TYPE_JSON, new Gson().toJson(map))) .build(); Call call = new MyOkHttpClient(this).newCall(request); call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { mHandler.sendEmptyMessage(3); } @Override public void onResponse(Call call, Response response) throws IOException { testSiteJson = String.valueOf(response.body().string()); mHandler.sendEmptyMessage(1); call.cancel(); } }); } private Handler mHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); if(srlTestPerson!=null&&srlTestPerson.isRefreshing()){ srlTestPerson.setRefreshing(false); } switch (msg.what){ case 1: testSiteBean = gson.fromJson(testSiteJson, TestSiteBean.class); testSites = new String[testSiteBean.getData_list().size()]; for (int i = 0; i < testSiteBean.getData_list().size(); i++) { testSites[i] = testSiteBean.getData_list().get(i).getExam_site(); } AlertDialog.Builder builder = new AlertDialog.Builder(StuForOrderActivity.this); builder.setTitle("选择考试场地") .setItems(testSites, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { tvExaminationRoom.setText(testSiteBean.getData_list().get(i).getExam_site()); orderSite = testSiteBean.getData_list().get(i).getExam_site(); } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { orderSite = ""; tvExaminationRoom.setText("选择场地"); dialogInterface.dismiss(); } }) .create().show(); break; case 2: if (responseJson != null) { StuForOrderBean bean = gson.fromJson(responseJson, StuForOrderBean.class); if (TextUtils.equals("0",bean.getRc())) { data_list = bean.getData(); if (data_list != null && data_list.size() != 0) { if (pageNum == 1) { adapter.setNewData(data_list); } else { adapter.addData(data_list); } adapter.loadMoreComplete(); } else { if (pageNum == 1) { adapter.setNewData(data_list); adapter.loadMoreEnd(true); } else { adapter.loadMoreEnd(false); } } } else { adapter.loadMoreEnd(true); } } break; case 3: ToastUtils.ToastMessage(StuForOrderActivity.this, "获取失败,请重试"); break; } } }; @Override public void onRefresh() { pageNum = 1; adapter.setEnableLoadMore(false); loadData(pageNum+""); adapter.removeAllFooterView(); } @Override public void onLoadMoreRequested() { pageNum++; loadData(pageNum+""); } }
true
2102f2b098506c066ee8c4a1d19b165c6fe5b72d
Java
weichk/yiji-sdk
/openapi-sdk-message/src/main/java/com/yiji/openapi/message/common/cashier/UnionCashierWebPayRequest.java
UTF-8
1,705
1.9375
2
[]
no_license
package com.yiji.openapi.message.common.cashier; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.Length; import com.yiji.openapi.message.common.cashier.info.ProdDetailInfo; import com.yiji.openapi.sdk.common.annotation.OpenApiField; import com.yiji.openapi.sdk.common.annotation.OpenApiMessage; import com.yiji.openapi.sdk.common.enums.ApiMessageType; import com.yiji.openapi.sdk.common.message.ApiRequest; @OpenApiMessage(service = "unionCashierWebPay", type = ApiMessageType.Request) public class UnionCashierWebPayRequest extends ApiRequest { @NotNull @Size(min = 1, max = 40) @OpenApiField(desc = "商品信息列表") private List<ProdDetailInfo> prodInfoList; @Length(max = 20, min = 20) @OpenApiField(desc = "买家id",demo = "20140814010000052219") private String buyerUserId; public void check() { Set<String> orderSet = new HashSet<String>(); for (Iterator<ProdDetailInfo> iterator = prodInfoList.iterator(); iterator.hasNext();) { ProdDetailInfo detail = iterator.next(); orderSet.add(detail.getOutOrderNo()); } if (orderSet.size() != prodInfoList.size()) { throw new IllegalArgumentException("outOrderNo 不允许有重复"); } } public List<ProdDetailInfo> getProdInfoList() { return prodInfoList; } public void setProdInfoList(List<ProdDetailInfo> prodInfoList) { this.prodInfoList = prodInfoList; } public String getBuyerUserId() { return buyerUserId; } public void setBuyerUserId(String buyerUserId) { this.buyerUserId = buyerUserId; } }
true