blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
1a82af6ae40f11a4d18264653b0e00e36ebef116
20,375,324,891,366
161219d4ef6b0f03168fe5a7f4a4f29d8235aa58
/src/main/java/org/rtctasks/RTCTasksRepository.java
0128b1f735d1001f2ad0d56583cebe0dc0eb8d93
[]
no_license
emaayan/RTCTasks
https://github.com/emaayan/RTCTasks
2c5d594a6d04b1095691eb505e67230101fe906f
ad7ef1014ebda03b8d1e8d3269ab2e00c1ddc75d
refs/heads/master
2023-03-17T14:43:10.183000
2023-03-14T10:28:33
2023-03-14T10:28:33
39,443,388
1
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.rtctasks; import com.ibm.team.process.common.IProcessArea; import com.ibm.team.process.common.IProjectArea; import com.ibm.team.repository.common.IContributorHandle; import com.ibm.team.repository.common.PermissionDeniedException; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.workitem.common.model.IComment; import com.ibm.team.workitem.common.model.IComments; import com.ibm.team.workitem.common.model.IWorkItem; import com.ibm.team.workitem.common.model.IWorkItemType; import com.ibm.team.workitem.common.workflow.IWorkflowInfo; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.util.text.StringUtil; import com.intellij.tasks.*; import com.intellij.tasks.impl.BaseRepository; import com.intellij.tasks.impl.RequestFailedException; import com.intellij.util.ExceptionUtil; import com.intellij.util.xmlb.annotations.Tag; import org.apache.commons.lang.StringUtils; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.rtctasks.core.RTCConnector; import org.rtctasks.core.RTCProject; import org.rtctasks.model.RTCComment; import org.rtctasks.model.RTCTask; import org.rtctasks.model.RTCTaskState; import org.rtctasks.model.RTCTaskType; import java.nio.channels.ClosedByInterruptException; import java.time.Duration; import java.util.*; import java.util.function.Consumer; import java.util.stream.Collectors; //https://intellij-support.jetbrains.com/hc/en-us/community/posts/207098975-Documenation-about-Task-Api //https://rsjazz.wordpress.com/2015/03/31/the-work-item-time-tracking-api/ //https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant// //https://jazz.net/library/article/1229 /** * Created by exm1110B. * Date: 17/07/2015, 14:54 */ @Tag(RTCTasksRepositoryType.NAME) public class RTCTasksRepository extends BaseRepository { public final static Logger LOGGER = Logger.getInstance(RTCTasksRepository.class); private volatile RTCConnector rtcConnector = null; private final Map<Integer, TaskState> taskStateMapper = new HashMap<>(); private final Map<String, TaskType> taskTypeMapper = new HashMap<>(); private String projectArea; //MUST BE KEPT FOR XML DE-SERIERLIZE!! public RTCTasksRepository() { super(); } public RTCTasksRepository(final TaskRepositoryType type) { super(type); } public RTCTasksRepository(final RTCTasksRepository rtcTasksRepository) { super(rtcTasksRepository); setProjectArea(rtcTasksRepository.getProjectArea()); setProjectId(rtcTasksRepository.getProjectId()); initConnector(); setConversions(); } @Override public void initializeRepository() { super.initializeRepository(); LOGGER.info("Init repository "+ this.getUrl() ); initConnector(); setConversions(); } protected void setConversions() { taskStateMapper.put(IWorkflowInfo.OPEN_STATES, TaskState.OPEN); taskStateMapper.put(IWorkflowInfo.CLOSED_STATES, TaskState.RESOLVED); taskStateMapper.put(IWorkflowInfo.IN_PROGRESS_STATES, TaskState.IN_PROGRESS); taskTypeMapper.put("defect", TaskType.BUG); taskTypeMapper.put("com.ibm.team.workitem.workItemType.defect", TaskType.BUG); taskTypeMapper.put("task", TaskType.FEATURE); taskTypeMapper.put("com.ibm.team.workitem.workItemType.task", TaskType.FEATURE); taskTypeMapper.put("", TaskType.OTHER); } private void initConnector() { if (isConfigured()) { final String url = getUrl(); final String username = getUsername(); final String password = getPassword(); rtcConnector =new RTCConnector(url, username, password); } } private TaskState getTaskState(int state) { return taskStateMapper.getOrDefault(state, TaskState.OTHER); } private TaskType getTaskType(String workItemType) { return taskTypeMapper.getOrDefault(workItemType, TaskType.OTHER); } @Override public boolean isShouldFormatCommitMessage() { return true; } @Override public Task[] getIssues(@Nullable final String query, final int offset, final int limit, final boolean withClosed, @NotNull final ProgressIndicator cancelled) { LOGGER.info("Query is " + query); final Optional<RTCConnector> connector = getConnector(); final ProgressMonitor progressMonitor=new ProgressMonitor(cancelled); return connector.map(rtcConnector -> { final Task[] tasks1; try { final RTCProject project = rtcConnector.getProject(projectId,progressMonitor); if (isNumber(query)) { final int id = Integer.parseInt(query); try { final IWorkItem workItem = rtcConnector.getJazzWorkItemById(id, progressMonitor); if (workItem!=null) { final RTCTask workItemBy = getRtcTask(rtcConnector, project, workItem, progressMonitor); tasks1 = new Task[]{workItemBy}; }else{ tasks1 = new Task[]{}; } } catch (PermissionDeniedException e) { LOGGER.warn("Couldn't find " + id);//because we can't access some task id return new Task[]{}; } } else { final List<IWorkItem> workItemsBy = project.getWorkItemsBy(query,progressMonitor); tasks1 = new Task[workItemsBy.size()]; for (int i = 0; i < workItemsBy.size(); i++) { final IWorkItem iWorkItem = workItemsBy.get(i); tasks1[i] = getRtcTask(rtcConnector, project, iWorkItem,progressMonitor); } } }catch (OperationCanceledException e){ throw new ProcessCanceledException(e); } catch (TeamRepositoryException e) { if (ExceptionUtil.causedBy(e, ClosedByInterruptException.class)) { throw new ProcessCanceledException(e); } else { throw new RequestFailedException(e); } } return tasks1; }).orElse(new Task[]{}); } @NotNull public RTCTask getRtcTask(RTCConnector rtcConnector, final RTCProject project, IWorkItem workItem,ProgressMonitor progressMonitor) throws TeamRepositoryException { final String workItemTypeId = workItem.getWorkItemType(); final IWorkItemType workItemType = project.getWorkItemType(workItemTypeId); final TaskType taskType = getTaskType(workItemTypeId); final RTCTaskType rtcTaskType = new RTCTaskType(workItemType, taskType); final int taskStateGroup = rtcConnector.getTaskStateGroup(workItem); final TaskState taskState = getTaskState(taskStateGroup); final boolean isClosed = !project.isOpen(workItem); final RTCTaskState rtcTaskState = new RTCTaskState(taskState, isClosed); final IComments comments = workItem.getComments(); final IComment[] contents = comments.getContents(); final RTCComment[] rtcComments = new RTCComment[contents.length]; for (int i = 0; i < contents.length; i++) { final IComment content = contents[i]; final IContributorHandle creator = content.getCreator(); final String contributorName = rtcConnector.getContributorName(creator,progressMonitor); final RTCComment rtcComment = new RTCComment(content, contributorName); rtcComments[i] = rtcComment; } return new RTCTask(workItem, rtcTaskType, rtcTaskState, rtcComments, projectArea); } private boolean isNumber(final @Nullable String query) { try { Integer.parseInt(query); return true; } catch (NumberFormatException e) { return false; } } @Nullable @Override public Task findTask(@NotNull final String s) { final String id1 = RTCTask.getId(s); final int id = Integer.parseInt(id1); final Optional<RTCConnector> connector = getConnector(); final Optional<Task> task = connector.map(rtcConnector -> { try { final RTCProject project = rtcConnector.getProject(projectId); final IWorkItem jazzWorkItemById = rtcConnector.getJazzWorkItemById(id,null); final RTCTask workItemBy = getRtcTask(rtcConnector, project, jazzWorkItemById,null); return workItemBy; } catch (TeamRepositoryException e) { throw new RequestFailedException(e); } }); return task.orElse(null); } @NotNull @Override public BaseRepository clone() { final RTCTasksRepository cloned = new RTCTasksRepository(this); return cloned; } @Override public String extractId(String taskName) { return RTCTask.getId(taskName); } @Override public CancellableConnection createCancellableConnection() { return new CancellableConnection() { //private volatile RTCConnector _connector; private final NullProgressMonitor nullProgressMonitor = new NullProgressMonitor(); @Override protected void doTest() throws Exception { final RTCConnector rtcConnector = new RTCConnector(getUrl(), getUsername(), getPassword(),nullProgressMonitor); rtcConnector.login(); } @Override public void cancel() { nullProgressMonitor.setCanceled(true); } }; } @Override public boolean isConfigured() { final boolean isConfigured = super.isConfigured() && hasParameters(); return isConfigured; } public boolean hasParameters() { return StringUtil.isNotEmpty(this.getUsername()) && StringUtil.isNotEmpty(this.getPassword()) && StringUtils.isNotEmpty(this.getProjectArea()) && StringUtil.isNotEmpty(this.getProjectId()); } public Optional<RTCConnector> getConnector() { return Optional.ofNullable(rtcConnector); } @Tag("projectArea") public String getProjectArea() { return projectArea; } public void setProjectArea(String projectArea) { this.projectArea = projectArea; } private String projectId; @Tag("projectUUID") public String getProjectId() { return projectId; } public void setProjectId(String projectId) { this.projectId = projectId; } public List<IProjectArea> getProjects() throws TeamRepositoryException { final RTCConnector rtcConnector=new RTCConnector(getUrl(), getUsername(),getPassword()); final List<IProjectArea> allProject = rtcConnector.getProjects(); return allProject; } public Map<String,String> getProjectNames(List<IProjectArea> allProject) { final Map<String,String> areas=allProject.stream().collect(Collectors.toMap(IProcessArea::getName, iProjectArea -> iProjectArea.getItemId().getUuidValue())); return areas; } public void updateProjectId(String projectName) { setProjectArea(projectName); if (StringUtil.isNotEmpty(projectName)) { // final String projectUid = projectMap.get(projectName); // setProjectId(projectUid); }else{ setProjectId(""); } } public void updateProjectUID() { getConnector().ifPresent(rtcConnector -> { final IProjectArea projectsBy; try { projectsBy = rtcConnector.getProjectsBy(RTCTasksRepository.this.projectArea); final String uuidValue = projectsBy.getItemId().getUuidValue(); setProjectId(uuidValue); } catch (TeamRepositoryException e) { LOGGER.error("Problem updating project ",e); } }); } @Override protected int getFeatures() { final int features = super.getFeatures() | TaskRepository.TIME_MANAGEMENT // | TaskRepository.STATE_UPDATING ; return features; } @Override public boolean isSupported(int feature) { final boolean supported = super.isSupported(feature); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Is supported " + feature + " " + supported); } return supported; } @Override //TaskRepository.TIME_MANAGEMENT public void updateTimeSpent(@NotNull LocalTask task, @NotNull String timeSpent, @NotNull String comment) { //super.updateTimeSpent(task, timeSpent, comment); final String number = task.getNumber(); final Optional<RTCConnector> connector = getConnector(); connector.ifPresent(rtcConnector -> { try { final IWorkItem jazzWorkItemById = rtcConnector.getJazzWorkItemById(Integer.parseInt(number),null); final Duration duration = matchDuration(timeSpent); rtcConnector.updateTimeSpent(jazzWorkItemById, duration.toMillis(), comment); } catch (TeamRepositoryException e) { throw new RequestFailedException(e); } }); } public static Duration matchDuration(@NotNull String timeSpent) { final StringTokenizer stringTokenizer = new StringTokenizer(timeSpent, " "); final StringBuffer stringBuffer = new StringBuffer("P"); boolean startTime = false; while (stringTokenizer.hasMoreTokens()) { final String s1 = stringTokenizer.nextToken(); final String s = s1.toUpperCase(); if (s.endsWith("D")) { stringBuffer.append(s); if (!startTime && stringTokenizer.hasMoreTokens()) { stringBuffer.append("T"); startTime = true; } } else { if (!startTime) { stringBuffer.append("T"); startTime = true; } stringBuffer.append(s); } } final Duration parse = Duration.parse(stringBuffer); return parse; } public static Duration parseDuration(int days, int hours, int minutes) { //P2DT3H4M String durationPattern = String.format("P%dDT%dH%dM", days, hours, minutes); final Duration parse = Duration.parse(durationPattern); return parse; } @NotNull @Override //TaskRepository.STATE_UPDATING public Set<CustomTaskState> getAvailableTaskStates(@NotNull final Task task) { final Optional<RTCConnector> connector = getConnector(); return connector.map(rtcConnector -> { try { final RTCProject project = rtcConnector.getProject(projectId); final Map<String, String> taskStates1 = project.getTaskStates(); final Set<Map.Entry<String, String>> entries = taskStates1.entrySet(); final Set<CustomTaskState> customTaskStates = new HashSet<>(); for (Map.Entry<String, String> entry : entries) { final String key = entry.getKey(); final String value = entry.getValue(); final CustomTaskState customTaskState = new CustomTaskState(key, value); customTaskStates.add(customTaskState); } return customTaskStates; } catch (TeamRepositoryException e) { throw new RequestFailedException(e); } }).orElse(Collections.emptySet()); } @Override public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof RTCTasksRepository)) return false; if (!super.equals(o)) return false; final RTCTasksRepository that = (RTCTasksRepository) o; return getProjectArea() != null ? getProjectArea().equals(that.getProjectArea()) : that.getProjectArea() == null; } @Override public int hashCode() { return getProjectArea() != null ? getProjectArea().hashCode() : 0; } }
UTF-8
Java
16,747
java
RTCTasksRepository.java
Java
[ { "context": "//jazz.net/library/article/1229\n\n/**\n * Created by exm1110B.\n * Date: 17/07/2015, 14:54\n */\n@Tag(RTCTasksRepo", "end": 2011, "score": 0.9995891451835632, "start": 2003, "tag": "USERNAME", "value": "exm1110B" }, { "context": "rl = getUrl();\n final String username = getUsername();\n final String password = getPasswor", "end": 3918, "score": 0.9641456007957458, "start": 3907, "tag": "USERNAME", "value": "getUsername" } ]
null
[]
package org.rtctasks; import com.ibm.team.process.common.IProcessArea; import com.ibm.team.process.common.IProjectArea; import com.ibm.team.repository.common.IContributorHandle; import com.ibm.team.repository.common.PermissionDeniedException; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.workitem.common.model.IComment; import com.ibm.team.workitem.common.model.IComments; import com.ibm.team.workitem.common.model.IWorkItem; import com.ibm.team.workitem.common.model.IWorkItemType; import com.ibm.team.workitem.common.workflow.IWorkflowInfo; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.util.text.StringUtil; import com.intellij.tasks.*; import com.intellij.tasks.impl.BaseRepository; import com.intellij.tasks.impl.RequestFailedException; import com.intellij.util.ExceptionUtil; import com.intellij.util.xmlb.annotations.Tag; import org.apache.commons.lang.StringUtils; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.rtctasks.core.RTCConnector; import org.rtctasks.core.RTCProject; import org.rtctasks.model.RTCComment; import org.rtctasks.model.RTCTask; import org.rtctasks.model.RTCTaskState; import org.rtctasks.model.RTCTaskType; import java.nio.channels.ClosedByInterruptException; import java.time.Duration; import java.util.*; import java.util.function.Consumer; import java.util.stream.Collectors; //https://intellij-support.jetbrains.com/hc/en-us/community/posts/207098975-Documenation-about-Task-Api //https://rsjazz.wordpress.com/2015/03/31/the-work-item-time-tracking-api/ //https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant// //https://jazz.net/library/article/1229 /** * Created by exm1110B. * Date: 17/07/2015, 14:54 */ @Tag(RTCTasksRepositoryType.NAME) public class RTCTasksRepository extends BaseRepository { public final static Logger LOGGER = Logger.getInstance(RTCTasksRepository.class); private volatile RTCConnector rtcConnector = null; private final Map<Integer, TaskState> taskStateMapper = new HashMap<>(); private final Map<String, TaskType> taskTypeMapper = new HashMap<>(); private String projectArea; //MUST BE KEPT FOR XML DE-SERIERLIZE!! public RTCTasksRepository() { super(); } public RTCTasksRepository(final TaskRepositoryType type) { super(type); } public RTCTasksRepository(final RTCTasksRepository rtcTasksRepository) { super(rtcTasksRepository); setProjectArea(rtcTasksRepository.getProjectArea()); setProjectId(rtcTasksRepository.getProjectId()); initConnector(); setConversions(); } @Override public void initializeRepository() { super.initializeRepository(); LOGGER.info("Init repository "+ this.getUrl() ); initConnector(); setConversions(); } protected void setConversions() { taskStateMapper.put(IWorkflowInfo.OPEN_STATES, TaskState.OPEN); taskStateMapper.put(IWorkflowInfo.CLOSED_STATES, TaskState.RESOLVED); taskStateMapper.put(IWorkflowInfo.IN_PROGRESS_STATES, TaskState.IN_PROGRESS); taskTypeMapper.put("defect", TaskType.BUG); taskTypeMapper.put("com.ibm.team.workitem.workItemType.defect", TaskType.BUG); taskTypeMapper.put("task", TaskType.FEATURE); taskTypeMapper.put("com.ibm.team.workitem.workItemType.task", TaskType.FEATURE); taskTypeMapper.put("", TaskType.OTHER); } private void initConnector() { if (isConfigured()) { final String url = getUrl(); final String username = getUsername(); final String password = getPassword(); rtcConnector =new RTCConnector(url, username, password); } } private TaskState getTaskState(int state) { return taskStateMapper.getOrDefault(state, TaskState.OTHER); } private TaskType getTaskType(String workItemType) { return taskTypeMapper.getOrDefault(workItemType, TaskType.OTHER); } @Override public boolean isShouldFormatCommitMessage() { return true; } @Override public Task[] getIssues(@Nullable final String query, final int offset, final int limit, final boolean withClosed, @NotNull final ProgressIndicator cancelled) { LOGGER.info("Query is " + query); final Optional<RTCConnector> connector = getConnector(); final ProgressMonitor progressMonitor=new ProgressMonitor(cancelled); return connector.map(rtcConnector -> { final Task[] tasks1; try { final RTCProject project = rtcConnector.getProject(projectId,progressMonitor); if (isNumber(query)) { final int id = Integer.parseInt(query); try { final IWorkItem workItem = rtcConnector.getJazzWorkItemById(id, progressMonitor); if (workItem!=null) { final RTCTask workItemBy = getRtcTask(rtcConnector, project, workItem, progressMonitor); tasks1 = new Task[]{workItemBy}; }else{ tasks1 = new Task[]{}; } } catch (PermissionDeniedException e) { LOGGER.warn("Couldn't find " + id);//because we can't access some task id return new Task[]{}; } } else { final List<IWorkItem> workItemsBy = project.getWorkItemsBy(query,progressMonitor); tasks1 = new Task[workItemsBy.size()]; for (int i = 0; i < workItemsBy.size(); i++) { final IWorkItem iWorkItem = workItemsBy.get(i); tasks1[i] = getRtcTask(rtcConnector, project, iWorkItem,progressMonitor); } } }catch (OperationCanceledException e){ throw new ProcessCanceledException(e); } catch (TeamRepositoryException e) { if (ExceptionUtil.causedBy(e, ClosedByInterruptException.class)) { throw new ProcessCanceledException(e); } else { throw new RequestFailedException(e); } } return tasks1; }).orElse(new Task[]{}); } @NotNull public RTCTask getRtcTask(RTCConnector rtcConnector, final RTCProject project, IWorkItem workItem,ProgressMonitor progressMonitor) throws TeamRepositoryException { final String workItemTypeId = workItem.getWorkItemType(); final IWorkItemType workItemType = project.getWorkItemType(workItemTypeId); final TaskType taskType = getTaskType(workItemTypeId); final RTCTaskType rtcTaskType = new RTCTaskType(workItemType, taskType); final int taskStateGroup = rtcConnector.getTaskStateGroup(workItem); final TaskState taskState = getTaskState(taskStateGroup); final boolean isClosed = !project.isOpen(workItem); final RTCTaskState rtcTaskState = new RTCTaskState(taskState, isClosed); final IComments comments = workItem.getComments(); final IComment[] contents = comments.getContents(); final RTCComment[] rtcComments = new RTCComment[contents.length]; for (int i = 0; i < contents.length; i++) { final IComment content = contents[i]; final IContributorHandle creator = content.getCreator(); final String contributorName = rtcConnector.getContributorName(creator,progressMonitor); final RTCComment rtcComment = new RTCComment(content, contributorName); rtcComments[i] = rtcComment; } return new RTCTask(workItem, rtcTaskType, rtcTaskState, rtcComments, projectArea); } private boolean isNumber(final @Nullable String query) { try { Integer.parseInt(query); return true; } catch (NumberFormatException e) { return false; } } @Nullable @Override public Task findTask(@NotNull final String s) { final String id1 = RTCTask.getId(s); final int id = Integer.parseInt(id1); final Optional<RTCConnector> connector = getConnector(); final Optional<Task> task = connector.map(rtcConnector -> { try { final RTCProject project = rtcConnector.getProject(projectId); final IWorkItem jazzWorkItemById = rtcConnector.getJazzWorkItemById(id,null); final RTCTask workItemBy = getRtcTask(rtcConnector, project, jazzWorkItemById,null); return workItemBy; } catch (TeamRepositoryException e) { throw new RequestFailedException(e); } }); return task.orElse(null); } @NotNull @Override public BaseRepository clone() { final RTCTasksRepository cloned = new RTCTasksRepository(this); return cloned; } @Override public String extractId(String taskName) { return RTCTask.getId(taskName); } @Override public CancellableConnection createCancellableConnection() { return new CancellableConnection() { //private volatile RTCConnector _connector; private final NullProgressMonitor nullProgressMonitor = new NullProgressMonitor(); @Override protected void doTest() throws Exception { final RTCConnector rtcConnector = new RTCConnector(getUrl(), getUsername(), getPassword(),nullProgressMonitor); rtcConnector.login(); } @Override public void cancel() { nullProgressMonitor.setCanceled(true); } }; } @Override public boolean isConfigured() { final boolean isConfigured = super.isConfigured() && hasParameters(); return isConfigured; } public boolean hasParameters() { return StringUtil.isNotEmpty(this.getUsername()) && StringUtil.isNotEmpty(this.getPassword()) && StringUtils.isNotEmpty(this.getProjectArea()) && StringUtil.isNotEmpty(this.getProjectId()); } public Optional<RTCConnector> getConnector() { return Optional.ofNullable(rtcConnector); } @Tag("projectArea") public String getProjectArea() { return projectArea; } public void setProjectArea(String projectArea) { this.projectArea = projectArea; } private String projectId; @Tag("projectUUID") public String getProjectId() { return projectId; } public void setProjectId(String projectId) { this.projectId = projectId; } public List<IProjectArea> getProjects() throws TeamRepositoryException { final RTCConnector rtcConnector=new RTCConnector(getUrl(), getUsername(),getPassword()); final List<IProjectArea> allProject = rtcConnector.getProjects(); return allProject; } public Map<String,String> getProjectNames(List<IProjectArea> allProject) { final Map<String,String> areas=allProject.stream().collect(Collectors.toMap(IProcessArea::getName, iProjectArea -> iProjectArea.getItemId().getUuidValue())); return areas; } public void updateProjectId(String projectName) { setProjectArea(projectName); if (StringUtil.isNotEmpty(projectName)) { // final String projectUid = projectMap.get(projectName); // setProjectId(projectUid); }else{ setProjectId(""); } } public void updateProjectUID() { getConnector().ifPresent(rtcConnector -> { final IProjectArea projectsBy; try { projectsBy = rtcConnector.getProjectsBy(RTCTasksRepository.this.projectArea); final String uuidValue = projectsBy.getItemId().getUuidValue(); setProjectId(uuidValue); } catch (TeamRepositoryException e) { LOGGER.error("Problem updating project ",e); } }); } @Override protected int getFeatures() { final int features = super.getFeatures() | TaskRepository.TIME_MANAGEMENT // | TaskRepository.STATE_UPDATING ; return features; } @Override public boolean isSupported(int feature) { final boolean supported = super.isSupported(feature); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Is supported " + feature + " " + supported); } return supported; } @Override //TaskRepository.TIME_MANAGEMENT public void updateTimeSpent(@NotNull LocalTask task, @NotNull String timeSpent, @NotNull String comment) { //super.updateTimeSpent(task, timeSpent, comment); final String number = task.getNumber(); final Optional<RTCConnector> connector = getConnector(); connector.ifPresent(rtcConnector -> { try { final IWorkItem jazzWorkItemById = rtcConnector.getJazzWorkItemById(Integer.parseInt(number),null); final Duration duration = matchDuration(timeSpent); rtcConnector.updateTimeSpent(jazzWorkItemById, duration.toMillis(), comment); } catch (TeamRepositoryException e) { throw new RequestFailedException(e); } }); } public static Duration matchDuration(@NotNull String timeSpent) { final StringTokenizer stringTokenizer = new StringTokenizer(timeSpent, " "); final StringBuffer stringBuffer = new StringBuffer("P"); boolean startTime = false; while (stringTokenizer.hasMoreTokens()) { final String s1 = stringTokenizer.nextToken(); final String s = s1.toUpperCase(); if (s.endsWith("D")) { stringBuffer.append(s); if (!startTime && stringTokenizer.hasMoreTokens()) { stringBuffer.append("T"); startTime = true; } } else { if (!startTime) { stringBuffer.append("T"); startTime = true; } stringBuffer.append(s); } } final Duration parse = Duration.parse(stringBuffer); return parse; } public static Duration parseDuration(int days, int hours, int minutes) { //P2DT3H4M String durationPattern = String.format("P%dDT%dH%dM", days, hours, minutes); final Duration parse = Duration.parse(durationPattern); return parse; } @NotNull @Override //TaskRepository.STATE_UPDATING public Set<CustomTaskState> getAvailableTaskStates(@NotNull final Task task) { final Optional<RTCConnector> connector = getConnector(); return connector.map(rtcConnector -> { try { final RTCProject project = rtcConnector.getProject(projectId); final Map<String, String> taskStates1 = project.getTaskStates(); final Set<Map.Entry<String, String>> entries = taskStates1.entrySet(); final Set<CustomTaskState> customTaskStates = new HashSet<>(); for (Map.Entry<String, String> entry : entries) { final String key = entry.getKey(); final String value = entry.getValue(); final CustomTaskState customTaskState = new CustomTaskState(key, value); customTaskStates.add(customTaskState); } return customTaskStates; } catch (TeamRepositoryException e) { throw new RequestFailedException(e); } }).orElse(Collections.emptySet()); } @Override public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof RTCTasksRepository)) return false; if (!super.equals(o)) return false; final RTCTasksRepository that = (RTCTasksRepository) o; return getProjectArea() != null ? getProjectArea().equals(that.getProjectArea()) : that.getProjectArea() == null; } @Override public int hashCode() { return getProjectArea() != null ? getProjectArea().hashCode() : 0; } }
16,747
0.641428
0.637666
435
37.498852
30.701483
167
false
false
0
0
0
0
0
0
0.629885
false
false
2
5fff474c381644252c58a29f456c99f9be445e29
22,385,369,548,507
4b17999e9b7105a987fe97675736e6da6d95da59
/Main.java
88851cdb6d583d3ec2c96c63a4056d27002795b7
[]
no_license
NikitaV1/Java-Epam-HW-7
https://github.com/NikitaV1/Java-Epam-HW-7
cbef946c3538ce72d7bf17731ef22cf9367f6246
137be1151568ea5049bde18d14bbe6aff0985db5
refs/heads/master
2020-05-03T04:24:06.194000
2019-03-30T09:04:31
2019-03-30T09:04:31
178,420,368
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hw7; public class Main { private static Shape[] diffShape = new Shape[9]; public static void main(String[] args) { fillArray(diffShape); outputArray(diffShape); System.out.println("Total area = " + calcTotalArea(diffShape)); printArray(calcByTypeArea(diffShape)); } public static void outputArray(Shape[] array) { for (int i = 0; i < array.length; i++) { System.out.println(array[i].toString()); } } public static void fillArray(Shape[] array) { array[0] = new Ractangle("red", 12.2, 8.33); array[1] = new Ractangle("blue", 5.11, 8.93); array[2] = new Ractangle("white", 3.12, 4.88); array[3] = new Ractangle("yellow", 16.44, 7.82); array[4] = new Circle("black", 5.5); array[5] = new Circle("orange", 7); array[6] = new Circle("purple", 2.45); array[7] = new Triangle("white", 5.5, 6, 10); array[8] = new Triangle("green", 3.88, 7.43, 9.75); } public static double calcTotalArea(Shape[] array) { double total = 0; for (int i = 0; i < array.length; i++) { total += array[i].calcArea(); } return total; } public static double[] calcByTypeArea(Shape[] array) { double totalTriangle = 0; double totalCircle = 0; double totalRactanle = 0; for (int i = 0; i < array.length; i++) { if (diffShape[i] instanceof Circle) { totalCircle += array[i].calcArea(); } if (diffShape[i] instanceof Ractangle) { totalRactanle += array[i].calcArea(); } if (diffShape[i] instanceof Triangle) { totalTriangle += array[i].calcArea(); } } double[] retArray = {totalCircle, totalRactanle, totalTriangle}; return retArray; } public static void printArray(double[] array) { System.out.print("Circle area = " + array[0] + ", Ractangle area = " + array[1] + ", Triangle area = " + array[2]); } }
UTF-8
Java
2,159
java
Main.java
Java
[]
null
[]
package hw7; public class Main { private static Shape[] diffShape = new Shape[9]; public static void main(String[] args) { fillArray(diffShape); outputArray(diffShape); System.out.println("Total area = " + calcTotalArea(diffShape)); printArray(calcByTypeArea(diffShape)); } public static void outputArray(Shape[] array) { for (int i = 0; i < array.length; i++) { System.out.println(array[i].toString()); } } public static void fillArray(Shape[] array) { array[0] = new Ractangle("red", 12.2, 8.33); array[1] = new Ractangle("blue", 5.11, 8.93); array[2] = new Ractangle("white", 3.12, 4.88); array[3] = new Ractangle("yellow", 16.44, 7.82); array[4] = new Circle("black", 5.5); array[5] = new Circle("orange", 7); array[6] = new Circle("purple", 2.45); array[7] = new Triangle("white", 5.5, 6, 10); array[8] = new Triangle("green", 3.88, 7.43, 9.75); } public static double calcTotalArea(Shape[] array) { double total = 0; for (int i = 0; i < array.length; i++) { total += array[i].calcArea(); } return total; } public static double[] calcByTypeArea(Shape[] array) { double totalTriangle = 0; double totalCircle = 0; double totalRactanle = 0; for (int i = 0; i < array.length; i++) { if (diffShape[i] instanceof Circle) { totalCircle += array[i].calcArea(); } if (diffShape[i] instanceof Ractangle) { totalRactanle += array[i].calcArea(); } if (diffShape[i] instanceof Triangle) { totalTriangle += array[i].calcArea(); } } double[] retArray = {totalCircle, totalRactanle, totalTriangle}; return retArray; } public static void printArray(double[] array) { System.out.print("Circle area = " + array[0] + ", Ractangle area = " + array[1] + ", Triangle area = " + array[2]); } }
2,159
0.525706
0.495137
62
32.854839
25.126677
127
false
false
0
0
0
0
0
0
0.887097
false
false
2
be42a7ae5c63c945c6d82768184e11a57a8d4cd2
13,580,686,606,912
abc5ee677cfd9f8231a3cc2f99deba91bef28e13
/src/main/java/webapp/LoginService.java
bbaa7cbca1525a53c48be3e7733dfd67052fe8a3
[]
no_license
dannythompson901/organize-your-tasks
https://github.com/dannythompson901/organize-your-tasks
591dcf436a93a05cd9db8aacf4722ef21a454e64
af69b95df4f1f4ad955b6b4a15b9d6bc0e0eb81a
refs/heads/master
2020-08-07T02:36:38.672000
2019-10-07T00:06:53
2019-10-07T00:06:53
213,263,189
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package webapp; public class LoginService { public boolean validateUser(String user, String password) { return user.equalsIgnoreCase("dannythompson") && password.equals("root"); } }
UTF-8
Java
187
java
LoginService.java
Java
[ { "context": "tring password) {\n\t\treturn user.equalsIgnoreCase(\"dannythompson\") && password.equals(\"root\");\n\t}\n\n}", "end": 151, "score": 0.9996070861816406, "start": 138, "tag": "USERNAME", "value": "dannythompson" }, { "context": "lsIgnoreCase(\"dannythompson\") && password.equals(\"root\");\n\t}\n\n}", "end": 178, "score": 0.9933643341064453, "start": 174, "tag": "PASSWORD", "value": "root" } ]
null
[]
package webapp; public class LoginService { public boolean validateUser(String user, String password) { return user.equalsIgnoreCase("dannythompson") && password.equals("<PASSWORD>"); } }
193
0.759358
0.759358
8
22.5
27.69025
75
false
false
0
0
0
0
0
0
0.875
false
false
2
e1e11360422ab057b89ea22b293e7552d63180c3
2,027,224,626,055
c4a0dc6e5b7d16e8d6a821b8c6b617ba25b73b3c
/src/main/java/com/yambacode/yfunctions/structure/YLists.java
7176189663a9cacec508a1aa5764a58c8c7ff905
[]
no_license
cyamba/YFunctions
https://github.com/cyamba/YFunctions
349bd438d8b571f31fa85c2c5b67f7a3603aad1e
c346e98b5ad42d1fe04786d02b1333a4995563b0
refs/heads/master
2021-01-18T22:34:51.376000
2016-05-21T18:38:11
2016-05-21T18:38:11
10,707,975
0
0
null
false
2016-05-21T18:38:12
2013-06-15T15:23:32
2016-02-19T20:30:48
2016-05-21T18:38:11
54
0
0
0
Java
null
null
package com.yambacode.yfunctions.structure; import java.util.ArrayList; import java.util.List; /** * @author : cbyamba * Date: 2013-06-15 * Time: 19:56 */ public class YLists { public static YList<Integer> list(Integer start, Integer end) { List<Integer> tmp = new ArrayList<>(); if (start > end) { for (int i = start; i >= end; i--) { tmp.add(i); } return new YList(tmp); } for (int i = start; i <= end; i++) { tmp.add(i); } return new YList(tmp); } public static <S> YList<S> cycle(YList<S> block, int count) { List<S> result = YList.list().getRawList(); List<S> blockRawList = block.getRawList(); for (int i = 0; i < count; i++) { result.add(blockRawList.get(i % blockRawList.size())); } return YList.list(result); } public static <S, T> YList<Tuple<S, T>> zip(YList<S> firstList, YList<T> sndList) { if (firstList.isEmpty() || sndList.isEmpty()) { return (YList<Tuple<S, T>>) YList.list(); } return zip0(firstList, sndList); } static <S, T> YList<Tuple<S, T>> zip0(YList<S> firstList, YList<T> sndList) { List<Tuple<S, T>> mutableTmpList = new ArrayList<Tuple<S, T>>(); int minLength = Math.min(firstList.length(), sndList.length()); for (int i = 0; i < minLength; i++) { mutableTmpList.add(zip1(firstList.get(i), sndList.get(i))); } return YList.list(mutableTmpList); } static <S, T> Tuple<S, T> zip1(S first, T second) { return Tuple.of(first, second); } public static <S, T> Tuple<YList<S>, YList<T>> split(YList<Tuple<S, T>> tupleList) { List<S> fstList = new ArrayList<>(); List<T> sndList = new ArrayList<>(); for (Tuple<S, T> tuple : tupleList.getRawList()) { fstList.add(tuple._0); sndList.add(tuple._1); } return Tuple.of(YList.list(fstList), YList.list(sndList)); } }
UTF-8
Java
2,083
java
YLists.java
Java
[ { "context": "rrayList;\nimport java.util.List;\n\n/**\n * @author : cbyamba\n * Date: 2013-06-15\n * Time: 19:5", "end": 121, "score": 0.9997149109840393, "start": 114, "tag": "USERNAME", "value": "cbyamba" } ]
null
[]
package com.yambacode.yfunctions.structure; import java.util.ArrayList; import java.util.List; /** * @author : cbyamba * Date: 2013-06-15 * Time: 19:56 */ public class YLists { public static YList<Integer> list(Integer start, Integer end) { List<Integer> tmp = new ArrayList<>(); if (start > end) { for (int i = start; i >= end; i--) { tmp.add(i); } return new YList(tmp); } for (int i = start; i <= end; i++) { tmp.add(i); } return new YList(tmp); } public static <S> YList<S> cycle(YList<S> block, int count) { List<S> result = YList.list().getRawList(); List<S> blockRawList = block.getRawList(); for (int i = 0; i < count; i++) { result.add(blockRawList.get(i % blockRawList.size())); } return YList.list(result); } public static <S, T> YList<Tuple<S, T>> zip(YList<S> firstList, YList<T> sndList) { if (firstList.isEmpty() || sndList.isEmpty()) { return (YList<Tuple<S, T>>) YList.list(); } return zip0(firstList, sndList); } static <S, T> YList<Tuple<S, T>> zip0(YList<S> firstList, YList<T> sndList) { List<Tuple<S, T>> mutableTmpList = new ArrayList<Tuple<S, T>>(); int minLength = Math.min(firstList.length(), sndList.length()); for (int i = 0; i < minLength; i++) { mutableTmpList.add(zip1(firstList.get(i), sndList.get(i))); } return YList.list(mutableTmpList); } static <S, T> Tuple<S, T> zip1(S first, T second) { return Tuple.of(first, second); } public static <S, T> Tuple<YList<S>, YList<T>> split(YList<Tuple<S, T>> tupleList) { List<S> fstList = new ArrayList<>(); List<T> sndList = new ArrayList<>(); for (Tuple<S, T> tuple : tupleList.getRawList()) { fstList.add(tuple._0); sndList.add(tuple._1); } return Tuple.of(YList.list(fstList), YList.list(sndList)); } }
2,083
0.542007
0.532405
66
30.560606
25.365885
88
false
false
0
0
0
0
0
0
0.863636
false
false
2
447b268bdcb1dc34eb7bb438ea4552840f5fbdd3
16,466,904,620,119
d17fb17899ab367011949f939f04ab089cd0c254
/Source_Files/DrawToImage.java
5c327e1ef9801d1c15519332906679252910e0ad
[]
no_license
prudentprogrammer/240_Project
https://github.com/prudentprogrammer/240_Project
bbc261de0180e62f0a21c95dd978d238f5476cce
5af8ecfb2c16b2432ae47f3864f909fe881b218f
refs/heads/master
2021-01-10T04:42:16.898000
2016-03-16T18:58:40
2016-03-16T18:58:40
53,975,565
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public static void main(String args[]) { int level = 23; if (args.length > 1 && args[1] != null && args[1].equalsIgnoreCase("-i")) drawToImage = true; if (args.length > 0) { String arg = args[0]; if (arg == null || arg.toLowerCase().indexOf("help") >= 0) { printHelp(); System.exit(1); } else { try { level = Integer.parseInt(arg); } catch (NumberFormatException exc) { System.out.println("Illegal Depth Number!"); System.exit(1); } } } else { drawToImage = true; } setLevel(level); new Fractal(); }
UTF-8
Java
601
java
DrawToImage.java
Java
[]
null
[]
public static void main(String args[]) { int level = 23; if (args.length > 1 && args[1] != null && args[1].equalsIgnoreCase("-i")) drawToImage = true; if (args.length > 0) { String arg = args[0]; if (arg == null || arg.toLowerCase().indexOf("help") >= 0) { printHelp(); System.exit(1); } else { try { level = Integer.parseInt(arg); } catch (NumberFormatException exc) { System.out.println("Illegal Depth Number!"); System.exit(1); } } } else { drawToImage = true; } setLevel(level); new Fractal(); }
601
0.544093
0.527454
27
21.296297
16.777
64
false
false
0
0
0
0
0
0
0.481481
false
false
2
9ed779681454cc4646c5329089d86cd30d8bd242
16,887,811,430,064
4746b2931ad6ce859049dcfc01c43c611447a919
/app/src/main/java/com/example/retrofit_dagger_java/MovieDataSource.java
3038e5934a5db30db1f675f1d9f5e868025c22d3
[]
no_license
bhuvicky/Retrofit-Dagger-Java
https://github.com/bhuvicky/Retrofit-Dagger-Java
e3dcb36427fe1b1f1ab22c1d7a9385b14741ad1b
d2db70611fa70315bd5a5660deda355681c60603
refs/heads/master
2020-04-08T23:34:53.475000
2018-11-30T13:57:49
2018-11-30T13:57:49
159,831,064
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.retrofit_dagger_java; import com.example.retrofit_dagger_java.dependency.NetworkModule; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; interface MovieOperation { @GET("discover/movie?") Call<Movie> fetchMovieList(@Query("api_key") String key, @Query("sort_by") String sortBy); @GET("movie/{movie_id}?") Call<Movie> fetchMovieDetails(@Path("movie_id") long movieId, @Query("api_key") String key); } public class MovieDataSource { private MovieOperation operation; MovieDataSource() { operation = NetworkModule.createService(MovieOperation.class); operation.fetchMovieList("", "asc"); // Created @ first time Re-build project; without any error DaggerNetworkComponent.builder().build(); } }
UTF-8
Java
888
java
MovieDataSource.java
Java
[]
null
[]
package com.example.retrofit_dagger_java; import com.example.retrofit_dagger_java.dependency.NetworkModule; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; interface MovieOperation { @GET("discover/movie?") Call<Movie> fetchMovieList(@Query("api_key") String key, @Query("sort_by") String sortBy); @GET("movie/{movie_id}?") Call<Movie> fetchMovieDetails(@Path("movie_id") long movieId, @Query("api_key") String key); } public class MovieDataSource { private MovieOperation operation; MovieDataSource() { operation = NetworkModule.createService(MovieOperation.class); operation.fetchMovieList("", "asc"); // Created @ first time Re-build project; without any error DaggerNetworkComponent.builder().build(); } }
888
0.673423
0.668919
33
25.90909
24.196623
70
false
false
0
0
0
0
0
0
0.484848
false
false
2
a40c6bcf1cfddf6a8676eba771e63f79346dd4df
8,143,258,054,494
532aac691c59808bea1f9424d54b60540faab509
/modules/tomcat/src/java/org/apache/geronimo/tomcat/BaseGBean.java
e349a9f752e096d0c8fb55f81c196baa0d03dbed
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
github4git/geronimo
https://github.com/github4git/geronimo
54b3fb2f2434e189e70efffbb3de2b577a35e5b3
cb557df1173f79b909f1aec8273115d712413927
refs/heads/1.0
2020-07-01T22:00:53
2016-11-20T04:44:52
2016-11-20T04:44:52
74,253,269
0
0
null
true
2016-11-20T04:42:27
2016-11-20T04:42:26
2016-09-03T17:20:48
2016-03-25T02:51:01
163,627
0
0
0
null
null
null
/** * * Copyright 2003-2004 The Apache Software Foundation * * 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.apache.geronimo.tomcat; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.tomcat.util.IntrospectionUtils; public abstract class BaseGBean { protected void setParameters(Object object, Map map){ if (map != null){ Set keySet = map.keySet(); Iterator iterator = keySet.iterator(); while(iterator.hasNext()){ String name = (String)iterator.next(); String value = (String)map.get(name); IntrospectionUtils.setProperty(object, name, value); } } } }
UTF-8
Java
1,289
java
BaseGBean.java
Java
[]
null
[]
/** * * Copyright 2003-2004 The Apache Software Foundation * * 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.apache.geronimo.tomcat; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.tomcat.util.IntrospectionUtils; public abstract class BaseGBean { protected void setParameters(Object object, Map map){ if (map != null){ Set keySet = map.keySet(); Iterator iterator = keySet.iterator(); while(iterator.hasNext()){ String name = (String)iterator.next(); String value = (String)map.get(name); IntrospectionUtils.setProperty(object, name, value); } } } }
1,289
0.649341
0.640031
41
30.439024
26.341146
88
false
false
0
0
0
0
0
0
0.439024
false
false
2
7c17b39a239fc628a73f8f7b61577666d94df99e
12,395,275,625,157
4665f9b61a4400ac2ed0a8b743c41d7ead69bba0
/src/main/java/com/example/onlineshop/entity/Order.java
84e2903c24e85f2e6a83cba152f95533fe374cde
[]
no_license
Armandokodheli/online-shop-master
https://github.com/Armandokodheli/online-shop-master
d879321c2ee0d5c799033f9923157db638a2aab7
8094aacb22f156fe5454eeed9ea95077979e46b6
refs/heads/master
2023-04-16T03:14:41.342000
2021-05-02T18:43:13
2021-05-02T18:43:13
363,724,823
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.onlineshop.entity; import javax.persistence.*; @Entity @Table(name = "order") public class Order { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "order_id") private int id; @Column(name = "final_price") private String finalPrice; private String comment; @ManyToOne @JoinColumn(name = "client_id", nullable = false) private Client client; @ManyToOne @JoinColumn(name = "product_id") private Product product; public Order(int id, String finalPrice, String comment, Client client, Product product) { this.id = id; this.finalPrice = finalPrice; this.comment = comment; this.client = client; this.product = product; } public Order() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFinalPrice() { return finalPrice; } public void setFinalPrice(String finalPrice) { this.finalPrice = finalPrice; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } }
UTF-8
Java
1,510
java
Order.java
Java
[]
null
[]
package com.example.onlineshop.entity; import javax.persistence.*; @Entity @Table(name = "order") public class Order { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "order_id") private int id; @Column(name = "final_price") private String finalPrice; private String comment; @ManyToOne @JoinColumn(name = "client_id", nullable = false) private Client client; @ManyToOne @JoinColumn(name = "product_id") private Product product; public Order(int id, String finalPrice, String comment, Client client, Product product) { this.id = id; this.finalPrice = finalPrice; this.comment = comment; this.client = client; this.product = product; } public Order() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFinalPrice() { return finalPrice; } public void setFinalPrice(String finalPrice) { this.finalPrice = finalPrice; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Client getClient() { return client; } public void setClient(Client client) { this.client = client; } public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } }
1,510
0.608609
0.608609
73
19.684931
17.722269
93
false
false
0
0
0
0
0
0
0.369863
false
false
2
4a80c6281f103da380c9182097ecc96a94eb2f0b
18,090,402,319,080
1cdb44b2d4ac22e5ec8717d6bbd504ed09111add
/src/main/java/pers/hanchao/designpattern/command/client/GameClientDemo.java
d227a4d291fad33f7296110e67c51b5921259bed
[ "Apache-2.0" ]
permissive
hanchao5272/design-pattern
https://github.com/hanchao5272/design-pattern
e1be2c40ec7d9a476e821d4b604403be6253bf4b
b830bc5e999624bee850ec8a98e1721815fe0bc6
refs/heads/master
2021-12-23T16:57:30.379000
2019-07-29T06:55:04
2019-07-29T06:55:04
193,321,405
0
0
Apache-2.0
false
2021-12-14T21:29:18
2019-06-23T07:57:36
2019-07-29T06:55:21
2021-12-14T21:29:16
691
0
0
2
Java
false
false
package pers.hanchao.designpattern.command.client; import com.google.common.collect.Lists; import pers.hanchao.designpattern.command.KeyEnum; import pers.hanchao.designpattern.command.command.Command; import pers.hanchao.designpattern.command.command.impl.*; import pers.hanchao.designpattern.command.invoker.KeyManager; import java.util.List; /** * <p>客户端</P> * * @author hanchao */ public class GameClientDemo { public static void main(String[] args) { //默认按键 KeyManager.press(KeyEnum.KEY_W); KeyManager.press(KeyEnum.KEY_SPACE); System.out.println("=============================================================================================================="); //将角色跳跃的快捷键进行替换 KeyManager.setCustomKey(new RoleJumpCommand(), KeyEnum.KEY_SPACE, KeyEnum.KEY_ENTER); KeyManager.press(KeyEnum.KEY_SPACE); KeyManager.press(KeyEnum.KEY_ENTER); System.out.println("=============================================================================================================="); //自定义宏命令:角色前进、释放技能:潜行术、释放技能:火球术,并将其绑定在按键A KeyManager.press(KeyEnum.KEY_A); List<Command> commandList = Lists.newArrayList( new RoleForwardCommand(), new ReleaseSneakCommand(), new ReleaseFireBallCommand() ); KeyManager.setCustomKey(new MacroCommand(commandList), null, KeyEnum.KEY_A); KeyManager.press(KeyEnum.KEY_A); } }
UTF-8
Java
1,562
java
GameClientDemo.java
Java
[ { "context": "t java.util.List;\n\n/**\n * <p>客户端</P>\n *\n * @author hanchao\n */\npublic class GameClientDemo {\n\n public sta", "end": 386, "score": 0.9995774626731873, "start": 379, "tag": "USERNAME", "value": "hanchao" } ]
null
[]
package pers.hanchao.designpattern.command.client; import com.google.common.collect.Lists; import pers.hanchao.designpattern.command.KeyEnum; import pers.hanchao.designpattern.command.command.Command; import pers.hanchao.designpattern.command.command.impl.*; import pers.hanchao.designpattern.command.invoker.KeyManager; import java.util.List; /** * <p>客户端</P> * * @author hanchao */ public class GameClientDemo { public static void main(String[] args) { //默认按键 KeyManager.press(KeyEnum.KEY_W); KeyManager.press(KeyEnum.KEY_SPACE); System.out.println("=============================================================================================================="); //将角色跳跃的快捷键进行替换 KeyManager.setCustomKey(new RoleJumpCommand(), KeyEnum.KEY_SPACE, KeyEnum.KEY_ENTER); KeyManager.press(KeyEnum.KEY_SPACE); KeyManager.press(KeyEnum.KEY_ENTER); System.out.println("=============================================================================================================="); //自定义宏命令:角色前进、释放技能:潜行术、释放技能:火球术,并将其绑定在按键A KeyManager.press(KeyEnum.KEY_A); List<Command> commandList = Lists.newArrayList( new RoleForwardCommand(), new ReleaseSneakCommand(), new ReleaseFireBallCommand() ); KeyManager.setCustomKey(new MacroCommand(commandList), null, KeyEnum.KEY_A); KeyManager.press(KeyEnum.KEY_A); } }
1,562
0.588843
0.588843
38
37.210526
36.192581
141
false
false
0
0
0
0
110
0.151515
0.631579
false
false
2
13d298eaa02a2267d52e6f18d822408259622db6
6,554,120,142,658
5e4c4761ca5ec533ef5ad57cf56204c0ffee7e76
/Weight.java
13f3fcb99111bd4814d4ba5eb1ab079cbc2f9679
[]
no_license
artemmakarov/java_examples
https://github.com/artemmakarov/java_examples
7eec4c2572e650f7c5d86a4df862a93f3b880ae4
951d8d758080709eefebc8ca54fff0d70f23e1e1
refs/heads/master
2021-01-12T07:15:43.098000
2017-01-26T07:59:49
2017-01-26T07:59:49
76,925,578
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Weight { public static void main (String args[]){ double weightEarth; double weightMoon; weightEarth = 60; weightMoon = (weightEarth * 17 / 100); System.out.println (weightMoon); } }
UTF-8
Java
201
java
Weight.java
Java
[]
null
[]
class Weight { public static void main (String args[]){ double weightEarth; double weightMoon; weightEarth = 60; weightMoon = (weightEarth * 17 / 100); System.out.println (weightMoon); } }
201
0.691542
0.656716
10
19.200001
14.675149
41
false
false
0
0
0
0
0
0
1.7
false
false
2
413e9b82ce0a33a23a4030779fb9f3e5436b4389
18,691,697,683,227
d039c42522a86c0b859d1444a6a66236fa2a3bb3
/src/main/java/com/dkthanh/demo/domain/RoleEntity.java
beec8004c220f6a600a0efd47867d7e9cb1392c2
[]
no_license
thanhdaoky/crowdfunding
https://github.com/thanhdaoky/crowdfunding
da0aa210584958e8b79b71786fea5630b441304a
04a91526daf32049420f391d94f73bc5d8722e59
refs/heads/master
2023-07-13T08:03:04.041000
2021-08-18T13:33:47
2021-08-18T13:33:47
273,655,786
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dkthanh.demo.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import java.util.Set; @Entity @Table(name = "role", schema = "demo", catalog = "") @Data @NoArgsConstructor @AllArgsConstructor public class RoleEntity { @Id @Column(name = "role_id", nullable = false) private Integer roleId; @Column(name = "role_name", nullable = true, length = 255) private String roleName; @ManyToMany(mappedBy = "roles") Set<UserEntity> users; public RoleEntity(Integer roleId, String roleName) { this.roleId = roleId; this.roleName = roleName; } }
UTF-8
Java
675
java
RoleEntity.java
Java
[]
null
[]
package com.dkthanh.demo.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import java.util.Set; @Entity @Table(name = "role", schema = "demo", catalog = "") @Data @NoArgsConstructor @AllArgsConstructor public class RoleEntity { @Id @Column(name = "role_id", nullable = false) private Integer roleId; @Column(name = "role_name", nullable = true, length = 255) private String roleName; @ManyToMany(mappedBy = "roles") Set<UserEntity> users; public RoleEntity(Integer roleId, String roleName) { this.roleId = roleId; this.roleName = roleName; } }
675
0.693333
0.688889
29
22.275862
17.590939
62
false
false
0
0
0
0
0
0
0.586207
false
false
2
d2f5a6f2d9455ed28aae9edf289c0ea773adcf43
24,678,882,090,720
075a3f3cd420be77aef9891b8f29c465b1db2481
/app/src/main/java/com/project/gagan/instagram_gagan/FollowActivityAdapter.java
98147e39beb50b647ed8fceb944b0d7efcae3742
[]
no_license
siftnoorsingh/InstagramViewer
https://github.com/siftnoorsingh/InstagramViewer
f7ccdbce5b0b74890abbe99198072e69c9e3f8dc
6480fe51a3efc63467ca33c130493f421fe42629
refs/heads/master
2021-01-10T03:20:24.032000
2015-10-13T19:45:07
2015-10-13T19:45:07
47,064,374
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.project.gagan.instagram_gagan; import android.content.Context; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseFile; import com.parse.ParseImageView; import com.parse.ParseObject; import com.parse.ParseQuery; import com.parse.ParseQueryAdapter; import com.parse.ParseUser; import java.util.Arrays; import java.util.List; /** * Created by Fenglin on 13/10/2015. * This adapter handles the display of the followers' activities in follow_tab */ public class FollowActivityAdapter extends ParseQueryAdapter<ParseObject> { public FollowActivityAdapter(final Context context) { super(context, new ParseQueryAdapter.QueryFactory<ParseObject>() { public ParseQuery<ParseObject> create() { ParseQuery followingActivitiesQuery2 = new ParseQuery("Activity"); followingActivitiesQuery2.whereEqualTo("toUser", ParseUser.getCurrentUser()); return followingActivitiesQuery2; } }); } @Override public View getItemView(ParseObject activity, View v, ViewGroup parent) { if (v == null) { v = View.inflate(getContext(), R.layout.follow_bottom_layout, null); } super.getItemView(activity, v, parent); final String type = activity.getString("type"); TextView uploadedAt = (TextView) v.findViewById(R.id.timestamp_bottom); String date = activity.getCreatedAt().toString(); String dateString = " "; String[] tokens = date.split(dateString); // Convert the time into a another format int timetoken = tokens.length; String time = ""; for (int i = 0; i < timetoken; i++) { if (i == 1) { time = time + tokens[i]; } else if (i == 2 || i == (timetoken - 1)) { time = time + "," + tokens[i]; } } // set time uploadedAt.setText(time); // set description TextView descriptionImage = (TextView) v.findViewById(R.id.imageDescription_bottom); // get username from the pointer in Activity table ParseObject parseObject = ParseObject.create("Activity"); parseObject = activity.getParseObject("fromUser"); String u = parseObject.getString("username"); // check for each type of activity, show different text if (type.equals("follow")) { descriptionImage.setText(u + " has started to follow you"); } else if (type.equals("comment")) { descriptionImage.setText(u + " has commented your photo"); } else if (type.equals("like")) { descriptionImage.setText(u + " has liked your photo"); } return v; } }
UTF-8
Java
2,892
java
FollowActivityAdapter.java
Java
[ { "context": ".Arrays;\nimport java.util.List;\n\n/**\n * Created by Fenglin on 13/10/2015.\n * This adapter handles the ", "end": 509, "score": 0.575377881526947, "start": 508, "tag": "NAME", "value": "F" }, { "context": "rrays;\nimport java.util.List;\n\n/**\n * Created by Fenglin on 13/10/2015.\n * This adapter handles the displa", "end": 515, "score": 0.892673909664154, "start": 509, "tag": "USERNAME", "value": "englin" } ]
null
[]
package com.project.gagan.instagram_gagan; import android.content.Context; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseFile; import com.parse.ParseImageView; import com.parse.ParseObject; import com.parse.ParseQuery; import com.parse.ParseQueryAdapter; import com.parse.ParseUser; import java.util.Arrays; import java.util.List; /** * Created by Fenglin on 13/10/2015. * This adapter handles the display of the followers' activities in follow_tab */ public class FollowActivityAdapter extends ParseQueryAdapter<ParseObject> { public FollowActivityAdapter(final Context context) { super(context, new ParseQueryAdapter.QueryFactory<ParseObject>() { public ParseQuery<ParseObject> create() { ParseQuery followingActivitiesQuery2 = new ParseQuery("Activity"); followingActivitiesQuery2.whereEqualTo("toUser", ParseUser.getCurrentUser()); return followingActivitiesQuery2; } }); } @Override public View getItemView(ParseObject activity, View v, ViewGroup parent) { if (v == null) { v = View.inflate(getContext(), R.layout.follow_bottom_layout, null); } super.getItemView(activity, v, parent); final String type = activity.getString("type"); TextView uploadedAt = (TextView) v.findViewById(R.id.timestamp_bottom); String date = activity.getCreatedAt().toString(); String dateString = " "; String[] tokens = date.split(dateString); // Convert the time into a another format int timetoken = tokens.length; String time = ""; for (int i = 0; i < timetoken; i++) { if (i == 1) { time = time + tokens[i]; } else if (i == 2 || i == (timetoken - 1)) { time = time + "," + tokens[i]; } } // set time uploadedAt.setText(time); // set description TextView descriptionImage = (TextView) v.findViewById(R.id.imageDescription_bottom); // get username from the pointer in Activity table ParseObject parseObject = ParseObject.create("Activity"); parseObject = activity.getParseObject("fromUser"); String u = parseObject.getString("username"); // check for each type of activity, show different text if (type.equals("follow")) { descriptionImage.setText(u + " has started to follow you"); } else if (type.equals("comment")) { descriptionImage.setText(u + " has commented your photo"); } else if (type.equals("like")) { descriptionImage.setText(u + " has liked your photo"); } return v; } }
2,892
0.634855
0.629668
96
29.125
26.764502
93
false
false
0
0
0
0
0
0
0.5625
false
false
2
beaa4ca6bc0e60d6154402330ec8da1ce7397174
30,674,656,450,730
8651815d220ced94baf6d3b4559b3d8e86931b91
/PR211-SQLiteRoom/app/src/main/java/es/iessaladillo/pedrojoya/pr211/Constants.java
4cc4b2a33f246096c8f3d0fb10b1fded72e7227f
[]
no_license
OmarObispoUX/studio
https://github.com/OmarObispoUX/studio
f23ee4a488c3c124afaab6e522d6540e0e89764a
a5fc52f835ee180f7cdec4999fab0eabd0f1f710
refs/heads/master
2020-03-17T02:05:05.950000
2018-05-08T17:03:28
2018-05-08T17:03:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.iessaladillo.pedrojoya.pr211; public class Constants { public static final String EXTRA_STUDENT_ID = "EXTRA_STUDENT_ID"; public static final String DATABASE_NAME = "instituto"; private Constants() { } }
UTF-8
Java
233
java
Constants.java
Java
[]
null
[]
package es.iessaladillo.pedrojoya.pr211; public class Constants { public static final String EXTRA_STUDENT_ID = "EXTRA_STUDENT_ID"; public static final String DATABASE_NAME = "instituto"; private Constants() { } }
233
0.712446
0.699571
10
22.299999
24.690281
69
false
false
0
0
0
0
0
0
0.3
false
false
2
cc1b3c8cb8c4e61c7887cdd23cfed09361d0467f
17,282,948,424,371
4f1429d6ebe4cff1068be051e855c5fcc1a178a0
/plugins/net.bioclipse.biojava.ui/src/net/bioclipse/biojava/ui/views/outline/AlignmentOutlinePage.java
44667bcb2ed2e53addd825c6cc85bc5b98905a6e
[]
no_license
miquelrojascherto/bioclipse.bioinformatics
https://github.com/miquelrojascherto/bioclipse.bioinformatics
4793477e942d36513916294002090d57dfb683a2
19426f746db88b4b652d38e5fe11b3650e141052
refs/heads/master
2021-01-18T01:56:07.946000
2009-06-03T12:38:33
2009-07-15T11:50:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.bioclipse.biojava.ui.views.outline; import java.awt.FlowLayout; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import net.bioclipse.biojava.ui.editors.Aligner; import net.bioclipse.biojava.ui.editors.AlignmentEditor; import org.biojava.bio.BioException; import org.biojava.bio.seq.Sequence; import org.biojava.bio.seq.SequenceIterator; import org.biojavax.bio.seq.RichSequence.IOTools; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.part.Page; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; public class AlignmentOutlinePage extends Page implements IContentOutlinePage, ISelectionListener, IAdaptable { private int squareSize = 8; private final static int MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS = 8; private int canvasWidthInSquares, canvasHeightInSquares; private IEditorInput input; private AlignmentEditor editor; private Canvas sequenceCanvas; // seqname, sequence private Map<String, String> sequences; private int consensusRow; public AlignmentOutlinePage(IEditorInput input, AlignmentEditor editor) { super(); setInput(input); } public void setInput( IEditorInput input ) { this.input = input; sequences = new LinkedHashMap<String, String>(); // Turn the editor input into an IFile. IFile file = (IFile) input.getAdapter( IFile.class ); if (file == null) return; SequenceIterator iter; try { // Create a BufferedInputStream for our IFile. BufferedReader br = new BufferedReader(new InputStreamReader(file.getContents())); // Create an iterator from the BufferedInputStream. // We have to generalize this from just proteins to anything. // The 'null' indicates that we don't care about which // namespace the sequence ends up getting. iter = IOTools.readFastaProtein( br, null ); } catch ( CoreException ce ) { // File not found. TODO: This should be logged. ce.printStackTrace(); return; } try { // Add the sequences one by one to the Map. Do minor cosmetics // on the name by removing everything up to and including to // the last '|', if any. while ( iter.hasNext() ) { Sequence s = iter.nextSequence(); String name = s.getName().replaceFirst( ".*\\|", "" ); sequences.put( name, s.seqString() ); } } catch ( BioException e ) { // There was a parsing error. TODO: This should be logged. e.printStackTrace(); } // We only show a consensus sequence if there is more than one // sequence already. consensusRow = sequences.size(); if (consensusRow > 1) { sequences.put( "Consensus", consensusSequence( sequences.values() ) ); } canvasHeightInSquares = sequences.size(); canvasWidthInSquares = maxLength( sequences.values() ); } private static String consensusSequence( final Collection<String> sequences ) { final StringBuilder consensus = new StringBuilder(); for ( int i = 0, n = maxLength(sequences); i < n; ++i ) consensus.append( consensusChar(sequences, i) ); return consensus.toString(); } private static int maxLength( final Collection<String> strings ) { int maxLength = 0; for ( String s : strings ) if ( maxLength < s.length() ) maxLength = s.length(); return maxLength; } private static char consensusChar( final Collection<String> sequences, final int index ) { Map<Character, Boolean> columnChars = new HashMap<Character, Boolean>(); for ( String seq : sequences ) columnChars.put( seq.length() > index ? seq.charAt(index) : '\0', true ); return columnChars.size() == 1 ? columnChars.keySet().iterator().next() : Character.forDigit( Math.min(columnChars.size(), 9), 10 ); } public void createControl(Composite parent) { sequenceCanvas = new Canvas( parent, SWT.H_SCROLL ); sequenceCanvas.setSize( canvasWidthInSquares*squareSize,canvasHeightInSquares*squareSize ); ScrollBar sb =sequenceCanvas.getHorizontalBar(); sb.setMaximum( canvasWidthInSquares ); sb.addSelectionListener( new SelectionListener(){ public void widgetDefaultSelected( SelectionEvent e ) { // TODO Auto-generated method stub } public void widgetSelected( SelectionEvent e ) { sequenceCanvas.redraw(); } }); final char fasta[][] = new char[ sequences.size() ][]; { int i = 0; for ( String sequence : sequences.values() ) fasta[i++] = sequence.toCharArray(); } sequenceCanvas.addPaintListener( new PaintListener() { public void paintControl(PaintEvent e) { GC gc = e.gc; if ( squareSize >= MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS ) { gc.setTextAntialias( SWT.ON ); gc.setFont( new Font(gc.getDevice(), "Arial", (int)(.7 * squareSize), SWT.NONE) ); gc.setForeground( Aligner.textColor ); } // int firstVisibleColumn // = sc.getHorizontalBar().getSelection() / squareSize, // lastVisibleColumn // = firstVisibleColumn // + sc.getBounds().width / squareSize // + 2; // compensate for 2 possible round-downs int firstVisibleColumn = sequenceCanvas.getHorizontalBar().getSelection(), lastVisibleColumn = sequences.values().iterator().next().length(); drawSequences(fasta, firstVisibleColumn, lastVisibleColumn, gc); drawConsensusSequence( fasta[canvasHeightInSquares-1], firstVisibleColumn, lastVisibleColumn, gc); } private void drawSequences( final char[][] fasta, int firstVisibleColumn, int lastVisibleColumn, GC gc ) { int xCoord = 0; for ( int column = firstVisibleColumn; column < lastVisibleColumn; ++column ) { for ( int row = 0; row < canvasHeightInSquares-1; ++row ) { char c = fasta[row].length > column ? fasta[row][column] : ' '; String cc = c + ""; gc.setBackground( "HKR".contains( cc ) ? Aligner.basicAAColor : "DE".contains( cc ) ? Aligner.acidicAAColor : "TQSN".contains( cc ) ? Aligner.polarAAColor : "FYW".contains( cc ) ? Aligner.nonpolarAAColor : "GP".contains( cc ) ? Aligner.smallAAColor : 'C' == c ? Aligner.cysteineColor : Aligner.normalAAColor ); int yCoord = row * squareSize; gc.fillRectangle(xCoord, yCoord, squareSize, squareSize); if ( Character.isUpperCase( c ) && squareSize >= MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS ) gc.drawText( "" + c, xCoord + 4, yCoord + 2 ); } xCoord += squareSize; } } private void drawConsensusSequence( final char[] sequence, int firstVisibleColumn, int lastVisibleColumn, GC gc ) { int yCoord = (canvasHeightInSquares-1) * squareSize; int xCoord = 0; for ( int column = firstVisibleColumn; column < lastVisibleColumn; ++column ) { char c = sequence.length > column ? sequence[column] : ' '; int consensusDegree = Character.isDigit(c) ? c - '0' : 1; gc.setBackground( Aligner.consensusColors[ consensusDegree-1 ]); gc.fillRectangle(xCoord, yCoord, squareSize, squareSize); if ( Character.isUpperCase( c ) && squareSize >= MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS ) gc.drawText( "" + c, xCoord + 4, yCoord + 2 ); xCoord += squareSize; } } }); } public void selectionChanged( IWorkbenchPart part, ISelection selection ) { } public Object getAdapter( Class adapter ) { return null; } @Override public Control getControl() { return sequenceCanvas; } @Override public void setFocus() { } public void addSelectionChangedListener( ISelectionChangedListener listener) { } public ISelection getSelection() { // TODO Auto-generated method stub return null; } public void removeSelectionChangedListener( ISelectionChangedListener listener ) { } public void setSelection( ISelection selection ) { } }
UTF-8
Java
11,697
java
AlignmentOutlinePage.java
Java
[]
null
[]
package net.bioclipse.biojava.ui.views.outline; import java.awt.FlowLayout; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import net.bioclipse.biojava.ui.editors.Aligner; import net.bioclipse.biojava.ui.editors.AlignmentEditor; import org.biojava.bio.BioException; import org.biojava.bio.seq.Sequence; import org.biojava.bio.seq.SequenceIterator; import org.biojavax.bio.seq.RichSequence.IOTools; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.part.Page; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; public class AlignmentOutlinePage extends Page implements IContentOutlinePage, ISelectionListener, IAdaptable { private int squareSize = 8; private final static int MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS = 8; private int canvasWidthInSquares, canvasHeightInSquares; private IEditorInput input; private AlignmentEditor editor; private Canvas sequenceCanvas; // seqname, sequence private Map<String, String> sequences; private int consensusRow; public AlignmentOutlinePage(IEditorInput input, AlignmentEditor editor) { super(); setInput(input); } public void setInput( IEditorInput input ) { this.input = input; sequences = new LinkedHashMap<String, String>(); // Turn the editor input into an IFile. IFile file = (IFile) input.getAdapter( IFile.class ); if (file == null) return; SequenceIterator iter; try { // Create a BufferedInputStream for our IFile. BufferedReader br = new BufferedReader(new InputStreamReader(file.getContents())); // Create an iterator from the BufferedInputStream. // We have to generalize this from just proteins to anything. // The 'null' indicates that we don't care about which // namespace the sequence ends up getting. iter = IOTools.readFastaProtein( br, null ); } catch ( CoreException ce ) { // File not found. TODO: This should be logged. ce.printStackTrace(); return; } try { // Add the sequences one by one to the Map. Do minor cosmetics // on the name by removing everything up to and including to // the last '|', if any. while ( iter.hasNext() ) { Sequence s = iter.nextSequence(); String name = s.getName().replaceFirst( ".*\\|", "" ); sequences.put( name, s.seqString() ); } } catch ( BioException e ) { // There was a parsing error. TODO: This should be logged. e.printStackTrace(); } // We only show a consensus sequence if there is more than one // sequence already. consensusRow = sequences.size(); if (consensusRow > 1) { sequences.put( "Consensus", consensusSequence( sequences.values() ) ); } canvasHeightInSquares = sequences.size(); canvasWidthInSquares = maxLength( sequences.values() ); } private static String consensusSequence( final Collection<String> sequences ) { final StringBuilder consensus = new StringBuilder(); for ( int i = 0, n = maxLength(sequences); i < n; ++i ) consensus.append( consensusChar(sequences, i) ); return consensus.toString(); } private static int maxLength( final Collection<String> strings ) { int maxLength = 0; for ( String s : strings ) if ( maxLength < s.length() ) maxLength = s.length(); return maxLength; } private static char consensusChar( final Collection<String> sequences, final int index ) { Map<Character, Boolean> columnChars = new HashMap<Character, Boolean>(); for ( String seq : sequences ) columnChars.put( seq.length() > index ? seq.charAt(index) : '\0', true ); return columnChars.size() == 1 ? columnChars.keySet().iterator().next() : Character.forDigit( Math.min(columnChars.size(), 9), 10 ); } public void createControl(Composite parent) { sequenceCanvas = new Canvas( parent, SWT.H_SCROLL ); sequenceCanvas.setSize( canvasWidthInSquares*squareSize,canvasHeightInSquares*squareSize ); ScrollBar sb =sequenceCanvas.getHorizontalBar(); sb.setMaximum( canvasWidthInSquares ); sb.addSelectionListener( new SelectionListener(){ public void widgetDefaultSelected( SelectionEvent e ) { // TODO Auto-generated method stub } public void widgetSelected( SelectionEvent e ) { sequenceCanvas.redraw(); } }); final char fasta[][] = new char[ sequences.size() ][]; { int i = 0; for ( String sequence : sequences.values() ) fasta[i++] = sequence.toCharArray(); } sequenceCanvas.addPaintListener( new PaintListener() { public void paintControl(PaintEvent e) { GC gc = e.gc; if ( squareSize >= MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS ) { gc.setTextAntialias( SWT.ON ); gc.setFont( new Font(gc.getDevice(), "Arial", (int)(.7 * squareSize), SWT.NONE) ); gc.setForeground( Aligner.textColor ); } // int firstVisibleColumn // = sc.getHorizontalBar().getSelection() / squareSize, // lastVisibleColumn // = firstVisibleColumn // + sc.getBounds().width / squareSize // + 2; // compensate for 2 possible round-downs int firstVisibleColumn = sequenceCanvas.getHorizontalBar().getSelection(), lastVisibleColumn = sequences.values().iterator().next().length(); drawSequences(fasta, firstVisibleColumn, lastVisibleColumn, gc); drawConsensusSequence( fasta[canvasHeightInSquares-1], firstVisibleColumn, lastVisibleColumn, gc); } private void drawSequences( final char[][] fasta, int firstVisibleColumn, int lastVisibleColumn, GC gc ) { int xCoord = 0; for ( int column = firstVisibleColumn; column < lastVisibleColumn; ++column ) { for ( int row = 0; row < canvasHeightInSquares-1; ++row ) { char c = fasta[row].length > column ? fasta[row][column] : ' '; String cc = c + ""; gc.setBackground( "HKR".contains( cc ) ? Aligner.basicAAColor : "DE".contains( cc ) ? Aligner.acidicAAColor : "TQSN".contains( cc ) ? Aligner.polarAAColor : "FYW".contains( cc ) ? Aligner.nonpolarAAColor : "GP".contains( cc ) ? Aligner.smallAAColor : 'C' == c ? Aligner.cysteineColor : Aligner.normalAAColor ); int yCoord = row * squareSize; gc.fillRectangle(xCoord, yCoord, squareSize, squareSize); if ( Character.isUpperCase( c ) && squareSize >= MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS ) gc.drawText( "" + c, xCoord + 4, yCoord + 2 ); } xCoord += squareSize; } } private void drawConsensusSequence( final char[] sequence, int firstVisibleColumn, int lastVisibleColumn, GC gc ) { int yCoord = (canvasHeightInSquares-1) * squareSize; int xCoord = 0; for ( int column = firstVisibleColumn; column < lastVisibleColumn; ++column ) { char c = sequence.length > column ? sequence[column] : ' '; int consensusDegree = Character.isDigit(c) ? c - '0' : 1; gc.setBackground( Aligner.consensusColors[ consensusDegree-1 ]); gc.fillRectangle(xCoord, yCoord, squareSize, squareSize); if ( Character.isUpperCase( c ) && squareSize >= MINIMUM_SQUARE_SIZE_FOR_TEXT_IN_PIXELS ) gc.drawText( "" + c, xCoord + 4, yCoord + 2 ); xCoord += squareSize; } } }); } public void selectionChanged( IWorkbenchPart part, ISelection selection ) { } public Object getAdapter( Class adapter ) { return null; } @Override public Control getControl() { return sequenceCanvas; } @Override public void setFocus() { } public void addSelectionChangedListener( ISelectionChangedListener listener) { } public ISelection getSelection() { // TODO Auto-generated method stub return null; } public void removeSelectionChangedListener( ISelectionChangedListener listener ) { } public void setSelection( ISelection selection ) { } }
11,697
0.527058
0.52475
321
35.439251
24.856039
99
false
false
0
0
0
0
0
0
0.53271
false
false
2
70d38b84ed455a32af9dfe5064cb0afde410faae
16,707,422,809,117
c0d1dbd59031c2b17c98669b49ee6f1195dc3c2d
/Online_Movie/src/main/java/com/capgemini/online_movie/controller/BookingController.java
f149fdb646eaf2f31c376fdbb82495bd10fa25f9
[]
no_license
animeshbindal/Sprint2
https://github.com/animeshbindal/Sprint2
e7dcb72e446e9e50e08f9a1d879e436309318ad7
a352d88a71a5d8837ccb445eb0c1a36a205ddc7b
refs/heads/master
2022-09-10T02:31:20.098000
2020-05-25T03:51:45
2020-05-25T03:51:45
261,259,852
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.capgemini.online_movie.controller; public class BookingController { }
UTF-8
Java
89
java
BookingController.java
Java
[]
null
[]
package com.capgemini.online_movie.controller; public class BookingController { }
89
0.764045
0.764045
5
15.8
19.456619
46
false
false
0
0
0
0
0
0
0.2
false
false
2
12e6e8b2deb7d7720f835d392f838b5008d5685d
21,053,929,685,827
afb585509e5bc7822ed744a0a591eb4e39f98144
/src/MyClass.java
29b4a230dfeccaad9700f21f1498cd8673dc3c5d
[]
no_license
LevOrlov/basejava
https://github.com/LevOrlov/basejava
49bc95368cf901d1c2cb7302969bec1d706d2088
76bee7ee630e50b9ef1487023ba8e4285c64800f
refs/heads/master
2021-05-11T02:05:57.082000
2018-05-22T17:48:35
2018-05-22T17:48:35
118,349,966
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; class FileVisitor implements java.nio.file.FileVisitor<Path> { public FileVisitResult visitFile(Path path, BasicFileAttributes fileAttributes) { // System.out.println("file name:" + path.getFileName()); return FileVisitResult.CONTINUE; } public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes fileAttributes) { for (int i = 3; i < path.getNameCount(); i++) { System.out.print("\t"); } System.out.println("Directory name:" + path); return FileVisitResult.CONTINUE; } public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { System.out.println("visitFileFailed: " + file); return FileVisitResult.CONTINUE; } public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { //System.out.println("postVisitDirectory: " + dir); return FileVisitResult.CONTINUE; } } public class MyClass { /* public static void main(String args[]) throws IOException, ClassNotFoundException { FileOutputStream fos = new FileOutputStream("temp.out"); ObjectOutputStream oos = new ObjectOutputStream(fos); TestSerial ts = new TestSerial(); oos.writeObject(ts); oos.flush(); oos.close(); //восставновление FileInputStream fis = new FileInputStream("temp.out"); ObjectInputStream oin = new ObjectInputStream(fis); TestSerial ts1 = (TestSerial) oin.readObject(); System.out.println("version="+ts.version); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().newDocument(); Node item = null; Node item1 = null; DocumentBuilder builder = domFactory.newDocumentBuilder(); Element root = doc.createElement("booking"); item = doc.createElement("bookingID"); item1 = doc.createElement("bookingID1"); item.appendChild(doc.createTextNode("115")); item1.appendChild(doc.createTextNode("1151111")); root.appendChild(item); root.appendChild(item1); doc.appendChild(root); File file = new File("C:\\Users\\Lev\\basejava\\temp1.xml"); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(new DOMSource(doc), new StreamResult(file)); // System.out.print(doc.getDocumentElement().getSchemaTypeInfo()); Document document = builder.parse(new File("C:\\Users\\Lev\\basejava\\temp1.xml")); XPath xPath = XPathFactory.newInstance().newXPath(); Node node = (Node) xPath.evaluate("/booking/bookingID1", document, XPathConstants.NODE); System.out.println(node.getTextContent()); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (XPathExpressionException e) { e.printStackTrace(); } }*/ /* //STREAM public static void main(String[] args) { Stream.of(1, 2, 3) .forEach(System.out::println); }*/ /* public static void main(String[] args) { Path pathSource = Paths.get("C:\\Users\\Lev\\basejava\\temp.out"); try { Files.createFile(pathSource); // Files.delete(pathSource); System.out.println("File deleted successfully"); } catch (IOException e) { e.printStackTrace(); } }*/ public static void main(String[] args) throws IOException { System.out.println(null == null); /*Path pathSource = Paths.get("C:/Users/Lev/basejava"); String path; path = pathSource+"\\kdkd"; pathSource=Paths.get(path); System.out.println(pathSource.getFileName());*/ /* try { Files.walkFileTree(pathSource, new FileVisitor()); } catch (IOException e) { e.printStackTrace(); }*/ /*String pathString = "C:\\Users\\Lev\\basejava"; Files.walkFileTree(Paths.get(pathString), new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { System.out.println("preVisitDirectory: " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println("visitFile: " + file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { System.out.println("visitFileFailed: " + file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { System.out.println("postVisitDirectory: " + dir); return FileVisitResult.CONTINUE; } }); */ } }
UTF-8
Java
6,011
java
MyClass.java
Java
[]
null
[]
import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; class FileVisitor implements java.nio.file.FileVisitor<Path> { public FileVisitResult visitFile(Path path, BasicFileAttributes fileAttributes) { // System.out.println("file name:" + path.getFileName()); return FileVisitResult.CONTINUE; } public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes fileAttributes) { for (int i = 3; i < path.getNameCount(); i++) { System.out.print("\t"); } System.out.println("Directory name:" + path); return FileVisitResult.CONTINUE; } public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { System.out.println("visitFileFailed: " + file); return FileVisitResult.CONTINUE; } public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { //System.out.println("postVisitDirectory: " + dir); return FileVisitResult.CONTINUE; } } public class MyClass { /* public static void main(String args[]) throws IOException, ClassNotFoundException { FileOutputStream fos = new FileOutputStream("temp.out"); ObjectOutputStream oos = new ObjectOutputStream(fos); TestSerial ts = new TestSerial(); oos.writeObject(ts); oos.flush(); oos.close(); //восставновление FileInputStream fis = new FileInputStream("temp.out"); ObjectInputStream oin = new ObjectInputStream(fis); TestSerial ts1 = (TestSerial) oin.readObject(); System.out.println("version="+ts.version); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().newDocument(); Node item = null; Node item1 = null; DocumentBuilder builder = domFactory.newDocumentBuilder(); Element root = doc.createElement("booking"); item = doc.createElement("bookingID"); item1 = doc.createElement("bookingID1"); item.appendChild(doc.createTextNode("115")); item1.appendChild(doc.createTextNode("1151111")); root.appendChild(item); root.appendChild(item1); doc.appendChild(root); File file = new File("C:\\Users\\Lev\\basejava\\temp1.xml"); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(new DOMSource(doc), new StreamResult(file)); // System.out.print(doc.getDocumentElement().getSchemaTypeInfo()); Document document = builder.parse(new File("C:\\Users\\Lev\\basejava\\temp1.xml")); XPath xPath = XPathFactory.newInstance().newXPath(); Node node = (Node) xPath.evaluate("/booking/bookingID1", document, XPathConstants.NODE); System.out.println(node.getTextContent()); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (XPathExpressionException e) { e.printStackTrace(); } }*/ /* //STREAM public static void main(String[] args) { Stream.of(1, 2, 3) .forEach(System.out::println); }*/ /* public static void main(String[] args) { Path pathSource = Paths.get("C:\\Users\\Lev\\basejava\\temp.out"); try { Files.createFile(pathSource); // Files.delete(pathSource); System.out.println("File deleted successfully"); } catch (IOException e) { e.printStackTrace(); } }*/ public static void main(String[] args) throws IOException { System.out.println(null == null); /*Path pathSource = Paths.get("C:/Users/Lev/basejava"); String path; path = pathSource+"\\kdkd"; pathSource=Paths.get(path); System.out.println(pathSource.getFileName());*/ /* try { Files.walkFileTree(pathSource, new FileVisitor()); } catch (IOException e) { e.printStackTrace(); }*/ /*String pathString = "C:\\Users\\Lev\\basejava"; Files.walkFileTree(Paths.get(pathString), new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { System.out.println("preVisitDirectory: " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println("visitFile: " + file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { System.out.println("visitFileFailed: " + file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { System.out.println("postVisitDirectory: " + dir); return FileVisitResult.CONTINUE; } }); */ } }
6,011
0.600734
0.596898
158
36.943039
26.438906
100
false
false
0
0
0
0
0
0
0.601266
false
false
2
d8c3edef3e126a06dd6c12936f3ac6bc026c0ac0
12,266,426,661,899
03e17e3b7aaeb4ae1d50e5b3677454c6f602081d
/src/main/java/ansraer/underworlds/mixin/common/OverworldBedrockMixin.java
e6dd8764305102aa1fb223142d87c5c12e453260
[ "CC0-1.0" ]
permissive
Ansraer/Underworlds
https://github.com/Ansraer/Underworlds
5c7dfd9f6aa6b8f987209646d34ec785221668e6
5ee93fbd10ec4b1be13552c033e6c227c12e1956
refs/heads/master
2020-06-16T10:43:45.774000
2019-11-02T17:47:01
2019-11-02T17:47:01
195,543,438
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ansraer.underworlds.mixin.common; import ansraer.underworlds.common.blocks.UnderworldsBlocks; import ansraer.underworlds.common.world.dimension.forgotten_depths.ForgottenDepthsChunkGenerator; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.noise.OctaveSimplexNoiseSampler; import net.minecraft.world.IWorld; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGeneratorConfig; import net.minecraft.world.gen.chunk.SurfaceChunkGenerator; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Random; /** * The purpose of this mixin is to replace Bedrock with our own custom block in the overworld. */ @Mixin(SurfaceChunkGenerator.class) public abstract class OverworldBedrockMixin { @Final @Shadow protected ChunkRandom random; OctaveSimplexNoiseSampler bedrockNoise; boolean isOverworld; @Inject(at = @At("RETURN"), method="Lnet/minecraft/world/gen/chunk/SurfaceChunkGenerator;<init>(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/biome/source/BiomeSource;IIILnet/minecraft/world/gen/chunk/ChunkGeneratorConfig;Z)V") private void constructor(IWorld iWorld_1, BiomeSource biomeSource_1, int int_1, int int_2, int int_3, ChunkGeneratorConfig chunkGeneratorConfig_1, boolean boolean_1, CallbackInfo ci){ if(iWorld_1.getDimension().getType() == DimensionType.OVERWORLD){ isOverworld = true; bedrockNoise = new OctaveSimplexNoiseSampler(this.random, 4); } else { isOverworld = false; } } /** * Replace the bedrock logic with our own */ @Inject(at = @At("HEAD"), method="Lnet/minecraft/world/gen/chunk/SurfaceChunkGenerator;buildBedrock(Lnet/minecraft/world/chunk/Chunk;Ljava/util/Random;)V", cancellable = true) private void generateBedrock(Chunk chunk, Random random, CallbackInfo ci){ //Don't apply our custom bedrock if we are not in in the Overworld. if(!isOverworld){ return; } BlockPos.Mutable blockPos$Mutable_1 = new BlockPos.Mutable(); int startX = chunk.getPos().getStartX(); int startZ = chunk.getPos().getStartZ(); double noiseMultiplier = 0.325D; BlockState bedrockBlock = UnderworldsBlocks.BEDROCK.getDefaultState(); for (BlockPos blockPos : BlockPos.iterate(startX, 0, startZ, startX + 15, 0, startZ + 15)) { //control this with a custom noise int bedrockHeight = (int) (12 + Math.round(bedrockNoise.sample(blockPos.getX() * noiseMultiplier, blockPos.getZ() * noiseMultiplier, true)) / 4.2); for (int y = 0; y <= bedrockHeight; y++) { chunk.setBlockState(blockPos$Mutable_1.set(blockPos.getX(), y, blockPos.getZ()), bedrockBlock, false); } } // we definitely don't want to generate the vanilla Bedrock ci.cancel(); } }
UTF-8
Java
3,384
java
OverworldBedrockMixin.java
Java
[]
null
[]
package ansraer.underworlds.mixin.common; import ansraer.underworlds.common.blocks.UnderworldsBlocks; import ansraer.underworlds.common.world.dimension.forgotten_depths.ForgottenDepthsChunkGenerator; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.noise.OctaveSimplexNoiseSampler; import net.minecraft.world.IWorld; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.chunk.ChunkGeneratorConfig; import net.minecraft.world.gen.chunk.SurfaceChunkGenerator; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Random; /** * The purpose of this mixin is to replace Bedrock with our own custom block in the overworld. */ @Mixin(SurfaceChunkGenerator.class) public abstract class OverworldBedrockMixin { @Final @Shadow protected ChunkRandom random; OctaveSimplexNoiseSampler bedrockNoise; boolean isOverworld; @Inject(at = @At("RETURN"), method="Lnet/minecraft/world/gen/chunk/SurfaceChunkGenerator;<init>(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/biome/source/BiomeSource;IIILnet/minecraft/world/gen/chunk/ChunkGeneratorConfig;Z)V") private void constructor(IWorld iWorld_1, BiomeSource biomeSource_1, int int_1, int int_2, int int_3, ChunkGeneratorConfig chunkGeneratorConfig_1, boolean boolean_1, CallbackInfo ci){ if(iWorld_1.getDimension().getType() == DimensionType.OVERWORLD){ isOverworld = true; bedrockNoise = new OctaveSimplexNoiseSampler(this.random, 4); } else { isOverworld = false; } } /** * Replace the bedrock logic with our own */ @Inject(at = @At("HEAD"), method="Lnet/minecraft/world/gen/chunk/SurfaceChunkGenerator;buildBedrock(Lnet/minecraft/world/chunk/Chunk;Ljava/util/Random;)V", cancellable = true) private void generateBedrock(Chunk chunk, Random random, CallbackInfo ci){ //Don't apply our custom bedrock if we are not in in the Overworld. if(!isOverworld){ return; } BlockPos.Mutable blockPos$Mutable_1 = new BlockPos.Mutable(); int startX = chunk.getPos().getStartX(); int startZ = chunk.getPos().getStartZ(); double noiseMultiplier = 0.325D; BlockState bedrockBlock = UnderworldsBlocks.BEDROCK.getDefaultState(); for (BlockPos blockPos : BlockPos.iterate(startX, 0, startZ, startX + 15, 0, startZ + 15)) { //control this with a custom noise int bedrockHeight = (int) (12 + Math.round(bedrockNoise.sample(blockPos.getX() * noiseMultiplier, blockPos.getZ() * noiseMultiplier, true)) / 4.2); for (int y = 0; y <= bedrockHeight; y++) { chunk.setBlockState(blockPos$Mutable_1.set(blockPos.getX(), y, blockPos.getZ()), bedrockBlock, false); } } // we definitely don't want to generate the vanilla Bedrock ci.cancel(); } }
3,384
0.725177
0.717494
81
40.777779
44.706173
234
false
false
0
0
0
0
0
0
0.851852
false
false
2
37dcb0af283b1db59c8550f442dd1db1a7033f3f
1,563,368,112,871
371d0d47a1613b461e0a1ecb98214982fdf73c56
/src/exception/ValorPrincipalVazioException.java
9d84a5574df41951fe5181bb47c3251467b8b799
[]
no_license
antoniocoj/Revisao.P1.DAS
https://github.com/antoniocoj/Revisao.P1.DAS
d5c26f5ddeb3560ac44f99685b8151dbfffbc6df
a72e8475da977b8f82294dbff4cb86ff511528ea
refs/heads/master
2020-03-27T22:59:11.053000
2018-09-04T02:42:20
2018-09-04T02:42:20
147,278,779
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package exception; public class ValorPrincipalVazioException extends ParametroException{ public static final String msg = "O valor principal eh igual a zero!"; public ValorPrincipalVazioException() { super(msg); } public ValorPrincipalVazioException(String msg) { super(msg); } }
UTF-8
Java
307
java
ValorPrincipalVazioException.java
Java
[]
null
[]
package exception; public class ValorPrincipalVazioException extends ParametroException{ public static final String msg = "O valor principal eh igual a zero!"; public ValorPrincipalVazioException() { super(msg); } public ValorPrincipalVazioException(String msg) { super(msg); } }
307
0.736156
0.736156
13
21.615385
25.572035
71
false
false
0
0
0
0
0
0
1.153846
false
false
2
d3bccdcfd0e61ff8a4f486738f272a757d870b30
23,545,010,740,704
61d8fd135b8ede5c4851668470ea41ba29ee2f21
/app/src/main/java/com/consideredhamster/yetanotherpixeldungeon/items/potions/PotionOfOvergrowth.java
0836c216f967f862e4e3d49121d4b8ae5a0c709e
[]
no_license
lazarish/EvenMorePixelDungeon
https://github.com/lazarish/EvenMorePixelDungeon
d3530e27ff609d08368b45716efba358f04c8410
66eedbe76b93f3c4f7e0d028364b5dcf991df0ba
refs/heads/master
2021-01-22T01:48:03.749000
2017-09-03T10:03:18
2017-09-03T10:03:18
102,237,571
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Pixel Dungeon * Copyright (C) 2012-2015 Oleg Dolya * * Yet Another Pixel Dungeon * Copyright (C) 2015-2016 Considered Hamster * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> */ package com.consideredhamster.yetanotherpixeldungeon.items.potions; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Random; import com.consideredhamster.yetanotherpixeldungeon.Assets; import com.consideredhamster.yetanotherpixeldungeon.Dungeon; import com.consideredhamster.yetanotherpixeldungeon.actors.blobs.Blob; import com.consideredhamster.yetanotherpixeldungeon.actors.blobs.Overgrowth; import com.consideredhamster.yetanotherpixeldungeon.levels.Level; import com.consideredhamster.yetanotherpixeldungeon.levels.Terrain; import com.consideredhamster.yetanotherpixeldungeon.scenes.GameScene; public class PotionOfOvergrowth extends Potion { public static final int BASE_VAL = 250; public static final int MODIFIER = 25; { name = "Potion of Overgrowth"; shortName = "Ov"; harmful = true; } @Override public void shatter( int cell ) { GameScene.add(Blob.seed(cell, BASE_VAL + MODIFIER * alchemySkill(), Overgrowth.class)); boolean mapUpdated = false; for (int n : Level.NEIGHBOURS5) { if( n == 0 || Random.Float() < 0.75f ) { int i = cell + n; int c = Dungeon.level.map[i]; switch (c) { case Terrain.EMPTY: case Terrain.EMPTY_DECO: case Terrain.EMBERS: Level.set(i, Terrain.GRASS); mapUpdated = true; break; case Terrain.GRASS: Level.set(i, Terrain.HIGH_GRASS); mapUpdated = true; break; } } } if (mapUpdated) { GameScene.updateMap(); Dungeon.observe(); } if (Dungeon.visible[cell]) { setKnown(); splash(cell); Sample.INSTANCE.play(Assets.SND_SHATTER); } } @Override public String desc() { return "This wondrous concoction fills the air around it with magical fumes, " + "forcing roots, grass and plants in its area of effect to grow at a greatly accelerated rate. " + "Apart from creating an instant cover, it can be thrown at your enemies to " + "stop them in their tracks or to re-decorate your garden."; } @Override public int price() { return isTypeKnown() ? 45 * quantity : super.price(); } }
UTF-8
Java
3,243
java
PotionOfOvergrowth.java
Java
[ { "context": "/*\n * Pixel Dungeon\n * Copyright (C) 2012-2015 Oleg Dolya\n *\n * Yet Another Pixel Dungeon\n * Copyright (C) ", "end": 57, "score": 0.9997612237930298, "start": 47, "tag": "NAME", "value": "Oleg Dolya" }, { "context": "t Another Pixel Dungeon\n * Copyright (C) 2015-2016 Considered Hamster\n *\n * This program is free software: you can redi", "end": 135, "score": 0.9958810806274414, "start": 117, "tag": "NAME", "value": "Considered Hamster" } ]
null
[]
/* * Pixel Dungeon * Copyright (C) 2012-2015 <NAME> * * Yet Another Pixel Dungeon * Copyright (C) 2015-2016 <NAME> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> */ package com.consideredhamster.yetanotherpixeldungeon.items.potions; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Random; import com.consideredhamster.yetanotherpixeldungeon.Assets; import com.consideredhamster.yetanotherpixeldungeon.Dungeon; import com.consideredhamster.yetanotherpixeldungeon.actors.blobs.Blob; import com.consideredhamster.yetanotherpixeldungeon.actors.blobs.Overgrowth; import com.consideredhamster.yetanotherpixeldungeon.levels.Level; import com.consideredhamster.yetanotherpixeldungeon.levels.Terrain; import com.consideredhamster.yetanotherpixeldungeon.scenes.GameScene; public class PotionOfOvergrowth extends Potion { public static final int BASE_VAL = 250; public static final int MODIFIER = 25; { name = "Potion of Overgrowth"; shortName = "Ov"; harmful = true; } @Override public void shatter( int cell ) { GameScene.add(Blob.seed(cell, BASE_VAL + MODIFIER * alchemySkill(), Overgrowth.class)); boolean mapUpdated = false; for (int n : Level.NEIGHBOURS5) { if( n == 0 || Random.Float() < 0.75f ) { int i = cell + n; int c = Dungeon.level.map[i]; switch (c) { case Terrain.EMPTY: case Terrain.EMPTY_DECO: case Terrain.EMBERS: Level.set(i, Terrain.GRASS); mapUpdated = true; break; case Terrain.GRASS: Level.set(i, Terrain.HIGH_GRASS); mapUpdated = true; break; } } } if (mapUpdated) { GameScene.updateMap(); Dungeon.observe(); } if (Dungeon.visible[cell]) { setKnown(); splash(cell); Sample.INSTANCE.play(Assets.SND_SHATTER); } } @Override public String desc() { return "This wondrous concoction fills the air around it with magical fumes, " + "forcing roots, grass and plants in its area of effect to grow at a greatly accelerated rate. " + "Apart from creating an instant cover, it can be thrown at your enemies to " + "stop them in their tracks or to re-decorate your garden."; } @Override public int price() { return isTypeKnown() ? 45 * quantity : super.price(); } }
3,227
0.636139
0.627197
102
30.794117
27.028431
100
false
false
0
0
0
0
0
0
0.686275
false
false
2
334ab2d7234dc151f9d54442c053ce58e805afdd
25,417,616,458,104
99d26bf1db8fc97326b7ea4099671257cde4c320
/Middleware/src/main/java/com/niit/controllers/FriendController.java
9f53f8b66abea730310b0418c4c535c2a336562a
[]
no_license
ManishRamesh/Collaboration-Platform
https://github.com/ManishRamesh/Collaboration-Platform
df121df533df9b9d9a856d2118f33b0ae15a18f0
05b1385a5cc6e3d4303fab4f6298a9b5ef2e01b0
refs/heads/master
2020-04-09T19:24:14.865000
2018-12-09T06:48:17
2018-12-09T06:48:17
160,542,520
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.niit.controllers; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.niit.dao.FriendDao; import com.niit.dao.UserDao; import com.niit.models.ErrorClazz; import com.niit.models.Friend; import com.niit.models.User; @Controller public class FriendController { @Autowired private FriendDao friendDao; @Autowired private UserDao userDao; @RequestMapping(value = "/suggestedUsers", method = RequestMethod.GET) public ResponseEntity<?> getAllSuggestedUsers(HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } List<User> suggestedUsers = friendDao.getAllSuggestedUsers(email); return new ResponseEntity<List<User>>(suggestedUsers, HttpStatus.OK); } @RequestMapping(value = "/pendingrequests", method = RequestMethod.GET) public ResponseEntity<?> pendingRequests(HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } List<Friend> pendingRequests = friendDao.getPendingRequests(email); return new ResponseEntity<List<Friend>>(pendingRequests, HttpStatus.OK); } @RequestMapping(value = "/friendrequest", method = RequestMethod.POST) public ResponseEntity<?> friendRequest(@RequestBody User toId, HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } User fromId = userDao.getUser(email); Friend friend = new Friend(); friend.setFromId(fromId); friend.setToId(toId); friend.setStatus('P'); friendDao.addFriendRequest(friend); return new ResponseEntity<Friend>(friend, HttpStatus.OK); } @RequestMapping(value = "/acceptrequest", method = RequestMethod.PUT) public ResponseEntity<?> acceptRequest(@RequestBody Friend friendRequest, HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } friendDao.acceptRequest(friendRequest); return new ResponseEntity<Void>(HttpStatus.OK); } @RequestMapping(value = "/deleterequest", method = RequestMethod.PUT) public ResponseEntity<?> deleteRequest(@RequestBody Friend friendRequest, HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } friendDao.deleteRequest(friendRequest); return new ResponseEntity<Void>(HttpStatus.OK); } @RequestMapping(value = "/friends", method = RequestMethod.GET) public ResponseEntity<?> listOfFriends(HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } List<User> friends = friendDao.listOfFriends(email); return new ResponseEntity<List<User>>(friends, HttpStatus.OK); } }
UTF-8
Java
4,112
java
FriendController.java
Java
[]
null
[]
package com.niit.controllers; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.niit.dao.FriendDao; import com.niit.dao.UserDao; import com.niit.models.ErrorClazz; import com.niit.models.Friend; import com.niit.models.User; @Controller public class FriendController { @Autowired private FriendDao friendDao; @Autowired private UserDao userDao; @RequestMapping(value = "/suggestedUsers", method = RequestMethod.GET) public ResponseEntity<?> getAllSuggestedUsers(HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } List<User> suggestedUsers = friendDao.getAllSuggestedUsers(email); return new ResponseEntity<List<User>>(suggestedUsers, HttpStatus.OK); } @RequestMapping(value = "/pendingrequests", method = RequestMethod.GET) public ResponseEntity<?> pendingRequests(HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } List<Friend> pendingRequests = friendDao.getPendingRequests(email); return new ResponseEntity<List<Friend>>(pendingRequests, HttpStatus.OK); } @RequestMapping(value = "/friendrequest", method = RequestMethod.POST) public ResponseEntity<?> friendRequest(@RequestBody User toId, HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } User fromId = userDao.getUser(email); Friend friend = new Friend(); friend.setFromId(fromId); friend.setToId(toId); friend.setStatus('P'); friendDao.addFriendRequest(friend); return new ResponseEntity<Friend>(friend, HttpStatus.OK); } @RequestMapping(value = "/acceptrequest", method = RequestMethod.PUT) public ResponseEntity<?> acceptRequest(@RequestBody Friend friendRequest, HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } friendDao.acceptRequest(friendRequest); return new ResponseEntity<Void>(HttpStatus.OK); } @RequestMapping(value = "/deleterequest", method = RequestMethod.PUT) public ResponseEntity<?> deleteRequest(@RequestBody Friend friendRequest, HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } friendDao.deleteRequest(friendRequest); return new ResponseEntity<Void>(HttpStatus.OK); } @RequestMapping(value = "/friends", method = RequestMethod.GET) public ResponseEntity<?> listOfFriends(HttpSession session) { String email = (String) session.getAttribute("email"); if (email == null) { ErrorClazz errorClazz = new ErrorClazz(5, "Unauthorized access..Please Login"); return new ResponseEntity<ErrorClazz>(errorClazz, HttpStatus.UNAUTHORIZED); } List<User> friends = friendDao.listOfFriends(email); return new ResponseEntity<List<User>>(friends, HttpStatus.OK); } }
4,112
0.751459
0.75
100
39.119999
29.893572
97
false
false
0
0
0
0
0
0
2.05
false
false
2
21ea665c52ba9bc7b1e4b6c92ba357420f07f3ac
4,595,615,018,647
a932beebef2e3e9cbf681f5cf161ddebaf603745
/geeksforgeeks/largest-subarray-of-0s-and-1s/java/GFG.java
b5486bd2b44ea7884b69db632d28a05df7aed3b9
[]
no_license
Tsimon-Dorakh/problem-solving
https://github.com/Tsimon-Dorakh/problem-solving
85e5bfa2d7b6248fb45b2de5ed096ec9c8f4d438
d5ea347c9a2763f6135ecde385d4b18bd6e40843
refs/heads/master
2021-10-27T19:17:55.356000
2021-10-16T15:26:45
2021-10-16T15:26:45
242,325,924
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; /** * Largest subarray of 0's and 1's * https://practice.geeksforgeeks.org/problems/largest-subarray-of-0s-and-1s/1 */ public class GFG { int maxLenOn3(int[] xs) { int max = 0; for (int i = 0; i < xs.length; i++) { for (int j = 0; j < xs.length; j++) { int c0 = 0; int c1 = 0; for (int k = i; k <= j; k++) { if (xs[k] == 0) c0++; else c1++; } if (c0 == c1) max = Math.max(max, c0 * 2); } } return max; } int maxLenOn2(int[] xs) { int max = 0; for (int i = 0; i < xs.length; i++) { int c0 = 0; int c1 = 0; for (int j = i; j < xs.length; j++) { if (xs[j] == 0) c0++; else c1++; if (c0 == c1) max = Math.max(max, c0 * 2); } } return max; } int maxLenOn(int[] xs) { for (int i = 0; i < xs.length; i++) { if (xs[i] == 0) xs[i] = -1; } int maxLen = 0; int cSum = 0; Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < xs.length; i++) { cSum += xs[i]; if (cSum == 0) { maxLen = i + 1; } else if (!map.containsKey(cSum)) { map.put(cSum, i); } else { maxLen = Math.max(maxLen, i - map.get(cSum)); } } return maxLen; } int maxLen(int[] xs) { return maxLenOn(xs); } public static void main(String[] args) { int[][] xss = readInput(new FastReader("input-00-0.txt")); // int[][] xss = readInput(new FastReader(System.in)); // print(xss); for (int[] xs : xss) { print(new GFG().maxLen(xs)); } } private static void println(int x) { System.out.println(x); } private static void println(long x) { System.out.println(x); } private static void print(Collection xs) { StringBuilder stringBuilder = new StringBuilder(xs.size() * 2); xs.forEach(x -> stringBuilder.append(x).append(" ")); System.out.println(stringBuilder.toString()); } private static void print(int x) { System.out.println(x); } private static void print(int[] xs) { for (int x : xs) { System.out.print(x + " "); } System.out.println(); } private static void print(int[][] xss) { for (int[] xs : xss) { print(xs); } } static int[][] readInput(FastReader fastReader) { int[][] xss = new int[fastReader.nextInt()][]; for (int i = 0; i < xss.length; i++) { xss[i] = new int[fastReader.nextInt()]; for (int j = 0; j < xss[i].length; j++) { xss[i][j] = fastReader.nextInt(); } } return xss; } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } public FastReader(InputStream inputStream) { br = new BufferedReader(new InputStreamReader(inputStream)); } public FastReader(String filename) { br = new BufferedReader(new InputStreamReader(GFG.class.getResourceAsStream(filename))); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
UTF-8
Java
4,531
java
GFG.java
Java
[]
null
[]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; /** * Largest subarray of 0's and 1's * https://practice.geeksforgeeks.org/problems/largest-subarray-of-0s-and-1s/1 */ public class GFG { int maxLenOn3(int[] xs) { int max = 0; for (int i = 0; i < xs.length; i++) { for (int j = 0; j < xs.length; j++) { int c0 = 0; int c1 = 0; for (int k = i; k <= j; k++) { if (xs[k] == 0) c0++; else c1++; } if (c0 == c1) max = Math.max(max, c0 * 2); } } return max; } int maxLenOn2(int[] xs) { int max = 0; for (int i = 0; i < xs.length; i++) { int c0 = 0; int c1 = 0; for (int j = i; j < xs.length; j++) { if (xs[j] == 0) c0++; else c1++; if (c0 == c1) max = Math.max(max, c0 * 2); } } return max; } int maxLenOn(int[] xs) { for (int i = 0; i < xs.length; i++) { if (xs[i] == 0) xs[i] = -1; } int maxLen = 0; int cSum = 0; Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < xs.length; i++) { cSum += xs[i]; if (cSum == 0) { maxLen = i + 1; } else if (!map.containsKey(cSum)) { map.put(cSum, i); } else { maxLen = Math.max(maxLen, i - map.get(cSum)); } } return maxLen; } int maxLen(int[] xs) { return maxLenOn(xs); } public static void main(String[] args) { int[][] xss = readInput(new FastReader("input-00-0.txt")); // int[][] xss = readInput(new FastReader(System.in)); // print(xss); for (int[] xs : xss) { print(new GFG().maxLen(xs)); } } private static void println(int x) { System.out.println(x); } private static void println(long x) { System.out.println(x); } private static void print(Collection xs) { StringBuilder stringBuilder = new StringBuilder(xs.size() * 2); xs.forEach(x -> stringBuilder.append(x).append(" ")); System.out.println(stringBuilder.toString()); } private static void print(int x) { System.out.println(x); } private static void print(int[] xs) { for (int x : xs) { System.out.print(x + " "); } System.out.println(); } private static void print(int[][] xss) { for (int[] xs : xss) { print(xs); } } static int[][] readInput(FastReader fastReader) { int[][] xss = new int[fastReader.nextInt()][]; for (int i = 0; i < xss.length; i++) { xss[i] = new int[fastReader.nextInt()]; for (int j = 0; j < xss[i].length; j++) { xss[i][j] = fastReader.nextInt(); } } return xss; } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } public FastReader(InputStream inputStream) { br = new BufferedReader(new InputStreamReader(inputStream)); } public FastReader(String filename) { br = new BufferedReader(new InputStreamReader(GFG.class.getResourceAsStream(filename))); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
4,531
0.44957
0.438976
189
22.973545
19.666111
80
false
false
0
0
0
0
0
0
0.455026
false
false
2
f4a4341f5138e78b0d918fc4f738589013d3e6bc
15,221,364,111,628
30f8091c2c9704c56002404bd71b96e516cc57e1
/app/src/main/java/com/example/myapp/ProdCommandéListAdapter.java
3dace1476a73ddedff180d75f5c1f50ea5aaa12b
[]
no_license
siwarbam/projectt
https://github.com/siwarbam/projectt
8a0f83167885fa45cc3bb2e21a0241e930fad28b
a70df28ea89886eabbfd0f8e2f86eb54aa1817bf
refs/heads/master
2020-05-26T01:07:28.442000
2019-05-22T15:28:34
2019-05-22T15:28:34
188,058,001
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.myapp; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import java.util.zip.Inflater; public class ProdCommandéListAdapter extends BaseAdapter{ private Context context; private ArrayList<ProduitCommandé> listproduitCommandés; private int layout ; public ProdCommandéListAdapter(Context context, int layout, ArrayList<ProduitCommandé> produitCommandés) { this.context = context ; this.layout = layout ; this.listproduitCommandés = produitCommandés ; } @Override public int getCount() { return listproduitCommandés.size(); } @Override public Object getItem(int position) { return listproduitCommandés.get(position); } @Override public long getItemId(int position) { return position; } private class ViewHolder{ TextView quantité , designation , prix , prixTot; } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; ViewHolder holder = new ViewHolder(); if (row == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(layout, null); holder.quantité = (TextView) row.findViewById(R.id.qte); holder.designation = (TextView) row.findViewById(R.id.des); holder.prix = (TextView) row.findViewById(R.id.ttc); holder.prixTot = (TextView) row.findViewById(R.id.pt); row.setTag(holder); } else { holder = (ProdCommandéListAdapter.ViewHolder)row.getTag(); } ProduitCommandé produit =listproduitCommandés.get(position); holder.quantité.setText(produit.getQuantite()); // float txtprix = Float.valueOf(produit.getprixTTCC()); holder.designation.setText(produit.getDesignation()); holder.prix.setText(String.valueOf(produit.prixTTC)); int p= Integer.parseInt(produit.getQuantite()); float ch= produit.prixTTC*p; holder.prixTot.setText(String.valueOf(ch)); return row; } }
UTF-8
Java
2,556
java
ProdCommandéListAdapter.java
Java
[]
null
[]
package com.example.myapp; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import java.util.zip.Inflater; public class ProdCommandéListAdapter extends BaseAdapter{ private Context context; private ArrayList<ProduitCommandé> listproduitCommandés; private int layout ; public ProdCommandéListAdapter(Context context, int layout, ArrayList<ProduitCommandé> produitCommandés) { this.context = context ; this.layout = layout ; this.listproduitCommandés = produitCommandés ; } @Override public int getCount() { return listproduitCommandés.size(); } @Override public Object getItem(int position) { return listproduitCommandés.get(position); } @Override public long getItemId(int position) { return position; } private class ViewHolder{ TextView quantité , designation , prix , prixTot; } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; ViewHolder holder = new ViewHolder(); if (row == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(layout, null); holder.quantité = (TextView) row.findViewById(R.id.qte); holder.designation = (TextView) row.findViewById(R.id.des); holder.prix = (TextView) row.findViewById(R.id.ttc); holder.prixTot = (TextView) row.findViewById(R.id.pt); row.setTag(holder); } else { holder = (ProdCommandéListAdapter.ViewHolder)row.getTag(); } ProduitCommandé produit =listproduitCommandés.get(position); holder.quantité.setText(produit.getQuantite()); // float txtprix = Float.valueOf(produit.getprixTTCC()); holder.designation.setText(produit.getDesignation()); holder.prix.setText(String.valueOf(produit.prixTTC)); int p= Integer.parseInt(produit.getQuantite()); float ch= produit.prixTTC*p; holder.prixTot.setText(String.valueOf(ch)); return row; } }
2,556
0.685827
0.685827
91
26.912088
26.459444
113
false
false
0
0
0
0
0
0
0.56044
false
false
2
5e4e5fb43f98ddcd6fd26028517a854540b377be
23,356,032,190,816
3b477ed16d7445335f9d343703ca1389d68c3908
/java/main/algorithms/sort/insertion/InsertionSort.java
2bc1785d4515e1c2ba9bc0e33300c194380966a9
[]
no_license
paveltinnik/Search_and_sort_algorithms
https://github.com/paveltinnik/Search_and_sort_algorithms
1c2ee49a5b11224106f9492d2875d79a01b7445f
f30f13f1b75398dcb4f0b1f0a0fbe8e595f22831
refs/heads/master
2023-07-15T01:20:29.876000
2021-08-21T06:52:27
2021-08-21T06:52:27
330,685,296
0
0
null
false
2021-08-21T06:52:28
2021-01-18T14:06:34
2021-08-18T14:14:44
2021-08-21T06:52:27
12
0
0
0
Java
false
false
package java.main.algorithms.sort.insertion; import java.util.Scanner; public class InsertionSort { public static int[] insertionSort(int[] array) { /* iterating over elements in the unsorted part */ for (int i = 1; i < array.length; i++) { int elem = array[i]; // take the next element int j = i - 1; /* find a suitable position to insert and shift elements to the right */ while (j >= 0 && array[j] > elem) { array[j + 1] = array[j]; // shifting j--; } array[j + 1] = elem; // insert the element in the found position in the sorted part } return array; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter size of array: "); int size = scanner.nextInt(); int[] array = new int[size]; System.out.print("Enter array: "); for (int i = 0; i < size; i++) { array[i] = scanner.nextInt(); } insertionSort(array); System.out.print("Sorted array in ascending order: "); for (int num : array) { System.out.print(num + " "); } } }
UTF-8
Java
1,259
java
InsertionSort.java
Java
[]
null
[]
package java.main.algorithms.sort.insertion; import java.util.Scanner; public class InsertionSort { public static int[] insertionSort(int[] array) { /* iterating over elements in the unsorted part */ for (int i = 1; i < array.length; i++) { int elem = array[i]; // take the next element int j = i - 1; /* find a suitable position to insert and shift elements to the right */ while (j >= 0 && array[j] > elem) { array[j + 1] = array[j]; // shifting j--; } array[j + 1] = elem; // insert the element in the found position in the sorted part } return array; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter size of array: "); int size = scanner.nextInt(); int[] array = new int[size]; System.out.print("Enter array: "); for (int i = 0; i < size; i++) { array[i] = scanner.nextInt(); } insertionSort(array); System.out.print("Sorted array in ascending order: "); for (int num : array) { System.out.print(num + " "); } } }
1,259
0.523431
0.518666
42
28.976191
24.168543
95
false
false
0
0
0
0
0
0
0.5
false
false
2
e38e6b646bc55291ff07eefe533c400a1e5ea04d
31,155,692,774,688
bc655a5158f61284d5542239759cb88d79ec026a
/src/main/java/MobileGoogleSearchResultsPage.java
d63a0cf32beb80e28bcfa933e9d0d54d3a51f4ff
[]
no_license
hillelit/appium_qa_framework
https://github.com/hillelit/appium_qa_framework
5c354ceb4341024440f0580bf59672db5bef147f
57aaf44a675fa4fcbf06602ec1f0eeb7bd0f9761
refs/heads/master
2021-07-05T16:15:38.917000
2019-06-22T13:03:18
2019-06-22T13:03:18
192,930,100
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class MobileGoogleSearchResultsPage { @FindBy(xpath = "(//*[@role='heading'])[1]") private WebElement firstSearchResultItem; private WebDriver webDriver; public MobileGoogleSearchResultsPage(final WebDriver driver) { this.webDriver = driver; PageFactory.initElements(driver, this); } public String getFirstSearchResultTitleText() { return firstSearchResultItem.getText(); } }
UTF-8
Java
608
java
MobileGoogleSearchResultsPage.java
Java
[]
null
[]
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class MobileGoogleSearchResultsPage { @FindBy(xpath = "(//*[@role='heading'])[1]") private WebElement firstSearchResultItem; private WebDriver webDriver; public MobileGoogleSearchResultsPage(final WebDriver driver) { this.webDriver = driver; PageFactory.initElements(driver, this); } public String getFirstSearchResultTitleText() { return firstSearchResultItem.getText(); } }
608
0.740132
0.738487
21
27.952381
21.949024
66
false
false
0
0
0
0
0
0
0.47619
false
false
2
2a19db8572243361257587257c1813a57c87270a
257,698,049,196
7cbe67619877cc2821444dc6be9f39cdd21a8021
/runnershi_be/src/main/java/com/ssafy/runnershi/entity/RoomAuthPK.java
eb305842d079c1a8c94cdb1e7120fb4a585d2723
[]
no_license
BAEKYUJEONG/RunnersHI
https://github.com/BAEKYUJEONG/RunnersHI
388ea6372198824ec250dc1440bfd94a24f372ba
33a1d92bd05357345e7b7676dc0ed17b9e20a933
refs/heads/master
2023-05-12T12:30:03.533000
2021-05-31T16:45:09
2021-05-31T16:45:09
372,572,960
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ssafy.runnershi.entity; import java.io.Serializable; import javax.persistence.Column; public class RoomAuthPK implements Serializable { @Column private String room; @Column private String authUser; }
UTF-8
Java
222
java
RoomAuthPK.java
Java
[]
null
[]
package com.ssafy.runnershi.entity; import java.io.Serializable; import javax.persistence.Column; public class RoomAuthPK implements Serializable { @Column private String room; @Column private String authUser; }
222
0.788288
0.788288
11
19.181818
15.694922
49
false
false
0
0
0
0
0
0
0.454545
false
false
2
be7b2aae04af03748125f7c6a085cc32e48aae00
1,159,641,240,106
da2039635f3599f18089c66c9a94f6ab537d0a8e
/src/src/app/cilp/dwfy/dao/CyypjlDao.java
1a4e42642ed04d191fb7e30d8df921ef9170de05
[]
no_license
dalinhuang/cilp
https://github.com/dalinhuang/cilp
c7567975e54a67572c041d613aff7c8259f1a5c1
ba5bb70778ba839501e306c0a9dcd796d87983c0
refs/heads/master
2018-01-08T22:05:12.195000
2012-05-08T01:41:02
2012-05-08T01:41:02
48,650,713
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.cilp.dwfy.dao; import app.cilp.dwfy.model.Cyypjl; import app.core.dao.BaseDao; public interface CyypjlDao extends BaseDao<Cyypjl, Long>{ }
UTF-8
Java
165
java
CyypjlDao.java
Java
[]
null
[]
package app.cilp.dwfy.dao; import app.cilp.dwfy.model.Cyypjl; import app.core.dao.BaseDao; public interface CyypjlDao extends BaseDao<Cyypjl, Long>{ }
165
0.727273
0.727273
9
16.333334
19.624249
57
false
false
0
0
0
0
0
0
0.555556
false
false
2
00b0fbd83a54c4f70a762175a2b4d752f121c664
6,356,551,623,402
330d1748dd697eff9465092a78ec8fb63ddd9a69
/ReservasAereas/src/cliente/Cliente.java
16be8dc482c23327ba0db80d966cd3cdd4f8595d
[]
no_license
alanbarbosagyn/gestor-companhia-aerea
https://github.com/alanbarbosagyn/gestor-companhia-aerea
d5d631f6bb6020a329b9561d5ad71cf671b20e69
4703bdc544a919901ddeef92ca31ccff086769f1
refs/heads/master
2021-01-19T08:14:39.685000
2011-06-30T20:35:34
2011-06-30T20:35:34
32,120,056
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cliente; import java.util.Date; public class Cliente { private String nome; private String email; private String senha; private String telefone; private int nCartao; private Date dataCriacaoConta; public Cliente() { } public Cliente(String nome, String email, String senha, String telefone, int nCartao, Date dataCriacaoConta) { this.nome = nome; this.email = email; this.senha = senha; this.telefone = telefone; this.nCartao = nCartao; this.dataCriacaoConta = dataCriacaoConta; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getSenha() { return senha; } public void setSenha(String senha) { this.senha = senha; } public String getTelefone() { return telefone; } public void setTelefone(String telefone) { this.telefone = telefone; } public int getnCartao() { return nCartao; } public void setnCartao(int nCartao) { this.nCartao = nCartao; } public Date getDataCriacaoConta() { return dataCriacaoConta; } public void setDataCriacaoConta(Date dataCriacaoConta) { this.dataCriacaoConta = dataCriacaoConta; } }
UTF-8
Java
1,274
java
Cliente.java
Java
[ { "context": ".nome = nome;\n\t\tthis.email = email;\n\t\tthis.senha = senha;\n\t\tthis.telefone = telefone;\n\t\tthis.nCartao = nCa", "end": 423, "score": 0.5151696801185608, "start": 418, "tag": "NAME", "value": "senha" } ]
null
[]
package cliente; import java.util.Date; public class Cliente { private String nome; private String email; private String senha; private String telefone; private int nCartao; private Date dataCriacaoConta; public Cliente() { } public Cliente(String nome, String email, String senha, String telefone, int nCartao, Date dataCriacaoConta) { this.nome = nome; this.email = email; this.senha = senha; this.telefone = telefone; this.nCartao = nCartao; this.dataCriacaoConta = dataCriacaoConta; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getSenha() { return senha; } public void setSenha(String senha) { this.senha = senha; } public String getTelefone() { return telefone; } public void setTelefone(String telefone) { this.telefone = telefone; } public int getnCartao() { return nCartao; } public void setnCartao(int nCartao) { this.nCartao = nCartao; } public Date getDataCriacaoConta() { return dataCriacaoConta; } public void setDataCriacaoConta(Date dataCriacaoConta) { this.dataCriacaoConta = dataCriacaoConta; } }
1,274
0.712716
0.712716
66
18.30303
15.691118
73
false
false
0
0
0
0
0
0
1.712121
false
false
2
2f9f4bad2632c728c965dae102b9683904452302
15,221,364,112,707
b2c13a991ff4e7c6de60d02111348b45f4e274aa
/TMAdim/src/tmadim/model/Matricula.java
9b352c75a5eb5e3d4c83e0c64fc58b16719d58bb
[]
no_license
thiagotls58/PadroesDeProjeto-EngIII
https://github.com/thiagotls58/PadroesDeProjeto-EngIII
9c819798a9fb8d9c03adfccefebca53486d32467
5782dda4c6e67e1d0f7f5fdb186328e102d3aea4
refs/heads/master
2020-08-06T23:33:00.065000
2019-10-06T16:23:27
2019-10-06T16:23:27
213,200,241
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 tmadim.model; import java.util.List; import javafx.scene.control.CheckBox; /** * * @author Thiago */ public class Matricula { private int codigo; private Oficina oficina; private Aluno aluno; private boolean ativo; private CheckBox presenca; private List<Horario> horarios; private List<Frequencia> frequencia; public Matricula(int codigo) { this.codigo = codigo; } public Matricula () { } public Matricula(int codigo, Oficina oficina, Aluno aluno, boolean ativo, List<Horario> horarios, CheckBox presenca) { this.codigo = codigo; this.oficina = oficina; this.aluno = aluno; this.ativo = ativo; this.horarios = horarios; this.presenca = presenca; } public Matricula(Oficina oficina, Aluno aluno, boolean ativo, List<Horario> horarios) { this.oficina = oficina; this.aluno = aluno; this.ativo = ativo; this.horarios = horarios; } public Matricula(int codigo, Oficina oficina, Aluno aluno, boolean ativo, List<Horario> horarios) { this.codigo = codigo; this.oficina = oficina; this.aluno = aluno; this.ativo = ativo; this.horarios = horarios; } public int getCodigo() { return codigo; } public void setCodigo(int codigo) { this.codigo = codigo; } public Oficina getOficina() { return oficina; } public void setOficina(Oficina oficina) { this.oficina = oficina; } public Aluno getAluno() { return aluno; } public void setAluno(Aluno aluno) { this.aluno = aluno; } public boolean isAtivo() { return ativo; } public void setAtivo(boolean ativo) { this.ativo = ativo; } public List<Horario> getHorarios() { return horarios; } public void setHorarios(List<Horario> horarios) { this.horarios = horarios; } public String getNome() { return getAluno().getNome(); } public String getCpf() { return getAluno().getCpf(); } public String getRg() { return getAluno().getRg(); } public CheckBox getPresenca() { return presenca; } public void setPresenca(CheckBox presenca) { this.presenca = presenca; } public List<Frequencia> getFrequencia() { return frequencia; } public void setFrequencia(List<Frequencia> frequencia) { this.frequencia = frequencia; } }
UTF-8
Java
2,783
java
Matricula.java
Java
[ { "context": " javafx.scene.control.CheckBox;\n\n/**\n *\n * @author Thiago\n */\npublic class Matricula {\n \n private int", "end": 294, "score": 0.9997220039367676, "start": 288, "tag": "NAME", "value": "Thiago" } ]
null
[]
/* * 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 tmadim.model; import java.util.List; import javafx.scene.control.CheckBox; /** * * @author Thiago */ public class Matricula { private int codigo; private Oficina oficina; private Aluno aluno; private boolean ativo; private CheckBox presenca; private List<Horario> horarios; private List<Frequencia> frequencia; public Matricula(int codigo) { this.codigo = codigo; } public Matricula () { } public Matricula(int codigo, Oficina oficina, Aluno aluno, boolean ativo, List<Horario> horarios, CheckBox presenca) { this.codigo = codigo; this.oficina = oficina; this.aluno = aluno; this.ativo = ativo; this.horarios = horarios; this.presenca = presenca; } public Matricula(Oficina oficina, Aluno aluno, boolean ativo, List<Horario> horarios) { this.oficina = oficina; this.aluno = aluno; this.ativo = ativo; this.horarios = horarios; } public Matricula(int codigo, Oficina oficina, Aluno aluno, boolean ativo, List<Horario> horarios) { this.codigo = codigo; this.oficina = oficina; this.aluno = aluno; this.ativo = ativo; this.horarios = horarios; } public int getCodigo() { return codigo; } public void setCodigo(int codigo) { this.codigo = codigo; } public Oficina getOficina() { return oficina; } public void setOficina(Oficina oficina) { this.oficina = oficina; } public Aluno getAluno() { return aluno; } public void setAluno(Aluno aluno) { this.aluno = aluno; } public boolean isAtivo() { return ativo; } public void setAtivo(boolean ativo) { this.ativo = ativo; } public List<Horario> getHorarios() { return horarios; } public void setHorarios(List<Horario> horarios) { this.horarios = horarios; } public String getNome() { return getAluno().getNome(); } public String getCpf() { return getAluno().getCpf(); } public String getRg() { return getAluno().getRg(); } public CheckBox getPresenca() { return presenca; } public void setPresenca(CheckBox presenca) { this.presenca = presenca; } public List<Frequencia> getFrequencia() { return frequencia; } public void setFrequencia(List<Frequencia> frequencia) { this.frequencia = frequencia; } }
2,783
0.603665
0.603665
127
20.913385
20.92733
122
false
false
0
0
0
0
0
0
0.456693
false
false
2
21ab436dfef84bdf6f302a192f8622f055a52d19
33,543,694,592,904
b32da4b605ec5b8c45bad18c2f3e21394a284bad
/DemoSiteExcel/src/main/java/demoexcel/Constants.java
7a8b3f71b4697622171d5699ff0fb05dbdd23aac
[]
no_license
Nightmayr/AutomatedTesting
https://github.com/Nightmayr/AutomatedTesting
be82f4e2010d16217bf91837dd7fe081a315531e
2c1173bc7af1f7f0c274be0203451cf2e2ab7a4d
refs/heads/master
2020-04-19T17:21:39.646000
2019-01-31T16:48:12
2019-01-31T16:48:12
168,331,028
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package demoexcel; public class Constants { public final static String DRIVER = "C:\\Users\\Admin\\Applications\\chromedriver.exe"; public final static String FILE = "C:\\Users\\Admin\\Desktop\\DemoSiteDDT.xlsx"; }
UTF-8
Java
218
java
Constants.java
Java
[]
null
[]
package demoexcel; public class Constants { public final static String DRIVER = "C:\\Users\\Admin\\Applications\\chromedriver.exe"; public final static String FILE = "C:\\Users\\Admin\\Desktop\\DemoSiteDDT.xlsx"; }
218
0.747706
0.747706
6
35.333332
35.859291
88
false
false
0
0
0
0
0
0
0.833333
false
false
2
cc7cb9e1b0bcbe12f775c777027647b5c99a606b
8,469,675,514,575
fd395cc87598be945259f91ac09f927226a45fd2
/java/TestMemoryAllocator.java
59d9f40e052caa73f6651f79807c0f4156f947ba
[]
no_license
SimonDanisch/ByteBufferBench
https://github.com/SimonDanisch/ByteBufferBench
0bed7384cad2db8e200238199e8a8aaae1e8b3fa
ecb78105794a5aaaca8fdad565fc5c4a7fe0cf05
refs/heads/master
2021-03-12T20:21:18.941000
2015-01-13T11:37:19
2015-01-13T11:37:19
29,186,522
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * * 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 java.util.concurrent.TimeUnit; import java.util.ArrayList; import java.util.List; import java.util.Collections; public class TestMemoryAllocator { public static void main(String... args) { if (args == null || args.length == 0) { args = new String[]{Allocator.Type.OFFHEAP.name(), "5000000"}; } final int nElements = Integer.valueOf(args[1]); final boolean randomAccess = true; final int[] idx; if (randomAccess) { idx = new int[nElements]; for (int i = 0; i < nElements; i++) { idx[i] = (int) (Math.random() * nElements); } } else { idx = null; } final ObjectType[] types = new ObjectType[]{Allocator.allocate(Allocator.Type.valueOf(args[0]), nElements)}; int ONE_MILLION = 1000000; final int len = types.length; List<Double> writes = new ArrayList<Double>(); List<Double> reads = new ArrayList<Double>(); List<Double> rreads = new ArrayList<Double>(); for (int x = 0; x < 100; x++) { for (int n = 0; n < len; n++) { final ObjectType t = types[n]; long writeStart = System.nanoTime(); int resWrite = write(t, nElements); long totalWrite = System.nanoTime() - writeStart; long readStart = System.nanoTime(); int resRead = read(t, nElements); long totalRead = System.nanoTime() - readStart; long rreadStart = System.nanoTime(); int rresRead = randomRead(t, nElements, idx); long rtotalRead = System.nanoTime() - readStart; writes.add(totalWrite*1d); reads.add(totalRead*1d); rreads.add(rtotalRead*1d); } } double meanwrites = mean(writes); double meanreads = mean(reads); double meanrreads = mean(rreads); double maxwrites = Collections.max(writes); double maxreads = Collections.max(reads); double maxrreads = Collections.max(rreads); double minwrites = Collections.min(writes); double minreads = Collections.min(reads); double minrreads = Collections.min(rreads); System.out.println(String.format("\"%s\" => [", types[0].getClass().getName())); System.out.println(String.format("\"Writes\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / meanwrites) / ONE_MILLION)); System.out.println(String.format("\"Reads\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / meanreads) / ONE_MILLION)); System.out.println(String.format("\"RandomReads\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / meanrreads) / ONE_MILLION)); System.out.println(String.format("\"Writes Max\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / minwrites) / ONE_MILLION)); System.out.println(String.format("\"Reads Max\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / minreads) / ONE_MILLION)); System.out.println(String.format("\"RandomReads Max\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / minrreads) / ONE_MILLION)); System.out.println(String.format("\"Writes Min\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / maxwrites) / ONE_MILLION)); System.out.println(String.format("\"Reads Min\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / maxreads) / ONE_MILLION)); System.out.println(String.format("\"RandomReads Min\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / maxrreads) / ONE_MILLION)); System.out.println("],"); } public static double mean(List <Double> marks) { double sum = 0.0; if(!marks.isEmpty()) { for (double mark : marks) { sum += mark; } return sum / marks.size(); } return sum; } public static int write(ObjectType t, int items) { int index = 0; for (; index < items; index++) { t.navigate(index); t.setByte((byte) index); t.setInt(index); t.setLong(index); } return index; } public static int read(ObjectType t, int items) { int sum = 0; for (int index = 0; index < items; index++) { t.navigate(index); /* consume ie use all read values to avoid dead code elimination */ sum += t.getByte() + t.getInt() + (int) t.getLong(); } return sum; } public static int randomRead(ObjectType t, int items, final int[] idx) { int sum = 0; for (int index = 0; index < items; index++) { t.navigate(idx[index]); /* consume ie use all read values to avoid dead code elimination */ sum += t.getByte() + t.getInt() + (int) t.getLong(); } return sum; } }
UTF-8
Java
5,512
java
TestMemoryAllocator.java
Java
[]
null
[]
/* * * 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 java.util.concurrent.TimeUnit; import java.util.ArrayList; import java.util.List; import java.util.Collections; public class TestMemoryAllocator { public static void main(String... args) { if (args == null || args.length == 0) { args = new String[]{Allocator.Type.OFFHEAP.name(), "5000000"}; } final int nElements = Integer.valueOf(args[1]); final boolean randomAccess = true; final int[] idx; if (randomAccess) { idx = new int[nElements]; for (int i = 0; i < nElements; i++) { idx[i] = (int) (Math.random() * nElements); } } else { idx = null; } final ObjectType[] types = new ObjectType[]{Allocator.allocate(Allocator.Type.valueOf(args[0]), nElements)}; int ONE_MILLION = 1000000; final int len = types.length; List<Double> writes = new ArrayList<Double>(); List<Double> reads = new ArrayList<Double>(); List<Double> rreads = new ArrayList<Double>(); for (int x = 0; x < 100; x++) { for (int n = 0; n < len; n++) { final ObjectType t = types[n]; long writeStart = System.nanoTime(); int resWrite = write(t, nElements); long totalWrite = System.nanoTime() - writeStart; long readStart = System.nanoTime(); int resRead = read(t, nElements); long totalRead = System.nanoTime() - readStart; long rreadStart = System.nanoTime(); int rresRead = randomRead(t, nElements, idx); long rtotalRead = System.nanoTime() - readStart; writes.add(totalWrite*1d); reads.add(totalRead*1d); rreads.add(rtotalRead*1d); } } double meanwrites = mean(writes); double meanreads = mean(reads); double meanrreads = mean(rreads); double maxwrites = Collections.max(writes); double maxreads = Collections.max(reads); double maxrreads = Collections.max(rreads); double minwrites = Collections.min(writes); double minreads = Collections.min(reads); double minrreads = Collections.min(rreads); System.out.println(String.format("\"%s\" => [", types[0].getClass().getName())); System.out.println(String.format("\"Writes\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / meanwrites) / ONE_MILLION)); System.out.println(String.format("\"Reads\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / meanreads) / ONE_MILLION)); System.out.println(String.format("\"RandomReads\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / meanrreads) / ONE_MILLION)); System.out.println(String.format("\"Writes Max\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / minwrites) / ONE_MILLION)); System.out.println(String.format("\"Reads Max\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / minreads) / ONE_MILLION)); System.out.println(String.format("\"RandomReads Max\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / minrreads) / ONE_MILLION)); System.out.println(String.format("\"Writes Min\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / maxwrites) / ONE_MILLION)); System.out.println(String.format("\"Reads Min\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / maxreads) / ONE_MILLION)); System.out.println(String.format("\"RandomReads Min\" => %16s,", (TimeUnit.SECONDS.toNanos(nElements) / maxrreads) / ONE_MILLION)); System.out.println("],"); } public static double mean(List <Double> marks) { double sum = 0.0; if(!marks.isEmpty()) { for (double mark : marks) { sum += mark; } return sum / marks.size(); } return sum; } public static int write(ObjectType t, int items) { int index = 0; for (; index < items; index++) { t.navigate(index); t.setByte((byte) index); t.setInt(index); t.setLong(index); } return index; } public static int read(ObjectType t, int items) { int sum = 0; for (int index = 0; index < items; index++) { t.navigate(index); /* consume ie use all read values to avoid dead code elimination */ sum += t.getByte() + t.getInt() + (int) t.getLong(); } return sum; } public static int randomRead(ObjectType t, int items, final int[] idx) { int sum = 0; for (int index = 0; index < items; index++) { t.navigate(idx[index]); /* consume ie use all read values to avoid dead code elimination */ sum += t.getByte() + t.getInt() + (int) t.getLong(); } return sum; } }
5,512
0.579463
0.569303
148
36.236488
35.819244
140
false
false
0
0
0
0
0
0
0.790541
false
false
2
5106cd9ba06a2de0a4c503ff33c5696c1378f1ac
4,715,874,154,948
ef2dfbacfdbcb276644d648cbb378d9fbb47b3bf
/src/com/company/ExerciseOne.java
24630ebdbca3606bfe1b10f008463961e545c588
[]
no_license
Vara-Ali/TestAPDemo
https://github.com/Vara-Ali/TestAPDemo
ee14b61bb87bdf9b13d808b9efd60b7b26155710
2dde9a1b06b3320581e2f83a358249b3a2e91169
refs/heads/master
2023-07-26T05:56:16.975000
2021-09-10T08:39:06
2021-09-10T08:39:06
405,010,051
0
0
null
false
2021-09-10T08:39:07
2021-09-10T08:28:14
2021-09-10T08:31:58
2021-09-10T08:39:06
0
0
0
0
Java
false
false
package com.company; import java.util.Scanner; public class ExerciseOne { public static void main(String[] args) { System.out.println("Program to calculate student percentage!!!!!!"); Scanner sc = new Scanner(System.in); System.out.println("Enter marks for subject 1"); int sub1 = sc.nextInt(); System.out.println("Enter marks for subject 2"); int sub2 = sc.nextInt(); System.out.println("Enter marks for subject 3"); int sub3 = sc.nextInt(); System.out.println("Enter marks for subject 4"); int sub4 = sc.nextInt(); System.out.println("Enter marks for subject 5"); int sub5 = sc.nextInt(); float total = sub1 + sub2 + sub3 + sub4 + sub5; System.out.print("Total marks for all five subjects are: "); System.out.println(total); float div = (( total / 500 ) * 100 ); System.out.print("Percentage: "); System.out.print(div); System.out.println("%"); } }
UTF-8
Java
1,015
java
ExerciseOne.java
Java
[]
null
[]
package com.company; import java.util.Scanner; public class ExerciseOne { public static void main(String[] args) { System.out.println("Program to calculate student percentage!!!!!!"); Scanner sc = new Scanner(System.in); System.out.println("Enter marks for subject 1"); int sub1 = sc.nextInt(); System.out.println("Enter marks for subject 2"); int sub2 = sc.nextInt(); System.out.println("Enter marks for subject 3"); int sub3 = sc.nextInt(); System.out.println("Enter marks for subject 4"); int sub4 = sc.nextInt(); System.out.println("Enter marks for subject 5"); int sub5 = sc.nextInt(); float total = sub1 + sub2 + sub3 + sub4 + sub5; System.out.print("Total marks for all five subjects are: "); System.out.println(total); float div = (( total / 500 ) * 100 ); System.out.print("Percentage: "); System.out.print(div); System.out.println("%"); } }
1,015
0.596059
0.575369
29
34
21.242443
76
false
false
0
0
0
0
0
0
0.724138
false
false
2
0db768f44b6c872d15beca284e6ebcc5a226acd8
23,682,449,683,570
cfc531c83af3f7e51f968d1656bb741e6133105b
/src/i2p/sbonk/kad/operation/RestoreOperation.java
039f38c98fc2b533399044dab56149b8d501ac52
[]
no_license
kronat/Sbonk
https://github.com/kronat/Sbonk
1ac8fb46329972f02be01adecc636b64b8cbe74c
6f66c6d8d17bf9dbc3818d76ba96a0abdb5cac83
refs/heads/master
2016-09-09T23:38:57.520000
2011-09-16T10:26:57
2011-09-16T10:26:57
2,137,052
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package i2p.sbonk.kad.operation; import i2p.sbonk.kad.Configuration; import i2p.sbonk.kad.HashCalculator; import i2p.sbonk.kad.Identifier; import i2p.sbonk.kad.Node; import i2p.sbonk.kad.Space; import i2p.sbonk.kad.messaging.Message; import i2p.sbonk.kad.messaging.MessageServer; import java.io.IOException; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import net.i2p.I2PException; import org.apache.commons.collections.MultiMap; /** * Refreshes all buckets and sends HashMessages to all nodes that are * among the K closest to mappings stored at this node. Also deletes any * mappings that this node is no longer among the K closest to. **/ public class RestoreOperation extends Operation { private Configuration conf; private MessageServer server; private Space space; private Node local; private MultiMap localMap; private HashCalculator hasher; public RestoreOperation(Configuration conf, MessageServer server, Space space, Node local, MultiMap localMap) { this.conf = conf; this.server = server; this.space = space; this.local = local; this.localMap = localMap; hasher = new HashCalculator(local, space, localMap); } /** * @return <code>null</code> * @throws I2PException If any suboperation timed out * @throws IOException If a network occurred **/ public synchronized Object execute() throws IOException, I2PException { // Refresh buckets Operation refresh = new RefreshOperation(conf, server, space, local); refresh.execute(); // Find nodes that are among the closest to mappings stored here // TODO: It is ineffective since HashCalculator also goes through all // mappings and looks at closestNodes. This should only be done once. Set<Node> nodes = new HashSet<Node>(); Iterator<Identifier> it = localMap.keySet().iterator(); while (it.hasNext()) { Identifier key = it.next(); List<Node> closest = space.getClosestNodes(key); // No longer closest to mapping? if (!closest.contains(local)) { it.remove(); } else { nodes.addAll(closest); } } // Do not send to self nodes.remove(local); // Calculate hashes and send HashMessage long now = System.currentTimeMillis(); Iterator<Node> iter = nodes.iterator(); while (iter.hasNext()) { Node node = iter.next(); List<byte[]> hashes = hasher.logarithmicHashes(node, now); if (hashes.size() > 0) { Message mess = new HashMessage(local, now, hashes); server.send(mess, node.getDestination(), null); } } return null; } }
UTF-8
Java
2,913
java
RestoreOperation.java
Java
[]
null
[]
package i2p.sbonk.kad.operation; import i2p.sbonk.kad.Configuration; import i2p.sbonk.kad.HashCalculator; import i2p.sbonk.kad.Identifier; import i2p.sbonk.kad.Node; import i2p.sbonk.kad.Space; import i2p.sbonk.kad.messaging.Message; import i2p.sbonk.kad.messaging.MessageServer; import java.io.IOException; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import net.i2p.I2PException; import org.apache.commons.collections.MultiMap; /** * Refreshes all buckets and sends HashMessages to all nodes that are * among the K closest to mappings stored at this node. Also deletes any * mappings that this node is no longer among the K closest to. **/ public class RestoreOperation extends Operation { private Configuration conf; private MessageServer server; private Space space; private Node local; private MultiMap localMap; private HashCalculator hasher; public RestoreOperation(Configuration conf, MessageServer server, Space space, Node local, MultiMap localMap) { this.conf = conf; this.server = server; this.space = space; this.local = local; this.localMap = localMap; hasher = new HashCalculator(local, space, localMap); } /** * @return <code>null</code> * @throws I2PException If any suboperation timed out * @throws IOException If a network occurred **/ public synchronized Object execute() throws IOException, I2PException { // Refresh buckets Operation refresh = new RefreshOperation(conf, server, space, local); refresh.execute(); // Find nodes that are among the closest to mappings stored here // TODO: It is ineffective since HashCalculator also goes through all // mappings and looks at closestNodes. This should only be done once. Set<Node> nodes = new HashSet<Node>(); Iterator<Identifier> it = localMap.keySet().iterator(); while (it.hasNext()) { Identifier key = it.next(); List<Node> closest = space.getClosestNodes(key); // No longer closest to mapping? if (!closest.contains(local)) { it.remove(); } else { nodes.addAll(closest); } } // Do not send to self nodes.remove(local); // Calculate hashes and send HashMessage long now = System.currentTimeMillis(); Iterator<Node> iter = nodes.iterator(); while (iter.hasNext()) { Node node = iter.next(); List<byte[]> hashes = hasher.logarithmicHashes(node, now); if (hashes.size() > 0) { Message mess = new HashMessage(local, now, hashes); server.send(mess, node.getDestination(), null); } } return null; } }
2,913
0.636457
0.631994
87
32.482758
22.876913
82
false
false
0
0
0
0
0
0
0.666667
false
false
2
3ff72bd768f533b95cce8340eb2d14c0651c9101
19,181,323,983,905
eb3f37d2376cbd0e34512d18392193368a4eb841
/noetflix/src/main/java/ar/com/ada/mongo/noetflix/repo/SerieRepository.java
1845fd2ea0beb1dcf5cd1d2588779a3d706f04ae
[]
no_license
noeliog/OctavaBackend
https://github.com/noeliog/OctavaBackend
90bbdf7c3c321351df014d0eaf545ac36026b5ac
d00a78c5ae02c647094e8a76e337fbe752d4a469
refs/heads/master
2020-08-28T00:07:52.614000
2019-11-11T14:26:02
2019-11-11T14:26:02
217,529,365
0
0
null
false
2021-06-04T02:17:29
2019-10-25T12:31:22
2019-11-11T14:22:52
2021-06-04T02:17:28
146
0
0
3
Java
false
false
package ar.com.ada.mongo.noetflix.repo; import org.springframework.data.mongodb.repository.MongoRepository; import ar.com.ada.mongo.noetflix.entities.Serie; /** * SerieRepository */ public interface SerieRepository extends MongoRepository<Serie, Integer> { Serie findByNombre(String nombre); }
UTF-8
Java
306
java
SerieRepository.java
Java
[]
null
[]
package ar.com.ada.mongo.noetflix.repo; import org.springframework.data.mongodb.repository.MongoRepository; import ar.com.ada.mongo.noetflix.entities.Serie; /** * SerieRepository */ public interface SerieRepository extends MongoRepository<Serie, Integer> { Serie findByNombre(String nombre); }
306
0.784314
0.784314
15
19.466667
25.41618
74
false
false
0
0
0
0
0
0
0.4
false
false
2
b2bb7f32c386456b117ab4620fb532b1e8463c50
6,322,191,876,839
fd3397caaa6cd4a0654c55e1a273b0f865afe077
/app/src/main/java/com/lipu/findnearbyplacesapp/CustomListviewAdapter.java
626481b349eac6396965f1dec89111f6698564fe
[]
no_license
Lipdroid/NearbyPlaces
https://github.com/Lipdroid/NearbyPlaces
5d71d35ebf8b0c31ec40683808b72ade8273f0ec
7a44dd46821434981d54725f44f0abcc6d55ba50
refs/heads/master
2021-09-05T15:40:13.890000
2018-01-29T10:33:10
2018-01-29T10:33:10
119,248,290
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lipu.findnearbyplacesapp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.lipu.findnearbyplacesapp.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.RatingBar; import android.widget.TextView; public class CustomListviewAdapter extends BaseAdapter{ List<HashMap<String, String>> names ; Context ctxt; LayoutInflater inflater; private OnClickListenerAdvanceListRow m_onClickListenerBookingListRow; public CustomListviewAdapter(List<HashMap<String,String>> newsArrayList, Context c,OnClickListenerAdvanceListRow m_onClickListenerBookingListRow) { names = newsArrayList; ctxt = c; inflater = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.m_onClickListenerBookingListRow = m_onClickListenerBookingListRow; } @Override public int getCount() { // TODO Auto-generated method stub return names.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return names.get(arg0); } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return arg0; } @Override public View getView(final int position, View view, ViewGroup viewGroup) { // TODO Create the cell (View) and populate it with an element of the array if (view == null) { // view = inflater.inflate(android.R.layout.simple_list_item_1, viewGroup, false); view = inflater.inflate(R.layout.list_row, viewGroup, false); } TextView name = (TextView) view.findViewById(R.id.textView1); TextView address = (TextView) view.findViewById(R.id.textView2); TextView other = (TextView) view.findViewById(R.id.textView3); RatingBar ratingBar = (RatingBar)view.findViewById(R.id.ratingBar1); Button btnshow = (Button) view.findViewById(R.id.btnShow); btnshow.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub m_onClickListenerBookingListRow.OnClickRowAction(names.get(position), 1, position); } }); name.setText(names.get(position).get("place_name")); address.setText(names.get(position).get("vicinity")); other.setText(names.get(position).get("rating")); float rating = 0; if(names.get(position).get("rating").equals("-NA-")){ }else rating = Float.parseFloat(names.get(position).get("rating")); ratingBar.setRating(rating); return view; } public interface OnClickListenerAdvanceListRow { public void OnClickRowAction(HashMap<String, String> hashMap, long id, int position); } }
UTF-8
Java
2,967
java
CustomListviewAdapter.java
Java
[]
null
[]
package com.lipu.findnearbyplacesapp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.lipu.findnearbyplacesapp.R; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.RatingBar; import android.widget.TextView; public class CustomListviewAdapter extends BaseAdapter{ List<HashMap<String, String>> names ; Context ctxt; LayoutInflater inflater; private OnClickListenerAdvanceListRow m_onClickListenerBookingListRow; public CustomListviewAdapter(List<HashMap<String,String>> newsArrayList, Context c,OnClickListenerAdvanceListRow m_onClickListenerBookingListRow) { names = newsArrayList; ctxt = c; inflater = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.m_onClickListenerBookingListRow = m_onClickListenerBookingListRow; } @Override public int getCount() { // TODO Auto-generated method stub return names.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return names.get(arg0); } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return arg0; } @Override public View getView(final int position, View view, ViewGroup viewGroup) { // TODO Create the cell (View) and populate it with an element of the array if (view == null) { // view = inflater.inflate(android.R.layout.simple_list_item_1, viewGroup, false); view = inflater.inflate(R.layout.list_row, viewGroup, false); } TextView name = (TextView) view.findViewById(R.id.textView1); TextView address = (TextView) view.findViewById(R.id.textView2); TextView other = (TextView) view.findViewById(R.id.textView3); RatingBar ratingBar = (RatingBar)view.findViewById(R.id.ratingBar1); Button btnshow = (Button) view.findViewById(R.id.btnShow); btnshow.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub m_onClickListenerBookingListRow.OnClickRowAction(names.get(position), 1, position); } }); name.setText(names.get(position).get("place_name")); address.setText(names.get(position).get("vicinity")); other.setText(names.get(position).get("rating")); float rating = 0; if(names.get(position).get("rating").equals("-NA-")){ }else rating = Float.parseFloat(names.get(position).get("rating")); ratingBar.setRating(rating); return view; } public interface OnClickListenerAdvanceListRow { public void OnClickRowAction(HashMap<String, String> hashMap, long id, int position); } }
2,967
0.6879
0.684193
92
31.195652
29.913368
151
false
false
0
0
0
0
0
0
0.826087
false
false
2
ddc729a0eb23c1f07d87ee1153cbe0f907e0112d
2,637,109,933,831
e59b4788593410c4f30517a43aedef42c3418dd2
/RAD80Java/src/itso/rad80/bank/model/Credit.java
b27bcd949bce8961754c14cf2b8f4c20a5b4638a
[ "Apache-2.0" ]
permissive
cjarroyo/hibernate
https://github.com/cjarroyo/hibernate
33ce00fd95a7b936434136925dcd6de20e061200
bb853b513628aca54f6dfdf2c1ebc260babdfe6b
refs/heads/master
2021-07-04T21:33:28.330000
2017-09-20T14:00:00
2017-09-20T14:00:00
104,204,309
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package itso.rad80.bank.model; import java.math.BigDecimal; import java.lang.String; import itso.rad80.bank.exception.InvalidTransactionException; import itso.rad80.bank.ifc.TransactionType; public class Credit extends Transaction { private static final long serialVersionUID = 9097730281411923364L; //Main Constructor public Credit(BigDecimal amount) { super(amount); } @Override //Replacement logic for toString on console output public String toString() { if (this.getAmount() != null) { return "Crebit: --> Amount $" + this.getAmount().setScale(2, BigDecimal.ROUND_HALF_EVEN) + " on " + this.getTimeStamp(); } else { return "Credit amount is not set. Transaction has failed."; } } //Process credit transaction logic public BigDecimal process(BigDecimal accountBalance) throws InvalidTransactionException { if ((this.getAmount() != null) && (this.getAmount().compareTo(new BigDecimal(0.00D)) > 0)) { return accountBalance.add(this.getAmount()); } else { if (this.getAmount() != null) { throw new InvalidTransactionException( "Credit transaction could not proceed: " + "Negative or zero credit amount has dedected. Credit amount is: $" + this.getAmount().setScale(2, BigDecimal.ROUND_HALF_EVEN) + "."); } else { throw new InvalidTransactionException( "Credit transaction could not proceed: " + "Credit amount is not set."); } } } // PUBLIC GETTERS public String getTransactionType() { return TransactionType.CREDIT; } }
UTF-8
Java
1,550
java
Credit.java
Java
[]
null
[]
package itso.rad80.bank.model; import java.math.BigDecimal; import java.lang.String; import itso.rad80.bank.exception.InvalidTransactionException; import itso.rad80.bank.ifc.TransactionType; public class Credit extends Transaction { private static final long serialVersionUID = 9097730281411923364L; //Main Constructor public Credit(BigDecimal amount) { super(amount); } @Override //Replacement logic for toString on console output public String toString() { if (this.getAmount() != null) { return "Crebit: --> Amount $" + this.getAmount().setScale(2, BigDecimal.ROUND_HALF_EVEN) + " on " + this.getTimeStamp(); } else { return "Credit amount is not set. Transaction has failed."; } } //Process credit transaction logic public BigDecimal process(BigDecimal accountBalance) throws InvalidTransactionException { if ((this.getAmount() != null) && (this.getAmount().compareTo(new BigDecimal(0.00D)) > 0)) { return accountBalance.add(this.getAmount()); } else { if (this.getAmount() != null) { throw new InvalidTransactionException( "Credit transaction could not proceed: " + "Negative or zero credit amount has dedected. Credit amount is: $" + this.getAmount().setScale(2, BigDecimal.ROUND_HALF_EVEN) + "."); } else { throw new InvalidTransactionException( "Credit transaction could not proceed: " + "Credit amount is not set."); } } } // PUBLIC GETTERS public String getTransactionType() { return TransactionType.CREDIT; } }
1,550
0.696129
0.676129
56
26.678572
21.767527
76
false
false
0
0
0
0
0
0
2.392857
false
false
2
d29777dfb3b4341c50af2fdfd94299346be26e23
22,557,168,280,535
8864e856a8c069639a759dadf331d6c0982586d6
/src/main/java/com/example/e3soft/CommentData.java
89a2528c927245bf4bc89d4714d8f74f2be7fdb4
[]
no_license
DNA00DAN/E3Soft
https://github.com/DNA00DAN/E3Soft
278f13729c1d97cff805c77e94e3c7c829f5b0dd
7fd0663b1a471bf4599cb4606819350f13fa95b2
refs/heads/master
2020-05-01T14:56:07.593000
2019-03-25T07:09:33
2019-03-25T07:09:33
177,527,374
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.e3soft; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import java.util.ArrayList; import java.util.List; public class CommentData extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "comments.db"; private static final String tblComment = "comments"; public CommentData(Context context) { super(context, "/sdcard/e3softData/Data/" + DATABASE_NAME, null, DATABASE_VERSION); SQLiteDatabase.openOrCreateDatabase("/sdcard/e3softData/Data/" + DATABASE_NAME, null); } @Override public void onCreate(SQLiteDatabase db) { if (!db.isReadOnly()) { db.execSQL("PRAGMA foreign_keys = ON;"); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + tblComment); } public List<String> getAllComments() { List<String> comm = new ArrayList<String>(); // Select All Query String selectQuery = "SELECT * FROM " + tblComment + " ORDER BY comments.comments ASC"; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { comm.add(cursor.getString(0)); } while (cursor.moveToNext()); } // closing connection cursor.close(); db.close(); // returning labels return comm; } public void insertComment(String commentT) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("comments", commentT); // Inserting Row db.insert(tblComment, null, values); db.close(); // Closing database connection } }
UTF-8
Java
2,114
java
CommentData.java
Java
[]
null
[]
package com.example.e3soft; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import java.util.ArrayList; import java.util.List; public class CommentData extends SQLiteOpenHelper { // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "comments.db"; private static final String tblComment = "comments"; public CommentData(Context context) { super(context, "/sdcard/e3softData/Data/" + DATABASE_NAME, null, DATABASE_VERSION); SQLiteDatabase.openOrCreateDatabase("/sdcard/e3softData/Data/" + DATABASE_NAME, null); } @Override public void onCreate(SQLiteDatabase db) { if (!db.isReadOnly()) { db.execSQL("PRAGMA foreign_keys = ON;"); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + tblComment); } public List<String> getAllComments() { List<String> comm = new ArrayList<String>(); // Select All Query String selectQuery = "SELECT * FROM " + tblComment + " ORDER BY comments.comments ASC"; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { comm.add(cursor.getString(0)); } while (cursor.moveToNext()); } // closing connection cursor.close(); db.close(); // returning labels return comm; } public void insertComment(String commentT) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("comments", commentT); // Inserting Row db.insert(tblComment, null, values); db.close(); // Closing database connection } }
2,114
0.647588
0.645222
73
27.958904
25.175787
96
false
false
0
0
0
0
0
0
0.547945
false
false
2
279ce18d9f3865dea8b464e4a969bf0cf6a266ca
5,377,299,069,823
b6625c64b02f73c753a100a1215e6009b39bedeb
/src/main/java/me/gravitinos/minigame/gamecore/scoreboard/SBTextGetter.java
f9a9cdae72931531b234b0f5104db4d00d4eabe2
[]
no_license
mattlack15/GBedWars
https://github.com/mattlack15/GBedWars
d088f2d4818fb3b55f00db09f9063a1301493555
8f8beb7998398603bb34ef5f74c9e88c36a6d166
refs/heads/master
2022-04-20T23:54:04.998000
2020-04-17T16:57:39
2020-04-17T16:57:39
240,989,054
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.gravitinos.minigame.gamecore.scoreboard; import org.bukkit.entity.Player; public interface SBTextGetter { String getText(Player player); }
UTF-8
Java
156
java
SBTextGetter.java
Java
[]
null
[]
package me.gravitinos.minigame.gamecore.scoreboard; import org.bukkit.entity.Player; public interface SBTextGetter { String getText(Player player); }
156
0.794872
0.794872
7
21.285715
19.166296
51
false
false
0
0
0
0
0
0
0.428571
false
false
2
be215e66f23bda096fd762652c7636cbdebee53f
19,061,064,868,301
9b408e6b19631d88f03ad81b15597337ea56a607
/CRAC/CRAC/src/module1/Identite.java
40c4e7d58fbf9d551eeb5a905e0102c3dd609973
[]
no_license
Kwazao/CRAC
https://github.com/Kwazao/CRAC
f7e387f76f799845df1be829ccb2b3d7e86d74ef
f5a88d80c35303925bf6c8a6b457ebda6b4c26ac
refs/heads/master
2020-04-02T09:23:19.018000
2019-01-13T21:22:46
2019-01-13T21:22:46
154,290,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Codé par Kevin Ouazzani */ package module1; import java.sql.Date; public class Identite { private String prenom; private String nom; private String sexe; private String ddn; //constructeur par défaut public Identite(String p, String n, String s, String d ) { prenom = p; nom=n; sexe=s; ddn=d; } //getters public String getPrenom() { return prenom; } public String getSexe() { return sexe; } public String getNom() { return nom; } public String getDdN() { return ddn; } //setters individuels public void setPrenom(String p) { this.prenom = p ; } public void setSexe(String s) { this.sexe = s ; } public void setNom(String n) { this.nom =n; } public void setDdN(String d) { this.ddn =d; } }
ISO-8859-1
Java
824
java
Identite.java
Java
[ { "context": "/* Codé par Kevin Ouazzani */\r\npackage module1;\r\n\r\nimport java.sql.Date;\r\n\r\n", "end": 26, "score": 0.9998871684074402, "start": 12, "tag": "NAME", "value": "Kevin Ouazzani" } ]
null
[]
/* Codé par <NAME> */ package module1; import java.sql.Date; public class Identite { private String prenom; private String nom; private String sexe; private String ddn; //constructeur par défaut public Identite(String p, String n, String s, String d ) { prenom = p; nom=n; sexe=s; ddn=d; } //getters public String getPrenom() { return prenom; } public String getSexe() { return sexe; } public String getNom() { return nom; } public String getDdN() { return ddn; } //setters individuels public void setPrenom(String p) { this.prenom = p ; } public void setSexe(String s) { this.sexe = s ; } public void setNom(String n) { this.nom =n; } public void setDdN(String d) { this.ddn =d; } }
816
0.600973
0.599757
56
12.678572
12.425646
59
false
false
0
0
0
0
0
0
1.446429
false
false
2
26cfccad6bec5804839c7f15ef5593169fb3407f
18,880,676,298,297
a2187916e734cfa1e334d85c0547b3c97a7cc032
/archive/03_2020_Spring/05.20-Trees_Recursion/src/test/BinaryTreeTest.java
4de12398f7afe5b479689527044e9ad902aa8acb
[]
no_license
theBrianCui/CSC-143-Notes
https://github.com/theBrianCui/CSC-143-Notes
428491794bc53c994ac483384ccb257dbdccfb64
867e45f927eda811309714372ee8e1530378fb15
refs/heads/master
2021-06-24T22:06:47.815000
2021-06-10T05:21:38
2021-06-10T05:21:38
210,466,655
7
12
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import org.junit.Test; import scratch.BinaryTreeNode; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static junit.framework.TestCase.assertEquals; public class BinaryTreeTest { @Test public void ConstructTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); assertEquals(Integer.valueOf(0), root.payload); assertEquals(Integer.valueOf(1), root.left.payload); assertEquals(Integer.valueOf(2), root.right.payload); } @Test public void ConstructDeepTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); root.right.left = new BinaryTreeNode<>(3); root.right.right = new BinaryTreeNode<>(4); assertEquals(Integer.valueOf(3), root.right.left.payload); assertEquals(Integer.valueOf(4), root.right.right.payload); } /** * Retrieves the Integer at the end of a path described by an ArrayList. * @param root The root of the Binary Tree of Integers. * @param path An ArrayList of Strings containing "right" or "left" directions from the root node. * @return The value at the end of the path. */ public Integer getIntegerAtPath(BinaryTreeNode<Integer> root, ArrayList<String> path) { for (String d : path) { if (d.equals("left")) { root = root.left; } else { root = root.right; } } return root.payload; } @Test public void IntegerPathTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); root.right.left = new BinaryTreeNode<>(3); root.right.right = new BinaryTreeNode<>(4); ArrayList<String> emptyPath = new ArrayList<>(); assertEquals(Integer.valueOf(0), getIntegerAtPath(root, emptyPath)); ArrayList<String> oneStepPath = new ArrayList<>(Arrays.asList( "left" )); assertEquals(Integer.valueOf(1), getIntegerAtPath(root, oneStepPath)); ArrayList<String> twoStepPath = new ArrayList<>(Arrays.asList( "right", "left" )); assertEquals(Integer.valueOf(3), getIntegerAtPath(root, twoStepPath)); } /* An enum is like an integer with a name. An enum is a programming-only construct that lets us use labels disguised as integers, where the underlying integer doesn't matter as much as the label itself. We could have just used 0 and 1 for left and right. This is what the compiler turns enums into, which are more efficient and less error prone than using raw strings. */ public enum Direction { left, // 0 right, // 1 } public <T> T getValueAtPath(BinaryTreeNode<T> root, List<Direction> path) { for (Direction d : path) { if (d.equals(Direction.left)) { root = root.left; } else if (d.equals(Direction.right)) { root = root.right; } } return root.payload; } @Test public void PathTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); root.right.left = new BinaryTreeNode<>(3); root.right.right = new BinaryTreeNode<>(4); ArrayList<Direction> emptyPath = new ArrayList<>(); assertEquals(Integer.valueOf(0), getValueAtPath(root, emptyPath)); ArrayList<Direction> oneStepPath = new ArrayList<>(Arrays.asList( Direction.left )); assertEquals(Integer.valueOf(1), getValueAtPath(root, oneStepPath)); ArrayList<Direction> twoStepPath = new ArrayList<>(Arrays.asList( Direction.right, Direction.left )); assertEquals(Integer.valueOf(3), getValueAtPath(root, twoStepPath)); } }
UTF-8
Java
4,382
java
BinaryTreeTest.java
Java
[]
null
[]
package test; import org.junit.Test; import scratch.BinaryTreeNode; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static junit.framework.TestCase.assertEquals; public class BinaryTreeTest { @Test public void ConstructTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); assertEquals(Integer.valueOf(0), root.payload); assertEquals(Integer.valueOf(1), root.left.payload); assertEquals(Integer.valueOf(2), root.right.payload); } @Test public void ConstructDeepTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); root.right.left = new BinaryTreeNode<>(3); root.right.right = new BinaryTreeNode<>(4); assertEquals(Integer.valueOf(3), root.right.left.payload); assertEquals(Integer.valueOf(4), root.right.right.payload); } /** * Retrieves the Integer at the end of a path described by an ArrayList. * @param root The root of the Binary Tree of Integers. * @param path An ArrayList of Strings containing "right" or "left" directions from the root node. * @return The value at the end of the path. */ public Integer getIntegerAtPath(BinaryTreeNode<Integer> root, ArrayList<String> path) { for (String d : path) { if (d.equals("left")) { root = root.left; } else { root = root.right; } } return root.payload; } @Test public void IntegerPathTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); root.right.left = new BinaryTreeNode<>(3); root.right.right = new BinaryTreeNode<>(4); ArrayList<String> emptyPath = new ArrayList<>(); assertEquals(Integer.valueOf(0), getIntegerAtPath(root, emptyPath)); ArrayList<String> oneStepPath = new ArrayList<>(Arrays.asList( "left" )); assertEquals(Integer.valueOf(1), getIntegerAtPath(root, oneStepPath)); ArrayList<String> twoStepPath = new ArrayList<>(Arrays.asList( "right", "left" )); assertEquals(Integer.valueOf(3), getIntegerAtPath(root, twoStepPath)); } /* An enum is like an integer with a name. An enum is a programming-only construct that lets us use labels disguised as integers, where the underlying integer doesn't matter as much as the label itself. We could have just used 0 and 1 for left and right. This is what the compiler turns enums into, which are more efficient and less error prone than using raw strings. */ public enum Direction { left, // 0 right, // 1 } public <T> T getValueAtPath(BinaryTreeNode<T> root, List<Direction> path) { for (Direction d : path) { if (d.equals(Direction.left)) { root = root.left; } else if (d.equals(Direction.right)) { root = root.right; } } return root.payload; } @Test public void PathTest() { BinaryTreeNode<Integer> root = new BinaryTreeNode<>(0); root.left = new BinaryTreeNode<>(1); root.right = new BinaryTreeNode<>(2); root.right.left = new BinaryTreeNode<>(3); root.right.right = new BinaryTreeNode<>(4); ArrayList<Direction> emptyPath = new ArrayList<>(); assertEquals(Integer.valueOf(0), getValueAtPath(root, emptyPath)); ArrayList<Direction> oneStepPath = new ArrayList<>(Arrays.asList( Direction.left )); assertEquals(Integer.valueOf(1), getValueAtPath(root, oneStepPath)); ArrayList<Direction> twoStepPath = new ArrayList<>(Arrays.asList( Direction.right, Direction.left )); assertEquals(Integer.valueOf(3), getValueAtPath(root, twoStepPath)); } }
4,382
0.592424
0.584893
135
30.459259
26.919292
102
false
false
0
0
0
0
0
0
0.540741
false
false
2
d2186c246cb8d43530da91c36c22c618f07a057f
360,777,281,466
40ea9e4f27d9170e7b6b7a3b586d6a521a333be7
/avaj-launcher/Main.java
833388a7809a0355b693ff52745632a1b85c4eb8
[]
no_license
johnsonWTC/AirCraftSimulator-JAVA
https://github.com/johnsonWTC/AirCraftSimulator-JAVA
303c98160dfdc4ad62454957f7753dd784a4bbb6
a547cbd3c06ac3cf91e1a78d1e5233871574f2a7
refs/heads/master
2022-01-16T09:17:25.482000
2019-07-10T15:54:07
2019-07-10T15:54:07
196,234,043
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jam; import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { File file = new File("/goinfre/jdubula//Desktop/simulator.txt"); Flyable flyable = null; BufferedReader reader = new BufferedReader(new FileReader(file)); String line = reader.readLine(); if (line != null) { WeatherTower weatherTower = new WeatherTower(); String splitsimulation[] = line.split(" "); int simulation = Integer.parseInt(splitsimulation[0]); System.out.println(simulation); // int simulation = Integer.parseInt(line.split(" ") [0]); if (simulation <= 0) { System.out.println("Simulation count cannot be 0 or less than 0"); System.exit(1); } while ((line = reader.readLine()) != null) { String plit[] = line.split(" "); if (plit.length == 5) { int lat = Integer.parseInt(plit[2]); int longi = Integer.parseInt(plit[3]); int high = Integer.parseInt(plit[4]); String type = plit[0]; String name = plit[1]; flyable = AircraftFactory.newAircraft(type, name, longi, lat, high); flyable.registerTower(weatherTower); String printThis = flyable.print(); FileWriter fw = new FileWriter("testfour.txt",true); fw.write(printThis); fw.close(); // System.out.println(line); } } while(simulation > 0) { weatherTower.conditionsChanged(); String printThis = flyable.print(); FileWriter fw = new FileWriter("testfour.txt",true); fw.write(printThis); fw.close(); simulation--; } //Coordinates coordinates = new Coordinates(10, 10, 10); //AircraftFactory aircraftFactory = new AircraftFactory(); // System.out.println(Aircraft.getIdCounter()); // WeatherTower weatherTower = new WeatherTower(); // Flyable flyable = aircraftFactory.newAircraft("Helicopter","SAAS",10,10,10); // flyable.registerTower(weatherTower); // flyable.updateConditions(); // String printThis = flyable.print(); // String writer = printThis; // FileWriter fw= new FileWriter("testout.txt"); // fw.write(writer); // System.out.println(Aircraft.getIdCounter()); // Flyable ballon = aircraftFactory.newAircraft("Helicopter","SAA",10,10,1); // Flyable plan = aircraftFactory.newAircraft("Ballon","SA express",10,10,1); // plan.registerTower(weatherTower); // plan.updateConditions(); // System.out.println(Aircraft.getIdCounter()); // ballon.registerTower(weatherTower); // ballon.updateConditions(); // String printThree = plan.print(); // String printTwo = ballon.print(); // System.out.println(Aircraft.getIdCounter()); // String written = printTwo; // fw.write(written); // fw.write(printThree); // fw.close(); } // for (int i = 0; i < simulation; i++) // weatherTower.changeWeather(); } }
UTF-8
Java
3,813
java
Main.java
Java
[]
null
[]
package com.jam; import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { File file = new File("/goinfre/jdubula//Desktop/simulator.txt"); Flyable flyable = null; BufferedReader reader = new BufferedReader(new FileReader(file)); String line = reader.readLine(); if (line != null) { WeatherTower weatherTower = new WeatherTower(); String splitsimulation[] = line.split(" "); int simulation = Integer.parseInt(splitsimulation[0]); System.out.println(simulation); // int simulation = Integer.parseInt(line.split(" ") [0]); if (simulation <= 0) { System.out.println("Simulation count cannot be 0 or less than 0"); System.exit(1); } while ((line = reader.readLine()) != null) { String plit[] = line.split(" "); if (plit.length == 5) { int lat = Integer.parseInt(plit[2]); int longi = Integer.parseInt(plit[3]); int high = Integer.parseInt(plit[4]); String type = plit[0]; String name = plit[1]; flyable = AircraftFactory.newAircraft(type, name, longi, lat, high); flyable.registerTower(weatherTower); String printThis = flyable.print(); FileWriter fw = new FileWriter("testfour.txt",true); fw.write(printThis); fw.close(); // System.out.println(line); } } while(simulation > 0) { weatherTower.conditionsChanged(); String printThis = flyable.print(); FileWriter fw = new FileWriter("testfour.txt",true); fw.write(printThis); fw.close(); simulation--; } //Coordinates coordinates = new Coordinates(10, 10, 10); //AircraftFactory aircraftFactory = new AircraftFactory(); // System.out.println(Aircraft.getIdCounter()); // WeatherTower weatherTower = new WeatherTower(); // Flyable flyable = aircraftFactory.newAircraft("Helicopter","SAAS",10,10,10); // flyable.registerTower(weatherTower); // flyable.updateConditions(); // String printThis = flyable.print(); // String writer = printThis; // FileWriter fw= new FileWriter("testout.txt"); // fw.write(writer); // System.out.println(Aircraft.getIdCounter()); // Flyable ballon = aircraftFactory.newAircraft("Helicopter","SAA",10,10,1); // Flyable plan = aircraftFactory.newAircraft("Ballon","SA express",10,10,1); // plan.registerTower(weatherTower); // plan.updateConditions(); // System.out.println(Aircraft.getIdCounter()); // ballon.registerTower(weatherTower); // ballon.updateConditions(); // String printThree = plan.print(); // String printTwo = ballon.print(); // System.out.println(Aircraft.getIdCounter()); // String written = printTwo; // fw.write(written); // fw.write(printThree); // fw.close(); } // for (int i = 0; i < simulation; i++) // weatherTower.changeWeather(); } }
3,813
0.492526
0.483084
113
32.734512
28.731291
95
false
false
0
0
0
0
0
0
0.725664
false
false
2
fd4e54c1ebe8fd8920cf55035058cb289e5b8992
4,715,874,162,877
9fcdd447d924e457aaa46a2fa65eb56f403ffa96
/backend/alanda-base/src/main/java/io/alanda/base/service/PmcDepartmentService.java
24241f957bba513aacd28f6fd8b11ec2ab7e9504
[ "MIT" ]
permissive
alanda-io/alanda
https://github.com/alanda-io/alanda
3c63d6102b9c057208a818876508ace35d9fd6f2
222ecac3429db7789b0eeaa095c08e85d4d852b1
refs/heads/master
2023-06-23T15:07:10.310000
2021-09-29T08:13:54
2021-09-29T08:13:54
200,077,440
7
1
MIT
false
2021-09-29T08:13:55
2019-08-01T15:39:15
2021-09-24T13:49:21
2021-09-29T08:13:54
78,316
5
2
5
Java
false
false
package io.alanda.base.service; import java.util.List; import io.alanda.base.dto.PmcDepartmentDto; public interface PmcDepartmentService { public static final Long DEPARTMENT_RAN_ID = 1L; public static final Long DEPARTMENT_IT_ID = 2L; public static final String DEPARTMENT_RAN = "RAN"; public static final String DEPARTMENT_IT = "IT"; PmcDepartmentDto getPmcDepartment(Long guid); PmcDepartmentDto getPmcDepartment(String idName); List<PmcDepartmentDto> getDepartmentList(); }
UTF-8
Java
505
java
PmcDepartmentService.java
Java
[]
null
[]
package io.alanda.base.service; import java.util.List; import io.alanda.base.dto.PmcDepartmentDto; public interface PmcDepartmentService { public static final Long DEPARTMENT_RAN_ID = 1L; public static final Long DEPARTMENT_IT_ID = 2L; public static final String DEPARTMENT_RAN = "RAN"; public static final String DEPARTMENT_IT = "IT"; PmcDepartmentDto getPmcDepartment(Long guid); PmcDepartmentDto getPmcDepartment(String idName); List<PmcDepartmentDto> getDepartmentList(); }
505
0.768317
0.764356
21
23.047619
22.476393
52
false
false
0
0
0
0
0
0
0.47619
false
false
2
db0f21c120ca8024e6e77146c56ff84182576e51
25,718,264,201,414
0ee32f94ad42d9f533bff85b0eb599df938729c8
/src/layer2_802Algorithms/Bss2AccessPoint.java
fd1f4143530741e783ca77fe7caf10c4980a7905
[]
no_license
Hazelia/Jemula802
https://github.com/Hazelia/Jemula802
61a64da0ab048a0778305690bdd50d66d46cabd3
84ee6f74252d23edeac05033b7267e1db267a982
refs/heads/master
2020-04-01T14:02:05.923000
2014-12-08T21:08:31
2014-12-08T21:08:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package layer2_802Algorithms; import plot.JEMultiPlotter; import layer2_80211Mac.JE802_11BackoffEntity; import layer2_80211Mac.JE802_11Mac; import layer2_80211Mac.JE802_11MacAlgorithm; public class Bss2AccessPoint extends JE802_11MacAlgorithm { private JE802_11BackoffEntity theBackoffEntity; private int theBSS; private int step; public Bss2AccessPoint(String name, JE802_11Mac aMac) { super(name, aMac); this.theBSS = 02; this.theBackoffEntity = this.mac.getBackoffEntity(theBSS); this.step = 0; } @Override public void compute() { this.step++; message(step + ": AP " + this.theBSS + " with MAC address " + this.dot11MACAddress.toString() + ". Algorithm: '" + this.algorithmName + "'.", 10); } @Override public void plot() { } }
UTF-8
Java
771
java
Bss2AccessPoint.java
Java
[]
null
[]
package layer2_802Algorithms; import plot.JEMultiPlotter; import layer2_80211Mac.JE802_11BackoffEntity; import layer2_80211Mac.JE802_11Mac; import layer2_80211Mac.JE802_11MacAlgorithm; public class Bss2AccessPoint extends JE802_11MacAlgorithm { private JE802_11BackoffEntity theBackoffEntity; private int theBSS; private int step; public Bss2AccessPoint(String name, JE802_11Mac aMac) { super(name, aMac); this.theBSS = 02; this.theBackoffEntity = this.mac.getBackoffEntity(theBSS); this.step = 0; } @Override public void compute() { this.step++; message(step + ": AP " + this.theBSS + " with MAC address " + this.dot11MACAddress.toString() + ". Algorithm: '" + this.algorithmName + "'.", 10); } @Override public void plot() { } }
771
0.725032
0.645914
35
21.028572
20.834703
61
false
false
0
0
0
0
0
0
1.371429
false
false
2
c6d31d093388a10d159edb8d6945608d670bbbaa
16,569,983,846,883
1be63031002b93b7c58df9c4a98a5b0963fcefdc
/src/main/java/com/merchantsafeunipay/sdk/response/misc/ResponseCode.java
e8b4b08887d2688dc565a94dee94bdaa20de5287
[ "Apache-2.0" ]
permissive
isahb/msu-api-sdk
https://github.com/isahb/msu-api-sdk
0139c087df78b929e3fcb2f28c5cdcad31a7837a
3b7f04b556c02f62b95f7e14a625b513028ae12e
refs/heads/master
2021-04-26T22:57:39.466000
2021-03-04T17:55:32
2021-03-04T17:55:32
123,893,171
4
4
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.merchantsafeunipay.sdk.response.misc; public class ResponseCode { public static final String APPROVEDCODE = "00"; public static final String WAITINGFORAPPROVALCODE = "01"; public static final String DECLINEDCODE = "99"; public static final String GENERALERRORCODE = "98"; private ResponseCode() { } }
UTF-8
Java
338
java
ResponseCode.java
Java
[]
null
[]
package com.merchantsafeunipay.sdk.response.misc; public class ResponseCode { public static final String APPROVEDCODE = "00"; public static final String WAITINGFORAPPROVALCODE = "01"; public static final String DECLINEDCODE = "99"; public static final String GENERALERRORCODE = "98"; private ResponseCode() { } }
338
0.730769
0.707101
11
29.818182
23.563524
61
false
false
0
0
0
0
0
0
0.454545
false
false
2
7151706905775fdbca2d4ee00c78b3f43b069a7b
16,569,983,845,303
332f8474d763248c5d727b2116f0caf53d8ef4e1
/src/main/java/gui/controller/AlertController.java
421245c1a22dc2ed4f1ca537c77cf61c33090c49
[]
no_license
ayathustra/sepme-ss14
https://github.com/ayathustra/sepme-ss14
92143bbd4e17fd6a9b11b78c288bba082f8356f2
8f30fd8a48ceebcac85796634c773174be2146aa
refs/heads/master
2016-09-06T00:12:26.870000
2014-04-25T10:44:51
2014-04-25T10:44:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gui.controller; import java.io.IOException; import javax.management.RuntimeErrorException; import org.apache.log4j.Logger; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.util.Callback; public class AlertController extends Pane { private static final Logger logger = Logger.getLogger( AlertController.class ); @FXML Label idMessage; private Stage stage; private boolean answer; public AlertController() { FXMLLoader fxmlloader = new FXMLLoader( getClass().getResource( "../Alert.fxml" ) ); fxmlloader.setRoot( this ); fxmlloader.setController( this ); try { fxmlloader.load(); } catch (IOException e) { e.printStackTrace(); throw new RuntimeErrorException( null ); } stage = new Stage(); stage.setScene( new Scene( this ) ); stage.show(); } public void setMessage( String message ) { idMessage.setText( message ); } public String getMessage() { return idMessage.getText(); } public void fireOk( ActionEvent ae ) { logger.info( "Ok clicked" ); answer = true; callback.execute( answer ); stage.close(); } public void fireCancel( ActionEvent ae ) { logger.info( "Cancel clicked" ); answer = false; callback.execute( answer ); stage.close(); } public boolean getAnswer() { return answer; } private ICallback callback; public void register( ICallback callback ) { this.callback = callback; } }
UTF-8
Java
1,681
java
AlertController.java
Java
[]
null
[]
package gui.controller; import java.io.IOException; import javax.management.RuntimeErrorException; import org.apache.log4j.Logger; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.util.Callback; public class AlertController extends Pane { private static final Logger logger = Logger.getLogger( AlertController.class ); @FXML Label idMessage; private Stage stage; private boolean answer; public AlertController() { FXMLLoader fxmlloader = new FXMLLoader( getClass().getResource( "../Alert.fxml" ) ); fxmlloader.setRoot( this ); fxmlloader.setController( this ); try { fxmlloader.load(); } catch (IOException e) { e.printStackTrace(); throw new RuntimeErrorException( null ); } stage = new Stage(); stage.setScene( new Scene( this ) ); stage.show(); } public void setMessage( String message ) { idMessage.setText( message ); } public String getMessage() { return idMessage.getText(); } public void fireOk( ActionEvent ae ) { logger.info( "Ok clicked" ); answer = true; callback.execute( answer ); stage.close(); } public void fireCancel( ActionEvent ae ) { logger.info( "Cancel clicked" ); answer = false; callback.execute( answer ); stage.close(); } public boolean getAnswer() { return answer; } private ICallback callback; public void register( ICallback callback ) { this.callback = callback; } }
1,681
0.669839
0.669244
68
23.720589
17.039612
81
false
false
0
0
0
0
0
0
0.558824
false
false
2
90452aa562bf94ad8c21ae254455f43eec1d4a1a
33,715,493,281,488
0db2ab735972a3d159a67dd57ff0b9b6f89f11b9
/app/src/main/java/com/example/lab4/MainActivity.java
fb1d2a547fa12053fe65dedfe1d744688d30873b
[]
no_license
zl00316/Project1
https://github.com/zl00316/Project1
575c09d76a51e5d35c92822a5d19794206c3f206
e3b3fccc553890b628988494aa2e2aef4aa9324d
refs/heads/master
2021-01-17T15:23:20.036000
2016-10-24T19:55:47
2016-10-24T19:55:47
71,826,727
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.lab4; import android.app.VoiceInteractor; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.*; public class MainActivity extends AppCompatActivity { EditText editText; TextView mTextView; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final RequestQueue queue = Volley.newRequestQueue(this); button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mTextView = (TextView) findViewById(R.id.textView); editText = (EditText) findViewById(R.id.editText); final String test = editText.getText().toString(); final String url = "http://api.openweathermap.org/data/2.5/weather?zip="+test+",us&appid=181debbe9663adb188f8cce64f2dbef7&units=imperial"; StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { mTextView.setText("Response is: "+ response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { mTextView.setText(test); } }); queue.add(stringRequest); } }); } }
UTF-8
Java
2,131
java
MainActivity.java
Java
[]
null
[]
package com.example.lab4; import android.app.VoiceInteractor; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.*; public class MainActivity extends AppCompatActivity { EditText editText; TextView mTextView; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final RequestQueue queue = Volley.newRequestQueue(this); button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mTextView = (TextView) findViewById(R.id.textView); editText = (EditText) findViewById(R.id.editText); final String test = editText.getText().toString(); final String url = "http://api.openweathermap.org/data/2.5/weather?zip="+test+",us&appid=181debbe9663adb188f8cce64f2dbef7&units=imperial"; StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { mTextView.setText("Response is: "+ response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { mTextView.setText(test); } }); queue.add(stringRequest); } }); } }
2,131
0.622243
0.613327
61
33.950821
27.890551
154
false
false
0
0
0
0
0
0
0.590164
false
false
2
c9f4c06335fedaa54e4c544290275beddef36602
27,839,978,030,676
f65cefc5d5d192a5cd2e6f9de68f9d9a1c4852e1
/src/com/ccclubs/action/api/chargedot/aishi/ChargeDotThread.java
4d473ba292734fe59e2c261197a7ecad354610e6
[]
no_license
mildrock/ccclubs-bj
https://github.com/mildrock/ccclubs-bj
d54a1251ca77110bef7b75b38604f7271adbf97b
16761e40924b5cef40f7935c98b4b62793a6e947
refs/heads/master
2020-04-16T10:41:11.921000
2018-09-28T09:46:53
2018-09-28T09:46:53
165,513,326
0
8
null
true
2019-01-13T14:14:23
2019-01-13T14:14:23
2018-12-14T06:59:55
2018-12-14T06:59:06
115,701
0
0
0
null
false
null
package com.ccclubs.action.api.chargedot.aishi; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; 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 net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.util.CollectionUtils; import com.ccclubs.helper.CacheStoreHelper; import com.ccclubs.helper.redis.DBIndex; import com.ccclubs.helper.redis.DefaultJRedisClient; import com.ccclubs.model.CsElecHistory; import com.ccclubs.model.CsPowerPile; import com.ccclubs.service.admin.ICsElecHistoryService; import com.ccclubs.service.admin.ICsPowerPileService; import com.ccclubs.util.DateUtil; import com.lazy3q.web.helper.$; /** * 埃士工业电桩状态数据获取 * * @author zhangjian * */ @Deprecated public class ChargeDotThread extends Thread{ final static String CHARSET = "utf-8"; final static String PATH = "http://42.96.191.30:8080/api/"; ICsElecHistoryService csElecHistoryService; ICsPowerPileService csPowerPileService; DefaultJRedisClient<String, CsElecHistory> jr = new DefaultJRedisClient<String, CsElecHistory>(DBIndex.APP_API); Map<String, CsPowerPile> pileMap = new HashMap<String, CsPowerPile>(); public void run() { Map<String, Object> params = new HashMap<String, Object>(); params.put(CsPowerPile.F.csppStatus, "1"); List<CsPowerPile> powerPileList = csPowerPileService.getCsPowerPileList(params, 1000); if(CollectionUtils.isEmpty(powerPileList)){ }else{ for(CsPowerPile powerPile : powerPileList){ pileMap.put(powerPile.getCsppNo(), powerPile); } } while(true){ if($.empty($.config("release.online"))){ try { $.trace("非在线模式,放弃执行当前线程"+this.getClass().getName()); Thread.sleep(5000l); } catch (Exception e) { e.printStackTrace(); } continue; } try { getData(csElecHistoryService); } catch (Exception e) { e.printStackTrace(); } try { Thread.sleep(60000 * 2); //两分钟去拉去一次数据 } catch (Exception e) { e.printStackTrace(); } } } /** * 获取和保存数据 */ public void getData(ICsElecHistoryService historyService){ String result = queryAllState(); JSONObject jsonObj = JSONObject.fromObject(result); if(!jsonObj.getBoolean("IsSuccess")){ System.out.println("ChargeDotThread.queryAllState获取数据失败"); return; } DateUtil dateUtil = new DateUtil(); JSONArray jsonArr = JSONArray.fromObject(jsonObj.get("MonDataList")); for (int i = 0; i < jsonArr.size(); i++) { JSONObject jobj = jsonArr.getJSONObject(i); String did = jobj.getString("Did"); CsPowerPile powerPile = pileMap.get(did); if(powerPile == null){ continue; } CsElecHistory elecHistory = new CsElecHistory(); elecHistory.setCsehPowerPile(powerPile.getCsppId()); elecHistory.setCsehDid(did); elecHistory.setCsehStatusText(CsElecHistory.getStatusCodeText(ignoreNull(jobj.getString("Status")))); elecHistory.setCsehStatusCode(jobj.getString("Status")); elecHistory.setCsehEleAmount(jobj.getString("EleAmount")); elecHistory.setCsehTimeLong(ignoreNull(jobj.getString("TimeLong"))); elecHistory.setCsehErrorCode(ignoreNull(jobj.getString("ErrorCode"))); elecHistory.setCsehData(jobj.toString()); String collectTimeStr = ignoreNull(jobj.getString("LastCreateTime")); if(collectTimeStr !=null){ Date collectTime = dateUtil.StringtoDate(collectTimeStr, "yyyy-MM-dd'T'HH:mm:ss.SSS"); //yyyy-MM-dd'T'HH:mm:ss.SSSZ elecHistory.setCsehCollectTime(collectTime); } elecHistory.setCsehAddTime(Calendar.getInstance().getTime()); elecHistory.save(); CacheStoreHelper.setElecHistory(elecHistory.getCsehPowerPile().toString(), elecHistory); } } /** * "null"字符处理 * @param data * @return */ public String ignoreNull(String data){ if(data !=null && data.equals("null")){ return null; } return data; } public final static String AUTH_CUST_ID = "cust0001"; public final static String AUTH_PASSWORD = "123456"; public final static String AUTH_COMPANY = "Com00001"; /** * 查询所有状态 * @return */ public String queryAllState(){ String path = PATH+"/GetMonCdsData"; JSONObject obj = new JSONObject(); obj.element("CustId", AUTH_CUST_ID); obj.element("Password", AUTH_PASSWORD); obj.element("Company", AUTH_COMPANY); String result = sendJson(path, obj.toString()); return result; } /** * 根据设备编号查询状态 * @param dids * @return */ public String queryStateByIds(List<String> dids){ if(dids == null || dids.size() == 0)return ""; String path = PATH+"/GetMonCdsDataByDids"; JSONObject obj = new JSONObject(); obj.element("CustId", AUTH_COMPANY); obj.element("Password", AUTH_PASSWORD); obj.element("Company", AUTH_COMPANY); List<Map<String, String>> didsList = new ArrayList<Map<String, String>>(); for(String did : dids){ Map<String, String> map = new HashMap<String, String>(); map.put("did", did); didsList.add(map); } obj.element("Dids", didsList); String result = sendJson(path, obj.toString()); return result; } /** * 发送JSON请求 * @param path * @param jsonParam * @return */ public String sendJson(String path, String jsonParam){ try { //创建连接 URL url = new URL(path); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setUseCaches(false); connection.setInstanceFollowRedirects(true); connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); connection.connect(); //POST请求 DataOutputStream out = new DataOutputStream(connection.getOutputStream()); out.writeBytes(jsonParam); out.flush(); out.close(); //读取响应 BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String lines; StringBuffer sb = new StringBuffer(""); while ((lines = reader.readLine()) != null) { lines = new String(lines.getBytes(), CHARSET); sb.append(lines); } reader.close(); connection.disconnect(); return sb.toString(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } public ICsElecHistoryService getCsElecHistoryService() { return csElecHistoryService; } public void setCsElecHistoryService(ICsElecHistoryService csElecHistoryService) { this.csElecHistoryService = csElecHistoryService; } public ICsPowerPileService getCsPowerPileService() { return csPowerPileService; } public void setCsPowerPileService(ICsPowerPileService csPowerPileService) { this.csPowerPileService = csPowerPileService; } public static void main(String[] args) { ChargeDotThread dotThread = new ChargeDotThread(); String result = dotThread.queryAllState(); System.out.println(result); List<String> dids = new ArrayList<String>(); dids.add("ASEV01A11404P0000001"); result = dotThread.queryStateByIds(dids); System.out.println(result); // Date collectTime = new DateUtil().StringtoDate("2014-12-24T08:48:31.123", "yyyy-MM-dd'T'HH:mm:ss.SSS"); Date collectTime = new DateUtil().StringtoDate("2014-11-28T11:23:00+08:00", "yyyy-MM-dd'T'HH:mm:ss"); System.out.println(collectTime); } }
UTF-8
Java
8,200
java
ChargeDotThread.java
Java
[ { "context": ".web.helper.$;\n\n/**\n * 埃士工业电桩状态数据获取\n * \n * @author zhangjian\n *\n */\n\n@Deprecated\npublic class ChargeDotThread ", "end": 1014, "score": 0.9278554320335388, "start": 1005, "tag": "USERNAME", "value": "zhangjian" }, { "context": "= \"utf-8\";\n\t\n\tfinal static String PATH = \"http://42.96.191.30:8080/api/\";\n\t\n\tICsElecHistoryService csElecHistor", "end": 1172, "score": 0.9391607642173767, "start": 1161, "tag": "IP_ADDRESS", "value": "2.96.191.30" }, { "context": "01\";\n\tpublic final static String AUTH_PASSWORD = \"123456\";\n\tpublic final static String AUTH_COMPANY = \"Com", "end": 4260, "score": 0.9993155002593994, "start": 4254, "tag": "PASSWORD", "value": "123456" }, { "context": "d\", AUTH_CUST_ID);\n obj.element(\"Password\", AUTH_PASSWORD);\n obj.element(\"Company\", AUTH_CO", "end": 4542, "score": 0.9947779774665833, "start": 4538, "tag": "PASSWORD", "value": "AUTH" }, { "context": "TH_CUST_ID);\n obj.element(\"Password\", AUTH_PASSWORD);\n obj.element(\"Company\", AUTH_COMPANY);\n ", "end": 4551, "score": 0.9230197072029114, "start": 4543, "tag": "PASSWORD", "value": "PASSWORD" }, { "context": "d\", AUTH_COMPANY);\n obj.element(\"Password\", AUTH_PASSWORD);\n obj.element(\"Company\", AUTH_COMPANY);\n\n", "end": 5015, "score": 0.8407869338989258, "start": 5002, "tag": "PASSWORD", "value": "AUTH_PASSWORD" } ]
null
[]
package com.ccclubs.action.api.chargedot.aishi; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; 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 net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.util.CollectionUtils; import com.ccclubs.helper.CacheStoreHelper; import com.ccclubs.helper.redis.DBIndex; import com.ccclubs.helper.redis.DefaultJRedisClient; import com.ccclubs.model.CsElecHistory; import com.ccclubs.model.CsPowerPile; import com.ccclubs.service.admin.ICsElecHistoryService; import com.ccclubs.service.admin.ICsPowerPileService; import com.ccclubs.util.DateUtil; import com.lazy3q.web.helper.$; /** * 埃士工业电桩状态数据获取 * * @author zhangjian * */ @Deprecated public class ChargeDotThread extends Thread{ final static String CHARSET = "utf-8"; final static String PATH = "http://4172.16.17.32:8080/api/"; ICsElecHistoryService csElecHistoryService; ICsPowerPileService csPowerPileService; DefaultJRedisClient<String, CsElecHistory> jr = new DefaultJRedisClient<String, CsElecHistory>(DBIndex.APP_API); Map<String, CsPowerPile> pileMap = new HashMap<String, CsPowerPile>(); public void run() { Map<String, Object> params = new HashMap<String, Object>(); params.put(CsPowerPile.F.csppStatus, "1"); List<CsPowerPile> powerPileList = csPowerPileService.getCsPowerPileList(params, 1000); if(CollectionUtils.isEmpty(powerPileList)){ }else{ for(CsPowerPile powerPile : powerPileList){ pileMap.put(powerPile.getCsppNo(), powerPile); } } while(true){ if($.empty($.config("release.online"))){ try { $.trace("非在线模式,放弃执行当前线程"+this.getClass().getName()); Thread.sleep(5000l); } catch (Exception e) { e.printStackTrace(); } continue; } try { getData(csElecHistoryService); } catch (Exception e) { e.printStackTrace(); } try { Thread.sleep(60000 * 2); //两分钟去拉去一次数据 } catch (Exception e) { e.printStackTrace(); } } } /** * 获取和保存数据 */ public void getData(ICsElecHistoryService historyService){ String result = queryAllState(); JSONObject jsonObj = JSONObject.fromObject(result); if(!jsonObj.getBoolean("IsSuccess")){ System.out.println("ChargeDotThread.queryAllState获取数据失败"); return; } DateUtil dateUtil = new DateUtil(); JSONArray jsonArr = JSONArray.fromObject(jsonObj.get("MonDataList")); for (int i = 0; i < jsonArr.size(); i++) { JSONObject jobj = jsonArr.getJSONObject(i); String did = jobj.getString("Did"); CsPowerPile powerPile = pileMap.get(did); if(powerPile == null){ continue; } CsElecHistory elecHistory = new CsElecHistory(); elecHistory.setCsehPowerPile(powerPile.getCsppId()); elecHistory.setCsehDid(did); elecHistory.setCsehStatusText(CsElecHistory.getStatusCodeText(ignoreNull(jobj.getString("Status")))); elecHistory.setCsehStatusCode(jobj.getString("Status")); elecHistory.setCsehEleAmount(jobj.getString("EleAmount")); elecHistory.setCsehTimeLong(ignoreNull(jobj.getString("TimeLong"))); elecHistory.setCsehErrorCode(ignoreNull(jobj.getString("ErrorCode"))); elecHistory.setCsehData(jobj.toString()); String collectTimeStr = ignoreNull(jobj.getString("LastCreateTime")); if(collectTimeStr !=null){ Date collectTime = dateUtil.StringtoDate(collectTimeStr, "yyyy-MM-dd'T'HH:mm:ss.SSS"); //yyyy-MM-dd'T'HH:mm:ss.SSSZ elecHistory.setCsehCollectTime(collectTime); } elecHistory.setCsehAddTime(Calendar.getInstance().getTime()); elecHistory.save(); CacheStoreHelper.setElecHistory(elecHistory.getCsehPowerPile().toString(), elecHistory); } } /** * "null"字符处理 * @param data * @return */ public String ignoreNull(String data){ if(data !=null && data.equals("null")){ return null; } return data; } public final static String AUTH_CUST_ID = "cust0001"; public final static String AUTH_PASSWORD = "<PASSWORD>"; public final static String AUTH_COMPANY = "Com00001"; /** * 查询所有状态 * @return */ public String queryAllState(){ String path = PATH+"/GetMonCdsData"; JSONObject obj = new JSONObject(); obj.element("CustId", AUTH_CUST_ID); obj.element("Password", <PASSWORD>_<PASSWORD>); obj.element("Company", AUTH_COMPANY); String result = sendJson(path, obj.toString()); return result; } /** * 根据设备编号查询状态 * @param dids * @return */ public String queryStateByIds(List<String> dids){ if(dids == null || dids.size() == 0)return ""; String path = PATH+"/GetMonCdsDataByDids"; JSONObject obj = new JSONObject(); obj.element("CustId", AUTH_COMPANY); obj.element("Password", <PASSWORD>); obj.element("Company", AUTH_COMPANY); List<Map<String, String>> didsList = new ArrayList<Map<String, String>>(); for(String did : dids){ Map<String, String> map = new HashMap<String, String>(); map.put("did", did); didsList.add(map); } obj.element("Dids", didsList); String result = sendJson(path, obj.toString()); return result; } /** * 发送JSON请求 * @param path * @param jsonParam * @return */ public String sendJson(String path, String jsonParam){ try { //创建连接 URL url = new URL(path); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setUseCaches(false); connection.setInstanceFollowRedirects(true); connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); connection.connect(); //POST请求 DataOutputStream out = new DataOutputStream(connection.getOutputStream()); out.writeBytes(jsonParam); out.flush(); out.close(); //读取响应 BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String lines; StringBuffer sb = new StringBuffer(""); while ((lines = reader.readLine()) != null) { lines = new String(lines.getBytes(), CHARSET); sb.append(lines); } reader.close(); connection.disconnect(); return sb.toString(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } public ICsElecHistoryService getCsElecHistoryService() { return csElecHistoryService; } public void setCsElecHistoryService(ICsElecHistoryService csElecHistoryService) { this.csElecHistoryService = csElecHistoryService; } public ICsPowerPileService getCsPowerPileService() { return csPowerPileService; } public void setCsPowerPileService(ICsPowerPileService csPowerPileService) { this.csPowerPileService = csPowerPileService; } public static void main(String[] args) { ChargeDotThread dotThread = new ChargeDotThread(); String result = dotThread.queryAllState(); System.out.println(result); List<String> dids = new ArrayList<String>(); dids.add("ASEV01A11404P0000001"); result = dotThread.queryStateByIds(dids); System.out.println(result); // Date collectTime = new DateUtil().StringtoDate("2014-12-24T08:48:31.123", "yyyy-MM-dd'T'HH:mm:ss.SSS"); Date collectTime = new DateUtil().StringtoDate("2014-11-28T11:23:00+08:00", "yyyy-MM-dd'T'HH:mm:ss"); System.out.println(collectTime); } }
8,210
0.68235
0.670276
272
28.536764
25.450041
119
false
false
0
0
0
0
0
0
2.102941
false
false
2
4a8da264a3c625dc9f554ad5b607e6e50fcb23f4
19,851,338,863,750
d602f231b1d36c4e5f3d35d1618b4faa307068b0
/src/main/java/ttt/model/GameState.java
934bdb72bb4fe53463693ab8759cef19c28a4d3e
[]
no_license
bigtonysayshi/challenge
https://github.com/bigtonysayshi/challenge
54d39bba5bbe30793629771ee00ba5e6751459aa
80b59935022e84c23489ebb9a5e44166161ed1a4
refs/heads/master
2021-01-12T13:17:09.557000
2017-06-12T06:36:46
2017-06-12T06:36:46
72,179,836
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ttt.model; /** * Created by tzhang2 on 4/23/17. */ public enum GameState { IDLE, INIT, WAIT_MOVE, INVALID_MOVE, PLAYER_WON, DRAW, END }
UTF-8
Java
175
java
GameState.java
Java
[ { "context": "package ttt.model;\n\n/**\n * Created by tzhang2 on 4/23/17.\n */\npublic enum GameState {\n IDLE,", "end": 45, "score": 0.9995177388191223, "start": 38, "tag": "USERNAME", "value": "tzhang2" } ]
null
[]
package ttt.model; /** * Created by tzhang2 on 4/23/17. */ public enum GameState { IDLE, INIT, WAIT_MOVE, INVALID_MOVE, PLAYER_WON, DRAW, END }
175
0.571429
0.537143
14
11.5
8.910267
33
false
false
0
0
0
0
0
0
0.5
false
false
2
6501bd445f2aa57300ab328e2ab2a83cc284cdeb
14,740,327,810,591
b08de696f7f29d56eb92bab7de32b4fd302b6e0a
/src/test/java/es/upm/grise/profundizacion2018/tema5/SmokeTest.java
5110c5452e3267f855b7f3f0ba2176d70910faf9
[]
no_license
meryiri95/PROF-Testable-Design
https://github.com/meryiri95/PROF-Testable-Design
348a6771c56d8136cfb172da08c60a1e06684159
1c792d0ba88541bdf96cec3ceb40bd0b3a3c169c
refs/heads/master
2020-04-08T12:30:32.356000
2019-01-22T16:37:15
2019-01-22T16:37:15
159,350,146
0
0
null
true
2018-11-27T14:41:55
2018-11-27T14:41:54
2018-11-26T09:42:39
2018-11-26T09:42:37
6
0
0
0
null
false
null
package es.upm.grise.profundizacion2018.tema5; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_CONNECT_DATABASE; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_FIND_DRIVER; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_INSTANTIATE_DRIVER; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_READ_FILE; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_RUN_QUERY; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_UPDATE_COUNTER; import static es.upm.grise.profundizacion2018.tema5.Error.CONNECTION_LOST; import static es.upm.grise.profundizacion2018.tema5.Error.CORRUPTED_COUNTER; import static es.upm.grise.profundizacion2018.tema5.Error.INCORRECT_COUNTER; import static es.upm.grise.profundizacion2018.tema5.Error.NON_EXISTING_FILE; import static es.upm.grise.profundizacion2018.tema5.Error.UNDEFINED_ENVIRON; import static org.junit.Assert.*; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import org.junit.Before; import org.junit.Test; public class SmokeTest { Document doc1; Document doc2; DocumentIdProviderTest documentIdProviderTest; public String url = "jdbc:mysql://piedrafita.ls.fi.upm.es:8000/tema5"; public String username = "tema5"; public String password = "tema5"; @Before public void toTest() throws NonRecoverableError, RecoverableError { doc1 = new Document(); doc2 = new Document(); documentIdProviderTest = new DocumentIdProviderTest(); } public static class DocumentIdProviderTest extends DocumentIdProvider{ /* public String url = "jdbc:mysql://piedrafita.ls.fi.upm.es:8000/tema5"; public String username = "tema5"; public String password = "tema5"; // Create the connection to the database private DocumentIdProviderTest() throws NonRecoverableError { // Load DB driver try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (InstantiationException e) { System.out.println(CANNOT_INSTANTIATE_DRIVER.getMessage()); throw new NonRecoverableError(); } catch (IllegalAccessException e) { System.out.println(CANNOT_INSTANTIATE_DRIVER.getMessage()); throw new NonRecoverableError(); } catch (ClassNotFoundException e) { System.out.println(CANNOT_FIND_DRIVER.getMessage()); throw new NonRecoverableError(); } // Create DB connection try { connection = DriverManager.getConnection(url, username, password); } catch (SQLException e) { System.out.println(CANNOT_CONNECT_DATABASE.getMessage()); throw new NonRecoverableError(); } // Read from the COUNTERS table String query = "SELECT documentId FROM Counters"; Statement statement = null; ResultSet resultSet = null; try { statement = connection.createStatement(); resultSet = statement.executeQuery(query); } catch (SQLException e) { System.out.println(CANNOT_RUN_QUERY.getMessage()); throw new NonRecoverableError(); } // Get the last objectID int numberOfValues = 0; try { while (resultSet.next()) { documentId = resultSet.getInt("documentId"); numberOfValues++; } } catch (SQLException e) { System.out.println(INCORRECT_COUNTER.getMessage()); throw new NonRecoverableError(); } // Only one objectID can be retrieved if(numberOfValues != 1) { System.out.println(CORRUPTED_COUNTER.getMessage()); throw new NonRecoverableError(); } // Close all DB connections try { resultSet.close(); statement.close(); } catch (SQLException e) { System.out.println(CONNECTION_LOST.getMessage()); throw new NonRecoverableError(); } } // Return the next valid objectID public int getDocumentIdTest() throws NonRecoverableError { documentId++; // Access the COUNTERS table String query = "UPDATE Counters SET documentId = ?"; int numUpdatedRows; // Update the documentID counter try { PreparedStatement preparedStatement = connection.prepareStatement(query); preparedStatement.setInt(1, documentId); numUpdatedRows = preparedStatement.executeUpdate(); } catch (SQLException e) { System.out.println(e.toString()); System.out.println(CANNOT_UPDATE_COUNTER.getMessage()); throw new NonRecoverableError(); } // Check that the update has been effectively completed if (numUpdatedRows != 1) { System.out.println(CORRUPTED_COUNTER.getMessage()); throw new NonRecoverableError(); } return documentId; } */ } /** * a. La aplicación genera las plantillas correctamente * b. La aplicación asigna el número de documento correcto. * @throws NonRecoverableError * @throws RecoverableError */ @Test public void test1() throws NonRecoverableError, RecoverableError { Document d = new Document(); d.setTemplate("DECLARATION"); d.setTitle("A"); d.setAuthor("B"); d.setBody("C"); assertEquals("DOCUMENT ID: "+d.documentId+"\n\nTitle : A\nAuthor: B\n\nC", d.getFormattedDocument()); } /** * c. Los números de documento asignados a documentos consecutivos son también * números consecutivos. * @throws NonRecoverableError * @throws RecoverableError */ @Test public void test3() throws NonRecoverableError, RecoverableError { /*DocumentIdProviderTest documentIdProviderTest = new DocumentIdProviderTest(); int prevId = documentIdProviderTest.getDocumentIdTest(); Document document = new Document(documentIdProviderTest.getDocumentIdTest()); assertEquals(document.getDocumentId(),prevId+1);*/ assertEquals(doc1.getDocumentId() + 1, doc2.getDocumentId()); } /** * a. La aplicación detecta correctamente que el fichero de configuración no existe. * @throws NonRecoverableError * @throws RecoverableError */ @Test(expected = NonRecoverableError.class) public void test4() throws NonRecoverableError, RecoverableError { Properties propertiesInFile = new Properties(); documentIdProviderTest.checkIfConfigFileExists(propertiesInFile, null, "falsePath"); } /** * b. La aplicación detecta correctamente que el driver MySQL no existe. * @throws NonRecoverableError * @throws RecoverableError */ @Test public void test5() throws NonRecoverableError, RecoverableError { documentIdProviderTest.loadBdDriver("nonExisting.Driver"); } /** * c. La aplicación detecta correctamente que hay más de una fila en la tabla Counters. * @throws NonRecoverableError * @throws RecoverableError * @throws SQLException */ @Test public void test6() throws NonRecoverableError, RecoverableError, SQLException { /* documentIdProviderTest.checkIfConfigFileExists(new Properties(),null,System.getenv(documentIdProviderTest.ENVIRON)); documentIdProviderTest.loadBdDriver("com.mysql.jdbc.Driver"); documentIdProviderTest.connection = documentIdProviderTest.createDbConnection(url, username, password); String query = "SELECT documentId FROM Counters"; Statement stat = documentIdProviderTest.connection.createStatement(); ResultSet result = stat.executeQuery(query); */ } /** * La aplicación detecta correctamente que la actualización del documentID en la tabla Counters * ha sido incorrectamente realizado. * * @throws NonRecoverableError * @throws RecoverableError * @throws SQLException */ @Test public void test7() throws NonRecoverableError, RecoverableError, SQLException { Document doc = new Document(); assertEquals(documentIdProviderTest.getDocumentId(), doc.getDocumentId()); } }
UTF-8
Java
8,000
java
SmokeTest.java
Java
[ { "context": "i.upm.es:8000/tema5\";\n\tpublic String \tusername = \"tema5\";\n\tpublic String password = \"tema5\";\n\t@Before\n\tpu", "end": 1510, "score": 0.9997257590293884, "start": 1505, "tag": "USERNAME", "value": "tema5" }, { "context": "g \tusername = \"tema5\";\n\tpublic String password = \"tema5\";\n\t@Before\n\tpublic void toTest() throws NonRecove", "end": 1545, "score": 0.9992521405220032, "start": 1540, "tag": "PASSWORD", "value": "tema5" }, { "context": ".upm.es:8000/tema5\";\n\t\tpublic String \tusername = \"tema5\";\n\t\tpublic String password = \"tema5\";\n\t\t\n\t\t\n\t\t// ", "end": 1925, "score": 0.9997238516807556, "start": 1920, "tag": "USERNAME", "value": "tema5" }, { "context": " \tusername = \"tema5\";\n\t\tpublic String password = \"tema5\";\n\t\t\n\t\t\n\t\t// Create the connection to the databas", "end": 1961, "score": 0.9992027282714844, "start": 1956, "tag": "PASSWORD", "value": "tema5" } ]
null
[]
package es.upm.grise.profundizacion2018.tema5; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_CONNECT_DATABASE; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_FIND_DRIVER; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_INSTANTIATE_DRIVER; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_READ_FILE; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_RUN_QUERY; import static es.upm.grise.profundizacion2018.tema5.Error.CANNOT_UPDATE_COUNTER; import static es.upm.grise.profundizacion2018.tema5.Error.CONNECTION_LOST; import static es.upm.grise.profundizacion2018.tema5.Error.CORRUPTED_COUNTER; import static es.upm.grise.profundizacion2018.tema5.Error.INCORRECT_COUNTER; import static es.upm.grise.profundizacion2018.tema5.Error.NON_EXISTING_FILE; import static es.upm.grise.profundizacion2018.tema5.Error.UNDEFINED_ENVIRON; import static org.junit.Assert.*; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import org.junit.Before; import org.junit.Test; public class SmokeTest { Document doc1; Document doc2; DocumentIdProviderTest documentIdProviderTest; public String url = "jdbc:mysql://piedrafita.ls.fi.upm.es:8000/tema5"; public String username = "tema5"; public String password = "<PASSWORD>"; @Before public void toTest() throws NonRecoverableError, RecoverableError { doc1 = new Document(); doc2 = new Document(); documentIdProviderTest = new DocumentIdProviderTest(); } public static class DocumentIdProviderTest extends DocumentIdProvider{ /* public String url = "jdbc:mysql://piedrafita.ls.fi.upm.es:8000/tema5"; public String username = "tema5"; public String password = "<PASSWORD>"; // Create the connection to the database private DocumentIdProviderTest() throws NonRecoverableError { // Load DB driver try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (InstantiationException e) { System.out.println(CANNOT_INSTANTIATE_DRIVER.getMessage()); throw new NonRecoverableError(); } catch (IllegalAccessException e) { System.out.println(CANNOT_INSTANTIATE_DRIVER.getMessage()); throw new NonRecoverableError(); } catch (ClassNotFoundException e) { System.out.println(CANNOT_FIND_DRIVER.getMessage()); throw new NonRecoverableError(); } // Create DB connection try { connection = DriverManager.getConnection(url, username, password); } catch (SQLException e) { System.out.println(CANNOT_CONNECT_DATABASE.getMessage()); throw new NonRecoverableError(); } // Read from the COUNTERS table String query = "SELECT documentId FROM Counters"; Statement statement = null; ResultSet resultSet = null; try { statement = connection.createStatement(); resultSet = statement.executeQuery(query); } catch (SQLException e) { System.out.println(CANNOT_RUN_QUERY.getMessage()); throw new NonRecoverableError(); } // Get the last objectID int numberOfValues = 0; try { while (resultSet.next()) { documentId = resultSet.getInt("documentId"); numberOfValues++; } } catch (SQLException e) { System.out.println(INCORRECT_COUNTER.getMessage()); throw new NonRecoverableError(); } // Only one objectID can be retrieved if(numberOfValues != 1) { System.out.println(CORRUPTED_COUNTER.getMessage()); throw new NonRecoverableError(); } // Close all DB connections try { resultSet.close(); statement.close(); } catch (SQLException e) { System.out.println(CONNECTION_LOST.getMessage()); throw new NonRecoverableError(); } } // Return the next valid objectID public int getDocumentIdTest() throws NonRecoverableError { documentId++; // Access the COUNTERS table String query = "UPDATE Counters SET documentId = ?"; int numUpdatedRows; // Update the documentID counter try { PreparedStatement preparedStatement = connection.prepareStatement(query); preparedStatement.setInt(1, documentId); numUpdatedRows = preparedStatement.executeUpdate(); } catch (SQLException e) { System.out.println(e.toString()); System.out.println(CANNOT_UPDATE_COUNTER.getMessage()); throw new NonRecoverableError(); } // Check that the update has been effectively completed if (numUpdatedRows != 1) { System.out.println(CORRUPTED_COUNTER.getMessage()); throw new NonRecoverableError(); } return documentId; } */ } /** * a. La aplicación genera las plantillas correctamente * b. La aplicación asigna el número de documento correcto. * @throws NonRecoverableError * @throws RecoverableError */ @Test public void test1() throws NonRecoverableError, RecoverableError { Document d = new Document(); d.setTemplate("DECLARATION"); d.setTitle("A"); d.setAuthor("B"); d.setBody("C"); assertEquals("DOCUMENT ID: "+d.documentId+"\n\nTitle : A\nAuthor: B\n\nC", d.getFormattedDocument()); } /** * c. Los números de documento asignados a documentos consecutivos son también * números consecutivos. * @throws NonRecoverableError * @throws RecoverableError */ @Test public void test3() throws NonRecoverableError, RecoverableError { /*DocumentIdProviderTest documentIdProviderTest = new DocumentIdProviderTest(); int prevId = documentIdProviderTest.getDocumentIdTest(); Document document = new Document(documentIdProviderTest.getDocumentIdTest()); assertEquals(document.getDocumentId(),prevId+1);*/ assertEquals(doc1.getDocumentId() + 1, doc2.getDocumentId()); } /** * a. La aplicación detecta correctamente que el fichero de configuración no existe. * @throws NonRecoverableError * @throws RecoverableError */ @Test(expected = NonRecoverableError.class) public void test4() throws NonRecoverableError, RecoverableError { Properties propertiesInFile = new Properties(); documentIdProviderTest.checkIfConfigFileExists(propertiesInFile, null, "falsePath"); } /** * b. La aplicación detecta correctamente que el driver MySQL no existe. * @throws NonRecoverableError * @throws RecoverableError */ @Test public void test5() throws NonRecoverableError, RecoverableError { documentIdProviderTest.loadBdDriver("nonExisting.Driver"); } /** * c. La aplicación detecta correctamente que hay más de una fila en la tabla Counters. * @throws NonRecoverableError * @throws RecoverableError * @throws SQLException */ @Test public void test6() throws NonRecoverableError, RecoverableError, SQLException { /* documentIdProviderTest.checkIfConfigFileExists(new Properties(),null,System.getenv(documentIdProviderTest.ENVIRON)); documentIdProviderTest.loadBdDriver("com.mysql.jdbc.Driver"); documentIdProviderTest.connection = documentIdProviderTest.createDbConnection(url, username, password); String query = "SELECT documentId FROM Counters"; Statement stat = documentIdProviderTest.connection.createStatement(); ResultSet result = stat.executeQuery(query); */ } /** * La aplicación detecta correctamente que la actualización del documentID en la tabla Counters * ha sido incorrectamente realizado. * * @throws NonRecoverableError * @throws RecoverableError * @throws SQLException */ @Test public void test7() throws NonRecoverableError, RecoverableError, SQLException { Document doc = new Document(); assertEquals(documentIdProviderTest.getDocumentId(), doc.getDocumentId()); } }
8,010
0.722174
0.710655
274
28.149635
28.236673
118
false
false
0
0
0
0
0
0
2.379562
false
false
2
7843f1c9f10caea360b24054da72927a0b7134e7
33,440,615,391,363
aab665800a3ac2e6ea3d69eb8d71d54c90df7abf
/Benard/Grid.java
c3e1bf610c1541092db0c0f820d3c08e3e87e23d
[]
no_license
shohei/appletcfd
https://github.com/shohei/appletcfd
259c5de6255b2d3af75ed21fdc6852420316cb2a
776879b4ac466fbf5247f4ac3b94a2695b5c023d
refs/heads/master
2020-06-14T19:33:02.487000
2016-12-02T02:47:55
2016-12-02T02:47:55
75,353,856
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/**==================================================================== Input data for simulating Benard natural heat convection Grid.java : Grid generation All rights reserved, Copyright (C) 2001-2003, Ver.2.0 Last update; December 25,2002, Kiyoshi Minemura ======================================================================*/ public class Grid { private int mx, my; // number of mesh points private double x[][], y[][]; // nodal coordinates private float xp[], yp[]; // one dimensional nodal coordinates private double xmin,xmax,ymin,ymax; private String flow; // Method for selecting flow object public void selectGrid( String flow ){ this.flow = flow; if(flow == "duct") grid_duct(); oneDim(); } // When flow = "duct", generate the grid for Benard heat convection. public void grid_duct(){ mx=70; my=16; // node numbers specified x = new double [mx][my]; y = new double [mx][my]; double a, co, b, sj, s0, s1, s2; int i, j; // perpendicular direction ( duct width = 1) s0 = 2.0/(double)(my-1); a = 1.15; b = (a+1.0)/(a-1.0); co = 1.0/(b-1.0); for(j=0; j<my; j++){ sj = s0*(double)j; // equal ratio s1 = Math.pow(b, sj); s2 = Math.pow(b, sj-1.0); y[0][j] = co*(s1-1.0)/(s2+1.0); x[0][j]=0.0; } // axial direction ( duct length = 10) s0 = 2.0/(double)(mx-1); a = 1.3; b = (a+1.0)/(a-1.0); co = 10.0/(b-1.0); for(i=0; i<mx; i++){ sj = s0*(double)i; // equal ratio s1 = Math.pow(b, sj); s2 = Math.pow(b, sj-1.0); x[i][0] = co*(s1-1.0)/(s2+1.0); } // for(i=1 ; i<mx; i++){ for(j=0; j<my; j++){ x[i][j]=x[i][0]; y[i][j]=y[0][j];} } // graphic output range xmin=-0.25; xmax=10.25; ymin=-0.5; ymax=1.5; } // access methods private void oneDim(){ int k, kmax = mx*my; xp = new float [kmax]; yp = new float [kmax]; for(int i=0; i<mx; i++){ for(int j=0; j<my; j++){ k=my*i+j; xp[k] = (float)x[i][j]; yp[k] = (float)y[i][j]; } } } public double [] getRange(){ double ra[] = { xmin, xmax, ymin, ymax }; return ra; } public double[][] getXarray(){ return x; } public double[][] getYarray(){ return y; } public float [] getXpArray(){ return xp; } public float [] getYpArray(){ return yp; } public int [] getGrid(){ int co[]={ mx, my }; return co; } }
UTF-8
Java
2,729
java
Grid.java
Java
[ { "context": " Ver.2.0 Last update; December 25,2002, Kiyoshi Minemura \r\n==============================================", "end": 336, "score": 0.9998407363891602, "start": 320, "tag": "NAME", "value": "Kiyoshi Minemura" } ]
null
[]
/**==================================================================== Input data for simulating Benard natural heat convection Grid.java : Grid generation All rights reserved, Copyright (C) 2001-2003, Ver.2.0 Last update; December 25,2002, <NAME> ======================================================================*/ public class Grid { private int mx, my; // number of mesh points private double x[][], y[][]; // nodal coordinates private float xp[], yp[]; // one dimensional nodal coordinates private double xmin,xmax,ymin,ymax; private String flow; // Method for selecting flow object public void selectGrid( String flow ){ this.flow = flow; if(flow == "duct") grid_duct(); oneDim(); } // When flow = "duct", generate the grid for Benard heat convection. public void grid_duct(){ mx=70; my=16; // node numbers specified x = new double [mx][my]; y = new double [mx][my]; double a, co, b, sj, s0, s1, s2; int i, j; // perpendicular direction ( duct width = 1) s0 = 2.0/(double)(my-1); a = 1.15; b = (a+1.0)/(a-1.0); co = 1.0/(b-1.0); for(j=0; j<my; j++){ sj = s0*(double)j; // equal ratio s1 = Math.pow(b, sj); s2 = Math.pow(b, sj-1.0); y[0][j] = co*(s1-1.0)/(s2+1.0); x[0][j]=0.0; } // axial direction ( duct length = 10) s0 = 2.0/(double)(mx-1); a = 1.3; b = (a+1.0)/(a-1.0); co = 10.0/(b-1.0); for(i=0; i<mx; i++){ sj = s0*(double)i; // equal ratio s1 = Math.pow(b, sj); s2 = Math.pow(b, sj-1.0); x[i][0] = co*(s1-1.0)/(s2+1.0); } // for(i=1 ; i<mx; i++){ for(j=0; j<my; j++){ x[i][j]=x[i][0]; y[i][j]=y[0][j];} } // graphic output range xmin=-0.25; xmax=10.25; ymin=-0.5; ymax=1.5; } // access methods private void oneDim(){ int k, kmax = mx*my; xp = new float [kmax]; yp = new float [kmax]; for(int i=0; i<mx; i++){ for(int j=0; j<my; j++){ k=my*i+j; xp[k] = (float)x[i][j]; yp[k] = (float)y[i][j]; } } } public double [] getRange(){ double ra[] = { xmin, xmax, ymin, ymax }; return ra; } public double[][] getXarray(){ return x; } public double[][] getYarray(){ return y; } public float [] getXpArray(){ return xp; } public float [] getYpArray(){ return yp; } public int [] getGrid(){ int co[]={ mx, my }; return co; } }
2,719
0.446684
0.409307
76
33.828949
21.529898
73
false
false
0
0
0
0
71
0.050934
1.210526
false
false
2
f8a7e5342a93517f6535d57d107ea4768c731c9f
11,622,181,521,611
2a34f1d14e6bd68cee1bb320fd0bb34ca9558886
/Problems/CodeForces/1400_TheDoctorMeetsVader.java
a9fa54de817d994e24e46ae1ec11274fc11c1fdf
[]
no_license
DevinLeamy/Competitive-Programming
https://github.com/DevinLeamy/Competitive-Programming
840fc905ba872c476e4180274555770cf013d400
9c0fac489e238d98ba983606da4a0a6d7f519d13
refs/heads/master
2022-05-05T05:17:48.256000
2022-03-21T03:43:00
2022-03-21T03:43:00
199,560,255
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; import java.io.*; public class TheDoctorMeetsVader_1400 { public static void main(String[] args) throws IOException { StringBuilder output = new StringBuilder(); int S = nextInt(); int B = nextInt(); StringTokenizer A = new StringTokenizer(in.readLine()); HashMap<Integer, Long> sums = new HashMap<>(); TreeSet<Integer> defense = new TreeSet<>(); for (int i = 0; i < B; i++) { int D = nextInt(); int G = nextInt(); defense.add(D); if (sums.containsKey(D)) { sums.replace(D, sums.get(D) + G); continue; } sums.put(D, (long) G); } Iterator<Integer> hold = defense.iterator(); long sum = sums.get(hold.next()); while (hold.hasNext()) { int key = hold.next(); sum = sums.get(key) + sum; sums.replace(key, sum); } while (A.hasMoreTokens()) { try { long value = sums.get(defense.floor(Integer.parseInt(A.nextToken()))); output.append(value); output.append(" "); } catch (NullPointerException npe) { output.append(0); output.append(" "); } } System.out.println(output.toString()); } private static StringTokenizer line = new StringTokenizer(""); private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private static int nextInt() throws IOException { return Integer.parseInt(nextString()); } private static long nextLong() throws IOException { return Long.parseLong(nextString()); } private static String nextString() throws IOException { if (line.hasMoreTokens()) { return line.nextToken(); } else { line = new StringTokenizer(in.readLine()); return line.nextToken(); } } }
UTF-8
Java
2,068
java
1400_TheDoctorMeetsVader.java
Java
[]
null
[]
import java.util.*; import java.io.*; public class TheDoctorMeetsVader_1400 { public static void main(String[] args) throws IOException { StringBuilder output = new StringBuilder(); int S = nextInt(); int B = nextInt(); StringTokenizer A = new StringTokenizer(in.readLine()); HashMap<Integer, Long> sums = new HashMap<>(); TreeSet<Integer> defense = new TreeSet<>(); for (int i = 0; i < B; i++) { int D = nextInt(); int G = nextInt(); defense.add(D); if (sums.containsKey(D)) { sums.replace(D, sums.get(D) + G); continue; } sums.put(D, (long) G); } Iterator<Integer> hold = defense.iterator(); long sum = sums.get(hold.next()); while (hold.hasNext()) { int key = hold.next(); sum = sums.get(key) + sum; sums.replace(key, sum); } while (A.hasMoreTokens()) { try { long value = sums.get(defense.floor(Integer.parseInt(A.nextToken()))); output.append(value); output.append(" "); } catch (NullPointerException npe) { output.append(0); output.append(" "); } } System.out.println(output.toString()); } private static StringTokenizer line = new StringTokenizer(""); private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private static int nextInt() throws IOException { return Integer.parseInt(nextString()); } private static long nextLong() throws IOException { return Long.parseLong(nextString()); } private static String nextString() throws IOException { if (line.hasMoreTokens()) { return line.nextToken(); } else { line = new StringTokenizer(in.readLine()); return line.nextToken(); } } }
2,068
0.525145
0.522244
69
28.971014
21.936649
92
false
false
0
0
0
0
0
0
0.550725
false
false
2
987077ecda124348b64dc30b308c5278157ba7c9
13,709,535,641,116
58bac9d1a20b2c33188261127a9406498238d75a
/src/test/java/com/codewars/kyu7/IsogramTest.java
02c517c53bd3b6b75dc04d55dc791b0e70947b86
[]
no_license
briansurratt/exercises
https://github.com/briansurratt/exercises
a8de8b6b5711f272c21517268a63096bdb424d6b
a33cd26f67ed508153bb0d81161318a42fba3e3b
refs/heads/master
2020-08-17T12:00:51.551000
2020-04-30T00:53:56
2020-04-30T00:53:56
215,663,147
0
0
null
false
2020-04-30T00:53:57
2019-10-16T23:34:34
2019-10-16T23:34:37
2020-04-30T00:53:57
0
0
0
0
null
false
false
package com.codewars.kyu7; import org.junit.Test; import static org.junit.Assert.assertEquals; public class IsogramTest { @Test public void test1() { assertEquals(true, com.codewars.kyu7.Isogram.isIsogram("Dermatoglyphics")); } @Test public void test2() throws Exception { assertEquals(true, com.codewars.kyu7.Isogram.isIsogram("isogram")); } @Test public void test3() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("moose")); } @Test public void test4() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("isIsogram")); } @Test public void test5() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("aba")); } @Test public void test6() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("moOse")); } @Test public void test7() throws Exception { assertEquals(true, com.codewars.kyu7.Isogram.isIsogram("thumbscrewjapingly")); } @Test public void test9() throws Exception { assertEquals(true, Isogram.isIsogram("")); } }
UTF-8
Java
1,192
java
IsogramTest.java
Java
[]
null
[]
package com.codewars.kyu7; import org.junit.Test; import static org.junit.Assert.assertEquals; public class IsogramTest { @Test public void test1() { assertEquals(true, com.codewars.kyu7.Isogram.isIsogram("Dermatoglyphics")); } @Test public void test2() throws Exception { assertEquals(true, com.codewars.kyu7.Isogram.isIsogram("isogram")); } @Test public void test3() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("moose")); } @Test public void test4() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("isIsogram")); } @Test public void test5() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("aba")); } @Test public void test6() throws Exception { assertEquals(false, com.codewars.kyu7.Isogram.isIsogram("moOse")); } @Test public void test7() throws Exception { assertEquals(true, com.codewars.kyu7.Isogram.isIsogram("thumbscrewjapingly")); } @Test public void test9() throws Exception { assertEquals(true, Isogram.isIsogram("")); } }
1,192
0.657718
0.644295
50
22.84
26.885208
86
false
false
0
0
0
0
0
0
0.38
false
false
2
981cff455df5a59efb023aaa7e18eaa029e6e5af
14,705,968,056,211
a366eaacbc150ed602623b134862bc26d5a51b7f
/homework3/src/main/java/com/kurochkin/illya/company/repository/ArrayCarRepository.java
f437df2573a3733c5b59ce3feec9023544322e6a
[]
no_license
illyakurochkin/epam-projects
https://github.com/illyakurochkin/epam-projects
efd23b4c8828e84d170971a5552377e0c04aed5b
4d2155c21ebad1ab5613daf0a4248139bb517ede
refs/heads/master
2020-05-02T08:12:37.320000
2019-03-29T13:36:31
2019-03-29T13:36:31
177,837,169
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kurochkin.illya.company.repository; import com.kurochkin.illya.company.entiry.Car; import java.util.Arrays; import java.util.Collection; import java.util.Set; import java.util.stream.Collectors; public class ArrayCarRepository implements CarRepository { private final Car[] cars; public ArrayCarRepository(Car...cars) { this.cars = Arrays.copyOf(cars, cars.length); } public <T extends Car> ArrayCarRepository(Collection<T> cars) { this(cars.toArray(new Car[]{})); } @Override public Car findCarById(long id) { return Arrays.stream(cars) .filter(car -> car.getId() == id) .findAny().orElse(null); } @Override public Set<Car> findCarsByBrand(String brand) { return Arrays.stream(cars) .filter(car -> car.getBrand().equalsIgnoreCase(brand)) .collect(Collectors.toSet()); } @Override public Set<Car> findCarsByModel(String model) { return Arrays.stream(cars) .filter(car -> car.getModel().equalsIgnoreCase(model)) .collect(Collectors.toSet()); } @Override public Set<Car> findCarsByYear(int year) { return Arrays.stream(cars) .filter(car -> car.getYear().equals(year)) .collect(Collectors.toSet()); } }
UTF-8
Java
1,366
java
ArrayCarRepository.java
Java
[]
null
[]
package com.kurochkin.illya.company.repository; import com.kurochkin.illya.company.entiry.Car; import java.util.Arrays; import java.util.Collection; import java.util.Set; import java.util.stream.Collectors; public class ArrayCarRepository implements CarRepository { private final Car[] cars; public ArrayCarRepository(Car...cars) { this.cars = Arrays.copyOf(cars, cars.length); } public <T extends Car> ArrayCarRepository(Collection<T> cars) { this(cars.toArray(new Car[]{})); } @Override public Car findCarById(long id) { return Arrays.stream(cars) .filter(car -> car.getId() == id) .findAny().orElse(null); } @Override public Set<Car> findCarsByBrand(String brand) { return Arrays.stream(cars) .filter(car -> car.getBrand().equalsIgnoreCase(brand)) .collect(Collectors.toSet()); } @Override public Set<Car> findCarsByModel(String model) { return Arrays.stream(cars) .filter(car -> car.getModel().equalsIgnoreCase(model)) .collect(Collectors.toSet()); } @Override public Set<Car> findCarsByYear(int year) { return Arrays.stream(cars) .filter(car -> car.getYear().equals(year)) .collect(Collectors.toSet()); } }
1,366
0.619326
0.619326
49
26.87755
22.261555
70
false
false
0
0
0
0
0
0
0.285714
false
false
2
794910008ea3cf55d62f383a4cf61bb1d896b8ea
6,055,903,887,422
d758a582e91b5d083c725558d18a6f6ae1c23452
/TCPClientePrj/src/br/fumec/tcp/TCPNovoCliente.java
1d8c40ac35d39868e1ff1d417e93df0776323727
[]
no_license
Edd002/Desenvolvimento-de-Sistemas-Distribuidos-workspace
https://github.com/Edd002/Desenvolvimento-de-Sistemas-Distribuidos-workspace
5da4f3b67a1496411b580d42e65537252589e669
08b3b693186562e74a4926f7f66bcb03bca6e732
refs/heads/master
2022-11-08T20:54:24.943000
2020-06-28T23:30:33
2020-06-28T23:30:33
271,330,487
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.fumec.tcp; // Protocolo: // // 1. O cliente deve enviar para o servidor os dados a processar na forma de um vetor de inteiros. // 2. O servidor espera receber do cliente dados na forma de um vetor de inteiros. // 3. Uma mensagem enviada pelo cliente para o servidor conterá um único vetor de inteiros. // 4. O servidor enviará uma resposta para o cliente na forma de um valor inteiro contendo // o resultado da soma dos elementos do vetor recebido. // 5. O cliente espera receber do servidor dados na forma de um valor inteiro. // 6. Uma mensagem enviada pelo servidor para o cliente conterá um único valor inteiro. // 7. O cliente enviará para o servidor uma referência nula para indicar que já terminou suas requisições // e que a conexão pode ser fechada. // 8. O servidor manterá a conexão com o cliente aberta até que receba uma referência nula, // quando então fechará a conexão e encerrará a interação com o cliente. import java.io.DataInputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.net.Socket; import java.util.Random; public class TCPNovoCliente { private static final String HOSTNAME = "localhost"; private static final int PORT = 4321; private static final int NUMREQS = 5; private static final int MAXTAM = 10; private static final int MAXELM = 100; public static void main(String[] args) { String hostname = HOSTNAME; int porta = PORT; Random r = new Random(); try { Socket s = new Socket(hostname, porta); DataInputStream in = new DataInputStream(s.getInputStream()); ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream()); for(int i = 0; i < NUMREQS; i++) { int tamanho = r.nextInt(MAXTAM) + 1; int[] vet = new int[tamanho]; for(int j = 0; j < vet.length; j++) vet[j] = r.nextInt(MAXELM + 1); out.writeObject(vet); int resultado = in.readInt(); exibe(vet, resultado); Thread.sleep(10000); } out.writeObject((int[])null); s.close(); } catch (IOException | InterruptedException e) { e.printStackTrace(); } } private static void exibe(int[] v, int r) { System.out.print("Soma "); for(int e: v) System.out.print(e + " "); System.out.println("= " + r); } }
UTF-8
Java
2,260
java
TCPNovoCliente.java
Java
[]
null
[]
package br.fumec.tcp; // Protocolo: // // 1. O cliente deve enviar para o servidor os dados a processar na forma de um vetor de inteiros. // 2. O servidor espera receber do cliente dados na forma de um vetor de inteiros. // 3. Uma mensagem enviada pelo cliente para o servidor conterá um único vetor de inteiros. // 4. O servidor enviará uma resposta para o cliente na forma de um valor inteiro contendo // o resultado da soma dos elementos do vetor recebido. // 5. O cliente espera receber do servidor dados na forma de um valor inteiro. // 6. Uma mensagem enviada pelo servidor para o cliente conterá um único valor inteiro. // 7. O cliente enviará para o servidor uma referência nula para indicar que já terminou suas requisições // e que a conexão pode ser fechada. // 8. O servidor manterá a conexão com o cliente aberta até que receba uma referência nula, // quando então fechará a conexão e encerrará a interação com o cliente. import java.io.DataInputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.net.Socket; import java.util.Random; public class TCPNovoCliente { private static final String HOSTNAME = "localhost"; private static final int PORT = 4321; private static final int NUMREQS = 5; private static final int MAXTAM = 10; private static final int MAXELM = 100; public static void main(String[] args) { String hostname = HOSTNAME; int porta = PORT; Random r = new Random(); try { Socket s = new Socket(hostname, porta); DataInputStream in = new DataInputStream(s.getInputStream()); ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream()); for(int i = 0; i < NUMREQS; i++) { int tamanho = r.nextInt(MAXTAM) + 1; int[] vet = new int[tamanho]; for(int j = 0; j < vet.length; j++) vet[j] = r.nextInt(MAXELM + 1); out.writeObject(vet); int resultado = in.readInt(); exibe(vet, resultado); Thread.sleep(10000); } out.writeObject((int[])null); s.close(); } catch (IOException | InterruptedException e) { e.printStackTrace(); } } private static void exibe(int[] v, int r) { System.out.print("Soma "); for(int e: v) System.out.print(e + " "); System.out.println("= " + r); } }
2,260
0.704779
0.69272
63
34.539684
27.741337
105
false
false
0
0
0
0
0
0
2.047619
false
false
2
c930c684cd5fc363e3b7ea9f8a5f93189969e2d1
4,750,233,872,373
20f9a860a56c43710d72aed0d01fcb0ff82ee4a7
/src/MinSpenntre.java
083ce6d2a85c962c0bb6786db1e21a5027f3590a
[]
no_license
dsreitan/Alg14MinSpenntre
https://github.com/dsreitan/Alg14MinSpenntre
fe7210a73583b58206b16280d6c163ae82772a8b
f3dc9d940266d1451b31ebb34231ed5deb66ad3f
refs/heads/master
2021-01-23T00:07:20.650000
2013-11-23T17:10:00
2013-11-23T17:10:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import Tree.*; import Tree.Tree.Edge; import Tree.Tree.Node; import java.util.ArrayList; import java.util.List; class MinSpenntre { public List<Node> settledNodes; public List<Node> unsettledNodes; public List<Integer> totalWeight = new ArrayList<>(); public MinSpenntre(Tree tree) { settledNodes = new ArrayList<>(); unsettledNodes = tree.getNodes(); } public List<Node> execute(Node source) { totalWeight.add(0); settleNode(source); while (!unsettledNodes.isEmpty()) { settleNode(getLowestUnsettledNeighbor()); } return settledNodes; // System.out.println("Settled: " + settledNodes); // System.out.println("Unsettled: " + unsettledNodes); } private List<Node> getNeighbors(Node node) { List<Node> neighbors = new ArrayList<>(); for (Edge edge : node.getOutEdges()) { neighbors.add(edge.getTargetNode()); } return neighbors; } private int getDistanceBetweenNeighborNodes(Node source, Node target) { for (Edge edge : source.getOutEdges()) { if (edge.getSourceNode().equals(source) && edge.getTargetNode().equals(target)) { return edge.getWeight(); } } throw new RuntimeException("Source and target are not neighbors"); } private Node getLowestUnsettledNeighbor() { int lowestWeight = Integer.MAX_VALUE; Node lowestNeighbor = null; for (Node node : settledNodes) { for (Node neighbor : getNeighbors(node)) { int weight = getDistanceBetweenNeighborNodes(node, neighbor); if (weight < lowestWeight && !isSettled(neighbor)) { lowestWeight = weight; lowestNeighbor = neighbor; } } } totalWeight.add(lowestWeight); return lowestNeighbor; } private boolean isSettled(Node node) { return (settledNodes.contains(node)) ? true : false; } private void settleNode(Node node) { unsettledNodes.remove(node); settledNodes.add(node); } public List<Integer> getWeightList(){ return totalWeight; } public int getTotalWeight(){ int result = 0; for (int i : totalWeight){ result += i; } return result; } }
UTF-8
Java
2,431
java
MinSpenntre.java
Java
[]
null
[]
import Tree.*; import Tree.Tree.Edge; import Tree.Tree.Node; import java.util.ArrayList; import java.util.List; class MinSpenntre { public List<Node> settledNodes; public List<Node> unsettledNodes; public List<Integer> totalWeight = new ArrayList<>(); public MinSpenntre(Tree tree) { settledNodes = new ArrayList<>(); unsettledNodes = tree.getNodes(); } public List<Node> execute(Node source) { totalWeight.add(0); settleNode(source); while (!unsettledNodes.isEmpty()) { settleNode(getLowestUnsettledNeighbor()); } return settledNodes; // System.out.println("Settled: " + settledNodes); // System.out.println("Unsettled: " + unsettledNodes); } private List<Node> getNeighbors(Node node) { List<Node> neighbors = new ArrayList<>(); for (Edge edge : node.getOutEdges()) { neighbors.add(edge.getTargetNode()); } return neighbors; } private int getDistanceBetweenNeighborNodes(Node source, Node target) { for (Edge edge : source.getOutEdges()) { if (edge.getSourceNode().equals(source) && edge.getTargetNode().equals(target)) { return edge.getWeight(); } } throw new RuntimeException("Source and target are not neighbors"); } private Node getLowestUnsettledNeighbor() { int lowestWeight = Integer.MAX_VALUE; Node lowestNeighbor = null; for (Node node : settledNodes) { for (Node neighbor : getNeighbors(node)) { int weight = getDistanceBetweenNeighborNodes(node, neighbor); if (weight < lowestWeight && !isSettled(neighbor)) { lowestWeight = weight; lowestNeighbor = neighbor; } } } totalWeight.add(lowestWeight); return lowestNeighbor; } private boolean isSettled(Node node) { return (settledNodes.contains(node)) ? true : false; } private void settleNode(Node node) { unsettledNodes.remove(node); settledNodes.add(node); } public List<Integer> getWeightList(){ return totalWeight; } public int getTotalWeight(){ int result = 0; for (int i : totalWeight){ result += i; } return result; } }
2,431
0.584533
0.58371
85
27.6
22.002781
93
false
false
0
0
0
0
0
0
0.435294
false
false
2
2bd650b6d60da91220a45aa343e4cb5b7ec4d7bf
21,500,606,324,388
9075a2eac54fc1a65043d76075127ac324431337
/src/main/java/lmr/randomizer/node/EscapeChecker.java
3d447154b389ecf47ce41d7ce97ac1373154bcee
[ "BSD-2-Clause" ]
permissive
thezerothcat/LaMulanaRandomizer
https://github.com/thezerothcat/LaMulanaRandomizer
0a69e6f8c9cbcae5a0d1469197055c4737c60ae7
fc98ed4a3194ad37c1acafae18456972e48ae33b
refs/heads/master
2023-05-12T09:18:45.291000
2022-07-30T23:25:44
2022-07-30T23:25:44
96,950,859
56
19
BSD-2-Clause
false
2023-05-09T18:28:53
2017-07-12T01:09:30
2023-04-28T00:01:19
2023-05-09T18:28:49
10,332
48
15
33
Java
false
false
package lmr.randomizer.node; import lmr.randomizer.DataFromFile; import lmr.randomizer.FileUtils; import lmr.randomizer.Settings; import lmr.randomizer.randomization.BacksideDoorRandomizer; import lmr.randomizer.randomization.ItemRandomizer; import lmr.randomizer.randomization.ShopRandomizer; import lmr.randomizer.randomization.TransitionGateRandomizer; import lmr.randomizer.util.LocationCoordinateMapper; import java.util.*; /** * Created by thezerothcat on 7/11/2017. */ public class EscapeChecker { private Map<String, NodeWithRequirements> mapOfNodeNameToRequirementsObject = new HashMap<>(); private Set<String> accessedNodes = new HashSet<>(); private List<String> queuedUpdates = new ArrayList<>(); private BacksideDoorRandomizer backsideDoorRandomizer; private TransitionGateRandomizer transitionGateRandomizer; private ItemRandomizer itemRandomizer; private ShopRandomizer shopRandomizer; private String successNode; public EscapeChecker(BacksideDoorRandomizer backsideDoorRandomizer, TransitionGateRandomizer transitionGateRandomizer, ItemRandomizer itemRandomizer, ShopRandomizer shopRandomizer, Set<String> accessedNodesFromValidation, String startingLocation, String successNode) { this.backsideDoorRandomizer = backsideDoorRandomizer; this.transitionGateRandomizer = transitionGateRandomizer; this.itemRandomizer = itemRandomizer; this.shopRandomizer = shopRandomizer; this.successNode = successNode; mapOfNodeNameToRequirementsObject = copyRequirementsMap(DataFromFile.getMapOfNodeNameToRequirementsObject()); queuedUpdates.add(startingLocation); queuedUpdates.add(startingLocation.replace("Location:", "Exit:")); queuedUpdates.add("State: Escape"); if(accessedNodesFromValidation.contains("Transition: Moonlight L1")) { queuedUpdates.add("State: Phase 1 Moonlight Access"); } if(accessedNodesFromValidation.contains("Transition: Surface R1")) { queuedUpdates.add("State: Phase 1 Surface Access"); } if(accessedNodesFromValidation.contains("Location: Tower of the Goddess [Grail]") && accessedNodesFromValidation.contains("Plane Model")) { queuedUpdates.add("State: Phase 1 Shield Statue Access"); } if(accessedNodesFromValidation.contains("Event: Flooded Temple of the Sun") && accessedNodesFromValidation.contains("Seal: O3") && accessedNodesFromValidation.contains("Location: Temple of the Sun [East]")) { queuedUpdates.add("State: Phase 1 Sun Exits Opened"); } for(String accessedNodeFromValidation : accessedNodesFromValidation) { if(!"Holy Grail".equals(accessedNodeFromValidation) && !"State: Pre-Escape".equals(accessedNodeFromValidation) && !accessedNodeFromValidation.endsWith(" Warp") && !accessedNodeFromValidation.startsWith("Location:") && !accessedNodeFromValidation.startsWith("Coin:") && !accessedNodeFromValidation.startsWith("Transition:") && (!accessedNodeFromValidation.startsWith("Exit:") || Settings.isRandomizeNpcs()) && !accessedNodeFromValidation.startsWith("NPC:") && !accessedNodeFromValidation.startsWith("NPCL:") && !accessedNodeFromValidation.startsWith("Door:")) { queuedUpdates.add(accessedNodeFromValidation); } } for(String queuedUpdateNode : queuedUpdates) { mapOfNodeNameToRequirementsObject.remove(queuedUpdateNode); } if(Settings.getEnabledGlitches().contains("Raindrop")) { NodeWithRequirements nodeWithRequirements = mapOfNodeNameToRequirementsObject.get(LocationCoordinateMapper.getStartingLocation()); if(nodeWithRequirements == null) { nodeWithRequirements = new NodeWithRequirements(LocationCoordinateMapper.getStartingLocation()); mapOfNodeNameToRequirementsObject.put(LocationCoordinateMapper.getStartingLocation(), nodeWithRequirements); } nodeWithRequirements.addRequirementSet(new ArrayList<>(Arrays.asList("Glitch: Raindrop", LocationCoordinateMapper.getStartingLocation().replace("Location:", "Exit:")))); } if(!LocationCoordinateMapper.isSurfaceStart() && accessedNodesFromValidation.contains("Location: Surface [Main]")) { NodeWithRequirements nodeWithRequirements = mapOfNodeNameToRequirementsObject.get("Location: Surface [Main]"); if(nodeWithRequirements == null) { nodeWithRequirements = new NodeWithRequirements("Location: Surface [Main]"); mapOfNodeNameToRequirementsObject.put("Location: Surface [Main]", nodeWithRequirements); } nodeWithRequirements.addRequirementSet(new ArrayList<>(Arrays.asList("Transition: Surface R1"))); } backsideDoorRandomizer.rebuildRequirementsMap(); FileUtils.log("Nodes accessible at escape start: " + queuedUpdates); } private static Map<String, NodeWithRequirements> copyRequirementsMap(Map<String, NodeWithRequirements> mapToCopy) { Map<String, NodeWithRequirements> copyMap = new HashMap<>(); for(Map.Entry<String, NodeWithRequirements> entry : mapToCopy.entrySet()) { copyMap.put(entry.getKey(), new NodeWithRequirements(entry.getValue())); } return copyMap; } public boolean isSuccess() { while (!queuedUpdates.isEmpty()) { computeAccessibleNodes(queuedUpdates.iterator().next(), null); if(accessedNodes.contains(successNode)) { return true; } } if(!accessedNodes.contains(successNode)) { FileUtils.log("Nodes not accessed: " + mapOfNodeNameToRequirementsObject.keySet()); } return accessedNodes.contains(successNode); } public void computeAccessibleNodes(String newState, Integer attemptNumber) { accessedNodes.add(newState); NodeWithRequirements node; Set<String> nodesToRemove = new HashSet<>(); for(String nodeName : mapOfNodeNameToRequirementsObject.keySet()) { node = mapOfNodeNameToRequirementsObject.get(nodeName); if(node.updateRequirements(newState)) { handleNodeAccess(nodeName, node.getType(), attemptNumber); nodesToRemove.add(nodeName); } } for(String nodeToRemove : nodesToRemove) { mapOfNodeNameToRequirementsObject.remove(nodeToRemove); } queuedUpdates.remove(newState); } private void handleNodeAccess(String nodeName, NodeType nodeType, Integer attemptNumber) { switch (nodeType) { case ITEM_LOCATION: if(!Settings.isRandomizeNpcs()) { if(nodeName.startsWith("Coin:") && !Settings.isRandomizeCoinChests()) { break; } if(nodeName.startsWith("Trap:") && !Settings.isRandomizeTrapItems()) { break; } String item = itemRandomizer.getItem(nodeName); if (item == null) { throw new RuntimeException("Unable to find item at " + nodeName + " location of type " + nodeType.toString()); } if (!Settings.getCurrentRemovedItems().contains(item) && !Settings.getRemovedItems().contains(item) && !"Holy Grail".equals(item)) { FileUtils.logDetail("Found item " + item, attemptNumber); queuedUpdates.add(item); } } break; case SHOP: if(!Settings.isRandomizeNpcs()) { for(String shopItem : shopRandomizer.getShopItems(nodeName)) { if(shopItem == null) { throw new RuntimeException("Unable to find item at " + nodeName + " location of type " + nodeType.toString()); } if(!accessedNodes.contains(shopItem) && !queuedUpdates.contains(shopItem) && !Settings.getRemovedItems().contains(shopItem) && !Settings.getCurrentRemovedItems().contains(shopItem)) { FileUtils.logDetail("Found item " + shopItem, attemptNumber); queuedUpdates.add(shopItem); } } } break; case MAP_LOCATION: FileUtils.logDetail("Gained access to node " + nodeName, attemptNumber); queuedUpdates.add(nodeName); queuedUpdates.addAll(backsideDoorRandomizer.getAvailableNodes(nodeName, null)); break; case NPC_LOCATION: // todo: door contents and move npc randomizer in here queuedUpdates.add(nodeName); break; case NPC: if(!Settings.isRandomizeNpcs()) { FileUtils.logDetail("Gained access to node " + nodeName, attemptNumber); queuedUpdates.add(nodeName); } break; case STATE: case SETTING: queuedUpdates.add(nodeName); if(DataFromFile.GUARDIAN_DEFEATED_EVENTS.contains(nodeName) || nodeName.startsWith("Fairy:")) { queuedUpdates.addAll(backsideDoorRandomizer.getAvailableNodes(nodeName, null)); } if("Event: Skanda Block Removed".equals(nodeName) || "Event: Illusion Unlocked".equals(nodeName)) { if(transitionGateRandomizer.isEndlessL1Open(nodeName)) { queuedUpdates.add("State: Endless L1 Open"); } } break; case EXIT: if(!Settings.isRandomizeNpcs()) { queuedUpdates.add(nodeName); queuedUpdates.addAll(backsideDoorRandomizer.getAvailableNodes(nodeName, attemptNumber)); queuedUpdates.addAll(transitionGateRandomizer.getTransitionExits(nodeName, attemptNumber)); } break; case TRANSITION: queuedUpdates.add(nodeName); String reverseTransition = transitionGateRandomizer.getTransitionReverse(nodeName); if(!accessedNodes.contains(reverseTransition) && !queuedUpdates.contains(reverseTransition)) { FileUtils.logDetail("Gained access to node " + reverseTransition + " through reverse transition " + nodeName, attemptNumber); queuedUpdates.add(reverseTransition); if("Transition: Goddess L2".equals(reverseTransition) ) { queuedUpdates.add("Event: Special Statue Removal"); } } break; } } }
UTF-8
Java
11,280
java
EscapeChecker.java
Java
[ { "context": "ateMapper;\n\nimport java.util.*;\n\n/**\n * Created by thezerothcat on 7/11/2017.\n */\npublic class EscapeChecker {\n ", "end": 462, "score": 0.9996564984321594, "start": 450, "tag": "USERNAME", "value": "thezerothcat" } ]
null
[]
package lmr.randomizer.node; import lmr.randomizer.DataFromFile; import lmr.randomizer.FileUtils; import lmr.randomizer.Settings; import lmr.randomizer.randomization.BacksideDoorRandomizer; import lmr.randomizer.randomization.ItemRandomizer; import lmr.randomizer.randomization.ShopRandomizer; import lmr.randomizer.randomization.TransitionGateRandomizer; import lmr.randomizer.util.LocationCoordinateMapper; import java.util.*; /** * Created by thezerothcat on 7/11/2017. */ public class EscapeChecker { private Map<String, NodeWithRequirements> mapOfNodeNameToRequirementsObject = new HashMap<>(); private Set<String> accessedNodes = new HashSet<>(); private List<String> queuedUpdates = new ArrayList<>(); private BacksideDoorRandomizer backsideDoorRandomizer; private TransitionGateRandomizer transitionGateRandomizer; private ItemRandomizer itemRandomizer; private ShopRandomizer shopRandomizer; private String successNode; public EscapeChecker(BacksideDoorRandomizer backsideDoorRandomizer, TransitionGateRandomizer transitionGateRandomizer, ItemRandomizer itemRandomizer, ShopRandomizer shopRandomizer, Set<String> accessedNodesFromValidation, String startingLocation, String successNode) { this.backsideDoorRandomizer = backsideDoorRandomizer; this.transitionGateRandomizer = transitionGateRandomizer; this.itemRandomizer = itemRandomizer; this.shopRandomizer = shopRandomizer; this.successNode = successNode; mapOfNodeNameToRequirementsObject = copyRequirementsMap(DataFromFile.getMapOfNodeNameToRequirementsObject()); queuedUpdates.add(startingLocation); queuedUpdates.add(startingLocation.replace("Location:", "Exit:")); queuedUpdates.add("State: Escape"); if(accessedNodesFromValidation.contains("Transition: Moonlight L1")) { queuedUpdates.add("State: Phase 1 Moonlight Access"); } if(accessedNodesFromValidation.contains("Transition: Surface R1")) { queuedUpdates.add("State: Phase 1 Surface Access"); } if(accessedNodesFromValidation.contains("Location: Tower of the Goddess [Grail]") && accessedNodesFromValidation.contains("Plane Model")) { queuedUpdates.add("State: Phase 1 Shield Statue Access"); } if(accessedNodesFromValidation.contains("Event: Flooded Temple of the Sun") && accessedNodesFromValidation.contains("Seal: O3") && accessedNodesFromValidation.contains("Location: Temple of the Sun [East]")) { queuedUpdates.add("State: Phase 1 Sun Exits Opened"); } for(String accessedNodeFromValidation : accessedNodesFromValidation) { if(!"Holy Grail".equals(accessedNodeFromValidation) && !"State: Pre-Escape".equals(accessedNodeFromValidation) && !accessedNodeFromValidation.endsWith(" Warp") && !accessedNodeFromValidation.startsWith("Location:") && !accessedNodeFromValidation.startsWith("Coin:") && !accessedNodeFromValidation.startsWith("Transition:") && (!accessedNodeFromValidation.startsWith("Exit:") || Settings.isRandomizeNpcs()) && !accessedNodeFromValidation.startsWith("NPC:") && !accessedNodeFromValidation.startsWith("NPCL:") && !accessedNodeFromValidation.startsWith("Door:")) { queuedUpdates.add(accessedNodeFromValidation); } } for(String queuedUpdateNode : queuedUpdates) { mapOfNodeNameToRequirementsObject.remove(queuedUpdateNode); } if(Settings.getEnabledGlitches().contains("Raindrop")) { NodeWithRequirements nodeWithRequirements = mapOfNodeNameToRequirementsObject.get(LocationCoordinateMapper.getStartingLocation()); if(nodeWithRequirements == null) { nodeWithRequirements = new NodeWithRequirements(LocationCoordinateMapper.getStartingLocation()); mapOfNodeNameToRequirementsObject.put(LocationCoordinateMapper.getStartingLocation(), nodeWithRequirements); } nodeWithRequirements.addRequirementSet(new ArrayList<>(Arrays.asList("Glitch: Raindrop", LocationCoordinateMapper.getStartingLocation().replace("Location:", "Exit:")))); } if(!LocationCoordinateMapper.isSurfaceStart() && accessedNodesFromValidation.contains("Location: Surface [Main]")) { NodeWithRequirements nodeWithRequirements = mapOfNodeNameToRequirementsObject.get("Location: Surface [Main]"); if(nodeWithRequirements == null) { nodeWithRequirements = new NodeWithRequirements("Location: Surface [Main]"); mapOfNodeNameToRequirementsObject.put("Location: Surface [Main]", nodeWithRequirements); } nodeWithRequirements.addRequirementSet(new ArrayList<>(Arrays.asList("Transition: Surface R1"))); } backsideDoorRandomizer.rebuildRequirementsMap(); FileUtils.log("Nodes accessible at escape start: " + queuedUpdates); } private static Map<String, NodeWithRequirements> copyRequirementsMap(Map<String, NodeWithRequirements> mapToCopy) { Map<String, NodeWithRequirements> copyMap = new HashMap<>(); for(Map.Entry<String, NodeWithRequirements> entry : mapToCopy.entrySet()) { copyMap.put(entry.getKey(), new NodeWithRequirements(entry.getValue())); } return copyMap; } public boolean isSuccess() { while (!queuedUpdates.isEmpty()) { computeAccessibleNodes(queuedUpdates.iterator().next(), null); if(accessedNodes.contains(successNode)) { return true; } } if(!accessedNodes.contains(successNode)) { FileUtils.log("Nodes not accessed: " + mapOfNodeNameToRequirementsObject.keySet()); } return accessedNodes.contains(successNode); } public void computeAccessibleNodes(String newState, Integer attemptNumber) { accessedNodes.add(newState); NodeWithRequirements node; Set<String> nodesToRemove = new HashSet<>(); for(String nodeName : mapOfNodeNameToRequirementsObject.keySet()) { node = mapOfNodeNameToRequirementsObject.get(nodeName); if(node.updateRequirements(newState)) { handleNodeAccess(nodeName, node.getType(), attemptNumber); nodesToRemove.add(nodeName); } } for(String nodeToRemove : nodesToRemove) { mapOfNodeNameToRequirementsObject.remove(nodeToRemove); } queuedUpdates.remove(newState); } private void handleNodeAccess(String nodeName, NodeType nodeType, Integer attemptNumber) { switch (nodeType) { case ITEM_LOCATION: if(!Settings.isRandomizeNpcs()) { if(nodeName.startsWith("Coin:") && !Settings.isRandomizeCoinChests()) { break; } if(nodeName.startsWith("Trap:") && !Settings.isRandomizeTrapItems()) { break; } String item = itemRandomizer.getItem(nodeName); if (item == null) { throw new RuntimeException("Unable to find item at " + nodeName + " location of type " + nodeType.toString()); } if (!Settings.getCurrentRemovedItems().contains(item) && !Settings.getRemovedItems().contains(item) && !"Holy Grail".equals(item)) { FileUtils.logDetail("Found item " + item, attemptNumber); queuedUpdates.add(item); } } break; case SHOP: if(!Settings.isRandomizeNpcs()) { for(String shopItem : shopRandomizer.getShopItems(nodeName)) { if(shopItem == null) { throw new RuntimeException("Unable to find item at " + nodeName + " location of type " + nodeType.toString()); } if(!accessedNodes.contains(shopItem) && !queuedUpdates.contains(shopItem) && !Settings.getRemovedItems().contains(shopItem) && !Settings.getCurrentRemovedItems().contains(shopItem)) { FileUtils.logDetail("Found item " + shopItem, attemptNumber); queuedUpdates.add(shopItem); } } } break; case MAP_LOCATION: FileUtils.logDetail("Gained access to node " + nodeName, attemptNumber); queuedUpdates.add(nodeName); queuedUpdates.addAll(backsideDoorRandomizer.getAvailableNodes(nodeName, null)); break; case NPC_LOCATION: // todo: door contents and move npc randomizer in here queuedUpdates.add(nodeName); break; case NPC: if(!Settings.isRandomizeNpcs()) { FileUtils.logDetail("Gained access to node " + nodeName, attemptNumber); queuedUpdates.add(nodeName); } break; case STATE: case SETTING: queuedUpdates.add(nodeName); if(DataFromFile.GUARDIAN_DEFEATED_EVENTS.contains(nodeName) || nodeName.startsWith("Fairy:")) { queuedUpdates.addAll(backsideDoorRandomizer.getAvailableNodes(nodeName, null)); } if("Event: Skanda Block Removed".equals(nodeName) || "Event: Illusion Unlocked".equals(nodeName)) { if(transitionGateRandomizer.isEndlessL1Open(nodeName)) { queuedUpdates.add("State: Endless L1 Open"); } } break; case EXIT: if(!Settings.isRandomizeNpcs()) { queuedUpdates.add(nodeName); queuedUpdates.addAll(backsideDoorRandomizer.getAvailableNodes(nodeName, attemptNumber)); queuedUpdates.addAll(transitionGateRandomizer.getTransitionExits(nodeName, attemptNumber)); } break; case TRANSITION: queuedUpdates.add(nodeName); String reverseTransition = transitionGateRandomizer.getTransitionReverse(nodeName); if(!accessedNodes.contains(reverseTransition) && !queuedUpdates.contains(reverseTransition)) { FileUtils.logDetail("Gained access to node " + reverseTransition + " through reverse transition " + nodeName, attemptNumber); queuedUpdates.add(reverseTransition); if("Transition: Goddess L2".equals(reverseTransition) ) { queuedUpdates.add("Event: Special Statue Removal"); } } break; } } }
11,280
0.619592
0.617996
217
50.981567
37.049347
181
false
false
0
0
0
0
0
0
0.599078
false
false
2
ee87cbbdd3e8f6bc5691a02e85b36786ad60e64c
25,752,623,945,727
885ed83098cc436fcecfcddf575ad95a36f9e71b
/src/main/java/tree/BSTTree/BSTNONRecursion.java
abee9a072ee73050101f22307b0b62c1023f4802
[]
no_license
KeepMovingLr/datastructure
https://github.com/KeepMovingLr/datastructure
227bddc91dccb15a828fb1d390ba97c9e622f9cf
a00c3a15da63032c06ed6c43f99cc1db2518c60e
refs/heads/master
2023-09-05T05:01:02.026000
2023-09-04T11:34:41
2023-09-04T11:34:41
186,635,438
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tree.BSTTree; import java.util.ArrayDeque; import java.util.Stack; /** * @author enyi.lr * @version $Id: BSTNONRecursion.java, v 0.1 2019‐05‐12 11:03 PM enyi.lr Exp $$ */ public class BSTNONRecursion<E extends Comparable> { private Node root; private int size; private class Node { public E value; public Node left, right; public Node(E value) { this.value = value; left = null; right = null; } } /*************************************************************************************************/ /** * 广度优先遍历 */ public void levelTraversal() { ArrayDeque<Node> queue = new ArrayDeque(); queue.add(root); while (!queue.isEmpty()) { Node current = queue.pollFirst(); // 以print代替操作 System.out.println(current.value); if (current.left != null) { queue.add(current.left); } if (current.right != null) { queue.add(current.right); } } } /*************************************************************************************************/ /** * 广度优先遍历 折线输出 */ public void levelTraversalZigzag() { ArrayDeque<Node> queue = new ArrayDeque(); queue.add(root); int i = 0; while (!queue.isEmpty()) { Node first = queue.getFirst(); // 以print代替操作 System.out.println(first.value); if (i % 2 == 0) { if (first.left != null) { queue.add(first.left); } if (first.right != null) { queue.add(first.right); } } else { if (first.right != null) { queue.add(first.right); } if (first.left != null) { queue.add(first.left); } } i++; } } /*************************************************************************************************/ public void preOrderTraversal() { preOrderTraversal(root); } /** * preorder traversal of a tree which root is root in the way of non recursion * * @param root */ private void preOrderTraversal(Node root) { Stack<Node> stack = new Stack<>(); stack.add(root); while (!stack.isEmpty()) { Node pop = stack.pop(); visitNode(pop); if (pop.right != null) { stack.push(pop.right); } if (pop.left != null) { stack.push(pop.left); } } } private void visitNode(Node node) { // 以输出代替访问。其他题目中,经常是要先存储到一个集合之类的 set.add(root.value); System.out.println(node.value); } /*************************************************************************************************/ // todo inorder traversal of a tree which root is root in the way of non recursion /*************************************************************************************************/ // todo postorder traversal of a tree which root is root in the way of non recursion /*************************************************************************************************/ // todo minimum() and maximum() public E minimum() { return null; } /*************************************************************************************************/ /*************************************************************************************************/ /*************************************************************************************************/ /*************************************************************************************************/ public int size() { return size; } public Boolean isEmpty() { return size == 0; } }
UTF-8
Java
4,157
java
BSTNONRecursion.java
Java
[ { "context": "rrayDeque;\nimport java.util.Stack;\n\n/**\n * @author enyi.lr\n * @version $Id: BSTNONRecursion.java, v 0.1 2019", "end": 99, "score": 0.9977807998657227, "start": 92, "tag": "USERNAME", "value": "enyi.lr" } ]
null
[]
package tree.BSTTree; import java.util.ArrayDeque; import java.util.Stack; /** * @author enyi.lr * @version $Id: BSTNONRecursion.java, v 0.1 2019‐05‐12 11:03 PM enyi.lr Exp $$ */ public class BSTNONRecursion<E extends Comparable> { private Node root; private int size; private class Node { public E value; public Node left, right; public Node(E value) { this.value = value; left = null; right = null; } } /*************************************************************************************************/ /** * 广度优先遍历 */ public void levelTraversal() { ArrayDeque<Node> queue = new ArrayDeque(); queue.add(root); while (!queue.isEmpty()) { Node current = queue.pollFirst(); // 以print代替操作 System.out.println(current.value); if (current.left != null) { queue.add(current.left); } if (current.right != null) { queue.add(current.right); } } } /*************************************************************************************************/ /** * 广度优先遍历 折线输出 */ public void levelTraversalZigzag() { ArrayDeque<Node> queue = new ArrayDeque(); queue.add(root); int i = 0; while (!queue.isEmpty()) { Node first = queue.getFirst(); // 以print代替操作 System.out.println(first.value); if (i % 2 == 0) { if (first.left != null) { queue.add(first.left); } if (first.right != null) { queue.add(first.right); } } else { if (first.right != null) { queue.add(first.right); } if (first.left != null) { queue.add(first.left); } } i++; } } /*************************************************************************************************/ public void preOrderTraversal() { preOrderTraversal(root); } /** * preorder traversal of a tree which root is root in the way of non recursion * * @param root */ private void preOrderTraversal(Node root) { Stack<Node> stack = new Stack<>(); stack.add(root); while (!stack.isEmpty()) { Node pop = stack.pop(); visitNode(pop); if (pop.right != null) { stack.push(pop.right); } if (pop.left != null) { stack.push(pop.left); } } } private void visitNode(Node node) { // 以输出代替访问。其他题目中,经常是要先存储到一个集合之类的 set.add(root.value); System.out.println(node.value); } /*************************************************************************************************/ // todo inorder traversal of a tree which root is root in the way of non recursion /*************************************************************************************************/ // todo postorder traversal of a tree which root is root in the way of non recursion /*************************************************************************************************/ // todo minimum() and maximum() public E minimum() { return null; } /*************************************************************************************************/ /*************************************************************************************************/ /*************************************************************************************************/ /*************************************************************************************************/ public int size() { return size; } public Boolean isEmpty() { return size == 0; } }
4,157
0.357161
0.352708
145
26.889656
28.037933
103
false
false
0
0
0
0
0
0
0.275862
false
false
2
97a8b9a8048d299ce4e505b1a0f11ad85417dcd6
30,580,167,217,888
432ff9313b7cd18250915d48ee0ffaa169239910
/Java/src/com/leetcode/Easy/LastStoneWeight.java
28e98e040153efe3ea4b4e8574716d21fd29dd92
[]
no_license
shankarmattigatti/LeetCode
https://github.com/shankarmattigatti/LeetCode
86752735ba28cf5be0c128085848950b4d0aefb5
93bc76fb118748195d3a5f7b03cc183129d7b4b7
refs/heads/master
2023-08-30T01:10:29.571000
2023-08-12T03:38:52
2023-08-12T03:38:52
174,800,463
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.leetcode.Easy; import java.util.*; // 1046. Last Stone Weight public class LastStoneWeight { public int lastStoneWeight(int[] stones) { PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder()); for (int i : stones) pq.offer(i); while (pq.size() > 1) { int max1 = pq.poll(); int max2 = pq.poll(); if (max1 - max2 > 0) pq.offer(max1 - max2); } return pq.size() > 0 ? pq.poll() : 0; } }
UTF-8
Java
532
java
LastStoneWeight.java
Java
[]
null
[]
package com.leetcode.Easy; import java.util.*; // 1046. Last Stone Weight public class LastStoneWeight { public int lastStoneWeight(int[] stones) { PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder()); for (int i : stones) pq.offer(i); while (pq.size() > 1) { int max1 = pq.poll(); int max2 = pq.poll(); if (max1 - max2 > 0) pq.offer(max1 - max2); } return pq.size() > 0 ? pq.poll() : 0; } }
532
0.526316
0.5
22
23.181818
20.294729
84
false
false
0
0
0
0
0
0
0.363636
false
false
2
6d89246f1ff03764471586ce22ee99319c74c3ad
996,432,465,924
53b047c284c3f1ef41083af5663f22cf38eb8d02
/src/code/Casilla.java
a0616c570703abb921cf8c0ef594c987eca67bca
[]
no_license
RubenDPY/BuscaMinas
https://github.com/RubenDPY/BuscaMinas
d76d5d5c4f1581377988e2e8e11d8c913c2e42f3
447e8fc7335fe9946dbac0e43674367d24090149
refs/heads/master
2021-07-16T20:37:09.612000
2016-05-17T16:25:45
2016-05-17T16:25:45
53,650,459
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package code; public class Casilla { private String valor; private boolean estado; private boolean bloqueado=false; public Casilla(){ estado=false; } public boolean getEstado(){ return estado; } public boolean bloquearDesbloquear(){ bloqueado = !bloqueado; return bloqueado; } public String getValor(){ return valor; } public boolean getBloqueado(){ return bloqueado; } public void darValor(String v){ valor=v; } public void cambiarEstado(){ estado=true; } public boolean esBomba(){ if(valor=="B"){ return true; }else{ return false; } } }
UTF-8
Java
632
java
Casilla.java
Java
[]
null
[]
package code; public class Casilla { private String valor; private boolean estado; private boolean bloqueado=false; public Casilla(){ estado=false; } public boolean getEstado(){ return estado; } public boolean bloquearDesbloquear(){ bloqueado = !bloqueado; return bloqueado; } public String getValor(){ return valor; } public boolean getBloqueado(){ return bloqueado; } public void darValor(String v){ valor=v; } public void cambiarEstado(){ estado=true; } public boolean esBomba(){ if(valor=="B"){ return true; }else{ return false; } } }
632
0.642405
0.642405
39
14.179487
11.229247
38
false
false
0
0
0
0
0
0
1.615385
false
false
2
b457fe9a5f290963222937ea6578c6a0fb35dc65
4,020,089,427,600
aa494ed284e57c0bafab411742d67a9b2e3ba08f
/src/main/java/org/echocat/kata/java/part1/controllers/PublicationController.java
3cf5407c34c472166a36c8a25f7f53ee61d06a4e
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
ThorKarlsson/java-kata-1
https://github.com/ThorKarlsson/java-kata-1
7469c7dcf97f0bdf37ef42ed47408c4279e46c63
9aa3002f5cf858903289e77d6573976c4da11709
refs/heads/master
2021-03-26T01:59:57.041000
2020-03-16T12:27:02
2020-03-16T12:27:02
247,664,948
0
0
MIT
true
2020-03-16T09:47:44
2020-03-16T09:47:44
2020-02-19T02:51:48
2019-12-08T10:39:41
55
0
0
0
null
false
false
package org.echocat.kata.java.part1.controllers; import org.echocat.kata.java.part1.exceptions.NotFoundException; import org.echocat.kata.java.part1.model.Publication; import org.echocat.kata.java.part1.service.PublicationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/publications") public class PublicationController { @Autowired private PublicationService publicationService; @RequestMapping public List<Publication> getAllPublications() { return publicationService.getAllPublications(); } @RequestMapping("/sort") public List<Publication> getSortedPublications() { return publicationService.getSortedPublications(); } @RequestMapping("/isbn/{isbn}") public Publication getPublicationById(@PathVariable("isbn") String isbn) { return publicationService.getPublicationByIsbn(isbn).orElseThrow(() -> new NotFoundException("No publication found with that ISBN")); } @RequestMapping("/author/{email}") public List<Publication> getPublicationsByAuthorEmail(@PathVariable("email") String email) { return publicationService.getPublicationsByAuthor(email); } }
UTF-8
Java
1,420
java
PublicationController.java
Java
[]
null
[]
package org.echocat.kata.java.part1.controllers; import org.echocat.kata.java.part1.exceptions.NotFoundException; import org.echocat.kata.java.part1.model.Publication; import org.echocat.kata.java.part1.service.PublicationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/publications") public class PublicationController { @Autowired private PublicationService publicationService; @RequestMapping public List<Publication> getAllPublications() { return publicationService.getAllPublications(); } @RequestMapping("/sort") public List<Publication> getSortedPublications() { return publicationService.getSortedPublications(); } @RequestMapping("/isbn/{isbn}") public Publication getPublicationById(@PathVariable("isbn") String isbn) { return publicationService.getPublicationByIsbn(isbn).orElseThrow(() -> new NotFoundException("No publication found with that ISBN")); } @RequestMapping("/author/{email}") public List<Publication> getPublicationsByAuthorEmail(@PathVariable("email") String email) { return publicationService.getPublicationsByAuthor(email); } }
1,420
0.776056
0.773239
39
35.410255
32.119743
141
false
false
0
0
0
0
0
0
0.358974
false
false
2
65b3ea280a44e781562a65d3a41f978e22c16bec
6,244,882,482,647
2329fcb47116700c54e1c924c4083449206aef04
/mdcp/generated/src/java/org/smpte/st2071/_2014/query/NOTDefaultFactory.java
ba2168750e7db94695cf957f31f54bd5b303f8ad
[]
no_license
jmwillkie/mdcp
https://github.com/jmwillkie/mdcp
45e3810b1aea3d3fbe2e9a99213fbf5c4f68b55c
a2a50c1558924f1710822b9fea3270ae43799f2d
refs/heads/master
2021-01-20T02:16:33.426000
2014-06-01T20:16:16
2014-06-01T20:16:16
41,262,792
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.smpte.st2071._2014.query; /** * org/smpte/st2071/_2014/query/NOTDefaultFactory.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from MDCF.idl * Thursday, March 20, 2014 1:55:28 PM EDT */ public class NOTDefaultFactory implements NOTValueFactory { public NOT init (org.smpte.st2071._2014.query.Expression expr) { return new NOTImpl (expr); } public java.io.Serializable read_value (org.omg.CORBA_2_3.portable.InputStream is) { return is.read_value(new NOTImpl ()); } }
UTF-8
Java
531
java
NOTDefaultFactory.java
Java
[]
null
[]
package org.smpte.st2071._2014.query; /** * org/smpte/st2071/_2014/query/NOTDefaultFactory.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from MDCF.idl * Thursday, March 20, 2014 1:55:28 PM EDT */ public class NOTDefaultFactory implements NOTValueFactory { public NOT init (org.smpte.st2071._2014.query.Expression expr) { return new NOTImpl (expr); } public java.io.Serializable read_value (org.omg.CORBA_2_3.portable.InputStream is) { return is.read_value(new NOTImpl ()); } }
531
0.713748
0.640301
22
23.136364
26.978603
84
false
false
0
0
0
0
0
0
0.272727
false
false
2
db4435b118ee4c5162b30ff8ef9f2d6024d3b309
31,645,319,096,482
cb4d13a3a54ae5923e02c670e2dd8ff4b42a7afb
/src/main/java/com/basics/UnsafeTest/unsafe_voliate/model/ObjectInHeap.java
b0d743f89fd93368dae4d9ec3fe20d8f92198885
[]
no_license
Jossc/JavaCode
https://github.com/Jossc/JavaCode
2386fddc25ce4e6e61d01036889f1354a7b0003c
455b19cad0069f548a74c5f463cb4f2330ac27c6
refs/heads/master
2022-06-27T18:20:10.914000
2021-05-16T12:15:09
2021-05-16T12:15:09
128,711,944
12
2
null
false
2022-06-21T00:51:39
2018-04-09T03:55:10
2021-06-12T15:42:43
2022-06-21T00:51:36
507
9
2
3
Java
false
false
package com.basics.UnsafeTest.unsafe_voliate.model; import com.basics.UnsafeTest.unsafe_voliate.UnsafeTestTwo; import sun.misc.Unsafe; import java.lang.reflect.Field; /** * @ClassName ObjectInHeap * @Description TODO * @Author chenzhuo * @Date 2018/8/23 11:44 * @Version 1.0 * 堆外内存 **/ public class ObjectInHeap { private long address = 0; public static Unsafe unsafe; public int anInt; public static long anLong; static { try { Field field = Unsafe.class.getDeclaredField("theUnsafe"); field.setAccessible(true); unsafe = (Unsafe) field.get(null); anLong = unsafe.objectFieldOffset(UnsafeTestTwo.class.getDeclaredField("anInt")); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } public ObjectInHeap() { address = unsafe.allocateMemory(2 * 1024 * 1024); } // Exception in thread "main" java.lang.OutOfMemoryError public static void main(String[] args) { //unsafe.allocateInstance() /* while (true) { ObjectInHeap heap = new ObjectInHeap(); System.out.println("memory address=" + heap.address); }*/ } }
UTF-8
Java
1,309
java
ObjectInHeap.java
Java
[ { "context": "sName ObjectInHeap\n * @Description TODO\n * @Author chenzhuo\n * @Date 2018/8/23 11:44\n * @Version 1.0\n * 堆外内存", "end": 241, "score": 0.9992215037345886, "start": 233, "tag": "USERNAME", "value": "chenzhuo" } ]
null
[]
package com.basics.UnsafeTest.unsafe_voliate.model; import com.basics.UnsafeTest.unsafe_voliate.UnsafeTestTwo; import sun.misc.Unsafe; import java.lang.reflect.Field; /** * @ClassName ObjectInHeap * @Description TODO * @Author chenzhuo * @Date 2018/8/23 11:44 * @Version 1.0 * 堆外内存 **/ public class ObjectInHeap { private long address = 0; public static Unsafe unsafe; public int anInt; public static long anLong; static { try { Field field = Unsafe.class.getDeclaredField("theUnsafe"); field.setAccessible(true); unsafe = (Unsafe) field.get(null); anLong = unsafe.objectFieldOffset(UnsafeTestTwo.class.getDeclaredField("anInt")); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } public ObjectInHeap() { address = unsafe.allocateMemory(2 * 1024 * 1024); } // Exception in thread "main" java.lang.OutOfMemoryError public static void main(String[] args) { //unsafe.allocateInstance() /* while (true) { ObjectInHeap heap = new ObjectInHeap(); System.out.println("memory address=" + heap.address); }*/ } }
1,309
0.619523
0.601845
49
25.55102
21.73501
93
false
false
0
0
0
0
0
0
0.346939
false
false
2
0705889284f4188c6cce1bac9bec1b2ea14c689b
27,719,718,975,961
1c4b44b47d50993311c80d675604f57e27e0c19d
/GuitarInventory/src/guitar/inventory/model/Inventory.java
cdfd0edf582b6805b6f335d5e8fb13b9ad73ceea
[]
no_license
Rutabaga1/GuitarInventory
https://github.com/Rutabaga1/GuitarInventory
7ab1ff331df37b594a4036d68e941ef000ec08b1
b8505ef16d93f3344ce83e2d9d3f8e763dfde28a
refs/heads/master
2021-01-01T04:31:09.922000
2016-05-25T12:56:01
2016-05-25T12:56:01
59,576,095
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package guitar.inventory.model; public class Inventory { private String series; private int gnumber; private String position; public int getGnumber() { return gnumber; } public void setGnumber(int gnumber) { this.gnumber = gnumber; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public String getSeries() { return series; } public void setSeries(String series) { this.series = series; } }
UTF-8
Java
494
java
Inventory.java
Java
[]
null
[]
package guitar.inventory.model; public class Inventory { private String series; private int gnumber; private String position; public int getGnumber() { return gnumber; } public void setGnumber(int gnumber) { this.gnumber = gnumber; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public String getSeries() { return series; } public void setSeries(String series) { this.series = series; } }
494
0.720648
0.720648
26
18
13.38771
43
false
false
0
0
0
0
0
0
1.461538
false
false
2
4eca01238bedbadbb70723b17f697daec3187f4f
12,111,807,822,867
009ef4ed2ac02e43c69bbb485e5bb0e391b76078
/src/edu/uwm/cs361/classdiagram/data/Argument.java
9f78e45b8d97dc7066e47555fa58cf4572f2fbe7
[]
no_license
jrmarten/UML-Diagrammer
https://github.com/jrmarten/UML-Diagrammer
2cb4dd8bb7b6df996aef5f43048567049e68cbc9
17fbf65fcf263c9672b4ee348479d04c0163678e
refs/heads/master
2021-01-01T18:12:22.509000
2014-01-16T02:42:02
2014-01-16T02:42:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.uwm.cs361.classdiagram.data; public class Argument { private String type, name; private Argument() { } public Argument(String type, String name) { this.type = type; this.name = name; } public String getType() { return type; } public String getName() { return name; } // @Override // public boolean equals ( Object o ) // { // if ( !( o instanceof Argument) ) return false; // // Argument that = (Argument) o; // // return that.name.equals(this.name) && that.type.equals(this.type); // } @Override public String toString() { return name + " : " + type; } @Override public boolean equals(Object o) { if (!(o instanceof Argument)) return false; Argument that = (Argument) o; return type.equals(that.type); } @SuppressWarnings("all") public static Argument Create(String str) { Argument arg = new Argument(); String[] parts; boolean uml = false; str = str.trim(); if ((uml = str.contains(":"))) parts = str.split(":"); else parts = str.split(" "); try { if (uml) { arg.name = parts[0].trim(); arg.type = parts[1].trim(); } else { arg.name = parts[1].trim(); arg.type = parts[0].trim(); } if (arg.name.contains(" ")) return null; if (arg.type.contains(" ")) return null; } catch (IndexOutOfBoundsException e) { return null; } return arg; } }
UTF-8
Java
1,376
java
Argument.java
Java
[]
null
[]
package edu.uwm.cs361.classdiagram.data; public class Argument { private String type, name; private Argument() { } public Argument(String type, String name) { this.type = type; this.name = name; } public String getType() { return type; } public String getName() { return name; } // @Override // public boolean equals ( Object o ) // { // if ( !( o instanceof Argument) ) return false; // // Argument that = (Argument) o; // // return that.name.equals(this.name) && that.type.equals(this.type); // } @Override public String toString() { return name + " : " + type; } @Override public boolean equals(Object o) { if (!(o instanceof Argument)) return false; Argument that = (Argument) o; return type.equals(that.type); } @SuppressWarnings("all") public static Argument Create(String str) { Argument arg = new Argument(); String[] parts; boolean uml = false; str = str.trim(); if ((uml = str.contains(":"))) parts = str.split(":"); else parts = str.split(" "); try { if (uml) { arg.name = parts[0].trim(); arg.type = parts[1].trim(); } else { arg.name = parts[1].trim(); arg.type = parts[0].trim(); } if (arg.name.contains(" ")) return null; if (arg.type.contains(" ")) return null; } catch (IndexOutOfBoundsException e) { return null; } return arg; } }
1,376
0.608285
0.603198
76
17.105263
15.181862
70
false
false
0
0
0
0
0
0
1.881579
false
false
2
5051cb876a567f13e62c9a71ecada18e07e2ff9f
8,856,222,633,750
9a8855d2eb7c987e819daa730edf8f4605be5ab8
/JavaAll/src/predefined/functional/interfaces/predicate/PredicateTest.java
b5dbc91dedd8f1eed6ccec1aa7ba9e77b4546f91
[]
no_license
zimrancis/workspace-18-Dec-2019
https://github.com/zimrancis/workspace-18-Dec-2019
c837696f8b4937dcefb0a6a8f116bad312a257af
a1e2355b8dfef5f1b29d1ecfd7a5ebd810a744b1
refs/heads/master
2022-12-31T21:48:00.515000
2020-07-13T08:25:49
2020-07-13T08:25:49
279,241,738
0
0
null
false
2020-10-13T23:31:45
2020-07-13T08:26:25
2020-07-13T08:27:43
2020-10-13T23:31:44
15,130
0
0
1
CSS
false
false
package predefined.functional.interfaces.predicate; import java.util.function.Predicate; class LengthTest { } public class PredicateTest { public static void main(String[] args) { Predicate<Integer> p1 = I -> I % 2 == 0; System.out.println(p1.test(10)); System.out.println(p1.test(15)); Predicate<String> s1 = I -> I.length() > 5; System.out.println(s1.test("Zobair")); System.out.println(s1.test("Imran")); Predicate<String> s2 = s -> { int b = 5; if (s.length() < b) { System.out.println(s + " is lesser length then " + b); return true; } else { System.out.println(s + " is greater length then " + b); return false; } }; s2.test("ouygeg ge"); // Print the String values of the array which are greater in length than 5 String[] string = { "abddh", "tryrteeed", "rty", "ertert", "uyty", "uiyu", "yetutyutyuy" }; int temp = 5; Predicate<String> p4 = s -> s.length() > temp && s.length() % 2 == 0; for (String s3 : string) { if (p4.test(s3)) { System.out.println("ss1: " + s3); } } int[] x = { 0, 5, 10, 15, 20, 25, 30, 35 }; int temp3 = 2; int temp4 = 10; Predicate<Integer> p5 = i1 -> i1 % temp3 == 0; Predicate<Integer> p6 = i2 -> i2 > temp4; System.out.println("\nWhich are Even and > than 10"); for (int f : x) { if (p5.and(p6).test(f)) { System.out.println(f); } } System.out.println("\nWhich are Even or > than 10"); for (int f : x) { if (p5.or(p6).test(f)) { System.out.println(f); } } System.out.println("\n Which are negate of Even"); for (int f : x) { if (p5.negate().test(f)) { System.out.println(f); } } } }
UTF-8
Java
1,734
java
PredicateTest.java
Java
[ { "context": "> I.length() > 5;\r\n\t\tSystem.out.println(s1.test(\"Zobair\"));\r\n\t\tSystem.out.println(s1.test(\"Imran\"));\r\n\r\n\t", "end": 400, "score": 0.6657821536064148, "start": 395, "tag": "NAME", "value": "obair" }, { "context": "test(\"Zobair\"));\r\n\t\tSystem.out.println(s1.test(\"Imran\"));\r\n\r\n\t\tPredicate<String> s2 = s -> {\r\n\t\t\tint b ", "end": 441, "score": 0.6204173564910889, "start": 438, "tag": "NAME", "value": "ran" } ]
null
[]
package predefined.functional.interfaces.predicate; import java.util.function.Predicate; class LengthTest { } public class PredicateTest { public static void main(String[] args) { Predicate<Integer> p1 = I -> I % 2 == 0; System.out.println(p1.test(10)); System.out.println(p1.test(15)); Predicate<String> s1 = I -> I.length() > 5; System.out.println(s1.test("Zobair")); System.out.println(s1.test("Imran")); Predicate<String> s2 = s -> { int b = 5; if (s.length() < b) { System.out.println(s + " is lesser length then " + b); return true; } else { System.out.println(s + " is greater length then " + b); return false; } }; s2.test("ouygeg ge"); // Print the String values of the array which are greater in length than 5 String[] string = { "abddh", "tryrteeed", "rty", "ertert", "uyty", "uiyu", "yetutyutyuy" }; int temp = 5; Predicate<String> p4 = s -> s.length() > temp && s.length() % 2 == 0; for (String s3 : string) { if (p4.test(s3)) { System.out.println("ss1: " + s3); } } int[] x = { 0, 5, 10, 15, 20, 25, 30, 35 }; int temp3 = 2; int temp4 = 10; Predicate<Integer> p5 = i1 -> i1 % temp3 == 0; Predicate<Integer> p6 = i2 -> i2 > temp4; System.out.println("\nWhich are Even and > than 10"); for (int f : x) { if (p5.and(p6).test(f)) { System.out.println(f); } } System.out.println("\nWhich are Even or > than 10"); for (int f : x) { if (p5.or(p6).test(f)) { System.out.println(f); } } System.out.println("\n Which are negate of Even"); for (int f : x) { if (p5.negate().test(f)) { System.out.println(f); } } } }
1,734
0.558824
0.522491
72
22.083334
21.665865
93
false
false
0
0
0
0
0
0
2.375
false
false
2
4f1787a7d6313844ebe94c3463957038fdca3171
16,673,063,087,072
736d52af62202656e6623ffe92528d1315f9980c
/batik/badapt_classes/org/apache/batik/svggen/SVGSyntax.java
19550c5cefabeceb7c6bed5f795b9d3b61a1a94b
[ "Apache-2.0" ]
permissive
anthonycanino1/entbench-pi
https://github.com/anthonycanino1/entbench-pi
1548ef975c7112881f053fd8930b3746d0fbf456
0fa0ae889aec3883138a547bdb8231e669c6eda1
refs/heads/master
2020-02-26T14:32:23.975000
2016-08-15T17:37:47
2016-08-15T17:37:47
65,744,715
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apache.batik.svggen; public interface SVGSyntax extends org.apache.batik.util.SVGConstants { java.lang.String ID_PREFIX_ALPHA_COMPOSITE_CLEAR = "alphaCompositeClear"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_DST_IN = "alphaCompositeDstIn"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_DST_OUT = "alphaCompositeDstOut"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_DST_OVER = "alphaCompositeDstOver"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_SRC = "alphaCompositeSrc"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_SRC_IN = "alphaCompositeSrcIn"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_SRC_OUT = "alphaCompositeSrcOut"; java.lang.String ID_PREFIX_AMBIENT_LIGHT = "ambientLight"; java.lang.String ID_PREFIX_BUMP_MAP = "bumpMap"; java.lang.String ID_PREFIX_CLIP_PATH = "clipPath"; java.lang.String ID_PREFIX_DEFS = "defs"; java.lang.String ID_PREFIX_DIFFUSE_ADD = "diffuseAdd"; java.lang.String ID_PREFIX_DIFFUSE_LIGHTING_RESULT = "diffuseLightingResult"; java.lang.String ID_PREFIX_FE_CONVOLVE_MATRIX = "convolve"; java.lang.String ID_PREFIX_FE_COMPONENT_TRANSFER = "componentTransfer"; java.lang.String ID_PREFIX_FE_COMPOSITE = "composite"; java.lang.String ID_PREFIX_FE_COMPLEX_FILTER = "complexFilter"; java.lang.String ID_PREFIX_FE_DIFFUSE_LIGHTING = "diffuseLighting"; java.lang.String ID_PREFIX_FE_FLOOD = "flood"; java.lang.String ID_PREFIX_FE_GAUSSIAN_BLUR = "feGaussianBlur"; java.lang.String ID_PREFIX_FE_LIGHTING_FILTER = "feLightingFilter"; java.lang.String ID_PREFIX_FE_SPECULAR_LIGHTING = "feSpecularLighting"; java.lang.String ID_PREFIX_FONT = "font"; java.lang.String ID_PREFIX_GENERIC_DEFS = "genericDefs"; java.lang.String ID_PREFIX_IMAGE = "image"; java.lang.String ID_PREFIX_IMAGE_DEFS = "imageDefs"; java.lang.String ID_PREFIX_LINEAR_GRADIENT = "linearGradient"; java.lang.String ID_PREFIX_MASK = "mask"; java.lang.String ID_PREFIX_PATTERN = "pattern"; java.lang.String ID_PREFIX_RADIAL_GRADIENT = "radialGradient"; java.lang.String ID_PREFIX_SPECULAR_ADD = "specularAdd"; java.lang.String ID_PREFIX_SPECULAR_LIGHTING_RESULT = "specularLightingResult"; java.lang.String CLOSE_PARENTHESIS = ")"; java.lang.String COMMA = ","; java.lang.String OPEN_PARENTHESIS = "("; java.lang.String RGB_PREFIX = "rgb("; java.lang.String RGB_SUFFIX = ")"; java.lang.String SIGN_PERCENT = "%"; java.lang.String SIGN_POUND = "#"; java.lang.String SPACE = " "; java.lang.String URL_PREFIX = "url("; java.lang.String URL_SUFFIX = ")"; java.lang.String DATA_PROTOCOL_PNG_PREFIX = "data:image/png;base64,"; java.lang.String jlc$CompilerVersion$jl7 = "2.7.0"; long jlc$SourceLastModified$jl7 = 1471028785000L; java.lang.String jlc$ClassType$jl7 = ("H4sIAAAAAAAAALVae2wcxRmf8ztO/IiTOGlInJcTYpLckZAHxEngfL6zN1nf" + "ne5sizqFY7w3Zy/Z211295xzaFGLBKV/FNGWV2mJVCkpEgKKqra0FaBUFZSq" + "BYlnSytoValVK5SWqAJVRdB+Mzv3nkuyV2ppdtfz/P2++b5vHvc9cR612hYa" + "ILrjdxZNYvvDuhPHlk3SIQ3b9iTkpZSHmvE/b/5r9Lom1DaDuuexPaFgm0RU" + "oqXtGbRe1W0H6wqxo4SkaYu4RWxiLWBHNfQZtEq1paypqYrqTBhpQitMY0tG" + "y7HjWOpsziES78BB62VAEmBIAsHq4mEZLVMMc7FUfU1Z9VBZCa2ZLY1lO6hX" + "vhUv4EDOUbWArNrOcN5CO0xDW5zTDMdP8o7/Vm0fF8FReV+NCDY/3fPhR/fN" + "9zIRrMC6bjiMnp0gtqEtkLSMekq5YY1k7dvQHahZRkvLKjtoUC4MGoBBAzBo" + "gW2pFqDvInouGzIYHafQU5upUEAO2lTZiYktnOXdxBlm6KHD4dxZY2C7scjW" + "ZVlD8YEdgfsfurn3+82oZwb1qHqSwlEAhAODzIBASXaWWHYwnSbpGbRch8lO" + "EkvFmnqKz3Sfrc7p2MnB9BfEQjNzJrHYmCVZwTwCNyunOIZVpJdhCsX/a81o" + "eA649pe4ugwjNB8IdqoAzMpg0DvepOWEqqcdtKG6RZHj4DGoAE3bs8SZN4pD" + "tegYMlCfqyIa1ucCSVA9fQ6qthqggJaD1tbtlMraxMoJPEdSVCOr6sXdIqi1" + "hAmCNnHQqupqrCeYpbVVs1Q2P+ejh+69XR/Xm5APMKeJolH8S6HRQFWjBMkQ" + "i4AduA2XXSU/iPufu6cJIai8qqqyW+eZz1+4YefAuZfcOlcI6sRmbyWKk1LO" + "zHa/ui40dF0zhdFhGrZKJ7+CObOyOC8ZzpvgYfqLPdJCf6HwXOLFz37xcfJe" + "E+qUUJtiaLks6NFyxciaqkasMaITCzskLaElRE+HWLmE2uFbVnXi5sYyGZs4" + "EmrRWFabwf4HEWWgCyqiTvhW9YxR+DaxM8++8yZCqB0S8kGKIvdvPX04aDIw" + "b2RJACtYV3UjELcMyt8OgMeZBdnOB2ZB608EbCNngQoGDGsugEEP5kmhYGFu" + "juiB5PRYclF3cN5Ptcv8P/Wbp3xWnPT5QNTrqg1dAxsZN7Q0sVLK/bmR8IWn" + "Ur9ylYgqPpcEeBUYyu8O5WdD+d2h/MWhkM/HRlhJh3QnEqbhBBg0eNRlQ8mb" + "jt5yz+Zm0CDzZAsVYp5Z2BXsnx0UWcUyw9aPgsdOKY+/fuDNx7724ElXA4fq" + "++aqdmv+HdNm7/zTvxijcmdLx24VWEdV+5nAE99eGzryHmu/BPySg0GPwOQH" + "qm20wqyosVZLGtxtqd89j2c/aNrc9kITap9BvQr35dNYy5EkAX/aqdoFBw/+" + "vqK80he5hjfMbd5B66pxlQ07XHCclHxH+QzDN61Nv7uYtixndVbC1LC5CkHa" + "yC2AvWlpv0mfq/M+nwOLnmbO4xBYJrVdEtIItmjpVqoQ1SKmEA4nzUd/+8rf" + "rmlCTSV33lO2DoMYhstcCO2sjzmL5SX9mrQIFdc7D8e/8cD5Lx9nygU1togG" + "HKRPChDWQ1hX7nrptrf/8O6ZN5qKCtnswBqam4WtCHzYbHlzAJmqY81V1ZX/" + "gT8fpE9oolKgGa4/6Atxp7Sx6JVMsJoN0mgqnghHpBtTQTk+HkyFYhPxWFKa" + "DKdCcjiYYP2ugQ0I40Qn1O8uLsxigcpgHU0v2xCklPveeL9r+v3nL9QoeaVE" + "J7A57E4ufWzLQ/erq211HNvzUG/vuejnerVzH0GPM9CjAr7GjlngI/IV8ue1" + "W9t/97Of99/yajNqiqBOzcDpCKZrN3hgZx6W+3lwL3nz+htc/TnZAY9e5gEQ" + "4z9QqWujkDZxXdt0Gbo2ajsSU4/DrJ/t7LmDPvzuvNLPAH1cTR+7mQj2OGhj" + "/bkZTU6mpCitt8+dCPo8QB9HXFU4eLlkIpA2czKbRWRW1pCJ5RxaHPbGZtPF" + "2cSmJkV0Ih7pjEPawulsEdFZVUtngTBPMOGNz+ZL8JkOJ0SEoh4JXQ9pkBMa" + "FBFaXkkoaSm0bMobmfX1ySQTIRGPaY88qNFs5Ty2XobRAA/XaG761IwGmNQx" + "mpsbMJptnMy2yzAaIMONhnxqRkPZ1DGajEc6eyFdyelcKaKzDGdnVdj9yOrc" + "PKOR9UZjdRmNiREpHJ1MydLYuBC87hH8VZC2c/DbReDbZ3NZExYBmpPzhruv" + "hHtkaiKemgjGRZAXPELeCWmIQx4SQe5QNNWM833+F7xhXlHCHJKleCoenBwX" + "gb7DI+gtXNYFmdeAhv1dhjW5yxvg7hLg0XAkKcJ6t0esV0PawbHuEGHtTKuZ" + "TM4mwXSaZn7VG+JVZYilSGQqGU4FR0dFwO/1CHyMa0dBS2qXLw6cWSJswxLE" + "zmnMJB9o2LMUODCTlKJjqUQ4OSULjfNBj3z2QdrF+ewSa7qhL9BbFZr1qDcK" + "60oUIrBdjUWnY/J0GIx0MiHdKEJ/2iP6ICQ/R+8XoWcnfUMHzzhpYd3OuBuJ" + "s95obKiiAQ4+Sj3kZCIYTUbEu4jvNmAQAc4kIGKyRCmsVTTvSW8M+msZ0CVK" + "BPwpj8Cv4+ALJGqAd1HgGslHVM1xxf9Db+CvqAEvh+FTkifFov+RRwaHIe3m" + "DHaLGPRUmTQtea7h7RtwqLZnEYvnPbKgK+sezmKPiAWckA2DOdMXGl5jAXtE" + "jsWEnvTFBhTnGg74GhHg7gwZwznbVrE+ouWY5rzsDfnaCuRjwalkUgpGUyPy" + "lFBxXmlAcfZyBntFDHozRZ0paf+b/4sPLa4A9dX/rQZ86D7OYp+IRV+GJE2i" + "5DRslVvAO954DFTwSMbDoSk5mLioCbzbwAZoP2eyX8SkJWPobCn+c8MboEgs" + "Klx3/+IRKzXRAxzrARHWpXP0FkhVRvme7XzDHn8sHA0npFDdvdvfPUKnh8Nr" + "OfRrhZ5GzeI5tkx94A10Twm0NBEcE65PH3pE6+eupuByahdWhrYg5o+9IV5Z" + "hbiukD/xCJsK9iCHfVAEu5v+GoGtMQun6cEPCnyt3rB/poRdlqJhMMaxRHCU" + "nv0EBHxtDRjjMCcwLDTGLLZP0J67GjbGiWDymAhrt0es9Ih3iGM9JMLabmIH" + "3De97vCt8gZ3eQkuHPTAZ4vuN3z9DajHYY74sFA9qF5grVw91jesHlQtgvJF" + "1WOgAf93hBM4IiKw1OZrjnsC9G1t2P8V1xrxEdC3zSN0CbmXfqjwrobeb1ct" + "l8UzoG+XNxabBSwufQj0+Ruw1RHOaETEyDdEu93nUfNDcgw2ufFgAnRmPJyU" + "RI7Rt98j1tXI/S0JFd41WHfSbj3e5LfCsWIiKMLn9bqeXtGPcnyjQnzbabce" + "7+Z7Y/Fw9FKi9HoVvwFSmEMNi6C2WHOzDK3Hm/fOxNgI11sRTq837OuQe6GL" + "Cm+xenq8UWcgk1OROiC9Xp8PIPdyCBXeNSC30m49XpYvS0pjMO/hRKiO3/V6" + "MU5lOc5hjgthbqHderwF73RhxqaiQg/r9bqb2rjEQUpCkBtptx7vuFuT8WBI" + "tKf0eb3RpoZzlOM7KjScnKUxw/F4nd05lZAvYjher7HpZB/jOI/VNxyP99cM" + "ZH3D8XptTZfQCQ5yQgSyP40dfJDt0gOmPjc8i22yfy/z8h4vsteMBieDIN/Y" + "ZCwUA0HDIlpf2Be70s5fbFwHdeBZ27Gw4tDTRSGKzAXBmrgRKz72vQZW+ZrA" + "GPbTeHJ6rBihR39pX18vdIuFnZ258/7T6djZ3W54S19lOFRYz2WffOvjX/sf" + "/uMvBZE5SxzD3KWRBaKVwUN5KCiG5tCgiDU1EX5uVJry1OmejtWnp37ThFrK" + "IseWyagjk9O08hCRsu820yIZlUllmRtTYNKX71sOWl0nUohGVbAPCtP3iFv/" + "NKyO1fXB2Nm7vN53QHNL9aAr96O8yhkHNUMV+nnWNPO+CmmUznKrLqXhxSbl" + "gSQ0+oJFUnLpTeTcWMqU8r3TR6O3X9h/1g1kUTR86hTtZamM2jOGlcXurNAY" + "y011eyv01TY+9FH300u2UjVgQnUBl3S7DNuGUhhGyNA0orCIj8Fw1nQWacTV" + "qR+v/sGhx06/ywJcQF9NqgRrS42CloUX7UH2ovXfPnPo+ZfvaXsNNOw48mEH" + "rTheG2aUN3OgysflUqhWWdCuimc1Mjz0yOKRnZl//J6Pi3yVoV3V9VPKG4/d" + "9PrX15wZaEJLJdQKxkDyLP5pdFFPEGXBmkFdqh3OA0ToBU5FEurI6eptOSKl" + "ZdRN9RXTiBkmQi75rmJu3DIUsNGauEvIJumcVR493KkZJ4k1YuR0ds/aJaOl" + "pRx3EittoDNnmlUNSjnFWV9Zyz2ljH6l59n7+pojYHMVdMq7b7dzs5OFoKzy" + "AFGWwZSil3mlPFUJUP6UPGGahZCkzmdhwqktPOPWofmwZFzF1GBFlRrQ+c9/" + "6bX13/wFfrQZ+STUYquniDt9rrejPf2UmdlP2Cd9PPdfGtkDJyAuAAA="); java.lang.String jlc$CompilerVersion$jl5 = "2.7.0"; long jlc$SourceLastModified$jl5 = 1471028785000L; java.lang.String jlc$ClassType$jl5 = ("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" + "bQzIAEHgDRJYk1pIRNiS9oOM3NAzSjGHUjMLJRzmau5IdmaL1Oemeo64XqtP" + "YQ0g2FkNbSfafCKPXawzw3XLTMws9uvlTi2QV2o1oiJx5eKwDXPYhkZgcapM" + "JtRs5YtqCGSr2R2XwxdLwvOj/qYumrHWDmsDH+kiJj6cs5teTM08dCyvRiuU" + "XWc+R8vjsKfbaDKFlE41MOBWoxsajcxazVmkQ+tRAG8GoVXBlkbITfAo0vS0" + "T7YEmZo3MDKA8bqadESZbYRYalizgYua0ZpWqpmGimO4aw5bUWpHltVTsGqq" + "pu4gVvJB0ONxXRyjXNxKpjodOVUb9lDWp4ZRFkYxasxCdTxOqsMaXzbmdrnV" + "nQrQ1GvC/KBv9AKX6ogtShgSkzkyWAydBqxncG06FSXI4TMza2k9WnE6URSt" + "J2VD3lTLjZlhwplsapyr0a1E8NT1pL+oMtyGUqDMaVR0orKxdcImY7nfa5dR" + "TuXWHNqRN+HSmpkRw+s91GxRqynHEJt6O9fMnoGXI0nqpY7CLJIWS6xzzVGi" + "hZIMFHqEbpIFo+CugJepCePhtYxQx/7UaSazNSknDdyLhQmhqCuzQeGTiYWu" + "I2e0tCfdWS6UMSCiTrncWctohFTEzoLs00t9yU8rDQWjV2pN6MFoOhvXpTnO" + "aIN12uGsgSEjus8hNRlpVTq4CqRpDQMSI5PMwnG+ufDsGUlk88xBmrww01yi" + "DuyAT7Vlh4cmaljPJz4/ag7ZURxZVR3OE5ltDyvJmOlDqid06Ikvxd21O7Mi" + "PtRwA5Fm66zDNSc6VtZrNjSY2IsBRAmu3bPrQx+PVBtBrIrBCu6w46nztLne" + "lGWvgmIbGU7Gs7Ap15Bp4ucVaaJJ61VX4a1E5/qzMmRmGJu327UG7k7hhhmV" + "y0qke8sypbNeG9qMlrkz1zydyWuN8QTXx+WmD+PdrkFu4jXlZRDCr0WrQvIr" + "bkhFXq2yitZBMpYZMs3TSO905zUNUthY6y7okRJ2keUwrjd1drZu4gsYmEGk" + "BwSygsrLqN+p2EbTnpsDVW8irVaYu8NKe0qhmkvlVHm4wdhWlV22s1nq5L4+" + "VtEqgzbRBaWs0Rq8nLjhsuKZETQo+yuO8T2Va+TIrBePdTyl6dSbh+MoGFbF" + "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" + "yGaKWg4mVfFpMxv34nWV84x5OvHDentk"); java.lang.String jlc$ClassType$jl5$1 = ("E3GfTozJWrHmiy5X6diokGSdWmVNy67kup6QjmZsf9quJtzErfhSYJNjFebR" + "lK87xBJi+2uuak6RGphOLtlmfUixTFeB426L66ztBcVKg3HZ9ycsz5VRz5M2" + "fj9moqmdi6pricNKOegRks+EI2OkTQaR1InrI6HF1addG6pa1YU0Ejote5TK" + "ijeozcFbvDbNYhaerSvVqrFeVqqjWblLUPVKJatJ87E19CXErYttjM1IybbJ" + "NQtXghil5x1iVfWHE0UbjSOhvIQS0s4rLWi96mlDostGlhCLjRrqBtK0LVG1" + "YDk1eZ8PyrK5VKYJy3KrRsfDqXhkG2RNkdg6Z60T05UiezLR0czxtOpgvqms" + "ub7gyy4E9Vq8U1+Pg3F93B3zfbIB6V0+nlabK1nBe0xPH/bzBbZm+GaoEwSP" + "k0AfFoQe2XUOrowCRGoSeBbTLSNMObHvyrrAdoXpyEEW3tBpN2Ovl9UxWkpY" + "UsnwJd3LPG0sNLr1/kLuNRbVWQaicgIpPYVzQyGv42BqFWCs77kSK859YjLu" + "yutNzZ1TLbfZ9dvlMJjPqMFYH0Rtta1vkiZHBP3NGibIyUoWHbfuuTwh9SS+" + "JfEkCd7S0cXG0+1VtEh5jp8EpreSiQ1RJRHCFeJhWetCLXVarUMrwgQBpyyO" + "pFmU+Q6WduPYmPNmTfJ0l6+hQCy8bpLpAuut4QyG4TeLzNqRaxFvbhOGd3aR" + "XiFVmL9bh2npUUVN0ljR0mJlxNm21l3v2yq7LXS7pQZPp6Vb9+zU22bBxDF5" + "Z8twkVT76P32km4Tal/9wltv69xPV4uEWiGTr4C+0yD8tGssDfdCr6UcPLiz" + "BbDYp/XcPTuJd7tftZ99+8lHn31b+rfXSg9e2KH6GFN61Mxc9+KutQvXD4ex" + "YTpbso/ttjmFWzx/Ly09e58dicVGr+1FAfPkF3flfykt3bhcPi09tP2+WO6X" + "09L183Kgqd3FxSK/kpYeAEWKy38chvnJXdI4H/D3XD9wp8rFvW1F+nW7Y3sv" + "vUG227N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2" + "HqZe/+4TP//Ya/vR3e0deyo/V9kL2F483xmGBq5raNtNaK/iXpiui52dm196" + "9hc/+7fe/u1tgvr/Au+lRLFKPwAA"); }
UTF-8
Java
27,126
java
SVGSyntax.java
Java
[ { "context": "5000L;\n java.lang.String jlc$ClassType$jl7 = (\"H4sIAAAAAAAAALVae2wcxRmf8ztO/IiTOGlInJcTYpLckZAHxEngfL6zN1nf\" +\n \"ne5", "end": 2901, "score": 0.7428039908409119, "start": 2841, "tag": "KEY", "value": "H4sIAAAAAAAAALVae2wcxRmf8ztO/IiTOGlInJcTYpLckZAHxEngfL6zN1nf" }, { "context": "1nf\" +\n \"ne5sizqFY7w3Zy/Z211295xzaFGLBKV/FNGWV2mJVCkpEgKKqra0FaBUFZSq\" +\n \"BYl", "end": 3008, "score": 0.83287513256073, "start": 2948, "tag": "KEY", "value": "ne5sizqFY7w3Zy/Z211295xzaFGLBKV/FNGWV2mJVCkpEgKKqra0FaBUFZSq" }, { "context": "ZSq\" +\n \"BYlnSytoValVK5SWqAJVRdB+Mzv3nkuyV2ppdtfz/P2++b5vHvc9cR", "end": 3059, "score": 0.5456535816192627, "start": 3055, "tag": "KEY", "value": "BYln" }, { "context": "\n \"BYlnSytoValVK5SWqAJVRdB+Mzv3nkuyV2ppdtfz/P2++b5vHvc9cR612hYa\" +\n ", "end": 3091, "score": 0.5936423540115356, "start": 3061, "tag": "KEY", "value": "toValVK5SWqAJVRdB+Mzv3nkuyV2pp" }, { "context": " \"BYlnSytoValVK5SWqAJVRdB+Mzv3nkuyV2ppdtfz/P2++b5vHvc9cR612hYa\" +\n ", "end": 3095, "score": 0.5072518587112427, "start": 3093, "tag": "KEY", "value": "fz" }, { "context": " \"BYlnSytoValVK5SWqAJVRdB+Mzv3nkuyV2ppdtfz/P2++b5vHvc9cR612hYa\" +\n ", "end": 3100, "score": 0.5422230362892151, "start": 3097, "tag": "KEY", "value": "2++" }, { "context": " java.lang.String jlc$ClassType$jl5$1 =\n (\"E3GfTozJWrHmiy5X6diokGSdWmVNy67kup6QjmZsf9quJtzErfhSYJNjFebR\" +\n \"lK87xBJi+2uuak6RGphOLtlmfUixTFeB426L66", "end": 25784, "score": 0.9962667226791382, "start": 25724, "tag": "KEY", "value": "E3GfTozJWrHmiy5X6diokGSdWmVNy67kup6QjmZsf9quJtzErfhSYJNjFebR" }, { "context": "WmVNy67kup6QjmZsf9quJtzErfhSYJNjFebR\" +\n \"lK87xBJi+2uuak6RGphOLtlmfUixTFeB426L66ztBcVKg3HZ9ycsz", "end": 25799, "score": 0.5459235310554504, "start": 25798, "tag": "KEY", "value": "8" }, { "context": "WKy38chvnJXdI4H/D3XD9wp8rFvW1F+nW7Y3sv\" +\n \"vUG227N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO", "end": 26957, "score": 0.6463710069656372, "start": 26948, "tag": "KEY", "value": "vUG227N9W" }, { "context": "dI4H/D3XD9wp8rFvW1F+nW7Y3sv\" +\n \"vUG227N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2\" +\n", "end": 26962, "score": 0.5558220744132996, "start": 26959, "tag": "KEY", "value": "5t3" }, { "context": "D3XD9wp8rFvW1F+nW7Y3sv\" +\n \"vUG227N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2\" +\n ", "end": 26967, "score": 0.5859476327896118, "start": 26964, "tag": "KEY", "value": "D77" }, { "context": "W1F+nW7Y3sv\" +\n \"vUG227N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2\" +\n \"HqZe/+4TP//Y", "end": 26982, "score": 0.5403465628623962, "start": 26975, "tag": "KEY", "value": "NVTabop" }, { "context": " \"vUG227N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2\" +\n \"HqZe/+4TP//Ya/vR3e0deyo/V9kL", "end": 26998, "score": 0.5625250339508057, "start": 26990, "tag": "KEY", "value": "B7ym5Uir" }, { "context": "227N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2\" +\n \"HqZe/+4TP//Ya/vR3e0deyo/V9kL2F48", "end": 27002, "score": 0.5994222164154053, "start": 27001, "tag": "KEY", "value": "9" }, { "context": "N9W/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2\" +\n \"HqZe/+4TP//Ya/vR3e0deyo/V9kL2F483xmGB", "end": 27007, "score": 0.538063108921051, "start": 27004, "tag": "KEY", "value": "tbO" }, { "context": "nd3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2\" +\n \"HqZe/+4TP//Ya/vR3e0deyo/V9kL2F483xmGBq5raNtNaK/iXpiui5", "end": 27024, "score": 0.6685044169425964, "start": 27020, "tag": "KEY", "value": "HqZe" }, { "context": "dIjZhB7ym5Uir3cL9+3tbO2\" +\n \"HqZe/+4TP//Ya/vR3e0deyo/V9kL2F483xmGBq5raNtNaK/iXpiui52dm196\" +\n ", "end": 27037, "score": 0.5840519666671753, "start": 27035, "tag": "KEY", "value": "R3" }, { "context": "Uir3cL9+3tbO2\" +\n \"HqZe/+4TP//Ya/vR3e0deyo/V9kL2F483xmGBq5raNtNaK/iXpiui52dm196\" +\n \"9hc/", "end": 27046, "score": 0.5538985729217529, "start": 27045, "tag": "KEY", "value": "9" }, { "context": "r3cL9+3tbO2\" +\n \"HqZe/+4TP//Ya/vR3e0deyo/V9kL2F483xmGBq5raNtNaK/iXpiui52dm196\" +\n \"9hc/+7", "end": 27048, "score": 0.5383403897285461, "start": 27047, "tag": "KEY", "value": "L" }, { "context": "e/+4TP//Ya/vR3e0deyo/V9kL2F483xmGBq5raNtNaK/iXpiui52dm196\" +\n \"9hc/+7fe/u1tgvr/Au+lRLFKPwAA\");\n", "end": 27074, "score": 0.5994959473609924, "start": 27073, "tag": "KEY", "value": "5" }, { "context": "o/V9kL2F483xmGBq5raNtNaK/iXpiui52dm196\" +\n \"9hc/+7fe/u1tgvr/Au+lRLFKPwAA\");\n}\n", "end": 27100, "score": 0.6361786723136902, "start": 27092, "tag": "KEY", "value": "9hc/+7fe" }, { "context": "3xmGBq5raNtNaK/iXpiui52dm196\" +\n \"9hc/+7fe/u1tgvr/Au+lRLFKPwAA\");\n}\n", "end": 27103, "score": 0.6985359787940979, "start": 27102, "tag": "KEY", "value": "1" }, { "context": "aK/iXpiui52dm196\" +\n \"9hc/+7fe/u1tgvr/Au+lRLFKPwAA\");\n}\n", "end": 27116, "score": 0.5381538271903992, "start": 27114, "tag": "KEY", "value": "FK" }, { "context": "Xpiui52dm196\" +\n \"9hc/+7fe/u1tgvr/Au+lRLFKPwAA\");\n}\n", "end": 27120, "score": 0.5150144100189209, "start": 27118, "tag": "KEY", "value": "AA" } ]
null
[]
package org.apache.batik.svggen; public interface SVGSyntax extends org.apache.batik.util.SVGConstants { java.lang.String ID_PREFIX_ALPHA_COMPOSITE_CLEAR = "alphaCompositeClear"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_DST_IN = "alphaCompositeDstIn"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_DST_OUT = "alphaCompositeDstOut"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_DST_OVER = "alphaCompositeDstOver"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_SRC = "alphaCompositeSrc"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_SRC_IN = "alphaCompositeSrcIn"; java.lang.String ID_PREFIX_ALPHA_COMPOSITE_SRC_OUT = "alphaCompositeSrcOut"; java.lang.String ID_PREFIX_AMBIENT_LIGHT = "ambientLight"; java.lang.String ID_PREFIX_BUMP_MAP = "bumpMap"; java.lang.String ID_PREFIX_CLIP_PATH = "clipPath"; java.lang.String ID_PREFIX_DEFS = "defs"; java.lang.String ID_PREFIX_DIFFUSE_ADD = "diffuseAdd"; java.lang.String ID_PREFIX_DIFFUSE_LIGHTING_RESULT = "diffuseLightingResult"; java.lang.String ID_PREFIX_FE_CONVOLVE_MATRIX = "convolve"; java.lang.String ID_PREFIX_FE_COMPONENT_TRANSFER = "componentTransfer"; java.lang.String ID_PREFIX_FE_COMPOSITE = "composite"; java.lang.String ID_PREFIX_FE_COMPLEX_FILTER = "complexFilter"; java.lang.String ID_PREFIX_FE_DIFFUSE_LIGHTING = "diffuseLighting"; java.lang.String ID_PREFIX_FE_FLOOD = "flood"; java.lang.String ID_PREFIX_FE_GAUSSIAN_BLUR = "feGaussianBlur"; java.lang.String ID_PREFIX_FE_LIGHTING_FILTER = "feLightingFilter"; java.lang.String ID_PREFIX_FE_SPECULAR_LIGHTING = "feSpecularLighting"; java.lang.String ID_PREFIX_FONT = "font"; java.lang.String ID_PREFIX_GENERIC_DEFS = "genericDefs"; java.lang.String ID_PREFIX_IMAGE = "image"; java.lang.String ID_PREFIX_IMAGE_DEFS = "imageDefs"; java.lang.String ID_PREFIX_LINEAR_GRADIENT = "linearGradient"; java.lang.String ID_PREFIX_MASK = "mask"; java.lang.String ID_PREFIX_PATTERN = "pattern"; java.lang.String ID_PREFIX_RADIAL_GRADIENT = "radialGradient"; java.lang.String ID_PREFIX_SPECULAR_ADD = "specularAdd"; java.lang.String ID_PREFIX_SPECULAR_LIGHTING_RESULT = "specularLightingResult"; java.lang.String CLOSE_PARENTHESIS = ")"; java.lang.String COMMA = ","; java.lang.String OPEN_PARENTHESIS = "("; java.lang.String RGB_PREFIX = "rgb("; java.lang.String RGB_SUFFIX = ")"; java.lang.String SIGN_PERCENT = "%"; java.lang.String SIGN_POUND = "#"; java.lang.String SPACE = " "; java.lang.String URL_PREFIX = "url("; java.lang.String URL_SUFFIX = ")"; java.lang.String DATA_PROTOCOL_PNG_PREFIX = "data:image/png;base64,"; java.lang.String jlc$CompilerVersion$jl7 = "2.7.0"; long jlc$SourceLastModified$jl7 = 1471028785000L; java.lang.String jlc$ClassType$jl7 = ("<KEY>" + "<KEY>" + "BYlnSy<KEY>dtfz/P2++b5vHvc9cR612hYa" + "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"); java.lang.String jlc$CompilerVersion$jl5 = "2.7.0"; long jlc$SourceLastModified$jl5 = 1471028785000L; java.lang.String jlc$ClassType$jl5 = ("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" + "bQzIAEHgDRJYk1pIRNiS9oOM3NAzSjGHUjMLJRzmau5IdmaL1Oemeo64XqtP" + "YQ0g2FkNbSfafCKPXawzw3XLTMws9uvlTi2QV2o1oiJx5eKwDXPYhkZgcapM" + "JtRs5YtqCGSr2R2XwxdLwvOj/qYumrHWDmsDH+kiJj6cs5teTM08dCyvRiuU" + "XWc+R8vjsKfbaDKFlE41MOBWoxsajcxazVmkQ+tRAG8GoVXBlkbITfAo0vS0" + "T7YEmZo3MDKA8bqadESZbYRYalizgYua0ZpWqpmGimO4aw5bUWpHltVTsGqq" + "pu4gVvJB0ONxXRyjXNxKpjodOVUb9lDWp4ZRFkYxasxCdTxOqsMaXzbmdrnV" + "nQrQ1GvC/KBv9AKX6ogtShgSkzkyWAydBqxncG06FSXI4TMza2k9WnE6URSt" + "J2VD3lTLjZlhwplsapyr0a1E8NT1pL+oMtyGUqDMaVR0orKxdcImY7nfa5dR" + "TuXWHNqRN+HSmpkRw+s91GxRqynHEJt6O9fMnoGXI0nqpY7CLJIWS6xzzVGi" + "hZIMFHqEbpIFo+CugJepCePhtYxQx/7UaSazNSknDdyLhQmhqCuzQeGTiYWu" + "I2e0tCfdWS6UMSCiTrncWctohFTEzoLs00t9yU8rDQWjV2pN6MFoOhvXpTnO" + "aIN12uGsgSEjus8hNRlpVTq4CqRpDQMSI5PMwnG+ufDsGUlk88xBmrww01yi" + "DuyAT7Vlh4cmaljPJz4/ag7ZURxZVR3OE5ltDyvJmOlDqid06Ikvxd21O7Mi" + "PtRwA5Fm66zDNSc6VtZrNjSY2IsBRAmu3bPrQx+PVBtBrIrBCu6w46nztLne" + "lGWvgmIbGU7Gs7Ap15Bp4ucVaaJJ61VX4a1E5/qzMmRmGJu327UG7k7hhhmV" + "y0qke8sypbNeG9qMlrkz1zydyWuN8QTXx+WmD+PdrkFu4jXlZRDCr0WrQvIr" + "bkhFXq2yitZBMpYZMs3TSO905zUNUthY6y7okRJ2keUwrjd1drZu4gsYmEGk" + "BwSygsrLqN+p2EbTnpsDVW8irVaYu8NKe0qhmkvlVHm4wdhWlV22s1nq5L4+" + "VtEqgzbRBaWs0Rq8nLjhsuKZETQo+yuO8T2Va+TIrBePdTyl6dSbh+MoGFbF" + "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" + "yGaKWg4mVfFpMxv34nWV84x5OvHDentk"); java.lang.String jlc$ClassType$jl5$1 = ("<KEY>" + "lK87xBJi+2uuak6RGphOLtlmfUixTFeB426L66ztBcVKg3HZ9ycsz5VRz5M2" + "fj9moqmdi6pricNKOegRks+EI2OkTQaR1InrI6HF1addG6pa1YU0Ejote5TK" + "ijeozcFbvDbNYhaerSvVqrFeVqqjWblLUPVKJatJ87E19CXErYttjM1IybbJ" + "NQtXghil5x1iVfWHE0UbjSOhvIQS0s4rLWi96mlDostGlhCLjRrqBtK0LVG1" + "YDk1eZ8PyrK5VKYJy3KrRsfDqXhkG2RNkdg6Z60T05UiezLR0czxtOpgvqms" + "ub7gyy4E9Vq8U1+Pg3F93B3zfbIB6V0+nlabK1nBe0xPH/bzBbZm+GaoEwSP" + "k0AfFoQe2XUOrowCRGoSeBbTLSNMObHvyrrAdoXpyEEW3tBpN2Ovl9UxWkpY" + "UsnwJd3LPG0sNLr1/kLuNRbVWQaicgIpPYVzQyGv42BqFWCs77kSK859YjLu" + "yutNzZ1TLbfZ9dvlMJjPqMFYH0Rtta1vkiZHBP3NGibIyUoWHbfuuTwh9SS+" + "JfEkCd7S0cXG0+1VtEh5jp8EpreSiQ1RJRHCFeJhWetCLXVarUMrwgQBpyyO" + "pFmU+Q6WduPYmPNmTfJ0l6+hQCy8bpLpAuut4QyG4TeLzNqRaxFvbhOGd3aR" + "XiFVmL9bh2npUUVN0ljR0mJlxNm21l3v2yq7LXS7pQZPp6Vb9+zU22bBxDF5" + "Z8twkVT76P32km4Tal/9wltv69xPV4uEWiGTr4C+0yD8tGssDfdCr6UcPLiz" + "BbDYp/XcPTuJd7tftZ99+8lHn31b+rfXSg9e2KH6GFN61Mxc9+KutQvXD4ex" + "YTpbso/ttjmFWzx/Ly09e58dicVGr+1FAfPkF3flfykt3bhcPi09tP2+WO6X" + "09L183Kgqd3FxSK/kpYeAEWKy38chvnJXdI4H/D3XD9wp8rFvW1F+nW7Y3sv" + "<KEY>/u5t3vsD77T+und3jrNVTabopVHmdIjZhB7ym5Uir3cL9+3tbO2" + "HqZe/+4TP//Ya/vR3e0deyo/V9kL2F483xmGBq5raNtNaK/iXpiui52dm196" + "9hc/+7fe/u1tgvr/Au+lRLFKPwAA"); }
26,932
0.576421
0.49318
285
94.178947
21.81082
106
false
false
0
0
0
0
0
0
0.189474
false
false
2
c35bcd1963ac9c46acbcf5ed6304b9da973c2e36
15,358,803,055,201
001db5eef06066c44c5a2a0a2d660e4d9a54fe1c
/shorturl/src/main/java/com/daesung/shorturl/feature/url/UrlController.java
1d7da0e4571a215c0f9013b89729bc9949862b5d
[]
no_license
yskkkkkk/urlShorten
https://github.com/yskkkkkk/urlShorten
5d4d5cb7bd654cc5bd0de77e63361a59e64b35f2
3f9da82c498ea1f5d121689b51f7468d9728e4da
refs/heads/main
2023-03-24T04:37:55.802000
2021-03-18T08:05:11
2021-03-18T08:05:11
347,845,244
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.daesung.shorturl.feature.url; import java.util.HashMap; import java.util.Map; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @Slf4j @RestController @RequestMapping("url") @RequiredArgsConstructor @Api(value = "url") public class UrlController { private final UrlService urlService; @ApiOperation(value = "createUrlKey", notes = "입력") @PostMapping("url") public ResponseEntity<?> createUrlKey(@RequestBody UrlDTO urlDTO){ log.info("input data: "+urlDTO.toString()); String result = ""; HttpStatus resultStatus = HttpStatus.OK; try { result = urlService.createUrlKey(urlDTO); } catch (Exception e) { e.printStackTrace(); resultStatus = HttpStatus.INTERNAL_SERVER_ERROR; }finally { log.info(result); } Map<String, Object> resultMap = new HashMap<>(); resultMap.put("result", result); return new ResponseEntity<>(resultMap, resultStatus); } @ApiOperation(value = "getUrlInfo", notes = "입력") @GetMapping("url") public String getUrlInfo(@RequestParam String urlKey){ log.info("input data: "+urlKey.toString()); UrlDTO urlDTO = new UrlDTO(); urlDTO.setUrlKey(urlKey); return urlService.getUrlInfo(urlDTO); } }
UTF-8
Java
1,390
java
UrlController.java
Java
[]
null
[]
package com.daesung.shorturl.feature.url; import java.util.HashMap; import java.util.Map; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @Slf4j @RestController @RequestMapping("url") @RequiredArgsConstructor @Api(value = "url") public class UrlController { private final UrlService urlService; @ApiOperation(value = "createUrlKey", notes = "입력") @PostMapping("url") public ResponseEntity<?> createUrlKey(@RequestBody UrlDTO urlDTO){ log.info("input data: "+urlDTO.toString()); String result = ""; HttpStatus resultStatus = HttpStatus.OK; try { result = urlService.createUrlKey(urlDTO); } catch (Exception e) { e.printStackTrace(); resultStatus = HttpStatus.INTERNAL_SERVER_ERROR; }finally { log.info(result); } Map<String, Object> resultMap = new HashMap<>(); resultMap.put("result", result); return new ResponseEntity<>(resultMap, resultStatus); } @ApiOperation(value = "getUrlInfo", notes = "입력") @GetMapping("url") public String getUrlInfo(@RequestParam String urlKey){ log.info("input data: "+urlKey.toString()); UrlDTO urlDTO = new UrlDTO(); urlDTO.setUrlKey(urlKey); return urlService.getUrlInfo(urlDTO); } }
1,390
0.736614
0.734443
53
25.075472
19.039036
67
false
false
0
0
0
0
0
0
1.603774
false
false
2
3a4ba2bc6f830382e835fdfb0c699c0acfc29801
2,920,577,788,936
6d62186954b1d795c7ded8d8747886aa0d30f3bc
/src/main/java/frc/team3256/robot/constants/FeederConstants.java
533623f855eeabbf3d27df4024428d117e51bf37
[]
no_license
charliebharlie/FRC_Programming_2020
https://github.com/charliebharlie/FRC_Programming_2020
be6ca5d9745c2f551575bcf3cd5937cc876f6f99
c087c0edb2a644b657cfb77f9c0a532f2c7a7a81
refs/heads/master
2023-08-25T23:13:13.479000
2021-10-25T23:38:09
2021-10-25T23:38:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package frc.team3256.robot.constants; import frc.team3256.robot.operations.SparkUtil; public class FeederConstants { public static final double kWheelDiameter = 1; public static final double kInchesBetweenPowerCells = 6; // 2.5 for 4 ball, 5 for 3 ball feeder public static final int kGearRatio = 5; public static final double kSpaceBetweenPowerCells = SparkUtil.positionToEncoderUnits(kInchesBetweenPowerCells, kGearRatio); public static final double kP = 0.18; public static final double kI = 0.00001; public static final double kD = 0.0100000000; public static final double positionTolerance = 0.15; }
UTF-8
Java
639
java
FeederConstants.java
Java
[]
null
[]
package frc.team3256.robot.constants; import frc.team3256.robot.operations.SparkUtil; public class FeederConstants { public static final double kWheelDiameter = 1; public static final double kInchesBetweenPowerCells = 6; // 2.5 for 4 ball, 5 for 3 ball feeder public static final int kGearRatio = 5; public static final double kSpaceBetweenPowerCells = SparkUtil.positionToEncoderUnits(kInchesBetweenPowerCells, kGearRatio); public static final double kP = 0.18; public static final double kI = 0.00001; public static final double kD = 0.0100000000; public static final double positionTolerance = 0.15; }
639
0.766823
0.70579
15
41.666668
34.76141
128
false
false
0
0
0
0
0
0
0.8
false
false
2
915ad2d789c16b5dbba57b8dd45a6091f7ffdbf3
12,214,887,024,900
502f8b78058f8a8f6b39c35067d34c9936580b55
/SoundboxApp/app/src/main/java/ca/umanitoba/cs/code/comp3350/winter2020/Soundbox/presentation/fragments/LibraryFragment.java
9523fb32802af9466bb26426a1ea4101498191cd
[]
no_license
CodyAu/Soundbox
https://github.com/CodyAu/Soundbox
86699aa22d5f429c60277a6bde8aa147bd0f919d
0cc66f8c5ed0ab88d4ae0a7af39cf19295da4733
refs/heads/master
2022-09-25T20:37:19.979000
2020-06-05T18:02:39
2020-06-05T18:02:39
269,724,009
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.fragments; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.SubMenu; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.Toolbar; import androidx.cursoradapter.widget.SimpleCursorAdapter; import androidx.viewpager2.widget.ViewPager2; import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.R; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.application.Observables; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.SongController; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.observables.SoundboxObserver; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.utils.SongCollectionFilters; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.utils.SongFilters; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.models.Song; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.models.SongCollection; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.activities.MainActivity; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.adapters.TabLibraryPagerAdapter; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.utils.SearchSuggestions; /** * Class: LibraryFragment.java * SearchSuggestions activity provides searching song feature for the users * it is connected with fragment_library.xml, which is its content view */ public class LibraryFragment extends BottomNavigationTab { private MainActivity mainActivity; private SoundboxObserver<Song> addSongObserver; private SoundboxObserver<Song> favoriteSongObserver; private SharedPreferences sharedPreferences; private Toolbar toolbar; private MenuItem searchItem; private SearchView searchBar; private SongController songController; private List<OnDuplicateTapListener> onDuplicateTapListeners; private List<OnTabsChangedListener> onTabsChangedListeners; private ViewPager2 viewPager; private TabLayout tabLayout; private TabLibraryPagerAdapter tabLibraryPagerAdapter; private List<List<SongCollection>> songCollections; private List<SongCollection> artists; private List<SongCollection> albums; private List<SongCollection> genres; private List<SongCollection> folders; private List<SongCollection> favorites; private SongCollection songs; private SimpleCursorAdapter simpleCursorAdapter; private List<String> songCollectionSortPreferences; private List<SongCollectionFilters.SortOrder> songCollectionSortOrders; private SongFilters.SortOrder songSortOrder; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mainActivity = (MainActivity) getActivity(); addSongObserver = (observer, arg) -> updateAddSong(observer.getValue()); favoriteSongObserver = (observer, arg) -> updateFavoriteSong(observer.getValue()); sharedPreferences = mainActivity.getSharedPreferences(mainActivity.getString(R.string.shared_pref), Context.MODE_PRIVATE); songController = new SongController(); onDuplicateTapListeners = new ArrayList<OnDuplicateTapListener>(); onTabsChangedListeners = new ArrayList<OnTabsChangedListener>(); songCollections = new ArrayList<List<SongCollection>>(); artists = new ArrayList<SongCollection>(); albums = new ArrayList<SongCollection>(); genres = new ArrayList<SongCollection>(); folders = new ArrayList<SongCollection>(); favorites = new ArrayList<SongCollection>(); songCollections.addAll(Arrays.asList(artists, albums, genres, folders, favorites)); songs = new SongCollection(); simpleCursorAdapter = SearchSuggestions.createSimpleCursorAdapter(mainActivity); songCollectionSortPreferences = Arrays.asList( getString(R.string.shared_pref_sort_artists_tab), getString(R.string.shared_pref_sort_albums_tab), getString(R.string.shared_pref_sort_genres_tab), getString(R.string.shared_pref_sort_folders_tab), getString(R.string.shared_pref_sort_favorites_tab) ); songCollectionSortOrders = new ArrayList<SongCollectionFilters.SortOrder>(); for (String preference : songCollectionSortPreferences) { songCollectionSortOrders.add(SongCollectionFilters.SortOrder.fromOrdinal(sharedPreferences.getInt(preference, 0))); } songSortOrder = SongFilters.SortOrder.fromOrdinal(sharedPreferences.getInt(getString(R.string.shared_pref_sort_tracklist), 0)); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_library, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { mainActivity.changeNavigationView(2); viewPager = (ViewPager2) view.findViewById(R.id.library_tab_view_pager); tabLayout = (TabLayout) view.findViewById(R.id.tablayout); initToolbar(); initSearchBar(); initTabLayout(); } private void initToolbar() { toolbar = (Toolbar) getView().findViewById(R.id.toolbar); toolbar.setTitle(getString(R.string.title_library)); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { int itemId = item.getItemId(); switch (itemId) { case R.id.action_search_library: return true; case R.id.action_sort_default: case R.id.action_sort_name: case R.id.action_sort_artist: case R.id.action_sort_album: case R.id.action_sort_genre: int currentTab = viewPager.getCurrentItem(); if (currentTab < songCollections.size()) { if (itemId == R.id.action_sort_default) songCollectionSortOrders.set(currentTab, SongCollectionFilters.SortOrder.DEFAULT); if (itemId == R.id.action_sort_name) songCollectionSortOrders.set(currentTab, SongCollectionFilters.SortOrder.NAME); sharedPreferences.edit().putInt(songCollectionSortPreferences.get(currentTab), songCollectionSortOrders.get(currentTab).ordinal()).apply(); } else { if (itemId == R.id.action_sort_default) songSortOrder = SongFilters.SortOrder.DEFAULT; if (itemId == R.id.action_sort_name) songSortOrder = SongFilters.SortOrder.NAME; if (itemId == R.id.action_sort_artist) songSortOrder = SongFilters.SortOrder.ARTIST; if (itemId == R.id.action_sort_album) songSortOrder = SongFilters.SortOrder.ALBUM; if (itemId == R.id.action_sort_genre) songSortOrder = SongFilters.SortOrder.GENRE; sharedPreferences.edit().putInt(getString(R.string.shared_pref_sort_tracklist), songSortOrder.ordinal()).apply(); } if (!item.isChecked() && item.isCheckable()) { item.setChecked(true); populateSongCollections(); notifyTabChanged(currentTab); } return true; default: return false; } } }); toolbar.inflateMenu(R.menu.menu_sort); toolbar.inflateMenu(R.menu.menu_library); searchItem = toolbar.getMenu().findItem(R.id.action_search_library); } private void initTabLayout() { /** * // From the docs https://developer.android.com/guide/navigation/navigation-swipe-view-2 * * Settings up the tablayout with a viewpager2 object */ tabLibraryPagerAdapter = new TabLibraryPagerAdapter(this); tabLibraryPagerAdapter.setData(songCollections, songs); viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { int lastPosition = -1; @Override public void onPageSelected(int position) { super.onPageSelected(position); if (lastPosition != position) { if (lastPosition >= 0 && searchItem.isActionViewExpanded()) searchItem.collapseActionView(); if (position < songCollections.size()) { showSortOptions(R.id.action_sort_default, R.id.action_sort_name); switch (songCollectionSortOrders.get(position)) { case DEFAULT: toolbar.getMenu().findItem(R.id.action_sort_default).setChecked(true); break; case NAME: toolbar.getMenu().findItem(R.id.action_sort_name).setChecked(true); break; } } else { showSortOptions(); switch (songSortOrder) { case DEFAULT: toolbar.getMenu().findItem(R.id.action_sort_default).setChecked(true); break; case NAME: toolbar.getMenu().findItem(R.id.action_sort_name).setChecked(true); break; case ARTIST: toolbar.getMenu().findItem(R.id.action_sort_artist).setChecked(true); break; case ALBUM: toolbar.getMenu().findItem(R.id.action_sort_album).setChecked(true); break; case GENRE: toolbar.getMenu().findItem(R.id.action_sort_genre).setChecked(true); break; default: break; } } } lastPosition = position; } }); viewPager.setAdapter(tabLibraryPagerAdapter); tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.clearOnTabSelectedListeners(); tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(TabLayout.Tab tab) { // Pass } @Override public void onTabReselected(TabLayout.Tab tab) { // Pass } }); new TabLayoutMediator(tabLayout, viewPager, new TabLayoutMediator.TabConfigurationStrategy() { @Override public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) { switch (position) { case 0: tab.setText(R.string.tab_artists); break; case 1: tab.setText(R.string.tab_albums); break; case 2: tab.setText(R.string.tab_genres); break; case 3: tab.setText(R.string.tab_folders); break; case 4: tab.setText(R.string.tab_favorites); break; case 5: tab.setText(R.string.tab_songs); break; default: tab.setText("Extras"); break; } } }).attach(); } private void initSearchBar() { try { searchBar = (SearchView) searchItem.getActionView(); } catch (Exception e) { e.printStackTrace(); } searchBar.setImeOptions(EditorInfo.IME_ACTION_DONE); searchBar.setIconified(true); searchBar.setFocusable(true); searchBar.setFocusableInTouchMode(true); searchBar.setQueryHint(mainActivity.getString(R.string.search_audio)); searchBar.setSuggestionsAdapter(simpleCursorAdapter); searchBar.setOnSuggestionListener(new SearchView.OnSuggestionListener() { @Override public boolean onSuggestionClick(int position) { searchBar.setQuery(SearchSuggestions.getSuggestion(simpleCursorAdapter, position), true); return true; } @Override public boolean onSuggestionSelect(int position) { return true; } }); searchBar.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { int currentTab = viewPager.getCurrentItem(); if (currentTab < songCollections.size()) SearchSuggestions.populateAdapterCollections(simpleCursorAdapter, newText, songCollections.get(currentTab)); else SearchSuggestions.populateAdapterSongs(simpleCursorAdapter, newText, songs); return false; } @Override public boolean onQueryTextSubmit(String query) { int currentTab = viewPager.getCurrentItem(); if (currentTab < songCollections.size()) { List<SongCollection> collection = songCollections.get(currentTab); List<SongCollection> filteredCollection = SongCollectionFilters.getSongCollectionsByNameLike(query, collection); collection.clear(); collection.addAll(filteredCollection); notifyTabChanged(currentTab); } else { List<Song> filteredSongs = SongFilters.getSongsLike(query, songs.getSongs()); songs.clearSongs(); songs.setComparator(null); songs.insertSongs(filteredSongs.subList(0, Math.min(filteredSongs.size(), SearchSuggestions.SEARCH_LIST_LIMIT))); notifyTabChanged(currentTab); } searchBar.clearFocus(); return false; } }); searchBar.setOnCloseListener(new SearchView.OnCloseListener() { @Override public boolean onClose() { updateList(); searchBar.clearFocus(); return true; } }); searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem menuItem) { return true; } @Override public boolean onMenuItemActionCollapse(MenuItem menuItem) { updateList(); searchBar.clearFocus(); return true; } }); } public void addOnDuplicateTapListener(OnDuplicateTapListener onDuplicateTapListener) { if (onDuplicateTapListener != null) this.onDuplicateTapListeners.add(onDuplicateTapListener); } public void addOnTabsChangedListener(OnTabsChangedListener onTabsChangedListener) { if (onTabsChangedListener != null) this.onTabsChangedListeners.add(onTabsChangedListener); } public void removeOnDuplicateTapListener(OnDuplicateTapListener onDuplicateTapListener) { if (onDuplicateTapListener != null) this.onDuplicateTapListeners.remove(onDuplicateTapListener); } public void removeOnTabsChangedListener(OnTabsChangedListener onTabsChangedListener) { if (onTabsChangedListener != null) this.onTabsChangedListeners.remove(onTabsChangedListener); } private void hideSortOptions() { SubMenu subMenu = toolbar.getMenu().findItem(R.id.action_sort).getSubMenu(); for (int i = 0; i < subMenu.size(); i++) { MenuItem item = subMenu.getItem(i); if (item.isVisible()) item.setVisible(false); } } private void showSortOptions() { SubMenu subMenu = toolbar.getMenu().findItem(R.id.action_sort).getSubMenu(); for (int i = 0; i < subMenu.size(); i++) { MenuItem item = subMenu.getItem(i); if (!item.isVisible()) item.setVisible(true); } } private void showSortOptions(int... resIds) { hideSortOptions(); SubMenu subMenu = toolbar.getMenu().findItem(R.id.action_sort).getSubMenu(); for (int i = 0; i < resIds.length; i++) { MenuItem item = subMenu.findItem(resIds[i]); if (item != null && !item.isVisible()) { item.setVisible(true); } } } private void populateSongCollections() { List<Song> allSongs = songController.getAllSongs(); artists.clear(); albums.clear(); genres.clear(); folders.clear(); songs.clearSongs(); artists.addAll(SongFilters.groupSongsByArtist(allSongs)); albums.addAll(SongFilters.groupSongsByAlbum(allSongs)); genres.addAll(SongFilters.groupSongsByGenre(allSongs)); folders.addAll(SongFilters.groupSongsByFolder(allSongs)); populateFavorites(allSongs); songs.insertSongs(allSongs); for (int i = 0; i < songCollections.size(); i++) { if (songCollectionSortOrders.get(i).equals(SongCollectionFilters.SortOrder.NAME)) Collections.sort(songCollections.get(i), SongCollection::compareToByName); } if (songSortOrder.equals(SongFilters.SortOrder.DEFAULT)) songs.setComparator(Song::compareToById); if (songSortOrder.equals(SongFilters.SortOrder.NAME)) songs.setComparator(Song::compareToByName); if (songSortOrder.equals(SongFilters.SortOrder.ARTIST)) songs.setComparator(Song::compareToByArtist); if (songSortOrder.equals(SongFilters.SortOrder.ALBUM)) songs.setComparator(Song::compareToByAlbum); if (songSortOrder.equals(SongFilters.SortOrder.GENRE)) songs.setComparator(Song::compareToByGenre); } private void populateFavorites(List<Song> allSongs) { favorites.clear(); favorites.addAll(SongFilters.groupSongsByFavorites(mainActivity, allSongs)); } private void registerObservers() { Observables.getAddSongPlaybackQueueObservable().addObserver(addSongObserver); Observables.getFavoriteSongObservable().addObserver(favoriteSongObserver); } private void unregisterObservers() { Observables.getAddSongPlaybackQueueObservable().deleteObserver(addSongObserver); Observables.getFavoriteSongObservable().deleteObserver(favoriteSongObserver); } public void updateAddSong(Song song) { updateList(); } public void updateFavoriteSong(Song song) { populateFavorites(songs.getSongs()); notifyTabChanged(songCollections.indexOf(favorites)); } public void updateList() { populateSongCollections(); notifyTabChanged(-1); } private void notifyTabChanged(int tabChanged) { for (OnTabsChangedListener onTabsChangedListener : onTabsChangedListeners) { if (onTabsChangedListener != null) onTabsChangedListener.onTabsChanged(tabChanged); } } @Override public void onDuplicateTap() { for (OnDuplicateTapListener onDuplicateTapListener : onDuplicateTapListeners) { if (onDuplicateTapListener != null) onDuplicateTapListener.onDuplicateTap(); } } @Override public void onResume() { super.onResume(); searchBar.clearFocus(); if (!searchItem.isActionViewExpanded()) // If the user has searched then do not change the results updateList(); registerObservers(); } @Override public void onPause() { super.onPause(); unregisterObservers(); } @Override public void onDestroy() { unregisterObservers(); super.onDestroy(); } public interface OnDuplicateTapListener { void onDuplicateTap(); } public interface OnTabsChangedListener { void onTabsChanged(int tabChanged); //pass your object types. } }
UTF-8
Java
22,031
java
LibraryFragment.java
Java
[]
null
[]
package ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.fragments; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.SubMenu; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; import androidx.appcompat.widget.Toolbar; import androidx.cursoradapter.widget.SimpleCursorAdapter; import androidx.viewpager2.widget.ViewPager2; import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.R; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.application.Observables; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.SongController; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.observables.SoundboxObserver; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.utils.SongCollectionFilters; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.logic.utils.SongFilters; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.models.Song; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.models.SongCollection; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.activities.MainActivity; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.adapters.TabLibraryPagerAdapter; import ca.umanitoba.cs.code.comp3350.winter2020.Soundbox.presentation.utils.SearchSuggestions; /** * Class: LibraryFragment.java * SearchSuggestions activity provides searching song feature for the users * it is connected with fragment_library.xml, which is its content view */ public class LibraryFragment extends BottomNavigationTab { private MainActivity mainActivity; private SoundboxObserver<Song> addSongObserver; private SoundboxObserver<Song> favoriteSongObserver; private SharedPreferences sharedPreferences; private Toolbar toolbar; private MenuItem searchItem; private SearchView searchBar; private SongController songController; private List<OnDuplicateTapListener> onDuplicateTapListeners; private List<OnTabsChangedListener> onTabsChangedListeners; private ViewPager2 viewPager; private TabLayout tabLayout; private TabLibraryPagerAdapter tabLibraryPagerAdapter; private List<List<SongCollection>> songCollections; private List<SongCollection> artists; private List<SongCollection> albums; private List<SongCollection> genres; private List<SongCollection> folders; private List<SongCollection> favorites; private SongCollection songs; private SimpleCursorAdapter simpleCursorAdapter; private List<String> songCollectionSortPreferences; private List<SongCollectionFilters.SortOrder> songCollectionSortOrders; private SongFilters.SortOrder songSortOrder; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mainActivity = (MainActivity) getActivity(); addSongObserver = (observer, arg) -> updateAddSong(observer.getValue()); favoriteSongObserver = (observer, arg) -> updateFavoriteSong(observer.getValue()); sharedPreferences = mainActivity.getSharedPreferences(mainActivity.getString(R.string.shared_pref), Context.MODE_PRIVATE); songController = new SongController(); onDuplicateTapListeners = new ArrayList<OnDuplicateTapListener>(); onTabsChangedListeners = new ArrayList<OnTabsChangedListener>(); songCollections = new ArrayList<List<SongCollection>>(); artists = new ArrayList<SongCollection>(); albums = new ArrayList<SongCollection>(); genres = new ArrayList<SongCollection>(); folders = new ArrayList<SongCollection>(); favorites = new ArrayList<SongCollection>(); songCollections.addAll(Arrays.asList(artists, albums, genres, folders, favorites)); songs = new SongCollection(); simpleCursorAdapter = SearchSuggestions.createSimpleCursorAdapter(mainActivity); songCollectionSortPreferences = Arrays.asList( getString(R.string.shared_pref_sort_artists_tab), getString(R.string.shared_pref_sort_albums_tab), getString(R.string.shared_pref_sort_genres_tab), getString(R.string.shared_pref_sort_folders_tab), getString(R.string.shared_pref_sort_favorites_tab) ); songCollectionSortOrders = new ArrayList<SongCollectionFilters.SortOrder>(); for (String preference : songCollectionSortPreferences) { songCollectionSortOrders.add(SongCollectionFilters.SortOrder.fromOrdinal(sharedPreferences.getInt(preference, 0))); } songSortOrder = SongFilters.SortOrder.fromOrdinal(sharedPreferences.getInt(getString(R.string.shared_pref_sort_tracklist), 0)); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_library, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { mainActivity.changeNavigationView(2); viewPager = (ViewPager2) view.findViewById(R.id.library_tab_view_pager); tabLayout = (TabLayout) view.findViewById(R.id.tablayout); initToolbar(); initSearchBar(); initTabLayout(); } private void initToolbar() { toolbar = (Toolbar) getView().findViewById(R.id.toolbar); toolbar.setTitle(getString(R.string.title_library)); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { int itemId = item.getItemId(); switch (itemId) { case R.id.action_search_library: return true; case R.id.action_sort_default: case R.id.action_sort_name: case R.id.action_sort_artist: case R.id.action_sort_album: case R.id.action_sort_genre: int currentTab = viewPager.getCurrentItem(); if (currentTab < songCollections.size()) { if (itemId == R.id.action_sort_default) songCollectionSortOrders.set(currentTab, SongCollectionFilters.SortOrder.DEFAULT); if (itemId == R.id.action_sort_name) songCollectionSortOrders.set(currentTab, SongCollectionFilters.SortOrder.NAME); sharedPreferences.edit().putInt(songCollectionSortPreferences.get(currentTab), songCollectionSortOrders.get(currentTab).ordinal()).apply(); } else { if (itemId == R.id.action_sort_default) songSortOrder = SongFilters.SortOrder.DEFAULT; if (itemId == R.id.action_sort_name) songSortOrder = SongFilters.SortOrder.NAME; if (itemId == R.id.action_sort_artist) songSortOrder = SongFilters.SortOrder.ARTIST; if (itemId == R.id.action_sort_album) songSortOrder = SongFilters.SortOrder.ALBUM; if (itemId == R.id.action_sort_genre) songSortOrder = SongFilters.SortOrder.GENRE; sharedPreferences.edit().putInt(getString(R.string.shared_pref_sort_tracklist), songSortOrder.ordinal()).apply(); } if (!item.isChecked() && item.isCheckable()) { item.setChecked(true); populateSongCollections(); notifyTabChanged(currentTab); } return true; default: return false; } } }); toolbar.inflateMenu(R.menu.menu_sort); toolbar.inflateMenu(R.menu.menu_library); searchItem = toolbar.getMenu().findItem(R.id.action_search_library); } private void initTabLayout() { /** * // From the docs https://developer.android.com/guide/navigation/navigation-swipe-view-2 * * Settings up the tablayout with a viewpager2 object */ tabLibraryPagerAdapter = new TabLibraryPagerAdapter(this); tabLibraryPagerAdapter.setData(songCollections, songs); viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { int lastPosition = -1; @Override public void onPageSelected(int position) { super.onPageSelected(position); if (lastPosition != position) { if (lastPosition >= 0 && searchItem.isActionViewExpanded()) searchItem.collapseActionView(); if (position < songCollections.size()) { showSortOptions(R.id.action_sort_default, R.id.action_sort_name); switch (songCollectionSortOrders.get(position)) { case DEFAULT: toolbar.getMenu().findItem(R.id.action_sort_default).setChecked(true); break; case NAME: toolbar.getMenu().findItem(R.id.action_sort_name).setChecked(true); break; } } else { showSortOptions(); switch (songSortOrder) { case DEFAULT: toolbar.getMenu().findItem(R.id.action_sort_default).setChecked(true); break; case NAME: toolbar.getMenu().findItem(R.id.action_sort_name).setChecked(true); break; case ARTIST: toolbar.getMenu().findItem(R.id.action_sort_artist).setChecked(true); break; case ALBUM: toolbar.getMenu().findItem(R.id.action_sort_album).setChecked(true); break; case GENRE: toolbar.getMenu().findItem(R.id.action_sort_genre).setChecked(true); break; default: break; } } } lastPosition = position; } }); viewPager.setAdapter(tabLibraryPagerAdapter); tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.clearOnTabSelectedListeners(); tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(TabLayout.Tab tab) { // Pass } @Override public void onTabReselected(TabLayout.Tab tab) { // Pass } }); new TabLayoutMediator(tabLayout, viewPager, new TabLayoutMediator.TabConfigurationStrategy() { @Override public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) { switch (position) { case 0: tab.setText(R.string.tab_artists); break; case 1: tab.setText(R.string.tab_albums); break; case 2: tab.setText(R.string.tab_genres); break; case 3: tab.setText(R.string.tab_folders); break; case 4: tab.setText(R.string.tab_favorites); break; case 5: tab.setText(R.string.tab_songs); break; default: tab.setText("Extras"); break; } } }).attach(); } private void initSearchBar() { try { searchBar = (SearchView) searchItem.getActionView(); } catch (Exception e) { e.printStackTrace(); } searchBar.setImeOptions(EditorInfo.IME_ACTION_DONE); searchBar.setIconified(true); searchBar.setFocusable(true); searchBar.setFocusableInTouchMode(true); searchBar.setQueryHint(mainActivity.getString(R.string.search_audio)); searchBar.setSuggestionsAdapter(simpleCursorAdapter); searchBar.setOnSuggestionListener(new SearchView.OnSuggestionListener() { @Override public boolean onSuggestionClick(int position) { searchBar.setQuery(SearchSuggestions.getSuggestion(simpleCursorAdapter, position), true); return true; } @Override public boolean onSuggestionSelect(int position) { return true; } }); searchBar.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { int currentTab = viewPager.getCurrentItem(); if (currentTab < songCollections.size()) SearchSuggestions.populateAdapterCollections(simpleCursorAdapter, newText, songCollections.get(currentTab)); else SearchSuggestions.populateAdapterSongs(simpleCursorAdapter, newText, songs); return false; } @Override public boolean onQueryTextSubmit(String query) { int currentTab = viewPager.getCurrentItem(); if (currentTab < songCollections.size()) { List<SongCollection> collection = songCollections.get(currentTab); List<SongCollection> filteredCollection = SongCollectionFilters.getSongCollectionsByNameLike(query, collection); collection.clear(); collection.addAll(filteredCollection); notifyTabChanged(currentTab); } else { List<Song> filteredSongs = SongFilters.getSongsLike(query, songs.getSongs()); songs.clearSongs(); songs.setComparator(null); songs.insertSongs(filteredSongs.subList(0, Math.min(filteredSongs.size(), SearchSuggestions.SEARCH_LIST_LIMIT))); notifyTabChanged(currentTab); } searchBar.clearFocus(); return false; } }); searchBar.setOnCloseListener(new SearchView.OnCloseListener() { @Override public boolean onClose() { updateList(); searchBar.clearFocus(); return true; } }); searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem menuItem) { return true; } @Override public boolean onMenuItemActionCollapse(MenuItem menuItem) { updateList(); searchBar.clearFocus(); return true; } }); } public void addOnDuplicateTapListener(OnDuplicateTapListener onDuplicateTapListener) { if (onDuplicateTapListener != null) this.onDuplicateTapListeners.add(onDuplicateTapListener); } public void addOnTabsChangedListener(OnTabsChangedListener onTabsChangedListener) { if (onTabsChangedListener != null) this.onTabsChangedListeners.add(onTabsChangedListener); } public void removeOnDuplicateTapListener(OnDuplicateTapListener onDuplicateTapListener) { if (onDuplicateTapListener != null) this.onDuplicateTapListeners.remove(onDuplicateTapListener); } public void removeOnTabsChangedListener(OnTabsChangedListener onTabsChangedListener) { if (onTabsChangedListener != null) this.onTabsChangedListeners.remove(onTabsChangedListener); } private void hideSortOptions() { SubMenu subMenu = toolbar.getMenu().findItem(R.id.action_sort).getSubMenu(); for (int i = 0; i < subMenu.size(); i++) { MenuItem item = subMenu.getItem(i); if (item.isVisible()) item.setVisible(false); } } private void showSortOptions() { SubMenu subMenu = toolbar.getMenu().findItem(R.id.action_sort).getSubMenu(); for (int i = 0; i < subMenu.size(); i++) { MenuItem item = subMenu.getItem(i); if (!item.isVisible()) item.setVisible(true); } } private void showSortOptions(int... resIds) { hideSortOptions(); SubMenu subMenu = toolbar.getMenu().findItem(R.id.action_sort).getSubMenu(); for (int i = 0; i < resIds.length; i++) { MenuItem item = subMenu.findItem(resIds[i]); if (item != null && !item.isVisible()) { item.setVisible(true); } } } private void populateSongCollections() { List<Song> allSongs = songController.getAllSongs(); artists.clear(); albums.clear(); genres.clear(); folders.clear(); songs.clearSongs(); artists.addAll(SongFilters.groupSongsByArtist(allSongs)); albums.addAll(SongFilters.groupSongsByAlbum(allSongs)); genres.addAll(SongFilters.groupSongsByGenre(allSongs)); folders.addAll(SongFilters.groupSongsByFolder(allSongs)); populateFavorites(allSongs); songs.insertSongs(allSongs); for (int i = 0; i < songCollections.size(); i++) { if (songCollectionSortOrders.get(i).equals(SongCollectionFilters.SortOrder.NAME)) Collections.sort(songCollections.get(i), SongCollection::compareToByName); } if (songSortOrder.equals(SongFilters.SortOrder.DEFAULT)) songs.setComparator(Song::compareToById); if (songSortOrder.equals(SongFilters.SortOrder.NAME)) songs.setComparator(Song::compareToByName); if (songSortOrder.equals(SongFilters.SortOrder.ARTIST)) songs.setComparator(Song::compareToByArtist); if (songSortOrder.equals(SongFilters.SortOrder.ALBUM)) songs.setComparator(Song::compareToByAlbum); if (songSortOrder.equals(SongFilters.SortOrder.GENRE)) songs.setComparator(Song::compareToByGenre); } private void populateFavorites(List<Song> allSongs) { favorites.clear(); favorites.addAll(SongFilters.groupSongsByFavorites(mainActivity, allSongs)); } private void registerObservers() { Observables.getAddSongPlaybackQueueObservable().addObserver(addSongObserver); Observables.getFavoriteSongObservable().addObserver(favoriteSongObserver); } private void unregisterObservers() { Observables.getAddSongPlaybackQueueObservable().deleteObserver(addSongObserver); Observables.getFavoriteSongObservable().deleteObserver(favoriteSongObserver); } public void updateAddSong(Song song) { updateList(); } public void updateFavoriteSong(Song song) { populateFavorites(songs.getSongs()); notifyTabChanged(songCollections.indexOf(favorites)); } public void updateList() { populateSongCollections(); notifyTabChanged(-1); } private void notifyTabChanged(int tabChanged) { for (OnTabsChangedListener onTabsChangedListener : onTabsChangedListeners) { if (onTabsChangedListener != null) onTabsChangedListener.onTabsChanged(tabChanged); } } @Override public void onDuplicateTap() { for (OnDuplicateTapListener onDuplicateTapListener : onDuplicateTapListeners) { if (onDuplicateTapListener != null) onDuplicateTapListener.onDuplicateTap(); } } @Override public void onResume() { super.onResume(); searchBar.clearFocus(); if (!searchItem.isActionViewExpanded()) // If the user has searched then do not change the results updateList(); registerObservers(); } @Override public void onPause() { super.onPause(); unregisterObservers(); } @Override public void onDestroy() { unregisterObservers(); super.onDestroy(); } public interface OnDuplicateTapListener { void onDuplicateTap(); } public interface OnTabsChangedListener { void onTabsChanged(int tabChanged); //pass your object types. } }
22,031
0.609596
0.604149
569
37.718803
31.504875
167
false
false
0
0
0
0
0
0
0.518453
false
false
2
f4dbc60ab7d0236249319c001a7cc24b16e8afde
12,214,887,026,800
ff9baa246137f03f22980348003485492b5840e4
/src/com/finalproject/Activity/Activity.java
fb27afa0d22e6e1b2ad3cccf5893ee5591ade864
[]
no_license
luongvankiet/SOA-final-BE
https://github.com/luongvankiet/SOA-final-BE
615bc717fe96d3932b39a0f5ac85e759efabfba6
bbdb93026e1cbf505adb63f12847a0d5fd348383
refs/heads/master
2020-04-08T13:56:14.501000
2018-12-06T16:32:11
2018-12-06T16:32:11
159,414,456
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.finalproject.Activity; import com.finalproject.Semester.Semester; public class Activity { private int activityID; private String activityContent; private Semester semester; private int score; private int numberOfJoin; private int limitOfJoin; private String date; private String status; private String place; public Activity() {} public Activity(int activityID, String activityContent, Semester semester, int score, int numberOfJoin, int limitOfJoin, String date, String status, String place) { this.activityID = activityID; this.activityContent = activityContent; this.setSemester(semester); this.score = score; this.numberOfJoin = numberOfJoin; this.limitOfJoin = limitOfJoin; this.date = date; this.status = status; this.place = place; } public String getActivityContent() { return activityContent; } public void setActivityContent(String activityContent) { this.activityContent = activityContent; } public int getActivityID() { return activityID; } public void setActivityID(int activityID) { this.activityID = activityID; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public int getNumberOfJoin() { return numberOfJoin; } public void setNumberOfJoin(int numberOfJoin) { this.numberOfJoin = numberOfJoin; } public int getLimitOfJoin() { return limitOfJoin; } public void setLimitOfJoin(int limitOfJoin) { this.limitOfJoin = limitOfJoin; } public Semester getSemester() { return semester; } public void setSemester(Semester semester) { this.semester = semester; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } }
UTF-8
Java
1,949
java
Activity.java
Java
[]
null
[]
package com.finalproject.Activity; import com.finalproject.Semester.Semester; public class Activity { private int activityID; private String activityContent; private Semester semester; private int score; private int numberOfJoin; private int limitOfJoin; private String date; private String status; private String place; public Activity() {} public Activity(int activityID, String activityContent, Semester semester, int score, int numberOfJoin, int limitOfJoin, String date, String status, String place) { this.activityID = activityID; this.activityContent = activityContent; this.setSemester(semester); this.score = score; this.numberOfJoin = numberOfJoin; this.limitOfJoin = limitOfJoin; this.date = date; this.status = status; this.place = place; } public String getActivityContent() { return activityContent; } public void setActivityContent(String activityContent) { this.activityContent = activityContent; } public int getActivityID() { return activityID; } public void setActivityID(int activityID) { this.activityID = activityID; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public int getNumberOfJoin() { return numberOfJoin; } public void setNumberOfJoin(int numberOfJoin) { this.numberOfJoin = numberOfJoin; } public int getLimitOfJoin() { return limitOfJoin; } public void setLimitOfJoin(int limitOfJoin) { this.limitOfJoin = limitOfJoin; } public Semester getSemester() { return semester; } public void setSemester(Semester semester) { this.semester = semester; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } }
1,949
0.73884
0.73884
83
22.481928
17.428934
104
false
false
0
0
0
0
0
0
1.843374
false
false
2
df00b42fd4c0eb9a32c50c10437681ba21b4c195
23,648,089,984,022
60d772974950b30f1508f8ea94b52e0d91d3cedb
/app/src/main/java/lanjing/com/titan/contact/DealContact.java
96ecca2cdb7ee6809965c99b9c934c284bdab299
[]
no_license
liyixaing/NewTiTanasd
https://github.com/liyixaing/NewTiTanasd
b0a79d63078f4e1ef3e2821591598348072c11a4
7ec7aae00a6a647cbe496069e597cfa28ea0e825
refs/heads/master
2020-06-13T09:16:02.947000
2019-12-20T08:42:11
2019-12-20T08:42:11
194,610,786
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package lanjing.com.titan.contact; import android.content.Context; import com.lxh.baselibray.mvp.BasePresent; import com.lxh.baselibray.mvp.IBaseView; import lanjing.com.titan.net.NetCallBack; import com.lxh.baselibray.net.ServiceGenerator; import com.lxh.baselibray.util.Md5Utils; import com.lxh.baselibray.util.SPUtils; import lanjing.com.titan.api.ApiService; import lanjing.com.titan.constant.Constant; import lanjing.com.titan.request.ActiveRequest; import lanjing.com.titan.request.BuyOrSellRequest; import lanjing.com.titan.request.DealPwdRequest; import lanjing.com.titan.request.EntrustListRequest; import lanjing.com.titan.request.InterDealRequest; import lanjing.com.titan.request.LanguageRequest; import lanjing.com.titan.request.RecallRequest; import lanjing.com.titan.response.ActiveResponse; import lanjing.com.titan.response.EntrustListResponse; import lanjing.com.titan.response.InterDealResponse; import lanjing.com.titan.response.PersonResponse; import lanjing.com.titan.response.ResultDTO; import lanjing.com.titan.response.SixTradeResponse; import lanjing.com.titan.response.WalletDataResponse; import retrofit2.Call; import retrofit2.Response; /** * Created by chenxi on 2019/4/12. */ //币币交易 主方法 public class DealContact { public static class DealPresent extends BasePresent<IDealView> { //智能交易 public void interDeal(final Context context, Integer isAuto) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); InterDealRequest request = new InterDealRequest(isAuto); service.interDeal(token, request).enqueue(new NetCallBack<InterDealResponse>() { @Override public void onSuccess(Call<InterDealResponse> call, Response<InterDealResponse> response) { if (getView() != null) { getView().getInterDealResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //右侧行情数据 两位显示 public void rightSixList(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.rigehtSixInfo(token, request).enqueue(new NetCallBack<SixTradeResponse>() { @Override public void onSuccess(Call<SixTradeResponse> call, Response<SixTradeResponse> response) { if (getView() != null) { getView().getDealSixResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //右侧行情数据 一位显示 public void rightSixListOne(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.rigehtSixInfo(token, request).enqueue(new NetCallBack<SixTradeResponse>() { @Override public void onSuccess(Call<SixTradeResponse> call, Response<SixTradeResponse> response) { if (getView() != null) { getView().getDealSixOneResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //右侧行情数据 零位显示 public void rightSixListZero(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.rigehtSixInfo(token, request).enqueue(new NetCallBack<SixTradeResponse>() { @Override public void onSuccess(Call<SixTradeResponse> call, Response<SixTradeResponse> response) { if (getView() != null) { getView().getDealSixZeroResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 TITAN的 可用 可用数量 public void walletDataTitan(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.walletData(token, request).enqueue(new NetCallBack<WalletDataResponse>() { @Override public void onSuccess(Call<WalletDataResponse> call, Response<WalletDataResponse> response) { if (getView() != null) { getView().getWalletDataTitanResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 USD 的 可用 可用数量 public void walletDataUsd(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.walletData(token, request).enqueue(new NetCallBack<WalletDataResponse>() { @Override public void onSuccess(Call<WalletDataResponse> call, Response<WalletDataResponse> response) { if (getView() != null) { getView().getWalletDataUsdResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 委托列表 public void entrustList(final Context context, String page, String size, String state) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); EntrustListRequest request = new EntrustListRequest(page, size, state); service.entrustList(token, request).enqueue(new NetCallBack<EntrustListResponse>() { @Override public void onSuccess(Call<EntrustListResponse> call, Response<EntrustListResponse> response) { if (getView() != null) { getView().getEntrustListResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 撤销委托 public void recallEntrust(final Context context, String id) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); RecallRequest request = new RecallRequest(id); service.recallEntrust(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getRecallEntrustResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 买卖单 public void buyOrSell(final Context context, String coin, String coinNum, String type) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); BuyOrSellRequest request = new BuyOrSellRequest(coin, coinNum, type); service.buyOrSell(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getBuyOrSellResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 验证买入密码 public void dealPwdBuy(final Context context, String password, String type) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); DealPwdRequest request = new DealPwdRequest(Md5Utils.MD5(password), type); service.dealPwd(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getDealPwdBuyResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 验证卖出密码 public void dealPwdSell(final Context context, String password, String type) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); DealPwdRequest request = new DealPwdRequest(Md5Utils.MD5(password), type); service.dealPwd(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getDealPwdSellResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } public void person(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.getPerson(token, request).enqueue(new NetCallBack<PersonResponse>() { @Override public void onSuccess(Call<PersonResponse> call, Response<PersonResponse> response) { if (getView() != null) { getView().getPersonResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } } public interface IDealView extends IBaseView { void getInterDealResult(Response<InterDealResponse> response);//钱包主页数据获取 void getWalletDataTitanResult(Response<WalletDataResponse> response);//钱包主页数据获取 TItan 可用 void getWalletDataUsdResult(Response<WalletDataResponse> response);//钱包主页数据获取 Usd 可用 void getDealSixResult(Response<SixTradeResponse> response);//右侧列表数据 void getDealSixOneResult(Response<SixTradeResponse> response);//右侧列表数据 1 位 void getDealSixZeroResult(Response<SixTradeResponse> response);//右侧列表数据 0位 void getEntrustListResult(Response<EntrustListResponse> response);//币币交易 委托列表 包括历史委托 void getRecallEntrustResult(Response<ResultDTO> response);//币币交易 撤销委托 void getDealPwdBuyResult(Response<ResultDTO> response);//币币交易 买入验证交易密码 void getDealPwdSellResult(Response<ResultDTO> response);//币币交易 卖出验证交易密码 void getBuyOrSellResult(Response<ResultDTO> response);//币币交易 买卖单 void getPersonResult(Response<PersonResponse> response); void getDataFailed(); } }
UTF-8
Java
14,233
java
DealContact.java
Java
[ { "context": "all;\nimport retrofit2.Response;\n\n/**\n * Created by chenxi on 2019/4/12.\n */\n//币币交易 主方法\n\npublic class DealCo", "end": 1196, "score": 0.9996271729469299, "start": 1190, "tag": "USERNAME", "value": "chenxi" }, { "context": "vice(ApiService.class);\n String token = SPUtils.getString(Constant.TOKEN, \"\", context);\n ", "end": 4369, "score": 0.8093050122261047, "start": 4362, "tag": "KEY", "value": "SPUtils" }, { "context": "vice(ApiService.class);\n String token = SPUtils.getString(Constant.TOKEN, \"\", context);\n int lan", "end": 5355, "score": 0.9537943005561829, "start": 5338, "tag": "KEY", "value": "SPUtils.getString" }, { "context": "vice(ApiService.class);\n String token = SPUtils.getString(Constant.TOKEN, \"\", context);\n int lan", "end": 6337, "score": 0.9243520498275757, "start": 6320, "tag": "KEY", "value": "SPUtils.getString" } ]
null
[]
package lanjing.com.titan.contact; import android.content.Context; import com.lxh.baselibray.mvp.BasePresent; import com.lxh.baselibray.mvp.IBaseView; import lanjing.com.titan.net.NetCallBack; import com.lxh.baselibray.net.ServiceGenerator; import com.lxh.baselibray.util.Md5Utils; import com.lxh.baselibray.util.SPUtils; import lanjing.com.titan.api.ApiService; import lanjing.com.titan.constant.Constant; import lanjing.com.titan.request.ActiveRequest; import lanjing.com.titan.request.BuyOrSellRequest; import lanjing.com.titan.request.DealPwdRequest; import lanjing.com.titan.request.EntrustListRequest; import lanjing.com.titan.request.InterDealRequest; import lanjing.com.titan.request.LanguageRequest; import lanjing.com.titan.request.RecallRequest; import lanjing.com.titan.response.ActiveResponse; import lanjing.com.titan.response.EntrustListResponse; import lanjing.com.titan.response.InterDealResponse; import lanjing.com.titan.response.PersonResponse; import lanjing.com.titan.response.ResultDTO; import lanjing.com.titan.response.SixTradeResponse; import lanjing.com.titan.response.WalletDataResponse; import retrofit2.Call; import retrofit2.Response; /** * Created by chenxi on 2019/4/12. */ //币币交易 主方法 public class DealContact { public static class DealPresent extends BasePresent<IDealView> { //智能交易 public void interDeal(final Context context, Integer isAuto) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); InterDealRequest request = new InterDealRequest(isAuto); service.interDeal(token, request).enqueue(new NetCallBack<InterDealResponse>() { @Override public void onSuccess(Call<InterDealResponse> call, Response<InterDealResponse> response) { if (getView() != null) { getView().getInterDealResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //右侧行情数据 两位显示 public void rightSixList(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.rigehtSixInfo(token, request).enqueue(new NetCallBack<SixTradeResponse>() { @Override public void onSuccess(Call<SixTradeResponse> call, Response<SixTradeResponse> response) { if (getView() != null) { getView().getDealSixResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //右侧行情数据 一位显示 public void rightSixListOne(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.rigehtSixInfo(token, request).enqueue(new NetCallBack<SixTradeResponse>() { @Override public void onSuccess(Call<SixTradeResponse> call, Response<SixTradeResponse> response) { if (getView() != null) { getView().getDealSixOneResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //右侧行情数据 零位显示 public void rightSixListZero(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.rigehtSixInfo(token, request).enqueue(new NetCallBack<SixTradeResponse>() { @Override public void onSuccess(Call<SixTradeResponse> call, Response<SixTradeResponse> response) { if (getView() != null) { getView().getDealSixZeroResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 TITAN的 可用 可用数量 public void walletDataTitan(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.walletData(token, request).enqueue(new NetCallBack<WalletDataResponse>() { @Override public void onSuccess(Call<WalletDataResponse> call, Response<WalletDataResponse> response) { if (getView() != null) { getView().getWalletDataTitanResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 USD 的 可用 可用数量 public void walletDataUsd(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.walletData(token, request).enqueue(new NetCallBack<WalletDataResponse>() { @Override public void onSuccess(Call<WalletDataResponse> call, Response<WalletDataResponse> response) { if (getView() != null) { getView().getWalletDataUsdResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 委托列表 public void entrustList(final Context context, String page, String size, String state) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); EntrustListRequest request = new EntrustListRequest(page, size, state); service.entrustList(token, request).enqueue(new NetCallBack<EntrustListResponse>() { @Override public void onSuccess(Call<EntrustListResponse> call, Response<EntrustListResponse> response) { if (getView() != null) { getView().getEntrustListResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 撤销委托 public void recallEntrust(final Context context, String id) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); RecallRequest request = new RecallRequest(id); service.recallEntrust(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getRecallEntrustResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 买卖单 public void buyOrSell(final Context context, String coin, String coinNum, String type) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); BuyOrSellRequest request = new BuyOrSellRequest(coin, coinNum, type); service.buyOrSell(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getBuyOrSellResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 验证买入密码 public void dealPwdBuy(final Context context, String password, String type) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); DealPwdRequest request = new DealPwdRequest(Md5Utils.MD5(password), type); service.dealPwd(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getDealPwdBuyResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } //币币交易 验证卖出密码 public void dealPwdSell(final Context context, String password, String type) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); DealPwdRequest request = new DealPwdRequest(Md5Utils.MD5(password), type); service.dealPwd(token, request).enqueue(new NetCallBack<ResultDTO>() { @Override public void onSuccess(Call<ResultDTO> call, Response<ResultDTO> response) { if (getView() != null) { getView().getDealPwdSellResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } public void person(final Context context) { ApiService service = ServiceGenerator.createService(ApiService.class); String token = SPUtils.getString(Constant.TOKEN, "", context); int language = Constant.LANGAGE; LanguageRequest request = new LanguageRequest(language); service.getPerson(token, request).enqueue(new NetCallBack<PersonResponse>() { @Override public void onSuccess(Call<PersonResponse> call, Response<PersonResponse> response) { if (getView() != null) { getView().getPersonResult(response); } } @Override public void onFailed() { if (getView() != null) { getView().getDataFailed(); } } }); } } public interface IDealView extends IBaseView { void getInterDealResult(Response<InterDealResponse> response);//钱包主页数据获取 void getWalletDataTitanResult(Response<WalletDataResponse> response);//钱包主页数据获取 TItan 可用 void getWalletDataUsdResult(Response<WalletDataResponse> response);//钱包主页数据获取 Usd 可用 void getDealSixResult(Response<SixTradeResponse> response);//右侧列表数据 void getDealSixOneResult(Response<SixTradeResponse> response);//右侧列表数据 1 位 void getDealSixZeroResult(Response<SixTradeResponse> response);//右侧列表数据 0位 void getEntrustListResult(Response<EntrustListResponse> response);//币币交易 委托列表 包括历史委托 void getRecallEntrustResult(Response<ResultDTO> response);//币币交易 撤销委托 void getDealPwdBuyResult(Response<ResultDTO> response);//币币交易 买入验证交易密码 void getDealPwdSellResult(Response<ResultDTO> response);//币币交易 卖出验证交易密码 void getBuyOrSellResult(Response<ResultDTO> response);//币币交易 买卖单 void getPersonResult(Response<PersonResponse> response); void getDataFailed(); } }
14,233
0.55771
0.556553
342
39.406433
30.004801
111
false
false
0
0
0
0
0
0
0.535088
false
false
2
d1e8747b9d397cde90826a88c516ceafd6672b17
6,244,882,498,940
f76109275b2d5fe2dfb8fb96a7a06b1a75f151cf
/scorpius-graylog/src/main/java/org/joo/scorpius/support/graylog/msg/AnnotatedExecutionContextFinishMessage.java
4293e2cd0720572fee6e14459974d8d9e5ed4446
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
dungba88/scorpius
https://github.com/dungba88/scorpius
b69294f4dc92704af5af3df20f1b466ab59765dd
2b74ee2a69fe8e3ad71f05212b525b4c52689230
refs/heads/master
2021-09-25T07:03:37.138000
2018-10-19T08:20:14
2018-10-19T08:20:14
109,854,857
0
1
null
false
2017-11-14T09:15:52
2017-11-07T15:35:13
2017-11-14T09:14:56
2017-11-14T09:15:52
145
0
0
0
Java
false
null
package org.joo.scorpius.support.graylog.msg; import org.joo.scorpius.support.message.ExecutionContextFinishMessage; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class AnnotatedExecutionContextFinishMessage extends AnnotatedGelfMessage { private static final long serialVersionUID = 3900326418162752886L; private ExecutionContextFinishMessage msg; public AnnotatedExecutionContextFinishMessage(ObjectMapper mapper, ExecutionContextFinishMessage msg) { super(); this.msg = msg; putField("executionContextId", msg.getId()); putField("eventName", msg.getEventName()); if (msg.getRequest() != null) { putField("traceId", msg.getRequest().getTraceId()); } try { putField("response", mapper.writeValueAsString(msg.getResponse())); } catch (JsonProcessingException e) { putField("responseEncodeException", e); } } @Override public String getFormattedMessage() { return "Finish handling event " + msg.getEventName() + " with id " + msg.getId(); } @Override public String getFormat() { return ""; } @Override public Object[] getParameters() { return new Object[0]; } @Override public Throwable getThrowable() { return null; } }
UTF-8
Java
1,454
java
AnnotatedExecutionContextFinishMessage.java
Java
[]
null
[]
package org.joo.scorpius.support.graylog.msg; import org.joo.scorpius.support.message.ExecutionContextFinishMessage; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class AnnotatedExecutionContextFinishMessage extends AnnotatedGelfMessage { private static final long serialVersionUID = 3900326418162752886L; private ExecutionContextFinishMessage msg; public AnnotatedExecutionContextFinishMessage(ObjectMapper mapper, ExecutionContextFinishMessage msg) { super(); this.msg = msg; putField("executionContextId", msg.getId()); putField("eventName", msg.getEventName()); if (msg.getRequest() != null) { putField("traceId", msg.getRequest().getTraceId()); } try { putField("response", mapper.writeValueAsString(msg.getResponse())); } catch (JsonProcessingException e) { putField("responseEncodeException", e); } } @Override public String getFormattedMessage() { return "Finish handling event " + msg.getEventName() + " with id " + msg.getId(); } @Override public String getFormat() { return ""; } @Override public Object[] getParameters() { return new Object[0]; } @Override public Throwable getThrowable() { return null; } }
1,454
0.648556
0.634801
48
28.291666
28.138021
107
false
false
0
0
0
0
0
0
0.479167
false
false
2
a476f3117a1c6540e59561850e906bf53d2fa2fe
6,244,882,498,103
546554ca4cc419d8d48f6e55c57edc8c5070acba
/src/main/java/ro/sd/a2/controller/AccountController.java
b2e83ad52c8e5913d6117ce6b4308cebbaa8fe62
[]
no_license
turdasanbogdan/VVS-BankApp
https://github.com/turdasanbogdan/VVS-BankApp
d8f1e65964773b48b1e67a1ef518dd962c640715
d03499b1332638e56ad0c6846bb2819a6c448406
refs/heads/master
2023-01-21T01:11:15.127000
2020-11-22T21:46:48
2020-11-22T21:46:48
312,571,965
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ro.sd.a2.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import ro.sd.a2.dto.MoneyAdditionDto; import ro.sd.a2.dto.TransactionTableDto; import ro.sd.a2.entity.Account; import ro.sd.a2.entity.Transaction; import ro.sd.a2.mapper.AccountDetailsMapper; import ro.sd.a2.mapper.TransactionTableMapper; import ro.sd.a2.service.AccountService; import ro.sd.a2.service.TransactionService; import ro.sd.a2.service.UserService; import java.util.List; import java.util.stream.Collectors; /** * Controller used for operations based on the accounts of the currently logged in user. */ @Controller @RequestMapping("/home/accounts") public class AccountController { @Autowired private TransactionService transactionService; @Autowired private AccountService accountService; @Autowired private UserService userService; private static final Logger log = LoggerFactory.getLogger(AccountController.class); /** * Method that processes the GET request on an account. If the account owner is not the authenticated user, we will redirect to * home displaying an error. Store all the content in DTOs and display the ModelAndView. * @param accountId the id of the requested account. * @param authentication the authentication of object of the user. * @param succ if we need to print a success message on this page. (probably after the user introduced his money * @return a mav with the information of this request. */ @GetMapping("/{accountId}") public ModelAndView accountDetails(@PathVariable(value = "accountId") Integer accountId, Authentication authentication, @RequestParam(value = "succ", required = false) String succ) { log.info("User "+authentication.getName()+" wants to see his account with id "+accountId+"."); List<TransactionTableDto> transactions = transactionService.findByAccountId(accountId) .stream().map(TransactionTableMapper::convertToDto).collect(Collectors.toList()); Account account = accountService.findById(accountId).orElse(null); if(account== null) { log.info("Account doesn't exist."); return new ModelAndView("redirect:/home").addObject("err", true).addObject("errMsg", "Account doesn't exist."); } if(!account.getUser().getEmail().equals(authentication.getName())) { log.info("User tried to access other account."); return new ModelAndView("redirect:/home").addObject("err", true).addObject("errMsg", "Account doesn't exist."); } ModelAndView mav = new ModelAndView(); mav.addObject("transactions", transactions); mav.addObject("account", AccountDetailsMapper.convertToDto(account)); mav.addObject("moneyAdditionDto", new MoneyAdditionDto()); if (succ != null) { mav.addObject("succ", succ); mav.addObject("succMsg", "Deposit done."); } mav.setViewName("accountDetails"); return mav; } /** * Method used in order for the user to add money to his account. If the account doesn't exist or the account doesn't belong to the * currently authenticated user, we return to home with an error message. We add the wanted sum to the account (processing comissions and * months for the saving account) and then redirect to the detailed view of the account with a success message. */ @PostMapping("/{accountId}/pay") public ModelAndView accountDetails(@PathVariable(value = "accountId") Integer accountId, @ModelAttribute(name = "moneyAdditionDto") MoneyAdditionDto moneyAdditionDto, Authentication authentication) { log.info("User "+authentication.getName()+" wants to see his account with id "+accountId+"."); ModelAndView mav = new ModelAndView(); log.info("Money addition request on account id "+accountId); log.info("Amount of money is " + moneyAdditionDto.getSum()); log.info("Number of months is " + moneyAdditionDto.getNumberOfMonths()); Account account = accountService.findById(accountId).orElse(null); if(account== null) { log.info("Account doesn't exist."); return new ModelAndView("redirect:/home").addObject("err", true) .addObject("errMsg", "Account doesn't exist."); } if(!account.getUser().getEmail().equals(authentication.getName())) { log.info("User tried to access other account."); return new ModelAndView("redirect:/home").addObject("err", true) .addObject("errMsg", "Account doesn't exist."); } account.deposit(moneyAdditionDto.getSum(), moneyAdditionDto.getNumberOfMonths()); log.info("The new sum is " + account.getSum()); accountService.update(account); mav.setViewName("redirect:/home/accounts/{accountId}"); mav.addObject("succ", true); return mav; } }
UTF-8
Java
5,471
java
AccountController.java
Java
[]
null
[]
package ro.sd.a2.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import ro.sd.a2.dto.MoneyAdditionDto; import ro.sd.a2.dto.TransactionTableDto; import ro.sd.a2.entity.Account; import ro.sd.a2.entity.Transaction; import ro.sd.a2.mapper.AccountDetailsMapper; import ro.sd.a2.mapper.TransactionTableMapper; import ro.sd.a2.service.AccountService; import ro.sd.a2.service.TransactionService; import ro.sd.a2.service.UserService; import java.util.List; import java.util.stream.Collectors; /** * Controller used for operations based on the accounts of the currently logged in user. */ @Controller @RequestMapping("/home/accounts") public class AccountController { @Autowired private TransactionService transactionService; @Autowired private AccountService accountService; @Autowired private UserService userService; private static final Logger log = LoggerFactory.getLogger(AccountController.class); /** * Method that processes the GET request on an account. If the account owner is not the authenticated user, we will redirect to * home displaying an error. Store all the content in DTOs and display the ModelAndView. * @param accountId the id of the requested account. * @param authentication the authentication of object of the user. * @param succ if we need to print a success message on this page. (probably after the user introduced his money * @return a mav with the information of this request. */ @GetMapping("/{accountId}") public ModelAndView accountDetails(@PathVariable(value = "accountId") Integer accountId, Authentication authentication, @RequestParam(value = "succ", required = false) String succ) { log.info("User "+authentication.getName()+" wants to see his account with id "+accountId+"."); List<TransactionTableDto> transactions = transactionService.findByAccountId(accountId) .stream().map(TransactionTableMapper::convertToDto).collect(Collectors.toList()); Account account = accountService.findById(accountId).orElse(null); if(account== null) { log.info("Account doesn't exist."); return new ModelAndView("redirect:/home").addObject("err", true).addObject("errMsg", "Account doesn't exist."); } if(!account.getUser().getEmail().equals(authentication.getName())) { log.info("User tried to access other account."); return new ModelAndView("redirect:/home").addObject("err", true).addObject("errMsg", "Account doesn't exist."); } ModelAndView mav = new ModelAndView(); mav.addObject("transactions", transactions); mav.addObject("account", AccountDetailsMapper.convertToDto(account)); mav.addObject("moneyAdditionDto", new MoneyAdditionDto()); if (succ != null) { mav.addObject("succ", succ); mav.addObject("succMsg", "Deposit done."); } mav.setViewName("accountDetails"); return mav; } /** * Method used in order for the user to add money to his account. If the account doesn't exist or the account doesn't belong to the * currently authenticated user, we return to home with an error message. We add the wanted sum to the account (processing comissions and * months for the saving account) and then redirect to the detailed view of the account with a success message. */ @PostMapping("/{accountId}/pay") public ModelAndView accountDetails(@PathVariable(value = "accountId") Integer accountId, @ModelAttribute(name = "moneyAdditionDto") MoneyAdditionDto moneyAdditionDto, Authentication authentication) { log.info("User "+authentication.getName()+" wants to see his account with id "+accountId+"."); ModelAndView mav = new ModelAndView(); log.info("Money addition request on account id "+accountId); log.info("Amount of money is " + moneyAdditionDto.getSum()); log.info("Number of months is " + moneyAdditionDto.getNumberOfMonths()); Account account = accountService.findById(accountId).orElse(null); if(account== null) { log.info("Account doesn't exist."); return new ModelAndView("redirect:/home").addObject("err", true) .addObject("errMsg", "Account doesn't exist."); } if(!account.getUser().getEmail().equals(authentication.getName())) { log.info("User tried to access other account."); return new ModelAndView("redirect:/home").addObject("err", true) .addObject("errMsg", "Account doesn't exist."); } account.deposit(moneyAdditionDto.getSum(), moneyAdditionDto.getNumberOfMonths()); log.info("The new sum is " + account.getSum()); accountService.update(account); mav.setViewName("redirect:/home/accounts/{accountId}"); mav.addObject("succ", true); return mav; } }
5,471
0.666606
0.664412
119
43.974789
38.097057
170
false
false
0
0
0
0
0
0
0.638655
false
false
2
e29a9ddc74a32f0b2efdf85927763cd06a9dd22e
14,645,838,488,236
43877aaafc74082bd215443056ecf55b178e580f
/java/com/pam/harvestcraft/blocks/BlockPamCrop.java
685d7ce36d36238ea708f7571d3ddf4e16f69fdb
[]
no_license
Ferdzz/harvestcraft
https://github.com/Ferdzz/harvestcraft
412f2b454c5ffa8649b113071232f0b7b5c1eb39
22d1c1738d1fd8ac3e43f7144c552a456832dc76
refs/heads/1.9.4-1.10.2a
2021-01-21T03:20:49.161000
2016-07-22T12:56:52
2016-07-22T12:56:52
66,096,208
0
1
null
true
2016-08-19T16:25:04
2016-08-19T16:25:03
2016-08-16T17:57:36
2016-08-16T09:45:31
4,362
0
0
0
null
null
null
package com.pam.harvestcraft.blocks; import com.pam.harvestcraft.HarvestCraft; import com.pam.harvestcraft.item.ItemRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.block.IGrowable; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.IPlantable; import net.minecraftforge.fml.common.FMLLog; import java.util.List; import java.util.Random; public class BlockPamCrop extends BlockCrops implements IGrowable, IPlantable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 3); private static final AxisAlignedBB[] CROPS_AABB = new AxisAlignedBB[]{new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.25D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.375D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; public final String registerName; public BlockPamCrop(String registerName) { super(); this.registerName = registerName; this.setDefaultState(blockState.getBaseState().withProperty(getAge(), 0)); this.setCreativeTab(HarvestCraft.modTab); } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { // CROPS_AABB is based on an age range from 0 to 7. Times two should fix that issue. return CROPS_AABB[state.getValue(getAge()) * 2]; } public boolean isSuitableSoilBlock(Block soilBlock) { return soilBlock == Blocks.farmland; } protected PropertyInteger getAge() { return AGE; } public int getHarvestReadyAge() { return 3; } public boolean isHarvestReady(IBlockState state) { return state.getValue(getAge()) >= getHarvestReadyAge(); } protected Item getSeeds() { final Item seeds = ItemRegistry.seedsMap.get(this); if (seeds == null) { FMLLog.bigWarning("No seeds have been set up."); return new Item(); } return seeds; } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(getSeeds()); } @Override public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { return !isHarvestReady(state); } protected Item getHarvestedItem() { final Item harvestedItem = ItemRegistry.harvestedItemMap.get(this); if (harvestedItem == null) { FMLLog.bigWarning("No harvested item has been set up."); return new Item(); } return harvestedItem; } @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(getAge(), meta); } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { this.checkAndDropBlock(worldIn, pos, state); if (worldIn.getLightFromNeighbors(pos.up()) >= 9) { int i = this.getMetaFromState(state); if (i < this.getHarvestReadyAge()) { float f = getGrowthChance(this, worldIn, pos); if (rand.nextInt((int) (25.0F / f) + 1) == 0) { worldIn.setBlockState(pos, this.getStateFromMeta(i + 1), 2); } } } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { if (!isHarvestReady(state)) { return getSeeds(); } else { return getHarvestedItem(); } } public int getMetaFromState(IBlockState state) { return state.getValue(getAge()); } @Override public boolean canPlaceBlockAt(World world, BlockPos pos) { Block soilBlock = world.getBlockState(pos.down()).getBlock(); return this.isSuitableSoilBlock(soilBlock); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (isHarvestReady(state)) { if (worldIn.isRemote) { return true; } final ItemStack savedStack = new ItemStack(getHarvestedItem()); worldIn.setBlockState(pos, state.withProperty(AGE, 0), 3); final EntityItem entityItem = new EntityItem(worldIn, playerIn.posX, playerIn.posY - 1D, playerIn.posZ, savedStack); worldIn.spawnEntityInWorld(entityItem); entityItem.onCollideWithPlayer(playerIn); return true; } return false; } @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { list.add(new ItemStack(itemIn, 1, 0)); list.add(new ItemStack(itemIn, 1, 3)); } @Override public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) { return EnumPlantType.Crop; } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, AGE); } protected int getRandomInt(World world) { return MathHelper.getRandomIntegerInRange(world.rand, 1, 3); } @Override public void grow(World worldIn, BlockPos pos, IBlockState state) { int newGrowth = getMetaFromState(state) + getRandomInt(worldIn); int maxGrowth = getHarvestReadyAge(); if (newGrowth > maxGrowth) { newGrowth = maxGrowth; } worldIn.setBlockState(pos, getStateFromMeta(newGrowth), 2); } @Override public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { grow(worldIn, pos, state); } @Override public int hashCode() { return registerName.hashCode(); } @Override public boolean equals(Object obj) { return (obj instanceof BlockPamCrop && registerName.equals(((BlockPamCrop) obj).registerName)); } @Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { List<ItemStack> ret = new java.util.ArrayList<ItemStack>(); Random rand = world instanceof World ? ((World) world).rand : new Random(); int age = getMetaFromState(state); int count = quantityDropped(state, fortune, rand); for (int i = 0; i < count; i++) { Item item = this.getItemDropped(state, rand, fortune); if (item != null) { ret.add(new ItemStack(item, 1, this.damageDropped(state))); } } if (age >= getHarvestReadyAge()) { for (int i = 0; i < 3 + fortune; ++i) { if (rand.nextInt(2 * getHarvestReadyAge()) <= age) { ret.add(new ItemStack(this.getSeed(), 1, 0)); } } } return ret; } }
UTF-8
Java
7,893
java
BlockPamCrop.java
Java
[]
null
[]
package com.pam.harvestcraft.blocks; import com.pam.harvestcraft.HarvestCraft; import com.pam.harvestcraft.item.ItemRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockCrops; import net.minecraft.block.IGrowable; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.IPlantable; import net.minecraftforge.fml.common.FMLLog; import java.util.List; import java.util.Random; public class BlockPamCrop extends BlockCrops implements IGrowable, IPlantable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 3); private static final AxisAlignedBB[] CROPS_AABB = new AxisAlignedBB[]{new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.25D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.375D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; public final String registerName; public BlockPamCrop(String registerName) { super(); this.registerName = registerName; this.setDefaultState(blockState.getBaseState().withProperty(getAge(), 0)); this.setCreativeTab(HarvestCraft.modTab); } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { // CROPS_AABB is based on an age range from 0 to 7. Times two should fix that issue. return CROPS_AABB[state.getValue(getAge()) * 2]; } public boolean isSuitableSoilBlock(Block soilBlock) { return soilBlock == Blocks.farmland; } protected PropertyInteger getAge() { return AGE; } public int getHarvestReadyAge() { return 3; } public boolean isHarvestReady(IBlockState state) { return state.getValue(getAge()) >= getHarvestReadyAge(); } protected Item getSeeds() { final Item seeds = ItemRegistry.seedsMap.get(this); if (seeds == null) { FMLLog.bigWarning("No seeds have been set up."); return new Item(); } return seeds; } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { return new ItemStack(getSeeds()); } @Override public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { return !isHarvestReady(state); } protected Item getHarvestedItem() { final Item harvestedItem = ItemRegistry.harvestedItemMap.get(this); if (harvestedItem == null) { FMLLog.bigWarning("No harvested item has been set up."); return new Item(); } return harvestedItem; } @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(getAge(), meta); } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { this.checkAndDropBlock(worldIn, pos, state); if (worldIn.getLightFromNeighbors(pos.up()) >= 9) { int i = this.getMetaFromState(state); if (i < this.getHarvestReadyAge()) { float f = getGrowthChance(this, worldIn, pos); if (rand.nextInt((int) (25.0F / f) + 1) == 0) { worldIn.setBlockState(pos, this.getStateFromMeta(i + 1), 2); } } } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { if (!isHarvestReady(state)) { return getSeeds(); } else { return getHarvestedItem(); } } public int getMetaFromState(IBlockState state) { return state.getValue(getAge()); } @Override public boolean canPlaceBlockAt(World world, BlockPos pos) { Block soilBlock = world.getBlockState(pos.down()).getBlock(); return this.isSuitableSoilBlock(soilBlock); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (isHarvestReady(state)) { if (worldIn.isRemote) { return true; } final ItemStack savedStack = new ItemStack(getHarvestedItem()); worldIn.setBlockState(pos, state.withProperty(AGE, 0), 3); final EntityItem entityItem = new EntityItem(worldIn, playerIn.posX, playerIn.posY - 1D, playerIn.posZ, savedStack); worldIn.spawnEntityInWorld(entityItem); entityItem.onCollideWithPlayer(playerIn); return true; } return false; } @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { list.add(new ItemStack(itemIn, 1, 0)); list.add(new ItemStack(itemIn, 1, 3)); } @Override public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) { return EnumPlantType.Crop; } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, AGE); } protected int getRandomInt(World world) { return MathHelper.getRandomIntegerInRange(world.rand, 1, 3); } @Override public void grow(World worldIn, BlockPos pos, IBlockState state) { int newGrowth = getMetaFromState(state) + getRandomInt(worldIn); int maxGrowth = getHarvestReadyAge(); if (newGrowth > maxGrowth) { newGrowth = maxGrowth; } worldIn.setBlockState(pos, getStateFromMeta(newGrowth), 2); } @Override public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { grow(worldIn, pos, state); } @Override public int hashCode() { return registerName.hashCode(); } @Override public boolean equals(Object obj) { return (obj instanceof BlockPamCrop && registerName.equals(((BlockPamCrop) obj).registerName)); } @Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { List<ItemStack> ret = new java.util.ArrayList<ItemStack>(); Random rand = world instanceof World ? ((World) world).rand : new Random(); int age = getMetaFromState(state); int count = quantityDropped(state, fortune, rand); for (int i = 0; i < count; i++) { Item item = this.getItemDropped(state, rand, fortune); if (item != null) { ret.add(new ItemStack(item, 1, this.damageDropped(state))); } } if (age >= getHarvestReadyAge()) { for (int i = 0; i < 3 + fortune; ++i) { if (rand.nextInt(2 * getHarvestReadyAge()) <= age) { ret.add(new ItemStack(this.getSeed(), 1, 0)); } } } return ret; } }
7,893
0.650196
0.632713
238
32.163864
43.480053
524
false
false
0
0
0
0
0
0
0.878151
false
false
2
b521d32352aa67bf916780945493522299c0a3ea
32,564,442,060,782
d16003238cacb1d753c161b7529593942165c808
/app/src/main/java/co/antoniolima/onlinechess/King.java
7d6525d0f5ef948dbd6cfaa9e51b2a10f8ed0c2d
[]
no_license
antoniolimadev/online-chess
https://github.com/antoniolimadev/online-chess
0cd7d750efb9caacdd0c2a0150fc5e17682c1219
2665ec78a7fa6136b8f7fe0dd66e15fe7c4ed4ad
refs/heads/master
2020-03-29T20:44:52.583000
2018-01-10T22:09:01
2018-01-10T22:09:01
150,328,597
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package co.antoniolima.onlinechess; import static co.antoniolima.onlinechess.Constants.BOARD_WIDTH; import static co.antoniolima.onlinechess.Constants.DRAWABLE_BLACK_PIECE_KING; import static co.antoniolima.onlinechess.Constants.DRAWABLE_WHITE_PIECE_KING; public class King extends Piece { private boolean hasMadeFirstMove; private boolean check; private boolean checkMate; public King(boolean color, int position) { super(color, position); this.setIdWhiteImage(DRAWABLE_WHITE_PIECE_KING); this.setIdBlackImage(DRAWABLE_BLACK_PIECE_KING); this.hasMadeFirstMove = false; this.check = false; this.checkMate = false; //this.initTargetPositions(); } @Override public void initTargetPositions(GameController gameController){ this.resetTargetPositions(); int pieceX = this.getPosition()%BOARD_WIDTH; int pieceY = this.getPosition()/BOARD_WIDTH; this.addTargetPosition(new Position(pieceX, pieceY-1)); // norte this.addTargetPosition(new Position(pieceX+1, pieceY-1)); // nordeste this.addTargetPosition(new Position(pieceX+1, pieceY)); // este this.addTargetPosition(new Position(pieceX+1, pieceY+1)); // sudeste this.addTargetPosition(new Position(pieceX, pieceY+1)); // sul this.addTargetPosition(new Position(pieceX-1, pieceY+1)); // sudoeste this.addTargetPosition(new Position(pieceX-1, pieceY)); // oeste this.addTargetPosition(new Position(pieceX-1, pieceY-1)); // nordoeste } @Override public void calculateTargetPositions(GameController gameController){ this.resetAvailablePositions(); this.initTargetPositions(gameController); // cycle through targets array and check which positions are within the board for (Position p : this.getTargetPositionsArray()) { if (gameController.isThisPositionValid(p)){ // se ta livre, é valida if (!gameController.isThisPositionTaken(gameController.getUniCoordinate(p))){ p.setValid(true); // se ta ocupada, vê a cor da peça } else { // se é diferente, é valida if (gameController.getPieceByPosition(gameController.getUniCoordinate(p)).getColor() != this.getColor()){ p.setValid(true); } } } } } @Override public void findAvailablePositions(GameController gameController){ this.resetAvailablePositions(); // TODO: check if there are pieces in the way } @Override public void select(GameController gameController) { this.initTargetPositions(gameController); this.calculateTargetPositions(gameController); gameController.resetHighlights(); // highlight itself gameController.highlightPosition(this.getPosition()); // highlight valid positions for (Position p : this.getTargetPositionsArray()) { if (p.isValid()){ gameController.highlightPosition(gameController.getUniCoordinate(p)); } } } @Override public void move(GameController gameController, int p) { // verifica se p é uma posicao das validas for (Position pos : this.getTargetPositionsArray()) { if (gameController.getUniCoordinate(pos) == p){ gameController.resetHighlights(); this.setPosition(p); hasMadeFirstMove = true; // se a peça é movida, deixa de estar selecionada gameController.setSelectedPiece(null); // passa o turno gameController.isKingInCheck(); gameController.nextTurn(); } } } public boolean hasMadeFirstMove() { return hasMadeFirstMove; } public void setHasMadeFirstMove(boolean hasMadeFirstMove) { this.hasMadeFirstMove = hasMadeFirstMove; } public boolean isCheck() { return check; } public void setCheck(boolean check) { this.check = check; } public boolean isCheckMate() { return checkMate; } public void setCheckMate(boolean checkMate) { this.checkMate = checkMate; } }
UTF-8
Java
4,370
java
King.java
Java
[]
null
[]
package co.antoniolima.onlinechess; import static co.antoniolima.onlinechess.Constants.BOARD_WIDTH; import static co.antoniolima.onlinechess.Constants.DRAWABLE_BLACK_PIECE_KING; import static co.antoniolima.onlinechess.Constants.DRAWABLE_WHITE_PIECE_KING; public class King extends Piece { private boolean hasMadeFirstMove; private boolean check; private boolean checkMate; public King(boolean color, int position) { super(color, position); this.setIdWhiteImage(DRAWABLE_WHITE_PIECE_KING); this.setIdBlackImage(DRAWABLE_BLACK_PIECE_KING); this.hasMadeFirstMove = false; this.check = false; this.checkMate = false; //this.initTargetPositions(); } @Override public void initTargetPositions(GameController gameController){ this.resetTargetPositions(); int pieceX = this.getPosition()%BOARD_WIDTH; int pieceY = this.getPosition()/BOARD_WIDTH; this.addTargetPosition(new Position(pieceX, pieceY-1)); // norte this.addTargetPosition(new Position(pieceX+1, pieceY-1)); // nordeste this.addTargetPosition(new Position(pieceX+1, pieceY)); // este this.addTargetPosition(new Position(pieceX+1, pieceY+1)); // sudeste this.addTargetPosition(new Position(pieceX, pieceY+1)); // sul this.addTargetPosition(new Position(pieceX-1, pieceY+1)); // sudoeste this.addTargetPosition(new Position(pieceX-1, pieceY)); // oeste this.addTargetPosition(new Position(pieceX-1, pieceY-1)); // nordoeste } @Override public void calculateTargetPositions(GameController gameController){ this.resetAvailablePositions(); this.initTargetPositions(gameController); // cycle through targets array and check which positions are within the board for (Position p : this.getTargetPositionsArray()) { if (gameController.isThisPositionValid(p)){ // se ta livre, é valida if (!gameController.isThisPositionTaken(gameController.getUniCoordinate(p))){ p.setValid(true); // se ta ocupada, vê a cor da peça } else { // se é diferente, é valida if (gameController.getPieceByPosition(gameController.getUniCoordinate(p)).getColor() != this.getColor()){ p.setValid(true); } } } } } @Override public void findAvailablePositions(GameController gameController){ this.resetAvailablePositions(); // TODO: check if there are pieces in the way } @Override public void select(GameController gameController) { this.initTargetPositions(gameController); this.calculateTargetPositions(gameController); gameController.resetHighlights(); // highlight itself gameController.highlightPosition(this.getPosition()); // highlight valid positions for (Position p : this.getTargetPositionsArray()) { if (p.isValid()){ gameController.highlightPosition(gameController.getUniCoordinate(p)); } } } @Override public void move(GameController gameController, int p) { // verifica se p é uma posicao das validas for (Position pos : this.getTargetPositionsArray()) { if (gameController.getUniCoordinate(pos) == p){ gameController.resetHighlights(); this.setPosition(p); hasMadeFirstMove = true; // se a peça é movida, deixa de estar selecionada gameController.setSelectedPiece(null); // passa o turno gameController.isKingInCheck(); gameController.nextTurn(); } } } public boolean hasMadeFirstMove() { return hasMadeFirstMove; } public void setHasMadeFirstMove(boolean hasMadeFirstMove) { this.hasMadeFirstMove = hasMadeFirstMove; } public boolean isCheck() { return check; } public void setCheck(boolean check) { this.check = check; } public boolean isCheckMate() { return checkMate; } public void setCheckMate(boolean checkMate) { this.checkMate = checkMate; } }
4,370
0.634571
0.63182
115
36.939129
28.783234
125
false
false
0
0
0
0
0
0
0.53913
false
false
2
976e0b90d66dd692ae6fe271978ff53ff077ec30
17,145,509,462,812
88b9ab6277965e90e7bd437ab48021013815beac
/com.sap.jnc.marketing.service/src/main/java/com/sap/jnc/marketing/service/wechat/impl/WechatPaymentServiceImpl.java
43965e2e9e748d5a49f94c3a7a5006a5161db53b
[]
no_license
com-sap-jnc/jnc-marketing-poc
https://github.com/com-sap-jnc/jnc-marketing-poc
48ee22ca23d49f1ad28f7c46498743b6d9bbd711
c26079e1eb07ee77fda6832628899eecc7a7c346
refs/heads/master
2016-09-10T05:39:51.398000
2016-06-13T06:57:23
2016-06-13T06:57:23
59,740,729
0
5
null
false
2016-06-13T07:23:38
2016-05-26T10:12:59
2016-05-27T05:06:05
2016-06-13T07:23:16
3,469
0
4
1
Java
null
null
package com.sap.jnc.marketing.service.wechat.impl; import com.sap.jnc.marketing.dto.shared.wechat.JSSDKConfig; import com.sap.jnc.marketing.dto.shared.wechat.JSSDKPayParams; import com.sap.jnc.marketing.dto.shared.wechat.PaymentNotifyResult; import com.sap.jnc.marketing.dto.shared.wechat.PaymentQueryResult; import com.sap.jnc.marketing.service.wechat.WechatPaymentService; import org.springframework.stereotype.Service; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * @author Alex */ @Service public class WechatPaymentServiceImpl implements WechatPaymentService{ @Override public String getWechatPrePayId(String paymentDesc, String orderNo, String orderPrice, String userIp, String openId, String wechatPaymentNotifyUrl, HttpSession session) { return null; } @Override public JSSDKPayParams configJSSDKPaymentParams(String prePayId, String orderNo) { return null; } @Override public PaymentNotifyResult processPayment(HttpServletRequest request, HttpServletResponse response) throws IOException { return null; } @Override public JSSDKConfig configJSSDK(String url, String accessToken) { return null; } @Override public PaymentQueryResult wechatPaymentQuery(String tradeNo) { return null; } }
UTF-8
Java
1,424
java
WechatPaymentServiceImpl.java
Java
[ { "context": "rt javax.servlet.http.HttpSession;\n\n/**\n * @author Alex\n */\n@Service\npublic class WechatPaymentServiceImp", "end": 606, "score": 0.9984117746353149, "start": 602, "tag": "NAME", "value": "Alex" } ]
null
[]
package com.sap.jnc.marketing.service.wechat.impl; import com.sap.jnc.marketing.dto.shared.wechat.JSSDKConfig; import com.sap.jnc.marketing.dto.shared.wechat.JSSDKPayParams; import com.sap.jnc.marketing.dto.shared.wechat.PaymentNotifyResult; import com.sap.jnc.marketing.dto.shared.wechat.PaymentQueryResult; import com.sap.jnc.marketing.service.wechat.WechatPaymentService; import org.springframework.stereotype.Service; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * @author Alex */ @Service public class WechatPaymentServiceImpl implements WechatPaymentService{ @Override public String getWechatPrePayId(String paymentDesc, String orderNo, String orderPrice, String userIp, String openId, String wechatPaymentNotifyUrl, HttpSession session) { return null; } @Override public JSSDKPayParams configJSSDKPaymentParams(String prePayId, String orderNo) { return null; } @Override public PaymentNotifyResult processPayment(HttpServletRequest request, HttpServletResponse response) throws IOException { return null; } @Override public JSSDKConfig configJSSDK(String url, String accessToken) { return null; } @Override public PaymentQueryResult wechatPaymentQuery(String tradeNo) { return null; } }
1,424
0.772472
0.772472
46
29.956522
36.139797
174
false
false
0
0
0
0
0
0
0.543478
false
false
2
831bd10b8446463fa8a5d03bd2329e5f58704153
1,460,288,893,707
9ed5716f353993fac2f3fce4b392b866a2a23996
/Chapter10/src/practice/MyDateTest.java
c2879fd518b2f77ad193314b91c1116636c8b683
[]
no_license
ByeongSoon/FastJava
https://github.com/ByeongSoon/FastJava
624e9bfe89909750d7a315d877aeec91c64da60f
d38b7a2d24291ff1873d34acd2989a6ee8f3f129
refs/heads/master
2023-03-13T16:42:42.721000
2021-03-10T09:53:15
2021-03-10T09:53:15
328,402,373
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package practice; class MyDate { int day; int month; int year; public MyDate(final int day, final int month, final int year) { this.day = day; this.month = month; this.year = year; } @Override public boolean equals(Object obj) { if (obj instanceof MyDate) { MyDate myDate = (MyDate) obj; return this.day == myDate.day && this.month == myDate.month && this.year == myDate.year; } return false; } @Override public int hashCode() { return day; } } public class MyDateTest { public static void main(String[] args) { MyDate date1 = new MyDate(24, 2, 2021); MyDate date2 = new MyDate(24, 2, 2021); System.out.println(date1.equals(date2)); } }
UTF-8
Java
728
java
MyDateTest.java
Java
[]
null
[]
package practice; class MyDate { int day; int month; int year; public MyDate(final int day, final int month, final int year) { this.day = day; this.month = month; this.year = year; } @Override public boolean equals(Object obj) { if (obj instanceof MyDate) { MyDate myDate = (MyDate) obj; return this.day == myDate.day && this.month == myDate.month && this.year == myDate.year; } return false; } @Override public int hashCode() { return day; } } public class MyDateTest { public static void main(String[] args) { MyDate date1 = new MyDate(24, 2, 2021); MyDate date2 = new MyDate(24, 2, 2021); System.out.println(date1.equals(date2)); } }
728
0.619505
0.59478
43
15.930233
20.124491
94
false
false
0
0
0
0
0
0
0.465116
false
false
2
ad9e7d4f480887cc7ae785ac1388e7fde6d6d792
32,830,730,078,168
631b25edf2acfea70e540116e1c36864557b594c
/src/main/java/cn/emitor/chesspro/hero/Wolf.java
7c22165b42824270ef2e71daa63a107c97860296
[ "MIT" ]
permissive
PayForFish/ChessPro
https://github.com/PayForFish/ChessPro
89f88fd07e1dd44a2c842cfe6c18ffbf7387e71b
5497d39b34b0e4c0c78e26f9d53f0d7531c45d0e
refs/heads/master
2020-07-14T15:47:09.041000
2019-09-01T13:05:40
2019-09-01T13:05:40
205,345,829
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.emitor.chesspro.hero; import cn.emitor.chesspro.Hero; import cn.emitor.chesspro.buff.DouShi; import cn.emitor.chesspro.buff.KuangYe; import cn.emitor.chesspro.enums.HeroEnum; public class Wolf extends Hero { private KuangYe kuangYe; private DouShi douShi; public Wolf() { super(); } @Override public void setHeroBuff() { this.douShi = new DouShi(); this.kuangYe = new KuangYe(); this.buffs.add(douShi); this.buffs.add(kuangYe); } @Override public void setterHeroEnum() { this.heroEnum = HeroEnum.LANG_REN; } }
UTF-8
Java
615
java
Wolf.java
Java
[]
null
[]
package cn.emitor.chesspro.hero; import cn.emitor.chesspro.Hero; import cn.emitor.chesspro.buff.DouShi; import cn.emitor.chesspro.buff.KuangYe; import cn.emitor.chesspro.enums.HeroEnum; public class Wolf extends Hero { private KuangYe kuangYe; private DouShi douShi; public Wolf() { super(); } @Override public void setHeroBuff() { this.douShi = new DouShi(); this.kuangYe = new KuangYe(); this.buffs.add(douShi); this.buffs.add(kuangYe); } @Override public void setterHeroEnum() { this.heroEnum = HeroEnum.LANG_REN; } }
615
0.64878
0.64878
29
20.206896
15.273099
42
false
false
0
0
0
0
0
0
0.448276
false
false
2
0227a3d6dfd34d2201e007f161bafefd6b43b655
1,924,145,411,099
eb0a78d4d95f0e33969335db82c11966d90a34c9
/bootstrap/src/main/java/com/nuodb/migrator/config/PropertiesConfigLoader.java
a28becc546b31769f73be40424f7d2f3f50fdf8e
[ "BSD-3-Clause" ]
permissive
nuodb/migration-tools
https://github.com/nuodb/migration-tools
5b585551cf86b6a7f15f5b3f960b62513060d9fd
e7224feb600cbb26785ddccdaf3fec50447d1b2d
refs/heads/master
2023-09-02T12:00:54.572000
2023-08-23T10:12:59
2023-08-23T13:34:14
5,372,003
7
10
BSD-3-Clause
false
2023-09-13T13:14:46
2012-08-10T17:04:06
2023-07-11T17:47:21
2023-09-13T13:14:44
43,770
27
10
15
Java
false
false
/** * Copyright (c) 2015, NuoDB, Inc. * 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 NuoDB, Inc. 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 NUODB, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.nuodb.migrator.config; import org.slf4j.Logger; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Properties; import static com.nuodb.migrator.config.Config.*; import static java.lang.String.format; import static java.lang.System.getProperties; import static java.lang.System.getProperty; import static java.lang.System.setProperty; import static org.slf4j.LoggerFactory.getLogger; @SuppressWarnings("unchecked") public class PropertiesConfigLoader { private static final Logger logger = getLogger(PropertiesConfigLoader.class); static { setHome(); } private static void setHome() { if (getProperty(HOME) != null) { return; } try { setProperty(HOME, new File(getProperty("user.dir"), "..").getCanonicalPath()); } catch (IOException e) { setProperty(HOME, getProperty("user.dir")); } } private static String getHome() { return getProperty(HOME); } public Config loadConfig() { InputStream input = getConfigFromProperty(); if (input == null) { input = getConfigFromHome(); } if (input == null) { input = getDefaultConfig(); } Throwable error = null; Properties properties = new Properties(); if (input != null) { if (logger.isDebugEnabled()) { logger.debug("Loading config"); } try { properties.load(input); input.close(); } catch (Throwable throwable) { error = throwable; } } if (input == null || error != null) { if (logger.isWarnEnabled()) { logger.warn("Failed to load bootstrap config", error); } } Replacer replacer = new Replacer(); replacer.addReplacements(getProperties()); replacer.addReplacements(properties); return new PropertiesConfig(properties, replacer); } private static InputStream getConfigFromProperty() { InputStream stream; try { String config = getProperty(CONFIG); if (config != null) { if (logger.isDebugEnabled()) { logger.debug(format("Opening custom config at %s", config)); } stream = (new URL(config)).openStream(); } else { if (logger.isDebugEnabled()) { logger.debug(format("Custom config path under %s property is not set", CONFIG)); } stream = null; } } catch (Throwable throwable) { stream = null; } return stream; } private static InputStream getConfigFromHome() { File path = new File(new File(getHome(), CONFIG_DIR), DEFAULT_CONFIG); InputStream stream; try { stream = new FileInputStream(path); } catch (Throwable t) { stream = null; } if (stream != null) { if (logger.isDebugEnabled()) { logger.debug(format("Config found at %s", path)); } } else { if (logger.isInfoEnabled()) { logger.info(format("Config can't be found at %s", path)); } } return stream; } private static InputStream getDefaultConfig() { InputStream stream; try { stream = PropertiesConfigLoader.class.getResourceAsStream(DEFAULT_CONFIG); } catch (Throwable throwable) { stream = null; } if (stream != null) { if (logger.isDebugEnabled()) { logger.debug(format("Default config found at %s", DEFAULT_CONFIG)); } } else { if (logger.isDebugEnabled()) { logger.debug(format("Default config can't be found at %s", DEFAULT_CONFIG)); } } return stream; } }
UTF-8
Java
5,684
java
PropertiesConfigLoader.java
Java
[ { "context": "/**\n * Copyright (c) 2015, NuoDB, Inc.\n * All rights reserved.\n *\n * Redistribut", "end": 30, "score": 0.7643850445747375, "start": 27, "tag": "NAME", "value": "Nuo" } ]
null
[]
/** * Copyright (c) 2015, NuoDB, Inc. * 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 NuoDB, Inc. 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 NUODB, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.nuodb.migrator.config; import org.slf4j.Logger; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Properties; import static com.nuodb.migrator.config.Config.*; import static java.lang.String.format; import static java.lang.System.getProperties; import static java.lang.System.getProperty; import static java.lang.System.setProperty; import static org.slf4j.LoggerFactory.getLogger; @SuppressWarnings("unchecked") public class PropertiesConfigLoader { private static final Logger logger = getLogger(PropertiesConfigLoader.class); static { setHome(); } private static void setHome() { if (getProperty(HOME) != null) { return; } try { setProperty(HOME, new File(getProperty("user.dir"), "..").getCanonicalPath()); } catch (IOException e) { setProperty(HOME, getProperty("user.dir")); } } private static String getHome() { return getProperty(HOME); } public Config loadConfig() { InputStream input = getConfigFromProperty(); if (input == null) { input = getConfigFromHome(); } if (input == null) { input = getDefaultConfig(); } Throwable error = null; Properties properties = new Properties(); if (input != null) { if (logger.isDebugEnabled()) { logger.debug("Loading config"); } try { properties.load(input); input.close(); } catch (Throwable throwable) { error = throwable; } } if (input == null || error != null) { if (logger.isWarnEnabled()) { logger.warn("Failed to load bootstrap config", error); } } Replacer replacer = new Replacer(); replacer.addReplacements(getProperties()); replacer.addReplacements(properties); return new PropertiesConfig(properties, replacer); } private static InputStream getConfigFromProperty() { InputStream stream; try { String config = getProperty(CONFIG); if (config != null) { if (logger.isDebugEnabled()) { logger.debug(format("Opening custom config at %s", config)); } stream = (new URL(config)).openStream(); } else { if (logger.isDebugEnabled()) { logger.debug(format("Custom config path under %s property is not set", CONFIG)); } stream = null; } } catch (Throwable throwable) { stream = null; } return stream; } private static InputStream getConfigFromHome() { File path = new File(new File(getHome(), CONFIG_DIR), DEFAULT_CONFIG); InputStream stream; try { stream = new FileInputStream(path); } catch (Throwable t) { stream = null; } if (stream != null) { if (logger.isDebugEnabled()) { logger.debug(format("Config found at %s", path)); } } else { if (logger.isInfoEnabled()) { logger.info(format("Config can't be found at %s", path)); } } return stream; } private static InputStream getDefaultConfig() { InputStream stream; try { stream = PropertiesConfigLoader.class.getResourceAsStream(DEFAULT_CONFIG); } catch (Throwable throwable) { stream = null; } if (stream != null) { if (logger.isDebugEnabled()) { logger.debug(format("Default config found at %s", DEFAULT_CONFIG)); } } else { if (logger.isDebugEnabled()) { logger.debug(format("Default config can't be found at %s", DEFAULT_CONFIG)); } } return stream; } }
5,684
0.604504
0.603448
161
34.310558
25.798607
100
false
false
0
0
0
0
0
0
0.596273
false
false
2
7d5bd248a0ae4342d9cb50e16412cf27db566ebb
14,585,708,955,635
6393c342dfcb1e5090dd9b264313d833b57faecf
/T027_1_Calculadora.java
165b0962d879e9fb41937dab0a68bc82add6acbd
[]
no_license
EmmCast/Tareas_Java1.1
https://github.com/EmmCast/Tareas_Java1.1
cd68adf354588a71425c33e22485f998da885b12
88186ad8f02fff95c38e3cab605dcec48c299d3c
refs/heads/master
2022-12-27T22:06:27.371000
2020-10-08T02:16:03
2020-10-08T02:16:03
299,449,332
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*27.-Elabore un algoritmo que solicite 2 números enteros y un operador aritmético y luego debe de mostrar * el resultado de la operación correspondiente "+" suma, "-" resta, "*"multiplicación. " ° " Potencia. */ package Estudio; import java.util.Scanner; public class T027_1_Calculadora { public static void main(String[] args) { Scanner entrada=new Scanner(System.in); System.out.println("Ingresar dato 1 \n Nota:cuando es potencia este es el dato que se resolvera"); int num1=entrada.nextInt(); System.out.println("Ingresar dato 2 \n Nota:cuando es potencia este es el exponente"); int num2=entrada.nextInt(); System.out.println("Ingresa la operacion que deseas '+=1' '-=2' '*=3' '/=4' '°=5'"); int operador=entrada.nextInt(); int resultado=solucion(num1,num2,operador); System.out.println("el resultado es :"+ resultado); } /** * * @param num1 * @param num2 * @param operador * @return */ private static int solucion(int num1, int num2, int operador) { int res=0; if(operador==1) { res=num1+num2; }else if(operador==2){ res=num1+num2; }else if (operador==3) { res=num1*num2; }else if(operador==4){ res=num1/num2; }else if(operador==5) { res=(int) Math.pow(num1, num2); } return res; } }
ISO-8859-1
Java
1,313
java
T027_1_Calculadora.java
Java
[]
null
[]
/*27.-Elabore un algoritmo que solicite 2 números enteros y un operador aritmético y luego debe de mostrar * el resultado de la operación correspondiente "+" suma, "-" resta, "*"multiplicación. " ° " Potencia. */ package Estudio; import java.util.Scanner; public class T027_1_Calculadora { public static void main(String[] args) { Scanner entrada=new Scanner(System.in); System.out.println("Ingresar dato 1 \n Nota:cuando es potencia este es el dato que se resolvera"); int num1=entrada.nextInt(); System.out.println("Ingresar dato 2 \n Nota:cuando es potencia este es el exponente"); int num2=entrada.nextInt(); System.out.println("Ingresa la operacion que deseas '+=1' '-=2' '*=3' '/=4' '°=5'"); int operador=entrada.nextInt(); int resultado=solucion(num1,num2,operador); System.out.println("el resultado es :"+ resultado); } /** * * @param num1 * @param num2 * @param operador * @return */ private static int solucion(int num1, int num2, int operador) { int res=0; if(operador==1) { res=num1+num2; }else if(operador==2){ res=num1+num2; }else if (operador==3) { res=num1*num2; }else if(operador==4){ res=num1/num2; }else if(operador==5) { res=(int) Math.pow(num1, num2); } return res; } }
1,313
0.650344
0.62127
41
29.878048
29.006472
107
false
false
0
0
0
0
0
0
2.121951
false
false
2
abc4cca5b7ee09f0fe3954f3e5386bc628acfbab
2,087,354,139,022
1de68a5e0de157a7ff762567890053e864ac2cd6
/src/main/java/com/boco/modules/fdoc/web/screen/MainScreenController.java
ee2b5690c235a8a2a12169c040d96c2aada89611
[]
no_license
huiwangui/fdoctor-fws
https://github.com/huiwangui/fdoctor-fws
fb4d7fe96f78d27048f7e164e572888a4898316d
f0fbc87f5e9f1080c0c2114b90b8e5c3b8810816
refs/heads/master
2020-03-26T19:49:14.119000
2018-08-19T09:17:59
2018-08-19T09:17:59
145,288,765
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.boco.modules.fdoc.web.screen; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; 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.ResponseBody; import com.boco.common.json.BaseJsonVo; import com.boco.common.utils.JsonUtils; import com.boco.common.utils.RestfulUtils; import com.boco.common.utils.StringUtils; import com.boco.modules.fdoc.dao.DoctorDao; import com.boco.modules.fdoc.model.DoctorEntity; import com.boco.modules.fdoc.model.HospitalEntity; import com.boco.modules.fdoc.model.SysRegionEntity; import com.boco.modules.fdoc.model.statistics.StatisticsDayBasedataEntity; import com.boco.modules.fdoc.service.DocService; import com.boco.modules.fdoc.service.HospitalService; import com.boco.modules.fdoc.service.SignService; import com.boco.modules.fdoc.service.StatisticsDayBasedataService; import com.boco.modules.fdoc.service.SysRegionService; import com.boco.modules.fdoc.vo.DoctorDetailVo; import com.boco.modules.fdoc.vo.HospitalVo; import com.boco.modules.fdoc.vo.SignVo; import com.boco.modules.fdoc.vo.statistics.StatisticsDayBasedataVo; /** * * ClassName: MainScreenController <br/> * Reason: 大屏展示控制器. <br/> * date: 2017年4月18日 上午8:50:59 <br/> * * @author q * @version * @since JDK 1.7+ */ @Controller @RequestMapping(value="/mainScreen",produces="application/json;charset=UTF-8") public class MainScreenController { @Resource HospitalService hospitalService; @Resource DocService docService; @Resource SysRegionService regionService; @Resource SignService signService; @Resource StatisticsDayBasedataService statisticsService; @SuppressWarnings("unchecked") @RequestMapping(value = "/showScreen", method = RequestMethod.GET) public String showScreen(HttpServletRequest request, Model model) { //查询机构列表,并过滤没有地址的,转为json放入作用域 HospitalVo vo = new HospitalVo(); List<HospitalVo> hospitalList = hospitalService.getHospitalListWithTeamNum(vo); List<HospitalVo> returnHospitalList = new ArrayList<HospitalVo>(); for (HospitalVo hospitalVo : hospitalList) { if (hospitalVo.getTeamNum() == null) { hospitalVo.setTeamNum(0); } if (StringUtils.isNoneEmpty(hospitalVo.getAddress())) { //发送请求获取机构经纬度 String response = RestfulUtils.sendGetRequest("http://api.map.baidu.com/geocoder?address="+hospitalVo.getAddress().replaceAll(" ", "")+"&output=json&src=bocohuikang"); Map<String, Object> dataMap = JsonUtils.getObjectJsonMap(response); if (dataMap.get("result") != null && dataMap.get("result") instanceof Map) { Map<String, Double> locationMap = (Map<String, Double>) ((Map<String, Object>)dataMap.get("result")).get("location"); Double lng = locationMap.get("lng"); Double lat = locationMap.get("lat"); Double[] location = {lng,lat}; hospitalVo.setPoint(location); returnHospitalList.add(hospitalVo); } } } model.addAttribute("hospJson", JsonUtils.getJson(returnHospitalList)); //封装地区基础数据 StatisticsDayBasedataEntity basedata = statisticsService.getBasedata(); model.addAttribute("basedata", basedata); //封装地区慢病同比增长率、月增长数 StatisticsDayBasedataVo incrementData = statisticsService.getIncrementData(); model.addAttribute("incrementData", JsonUtils.getJson(incrementData)); //json属于用于echarts使用 model.addAttribute("incrementObject", incrementData); //对象数据用于jstl标签使用 return "/mainscreen/mainscreen"; } @RequestMapping(value = "/getTeamInfoInHospital", method = RequestMethod.GET) @ResponseBody public String getTeamInfoInHospital(HttpServletRequest request, Model model, String orgId) { List<HospitalVo> teamInfo = hospitalService.getTeamInHospital(orgId); Map<String, Object> returnMap = new HashMap<String, Object>(); for (HospitalVo hospitalVo : teamInfo) { List<DoctorDetailVo> docList = docService.getDoctorTeamMemberByTeamId(hospitalVo.getDocTeamId()); if (docList != null && docList.size() >= 3) { returnMap.put("docNum", docList.size()); returnMap.put("docList", docList); break; } } return JsonUtils.getJson(BaseJsonVo.success(returnMap)); } @RequestMapping(value = "/getTownInfoByHospital", method = RequestMethod.GET) @ResponseBody public String getTownInfoByHospital(HttpServletRequest request, Model model, String orgId) { try { Map<String, Object> returnMap = new HashMap<String, Object>(); //获取医院信息 HospitalEntity hospitalInfo = hospitalService.getHospitalInfo(orgId); //封装直属乡镇信息 SysRegionEntity region = regionService.getRegionByCode(hospitalInfo.getRegionCode()); Map<String, Object> regionMap = new HashMap<String, Object>(); regionMap.put("name", region.getName()); StatisticsDayBasedataVo townInfo = statisticsService.getTownIncrementData(hospitalInfo.getRegionCode()); townInfo = (townInfo != null) ? townInfo : new StatisticsDayBasedataVo(); regionMap.put("dataInfo", townInfo); returnMap.put("regionInfo", regionMap); //封装团队数量 List<DoctorEntity> leaderList = docService.getLeaderListByHospital(orgId); returnMap.put("leaderList", leaderList); //封装子区划信息 List<SysRegionEntity> childrenRegions = regionService.getChildrenRegions(hospitalInfo.getRegionCode()); List<Map<String, Object>> childrenList = new ArrayList<Map<String,Object>>(); for (SysRegionEntity child : childrenRegions) { //封装直属乡镇信息 Map<String, Object> childMap = new HashMap<String, Object>(); SignVo childVo = signService.getSignedCountByRegion(child.getRegionCode()); childMap.put("name", child.getName()); childMap.put("personCount", childVo.getPersonCount()); childMap.put("signCount", childVo.getSignedCount()); childMap.put("signPer", childVo.getSignPer()); childrenList.add(childMap); } returnMap.put("childrenInfo", childrenList); returnMap.put("hospitalInfo", hospitalInfo); return JsonUtils.getJson(BaseJsonVo.success(returnMap)); } catch (Exception e) { e.printStackTrace(); return JsonUtils.getJson(BaseJsonVo.error()); } } @RequestMapping(value = "/getTeamInfo", method = RequestMethod.GET) @ResponseBody public String getTeamInfo(HttpServletRequest request, Model model, String teamId, Integer personCount) { try { StatisticsDayBasedataVo teamIncrementData = statisticsService.getTeamIncrementData(teamId); DoctorDetailVo teamLeaderInfo = docService.getTeamLeaderInfo(teamId); teamIncrementData.setLeaderName(teamLeaderInfo.getDocName()); if (personCount != 0) { Double signPer = Double.valueOf(teamIncrementData.getSignCount()) / Double.valueOf(personCount); BigDecimal decimal = new BigDecimal(signPer * 100); teamIncrementData.setSignPer(decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); }else { teamIncrementData.setSignPer(0.0); } return JsonUtils.getJson(BaseJsonVo.success(teamIncrementData)); } catch (Exception e) { e.printStackTrace(); return JsonUtils.getJson(BaseJsonVo.error()); } } }
UTF-8
Java
7,484
java
MainScreenController.java
Java
[ { "context": "\n * date: 2017年4月18日 上午8:50:59 <br/>\n *\n * @author q\n * @version \n * @since JDK 1.7+\n */\n@Controller\n@", "end": 1565, "score": 0.8943938612937927, "start": 1564, "tag": "NAME", "value": "q" } ]
null
[]
package com.boco.modules.fdoc.web.screen; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; 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.ResponseBody; import com.boco.common.json.BaseJsonVo; import com.boco.common.utils.JsonUtils; import com.boco.common.utils.RestfulUtils; import com.boco.common.utils.StringUtils; import com.boco.modules.fdoc.dao.DoctorDao; import com.boco.modules.fdoc.model.DoctorEntity; import com.boco.modules.fdoc.model.HospitalEntity; import com.boco.modules.fdoc.model.SysRegionEntity; import com.boco.modules.fdoc.model.statistics.StatisticsDayBasedataEntity; import com.boco.modules.fdoc.service.DocService; import com.boco.modules.fdoc.service.HospitalService; import com.boco.modules.fdoc.service.SignService; import com.boco.modules.fdoc.service.StatisticsDayBasedataService; import com.boco.modules.fdoc.service.SysRegionService; import com.boco.modules.fdoc.vo.DoctorDetailVo; import com.boco.modules.fdoc.vo.HospitalVo; import com.boco.modules.fdoc.vo.SignVo; import com.boco.modules.fdoc.vo.statistics.StatisticsDayBasedataVo; /** * * ClassName: MainScreenController <br/> * Reason: 大屏展示控制器. <br/> * date: 2017年4月18日 上午8:50:59 <br/> * * @author q * @version * @since JDK 1.7+ */ @Controller @RequestMapping(value="/mainScreen",produces="application/json;charset=UTF-8") public class MainScreenController { @Resource HospitalService hospitalService; @Resource DocService docService; @Resource SysRegionService regionService; @Resource SignService signService; @Resource StatisticsDayBasedataService statisticsService; @SuppressWarnings("unchecked") @RequestMapping(value = "/showScreen", method = RequestMethod.GET) public String showScreen(HttpServletRequest request, Model model) { //查询机构列表,并过滤没有地址的,转为json放入作用域 HospitalVo vo = new HospitalVo(); List<HospitalVo> hospitalList = hospitalService.getHospitalListWithTeamNum(vo); List<HospitalVo> returnHospitalList = new ArrayList<HospitalVo>(); for (HospitalVo hospitalVo : hospitalList) { if (hospitalVo.getTeamNum() == null) { hospitalVo.setTeamNum(0); } if (StringUtils.isNoneEmpty(hospitalVo.getAddress())) { //发送请求获取机构经纬度 String response = RestfulUtils.sendGetRequest("http://api.map.baidu.com/geocoder?address="+hospitalVo.getAddress().replaceAll(" ", "")+"&output=json&src=bocohuikang"); Map<String, Object> dataMap = JsonUtils.getObjectJsonMap(response); if (dataMap.get("result") != null && dataMap.get("result") instanceof Map) { Map<String, Double> locationMap = (Map<String, Double>) ((Map<String, Object>)dataMap.get("result")).get("location"); Double lng = locationMap.get("lng"); Double lat = locationMap.get("lat"); Double[] location = {lng,lat}; hospitalVo.setPoint(location); returnHospitalList.add(hospitalVo); } } } model.addAttribute("hospJson", JsonUtils.getJson(returnHospitalList)); //封装地区基础数据 StatisticsDayBasedataEntity basedata = statisticsService.getBasedata(); model.addAttribute("basedata", basedata); //封装地区慢病同比增长率、月增长数 StatisticsDayBasedataVo incrementData = statisticsService.getIncrementData(); model.addAttribute("incrementData", JsonUtils.getJson(incrementData)); //json属于用于echarts使用 model.addAttribute("incrementObject", incrementData); //对象数据用于jstl标签使用 return "/mainscreen/mainscreen"; } @RequestMapping(value = "/getTeamInfoInHospital", method = RequestMethod.GET) @ResponseBody public String getTeamInfoInHospital(HttpServletRequest request, Model model, String orgId) { List<HospitalVo> teamInfo = hospitalService.getTeamInHospital(orgId); Map<String, Object> returnMap = new HashMap<String, Object>(); for (HospitalVo hospitalVo : teamInfo) { List<DoctorDetailVo> docList = docService.getDoctorTeamMemberByTeamId(hospitalVo.getDocTeamId()); if (docList != null && docList.size() >= 3) { returnMap.put("docNum", docList.size()); returnMap.put("docList", docList); break; } } return JsonUtils.getJson(BaseJsonVo.success(returnMap)); } @RequestMapping(value = "/getTownInfoByHospital", method = RequestMethod.GET) @ResponseBody public String getTownInfoByHospital(HttpServletRequest request, Model model, String orgId) { try { Map<String, Object> returnMap = new HashMap<String, Object>(); //获取医院信息 HospitalEntity hospitalInfo = hospitalService.getHospitalInfo(orgId); //封装直属乡镇信息 SysRegionEntity region = regionService.getRegionByCode(hospitalInfo.getRegionCode()); Map<String, Object> regionMap = new HashMap<String, Object>(); regionMap.put("name", region.getName()); StatisticsDayBasedataVo townInfo = statisticsService.getTownIncrementData(hospitalInfo.getRegionCode()); townInfo = (townInfo != null) ? townInfo : new StatisticsDayBasedataVo(); regionMap.put("dataInfo", townInfo); returnMap.put("regionInfo", regionMap); //封装团队数量 List<DoctorEntity> leaderList = docService.getLeaderListByHospital(orgId); returnMap.put("leaderList", leaderList); //封装子区划信息 List<SysRegionEntity> childrenRegions = regionService.getChildrenRegions(hospitalInfo.getRegionCode()); List<Map<String, Object>> childrenList = new ArrayList<Map<String,Object>>(); for (SysRegionEntity child : childrenRegions) { //封装直属乡镇信息 Map<String, Object> childMap = new HashMap<String, Object>(); SignVo childVo = signService.getSignedCountByRegion(child.getRegionCode()); childMap.put("name", child.getName()); childMap.put("personCount", childVo.getPersonCount()); childMap.put("signCount", childVo.getSignedCount()); childMap.put("signPer", childVo.getSignPer()); childrenList.add(childMap); } returnMap.put("childrenInfo", childrenList); returnMap.put("hospitalInfo", hospitalInfo); return JsonUtils.getJson(BaseJsonVo.success(returnMap)); } catch (Exception e) { e.printStackTrace(); return JsonUtils.getJson(BaseJsonVo.error()); } } @RequestMapping(value = "/getTeamInfo", method = RequestMethod.GET) @ResponseBody public String getTeamInfo(HttpServletRequest request, Model model, String teamId, Integer personCount) { try { StatisticsDayBasedataVo teamIncrementData = statisticsService.getTeamIncrementData(teamId); DoctorDetailVo teamLeaderInfo = docService.getTeamLeaderInfo(teamId); teamIncrementData.setLeaderName(teamLeaderInfo.getDocName()); if (personCount != 0) { Double signPer = Double.valueOf(teamIncrementData.getSignCount()) / Double.valueOf(personCount); BigDecimal decimal = new BigDecimal(signPer * 100); teamIncrementData.setSignPer(decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); }else { teamIncrementData.setSignPer(0.0); } return JsonUtils.getJson(BaseJsonVo.success(teamIncrementData)); } catch (Exception e) { e.printStackTrace(); return JsonUtils.getJson(BaseJsonVo.error()); } } }
7,484
0.761668
0.758354
179
39.458099
30.714075
171
false
false
0
0
0
0
0
0
2.631285
false
false
2
4bb9b043268f828acfdb99d60e3a2af3a9fc064d
592,705,494,542
797c8d393fabc601d9fa513022e836a6145a88e1
/listeners/ExcelListeners.java
c539ce3e756f9e63af4e7f1f83dbfccc09f9f761
[]
no_license
machirajunagasundar/TestngseleniumUiFramework
https://github.com/machirajunagasundar/TestngseleniumUiFramework
983eb3ea66a1330da9141db28adbb87749a63771
fc8e3381a677b9c860f316372a7508bf743a5bda
refs/heads/main
2023-05-10T18:43:38.394000
2021-05-17T08:49:26
2021-05-17T08:49:26
368,099,304
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.optum.automation.coreframework.listeners; /** * @author Manoj Sharma * */ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.apache.poi.ss.usermodel.IndexedColors; import org.testng.IInvokedMethod; import org.testng.IInvokedMethodListener; import org.testng.ISuite; import org.testng.ISuiteListener; import org.testng.ITestClass; import org.testng.ITestContext; import org.testng.ITestListener; import org.testng.ITestResult; import com.optum.automation.coreframework.utils.PoiWriter; public class ExcelListeners extends BaseListener { public static int counter = 0; public static int columnIndex = 0; public String[] sheetHeaders = { "Test Name", "Description", "Result", "Testdata" }; public Map<String, String[]> sheetHeaderMap = new HashMap<String, String[]>(); public String[] sheetName = { "TestResult" }; public static String REPORTNAME = "ExcelReport.xlsx"; public static Map<Integer, List<String>> resultMap = new LinkedHashMap<Integer, List<String>>(); @Override public void onStart(ISuite arg0) { File file = new File(REPORTNAME); if (file.exists()) { file.delete(); } PoiWriter.createExcelFile(REPORTNAME, sheetName); // TODO Auto-generated method stub resultMap.put(counter++, Arrays.asList(sheetHeaders)); PoiWriter.appendDataToFile(REPORTNAME, sheetName[0], resultMap); PoiWriter.setRowStyle(0, REPORTNAME, sheetName[0], IndexedColors.YELLOW); resultMap.clear(); } @Override public void afterInvocation(IInvokedMethod arg0, ITestResult arg1) { if (arg0.isTestMethod()) { List<String> dataMap = new LinkedList<String>(); String description = arg1.getMethod().getDescription(); String CompleteDescription = (description == null) ? (arg1 .getMethod().getMethodName() + ": No description provided") : description; if (CompleteDescription.contains(":")) { String[] arrDescription = CompleteDescription.split(":"); dataMap.add(arrDescription[0]); dataMap.add(arrDescription[1]); } else { dataMap.add(arg1.getMethod().getMethodName()); dataMap.add(CompleteDescription); } dataMap.add(resultStatusToString(arg1)); if (arg1.getParameters().length == 0) { dataMap.add("No Parameter declared"); } else { dataMap.add(arg1.getParameters()[0].toString()); } resultMap.put(counter++, dataMap); } } private String resultStatusToString(ITestResult arg1) { String status = null; switch (arg1.getStatus()) { case 1: status = "SUCCESS"; break; case 2: status = "FAIL"; break; case 3: status = "SKIP"; break; case 4: status = "SUCCESS_PERCENTAGE_FAILURE"; } return status; } @Override public void onAfterClass(ITestClass arg0) { // TODO Auto-generated method stub PoiWriter.appendDataToFile(REPORTNAME, sheetName[0], resultMap); resultMap.clear(); } @Override public void onFinish(ISuite arg0) { List<List<Object>> rulesList = new ArrayList<>(); rulesList.add(PoiWriter.SetExcelFormatRule("EQUAL", "\"SUCCESS\"", IndexedColors.GREEN)); rulesList.add(PoiWriter.SetExcelFormatRule("EQUAL", "\"FAIL\"", IndexedColors.RED)); rulesList.add(PoiWriter.SetExcelFormatRule("EQUAL", "\"SKIP\"", IndexedColors.YELLOW)); try { PoiWriter.conditionalFormatCells(REPORTNAME, sheetName[0], "C1:C500", rulesList); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
3,751
java
ExcelListeners.java
Java
[ { "context": "tomation.coreframework.listeners;\r\n/**\r\n * @author Manoj Sharma\r\n *\r\n */\r\nimport java.io.File;\r\nimport java.io.IO", "end": 83, "score": 0.9998010396957397, "start": 71, "tag": "NAME", "value": "Manoj Sharma" } ]
null
[]
package com.optum.automation.coreframework.listeners; /** * @author <NAME> * */ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.apache.poi.ss.usermodel.IndexedColors; import org.testng.IInvokedMethod; import org.testng.IInvokedMethodListener; import org.testng.ISuite; import org.testng.ISuiteListener; import org.testng.ITestClass; import org.testng.ITestContext; import org.testng.ITestListener; import org.testng.ITestResult; import com.optum.automation.coreframework.utils.PoiWriter; public class ExcelListeners extends BaseListener { public static int counter = 0; public static int columnIndex = 0; public String[] sheetHeaders = { "Test Name", "Description", "Result", "Testdata" }; public Map<String, String[]> sheetHeaderMap = new HashMap<String, String[]>(); public String[] sheetName = { "TestResult" }; public static String REPORTNAME = "ExcelReport.xlsx"; public static Map<Integer, List<String>> resultMap = new LinkedHashMap<Integer, List<String>>(); @Override public void onStart(ISuite arg0) { File file = new File(REPORTNAME); if (file.exists()) { file.delete(); } PoiWriter.createExcelFile(REPORTNAME, sheetName); // TODO Auto-generated method stub resultMap.put(counter++, Arrays.asList(sheetHeaders)); PoiWriter.appendDataToFile(REPORTNAME, sheetName[0], resultMap); PoiWriter.setRowStyle(0, REPORTNAME, sheetName[0], IndexedColors.YELLOW); resultMap.clear(); } @Override public void afterInvocation(IInvokedMethod arg0, ITestResult arg1) { if (arg0.isTestMethod()) { List<String> dataMap = new LinkedList<String>(); String description = arg1.getMethod().getDescription(); String CompleteDescription = (description == null) ? (arg1 .getMethod().getMethodName() + ": No description provided") : description; if (CompleteDescription.contains(":")) { String[] arrDescription = CompleteDescription.split(":"); dataMap.add(arrDescription[0]); dataMap.add(arrDescription[1]); } else { dataMap.add(arg1.getMethod().getMethodName()); dataMap.add(CompleteDescription); } dataMap.add(resultStatusToString(arg1)); if (arg1.getParameters().length == 0) { dataMap.add("No Parameter declared"); } else { dataMap.add(arg1.getParameters()[0].toString()); } resultMap.put(counter++, dataMap); } } private String resultStatusToString(ITestResult arg1) { String status = null; switch (arg1.getStatus()) { case 1: status = "SUCCESS"; break; case 2: status = "FAIL"; break; case 3: status = "SKIP"; break; case 4: status = "SUCCESS_PERCENTAGE_FAILURE"; } return status; } @Override public void onAfterClass(ITestClass arg0) { // TODO Auto-generated method stub PoiWriter.appendDataToFile(REPORTNAME, sheetName[0], resultMap); resultMap.clear(); } @Override public void onFinish(ISuite arg0) { List<List<Object>> rulesList = new ArrayList<>(); rulesList.add(PoiWriter.SetExcelFormatRule("EQUAL", "\"SUCCESS\"", IndexedColors.GREEN)); rulesList.add(PoiWriter.SetExcelFormatRule("EQUAL", "\"FAIL\"", IndexedColors.RED)); rulesList.add(PoiWriter.SetExcelFormatRule("EQUAL", "\"SKIP\"", IndexedColors.YELLOW)); try { PoiWriter.conditionalFormatCells(REPORTNAME, sheetName[0], "C1:C500", rulesList); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
3,745
0.689949
0.681152
134
25.992537
24.256557
97
false
false
0
0
0
0
0
0
2.104478
false
false
2
40713e0e851b37811fbd8e628ccc46e38f57cfdd
3,685,081,942,643
7ec5f394cca3d3d0a70a9599ac0c9d9b40c00b2c
/src/main/java/com/hotel/service/UserService.java
150ed7f101ff97d606a8a92dc9b1734ae9f7e9a4
[]
no_license
wanghaijin/hotel
https://github.com/wanghaijin/hotel
d010471e18f5bcfbfef3ad2315fd6a79177bf3ab
901c12a1ae89b6ae70c97041a1037a4fec985a9f
refs/heads/master
2021-07-07T14:50:11.955000
2017-10-01T06:15:13
2017-10-01T06:15:13
104,686,819
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hotel.service; import com.hotel.pojo.User; public interface UserService { //根据订单号选择人物 // public List<User> selectUser(String ordersType,String userId,String roomNum,String startTime,String endTime); //插入人物 public boolean insertUser(User user); }
GB18030
Java
292
java
UserService.java
Java
[]
null
[]
package com.hotel.service; import com.hotel.pojo.User; public interface UserService { //根据订单号选择人物 // public List<User> selectUser(String ordersType,String userId,String roomNum,String startTime,String endTime); //插入人物 public boolean insertUser(User user); }
292
0.778196
0.778196
10
25.6
32.016247
113
false
false
0
0
0
0
0
0
1.5
false
false
2
8a0d771df155a20293b4e132131c49793b76d3a1
15,831,249,462,256
32782229985d4675bd887a88f0a862bc17a548a1
/practica8/src/Lexer/InputOutputAnalLex.java
41f0bec81e9834f1f2a762cb2ea70b75bf82e0fc
[]
no_license
DavidFHCh/Practica8LP
https://github.com/DavidFHCh/Practica8LP
d9b81a6b6c39cd5c750337f487d78f9ffbe87c9f
f706e8568a35be683422ff495405eff28fa002ef
refs/heads/master
2021-01-13T15:09:05.861000
2016-12-13T00:08:59
2016-12-13T00:08:59
76,231,009
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Lexer; import java.io.*; import java.util.*; /** * File: InputOutputAnalLex * * En este archivo es donde se manejara la entrada y la salida. */ public class InputOutputAnalLex{ public static void main(String[] args){ BufferedReader br = null; BufferedReader br2 = null; FileReader fr = null; System.out.println("Analizador Lexico."); boolean continuo = true; try{ while(continuo){ System.out.println("¿Como se va a presentar el codigo? \n 1)Terminal. \n 2)Archivo. \n 3)Cerrar."); br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); String entrada = ""; switch(input){ case "1": System.out.println("Cuando termine de introducir codigo, de salto de linea y escriba la palabra \"FIN\",sin comillas. \n Introduzca el codigo: \n > "); input = ""; do{ input = br.readLine(); if(!input.equals("FIN")) entrada += input; }while(!input.equals("FIN")); //Aqui llamo al coso lexico. AnalLex al1 = new AnalLex(entrada); ArrayList<String> salida1 = al1.run(); for(String s: salida1) System.out.println(s); break; case "2": System.out.println("Por favor introduce la direccion absoluta del archivo: \n"); input = br.readLine(); File file = new File(input); fr = new FileReader(file); br2 = new BufferedReader(fr); while((input = br2.readLine()) != null){ entrada += input; } //Aqui llamo al lexico. AnalLex al = new AnalLex(entrada); ArrayList<String> salida = al.run(); for(String s: salida) System.out.println(s); break; case "3": continuo = false; break; default: System.out.println("Intenta Otra Vez."); } } }catch(Exception e){ System.err.println("Error al leer Archivo."); e.printStackTrace(); } } }
UTF-8
Java
1,912
java
InputOutputAnalLex.java
Java
[]
null
[]
package Lexer; import java.io.*; import java.util.*; /** * File: InputOutputAnalLex * * En este archivo es donde se manejara la entrada y la salida. */ public class InputOutputAnalLex{ public static void main(String[] args){ BufferedReader br = null; BufferedReader br2 = null; FileReader fr = null; System.out.println("Analizador Lexico."); boolean continuo = true; try{ while(continuo){ System.out.println("¿Como se va a presentar el codigo? \n 1)Terminal. \n 2)Archivo. \n 3)Cerrar."); br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); String entrada = ""; switch(input){ case "1": System.out.println("Cuando termine de introducir codigo, de salto de linea y escriba la palabra \"FIN\",sin comillas. \n Introduzca el codigo: \n > "); input = ""; do{ input = br.readLine(); if(!input.equals("FIN")) entrada += input; }while(!input.equals("FIN")); //Aqui llamo al coso lexico. AnalLex al1 = new AnalLex(entrada); ArrayList<String> salida1 = al1.run(); for(String s: salida1) System.out.println(s); break; case "2": System.out.println("Por favor introduce la direccion absoluta del archivo: \n"); input = br.readLine(); File file = new File(input); fr = new FileReader(file); br2 = new BufferedReader(fr); while((input = br2.readLine()) != null){ entrada += input; } //Aqui llamo al lexico. AnalLex al = new AnalLex(entrada); ArrayList<String> salida = al.run(); for(String s: salida) System.out.println(s); break; case "3": continuo = false; break; default: System.out.println("Intenta Otra Vez."); } } }catch(Exception e){ System.err.println("Error al leer Archivo."); e.printStackTrace(); } } }
1,912
0.610152
0.603349
76
24.157894
25.008448
157
false
false
0
0
0
0
0
0
3.986842
false
false
2
9f083c9077fb4fd88a9c8f4e359d284b4ec5c353
15,831,249,462,616
010e9cc2a5ebc804c5acd99a6b100c007ad76f8c
/src/main/java/com/server/module/system/bargainManage/TblCustomerBargainDetailBean.java
3a41b6384bf49f763cbd36592c7eb55e8d6b6c8f
[]
no_license
Amberking196/admin
https://github.com/Amberking196/admin
01e5ea9000d533b3ec075bb82468cb84a9588c88
12d82b652c422af03a579eb65c73488f5a259566
refs/heads/master
2022-07-10T06:40:04.603000
2020-07-13T13:22:35
2020-07-13T13:22:35
239,647,547
1
1
null
false
2022-06-29T18:14:30
2020-02-11T01:08:09
2020-07-13T13:32:58
2022-06-29T18:14:29
3,561
1
1
9
Java
false
false
package com.server.module.system.bargainManage; import com.server.common.persistence.Entity; import com.server.common.persistence.NotField; import lombok.Data; import java.math.BigDecimal; import java.util.Date; import org.springframework.format.annotation.DateTimeFormat; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; /** * table name: tbl_customer_bargain * author name: hjc * create time: 2018-12-21 16:20:26 */ @Data @Entity(tableName="tbl_customer_bargain_detail",id="",idGenerate="auto") public class TblCustomerBargainDetailBean{ private Integer id; private Integer customerBargainId; private Long customerId; private BigDecimal cutPrice;//每次砍价的金额 @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss") private Date createTime; @NotField private String phone; @NotField private String name; }
UTF-8
Java
908
java
TblCustomerBargainDetailBean.java
Java
[ { "context": " table name: tbl_customer_bargain\n * author name: hjc\n * create time: 2018-12-21 16:20:26\n */ \n@Data\n@E", "end": 442, "score": 0.9996834993362427, "start": 439, "tag": "USERNAME", "value": "hjc" } ]
null
[]
package com.server.module.system.bargainManage; import com.server.common.persistence.Entity; import com.server.common.persistence.NotField; import lombok.Data; import java.math.BigDecimal; import java.util.Date; import org.springframework.format.annotation.DateTimeFormat; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; /** * table name: tbl_customer_bargain * author name: hjc * create time: 2018-12-21 16:20:26 */ @Data @Entity(tableName="tbl_customer_bargain_detail",id="",idGenerate="auto") public class TblCustomerBargainDetailBean{ private Integer id; private Integer customerBargainId; private Long customerId; private BigDecimal cutPrice;//每次砍价的金额 @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss") private Date createTime; @NotField private String phone; @NotField private String name; }
908
0.767338
0.751678
35
24.514286
19.977661
72
false
false
0
0
0
0
0
0
0.828571
false
false
2
ff8a89daacac4ca1a77849e0f9457afef279bee9
9,801,115,399,409
5501cefcee77258f51687c7cf7aec40cadf46bf2
/src/test/java/pl/sda/HTTPDownloadManagerTest.java
0a99ca7454c9add0e9c35743542b56c4e87969c1
[]
no_license
blaxej/download-manager
https://github.com/blaxej/download-manager
49c79d7e3b057d8640ba3d0e2d6b61234316d35c
8e652a7a6ce53434e0b78da33abd8d484cbbf08f
refs/heads/master
2022-07-21T14:40:16.039000
2019-07-14T12:53:59
2019-07-14T12:53:59
196,815,798
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.sda; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import static org.assertj.core.api.Assertions.assertThat; public class HTTPDownloadManagerTest { private Server server; @BeforeEach void setup() throws Exception { server = prepareServer(); server.start(); } @AfterEach void tearDown() throws Exception { server.stop(); } @DisplayName( "given http://localhost:8080/file" + "when download " + "then file is downloaded to download dir" ) @Test public void dummy() throws Exception { //given Path downloadPath = Files.createTempDirectory( "download-dir") .resolve(Paths.get("file")); HTTPDownloadManager manager = new HTTPDownloadManager(); //when manager.download(new URL("http://localhost:8080/file"), downloadPath); //then assertThat(downloadPath).exists(); } private Server prepareServer() { Server server = new Server(8080); server.setHandler(new AbstractHandler() { @Override public void handle(String s, Request request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { httpServletResponse.getWriter().write("Hello"); httpServletResponse.setStatus(200); httpServletResponse.setContentType("text/plain"); request.setHandled(true); } }); return server; } }
UTF-8
Java
2,159
java
HTTPDownloadManagerTest.java
Java
[]
null
[]
package pl.sda; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import static org.assertj.core.api.Assertions.assertThat; public class HTTPDownloadManagerTest { private Server server; @BeforeEach void setup() throws Exception { server = prepareServer(); server.start(); } @AfterEach void tearDown() throws Exception { server.stop(); } @DisplayName( "given http://localhost:8080/file" + "when download " + "then file is downloaded to download dir" ) @Test public void dummy() throws Exception { //given Path downloadPath = Files.createTempDirectory( "download-dir") .resolve(Paths.get("file")); HTTPDownloadManager manager = new HTTPDownloadManager(); //when manager.download(new URL("http://localhost:8080/file"), downloadPath); //then assertThat(downloadPath).exists(); } private Server prepareServer() { Server server = new Server(8080); server.setHandler(new AbstractHandler() { @Override public void handle(String s, Request request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { httpServletResponse.getWriter().write("Hello"); httpServletResponse.setStatus(200); httpServletResponse.setContentType("text/plain"); request.setHandled(true); } }); return server; } }
2,159
0.663733
0.656786
74
28.175676
26.685028
176
false
false
0
0
0
0
0
0
0.513514
false
false
2
01fef2438d6002e8a40387de7e1e411a79acc807
28,372,554,020,059
7353ed50bcd613a8d10b1cab2c982d05799fc114
/Bookstore/src/main/java/palvelinkurssi/Bookstore/web/CategoryController.java
2884dd131b67c369d328f09cde4fc8987c852bd3
[]
no_license
JoelVaarala/Bookstore
https://github.com/JoelVaarala/Bookstore
64bf40e8d9a20036d6f721acfff7dae34fe4fdc7
9b60dc97ba53a00f552e51c6215f8f9abd8cfd40
refs/heads/master
2020-12-30T02:35:56.342000
2020-03-30T08:06:24
2020-03-30T08:06:24
238,832,834
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package palvelinkurssi.Bookstore.web; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import palvelinkurssi.Bookstore.Domain.CategoryRepository; import palvelinkurssi.Bookstore.Domain.Category; @Controller public class CategoryController { @Autowired CategoryRepository categoryRepository; @RequestMapping(value="/categorylist", method=RequestMethod.GET) public String getCategories(Model model) { List<Category> category = (List<Category>) categoryRepository.findAll(); model.addAttribute("category", category); return "listCategories"; } @RequestMapping(value = "/newcategory", method = RequestMethod.GET) public String getNewCategoryForm(Model model) { model.addAttribute("category", new Category()); return "addCategory"; } @RequestMapping(value = "/add", method = RequestMethod.POST) public String saveCategory(@ModelAttribute Category category) { categoryRepository.save(category); return "redirect:/listCategories"; } }
UTF-8
Java
1,282
java
CategoryController.java
Java
[]
null
[]
package palvelinkurssi.Bookstore.web; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import palvelinkurssi.Bookstore.Domain.CategoryRepository; import palvelinkurssi.Bookstore.Domain.Category; @Controller public class CategoryController { @Autowired CategoryRepository categoryRepository; @RequestMapping(value="/categorylist", method=RequestMethod.GET) public String getCategories(Model model) { List<Category> category = (List<Category>) categoryRepository.findAll(); model.addAttribute("category", category); return "listCategories"; } @RequestMapping(value = "/newcategory", method = RequestMethod.GET) public String getNewCategoryForm(Model model) { model.addAttribute("category", new Category()); return "addCategory"; } @RequestMapping(value = "/add", method = RequestMethod.POST) public String saveCategory(@ModelAttribute Category category) { categoryRepository.save(category); return "redirect:/listCategories"; } }
1,282
0.799532
0.799532
40
31.049999
25.204117
74
false
false
0
0
0
0
0
0
1.325
false
false
2
0d5aca9294ac008afccc76373b8d82347d05bb22
27,273,042,334,449
c6ec94073bd51340791afd84f95b502703f3f6ea
/src/runtime/debug/Tracer.java
6eb073cd475eef88ab37589781c2ea7ec57a9be0
[ "Apache-2.0" ]
permissive
hessammehr/JCHR
https://github.com/hessammehr/JCHR
d70252cd154339506be39042c1cc7db6c5563867
cd0547afa97041a9f7d60db49fba805973d498fc
refs/heads/master
2020-08-06T23:31:32.614000
2019-10-06T17:01:37
2019-10-06T17:01:37
213,199,268
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package runtime.debug; import runtime.Constraint; /** * The interface you have to implement if you want to listen * for events during the execution of a JCHR program. * Currently, events can be thrown on the following execution points: * <ul> * <li>Right after a constraint is activated (for the first time).</li> * <li>Right after a constraint is reactivated (by some built-in event).</li> * <li>Right after a constraint is stored in the constraint store.</li> * <li>Right before a constraint is suspended * (will <em>always</em> be a constraint that has been stored)</li> * <li>Right after a constraint is removed from the constraint store.</li> * <li>Right <em>before</em> a rule fires. Arguments passed here include * also the constraints that matched the head and the index of the * active constraint.</li> * <li>Right <em>after</em> a rule fired, that is: right after * the execution of its body.</li> * </ul> * * @author Peter Van Weert */ public interface Tracer { /** * Called right after the given constraint is activated. * * @param constraint * The constraint that has just been activated. */ public void activated(Constraint constraint); /** * Called right after the given constraint is reactivated. * * @param constraint * The constraint that has just been reactivated. */ public void reactivated(Constraint constraint); /** * Called right after the given constraint is stored in the constraint store. * * @param constraint * The constraint that has just been stored. */ public void stored(Constraint constraint); /** * Called right before the given constraint is suspended. * This constraint is always stored. * * @param constraint * The constraint that is about to be suspended. */ public void suspended(Constraint constraint); /** * Called right after the given constraint is removed from the constraint store. * * @param constraint * The constraint that has just been removed. */ public void removed(Constraint constraint); /** * Called right after the given constraint is terminated. * * @param constraint * The constraint that has just been terminated. */ public void terminated(Constraint constraint); /** * Called right <em>before</em> the rule with the given identifier fires, * with the given constraints matching its head (<code>activeIndex</code> * is the index of the active constraint). Right <em>after</em> this call, the * runtime will delete the necessary constraints and execute the rule's * body. * * @param ruleId * The identifier of the rule that is about to fire. * @param activeIndex * The index of the active constraint, i.e. the <code>activeIndex</code>'th * constraint of <code>constraints</code> is the active constraint. * @param constraints * The list of constraints that match the rule's head. The constraints are * given in order: the first constraint matches the first occurrence in the * rule's head (left-to-right), etc */ public void fires(String ruleId, int activeIndex, Constraint... constraints); /** * Called right <em>after</em> the body of some rule is entirely executed. * * @param ruleId * The identifier of the rule that just fired. * @param activeIndex * The index of the active constraint, i.e. the <code>activeIndex</code>'th * constraint of <code>constraints</code> is the active constraint. * @param constraints * The list of constraints that match the rule's head. The constraints are * given in order: the first constraint matches the first occurrence in the * rule's head (left-to-right), etc */ public void fired(String ruleId, int activeIndex, Constraint... constraints); }
UTF-8
Java
4,009
java
Tracer.java
Java
[ { "context": "xecution of its body.</li>\n * </ul>\n * \n * @author Peter Van Weert\n */\npublic interface Tracer {\n\n /**\n * Cal", "end": 989, "score": 0.9997077584266663, "start": 974, "tag": "NAME", "value": "Peter Van Weert" } ]
null
[]
package runtime.debug; import runtime.Constraint; /** * The interface you have to implement if you want to listen * for events during the execution of a JCHR program. * Currently, events can be thrown on the following execution points: * <ul> * <li>Right after a constraint is activated (for the first time).</li> * <li>Right after a constraint is reactivated (by some built-in event).</li> * <li>Right after a constraint is stored in the constraint store.</li> * <li>Right before a constraint is suspended * (will <em>always</em> be a constraint that has been stored)</li> * <li>Right after a constraint is removed from the constraint store.</li> * <li>Right <em>before</em> a rule fires. Arguments passed here include * also the constraints that matched the head and the index of the * active constraint.</li> * <li>Right <em>after</em> a rule fired, that is: right after * the execution of its body.</li> * </ul> * * @author <NAME> */ public interface Tracer { /** * Called right after the given constraint is activated. * * @param constraint * The constraint that has just been activated. */ public void activated(Constraint constraint); /** * Called right after the given constraint is reactivated. * * @param constraint * The constraint that has just been reactivated. */ public void reactivated(Constraint constraint); /** * Called right after the given constraint is stored in the constraint store. * * @param constraint * The constraint that has just been stored. */ public void stored(Constraint constraint); /** * Called right before the given constraint is suspended. * This constraint is always stored. * * @param constraint * The constraint that is about to be suspended. */ public void suspended(Constraint constraint); /** * Called right after the given constraint is removed from the constraint store. * * @param constraint * The constraint that has just been removed. */ public void removed(Constraint constraint); /** * Called right after the given constraint is terminated. * * @param constraint * The constraint that has just been terminated. */ public void terminated(Constraint constraint); /** * Called right <em>before</em> the rule with the given identifier fires, * with the given constraints matching its head (<code>activeIndex</code> * is the index of the active constraint). Right <em>after</em> this call, the * runtime will delete the necessary constraints and execute the rule's * body. * * @param ruleId * The identifier of the rule that is about to fire. * @param activeIndex * The index of the active constraint, i.e. the <code>activeIndex</code>'th * constraint of <code>constraints</code> is the active constraint. * @param constraints * The list of constraints that match the rule's head. The constraints are * given in order: the first constraint matches the first occurrence in the * rule's head (left-to-right), etc */ public void fires(String ruleId, int activeIndex, Constraint... constraints); /** * Called right <em>after</em> the body of some rule is entirely executed. * * @param ruleId * The identifier of the rule that just fired. * @param activeIndex * The index of the active constraint, i.e. the <code>activeIndex</code>'th * constraint of <code>constraints</code> is the active constraint. * @param constraints * The list of constraints that match the rule's head. The constraints are * given in order: the first constraint matches the first occurrence in the * rule's head (left-to-right), etc */ public void fired(String ruleId, int activeIndex, Constraint... constraints); }
4,000
0.663507
0.663507
109
35.78899
28.69935
84
false
false
0
0
0
0
0
0
0.220183
false
false
2
a33d04119568fe1789f9e9e8ce2613a2c92326ec
17,325,898,081,660
312b8838ddde76337d761fd03e639c5dbed6ffd1
/app/src/main/java/ec/solmedia/cleanarchitecture/di/components/MainComponent.java
8b226a85765a5e222ecdfb198bea2ed2582ed239
[]
no_license
mayalaat/clean-architecture
https://github.com/mayalaat/clean-architecture
c30d88fe3d7e14fe769b60a0132de9a50eccfc58
1a97628e1573cb698dae7958df18a6b16079c5d2
refs/heads/main
2023-02-17T04:16:13.165000
2021-01-20T01:25:03
2021-01-20T01:25:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ec.solmedia.cleanarchitecture.di.components; import javax.inject.Singleton; import dagger.Component; import ec.solmedia.cleanarchitecture.di.modules.MainModule; import ec.solmedia.cleanarchitecture.view.activity.MainActivity; @Singleton @Component(modules = MainModule.class) public interface MainComponent { void inject(MainActivity activity); }
UTF-8
Java
363
java
MainComponent.java
Java
[]
null
[]
package ec.solmedia.cleanarchitecture.di.components; import javax.inject.Singleton; import dagger.Component; import ec.solmedia.cleanarchitecture.di.modules.MainModule; import ec.solmedia.cleanarchitecture.view.activity.MainActivity; @Singleton @Component(modules = MainModule.class) public interface MainComponent { void inject(MainActivity activity); }
363
0.826446
0.826446
14
24.928572
22.594133
64
false
false
0
0
0
0
0
0
0.428571
false
false
2
01bd4e47379e8f9308261938052716002858e741
24,721,831,757,531
7b48e6b5fe743737f201fae569a614e0d6c3a364
/string_processing/string_sorts/LSD.java
51e10f1684da00b78c4c4af9b1a0550d6a8c11eb
[ "Apache-2.0" ]
permissive
manishjoshi394/algorithms
https://github.com/manishjoshi394/algorithms
6470fa1c5a07db575c0e3890c9c41807dffc1ede
93045de6a9ae5f6ff4e85ce6bdf67f8b75b42a86
refs/heads/master
2021-08-08T04:54:30.875000
2018-12-30T19:23:33
2018-12-30T19:23:33
129,548,432
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2018 Manish Joshi. * * 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 string_processing.string_sorts; import java.lang.String; import java.util.Arrays; /** * The {@code LSD} class provides static Methods to sort 32-bit Integers and * fixed length strings in Linear time (multiplied by length of String). (The * length upto which the strings are sorted is same and can be chosen by the * method caller) * <p> * The class uses LSD Radix sort as its core mechanism. Overall the methods are * 2-3x faster than Arrays.sort(). * <p> * In Big Oh notation, running time is - {@code O(W(N + R))} * * @author Manish Joshi */ public class LSD { /** * Sorts the strings in the given array upto the length of minimum length * string. * * @param a the string array to be sorted */ public static void sort(String[] a) { int minLength = Integer.MAX_VALUE; for (int i = 0; i < a.length; ++i) { minLength = Math.min(minLength, a[i].length()); } System.out.println(minLength); sort(a, minLength); } /** * Sorts the strings in the given array using first W characters of the * Strings, * * @param a The String array to be sorted * @param W upto W characters from the beginning the strings will be sorted */ public static void sort(String[] a, int W) { for (int i = 0; i < a.length; ++i) { if (a[i].length() < W) { throw new IllegalArgumentException("String at index " + i + " has length smaller than W, which is NOT allowed."); } } int N = a.length; int R = 256; String[] aux = new String[N]; for (int pos = W - 1; pos >= 0; pos--) { int count[] = new int[R + 1]; // compute frequency counts for (int i = 0; i < N; ++i) { count[a[i].charAt(pos) + 1]++; } // build cumulative frequency for (int r = 0; r < R; ++r) { count[r + 1] += count[r]; } // distribute the data in aux array while sorting it for (int i = 0; i < N; ++i) { aux[count[a[i].charAt(pos)]++] = a[i]; } // copy back into the original array for (int i = 0; i < N; ++i) { a[i] = aux[i]; } } } /** * Sorts the 32-bit integer in the linear time {@code O(N)} using LSD radix * sort. * <p> * <b>Implementation Note:</b> 32-bit integer is divided into 4 Bytes and * then sorted with Counting sort in 4 passes. * * @param a The integer array to be sorted */ public static void sort(int[] a) { final int BITS = 32; // each int is 32-bits final int BITS_PER_BYTE = 8; final int R = 1 << BITS_PER_BYTE; // each byte can take 2^8 = 256 different values final int W = BITS / BITS_PER_BYTE; // 4 bytes final int MASK = R - 1; // 0xFF int N = a.length; int[] aux = new int[N]; for (int pos = 0; pos < W; ++pos) { // compute frequency counts int[] count = new int[R + 1]; for (int i = 0; i < N; ++i) { int d = (a[i] >> BITS_PER_BYTE * pos) & MASK; count[d + 1]++; } // compute cumulates for (int r = 0; r < R; ++r) { count[r + 1] += count[r]; } // for most significant byte, sign bit has to be taken in consideration // that's why 0x80-0xFF must come before 0x00-0x7F if (pos == W - 1) { int shift1 = count[R] - count[R / 2]; int shift2 = count[R / 2]; for (int r = 0; r < R / 2; ++r) { count[r] += shift1; } for (int r = R / 2; r < R; ++r) { count[r] -= shift2; } } // distribute the data for (int i = 0; i < N; ++i) { int d = (a[i] >> BITS_PER_BYTE * pos) & MASK; aux[count[d]++] = a[i] ; } // copy back into the original array for (int i = 0; i < N; ++i) { a[i] = aux[i]; } } } // for unit testing of the class public static void main(String[] args) { String[] a = {"Manish", "Joshi", "isa", "ofcourse", "Azb", "Aza", "Really", "Good", "Boy", "Badass"}; int[] arr = {3, -2 , 1, 10 , 20, 0, -1, -100}; LSD.sort(arr); for (int x : arr) { System.out.println(x); } } }
UTF-8
Java
5,369
java
LSD.java
Java
[ { "context": "/*\n * Copyright 2018 Manish Joshi.\n *\n * Licensed under the Apache License, Version", "end": 33, "score": 0.9998739957809448, "start": 21, "tag": "NAME", "value": "Manish Joshi" }, { "context": "unning time is - {@code O(W(N + R))}\n *\n * @author Manish Joshi\n */\npublic class LSD {\n\n /**\n * Sorts the ", "end": 1160, "score": 0.9998672604560852, "start": 1148, "tag": "NAME", "value": "Manish Joshi" }, { "context": "void main(String[] args) {\n String[] a = {\"Manish\", \"Joshi\", \"isa\", \"ofcourse\", \"Azb\", \"Aza\", \"Real", "end": 5128, "score": 0.9997274875640869, "start": 5122, "tag": "NAME", "value": "Manish" }, { "context": "String[] args) {\n String[] a = {\"Manish\", \"Joshi\", \"isa\", \"ofcourse\", \"Azb\", \"Aza\", \"Really\", \"Goo", "end": 5137, "score": 0.9996317028999329, "start": 5132, "tag": "NAME", "value": "Joshi" } ]
null
[]
/* * Copyright 2018 <NAME>. * * 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 string_processing.string_sorts; import java.lang.String; import java.util.Arrays; /** * The {@code LSD} class provides static Methods to sort 32-bit Integers and * fixed length strings in Linear time (multiplied by length of String). (The * length upto which the strings are sorted is same and can be chosen by the * method caller) * <p> * The class uses LSD Radix sort as its core mechanism. Overall the methods are * 2-3x faster than Arrays.sort(). * <p> * In Big Oh notation, running time is - {@code O(W(N + R))} * * @author <NAME> */ public class LSD { /** * Sorts the strings in the given array upto the length of minimum length * string. * * @param a the string array to be sorted */ public static void sort(String[] a) { int minLength = Integer.MAX_VALUE; for (int i = 0; i < a.length; ++i) { minLength = Math.min(minLength, a[i].length()); } System.out.println(minLength); sort(a, minLength); } /** * Sorts the strings in the given array using first W characters of the * Strings, * * @param a The String array to be sorted * @param W upto W characters from the beginning the strings will be sorted */ public static void sort(String[] a, int W) { for (int i = 0; i < a.length; ++i) { if (a[i].length() < W) { throw new IllegalArgumentException("String at index " + i + " has length smaller than W, which is NOT allowed."); } } int N = a.length; int R = 256; String[] aux = new String[N]; for (int pos = W - 1; pos >= 0; pos--) { int count[] = new int[R + 1]; // compute frequency counts for (int i = 0; i < N; ++i) { count[a[i].charAt(pos) + 1]++; } // build cumulative frequency for (int r = 0; r < R; ++r) { count[r + 1] += count[r]; } // distribute the data in aux array while sorting it for (int i = 0; i < N; ++i) { aux[count[a[i].charAt(pos)]++] = a[i]; } // copy back into the original array for (int i = 0; i < N; ++i) { a[i] = aux[i]; } } } /** * Sorts the 32-bit integer in the linear time {@code O(N)} using LSD radix * sort. * <p> * <b>Implementation Note:</b> 32-bit integer is divided into 4 Bytes and * then sorted with Counting sort in 4 passes. * * @param a The integer array to be sorted */ public static void sort(int[] a) { final int BITS = 32; // each int is 32-bits final int BITS_PER_BYTE = 8; final int R = 1 << BITS_PER_BYTE; // each byte can take 2^8 = 256 different values final int W = BITS / BITS_PER_BYTE; // 4 bytes final int MASK = R - 1; // 0xFF int N = a.length; int[] aux = new int[N]; for (int pos = 0; pos < W; ++pos) { // compute frequency counts int[] count = new int[R + 1]; for (int i = 0; i < N; ++i) { int d = (a[i] >> BITS_PER_BYTE * pos) & MASK; count[d + 1]++; } // compute cumulates for (int r = 0; r < R; ++r) { count[r + 1] += count[r]; } // for most significant byte, sign bit has to be taken in consideration // that's why 0x80-0xFF must come before 0x00-0x7F if (pos == W - 1) { int shift1 = count[R] - count[R / 2]; int shift2 = count[R / 2]; for (int r = 0; r < R / 2; ++r) { count[r] += shift1; } for (int r = R / 2; r < R; ++r) { count[r] -= shift2; } } // distribute the data for (int i = 0; i < N; ++i) { int d = (a[i] >> BITS_PER_BYTE * pos) & MASK; aux[count[d]++] = a[i] ; } // copy back into the original array for (int i = 0; i < N; ++i) { a[i] = aux[i]; } } } // for unit testing of the class public static void main(String[] args) { String[] a = {"Manish", "Joshi", "isa", "ofcourse", "Azb", "Aza", "Really", "Good", "Boy", "Badass"}; int[] arr = {3, -2 , 1, 10 , 20, 0, -1, -100}; LSD.sort(arr); for (int x : arr) { System.out.println(x); } } }
5,357
0.493574
0.477743
163
31.93865
25.476488
129
false
false
0
0
0
0
0
0
0.576687
false
false
2
adaf804d4063bc91d0f4ddaee1aeb84fa98b3337
24,721,831,760,706
a654d568c4257ef4b6dd2a6eaaa8d786719af682
/Biblioteca_Patrones_Software/src/usuarios_factoryMethod/Fabrica.java
5477338b73fbfbb74587868911d191f004bb32a9
[ "MIT" ]
permissive
KevinLiebergen/Practica-final-Patrones-Software
https://github.com/KevinLiebergen/Practica-final-Patrones-Software
c540c88653386bd4c9985ebe5b75bc14aae52dda
356f7d3e60513e06d473f54647645cea015ef6ed
refs/heads/master
2020-04-21T22:27:23.919000
2019-02-11T16:34:09
2019-02-11T16:34:09
169,911,473
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package usuarios_factoryMethod; /** * Creador: clase para crear distintos usuarios. * Se encargara de crear los objetos de usuario * dependiendo de lo que eliga el cliente * * @author kevin van Liebergen */ public class Fabrica { protected String tipo; public Fabrica(String categoria){ tipo = categoria; } /** * Operador ternario (para realizar if-else inline) * para crear un objeto de tipo alumno o profesor * * @return Objeto de tipo alumno o profesor */ public Usuario creaUsuario(){ Usuario usuario; usuario = (tipo.equalsIgnoreCase("alumno")) ? new Alumno() : new Profesor(); return usuario; } }
UTF-8
Java
696
java
Fabrica.java
Java
[ { "context": "pendiendo de lo que eliga el cliente\n *\n * @author kevin van Liebergen\n */\n\npublic class Fabrica {\n\n protected String", "end": 209, "score": 0.9991503357887268, "start": 190, "tag": "NAME", "value": "kevin van Liebergen" } ]
null
[]
package usuarios_factoryMethod; /** * Creador: clase para crear distintos usuarios. * Se encargara de crear los objetos de usuario * dependiendo de lo que eliga el cliente * * @author <NAME> */ public class Fabrica { protected String tipo; public Fabrica(String categoria){ tipo = categoria; } /** * Operador ternario (para realizar if-else inline) * para crear un objeto de tipo alumno o profesor * * @return Objeto de tipo alumno o profesor */ public Usuario creaUsuario(){ Usuario usuario; usuario = (tipo.equalsIgnoreCase("alumno")) ? new Alumno() : new Profesor(); return usuario; } }
683
0.647988
0.647988
31
21.451612
21.585299
84
false
false
0
0
0
0
0
0
0.193548
false
false
2
5c0589fab7f38bbbf1eaa80fabbff3bcb0d363af
26,886,495,325,329
6bd861c92d4e2a8be7d70df02f02ab13d1514a1f
/src/com/echosens/hl7/router/MessageNotSendDueToClientUnreachable.java
7f45c7db8d10ec634711381dd8636adb9dc6af82
[]
no_license
moroccan-dude/hl7broker
https://github.com/moroccan-dude/hl7broker
7bbb623b58d2800f1df8090f3f59cd57f3e4f1b1
75f422f1aafb766a435857ed6b73d8c51a8bf916
refs/heads/master
2016-07-30T02:56:47.972000
2014-09-29T18:53:02
2014-09-29T18:53:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.echosens.hl7.router; public class MessageNotSendDueToClientUnreachable extends Exception { public MessageNotSendDueToClientUnreachable(Exception e) { super(e); } }
UTF-8
Java
183
java
MessageNotSendDueToClientUnreachable.java
Java
[]
null
[]
package com.echosens.hl7.router; public class MessageNotSendDueToClientUnreachable extends Exception { public MessageNotSendDueToClientUnreachable(Exception e) { super(e); } }
183
0.808743
0.803279
9
19.333334
25.880066
69
false
false
0
0
0
0
0
0
0.666667
false
false
2
e49a43d3451c234bd100e1d139a4cbaac98530b1
13,391,708,051,816
5aea483eeeba5490a2f387e798d041a54ae95c35
/kunyao-data/kunyao-data-orm/kunyao-data-mybatis/src/test/java/com/baomidou/ant/user/entity/User.java
d72f73f9a8fd37aeb5041cb2061f0af1aae990d8
[ "Apache-2.0" ]
permissive
yjn8888/kunyao
https://github.com/yjn8888/kunyao
2b8c76bd0a98c1df3e2fd64bcd7465e016103fbd
67973ae725b7cebbc859da195d4f6e45fb41a674
refs/heads/master
2022-07-06T19:21:03.956000
2019-05-05T12:32:13
2019-05-05T12:32:13
149,589,008
0
0
Apache-2.0
false
2022-06-24T02:10:28
2018-09-20T10:00:03
2019-05-05T12:32:41
2022-06-24T02:10:25
333
0
0
4
Java
false
false
package com.baomidou.ant.user.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableField; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * <p> * * </p> * * @author jobob * @since 2019-04-06 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) public class User implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; @TableField("userName") private String userName; private String password; /** * 用户真实姓名或昵称 */ @TableField("trueName") private String trueName; @TableField("roleId") private String roleId; @TableField("roleName") private String roleName; private String auth; @TableField("authName") private String authName; @TableField("createTime") private LocalDateTime createTime; private Integer status; /** * 排序,越大越靠前 */ private Long sequence; /** * 用户类型:1普通用户,100:管理员 */ private Integer type; private String email; /** * 用户头像 */ @TableField("avatarUrl") private String avatarUrl; /** * 0:账号登陆,1:github登陆,2:码云 */ @TableField("loginType") private Integer loginType; /** * 第三方唯一ID */ @TableField("thirdlyId") private String thirdlyId; /** * 密码MD5盐 */ @TableField("passwordSalt") private String passwordSalt; }
UTF-8
Java
1,784
java
User.java
Java
[ { "context": "l.Accessors;\n\n/**\n * <p>\n * \n * </p>\n *\n * @author jobob\n * @since 2019-04-06\n */\n@Data\n@EqualsAndHashCode", "end": 392, "score": 0.9996373057365417, "start": 387, "tag": "USERNAME", "value": "jobob" }, { "context": "e.AUTO)\n private Integer id;\n\n @TableField(\"userName\")\n private String userName;\n\n private Strin", "end": 683, "score": 0.7753292322158813, "start": 675, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.baomidou.ant.user.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableField; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * <p> * * </p> * * @author jobob * @since 2019-04-06 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) public class User implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; @TableField("userName") private String userName; private String password; /** * 用户真实姓名或昵称 */ @TableField("trueName") private String trueName; @TableField("roleId") private String roleId; @TableField("roleName") private String roleName; private String auth; @TableField("authName") private String authName; @TableField("createTime") private LocalDateTime createTime; private Integer status; /** * 排序,越大越靠前 */ private Long sequence; /** * 用户类型:1普通用户,100:管理员 */ private Integer type; private String email; /** * 用户头像 */ @TableField("avatarUrl") private String avatarUrl; /** * 0:账号登陆,1:github登陆,2:码云 */ @TableField("loginType") private Integer loginType; /** * 第三方唯一ID */ @TableField("thirdlyId") private String thirdlyId; /** * 密码MD5盐 */ @TableField("passwordSalt") private String passwordSalt; }
1,784
0.65012
0.639952
94
16.787233
14.929531
54
false
false
0
0
0
0
0
0
0.297872
false
false
2
2ede563f6cee57a806e779113734679245d12d5d
26,834,955,712,508
7330bc962da2e8f13e5fc1f0826e0f40c4c5fcd0
/src/main/java/com/alex/looks/servlets/AdminFullServlet.java
3c15ac52de68f39910be0da89460577d9578d2b9
[]
no_license
microsd002/look
https://github.com/microsd002/look
e021f13a66bff208efcf28ef85f8c049026e4b17
c4145a8345435269ea33b0da1d1bfe85a2ae34de
refs/heads/master
2016-09-05T21:46:22.372000
2015-02-27T22:15:23
2015-02-27T22:15:23
31,438,257
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alex.looks.servlets; import java.io.IOException; import java.io.PrintWriter; import java.util.Enumeration; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.alex.looks.chipher.Encryption; import com.alex.looks.dao.mybatis.MyBatisConnectionFactory; import com.alex.looks.dao.mybatis.MyBatisDAO; import com.alex.looks.models.User; public class AdminFullServlet extends HttpServlet { private static final long serialVersionUID = 1L; MyBatisDAO dao = new MyBatisDAO( MyBatisConnectionFactory.getSqlSessionFactory()); protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); Enumeration<String> l = session.getAttributeNames(); String s; boolean isOk = false; while(l.hasMoreElements()) { if(l.nextElement().equals("status")) { if(session.getAttribute("status").equals("adminfull")){ isOk = true; break; } } } if (!isOk) { session.removeAttribute("status"); session.removeAttribute("fullName"); response.sendRedirect("index.jsp"); return; } else{ if (request.getParameterMap().containsKey("exit")) { session.setAttribute("status", ""); session.setAttribute("fullName", ""); response.sendRedirect("index.jsp"); return; } response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try{ response.setCharacterEncoding("UTF-8"); response.setContentType("text/plain"); String result=""; if (request.getParameter("load").equals("showuser")) { result = newLoad(); } if (request.getParameter("load").equals("newuser")) { String fullname = request.getParameter("three_name") + " " + request.getParameter("first_name") + " " + request.getParameter("second_name"); String tel = request.getParameter("tel"); String username = request.getParameter("username_registration"); String password = request.getParameter("password_registration"); String status = request.getParameter("status"); Encryption md5 = new Encryption(username, password); String hash = md5.encryptionMD5(); User nUser = new User(fullname, tel, status, username, password, hash); dao.insertUser(nUser); nUser = null; result = newLoad(); } if (request.getParameter("load").equals("update")) { String username = request.getParameter("username"); String password = request.getParameter("password"); User us = new User(); us.setUsername(username); us.setPassword(password); System.out.println(us.getUsername() + " "+ us.getPassword()); dao.updateUser(us); result = newLoad(); } if (request.getParameter("load").equals("delete")) { String username = request.getParameter("username"); User us = new User(); us.setUsername(username); dao.deleteUser(us); result = newLoad(); } response.getWriter().write(result); } finally{ out.close(); } } } private String newLoad(){ List<User> listUsers = dao.selectAllUsers(); String result = ""; result += "<br><br>"; result += "<table border=3 align=\"center\" class=\"table sortable\">"; result += "<tr bgcolor=\"#00FFFF\">"; result += "<th align=\"center\">ФИО</th>"; result += "<th align=\"center\">Телефон</th>"; result += "<th align=\"center\">Уровень доступа</th>"; result += "<th align=\"center\">Логин</th>"; result += "<th align=\"center\">Пароль</th>"; result += "<th align=\"center\">Функция</th>"; result += "</tr>"; int n = 0; for(User i : listUsers){ n++; result += "<tr align=\"center\">"; result += "<td><label id=\"fullnametable"+n+"\">"+i.getFullName()+"</label></td>"; result += "<td><label id=\"teltable"+n+"\">"+i.getTel()+"</label></td>"; result += "<td><label id=\"statustable"+n+"\">"+i.getStatus()+"</label></td>"; result += "<td><input type=\"text\" id=\"usernametable"+n+"\" value=\""+i.getUsername()+"\" style=\"font-size : 20px;\" readonly></td>"; result += "<td><input type=\"text\" id=\"passwordtable"+n+"\" value=\""+i.getPassword()+"\" style=\"font-size : 20px;\"></td>"; result += "<td>"; result += "<input type=\"submit\" align=\"middle\" value=\"\" id=\"update"+n+"\" name=\"update\" id='update' class=\"update\" onclick=\"update_delete(this, 'update');\"/>"; result += "<input type=\"submit\" align=\"middle\" value=\"\" id=\"delete"+n+"\" name=\"delete\" id='delete' class=\"delete\" onclick=\"update_delete(this, 'delete');\"/>"; result += "</td>"; result += "</tr>"; } result += "</table>"; return result; } }
WINDOWS-1251
Java
4,989
java
AdminFullServlet.java
Java
[ { "context": "l\");\n\t\t\t\t\tString username = request.getParameter(\"username_registration\");\n\t\t\t\t\tString password = request.getParameter(\"p", "end": 2220, "score": 0.9911705851554871, "start": 2199, "tag": "USERNAME", "value": "username_registration" }, { "context": ")) {\n\t\t\t\t\tString username = request.getParameter(\"username\");\n\t\t\t\t\tString password = request.getParameter(\"p", "end": 2722, "score": 0.9821964502334595, "start": 2714, "tag": "USERNAME", "value": "username" }, { "context": "ameter(\"username\");\n\t\t\t\t\tString password = request.getParameter(\"password\");\n\t\t\t\t\tUser us = new User(", "end": 2756, "score": 0.752591609954834, "start": 2756, "tag": "PASSWORD", "value": "" }, { "context": ");\n\t\t\t\t\tUser us = new User();\n\t\t\t\t\tus.setUsername(username);\n\t\t\t\t\tus.setPassword(password);\n\t\t\t\t\tSystem.out.", "end": 2838, "score": 0.9948186278343201, "start": 2830, "tag": "USERNAME", "value": "username" }, { "context": "\t\t\t\tus.setUsername(username);\n\t\t\t\t\tus.setPassword(password);\n\t\t\t\t\tSystem.out.println(us.getUsername() + \" \"", "end": 2869, "score": 0.9947487711906433, "start": 2861, "tag": "PASSWORD", "value": "password" }, { "context": ")) {\n\t\t\t\t\tString username = request.getParameter(\"username\");\n\t\t\t\t\tUser us = new User();\n\t\t\t\t\tus.setUsername", "end": 3107, "score": 0.9500619173049927, "start": 3099, "tag": "USERNAME", "value": "username" }, { "context": ");\n\t\t\t\t\tUser us = new User();\n\t\t\t\t\tus.setUsername(username);\n\t\t\t\t\tdao.deleteUser(us);\n\t\t\t\t\tresult = newLoad(", "end": 3166, "score": 0.9228150844573975, "start": 3158, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.alex.looks.servlets; import java.io.IOException; import java.io.PrintWriter; import java.util.Enumeration; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.alex.looks.chipher.Encryption; import com.alex.looks.dao.mybatis.MyBatisConnectionFactory; import com.alex.looks.dao.mybatis.MyBatisDAO; import com.alex.looks.models.User; public class AdminFullServlet extends HttpServlet { private static final long serialVersionUID = 1L; MyBatisDAO dao = new MyBatisDAO( MyBatisConnectionFactory.getSqlSessionFactory()); protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); Enumeration<String> l = session.getAttributeNames(); String s; boolean isOk = false; while(l.hasMoreElements()) { if(l.nextElement().equals("status")) { if(session.getAttribute("status").equals("adminfull")){ isOk = true; break; } } } if (!isOk) { session.removeAttribute("status"); session.removeAttribute("fullName"); response.sendRedirect("index.jsp"); return; } else{ if (request.getParameterMap().containsKey("exit")) { session.setAttribute("status", ""); session.setAttribute("fullName", ""); response.sendRedirect("index.jsp"); return; } response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try{ response.setCharacterEncoding("UTF-8"); response.setContentType("text/plain"); String result=""; if (request.getParameter("load").equals("showuser")) { result = newLoad(); } if (request.getParameter("load").equals("newuser")) { String fullname = request.getParameter("three_name") + " " + request.getParameter("first_name") + " " + request.getParameter("second_name"); String tel = request.getParameter("tel"); String username = request.getParameter("username_registration"); String password = request.getParameter("password_registration"); String status = request.getParameter("status"); Encryption md5 = new Encryption(username, password); String hash = md5.encryptionMD5(); User nUser = new User(fullname, tel, status, username, password, hash); dao.insertUser(nUser); nUser = null; result = newLoad(); } if (request.getParameter("load").equals("update")) { String username = request.getParameter("username"); String password = request.getParameter("password"); User us = new User(); us.setUsername(username); us.setPassword(<PASSWORD>); System.out.println(us.getUsername() + " "+ us.getPassword()); dao.updateUser(us); result = newLoad(); } if (request.getParameter("load").equals("delete")) { String username = request.getParameter("username"); User us = new User(); us.setUsername(username); dao.deleteUser(us); result = newLoad(); } response.getWriter().write(result); } finally{ out.close(); } } } private String newLoad(){ List<User> listUsers = dao.selectAllUsers(); String result = ""; result += "<br><br>"; result += "<table border=3 align=\"center\" class=\"table sortable\">"; result += "<tr bgcolor=\"#00FFFF\">"; result += "<th align=\"center\">ФИО</th>"; result += "<th align=\"center\">Телефон</th>"; result += "<th align=\"center\">Уровень доступа</th>"; result += "<th align=\"center\">Логин</th>"; result += "<th align=\"center\">Пароль</th>"; result += "<th align=\"center\">Функция</th>"; result += "</tr>"; int n = 0; for(User i : listUsers){ n++; result += "<tr align=\"center\">"; result += "<td><label id=\"fullnametable"+n+"\">"+i.getFullName()+"</label></td>"; result += "<td><label id=\"teltable"+n+"\">"+i.getTel()+"</label></td>"; result += "<td><label id=\"statustable"+n+"\">"+i.getStatus()+"</label></td>"; result += "<td><input type=\"text\" id=\"usernametable"+n+"\" value=\""+i.getUsername()+"\" style=\"font-size : 20px;\" readonly></td>"; result += "<td><input type=\"text\" id=\"passwordtable"+n+"\" value=\""+i.getPassword()+"\" style=\"font-size : 20px;\"></td>"; result += "<td>"; result += "<input type=\"submit\" align=\"middle\" value=\"\" id=\"update"+n+"\" name=\"update\" id='update' class=\"update\" onclick=\"update_delete(this, 'update');\"/>"; result += "<input type=\"submit\" align=\"middle\" value=\"\" id=\"delete"+n+"\" name=\"delete\" id='delete' class=\"delete\" onclick=\"update_delete(this, 'delete');\"/>"; result += "</td>"; result += "</tr>"; } result += "</table>"; return result; } }
4,991
0.64342
0.64059
146
32.88356
32.221729
175
false
false
0
0
0
0
0
0
3.458904
false
false
2
c0b7b92a08f41445af0a84b04370dc1214eba022
26,834,955,715,220
19daba3f6c050b90f5bfb193dce1eacd2dba249f
/src/main/java/org/jpc/engine/profile/LogtalkEngineProfile.java
6abaf7c100350d8f45e3ba8ebaf0ce46f46f8ddf
[ "Apache-2.0" ]
permissive
java-prolog-connectivity/jpc
https://github.com/java-prolog-connectivity/jpc
aaa5a12190761b0ce2395089baa9c5492b527542
d92911131e7450a83a00120c07c2b78df6c53a91
refs/heads/master
2021-06-02T01:42:31.301000
2018-02-18T21:46:43
2018-02-18T21:46:43
6,571,446
7
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.jpc.engine.profile; import org.jpc.engine.prolog.PrologEngine; import org.jpc.engine.prolog.driver.PrologEngineFactory; public class LogtalkEngineProfile<T extends PrologEngine> extends PrologEngineProfile<T> { public LogtalkEngineProfile(PrologEngineFactory<T> engineFactory) { super(engineFactory); } @Override public void onCreate(T newPrologEngine) { newPrologEngine.withLogtalk(); } }
UTF-8
Java
418
java
LogtalkEngineProfile.java
Java
[]
null
[]
package org.jpc.engine.profile; import org.jpc.engine.prolog.PrologEngine; import org.jpc.engine.prolog.driver.PrologEngineFactory; public class LogtalkEngineProfile<T extends PrologEngine> extends PrologEngineProfile<T> { public LogtalkEngineProfile(PrologEngineFactory<T> engineFactory) { super(engineFactory); } @Override public void onCreate(T newPrologEngine) { newPrologEngine.withLogtalk(); } }
418
0.799043
0.799043
17
23.588236
27.174942
90
false
false
0
0
0
0
0
0
0.941176
false
false
2
a2e959530716e5ad200218245dbb7b9553cbc28e
11,038,065,959,086
44bca90f3ab9755a8666533a16f0fad71032a78a
/hostelbrum/source/HostelBrumMobile/HostelBrumMobile/src/br/edu/unibratec/hostelbrummobile/bussines/ControladorPush.java
48382f2049617f9974a7a28b3bd7578f8a9179b8
[]
no_license
tectronics/the-last-battle
https://github.com/tectronics/the-last-battle
8bb6cb34bc54ef4f59f79e5a785a1e5069f71236
19290e6ea107f68754895841933937aa0fe42ec2
refs/heads/master
2018-01-11T15:03:12.930000
2013-12-05T03:10:55
2013-12-05T03:10:55
48,789,579
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.edu.unibratec.hostelbrummobile.bussines; import java.util.List; import br.edu.unibratec.hostelbrummobile.ApplicationContextProvider; import br.edu.unibratec.hostelbrummobile.PushActivity; import br.edu.unibratec.hostelbrummobile.bussines.GlobalVariables; import br.edu.unibratec.hostelbrummobile.exceptions.PushException; import com.netmera.mobile.Netmera; import com.netmera.mobile.NetmeraDeviceDetail; import com.netmera.mobile.NetmeraException; import com.netmera.mobile.NetmeraPushService; public class ControladorPush { // Context context; // public ControladorPush(Context context) { // this.context = context; // } public ControladorPush() { } private boolean registered; // Registration status of the device public String cadastrarPush(List<String> tags) throws PushException { String retorno = ""; Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); try { retorno = "1"; // NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail( // ApplicationContextProvider.getContext(), // GlobalVariables.projectId, PushActivity.class); NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail(ApplicationContextProvider.getContext(), GlobalVariables.projectId, PushActivity.class); deviceDetail.setTags(tags); NetmeraPushService.register(deviceDetail); } catch (NetmeraException e) { e.printStackTrace(); throw new PushException(); } showPage(); return retorno; } //public String descadastrarPush(String tag) throws PushException { // public String descadastrarPush(List<String> tag) throws PushException { // String retorno = ""; // Netmera.init(ApplicationContextProvider.getContext(), // GlobalVariables.apiKey); // //if (registered) { // // If registered to the service, unregister from it // NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail( // ApplicationContextProvider.getContext(), // GlobalVariables.projectId, PushActivity.class); // NetmeraPushService.unregister(deviceDetail); // retorno = "1"; // //// NetmeraPushService.unregister(ApplicationContextProvider.getContext()); //// //// List<String> tags = descadastrarTag(tag); //// if ((tags != null) && (tags.size() > 0)){ //// cadastrarPush(tags); //// } // // //} else { // // If not show an error toast // // retorno = "2"; // //} // showPage(); // return retorno; // } //public List<String> descadastrarPush(String tag) throws PushException { public void descadastrarTag(String tag) { Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail(ApplicationContextProvider.getContext(), GlobalVariables.projectId, PushActivity.class); deviceDetail.addTag(tag); NetmeraPushService.unregister(deviceDetail); } private void showPage() { registered = NetmeraPushService.isRegistered(ApplicationContextProvider .getContext()); } // public boolean dispositivoCadastrado(String tag) throws PushException { // boolean cadastrado = false; // Netmera.init(ApplicationContextProvider.getContext(), // GlobalVariables.apiKey); // // ArrayList<String> tags; // try { // tags = (ArrayList<String>) NetmeraPushService.getTags(); // for (int i = 0; i < tags.size(); i++) { // if (tags.get(i).equals(tag)){ // cadastrado = true; // break; // } // // } // } catch (NetmeraException e) { // throw new PushException(); // } // // //return cadastrado; // return false; // // } // public List<String> descadastrarTag(String tag) throws PushException { // Netmera.init(ApplicationContextProvider.getContext(), // GlobalVariables.apiKey); // // ArrayList<String> tags; // try { // tags = (ArrayList<String>) NetmeraPushService.getTags(); // for (int i = 0; i < tags.size(); i++) { // if (tags.get(i).equals(tag)){ // tags.remove(i); // break; // } // // } // } catch (NetmeraException e) { // throw new PushException(); // } // // return tags; // // } public void descadastrarDispositivo() { Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail(ApplicationContextProvider.getContext(), GlobalVariables.projectId, PushActivity.class); NetmeraPushService.unregister(ApplicationContextProvider.getContext()); } public boolean isDispositivoCadastrado(String tag) { boolean cadastrado = false; Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); NetmeraDeviceDetail deviceDetail; try { deviceDetail = NetmeraPushService.getDeviceDetail(ApplicationContextProvider.getContext()); List<String> tagsCadastradas = deviceDetail.getTags(); for (int i = 0; i < tagsCadastradas.size(); i++) { if (tagsCadastradas.get(i).equals(tag)){ cadastrado = true; break; } } } catch (NetmeraException e) { // TODO Auto-generated catch block e.printStackTrace(); } return cadastrado; } }
UTF-8
Java
5,286
java
ControladorPush.java
Java
[]
null
[]
package br.edu.unibratec.hostelbrummobile.bussines; import java.util.List; import br.edu.unibratec.hostelbrummobile.ApplicationContextProvider; import br.edu.unibratec.hostelbrummobile.PushActivity; import br.edu.unibratec.hostelbrummobile.bussines.GlobalVariables; import br.edu.unibratec.hostelbrummobile.exceptions.PushException; import com.netmera.mobile.Netmera; import com.netmera.mobile.NetmeraDeviceDetail; import com.netmera.mobile.NetmeraException; import com.netmera.mobile.NetmeraPushService; public class ControladorPush { // Context context; // public ControladorPush(Context context) { // this.context = context; // } public ControladorPush() { } private boolean registered; // Registration status of the device public String cadastrarPush(List<String> tags) throws PushException { String retorno = ""; Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); try { retorno = "1"; // NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail( // ApplicationContextProvider.getContext(), // GlobalVariables.projectId, PushActivity.class); NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail(ApplicationContextProvider.getContext(), GlobalVariables.projectId, PushActivity.class); deviceDetail.setTags(tags); NetmeraPushService.register(deviceDetail); } catch (NetmeraException e) { e.printStackTrace(); throw new PushException(); } showPage(); return retorno; } //public String descadastrarPush(String tag) throws PushException { // public String descadastrarPush(List<String> tag) throws PushException { // String retorno = ""; // Netmera.init(ApplicationContextProvider.getContext(), // GlobalVariables.apiKey); // //if (registered) { // // If registered to the service, unregister from it // NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail( // ApplicationContextProvider.getContext(), // GlobalVariables.projectId, PushActivity.class); // NetmeraPushService.unregister(deviceDetail); // retorno = "1"; // //// NetmeraPushService.unregister(ApplicationContextProvider.getContext()); //// //// List<String> tags = descadastrarTag(tag); //// if ((tags != null) && (tags.size() > 0)){ //// cadastrarPush(tags); //// } // // //} else { // // If not show an error toast // // retorno = "2"; // //} // showPage(); // return retorno; // } //public List<String> descadastrarPush(String tag) throws PushException { public void descadastrarTag(String tag) { Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail(ApplicationContextProvider.getContext(), GlobalVariables.projectId, PushActivity.class); deviceDetail.addTag(tag); NetmeraPushService.unregister(deviceDetail); } private void showPage() { registered = NetmeraPushService.isRegistered(ApplicationContextProvider .getContext()); } // public boolean dispositivoCadastrado(String tag) throws PushException { // boolean cadastrado = false; // Netmera.init(ApplicationContextProvider.getContext(), // GlobalVariables.apiKey); // // ArrayList<String> tags; // try { // tags = (ArrayList<String>) NetmeraPushService.getTags(); // for (int i = 0; i < tags.size(); i++) { // if (tags.get(i).equals(tag)){ // cadastrado = true; // break; // } // // } // } catch (NetmeraException e) { // throw new PushException(); // } // // //return cadastrado; // return false; // // } // public List<String> descadastrarTag(String tag) throws PushException { // Netmera.init(ApplicationContextProvider.getContext(), // GlobalVariables.apiKey); // // ArrayList<String> tags; // try { // tags = (ArrayList<String>) NetmeraPushService.getTags(); // for (int i = 0; i < tags.size(); i++) { // if (tags.get(i).equals(tag)){ // tags.remove(i); // break; // } // // } // } catch (NetmeraException e) { // throw new PushException(); // } // // return tags; // // } public void descadastrarDispositivo() { Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail(ApplicationContextProvider.getContext(), GlobalVariables.projectId, PushActivity.class); NetmeraPushService.unregister(ApplicationContextProvider.getContext()); } public boolean isDispositivoCadastrado(String tag) { boolean cadastrado = false; Netmera.init(ApplicationContextProvider.getContext(), GlobalVariables.apiKey); NetmeraDeviceDetail deviceDetail; try { deviceDetail = NetmeraPushService.getDeviceDetail(ApplicationContextProvider.getContext()); List<String> tagsCadastradas = deviceDetail.getTags(); for (int i = 0; i < tagsCadastradas.size(); i++) { if (tagsCadastradas.get(i).equals(tag)){ cadastrado = true; break; } } } catch (NetmeraException e) { // TODO Auto-generated catch block e.printStackTrace(); } return cadastrado; } }
5,286
0.682747
0.681423
176
28.03409
28.039724
151
false
false
0
0
0
0
0
0
2.801136
false
false
2
e3167ed4a0c3bcb75ba10d11fa72f555b830bdb4
3,058,016,733,053
4092062475a36cc1105e8958dc13526deb41f148
/JCL_Android/app/src/main/java/implementations/util/android/AndroidSensor.java
ad25fd610fc0417092b87dc5fe9ede4fb4502992
[ "Apache-2.0" ]
permissive
AndreJCL/JCL
https://github.com/AndreJCL/JCL
30f8aea1b02f15127b88e2ce13a17223f9f25e1f
46dfbe38f6766e92a0825eb783086dc374c6dc2d
refs/heads/master
2021-01-19T22:10:55.988000
2020-02-13T19:02:22
2020-02-13T19:02:22
69,570,756
7
4
null
null
null
null
null
null
null
null
null
null
null
null
null
package implementations.util.android; import sensor.JCL_Sensor; /** * Created by estevao on 03/03/17. */ public class AndroidSensor { private String name; private String size; private String participation; private String delay; private String audioTime; private int id; public AndroidSensor(int id, String name, String size, String participation, String delay, String audioTime) { this.name = name; this.size = size; this.participation = participation; this.delay = delay; this.audioTime = audioTime; this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public String getParticipation() { return participation; } public void setParticipation(String participation) { this.participation = participation; } public String getDelay() { return delay; } public void setDelay(String delay) { this.delay = delay; } public String getAudioTime() { return audioTime; } public void setAudioTime(String audioTime) { this.audioTime = audioTime; } public int getId() { return id; } public void setId(int id) { this.id = id; } }
UTF-8
Java
1,458
java
AndroidSensor.java
Java
[ { "context": "oid;\n\nimport sensor.JCL_Sensor;\n\n/**\n * Created by estevao on 03/03/17.\n */\n\npublic class AndroidSensor {\n ", "end": 91, "score": 0.9992397427558899, "start": 84, "tag": "USERNAME", "value": "estevao" } ]
null
[]
package implementations.util.android; import sensor.JCL_Sensor; /** * Created by estevao on 03/03/17. */ public class AndroidSensor { private String name; private String size; private String participation; private String delay; private String audioTime; private int id; public AndroidSensor(int id, String name, String size, String participation, String delay, String audioTime) { this.name = name; this.size = size; this.participation = participation; this.delay = delay; this.audioTime = audioTime; this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public String getParticipation() { return participation; } public void setParticipation(String participation) { this.participation = participation; } public String getDelay() { return delay; } public void setDelay(String delay) { this.delay = delay; } public String getAudioTime() { return audioTime; } public void setAudioTime(String audioTime) { this.audioTime = audioTime; } public int getId() { return id; } public void setId(int id) { this.id = id; } }
1,458
0.604252
0.600137
74
18.702703
18.788818
114
false
false
0
0
0
0
0
0
0.418919
false
false
2
21c0f77063a47e80baf1bc20ad282950e8cdf1f2
7,189,775,305,205
0b8cea436b4de7f8e54bb8e18905d60a37a2c836
/app/src/main/java/im/tox/antox/callbacks/AntoxOnFriendRequestCallback.java
93b640b779d0af77f7d14aca42478f8e6dd74c0f
[]
no_license
DeX77/Antox
https://github.com/DeX77/Antox
ea87a9134b002c72ec8abcca5c48932804692b7c
56590b8583b70c3ac8ca7cb0506b74b74d72efbd
refs/heads/master
2021-01-21T07:38:46.722000
2014-03-04T18:25:09
2014-03-04T18:25:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package im.tox.antox.callbacks; import android.content.Context; import android.content.Intent; import android.util.Log; import im.tox.antox.Constants; import im.tox.antox.ToxService; import im.tox.jtoxcore.callbacks.OnFriendRequestCallback; /** * Created by soft on 02/03/14. */ public class AntoxOnFriendRequestCallback implements OnFriendRequestCallback { private static final String TAG = "im.tox.antox.TAG"; public static final String FRIEND_KEY = "im.tox.antox.FRIEND_KEY"; public static final String FRIEND_MESSAGE = "im.tox.antox.FRIEND_MESSAGE"; private Context ctx; public AntoxOnFriendRequestCallback(Context ctx) { this.ctx = ctx; } @Override public void execute(String publicKey, String message){ Log.d(TAG, "Friend request callback"); Intent intent = new Intent(this.ctx, ToxService.class); intent.setAction(Constants.FRIEND_REQUEST); intent.putExtra(FRIEND_KEY, publicKey); intent.putExtra(FRIEND_MESSAGE, message); this.ctx.startService(intent); } }
UTF-8
Java
1,067
java
AntoxOnFriendRequestCallback.java
Java
[ { "context": "lbacks.OnFriendRequestCallback;\n\n/**\n * Created by soft on 02/03/14.\n */\npublic class AntoxOnFriendReques", "end": 266, "score": 0.9963761568069458, "start": 262, "tag": "USERNAME", "value": "soft" }, { "context": "AG\";\n public static final String FRIEND_KEY = \"im.tox.antox.FRIEND_KEY\";\n public static final String FRIEND_MESSAGE =", "end": 490, "score": 0.9982104301452637, "start": 467, "tag": "KEY", "value": "im.tox.antox.FRIEND_KEY" } ]
null
[]
package im.tox.antox.callbacks; import android.content.Context; import android.content.Intent; import android.util.Log; import im.tox.antox.Constants; import im.tox.antox.ToxService; import im.tox.jtoxcore.callbacks.OnFriendRequestCallback; /** * Created by soft on 02/03/14. */ public class AntoxOnFriendRequestCallback implements OnFriendRequestCallback { private static final String TAG = "im.tox.antox.TAG"; public static final String FRIEND_KEY = "im.tox.antox.FRIEND_KEY"; public static final String FRIEND_MESSAGE = "im.tox.antox.FRIEND_MESSAGE"; private Context ctx; public AntoxOnFriendRequestCallback(Context ctx) { this.ctx = ctx; } @Override public void execute(String publicKey, String message){ Log.d(TAG, "Friend request callback"); Intent intent = new Intent(this.ctx, ToxService.class); intent.setAction(Constants.FRIEND_REQUEST); intent.putExtra(FRIEND_KEY, publicKey); intent.putExtra(FRIEND_MESSAGE, message); this.ctx.startService(intent); } }
1,067
0.718838
0.713215
36
28.638889
25.067856
78
false
false
0
0
0
0
0
0
0.638889
false
false
2
d872d357924846e6a180208d4b006cf72fed382e
32,710,470,988,585
5ab65dce4d4b15dfba4935a4b6402da6636a67eb
/app/src/main/java/com/if1001exemplo1/tccvaseguro/Pessoa.java
9ad91e5faa0c7d581497a4055e41e7db0d56eaa5
[]
no_license
alessandroliver/DestinoSeguro
https://github.com/alessandroliver/DestinoSeguro
a62f2ef855b798f9401ec2ca367ad2d1864f42cb
25598d6c3c342ba9bbd61d2f433f32e05e117012
refs/heads/master
2021-09-16T14:00:09.790000
2018-06-21T14:53:34
2018-06-21T14:53:34
111,248,570
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.if1001exemplo1.tccvaseguro; import java.util.Date; public class Pessoa { private String nome; private String sobrenome; private String cidade; private String uf; private String email; private String sexo; private Date nascimento; private int numeroCelular; private String operadora; private String nacionalidade; private double cep; public Pessoa(String nome, String sobrenome, String email, String cidade, String uf, String sexo, Date nascimento, int numero_celular, String operadora, String nacionalidade, double cep) { this. nome = nome; this. sobrenome = sobrenome; this.email = email; this.cidade = cidade; this.uf = uf; this.sexo = sexo; this.nascimento = nascimento; this.numeroCelular = numero_celular; this.operadora = operadora; this.nacionalidade = nacionalidade; this.cep = cep; } public double getCep() { return cep; } public void setCep(double cep) { this.cep = cep; } public String getNome() { return nome; } public String getSobrenome() { return sobrenome; } public String getSexo() { return sexo; } public String getEmail() { return email; } public Date getNascimento() { return nascimento; } public int getNumeroCelular() { return numeroCelular; } public String getCidade() { return cidade; } public String getOperadora() { return operadora; } public String getUf() { return uf; } public String getNacionalidade() { return nacionalidade; } public void setCidade(String cidade) { this.cidade = cidade; } public void setEmail(String email) { this.email = email; } public void setNascimento(Date nascimento) { this.nascimento = nascimento; } public void setNome(String nome) { this.nome = nome; } public void setNumeroCelular(int numeroCelular) { this.numeroCelular = numeroCelular; } public void setOperadora(String operadora) { this.operadora = operadora; } public void setSexo(String sexo) { this.sexo = sexo; } public void setSobrenome(String sobrenome) { this.sobrenome = sobrenome; } public void setUf(String uf) { this.uf = uf; } public void setNacionalidade(String nacionalidade) { this.nacionalidade = nacionalidade; } }
UTF-8
Java
2,579
java
Pessoa.java
Java
[ { "context": "{\n\n private String nome;\n private String sobrenome;\n private String cidade;\n private String", "end": 138, "score": 0.7390095591545105, "start": 135, "tag": "NAME", "value": "ren" }, { "context": "le cep;\n\n public Pessoa(String nome, String sobrenome, String email, String cidade, String uf, Strin", "end": 437, "score": 0.621842622756958, "start": 434, "tag": "NAME", "value": "ren" }, { "context": " this. nome = nome;\n this. sobrenome = sobrenome;\n this.email = email;\n this.cidade ", "end": 649, "score": 0.9177660942077637, "start": 640, "tag": "NAME", "value": "sobrenome" } ]
null
[]
package com.if1001exemplo1.tccvaseguro; import java.util.Date; public class Pessoa { private String nome; private String sobrenome; private String cidade; private String uf; private String email; private String sexo; private Date nascimento; private int numeroCelular; private String operadora; private String nacionalidade; private double cep; public Pessoa(String nome, String sobrenome, String email, String cidade, String uf, String sexo, Date nascimento, int numero_celular, String operadora, String nacionalidade, double cep) { this. nome = nome; this. sobrenome = sobrenome; this.email = email; this.cidade = cidade; this.uf = uf; this.sexo = sexo; this.nascimento = nascimento; this.numeroCelular = numero_celular; this.operadora = operadora; this.nacionalidade = nacionalidade; this.cep = cep; } public double getCep() { return cep; } public void setCep(double cep) { this.cep = cep; } public String getNome() { return nome; } public String getSobrenome() { return sobrenome; } public String getSexo() { return sexo; } public String getEmail() { return email; } public Date getNascimento() { return nascimento; } public int getNumeroCelular() { return numeroCelular; } public String getCidade() { return cidade; } public String getOperadora() { return operadora; } public String getUf() { return uf; } public String getNacionalidade() { return nacionalidade; } public void setCidade(String cidade) { this.cidade = cidade; } public void setEmail(String email) { this.email = email; } public void setNascimento(Date nascimento) { this.nascimento = nascimento; } public void setNome(String nome) { this.nome = nome; } public void setNumeroCelular(int numeroCelular) { this.numeroCelular = numeroCelular; } public void setOperadora(String operadora) { this.operadora = operadora; } public void setSexo(String sexo) { this.sexo = sexo; } public void setSobrenome(String sobrenome) { this.sobrenome = sobrenome; } public void setUf(String uf) { this.uf = uf; } public void setNacionalidade(String nacionalidade) { this.nacionalidade = nacionalidade; } }
2,579
0.612253
0.610314
122
20.131147
22.170336
192
false
false
0
0
0
0
0
0
0.459016
false
false
2
7ebcb058af3ee79413ddb26599c17605d6a7eb0b
1,391,569,417,065
8dc49f037b885dae5f198d625129c96edce2bc1e
/study/bill/com/mysql/jdbc/BlobFromLocator.java
ddd43af78d96a1bfd0235c730244c40d0befcd2c
[]
no_license
Dlyyy/javaproject
https://github.com/Dlyyy/javaproject
65460e0d281f017a346776f3f4b6efff6b284642
0d37584bf1b3fb4302afbe9571850a7c7f70a11a
refs/heads/master
2020-04-10T21:33:09.102000
2019-01-26T01:33:20
2019-01-26T01:33:20
161,299,205
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* */ package com.mysql.jdbc; /* */ /* */ import java.io.BufferedInputStream; /* */ import java.io.IOException; /* */ import java.io.InputStream; /* */ import java.io.OutputStream; /* */ import java.sql.Blob; /* */ import java.sql.DatabaseMetaData; /* */ import java.sql.PreparedStatement; /* */ import java.sql.SQLException; /* */ import java.util.ArrayList; /* */ import java.util.List; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class BlobFromLocator /* */ implements Blob /* */ { /* 55 */ private List primaryKeyColumns = null; /* */ /* 57 */ private List primaryKeyValues = null; /* */ /* */ /* */ private ResultSet creatorResultSet; /* */ /* 62 */ private String blobColumnName = null; /* */ /* 64 */ private String tableName = null; /* */ /* 66 */ private int numColsInResultSet = 0; /* */ /* 68 */ private int numPrimaryKeys = 0; /* */ /* */ /* */ private String quotedId; /* */ /* */ /* */ BlobFromLocator(ResultSet creatorResultSetToSet, int blobColumnIndex) /* */ throws SQLException /* */ { /* 77 */ this.creatorResultSet = creatorResultSetToSet; /* */ /* 79 */ this.numColsInResultSet = this.creatorResultSet.fields.length; /* 80 */ this.quotedId = this.creatorResultSet.connection.getMetaData().getIdentifierQuoteString(); /* */ /* */ /* 83 */ if (this.numColsInResultSet > 1) { /* 84 */ this.primaryKeyColumns = new ArrayList(); /* 85 */ this.primaryKeyValues = new ArrayList(); /* */ /* 87 */ for (int i = 0; i < this.numColsInResultSet; i++) { /* 88 */ if (this.creatorResultSet.fields[i].isPrimaryKey()) { /* 89 */ StringBuffer keyName = new StringBuffer(); /* 90 */ keyName.append(this.quotedId); /* */ /* 92 */ String originalColumnName = this.creatorResultSet.fields[i].getOriginalName(); /* */ /* */ /* 95 */ if ((originalColumnName != null) && (originalColumnName.length() > 0)) /* */ { /* 97 */ keyName.append(originalColumnName); /* */ } else { /* 99 */ keyName.append(this.creatorResultSet.fields[i].getName()); /* */ } /* */ /* */ /* 103 */ keyName.append(this.quotedId); /* */ /* 105 */ this.primaryKeyColumns.add(keyName.toString()); /* 106 */ this.primaryKeyValues.add(this.creatorResultSet.getString(i + 1)); /* */ } /* */ } /* */ } /* */ else { /* 111 */ notEnoughInformationInQuery(); /* */ } /* */ /* 114 */ this.numPrimaryKeys = this.primaryKeyColumns.size(); /* */ /* 116 */ if (this.numPrimaryKeys == 0) { /* 117 */ notEnoughInformationInQuery(); /* */ } /* */ /* 120 */ if (this.creatorResultSet.fields[0].getOriginalTableName() != null) { /* 121 */ StringBuffer tableNameBuffer = new StringBuffer(); /* */ /* 123 */ String databaseName = this.creatorResultSet.fields[0].getDatabaseName(); /* */ /* */ /* 126 */ if ((databaseName != null) && (databaseName.length() > 0)) { /* 127 */ tableNameBuffer.append(this.quotedId); /* 128 */ tableNameBuffer.append(databaseName); /* 129 */ tableNameBuffer.append(this.quotedId); /* 130 */ tableNameBuffer.append('.'); /* */ } /* */ /* 133 */ tableNameBuffer.append(this.quotedId); /* 134 */ tableNameBuffer.append(this.creatorResultSet.fields[0].getOriginalTableName()); /* */ /* 136 */ tableNameBuffer.append(this.quotedId); /* */ /* 138 */ this.tableName = tableNameBuffer.toString(); /* */ } else { /* 140 */ StringBuffer tableNameBuffer = new StringBuffer(); /* */ /* 142 */ tableNameBuffer.append(this.quotedId); /* 143 */ tableNameBuffer.append(this.creatorResultSet.fields[0].getTableName()); /* */ /* 145 */ tableNameBuffer.append(this.quotedId); /* */ /* 147 */ this.tableName = tableNameBuffer.toString(); /* */ } /* */ /* 150 */ this.blobColumnName = (this.quotedId + this.creatorResultSet.getString(blobColumnIndex) + this.quotedId); /* */ } /* */ /* */ private void notEnoughInformationInQuery() throws SQLException /* */ { /* 155 */ throw SQLError.createSQLException("Emulated BLOB locators must come from a ResultSet with only one table selected, and all primary keys selected", "S1000"); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public OutputStream setBinaryStream(long indexToWriteAt) /* */ throws SQLException /* */ { /* 165 */ throw new NotImplemented(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public InputStream getBinaryStream() /* */ throws SQLException /* */ { /* 178 */ return new BufferedInputStream(new LocatorInputStream(), this.creatorResultSet.connection.getLocatorFetchBufferSize()); /* */ } /* */ /* */ /* */ /* */ /* */ public int setBytes(long writeAt, byte[] bytes, int offset, int length) /* */ throws SQLException /* */ { /* 187 */ PreparedStatement pStmt = null; /* */ /* 189 */ if (offset + length > bytes.length) { /* 190 */ length = bytes.length - offset; /* */ } /* */ /* 193 */ byte[] bytesToWrite = new byte[length]; /* 194 */ System.arraycopy(bytes, offset, bytesToWrite, 0, length); /* */ /* */ /* 197 */ StringBuffer query = new StringBuffer("UPDATE "); /* 198 */ query.append(this.tableName); /* 199 */ query.append(" SET "); /* 200 */ query.append(this.blobColumnName); /* 201 */ query.append(" = INSERT("); /* 202 */ query.append(this.blobColumnName); /* 203 */ query.append(", "); /* 204 */ query.append(writeAt); /* 205 */ query.append(", "); /* 206 */ query.append(length); /* 207 */ query.append(", ?) WHERE "); /* */ /* 209 */ query.append((String)this.primaryKeyColumns.get(0)); /* 210 */ query.append(" = ?"); /* */ /* 212 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 213 */ query.append(" AND "); /* 214 */ query.append((String)this.primaryKeyColumns.get(i)); /* 215 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 220 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* */ /* 223 */ pStmt.setBytes(1, bytesToWrite); /* */ /* 225 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 226 */ pStmt.setString(i + 2, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 229 */ int rowsUpdated = pStmt.executeUpdate(); /* */ /* 231 */ if (rowsUpdated != 1) { /* 232 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ } /* */ finally /* */ { /* 237 */ if (pStmt != null) { /* */ try { /* 239 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 244 */ pStmt = null; /* */ } /* */ } /* */ /* 248 */ return (int)length(); /* */ } /* */ /* */ /* */ public int setBytes(long writeAt, byte[] bytes) /* */ throws SQLException /* */ { /* 255 */ return setBytes(writeAt, bytes, 0, bytes.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public byte[] getBytes(long pos, int length) /* */ throws SQLException /* */ { /* 274 */ PreparedStatement pStmt = null; /* */ /* */ try /* */ { /* 278 */ pStmt = createGetBytesStatement(); /* */ /* 280 */ return getBytesInternal(pStmt, pos, length); /* */ } finally { /* 282 */ if (pStmt != null) { /* */ try { /* 284 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 289 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public long length() /* */ throws SQLException /* */ { /* 304 */ java.sql.ResultSet blobRs = null; /* 305 */ PreparedStatement pStmt = null; /* */ /* */ /* 308 */ StringBuffer query = new StringBuffer("SELECT LENGTH("); /* 309 */ query.append(this.blobColumnName); /* 310 */ query.append(") FROM "); /* 311 */ query.append(this.tableName); /* 312 */ query.append(" WHERE "); /* */ /* 314 */ query.append((String)this.primaryKeyColumns.get(0)); /* 315 */ query.append(" = ?"); /* */ /* 317 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 318 */ query.append(" AND "); /* 319 */ query.append((String)this.primaryKeyColumns.get(i)); /* 320 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 325 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* */ /* 328 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 329 */ pStmt.setString(i + 1, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 332 */ blobRs = pStmt.executeQuery(); /* */ /* 334 */ if (blobRs.next()) { /* 335 */ return blobRs.getLong(1); /* */ } /* */ /* 338 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ finally /* */ { /* 342 */ if (blobRs != null) { /* */ try { /* 344 */ blobRs.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 349 */ blobRs = null; /* */ } /* */ /* 352 */ if (pStmt != null) { /* */ try { /* 354 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 359 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public long position(Blob pattern, long start) /* */ throws SQLException /* */ { /* 379 */ return position(pattern.getBytes(0L, (int)pattern.length()), start); /* */ } /* */ /* */ /* */ public long position(byte[] pattern, long start) /* */ throws SQLException /* */ { /* 386 */ java.sql.ResultSet blobRs = null; /* 387 */ PreparedStatement pStmt = null; /* */ /* */ /* 390 */ StringBuffer query = new StringBuffer("SELECT LOCATE("); /* 391 */ query.append("?, "); /* 392 */ query.append(this.blobColumnName); /* 393 */ query.append(", "); /* 394 */ query.append(start); /* 395 */ query.append(") FROM "); /* 396 */ query.append(this.tableName); /* 397 */ query.append(" WHERE "); /* */ /* 399 */ query.append((String)this.primaryKeyColumns.get(0)); /* 400 */ query.append(" = ?"); /* */ /* 402 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 403 */ query.append(" AND "); /* 404 */ query.append((String)this.primaryKeyColumns.get(i)); /* 405 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 410 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* 412 */ pStmt.setBytes(1, pattern); /* */ /* 414 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 415 */ pStmt.setString(i + 2, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 418 */ blobRs = pStmt.executeQuery(); /* */ /* 420 */ if (blobRs.next()) { /* 421 */ return blobRs.getLong(1); /* */ } /* */ /* 424 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ finally /* */ { /* 428 */ if (blobRs != null) { /* */ try { /* 430 */ blobRs.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 435 */ blobRs = null; /* */ } /* */ /* 438 */ if (pStmt != null) { /* */ try { /* 440 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 445 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ /* */ public void truncate(long length) /* */ throws SQLException /* */ { /* 454 */ PreparedStatement pStmt = null; /* */ /* */ /* 457 */ StringBuffer query = new StringBuffer("UPDATE "); /* 458 */ query.append(this.tableName); /* 459 */ query.append(" SET "); /* 460 */ query.append(this.blobColumnName); /* 461 */ query.append(" = LEFT("); /* 462 */ query.append(this.blobColumnName); /* 463 */ query.append(", "); /* 464 */ query.append(length); /* 465 */ query.append(") WHERE "); /* */ /* 467 */ query.append((String)this.primaryKeyColumns.get(0)); /* 468 */ query.append(" = ?"); /* */ /* 470 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 471 */ query.append(" AND "); /* 472 */ query.append((String)this.primaryKeyColumns.get(i)); /* 473 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 478 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* */ /* 481 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 482 */ pStmt.setString(i + 1, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 485 */ int rowsUpdated = pStmt.executeUpdate(); /* */ /* 487 */ if (rowsUpdated != 1) { /* 488 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ } /* */ finally /* */ { /* 493 */ if (pStmt != null) { /* */ try { /* 495 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 500 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ PreparedStatement createGetBytesStatement() throws SQLException { /* 506 */ StringBuffer query = new StringBuffer("SELECT SUBSTRING("); /* */ /* 508 */ query.append(this.blobColumnName); /* 509 */ query.append(", "); /* 510 */ query.append("?"); /* 511 */ query.append(", "); /* 512 */ query.append("?"); /* 513 */ query.append(") FROM "); /* 514 */ query.append(this.tableName); /* 515 */ query.append(" WHERE "); /* */ /* 517 */ query.append((String)this.primaryKeyColumns.get(0)); /* 518 */ query.append(" = ?"); /* */ /* 520 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 521 */ query.append(" AND "); /* 522 */ query.append((String)this.primaryKeyColumns.get(i)); /* 523 */ query.append(" = ?"); /* */ } /* */ /* 526 */ return this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ } /* */ /* */ /* */ byte[] getBytesInternal(PreparedStatement pStmt, long pos, int length) /* */ throws SQLException /* */ { /* 533 */ java.sql.ResultSet blobRs = null; /* */ /* */ try /* */ { /* 537 */ pStmt.setLong(1, pos); /* 538 */ pStmt.setInt(2, length); /* */ /* 540 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 541 */ pStmt.setString(i + 3, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 544 */ blobRs = pStmt.executeQuery(); /* */ /* 546 */ if (blobRs.next()) { /* 547 */ return ((ResultSet)blobRs).getBytes(1, true); /* */ } /* */ /* 550 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ finally /* */ { /* 554 */ if (blobRs != null) { /* */ try { /* 556 */ blobRs.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 561 */ blobRs = null; /* */ } /* */ } /* */ } /* */ /* */ class LocatorInputStream extends InputStream { /* 567 */ long currentPositionInBlob = 0L; /* */ /* 569 */ long length = 0L; /* */ /* 571 */ PreparedStatement pStmt = null; /* */ /* */ LocatorInputStream() throws SQLException { /* 574 */ this.length = BlobFromLocator.this.length(); /* 575 */ this.pStmt = BlobFromLocator.this.createGetBytesStatement(); /* */ } /* */ /* */ public int read() throws IOException { /* 579 */ if (this.currentPositionInBlob + 1L > this.length) { /* 580 */ return -1; /* */ } /* */ try /* */ { /* 584 */ byte[] asBytes = BlobFromLocator.this.getBytesInternal(this.pStmt, this.currentPositionInBlob++ + 1L, 1); /* */ /* */ /* 587 */ if (asBytes == null) { /* 588 */ return -1; /* */ } /* */ /* 591 */ return asBytes[0]; /* */ } catch (SQLException sqlEx) { /* 593 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public int read(byte[] b, int off, int len) /* */ throws IOException /* */ { /* 603 */ if (this.currentPositionInBlob + 1L > this.length) { /* 604 */ return -1; /* */ } /* */ try /* */ { /* 608 */ byte[] asBytes = BlobFromLocator.this.getBytesInternal(this.pStmt, this.currentPositionInBlob + 1L, len); /* */ /* */ /* 611 */ if (asBytes == null) { /* 612 */ return -1; /* */ } /* */ /* 615 */ System.arraycopy(asBytes, 0, b, off, asBytes.length); /* */ /* 617 */ this.currentPositionInBlob += asBytes.length; /* */ /* 619 */ return asBytes.length; /* */ } catch (SQLException sqlEx) { /* 621 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public int read(byte[] b) /* */ throws IOException /* */ { /* 631 */ if (this.currentPositionInBlob + 1L > this.length) { /* 632 */ return -1; /* */ } /* */ try /* */ { /* 636 */ byte[] asBytes = BlobFromLocator.this.getBytesInternal(this.pStmt, this.currentPositionInBlob + 1L, b.length); /* */ /* */ /* 639 */ if (asBytes == null) { /* 640 */ return -1; /* */ } /* */ /* 643 */ System.arraycopy(asBytes, 0, b, 0, asBytes.length); /* */ /* 645 */ this.currentPositionInBlob += asBytes.length; /* */ /* 647 */ return asBytes.length; /* */ } catch (SQLException sqlEx) { /* 649 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public void close() /* */ throws IOException /* */ { /* 659 */ if (this.pStmt != null) { /* */ try { /* 661 */ this.pStmt.close(); /* */ } catch (SQLException sqlEx) { /* 663 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* 667 */ super.close(); /* */ } /* */ } /* */ } /* Location: E:\java\java学习\hutubill\lib\all.jar!\com\mysql\jdbc\BlobFromLocator.class * Java compiler version: 2 (46.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
21,401
java
BlobFromLocator.java
Java
[]
null
[]
/* */ package com.mysql.jdbc; /* */ /* */ import java.io.BufferedInputStream; /* */ import java.io.IOException; /* */ import java.io.InputStream; /* */ import java.io.OutputStream; /* */ import java.sql.Blob; /* */ import java.sql.DatabaseMetaData; /* */ import java.sql.PreparedStatement; /* */ import java.sql.SQLException; /* */ import java.util.ArrayList; /* */ import java.util.List; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class BlobFromLocator /* */ implements Blob /* */ { /* 55 */ private List primaryKeyColumns = null; /* */ /* 57 */ private List primaryKeyValues = null; /* */ /* */ /* */ private ResultSet creatorResultSet; /* */ /* 62 */ private String blobColumnName = null; /* */ /* 64 */ private String tableName = null; /* */ /* 66 */ private int numColsInResultSet = 0; /* */ /* 68 */ private int numPrimaryKeys = 0; /* */ /* */ /* */ private String quotedId; /* */ /* */ /* */ BlobFromLocator(ResultSet creatorResultSetToSet, int blobColumnIndex) /* */ throws SQLException /* */ { /* 77 */ this.creatorResultSet = creatorResultSetToSet; /* */ /* 79 */ this.numColsInResultSet = this.creatorResultSet.fields.length; /* 80 */ this.quotedId = this.creatorResultSet.connection.getMetaData().getIdentifierQuoteString(); /* */ /* */ /* 83 */ if (this.numColsInResultSet > 1) { /* 84 */ this.primaryKeyColumns = new ArrayList(); /* 85 */ this.primaryKeyValues = new ArrayList(); /* */ /* 87 */ for (int i = 0; i < this.numColsInResultSet; i++) { /* 88 */ if (this.creatorResultSet.fields[i].isPrimaryKey()) { /* 89 */ StringBuffer keyName = new StringBuffer(); /* 90 */ keyName.append(this.quotedId); /* */ /* 92 */ String originalColumnName = this.creatorResultSet.fields[i].getOriginalName(); /* */ /* */ /* 95 */ if ((originalColumnName != null) && (originalColumnName.length() > 0)) /* */ { /* 97 */ keyName.append(originalColumnName); /* */ } else { /* 99 */ keyName.append(this.creatorResultSet.fields[i].getName()); /* */ } /* */ /* */ /* 103 */ keyName.append(this.quotedId); /* */ /* 105 */ this.primaryKeyColumns.add(keyName.toString()); /* 106 */ this.primaryKeyValues.add(this.creatorResultSet.getString(i + 1)); /* */ } /* */ } /* */ } /* */ else { /* 111 */ notEnoughInformationInQuery(); /* */ } /* */ /* 114 */ this.numPrimaryKeys = this.primaryKeyColumns.size(); /* */ /* 116 */ if (this.numPrimaryKeys == 0) { /* 117 */ notEnoughInformationInQuery(); /* */ } /* */ /* 120 */ if (this.creatorResultSet.fields[0].getOriginalTableName() != null) { /* 121 */ StringBuffer tableNameBuffer = new StringBuffer(); /* */ /* 123 */ String databaseName = this.creatorResultSet.fields[0].getDatabaseName(); /* */ /* */ /* 126 */ if ((databaseName != null) && (databaseName.length() > 0)) { /* 127 */ tableNameBuffer.append(this.quotedId); /* 128 */ tableNameBuffer.append(databaseName); /* 129 */ tableNameBuffer.append(this.quotedId); /* 130 */ tableNameBuffer.append('.'); /* */ } /* */ /* 133 */ tableNameBuffer.append(this.quotedId); /* 134 */ tableNameBuffer.append(this.creatorResultSet.fields[0].getOriginalTableName()); /* */ /* 136 */ tableNameBuffer.append(this.quotedId); /* */ /* 138 */ this.tableName = tableNameBuffer.toString(); /* */ } else { /* 140 */ StringBuffer tableNameBuffer = new StringBuffer(); /* */ /* 142 */ tableNameBuffer.append(this.quotedId); /* 143 */ tableNameBuffer.append(this.creatorResultSet.fields[0].getTableName()); /* */ /* 145 */ tableNameBuffer.append(this.quotedId); /* */ /* 147 */ this.tableName = tableNameBuffer.toString(); /* */ } /* */ /* 150 */ this.blobColumnName = (this.quotedId + this.creatorResultSet.getString(blobColumnIndex) + this.quotedId); /* */ } /* */ /* */ private void notEnoughInformationInQuery() throws SQLException /* */ { /* 155 */ throw SQLError.createSQLException("Emulated BLOB locators must come from a ResultSet with only one table selected, and all primary keys selected", "S1000"); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public OutputStream setBinaryStream(long indexToWriteAt) /* */ throws SQLException /* */ { /* 165 */ throw new NotImplemented(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public InputStream getBinaryStream() /* */ throws SQLException /* */ { /* 178 */ return new BufferedInputStream(new LocatorInputStream(), this.creatorResultSet.connection.getLocatorFetchBufferSize()); /* */ } /* */ /* */ /* */ /* */ /* */ public int setBytes(long writeAt, byte[] bytes, int offset, int length) /* */ throws SQLException /* */ { /* 187 */ PreparedStatement pStmt = null; /* */ /* 189 */ if (offset + length > bytes.length) { /* 190 */ length = bytes.length - offset; /* */ } /* */ /* 193 */ byte[] bytesToWrite = new byte[length]; /* 194 */ System.arraycopy(bytes, offset, bytesToWrite, 0, length); /* */ /* */ /* 197 */ StringBuffer query = new StringBuffer("UPDATE "); /* 198 */ query.append(this.tableName); /* 199 */ query.append(" SET "); /* 200 */ query.append(this.blobColumnName); /* 201 */ query.append(" = INSERT("); /* 202 */ query.append(this.blobColumnName); /* 203 */ query.append(", "); /* 204 */ query.append(writeAt); /* 205 */ query.append(", "); /* 206 */ query.append(length); /* 207 */ query.append(", ?) WHERE "); /* */ /* 209 */ query.append((String)this.primaryKeyColumns.get(0)); /* 210 */ query.append(" = ?"); /* */ /* 212 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 213 */ query.append(" AND "); /* 214 */ query.append((String)this.primaryKeyColumns.get(i)); /* 215 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 220 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* */ /* 223 */ pStmt.setBytes(1, bytesToWrite); /* */ /* 225 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 226 */ pStmt.setString(i + 2, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 229 */ int rowsUpdated = pStmt.executeUpdate(); /* */ /* 231 */ if (rowsUpdated != 1) { /* 232 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ } /* */ finally /* */ { /* 237 */ if (pStmt != null) { /* */ try { /* 239 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 244 */ pStmt = null; /* */ } /* */ } /* */ /* 248 */ return (int)length(); /* */ } /* */ /* */ /* */ public int setBytes(long writeAt, byte[] bytes) /* */ throws SQLException /* */ { /* 255 */ return setBytes(writeAt, bytes, 0, bytes.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public byte[] getBytes(long pos, int length) /* */ throws SQLException /* */ { /* 274 */ PreparedStatement pStmt = null; /* */ /* */ try /* */ { /* 278 */ pStmt = createGetBytesStatement(); /* */ /* 280 */ return getBytesInternal(pStmt, pos, length); /* */ } finally { /* 282 */ if (pStmt != null) { /* */ try { /* 284 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 289 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public long length() /* */ throws SQLException /* */ { /* 304 */ java.sql.ResultSet blobRs = null; /* 305 */ PreparedStatement pStmt = null; /* */ /* */ /* 308 */ StringBuffer query = new StringBuffer("SELECT LENGTH("); /* 309 */ query.append(this.blobColumnName); /* 310 */ query.append(") FROM "); /* 311 */ query.append(this.tableName); /* 312 */ query.append(" WHERE "); /* */ /* 314 */ query.append((String)this.primaryKeyColumns.get(0)); /* 315 */ query.append(" = ?"); /* */ /* 317 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 318 */ query.append(" AND "); /* 319 */ query.append((String)this.primaryKeyColumns.get(i)); /* 320 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 325 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* */ /* 328 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 329 */ pStmt.setString(i + 1, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 332 */ blobRs = pStmt.executeQuery(); /* */ /* 334 */ if (blobRs.next()) { /* 335 */ return blobRs.getLong(1); /* */ } /* */ /* 338 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ finally /* */ { /* 342 */ if (blobRs != null) { /* */ try { /* 344 */ blobRs.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 349 */ blobRs = null; /* */ } /* */ /* 352 */ if (pStmt != null) { /* */ try { /* 354 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 359 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public long position(Blob pattern, long start) /* */ throws SQLException /* */ { /* 379 */ return position(pattern.getBytes(0L, (int)pattern.length()), start); /* */ } /* */ /* */ /* */ public long position(byte[] pattern, long start) /* */ throws SQLException /* */ { /* 386 */ java.sql.ResultSet blobRs = null; /* 387 */ PreparedStatement pStmt = null; /* */ /* */ /* 390 */ StringBuffer query = new StringBuffer("SELECT LOCATE("); /* 391 */ query.append("?, "); /* 392 */ query.append(this.blobColumnName); /* 393 */ query.append(", "); /* 394 */ query.append(start); /* 395 */ query.append(") FROM "); /* 396 */ query.append(this.tableName); /* 397 */ query.append(" WHERE "); /* */ /* 399 */ query.append((String)this.primaryKeyColumns.get(0)); /* 400 */ query.append(" = ?"); /* */ /* 402 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 403 */ query.append(" AND "); /* 404 */ query.append((String)this.primaryKeyColumns.get(i)); /* 405 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 410 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* 412 */ pStmt.setBytes(1, pattern); /* */ /* 414 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 415 */ pStmt.setString(i + 2, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 418 */ blobRs = pStmt.executeQuery(); /* */ /* 420 */ if (blobRs.next()) { /* 421 */ return blobRs.getLong(1); /* */ } /* */ /* 424 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ finally /* */ { /* 428 */ if (blobRs != null) { /* */ try { /* 430 */ blobRs.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 435 */ blobRs = null; /* */ } /* */ /* 438 */ if (pStmt != null) { /* */ try { /* 440 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 445 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ /* */ public void truncate(long length) /* */ throws SQLException /* */ { /* 454 */ PreparedStatement pStmt = null; /* */ /* */ /* 457 */ StringBuffer query = new StringBuffer("UPDATE "); /* 458 */ query.append(this.tableName); /* 459 */ query.append(" SET "); /* 460 */ query.append(this.blobColumnName); /* 461 */ query.append(" = LEFT("); /* 462 */ query.append(this.blobColumnName); /* 463 */ query.append(", "); /* 464 */ query.append(length); /* 465 */ query.append(") WHERE "); /* */ /* 467 */ query.append((String)this.primaryKeyColumns.get(0)); /* 468 */ query.append(" = ?"); /* */ /* 470 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 471 */ query.append(" AND "); /* 472 */ query.append((String)this.primaryKeyColumns.get(i)); /* 473 */ query.append(" = ?"); /* */ } /* */ /* */ try /* */ { /* 478 */ pStmt = this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ /* */ /* 481 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 482 */ pStmt.setString(i + 1, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 485 */ int rowsUpdated = pStmt.executeUpdate(); /* */ /* 487 */ if (rowsUpdated != 1) { /* 488 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ } /* */ finally /* */ { /* 493 */ if (pStmt != null) { /* */ try { /* 495 */ pStmt.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 500 */ pStmt = null; /* */ } /* */ } /* */ } /* */ /* */ PreparedStatement createGetBytesStatement() throws SQLException { /* 506 */ StringBuffer query = new StringBuffer("SELECT SUBSTRING("); /* */ /* 508 */ query.append(this.blobColumnName); /* 509 */ query.append(", "); /* 510 */ query.append("?"); /* 511 */ query.append(", "); /* 512 */ query.append("?"); /* 513 */ query.append(") FROM "); /* 514 */ query.append(this.tableName); /* 515 */ query.append(" WHERE "); /* */ /* 517 */ query.append((String)this.primaryKeyColumns.get(0)); /* 518 */ query.append(" = ?"); /* */ /* 520 */ for (int i = 1; i < this.numPrimaryKeys; i++) { /* 521 */ query.append(" AND "); /* 522 */ query.append((String)this.primaryKeyColumns.get(i)); /* 523 */ query.append(" = ?"); /* */ } /* */ /* 526 */ return this.creatorResultSet.connection.prepareStatement(query.toString()); /* */ } /* */ /* */ /* */ byte[] getBytesInternal(PreparedStatement pStmt, long pos, int length) /* */ throws SQLException /* */ { /* 533 */ java.sql.ResultSet blobRs = null; /* */ /* */ try /* */ { /* 537 */ pStmt.setLong(1, pos); /* 538 */ pStmt.setInt(2, length); /* */ /* 540 */ for (int i = 0; i < this.numPrimaryKeys; i++) { /* 541 */ pStmt.setString(i + 3, (String)this.primaryKeyValues.get(i)); /* */ } /* */ /* 544 */ blobRs = pStmt.executeQuery(); /* */ /* 546 */ if (blobRs.next()) { /* 547 */ return ((ResultSet)blobRs).getBytes(1, true); /* */ } /* */ /* 550 */ throw SQLError.createSQLException("BLOB data not found! Did primary keys change?", "S1000"); /* */ } /* */ finally /* */ { /* 554 */ if (blobRs != null) { /* */ try { /* 556 */ blobRs.close(); /* */ } /* */ catch (SQLException sqlEx) {} /* */ /* */ /* 561 */ blobRs = null; /* */ } /* */ } /* */ } /* */ /* */ class LocatorInputStream extends InputStream { /* 567 */ long currentPositionInBlob = 0L; /* */ /* 569 */ long length = 0L; /* */ /* 571 */ PreparedStatement pStmt = null; /* */ /* */ LocatorInputStream() throws SQLException { /* 574 */ this.length = BlobFromLocator.this.length(); /* 575 */ this.pStmt = BlobFromLocator.this.createGetBytesStatement(); /* */ } /* */ /* */ public int read() throws IOException { /* 579 */ if (this.currentPositionInBlob + 1L > this.length) { /* 580 */ return -1; /* */ } /* */ try /* */ { /* 584 */ byte[] asBytes = BlobFromLocator.this.getBytesInternal(this.pStmt, this.currentPositionInBlob++ + 1L, 1); /* */ /* */ /* 587 */ if (asBytes == null) { /* 588 */ return -1; /* */ } /* */ /* 591 */ return asBytes[0]; /* */ } catch (SQLException sqlEx) { /* 593 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public int read(byte[] b, int off, int len) /* */ throws IOException /* */ { /* 603 */ if (this.currentPositionInBlob + 1L > this.length) { /* 604 */ return -1; /* */ } /* */ try /* */ { /* 608 */ byte[] asBytes = BlobFromLocator.this.getBytesInternal(this.pStmt, this.currentPositionInBlob + 1L, len); /* */ /* */ /* 611 */ if (asBytes == null) { /* 612 */ return -1; /* */ } /* */ /* 615 */ System.arraycopy(asBytes, 0, b, off, asBytes.length); /* */ /* 617 */ this.currentPositionInBlob += asBytes.length; /* */ /* 619 */ return asBytes.length; /* */ } catch (SQLException sqlEx) { /* 621 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public int read(byte[] b) /* */ throws IOException /* */ { /* 631 */ if (this.currentPositionInBlob + 1L > this.length) { /* 632 */ return -1; /* */ } /* */ try /* */ { /* 636 */ byte[] asBytes = BlobFromLocator.this.getBytesInternal(this.pStmt, this.currentPositionInBlob + 1L, b.length); /* */ /* */ /* 639 */ if (asBytes == null) { /* 640 */ return -1; /* */ } /* */ /* 643 */ System.arraycopy(asBytes, 0, b, 0, asBytes.length); /* */ /* 645 */ this.currentPositionInBlob += asBytes.length; /* */ /* 647 */ return asBytes.length; /* */ } catch (SQLException sqlEx) { /* 649 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public void close() /* */ throws IOException /* */ { /* 659 */ if (this.pStmt != null) { /* */ try { /* 661 */ this.pStmt.close(); /* */ } catch (SQLException sqlEx) { /* 663 */ throw new IOException(sqlEx.toString()); /* */ } /* */ } /* */ /* 667 */ super.close(); /* */ } /* */ } /* */ } /* Location: E:\java\java学习\hutubill\lib\all.jar!\com\mysql\jdbc\BlobFromLocator.class * Java compiler version: 2 (46.0) * JD-Core Version: 0.7.1 */
21,401
0.433285
0.397299
676
30.653847
23.989365
170
false
false
0
0
0
0
0
0
0.431953
false
false
2
911f7a85d4d40879e5027e44eaf01f764402a4e5
24,369,644,469,487
a3c7353b80d7e706f5b7cfb9b25f3bb788b8e67f
/src/main/java/org/basic/testing/units/services/ExternalCompanyValidationService.java
f709ffa4d7a547cf1edd909be89bfd573aa29781
[]
no_license
sebasacuna/basic-testing-java
https://github.com/sebasacuna/basic-testing-java
c987d4ca0712bc1eeb8be7d3bee0ca9d8e06fc2f
58c5b0c6246543bbd6707d9299c121ea44a07ba6
refs/heads/master
2023-03-06T03:13:10.218000
2021-02-15T08:33:21
2021-02-15T08:33:21
339,009,721
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.basic.testing.units.services; public interface ExternalCompanyValidationService { boolean checkValidationCompany(String code); }
UTF-8
Java
148
java
ExternalCompanyValidationService.java
Java
[]
null
[]
package org.basic.testing.units.services; public interface ExternalCompanyValidationService { boolean checkValidationCompany(String code); }
148
0.817568
0.817568
7
20.142857
23.135801
51
false
false
0
0
0
0
0
0
0.285714
false
false
2