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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5e08bc062f7a7c1b2764be6226ee00c30ec8dedf
| 2,370,821,958,655
|
252c4d23849e995cd4e1bb105ab1efb3ec2eb60f
|
/Hw09/src/edu/umb/cs/cs680/hw09/FSElement.java
|
cdc4337669bbac08b21467429e212ba453b6d05a
|
[] |
no_license
|
beavinash/Java-Design-Patterns
|
https://github.com/beavinash/Java-Design-Patterns
|
13ed06458e710c3ec7b155b1f49b3ccfb42b7feb
|
b9efa0c7c7100b638a6667e8e3fc10a1afe91de1
|
refs/heads/master
| 2021-04-27T07:59:38.040000
| 2018-02-23T16:23:24
| 2018-02-23T16:23:24
| 122,644,635
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.umb.cs.cs680.hw09;
import java.util.Date;
/**
* @author avinashreddy
*
*/
public class FSElement {
String name;
String owner;
Date created;
Date lastModified;
int size;
Directory parent;
public FSElement(Directory parent,String name, String owner, Date created, Date lastModified, int size) {
super();
this.parent = parent;
this.name = name;
this.owner = owner;
this.created = new Date();
this.lastModified = this.created;
this.size = size;
}
public int getSize() {
return size;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
// public void setName(String name) {
// this.name = name;
// }
/**
* @return the owner
*/
public String getOwner() {
return owner;
}
/**
* @param owner the owner to set
*/
// public void setOwner(String owner) {
// this.owner = owner;
// }
/**
* @return the created
*/
// public Date getCreated() {
// return created;
// }
/**
* @param created the created to set
*/
// public void setCreated(Date created) {
// this.created = created;
// }
/**
* @return the lastModified
*/
// public Date getLastModified() {
// return lastModified;
// }
/**
* @param lastModified the lastModified to set
*/
// public void setLastModified(Date lastModified) {
// this.lastModified = lastModified;
// }
/**
* @return the parent
*/
// public Directory getParent() {
// return parent;
// }
/**
* @param parent the parent to set
*/
// public void setParent(Directory parent) {
// this.parent = parent;
// }
/**
* @param size the size to set
*/
// public void setSize(int size) {
// this.size = size;
// }
public boolean isFile() {
return true;
}
public void display() {
System.out.println("File Name:"+this.getName());
System.out.println("Owner Name:"+this.getOwner());
}
}
|
UTF-8
|
Java
| 1,897
|
java
|
FSElement.java
|
Java
|
[
{
"context": "s680.hw09;\n\nimport java.util.Date;\n\n/**\n * @author avinashreddy\n *\n */\n\npublic class FSElement {\n\t\n\tString name;\n",
"end": 83,
"score": 0.9056462049484253,
"start": 71,
"tag": "USERNAME",
"value": "avinashreddy"
}
] | null |
[] |
package edu.umb.cs.cs680.hw09;
import java.util.Date;
/**
* @author avinashreddy
*
*/
public class FSElement {
String name;
String owner;
Date created;
Date lastModified;
int size;
Directory parent;
public FSElement(Directory parent,String name, String owner, Date created, Date lastModified, int size) {
super();
this.parent = parent;
this.name = name;
this.owner = owner;
this.created = new Date();
this.lastModified = this.created;
this.size = size;
}
public int getSize() {
return size;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
// public void setName(String name) {
// this.name = name;
// }
/**
* @return the owner
*/
public String getOwner() {
return owner;
}
/**
* @param owner the owner to set
*/
// public void setOwner(String owner) {
// this.owner = owner;
// }
/**
* @return the created
*/
// public Date getCreated() {
// return created;
// }
/**
* @param created the created to set
*/
// public void setCreated(Date created) {
// this.created = created;
// }
/**
* @return the lastModified
*/
// public Date getLastModified() {
// return lastModified;
// }
/**
* @param lastModified the lastModified to set
*/
// public void setLastModified(Date lastModified) {
// this.lastModified = lastModified;
// }
/**
* @return the parent
*/
// public Directory getParent() {
// return parent;
// }
/**
* @param parent the parent to set
*/
// public void setParent(Directory parent) {
// this.parent = parent;
// }
/**
* @param size the size to set
*/
// public void setSize(int size) {
// this.size = size;
// }
public boolean isFile() {
return true;
}
public void display() {
System.out.println("File Name:"+this.getName());
System.out.println("Owner Name:"+this.getOwner());
}
}
| 1,897
| 0.618872
| 0.616236
| 123
| 14.414634
| 16.197424
| 106
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.284553
| false
| false
|
2
|
fb765b5e7e20c634b76ce1021b4691d37816aa13
| 5,523,327,961,552
|
2ec8ab9ac2efa9aebfe24092cb737fa95355f726
|
/jAoUrnToRam/iw/intermediateWorkflow/impl/IwWaitingPlaceImpl.java
|
4d43bc4c97c950d72724a2ea6de15321438cd880
|
[] |
no_license
|
JUCMNAV/projetseg
|
https://github.com/JUCMNAV/projetseg
|
549f474e2de2ae8b0242d5b73ed8d225c9d5d2da
|
334302cc68f3bbe3f3cbc7a73905a928864ad149
|
refs/heads/master
| 2021-08-30T19:32:33.219000
| 2017-04-26T16:45:14
| 2017-04-26T16:45:14
| 81,868,373
| 3
| 4
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package intermediateWorkflow.impl;
import java.util.List;
import intermediateWorkflow.IntermediateWorkflowFactory;
import intermediateWorkflow.IntermediateWorkflowPackage;
import intermediateWorkflow.IwAndFork;
import intermediateWorkflow.IwNode;
import intermediateWorkflow.IwNodeConnection;
import intermediateWorkflow.IwStep;
import intermediateWorkflow.IwWaitingPlace;
import intermediateWorkflow.IwWorkflow;
import iwToJavaInstantiator.NodeInstantiationStrategy;
import iwToJavaInstantiator.WaitingplaceNodeInstantiatorStrategy;
import iwToJavaInstantiator.WorkflowNodeInstantiationStrategy;
import iwToStepView.StepView;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import ucm.map.NodeConnection;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Iw Waiting Place</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link intermediateWorkflow.impl.IwWaitingPlaceImpl#getTransient <em>Transient</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class IwWaitingPlaceImpl extends IwNodeImpl implements IwWaitingPlace {
@Override
public boolean hasTrigger() {
for(IwNodeConnection nodeConnection : getSuccs()) {
return nodeConnection.hasTriggerLabel();
}
return false;
}
@Override
public IwNodeConnection getTriggerSucc() {
for(IwNodeConnection nodeConnection : getSuccs()) {
if(nodeConnection.hasTriggerLabel()) {
return nodeConnection;
}
}
return null;
}
@Override
public IwNodeConnection getWaitingSucc() {
for(IwNodeConnection nodeConnection : getSuccs()) {
if(!nodeConnection.hasLabel()) {
return nodeConnection;
}
}
return null;
}
@Override
public void linkTriggerPath(IwNodeConnection iwPred, IwNode iwTarget, IwWorkflow iwWorkflow) {
IwAndFork implicitAndFork = IntermediateWorkflowFactory.eINSTANCE.createIwAndFork();
implicitAndFork.setName("ImplicitAndFork");
iwPred.setTarget(implicitAndFork);
iwWorkflow.addNode(implicitAndFork);
//as mentioned by Dr. Mussbacher in email on 17 Jan, this succ should be first
IwNodeConnection impAfSuccToWp = IntermediateWorkflowFactory.eINSTANCE.createIwNodeConnection();
impAfSuccToWp.setSource(implicitAndFork);
impAfSuccToWp.setLabel("trigger");
impAfSuccToWp.setTarget(this);
IwNodeConnection impAfSucc = IntermediateWorkflowFactory.eINSTANCE.createIwNodeConnection();
impAfSucc.setSource(implicitAndFork);
impAfSucc.setTarget(iwTarget);
}
@Override
public String getInputProcessingNodeAction() {
return "continue";
}
@Override
public NodeInstantiationStrategy createStrategy() {
return new WaitingplaceNodeInstantiatorStrategy(this, "ConditionalSynchronizationNode", getTransient());
}
@Override
public String getImageName(){
return "Wait16.gif";
}
/**
* The default value of the '{@link #getTransient() <em>Transient</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTransient()
* @generated
* @ordered
*/
protected static final Boolean TRANSIENT_EDEFAULT = null;
/**
* The cached value of the '{@link #getTransient() <em>Transient</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTransient()
* @generated
* @ordered
*/
protected Boolean transient_ = TRANSIENT_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IwWaitingPlaceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return IntermediateWorkflowPackage.Literals.IW_WAITING_PLACE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Boolean getTransient() {
return transient_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTransient(Boolean newTransient) {
Boolean oldTransient = transient_;
transient_ = newTransient;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT, oldTransient, transient_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
return getTransient();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
setTransient((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
setTransient(TRANSIENT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
return TRANSIENT_EDEFAULT == null ? transient_ != null : !TRANSIENT_EDEFAULT.equals(transient_);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (transient: ");
result.append(transient_);
result.append(')');
return result.toString();
}
} //IwWaitingPlaceImpl
|
UTF-8
|
Java
| 6,228
|
java
|
IwWaitingPlaceImpl.java
|
Java
|
[
{
"context": "addNode(implicitAndFork);\r\n\t\t\r\n\t\t//as mentioned by Dr. Mussbacher in email on 17 Jan, this succ should b",
"end": 2261,
"score": 0.995930016040802,
"start": 2259,
"tag": "NAME",
"value": "Dr"
},
{
"context": "ode(implicitAndFork);\r\n\t\t\r\n\t\t//as mentioned by Dr. Mussbacher in email on 17 Jan, this succ should be first\r\n\t\t",
"end": 2273,
"score": 0.9966258406639099,
"start": 2263,
"tag": "NAME",
"value": "Mussbacher"
}
] | null |
[] |
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package intermediateWorkflow.impl;
import java.util.List;
import intermediateWorkflow.IntermediateWorkflowFactory;
import intermediateWorkflow.IntermediateWorkflowPackage;
import intermediateWorkflow.IwAndFork;
import intermediateWorkflow.IwNode;
import intermediateWorkflow.IwNodeConnection;
import intermediateWorkflow.IwStep;
import intermediateWorkflow.IwWaitingPlace;
import intermediateWorkflow.IwWorkflow;
import iwToJavaInstantiator.NodeInstantiationStrategy;
import iwToJavaInstantiator.WaitingplaceNodeInstantiatorStrategy;
import iwToJavaInstantiator.WorkflowNodeInstantiationStrategy;
import iwToStepView.StepView;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import ucm.map.NodeConnection;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Iw Waiting Place</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link intermediateWorkflow.impl.IwWaitingPlaceImpl#getTransient <em>Transient</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class IwWaitingPlaceImpl extends IwNodeImpl implements IwWaitingPlace {
@Override
public boolean hasTrigger() {
for(IwNodeConnection nodeConnection : getSuccs()) {
return nodeConnection.hasTriggerLabel();
}
return false;
}
@Override
public IwNodeConnection getTriggerSucc() {
for(IwNodeConnection nodeConnection : getSuccs()) {
if(nodeConnection.hasTriggerLabel()) {
return nodeConnection;
}
}
return null;
}
@Override
public IwNodeConnection getWaitingSucc() {
for(IwNodeConnection nodeConnection : getSuccs()) {
if(!nodeConnection.hasLabel()) {
return nodeConnection;
}
}
return null;
}
@Override
public void linkTriggerPath(IwNodeConnection iwPred, IwNode iwTarget, IwWorkflow iwWorkflow) {
IwAndFork implicitAndFork = IntermediateWorkflowFactory.eINSTANCE.createIwAndFork();
implicitAndFork.setName("ImplicitAndFork");
iwPred.setTarget(implicitAndFork);
iwWorkflow.addNode(implicitAndFork);
//as mentioned by Dr. Mussbacher in email on 17 Jan, this succ should be first
IwNodeConnection impAfSuccToWp = IntermediateWorkflowFactory.eINSTANCE.createIwNodeConnection();
impAfSuccToWp.setSource(implicitAndFork);
impAfSuccToWp.setLabel("trigger");
impAfSuccToWp.setTarget(this);
IwNodeConnection impAfSucc = IntermediateWorkflowFactory.eINSTANCE.createIwNodeConnection();
impAfSucc.setSource(implicitAndFork);
impAfSucc.setTarget(iwTarget);
}
@Override
public String getInputProcessingNodeAction() {
return "continue";
}
@Override
public NodeInstantiationStrategy createStrategy() {
return new WaitingplaceNodeInstantiatorStrategy(this, "ConditionalSynchronizationNode", getTransient());
}
@Override
public String getImageName(){
return "Wait16.gif";
}
/**
* The default value of the '{@link #getTransient() <em>Transient</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTransient()
* @generated
* @ordered
*/
protected static final Boolean TRANSIENT_EDEFAULT = null;
/**
* The cached value of the '{@link #getTransient() <em>Transient</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTransient()
* @generated
* @ordered
*/
protected Boolean transient_ = TRANSIENT_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IwWaitingPlaceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return IntermediateWorkflowPackage.Literals.IW_WAITING_PLACE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Boolean getTransient() {
return transient_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTransient(Boolean newTransient) {
Boolean oldTransient = transient_;
transient_ = newTransient;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT, oldTransient, transient_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
return getTransient();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
setTransient((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
setTransient(TRANSIENT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case IntermediateWorkflowPackage.IW_WAITING_PLACE__TRANSIENT:
return TRANSIENT_EDEFAULT == null ? transient_ != null : !TRANSIENT_EDEFAULT.equals(transient_);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (transient: ");
result.append(transient_);
result.append(')');
return result.toString();
}
} //IwWaitingPlaceImpl
| 6,228
| 0.67614
| 0.675498
| 242
| 23.735537
| 24.594822
| 141
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.471074
| false
| false
|
2
|
ffe3def2a362c09b3fbd554a923ebcde42fe7245
| 2,499,670,981,927
|
8f6573ce445d42ee396da550212a9ff83a799a45
|
/ProjectComputationAlgorithm/src/org/hrank/algorithm/warmup/MaximumPerimeterTriangle.java
|
0cadb132085a6a88348d1132b7292cc0bed4e137
|
[] |
no_license
|
suhailahmed1512/Algorithm
|
https://github.com/suhailahmed1512/Algorithm
|
a2d7d91efed33ff18fc05c7fdda341445297797e
|
42512bd2d1fcea42359f20de0a2f592fa134cf67
|
refs/heads/master
| 2020-06-15T12:40:50.517000
| 2018-04-20T06:30:26
| 2018-04-20T06:30:26
| 75,293,107
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.hrank.algorithm.warmup;
import java.util.Arrays;
import java.util.Scanner;
/**
* Class to implement maximum-perimeter-triangle algo. (degenerate triangles)
*
* @author suhail-a
* @version 1.0
*
*/
public class MaximumPerimeterTriangle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int arr[] = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
int x = N - 3, y = N - 2, z = N - 1;
for (; arr[x] + arr[y] <= arr[z]; x--, y--, z--) {
// For Non-Degenerating triangle
if (x == 0) {
System.out.println("-1");
sc.close();
return;
}
}
System.out.print(arr[x] + " " + arr[y] + " " + arr[z]);
sc.close();
}
}
|
UTF-8
|
Java
| 769
|
java
|
MaximumPerimeterTriangle.java
|
Java
|
[
{
"context": "iangle algo. (degenerate triangles)\n * \n * @author suhail-a\n * @version 1.0\n * \n */\npublic class MaximumPerim",
"end": 194,
"score": 0.9817411303520203,
"start": 186,
"tag": "USERNAME",
"value": "suhail-a"
}
] | null |
[] |
package org.hrank.algorithm.warmup;
import java.util.Arrays;
import java.util.Scanner;
/**
* Class to implement maximum-perimeter-triangle algo. (degenerate triangles)
*
* @author suhail-a
* @version 1.0
*
*/
public class MaximumPerimeterTriangle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int arr[] = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
int x = N - 3, y = N - 2, z = N - 1;
for (; arr[x] + arr[y] <= arr[z]; x--, y--, z--) {
// For Non-Degenerating triangle
if (x == 0) {
System.out.println("-1");
sc.close();
return;
}
}
System.out.print(arr[x] + " " + arr[y] + " " + arr[z]);
sc.close();
}
}
| 769
| 0.564369
| 0.553966
| 42
| 17.309525
| 18.524742
| 77
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.666667
| false
| false
|
2
|
a81162222409861c63b7a89a6b8334417eb7e330
| 30,331,059,067,677
|
710aff979c2a4151a28757f3c1de0b77dad5df77
|
/dom/src/main/java/org/isisaddons/services/remoteprofiles/LinkedInPositionsResource.java
|
15d61ebc940a27da3ad57c467e54dbb21dd33f20
|
[] |
no_license
|
johandoornenbal/matching
|
https://github.com/johandoornenbal/matching
|
b5500eef829e76096bd47a1fb513894a7d2c40df
|
d17d35d9d21dfafd335b1cfcbbb3f56ad1fceed1
|
refs/heads/master
| 2021-01-24T16:10:38.419000
| 2015-12-15T08:09:18
| 2015-12-15T08:09:18
| 21,899,439
| 0
| 5
| null | false
| 2015-04-03T12:59:24
| 2014-07-16T12:19:12
| 2015-04-03T10:29:26
| 2015-04-03T12:59:23
| 2,394
| 0
| 2
| 0
|
Java
| null | null |
/*
* Copyright 2015 Yodo Int. Projects and Consultancy
*
* 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.isisaddons.services.remoteprofiles;
import java.util.List;
/**
* Created by jodo on 20/05/15.
*/
public class LinkedInPositionsResource {
//region > _total (property)
private Integer _total;
public Integer getTotal() {
return _total;
}
public void setTotal(final Integer _total) {
this._total = _total;
}
//endregion
//region > values (property)
private List<LinkedInPositionValueResource> values;
public List<LinkedInPositionValueResource> getValues() {
return values;
}
public void setValues(final List<LinkedInPositionValueResource> values) {
this.values = values;
}
//endregion
}
|
UTF-8
|
Java
| 1,315
|
java
|
LinkedInPositionsResource.java
|
Java
|
[
{
"context": "ofiles;\n\nimport java.util.List;\n\n/**\n * Created by jodo on 20/05/15.\n */\npublic class LinkedInPositionsRe",
"end": 715,
"score": 0.9995978474617004,
"start": 711,
"tag": "USERNAME",
"value": "jodo"
}
] | null |
[] |
/*
* Copyright 2015 Yodo Int. Projects and Consultancy
*
* 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.isisaddons.services.remoteprofiles;
import java.util.List;
/**
* Created by jodo on 20/05/15.
*/
public class LinkedInPositionsResource {
//region > _total (property)
private Integer _total;
public Integer getTotal() {
return _total;
}
public void setTotal(final Integer _total) {
this._total = _total;
}
//endregion
//region > values (property)
private List<LinkedInPositionValueResource> values;
public List<LinkedInPositionValueResource> getValues() {
return values;
}
public void setValues(final List<LinkedInPositionValueResource> values) {
this.values = values;
}
//endregion
}
| 1,315
| 0.697338
| 0.686692
| 51
| 24.784313
| 23.875751
| 77
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.254902
| false
| false
|
2
|
b7c4fb8c426811ce61a3c97d11adf5b24f408e8c
| 23,605,140,286,205
|
424a5540b6b9efc36186250344dc43b22fe252c0
|
/server/app/com/nada/webservice/ArrayOfAdjustedAccessoryStruc.java
|
8a9d446ef2bfa591dfc112401af093d1dc5aebcb
|
[
"Apache-2.0"
] |
permissive
|
sarmstro1968/BControlPlay
|
https://github.com/sarmstro1968/BControlPlay
|
020c8ce9f6c3a9e9a61bbed19a227719c8edeba3
|
95c7489a9d0a5cefb0d988c103b2b75c4fc87646
|
refs/heads/master
| 2017-05-03T15:28:15.062000
| 2017-02-15T13:43:01
| 2017-02-15T13:43:01
| 37,444,012
| 0
| 0
| null | false
| 2017-06-05T01:30:23
| 2015-06-15T04:45:21
| 2016-10-27T03:05:18
| 2017-06-05T01:29:34
| 96,058
| 0
| 0
| 1
|
Java
| null | null |
package com.nada.webservice;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ArrayOfAdjustedAccessory_Struc complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ArrayOfAdjustedAccessory_Struc">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="AdjustedAccessory_Struc" type="{http://webservice.nada.com/}AdjustedAccessory_Struc" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfAdjustedAccessory_Struc", propOrder = {
"adjustedAccessoryStruc"
})
public class ArrayOfAdjustedAccessoryStruc {
@XmlElement(name = "AdjustedAccessory_Struc", nillable = true)
protected List<AdjustedAccessoryStruc> adjustedAccessoryStruc;
/**
* Gets the value of the adjustedAccessoryStruc property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the adjustedAccessoryStruc property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAdjustedAccessoryStruc().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AdjustedAccessoryStruc }
*
*
*/
public List<AdjustedAccessoryStruc> getAdjustedAccessoryStruc() {
if (adjustedAccessoryStruc == null) {
adjustedAccessoryStruc = new ArrayList<AdjustedAccessoryStruc>();
}
return this.adjustedAccessoryStruc;
}
}
|
UTF-8
|
Java
| 2,160
|
java
|
ArrayOfAdjustedAccessoryStruc.java
|
Java
|
[] | null |
[] |
package com.nada.webservice;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ArrayOfAdjustedAccessory_Struc complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ArrayOfAdjustedAccessory_Struc">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="AdjustedAccessory_Struc" type="{http://webservice.nada.com/}AdjustedAccessory_Struc" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfAdjustedAccessory_Struc", propOrder = {
"adjustedAccessoryStruc"
})
public class ArrayOfAdjustedAccessoryStruc {
@XmlElement(name = "AdjustedAccessory_Struc", nillable = true)
protected List<AdjustedAccessoryStruc> adjustedAccessoryStruc;
/**
* Gets the value of the adjustedAccessoryStruc property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the adjustedAccessoryStruc property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAdjustedAccessoryStruc().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AdjustedAccessoryStruc }
*
*
*/
public List<AdjustedAccessoryStruc> getAdjustedAccessoryStruc() {
if (adjustedAccessoryStruc == null) {
adjustedAccessoryStruc = new ArrayList<AdjustedAccessoryStruc>();
}
return this.adjustedAccessoryStruc;
}
}
| 2,160
| 0.681944
| 0.679167
| 68
| 30.75
| 30.304035
| 151
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.367647
| false
| false
|
2
|
fb7bfb20c9ace439fd2334bd8ea51b178a8d6ca7
| 23,175,643,557,671
|
848625ae553f0040b74721a266cdb6bdbf7a4b47
|
/src/main/java/com/leverx/redis/queue/MessagePublisher.java
|
4360b466b019484b69f3536e832380bf3a39ca95
|
[] |
no_license
|
Sloydeath/dealerStatCloudFoundry
|
https://github.com/Sloydeath/dealerStatCloudFoundry
|
6ac5e8cc18d00868e890c0f77fa3b4b53e240071
|
17a5b470d729db741ccc89d73881daba8840a19e
|
refs/heads/master
| 2023-04-18T19:26:43.426000
| 2021-05-06T22:09:55
| 2021-05-06T22:09:55
| 365,047,176
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.leverx.redis.queue;
/**
* @author Andrew Panas
*/
public interface MessagePublisher {
void publish(final String message);
}
|
UTF-8
|
Java
| 144
|
java
|
MessagePublisher.java
|
Java
|
[
{
"context": "package com.leverx.redis.queue;\n\n/**\n * @author Andrew Panas\n */\n\npublic interface MessagePublisher {\n void",
"end": 60,
"score": 0.9998111128807068,
"start": 48,
"tag": "NAME",
"value": "Andrew Panas"
}
] | null |
[] |
package com.leverx.redis.queue;
/**
* @author <NAME>
*/
public interface MessagePublisher {
void publish(final String message);
}
| 138
| 0.715278
| 0.715278
| 9
| 15
| 15.740958
| 39
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.222222
| false
| false
|
2
|
83766991504eb62444433d8d144d0f7421221eb7
| 11,785,390,271,972
|
3141c923e9491597ed79e145adbc22261bd1ede3
|
/src/tests/math/AreaTest.java
|
23d2a18d1b3e1f4e2f40d5a0240e0f3c09932eeb
|
[
"MIT"
] |
permissive
|
whhone/algo-java
|
https://github.com/whhone/algo-java
|
25bc8b46e6df29bfda03607df20b86d1086b0489
|
6189191b462aee9804682b79916d5ca4de60a791
|
refs/heads/master
| 2022-03-16T09:55:34.046000
| 2022-02-21T20:26:20
| 2022-02-21T20:26:20
| 50,474,741
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package tests.math;
import org.junit.Test;
import weapon.math.Area;
import static junit.framework.TestCase.assertEquals;
public class AreaTest {
@Test
public void regularPolygonForTriangles() {
assertEquals(Math.sqrt(3) / 4, Area.ofRegularPolygon(3, 1), 1e-8);
assertEquals(Math.sqrt(3), Area.ofRegularPolygon(3, 2), 1e-8);
assertEquals(Math.sqrt(3) / 4 * 9, Area.ofRegularPolygon(3, 3), 1e-8);
}
@Test
public void regularPolygonForSquares() {
assertEquals(1, Area.ofRegularPolygon(4, 1), 1e-8);
assertEquals(4, Area.ofRegularPolygon(4, 2), 1e-8);
assertEquals(9, Area.ofRegularPolygon(4, 3), 1e-8);
}
@Test
public void regularPolygonForPentagon() {
assertEquals(1.720477400588967, Area.ofRegularPolygon(5, 1), 1e-8);
assertEquals(6.881909602355868, Area.ofRegularPolygon(5, 2), 1e-8);
assertEquals(15.484296605300703, Area.ofRegularPolygon(5, 3), 1e-8);
}
@Test
public void triangle() {
assertEquals(6, Area.ofTriangle(3, 4, 5), 1e-8);
assertEquals(0, Area.ofTriangle(3, 4, 7), 1e-8);
}
@Test
public void circle() {
assertEquals(Math.PI, Area.ofCircle(1), 1e-8);
assertEquals(Math.PI * 10000, Area.ofCircle(100), 1e-8);
}
@Test
public void ellipse() {
assertEquals(0, Area.ofEllipse(0, 0), 1e-8);
assertEquals(Math.PI * 1 * 2, Area.ofEllipse(1, 2), 1e-8);
}
}
|
UTF-8
|
Java
| 1,366
|
java
|
AreaTest.java
|
Java
|
[] | null |
[] |
package tests.math;
import org.junit.Test;
import weapon.math.Area;
import static junit.framework.TestCase.assertEquals;
public class AreaTest {
@Test
public void regularPolygonForTriangles() {
assertEquals(Math.sqrt(3) / 4, Area.ofRegularPolygon(3, 1), 1e-8);
assertEquals(Math.sqrt(3), Area.ofRegularPolygon(3, 2), 1e-8);
assertEquals(Math.sqrt(3) / 4 * 9, Area.ofRegularPolygon(3, 3), 1e-8);
}
@Test
public void regularPolygonForSquares() {
assertEquals(1, Area.ofRegularPolygon(4, 1), 1e-8);
assertEquals(4, Area.ofRegularPolygon(4, 2), 1e-8);
assertEquals(9, Area.ofRegularPolygon(4, 3), 1e-8);
}
@Test
public void regularPolygonForPentagon() {
assertEquals(1.720477400588967, Area.ofRegularPolygon(5, 1), 1e-8);
assertEquals(6.881909602355868, Area.ofRegularPolygon(5, 2), 1e-8);
assertEquals(15.484296605300703, Area.ofRegularPolygon(5, 3), 1e-8);
}
@Test
public void triangle() {
assertEquals(6, Area.ofTriangle(3, 4, 5), 1e-8);
assertEquals(0, Area.ofTriangle(3, 4, 7), 1e-8);
}
@Test
public void circle() {
assertEquals(Math.PI, Area.ofCircle(1), 1e-8);
assertEquals(Math.PI * 10000, Area.ofCircle(100), 1e-8);
}
@Test
public void ellipse() {
assertEquals(0, Area.ofEllipse(0, 0), 1e-8);
assertEquals(Math.PI * 1 * 2, Area.ofEllipse(1, 2), 1e-8);
}
}
| 1,366
| 0.676428
| 0.581259
| 48
| 27.458334
| 26.207472
| 74
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.333333
| false
| false
|
2
|
d25ef6731c2ec2a79c47dfe0fe82abd77d73eada
| 31,018,253,848,204
|
62d1aa91ae05a00fb1d43cae9ad0f2530d0bd9eb
|
/app/src/main/java/com/example/bahroel/sigapbencana/utils/PrefUtils.java
|
23b201a0ab4fd7186cf12fc815b621b74ef56e46
|
[] |
no_license
|
Fatkhun/sigapbencana-retrofit-mobile
|
https://github.com/Fatkhun/sigapbencana-retrofit-mobile
|
68e92113f7836565b877397aa3052697d6a67e75
|
533416ecef3758f5b687f60652ca65caaf82e894
|
refs/heads/master
| 2020-06-16T20:05:33.060000
| 2019-07-07T19:23:40
| 2019-07-07T19:23:40
| 195,688,327
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.bahroel.sigapbencana.utils;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.design.widget.CollapsingToolbarLayout;
import com.example.bahroel.sigapbencana.activity.LoginActivity;
public class PrefUtils {
// Sharedpref file name
private static final String PREF_NAME = "sigapbencana";
// All Shared Preferences Keys
private static final String IS_LOGIN = "IsLoggedIn";
// User name (make variable public to access from outside)
public static final String KEY_NAME = "name";
// Email address (make variable public to access from outside)
public static final String KEY_USERID = "userId";
public static final String KEY_EMAIL = "email";
public static final String KEY_PASSWORD = "password";
public static final String KEY_API_TOKEN = "api_token";
public static final String KEY_PLACE = "place";
public static final String KEY_LATITUDE = "latitude";
public static final String KEY_LONGITUDE = "longitude";
public static final String KEY_ADDRESS = "address";
public static final String IS_DATA = "IsDataIn";
public PrefUtils() {
}
private static SharedPreferences getSharedPreferences(Context context) {
return context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public static void setApiKey(Context context, String apiKey) {
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_API_TOKEN, apiKey);
editor.commit();
}
public static String getApiKey(Context context) {
return getSharedPreferences(context).getString(KEY_API_TOKEN, null);
}
public static void setLoginSession(Context context, String userId, String email, String password, String nama){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
// Storing login value as TRUE
editor.putBoolean(IS_LOGIN, true);
editor.putString(KEY_USERID, userId);
editor.putString(KEY_EMAIL, email);
editor.putString(KEY_PASSWORD, password);
editor.putString(KEY_NAME, nama);
editor.commit();
}
public static void setNewPassword(Context context, String newPassword){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_PASSWORD, newPassword);
editor.commit();
}
public static String getNamaUser(Context context){
return getSharedPreferences(context).getString(KEY_NAME, null);
}
public static String getUserId(Context context){
return getSharedPreferences(context).getString(KEY_USERID, null);
}
public static String getPasswordUser(Context context){
return getSharedPreferences(context).getString(KEY_PASSWORD, null);
}
public static void setDataBencana(Context context, String place, String latitude, String longitude, String address){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_PLACE, place);
editor.putString(KEY_LATITUDE, latitude);
editor.putString(KEY_LONGITUDE, longitude);
editor.putString(KEY_ADDRESS, address);
editor.commit();
}
public static void setLatLang(Context context, String latitude, String longitude){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_LATITUDE, latitude);
editor.putString(KEY_LONGITUDE, longitude);
editor.commit();
}
public static String getPlaceBencana(Context context){
return getSharedPreferences(context).getString(KEY_PLACE, null);
}
public static String getLatitudeBencana(Context context){
return getSharedPreferences(context).getString(KEY_LATITUDE, null);
}
public static String getLongitudeBencana(Context context){
return getSharedPreferences(context).getString(KEY_LONGITUDE, null);
}
public static String getAddressBencana(Context context){
return getSharedPreferences(context).getString(KEY_ADDRESS, null);
}
public static void setCheckLogin(Context context){
// Check login status
if(!isLoggedIn(context)){
// user is not logged in redirect him to Login Activity
Intent i = new Intent(context, LoginActivity.class);
// Closing all the Activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Add new Flag to start new Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Staring Login Activity
context.startActivity(i);
}
}
public static void logoutUser(Context context){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
// Clearing all data from Shared Preferences
editor.clear();
editor.commit();
// After menu redirect user to Loing Activity
Intent i = new Intent(context, LoginActivity.class);
// Closing all the Activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Add new Flag to start new Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Staring Login Activity
context.startActivity(i);
}
// Get Login State
public static boolean isLoggedIn(Context context){
return getSharedPreferences(context).getBoolean(IS_LOGIN, false);
}
public static boolean isDataIn(Context context){
return getSharedPreferences(context).getBoolean(IS_DATA, false);
}
}
|
UTF-8
|
Java
| 5,632
|
java
|
PrefUtils.java
|
Java
|
[
{
"context": "ide)\n public static final String KEY_USERID = \"userId\";\n public static final String KEY_EMAIL = \"ema",
"end": 718,
"score": 0.5880998969078064,
"start": 712,
"tag": "KEY",
"value": "userId"
},
{
"context": "\";\n public static final String KEY_PASSWORD = \"password\";\n public static final String KEY_API_TOKEN = ",
"end": 828,
"score": 0.9988957047462463,
"start": 820,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "IL, email);\n editor.putString(KEY_PASSWORD, password);\n editor.putString(KEY_NAME, nama);\n ",
"end": 2148,
"score": 0.9974694848060608,
"start": 2140,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
package com.example.bahroel.sigapbencana.utils;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.design.widget.CollapsingToolbarLayout;
import com.example.bahroel.sigapbencana.activity.LoginActivity;
public class PrefUtils {
// Sharedpref file name
private static final String PREF_NAME = "sigapbencana";
// All Shared Preferences Keys
private static final String IS_LOGIN = "IsLoggedIn";
// User name (make variable public to access from outside)
public static final String KEY_NAME = "name";
// Email address (make variable public to access from outside)
public static final String KEY_USERID = "userId";
public static final String KEY_EMAIL = "email";
public static final String KEY_PASSWORD = "<PASSWORD>";
public static final String KEY_API_TOKEN = "api_token";
public static final String KEY_PLACE = "place";
public static final String KEY_LATITUDE = "latitude";
public static final String KEY_LONGITUDE = "longitude";
public static final String KEY_ADDRESS = "address";
public static final String IS_DATA = "IsDataIn";
public PrefUtils() {
}
private static SharedPreferences getSharedPreferences(Context context) {
return context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public static void setApiKey(Context context, String apiKey) {
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_API_TOKEN, apiKey);
editor.commit();
}
public static String getApiKey(Context context) {
return getSharedPreferences(context).getString(KEY_API_TOKEN, null);
}
public static void setLoginSession(Context context, String userId, String email, String password, String nama){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
// Storing login value as TRUE
editor.putBoolean(IS_LOGIN, true);
editor.putString(KEY_USERID, userId);
editor.putString(KEY_EMAIL, email);
editor.putString(KEY_PASSWORD, <PASSWORD>);
editor.putString(KEY_NAME, nama);
editor.commit();
}
public static void setNewPassword(Context context, String newPassword){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_PASSWORD, newPassword);
editor.commit();
}
public static String getNamaUser(Context context){
return getSharedPreferences(context).getString(KEY_NAME, null);
}
public static String getUserId(Context context){
return getSharedPreferences(context).getString(KEY_USERID, null);
}
public static String getPasswordUser(Context context){
return getSharedPreferences(context).getString(KEY_PASSWORD, null);
}
public static void setDataBencana(Context context, String place, String latitude, String longitude, String address){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_PLACE, place);
editor.putString(KEY_LATITUDE, latitude);
editor.putString(KEY_LONGITUDE, longitude);
editor.putString(KEY_ADDRESS, address);
editor.commit();
}
public static void setLatLang(Context context, String latitude, String longitude){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
editor.putString(KEY_LATITUDE, latitude);
editor.putString(KEY_LONGITUDE, longitude);
editor.commit();
}
public static String getPlaceBencana(Context context){
return getSharedPreferences(context).getString(KEY_PLACE, null);
}
public static String getLatitudeBencana(Context context){
return getSharedPreferences(context).getString(KEY_LATITUDE, null);
}
public static String getLongitudeBencana(Context context){
return getSharedPreferences(context).getString(KEY_LONGITUDE, null);
}
public static String getAddressBencana(Context context){
return getSharedPreferences(context).getString(KEY_ADDRESS, null);
}
public static void setCheckLogin(Context context){
// Check login status
if(!isLoggedIn(context)){
// user is not logged in redirect him to Login Activity
Intent i = new Intent(context, LoginActivity.class);
// Closing all the Activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Add new Flag to start new Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Staring Login Activity
context.startActivity(i);
}
}
public static void logoutUser(Context context){
SharedPreferences.Editor editor = getSharedPreferences(context).edit();
// Clearing all data from Shared Preferences
editor.clear();
editor.commit();
// After menu redirect user to Loing Activity
Intent i = new Intent(context, LoginActivity.class);
// Closing all the Activities
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Add new Flag to start new Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Staring Login Activity
context.startActivity(i);
}
// Get Login State
public static boolean isLoggedIn(Context context){
return getSharedPreferences(context).getBoolean(IS_LOGIN, false);
}
public static boolean isDataIn(Context context){
return getSharedPreferences(context).getBoolean(IS_DATA, false);
}
}
| 5,636
| 0.6962
| 0.6962
| 149
| 36.798656
| 28.744413
| 120
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.677852
| false
| false
|
2
|
6e59dcae5cd81d81a5954ba1874b1ed90e927479
| 27,109,833,639,384
|
e87a03e0491334d09efec816a24a04f30c2eb4c1
|
/drivers/basic/src/main/java/de/learnlib/drivers/api/TestDriver.java
|
3e9049fdce51161c931d5615b8f98618e09a781e
|
[
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
LearnLib/learnlib
|
https://github.com/LearnLib/learnlib
|
2a75cee140921555e95d0bc18901d227b0250d6e
|
9ea440ed76c54a90e42ba04b4f9cc1b88c9dd743
|
refs/heads/develop
| 2023-08-19T07:24:42.434000
| 2023-08-02T00:17:55
| 2023-08-02T00:17:55
| 10,172,073
| 180
| 62
|
Apache-2.0
| false
| 2023-06-14T22:44:23
| 2013-05-20T12:18:14
| 2023-05-18T09:37:28
| 2023-06-14T22:44:23
| 27,682
| 170
| 51
| 7
|
Java
| false
| false
|
/* Copyright (C) 2013-2023 TU Dortmund
* This file is part of LearnLib, http://www.learnlib.de/.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.learnlib.drivers.api;
import de.learnlib.api.SUL;
import de.learnlib.mapper.ExecutableInputSUL;
import de.learnlib.mapper.SULMappers;
import de.learnlib.mapper.api.ExecutableInput;
import de.learnlib.mapper.api.SULMapper;
/**
* A test driver executes.
*
* @param <AI>
* abstract input type
* @param <CI>
* concrete input type
* @param <AO>
* abstract output type
* @param <CO>
* concrete output type
*
* @author falkhowar
*/
public class TestDriver<AI, AO, CI extends ExecutableInput<CO>, CO> implements SUL<AI, AO> {
private final SUL<AI, AO> sul;
public TestDriver(SULMapper<AI, AO, CI, CO> mapper) {
this(SULMappers.apply(mapper, new ExecutableInputSUL<>()));
}
private TestDriver(SUL<AI, AO> sul) {
this.sul = sul;
}
@Override
public void pre() {
sul.pre();
}
@Override
public void post() {
sul.post();
}
@Override
public AO step(AI i) {
return sul.step(i);
}
@Override
public boolean canFork() {
return sul.canFork();
}
@Override
public SUL<AI, AO> fork() {
return new TestDriver<>(sul.fork());
}
}
|
UTF-8
|
Java
| 1,867
|
java
|
TestDriver.java
|
Java
|
[
{
"context": "/* Copyright (C) 2013-2023 TU Dortmund\n * This file is part of LearnLib, http://www.lear",
"end": 38,
"score": 0.9287335276603699,
"start": 27,
"tag": "NAME",
"value": "TU Dortmund"
},
{
"context": "<CO>\n * concrete output type\n *\n * @author falkhowar\n */\npublic class TestDriver<AI, AO, CI extends Ex",
"end": 1138,
"score": 0.9804989099502563,
"start": 1129,
"tag": "USERNAME",
"value": "falkhowar"
}
] | null |
[] |
/* Copyright (C) 2013-2023 <NAME>
* This file is part of LearnLib, http://www.learnlib.de/.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.learnlib.drivers.api;
import de.learnlib.api.SUL;
import de.learnlib.mapper.ExecutableInputSUL;
import de.learnlib.mapper.SULMappers;
import de.learnlib.mapper.api.ExecutableInput;
import de.learnlib.mapper.api.SULMapper;
/**
* A test driver executes.
*
* @param <AI>
* abstract input type
* @param <CI>
* concrete input type
* @param <AO>
* abstract output type
* @param <CO>
* concrete output type
*
* @author falkhowar
*/
public class TestDriver<AI, AO, CI extends ExecutableInput<CO>, CO> implements SUL<AI, AO> {
private final SUL<AI, AO> sul;
public TestDriver(SULMapper<AI, AO, CI, CO> mapper) {
this(SULMappers.apply(mapper, new ExecutableInputSUL<>()));
}
private TestDriver(SUL<AI, AO> sul) {
this.sul = sul;
}
@Override
public void pre() {
sul.pre();
}
@Override
public void post() {
sul.post();
}
@Override
public AO step(AI i) {
return sul.step(i);
}
@Override
public boolean canFork() {
return sul.canFork();
}
@Override
public SUL<AI, AO> fork() {
return new TestDriver<>(sul.fork());
}
}
| 1,862
| 0.650241
| 0.643814
| 75
| 23.893333
| 22.81904
| 92
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.413333
| false
| false
|
2
|
8d53f44ab5d110e75c99ba7c1ca398a6c24e0259
| 30,081,950,993,580
|
11695bea5856c33c797b6c82b1fa106d487dc5df
|
/src/main/java/com/shandong/human/resource/service/sys/SurveyTimeService.java
|
7184f37b4abf81c0f8ee28f585eedcde6e987b68
|
[] |
no_license
|
suoluomen/humanresource
|
https://github.com/suoluomen/humanresource
|
418dd08e4a1d82d5ab03380fc21318acadc94c1a
|
11530fb04461e6dd5dfd78a9a9fbc2a28b7b5fb6
|
refs/heads/master
| 2020-03-22T07:13:14.436000
| 2018-09-05T03:39:19
| 2018-09-05T03:39:19
| 139,686,363
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.shandong.human.resource.service.sys;
import com.shandong.human.resource.domain.SurveyTime;
import java.util.ArrayList;
/**
* 调查期Service
* <p>
* Author: syc <522560298@qq.com>
* Date: 3/20/16 下午1:21
*/
public interface SurveyTimeService {
/**
* 获取所有调查时间
*
* @return
*/
ArrayList<SurveyTime> getAllSurveyTime();
/**
* 向表中插入一个时间
*
* @param time
* @return
*/
Integer insertSurveyTime(SurveyTime time);
/**
* 通过id获得所有调查期
*
* @param id
* @return
*/
SurveyTime getAllSurveyTimeById(int id);
/**
* 获得调查期的总数
*
* @return
*/
Integer getSurveyTimeCount();
}
|
UTF-8
|
Java
| 770
|
java
|
SurveyTimeService.java
|
Java
|
[
{
"context": "il.ArrayList;\n\n/**\n * 调查期Service\n * <p>\n * Author: syc <522560298@qq.com>\n * Date: 3/20/16 下午1:21\n */\npu",
"end": 173,
"score": 0.9996110200881958,
"start": 170,
"tag": "USERNAME",
"value": "syc"
},
{
"context": "ayList;\n\n/**\n * 调查期Service\n * <p>\n * Author: syc <522560298@qq.com>\n * Date: 3/20/16 下午1:21\n */\npublic interface Sur",
"end": 191,
"score": 0.9998976588249207,
"start": 175,
"tag": "EMAIL",
"value": "522560298@qq.com"
}
] | null |
[] |
package com.shandong.human.resource.service.sys;
import com.shandong.human.resource.domain.SurveyTime;
import java.util.ArrayList;
/**
* 调查期Service
* <p>
* Author: syc <<EMAIL>>
* Date: 3/20/16 下午1:21
*/
public interface SurveyTimeService {
/**
* 获取所有调查时间
*
* @return
*/
ArrayList<SurveyTime> getAllSurveyTime();
/**
* 向表中插入一个时间
*
* @param time
* @return
*/
Integer insertSurveyTime(SurveyTime time);
/**
* 通过id获得所有调查期
*
* @param id
* @return
*/
SurveyTime getAllSurveyTimeById(int id);
/**
* 获得调查期的总数
*
* @return
*/
Integer getSurveyTimeCount();
}
| 761
| 0.575145
| 0.550578
| 44
| 14.727273
| 14.719133
| 53
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.159091
| false
| false
|
2
|
75a5e5858fa082cbae2c38df91f29da5a8b26d7d
| 9,929,964,455,368
|
21b80edbe036fa2aec8ae566295a8968249a8929
|
/src/main/java/com/blockchain/commune/enums/InOrOutTypeEnum.java
|
0f1aa3a6d4d1af0831fa54479a9bbce3d516477d
|
[] |
no_license
|
linjiahe/Project_integration
|
https://github.com/linjiahe/Project_integration
|
f0bd46ade747792e7d67b5e7899fcb28c91c8273
|
17c77b652d3661194a3bf2c4da11804d168e6332
|
refs/heads/master
| 2020-04-05T02:26:51.470000
| 2018-11-07T02:36:07
| 2018-11-07T02:36:07
| 156,477,189
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.blockchain.commune.enums;
/**
* Created by chijr on 17/8/1.
*/
public enum InOrOutTypeEnum {
IN_TYPE, //收入
OUT_TYPE //支出
}
|
UTF-8
|
Java
| 157
|
java
|
InOrOutTypeEnum.java
|
Java
|
[
{
"context": "e com.blockchain.commune.enums;\n\n/**\n * Created by chijr on 17/8/1.\n */\npublic enum InOrOutTypeEnum {\n ",
"end": 62,
"score": 0.9995918273925781,
"start": 57,
"tag": "USERNAME",
"value": "chijr"
}
] | null |
[] |
package com.blockchain.commune.enums;
/**
* Created by chijr on 17/8/1.
*/
public enum InOrOutTypeEnum {
IN_TYPE, //收入
OUT_TYPE //支出
}
| 157
| 0.630872
| 0.604027
| 10
| 13.9
| 13.59007
| 37
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| false
| false
|
2
|
59d400f21265aa5611fd73d8da199798a9a34990
| 12,627,203,876,137
|
85f70f81885d40afa62092fd604621741fd65617
|
/src/com/fsti/fjdicClient/util/ImageLoaderHelper.java
|
fb2fb0941c812ce57d6510440a2344afe5045d5b
|
[] |
no_license
|
tojames/fuji
|
https://github.com/tojames/fuji
|
a5e62fc51d2b18fc7e5da877d7bc6b915b71d607
|
8a25981077ff311d7b99713ae5480ec5f3a99de5
|
refs/heads/master
| 2019-05-16T03:57:56.131000
| 2015-01-25T14:33:55
| 2015-01-25T14:33:55
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fsti.fjdicClient.util;
import android.content.Context;
import android.widget.ImageView;
import com.fsti.fjdicClient.R;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
/**
* 图片加载帮助�?DisplayImageOptions是用于设置图片显示的类: 1.此类的功能: //设置图片在下载期间显示的图片 showStubImage(R.drawable.ic_launcher) //设置图片Uri为空或是错误的时候显示的图片 showImageForEmptyUri(R.drawable.ic_empty) //设置图片加载/解码过程中错误时候显示的图片 showImageOnFail(R.drawable.ic_error) //设置图片在下载前是否重置,复�?resetViewBeforeLoading() //设置下载的图片是否缓存在内存�?cacheInMemory() //设置下载的图片是否缓存在SD卡中 cacheOnDisc() //设置图片的解码类�?bitmapConfig(Bitmap.Config.RGB_565)
* //设置图片的解码配�?decodingOptions(android.graphics.BitmapFactory.Options decodingOptions) //设置图片下载前的延迟 delayBeforeLoading(int delayInMillis) //设置额外的内容给ImageDownloader extraForDownloader(Object extra) //设置图片加入缓存前,对bitmap进行设置 preProcessor(BitmapProcessor preProcessor) //设置显示前的图片,显示后这个图片�?��保留在缓存中 postProcessor(BitmapProcessor postProcessor) //设置图片以如何的编码方式显示 imageScaleType(ImageScaleType imageScaleType)
* .此类的两种创建方�? DisplayImageOptions 创建的两种方式�? // 创建默认的DisplayImageOptions DisplayImageOptions option_0 = DisplayImageOptions.createSimple(); // 使用DisplayImageOptions.Builder()创建DisplayImageOptions DisplayImageOptions option_1 = new DisplayImageOptions.Builder() .showStubImage(R.drawable.ic_launcher) .showImageOnFail(R.drawable.ic_error) .showImageForEmptyUri(R.drawable.ic_empty).cacheInMemory()
* .cacheOnDisc().displayer(new RoundedBitmapDisplayer(20)) .build(); 3.类中的方法使用: 设置图片的显示方�?displayer(BitmapDisplayer displayer) displayer�?RoundedBitmapDisplayer(int roundPixels)设置圆角图�?FakeBitmapDisplayer()这个类什么都没做 FadeInBitmapDisplayer(int durationMillis)设置图片渐显的时间 �??�??�??�?SimpleBitmapDisplayer()正常显示�?��图片 图片的缩放方�?imageScaleType(ImageScaleType imageScaleType) imageScaleType: EXACTLY
* :图像将完全按比例缩小的目标大�? EXACTLY_STRETCHED:图片会缩放到目标大小完全 IN_SAMPLE_INT:图像将被二次采样的整数�? IN_SAMPLE_POWER_OF_2:图片将降�?倍,直到下一减少步骤,使图像更小的目标大�?NONE:图片不会调整
*
* @author syc
*/
public class ImageLoaderHelper {
public static void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you
// may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO)
// .enableLogging() // Not necessary in common
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);
}
static DisplayImageOptions options = new DisplayImageOptions.Builder().showStubImage(R.drawable.image_load_err)// 加载中的图片
.showImageForEmptyUri(R.drawable.image_load_err)// URL为空的图片
.showImageOnFail(R.drawable.image_load_err)// 加载失败的图片
.cacheInMemory(true)// 是否缓存
.cacheOnDisc(true).displayer(new SimpleBitmapDisplayer()).build(); // 图片圆角
public static void displayImage(ImageView imageView, String url) {
if (url != null && !url.equals("") && !url.substring(0, 5).equals("http:")) {
url = HttpUtil.base_url + url;
}
ImageLoader.getInstance().displayImage(url, imageView, options);
}
public static void displayImage(ImageView imageView, String uri, int tubImage, int emptyImg, int failImg) {
DisplayImageOptions temp_options = new DisplayImageOptions.Builder().showStubImage(tubImage).showImageForEmptyUri(emptyImg).showImageOnFail(failImg).cacheInMemory(true).cacheOnDisc(true)
.displayer(new RoundedBitmapDisplayer(5)).build();
ImageLoader.getInstance().displayImage(uri, imageView, temp_options);
}
public static void displayImageAndSetFail(ImageView imageView, String uri, int failDrawable, int roundPx) {
DisplayImageOptions temp_options = new DisplayImageOptions.Builder().showStubImage(failDrawable).showImageForEmptyUri(failDrawable).showImageOnFail(failDrawable).cacheInMemory(true)
.cacheOnDisc(true).displayer(new RoundedBitmapDisplayer(roundPx)).build();
ImageLoader.getInstance().displayImage(uri, imageView, temp_options);
}
}
|
UTF-8
|
Java
| 5,835
|
java
|
ImageLoaderHelper.java
|
Java
|
[
{
"context": "倍,直到下一减少步骤,使图像更小的目标大�?NONE:图片不会调整\r\n * \r\n * @author syc\r\n */\r\npublic class ImageLoaderHelper {\r\n\r\n pub",
"end": 2405,
"score": 0.9995283484458923,
"start": 2402,
"tag": "USERNAME",
"value": "syc"
}
] | null |
[] |
package com.fsti.fjdicClient.util;
import android.content.Context;
import android.widget.ImageView;
import com.fsti.fjdicClient.R;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;
/**
* 图片加载帮助�?DisplayImageOptions是用于设置图片显示的类: 1.此类的功能: //设置图片在下载期间显示的图片 showStubImage(R.drawable.ic_launcher) //设置图片Uri为空或是错误的时候显示的图片 showImageForEmptyUri(R.drawable.ic_empty) //设置图片加载/解码过程中错误时候显示的图片 showImageOnFail(R.drawable.ic_error) //设置图片在下载前是否重置,复�?resetViewBeforeLoading() //设置下载的图片是否缓存在内存�?cacheInMemory() //设置下载的图片是否缓存在SD卡中 cacheOnDisc() //设置图片的解码类�?bitmapConfig(Bitmap.Config.RGB_565)
* //设置图片的解码配�?decodingOptions(android.graphics.BitmapFactory.Options decodingOptions) //设置图片下载前的延迟 delayBeforeLoading(int delayInMillis) //设置额外的内容给ImageDownloader extraForDownloader(Object extra) //设置图片加入缓存前,对bitmap进行设置 preProcessor(BitmapProcessor preProcessor) //设置显示前的图片,显示后这个图片�?��保留在缓存中 postProcessor(BitmapProcessor postProcessor) //设置图片以如何的编码方式显示 imageScaleType(ImageScaleType imageScaleType)
* .此类的两种创建方�? DisplayImageOptions 创建的两种方式�? // 创建默认的DisplayImageOptions DisplayImageOptions option_0 = DisplayImageOptions.createSimple(); // 使用DisplayImageOptions.Builder()创建DisplayImageOptions DisplayImageOptions option_1 = new DisplayImageOptions.Builder() .showStubImage(R.drawable.ic_launcher) .showImageOnFail(R.drawable.ic_error) .showImageForEmptyUri(R.drawable.ic_empty).cacheInMemory()
* .cacheOnDisc().displayer(new RoundedBitmapDisplayer(20)) .build(); 3.类中的方法使用: 设置图片的显示方�?displayer(BitmapDisplayer displayer) displayer�?RoundedBitmapDisplayer(int roundPixels)设置圆角图�?FakeBitmapDisplayer()这个类什么都没做 FadeInBitmapDisplayer(int durationMillis)设置图片渐显的时间 �??�??�??�?SimpleBitmapDisplayer()正常显示�?��图片 图片的缩放方�?imageScaleType(ImageScaleType imageScaleType) imageScaleType: EXACTLY
* :图像将完全按比例缩小的目标大�? EXACTLY_STRETCHED:图片会缩放到目标大小完全 IN_SAMPLE_INT:图像将被二次采样的整数�? IN_SAMPLE_POWER_OF_2:图片将降�?倍,直到下一减少步骤,使图像更小的目标大�?NONE:图片不会调整
*
* @author syc
*/
public class ImageLoaderHelper {
public static void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you
// may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO)
// .enableLogging() // Not necessary in common
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);
}
static DisplayImageOptions options = new DisplayImageOptions.Builder().showStubImage(R.drawable.image_load_err)// 加载中的图片
.showImageForEmptyUri(R.drawable.image_load_err)// URL为空的图片
.showImageOnFail(R.drawable.image_load_err)// 加载失败的图片
.cacheInMemory(true)// 是否缓存
.cacheOnDisc(true).displayer(new SimpleBitmapDisplayer()).build(); // 图片圆角
public static void displayImage(ImageView imageView, String url) {
if (url != null && !url.equals("") && !url.substring(0, 5).equals("http:")) {
url = HttpUtil.base_url + url;
}
ImageLoader.getInstance().displayImage(url, imageView, options);
}
public static void displayImage(ImageView imageView, String uri, int tubImage, int emptyImg, int failImg) {
DisplayImageOptions temp_options = new DisplayImageOptions.Builder().showStubImage(tubImage).showImageForEmptyUri(emptyImg).showImageOnFail(failImg).cacheInMemory(true).cacheOnDisc(true)
.displayer(new RoundedBitmapDisplayer(5)).build();
ImageLoader.getInstance().displayImage(uri, imageView, temp_options);
}
public static void displayImageAndSetFail(ImageView imageView, String uri, int failDrawable, int roundPx) {
DisplayImageOptions temp_options = new DisplayImageOptions.Builder().showStubImage(failDrawable).showImageForEmptyUri(failDrawable).showImageOnFail(failDrawable).cacheInMemory(true)
.cacheOnDisc(true).displayer(new RoundedBitmapDisplayer(roundPx)).build();
ImageLoader.getInstance().displayImage(uri, imageView, temp_options);
}
}
| 5,835
| 0.740711
| 0.734751
| 65
| 75.430771
| 94.253502
| 400
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.615385
| false
| false
|
2
|
fee884870b94ed338ab555cb1431dcdd2b6bb35e
| 32,950,989,162,681
|
6392035b0421990479baf09a3bc4ca6bcc431e6e
|
/projects/OpenTripPlanner-e32f161f/curr/src/main/java/org/opentripplanner/analyst/cluster/AnalystClusterRequest.java
|
9c8252475a82c484ba12c8c25888b3a73d8f1fba
|
[] |
no_license
|
ameyaKetkar/RMinerEvaluationTools
|
https://github.com/ameyaKetkar/RMinerEvaluationTools
|
4975130072bf1d4940f9aeb6583eba07d5fedd0a
|
6102a69d1b78ae44c59d71168fc7569ac1ccb768
|
refs/heads/master
| 2020-09-26T00:18:38.389000
| 2020-05-28T17:34:39
| 2020-05-28T17:34:39
| 226,119,387
| 3
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.opentripplanner.analyst.cluster;
import org.opentripplanner.profile.ProfileRequest;
import org.opentripplanner.routing.core.RoutingRequest;
import java.io.Serializable;
/**
* A request sent to an Analyst cluster worker.
* It has two separate fields for RoutingReqeust or ProfileReqeust to facilitate binding from JSON.
* Only one of them should be set in a given instance, with the ProfileRequest taking precedence if both are set.
*/
public class AnalystClusterRequest implements Serializable {
/** The ID of the destinations pointset */
public String destinationPointsetId;
/** The Analyst Cluster user that created this request */
public String userId;
/** The ID of the graph against which to calculate this request */
public String graphId;
/** The job ID this is associated with */
public String jobId;
/** The id of this particular origin */
public String id;
/** To where should the result be POSTed */
public String directOutputUrl;
/** A unique identifier for this request assigned by the queue/broker system. */
public int taskId;
/**
* To what queue should the notification of the result be delivered?
*/
public String outputQueue;
/**
* Where should the job be saved?
*/
public String outputLocation;
/**
* The routing parameters to use if this is a one-to-many profile request.
* If profileRequest is provided, it will take precedence and routingRequest will be ignored.
*/
public ProfileRequest profileRequest;
/**
* The routing parameters to use if this is a non-profile one-to-many request.
* If profileRequest is not provided, we will fall back on this routingRequest.
*/
public RoutingRequest routingRequest;
/** Should times be included in the results (i.e. ResultSetWithTimes rather than ResultSet) */
public boolean includeTimes = false;
private AnalystClusterRequest(String destinationPointsetId, String graphId) {
this.destinationPointsetId = destinationPointsetId;
this.graphId = graphId;
}
/** Create a cluster request that wraps a ProfileRequest, and has no RoutingRequest. */
public AnalystClusterRequest(String destinationPointsetId, String graphId, ProfileRequest req) {
this(destinationPointsetId, graphId);
routingRequest = null;
try {
profileRequest = req.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError();
}
profileRequest.analyst = true;
profileRequest.toLat = profileRequest.fromLat;
profileRequest.toLon = profileRequest.fromLon;
}
/** Create a cluster request that wraps a RoutingRequest, and has no ProfileRequest. */
public AnalystClusterRequest(String destinationPointsetId, String graphId, RoutingRequest req) {
this(destinationPointsetId, graphId);
profileRequest = null;
routingRequest = req.clone();
routingRequest.batch = true;
routingRequest.rctx = null;
}
/** Used for deserialization from JSON */
public AnalystClusterRequest () { /* do nothing */ }
}
|
UTF-8
|
Java
| 2,954
|
java
|
AnalystClusterRequest.java
|
Java
|
[] | null |
[] |
package org.opentripplanner.analyst.cluster;
import org.opentripplanner.profile.ProfileRequest;
import org.opentripplanner.routing.core.RoutingRequest;
import java.io.Serializable;
/**
* A request sent to an Analyst cluster worker.
* It has two separate fields for RoutingReqeust or ProfileReqeust to facilitate binding from JSON.
* Only one of them should be set in a given instance, with the ProfileRequest taking precedence if both are set.
*/
public class AnalystClusterRequest implements Serializable {
/** The ID of the destinations pointset */
public String destinationPointsetId;
/** The Analyst Cluster user that created this request */
public String userId;
/** The ID of the graph against which to calculate this request */
public String graphId;
/** The job ID this is associated with */
public String jobId;
/** The id of this particular origin */
public String id;
/** To where should the result be POSTed */
public String directOutputUrl;
/** A unique identifier for this request assigned by the queue/broker system. */
public int taskId;
/**
* To what queue should the notification of the result be delivered?
*/
public String outputQueue;
/**
* Where should the job be saved?
*/
public String outputLocation;
/**
* The routing parameters to use if this is a one-to-many profile request.
* If profileRequest is provided, it will take precedence and routingRequest will be ignored.
*/
public ProfileRequest profileRequest;
/**
* The routing parameters to use if this is a non-profile one-to-many request.
* If profileRequest is not provided, we will fall back on this routingRequest.
*/
public RoutingRequest routingRequest;
/** Should times be included in the results (i.e. ResultSetWithTimes rather than ResultSet) */
public boolean includeTimes = false;
private AnalystClusterRequest(String destinationPointsetId, String graphId) {
this.destinationPointsetId = destinationPointsetId;
this.graphId = graphId;
}
/** Create a cluster request that wraps a ProfileRequest, and has no RoutingRequest. */
public AnalystClusterRequest(String destinationPointsetId, String graphId, ProfileRequest req) {
this(destinationPointsetId, graphId);
routingRequest = null;
try {
profileRequest = req.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError();
}
profileRequest.analyst = true;
profileRequest.toLat = profileRequest.fromLat;
profileRequest.toLon = profileRequest.fromLon;
}
/** Create a cluster request that wraps a RoutingRequest, and has no ProfileRequest. */
public AnalystClusterRequest(String destinationPointsetId, String graphId, RoutingRequest req) {
this(destinationPointsetId, graphId);
profileRequest = null;
routingRequest = req.clone();
routingRequest.batch = true;
routingRequest.rctx = null;
}
/** Used for deserialization from JSON */
public AnalystClusterRequest () { /* do nothing */ }
}
| 2,954
| 0.755924
| 0.755924
| 91
| 31.461538
| 30.624025
| 113
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.351648
| false
| false
|
2
|
06b743e5185ea12eca718509975bbfc2c33b1bf3
| 30,502,857,792,599
|
c173832fd576d45c875063a1a480672fbd59ca04
|
/seguridad/tags/release-1.0/modulos/apps/LOCALGIS-GPS/src/main/java/es/satec/gps/srs/UTMPoint.java
|
3c7bf71fad38d8c6599ca7c057a329d8422fea8e
|
[] |
no_license
|
jormaral/allocalgis
|
https://github.com/jormaral/allocalgis
|
1308616b0f3ac8aa68fb0820a7dfa89d5a64d0e6
|
bd5b454b9c2e8ee24f70017ae597a32301364a54
|
refs/heads/master
| 2021-01-16T18:08:36.542000
| 2016-04-12T11:43:18
| 2016-04-12T11:43:18
| 50,914,723
| 0
| 0
| null | true
| 2016-02-02T11:04:27
| 2016-02-02T11:04:27
| 2016-01-21T09:50:03
| 2016-01-28T13:15:00
| 519,283
| 0
| 0
| 0
| null | null | null |
package es.satec.gps.srs;
/**
* Punto en coordenadas UTM
* @author jpresa
*/
public class UTMPoint {
/**
* Componente x (Easting)
*/
private double x;
/**
* Componente y (Northing)
*/
private double y;
/**
* Huso o zona UTM
*/
private int zone;
/**
* Constructor
* @param x Coordenada x
* @param y Coordenada y
* @param zone Huso o zona UTM
*/
public UTMPoint(double x, double y, int zone) {
this.x = x;
this.y = y;
this.zone = zone;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public int getZone() {
return zone;
}
public void setZone(int zone) {
this.zone = zone;
}
public String toString() {
return "(" + x + ", " + y + " - "+ zone + ")";
}
}
|
UTF-8
|
Java
| 908
|
java
|
UTMPoint.java
|
Java
|
[
{
"context": "s;\r\n\r\n/**\r\n * Punto en coordenadas UTM\r\n * @author jpresa\r\n */\r\npublic class UTMPoint {\r\n\r\n\t/**\r\n\t * Compon",
"end": 80,
"score": 0.9970752596855164,
"start": 74,
"tag": "USERNAME",
"value": "jpresa"
}
] | null |
[] |
package es.satec.gps.srs;
/**
* Punto en coordenadas UTM
* @author jpresa
*/
public class UTMPoint {
/**
* Componente x (Easting)
*/
private double x;
/**
* Componente y (Northing)
*/
private double y;
/**
* Huso o zona UTM
*/
private int zone;
/**
* Constructor
* @param x Coordenada x
* @param y Coordenada y
* @param zone Huso o zona UTM
*/
public UTMPoint(double x, double y, int zone) {
this.x = x;
this.y = y;
this.zone = zone;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public int getZone() {
return zone;
}
public void setZone(int zone) {
this.zone = zone;
}
public String toString() {
return "(" + x + ", " + y + " - "+ zone + ")";
}
}
| 908
| 0.530837
| 0.530837
| 62
| 12.645162
| 12.104514
| 48
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.258065
| false
| false
|
2
|
94b81162e450e149bf04f24428a29bcc262ac18d
| 21,028,159,887,905
|
e9d266c7046bd87b71bc5ef1914fe94a2b9c880b
|
/ContactApp/app/src/main/java/com/example/contactapp/Type.java
|
a696e94bab31bdc502b6e1e7b94054ab4f66f602
|
[] |
no_license
|
dlooney-ops/ContactApp
|
https://github.com/dlooney-ops/ContactApp
|
c5dcc7cd8194275d9830467727e4b694ce707da4
|
c1f46b200105d619a75e0990998b688ea6f43eff
|
refs/heads/master
| 2021-01-05T11:14:25.886000
| 2020-02-17T06:54:04
| 2020-02-17T06:54:04
| 241,004,895
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.contactapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import java.util.Date;
public class Type extends AppCompatActivity {
Button btn_biz, btn_person, btn_home;
TextView tv_contactList;
ContactAdapter adapter;
ListView lv_contacts;
AddressBook addressBook;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_type);
btn_biz = findViewById(R.id.btn_biz);
btn_person = findViewById(R.id.btn_person);
btn_home = findViewById(R.id.btn_home);
tv_contactList = findViewById(R.id.tv_contactList);
lv_contacts = findViewById(R.id.lv_contacts);
addressBook = ((MyApplication) this.getApplication()).getAddressBook();
adapter = new ContactAdapter(Type.this, addressBook);
lv_contacts.setAdapter(adapter);
Bundle incomingMessages = getIntent().getExtras();
if (incomingMessages !=null) {
String name = incomingMessages.getString("Name");
String phone = incomingMessages.getString("Phone Number");
Location location = incomingMessages.getParcelable("Location");
Date birthday = incomingMessages.getParcelable("Date");
String info = incomingMessages.getString("Info");
Person p = new Person(name, phone, location, birthday, info);
addressBook.getContactList().add(p);
adapter.notifyDataSetChanged();
}
btn_home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
returnHome();
}
});
btn_biz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addBiz();
}
});
btn_person.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addContact();
}
});
lv_contacts.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
editContact(position);
}
});
}
public void editContact(int position) {
Intent i = new Intent(getApplicationContext(), NewContact.class);
BaseContact x = addressBook.getContactList().get(position);
i.putExtra("Name", x.getName());
i.putExtra("Phone", x.getPhone());
startActivity(i);
}
public void returnHome() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
public void addContact() {
Intent intent = new Intent(this, NewContact.class);
startActivity(intent);
}
public void addBiz() {
Intent intent = new Intent(this, new_biz.class);
startActivity(intent);
}
}
|
UTF-8
|
Java
| 3,336
|
java
|
Type.java
|
Java
|
[] | null |
[] |
package com.example.contactapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import java.util.Date;
public class Type extends AppCompatActivity {
Button btn_biz, btn_person, btn_home;
TextView tv_contactList;
ContactAdapter adapter;
ListView lv_contacts;
AddressBook addressBook;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_type);
btn_biz = findViewById(R.id.btn_biz);
btn_person = findViewById(R.id.btn_person);
btn_home = findViewById(R.id.btn_home);
tv_contactList = findViewById(R.id.tv_contactList);
lv_contacts = findViewById(R.id.lv_contacts);
addressBook = ((MyApplication) this.getApplication()).getAddressBook();
adapter = new ContactAdapter(Type.this, addressBook);
lv_contacts.setAdapter(adapter);
Bundle incomingMessages = getIntent().getExtras();
if (incomingMessages !=null) {
String name = incomingMessages.getString("Name");
String phone = incomingMessages.getString("Phone Number");
Location location = incomingMessages.getParcelable("Location");
Date birthday = incomingMessages.getParcelable("Date");
String info = incomingMessages.getString("Info");
Person p = new Person(name, phone, location, birthday, info);
addressBook.getContactList().add(p);
adapter.notifyDataSetChanged();
}
btn_home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
returnHome();
}
});
btn_biz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addBiz();
}
});
btn_person.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addContact();
}
});
lv_contacts.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
editContact(position);
}
});
}
public void editContact(int position) {
Intent i = new Intent(getApplicationContext(), NewContact.class);
BaseContact x = addressBook.getContactList().get(position);
i.putExtra("Name", x.getName());
i.putExtra("Phone", x.getPhone());
startActivity(i);
}
public void returnHome() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
public void addContact() {
Intent intent = new Intent(this, NewContact.class);
startActivity(intent);
}
public void addBiz() {
Intent intent = new Intent(this, new_biz.class);
startActivity(intent);
}
}
| 3,336
| 0.61211
| 0.61211
| 120
| 26.791666
| 24.811588
| 94
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.575
| false
| false
|
2
|
9d3d7cad53a5aa4d4e0599f8f20f7cb3a9582241
| 19,567,871,042,771
|
73a961d362dc7138c16ef6a1b21746440ffb72b7
|
/app/src/main/java/com/wdl/jwdl/model/UserMainMsg.java
|
60a22d284ce086186442fd6e724daf30ba4dc644
|
[] |
no_license
|
truesA/WDL
|
https://github.com/truesA/WDL
|
c3503ff035a109d57bad654da5700121c282b0c9
|
36754567718acda24ea7166ccfd2665110236b76
|
refs/heads/master
| 2018-09-16T02:10:01.219000
| 2018-06-24T11:32:28
| 2018-06-24T11:32:28
| 126,050,715
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wdl.jwdl.model;
/**
* Created by 62682 on 2018/3/20.
*/
import java.io.Serializable;
import java.util.List;
public class UserMainMsg implements Serializable {
/**
* error_code : 200
* reason : 用户详细信息已正确返回!
* result : {"M1":0,"M2":0,"Numb":"13766286568","T1_threshold":430,"birthday":"1900-01-31","body_shop_times":0,"car_age":7,"car_care_times":0,"car_model":"汉兰达","continue_insurance_times":0,"count_appoint":0,"count_continue":0,"count_giveup":0,"cred_score":[0,15,0,168,0],"cred_score_ratio":[0,15,0,168,0],"day_km_recent":77,"economy_times":0,"excellent_times":0,"header":{"request_time":"2018-05-23 00:16:43","response_time":"2018-05-23 00:16:43"},"id":0,"insurance_date":"1900-01-31","km_past":179256,"km_per_day":84,"km_period":11004,"loy_coef":9.33827002571,"maint_single":0,"maint_single_pct":33,"maint_sum":0,"maint_sum_pct":36,"maint_times":8,"month_past":71,"name":"罗","period":131.608959327,"plate_num":"赣D-L1838","repair_times":1,"small_scratch_number":0,"submit_appoint":0,"submit_continue":0,"submit_giveup":0,"submit_loss":0,"survey_speed":0,"wechat_appoint":0,"wechat_id":"0.0","zhe":7.5}
*/
private int error_code;
private String reason;
private ResultBean result;
public int getError_code() {
return error_code;
}
public void setError_code(int error_code) {
this.error_code = error_code;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
public static class ResultBean implements Serializable{
/**
* M1 : 0
* M2 : 0
* Numb : 13766286568
* T1_threshold : 430.0
* birthday : 1900-01-31
* body_shop_times : 0
* car_age : 7
* car_care_times : 0
* car_model : 汉兰达
* continue_insurance_times : 0
* count_appoint : 0
* count_continue : 0
* count_giveup : 0
* cred_score : [0,15,0,168,0]
* cred_score_ratio : [0,15,0,168,0]
* day_km_recent : 77
* economy_times : 0
* excellent_times : 0
* header : {"request_time":"2018-05-23 00:16:43","response_time":"2018-05-23 00:16:43"}
* id : 0
* insurance_date : 1900-01-31
* km_past : 179256
* km_per_day : 84
* km_period : 11004
* loy_coef : 9.33827002571
* maint_single : 0
* maint_single_pct : 33
* maint_sum : 0
* maint_sum_pct : 36
* maint_times : 8
* month_past : 71
* name : 罗
* period : 131.608959327
* plate_num : 赣D-L1838
* repair_times : 1
* small_scratch_number : 0
* submit_appoint : 0
* submit_continue : 0
* submit_giveup : 0
* submit_loss : 0
* survey_speed : 0
* wechat_appoint : 0
* wechat_id : 0.0
* zhe : 7.5
*/
private int M1;
private int M2;
private String Numb;
private int T1_threshold;
private String birthday;
private int body_shop_times;
private int car_age;
private int car_care_times;
private String car_model;
private int continue_insurance_times;
private int count_appoint;
private int count_continue;
private int count_giveup;
private int day_km_recent;
private int economy_times;
private int excellent_times;
private HeaderBean header;
private int userid;
private String insurance_date;
private int km_past;
private int km_per_day;
private int km_period;
private double loy_coef;
private int maint_single;
private int maint_single_pct;
private int maint_sum;
private int maint_sum_pct;
private int maint_times;
private int month_past;
private String name;
private double period;
private String plate_num;
private int repair_times;
private int small_scratch_number;
private int submit_appoint;
private int submit_continue;
private int submit_giveup;
private int submit_loss;
private int survey_speed;
private int wechat_appoint;
private String wechat_id;
private double zhe;
private List<Integer> cred_score;
private List<Double> cred_score_ratio;
public int getM1() {
return M1;
}
public void setM1(int M1) {
this.M1 = M1;
}
public int getM2() {
return M2;
}
public void setM2(int M2) {
this.M2 = M2;
}
public String getNumb() {
return Numb;
}
public void setNumb(String Numb) {
this.Numb = Numb;
}
public int getT1_threshold() {
return T1_threshold;
}
public void setT1_threshold(int T1_threshold) {
this.T1_threshold = T1_threshold;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public int getBody_shop_times() {
return body_shop_times;
}
public void setBody_shop_times(int body_shop_times) {
this.body_shop_times = body_shop_times;
}
public int getCar_age() {
return car_age;
}
public void setCar_age(int car_age) {
this.car_age = car_age;
}
public int getCar_care_times() {
return car_care_times;
}
public void setCar_care_times(int car_care_times) {
this.car_care_times = car_care_times;
}
public String getCar_model() {
return car_model;
}
public void setCar_model(String car_model) {
this.car_model = car_model;
}
public int getContinue_insurance_times() {
return continue_insurance_times;
}
public void setContinue_insurance_times(int continue_insurance_times) {
this.continue_insurance_times = continue_insurance_times;
}
public int getCount_appoint() {
return count_appoint;
}
public void setCount_appoint(int count_appoint) {
this.count_appoint = count_appoint;
}
public int getCount_continue() {
return count_continue;
}
public void setCount_continue(int count_continue) {
this.count_continue = count_continue;
}
public int getCount_giveup() {
return count_giveup;
}
public void setCount_giveup(int count_giveup) {
this.count_giveup = count_giveup;
}
public int getDay_km_recent() {
return day_km_recent;
}
public void setDay_km_recent(int day_km_recent) {
this.day_km_recent = day_km_recent;
}
public int getEconomy_times() {
return economy_times;
}
public void setEconomy_times(int economy_times) {
this.economy_times = economy_times;
}
public int getExcellent_times() {
return excellent_times;
}
public void setExcellent_times(int excellent_times) {
this.excellent_times = excellent_times;
}
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public int getUserid() {
return userid;
}
public void setUserid(int userid) {
this.userid = userid;
}
public String getInsurance_date() {
return insurance_date;
}
public void setInsurance_date(String insurance_date) {
this.insurance_date = insurance_date;
}
public int getKm_past() {
return km_past;
}
public void setKm_past(int km_past) {
this.km_past = km_past;
}
public int getKm_per_day() {
return km_per_day;
}
public void setKm_per_day(int km_per_day) {
this.km_per_day = km_per_day;
}
public int getKm_period() {
return km_period;
}
public void setKm_period(int km_period) {
this.km_period = km_period;
}
public double getLoy_coef() {
return loy_coef;
}
public void setLoy_coef(double loy_coef) {
this.loy_coef = loy_coef;
}
public int getMaint_single() {
return maint_single;
}
public void setMaint_single(int maint_single) {
this.maint_single = maint_single;
}
public int getMaint_single_pct() {
return maint_single_pct;
}
public void setMaint_single_pct(int maint_single_pct) {
this.maint_single_pct = maint_single_pct;
}
public int getMaint_sum() {
return maint_sum;
}
public void setMaint_sum(int maint_sum) {
this.maint_sum = maint_sum;
}
public int getMaint_sum_pct() {
return maint_sum_pct;
}
public void setMaint_sum_pct(int maint_sum_pct) {
this.maint_sum_pct = maint_sum_pct;
}
public int getMaint_times() {
return maint_times;
}
public void setMaint_times(int maint_times) {
this.maint_times = maint_times;
}
public int getMonth_past() {
return month_past;
}
public void setMonth_past(int month_past) {
this.month_past = month_past;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPeriod() {
return period;
}
public void setPeriod(double period) {
this.period = period;
}
public String getPlate_num() {
return plate_num;
}
public void setPlate_num(String plate_num) {
this.plate_num = plate_num;
}
public int getRepair_times() {
return repair_times;
}
public void setRepair_times(int repair_times) {
this.repair_times = repair_times;
}
public int getSmall_scratch_number() {
return small_scratch_number;
}
public void setSmall_scratch_number(int small_scratch_number) {
this.small_scratch_number = small_scratch_number;
}
public int getSubmit_appoint() {
return submit_appoint;
}
public void setSubmit_appoint(int submit_appoint) {
this.submit_appoint = submit_appoint;
}
public int getSubmit_continue() {
return submit_continue;
}
public void setSubmit_continue(int submit_continue) {
this.submit_continue = submit_continue;
}
public int getSubmit_giveup() {
return submit_giveup;
}
public void setSubmit_giveup(int submit_giveup) {
this.submit_giveup = submit_giveup;
}
public int getSubmit_loss() {
return submit_loss;
}
public void setSubmit_loss(int submit_loss) {
this.submit_loss = submit_loss;
}
public int getSurvey_speed() {
return survey_speed;
}
public void setSurvey_speed(int survey_speed) {
this.survey_speed = survey_speed;
}
public int getWechat_appoint() {
return wechat_appoint;
}
public void setWechat_appoint(int wechat_appoint) {
this.wechat_appoint = wechat_appoint;
}
public String getWechat_id() {
return wechat_id;
}
public void setWechat_id(String wechat_id) {
this.wechat_id = wechat_id;
}
public double getZhe() {
return zhe;
}
public void setZhe(double zhe) {
this.zhe = zhe;
}
public List<Integer> getCred_score() {
return cred_score;
}
public void setCred_score(List<Integer> cred_score) {
this.cred_score = cred_score;
}
public List<Double> getCred_score_ratio() {
return cred_score_ratio;
}
public void setCred_score_ratio(List<Double> cred_score_ratio) {
this.cred_score_ratio = cred_score_ratio;
}
public static class HeaderBean {
/**
* request_time : 2018-05-23 00:16:43
* response_time : 2018-05-23 00:16:43
*/
private String request_time;
private String response_time;
public String getRequest_time() {
return request_time;
}
public void setRequest_time(String request_time) {
this.request_time = request_time;
}
public String getResponse_time() {
return response_time;
}
public void setResponse_time(String response_time) {
this.response_time = response_time;
}
}
}
}
|
UTF-8
|
Java
| 13,838
|
java
|
UserMainMsg.java
|
Java
|
[
{
"context": "package com.wdl.jwdl.model;\n\n/**\n * Created by 62682 on 2018/3/20.\n */\n\nimport java.io.Serializable;\ni",
"end": 52,
"score": 0.9463769793510437,
"start": 47,
"tag": "USERNAME",
"value": "62682"
},
{
"context": "m_pct\":36,\"maint_times\":8,\"month_past\":71,\"name\":\"罗\",\"period\":131.608959327,\"plate_num\":\"赣D-L1838\",\"r",
"end": 917,
"score": 0.9994173645973206,
"start": 916,
"tag": "NAME",
"value": "罗"
},
{
"context": "s : 8\n * month_past : 71\n * name : 罗\n * period : 131.608959327\n * pla",
"end": 2769,
"score": 0.841943621635437,
"start": 2769,
"tag": "NAME",
"value": ""
},
{
"context": " : 8\n * month_past : 71\n * name : 罗\n * period : 131.608959327\n * plat",
"end": 2771,
"score": 0.9996820688247681,
"start": 2770,
"tag": "NAME",
"value": "罗"
}
] | null |
[] |
package com.wdl.jwdl.model;
/**
* Created by 62682 on 2018/3/20.
*/
import java.io.Serializable;
import java.util.List;
public class UserMainMsg implements Serializable {
/**
* error_code : 200
* reason : 用户详细信息已正确返回!
* result : {"M1":0,"M2":0,"Numb":"13766286568","T1_threshold":430,"birthday":"1900-01-31","body_shop_times":0,"car_age":7,"car_care_times":0,"car_model":"汉兰达","continue_insurance_times":0,"count_appoint":0,"count_continue":0,"count_giveup":0,"cred_score":[0,15,0,168,0],"cred_score_ratio":[0,15,0,168,0],"day_km_recent":77,"economy_times":0,"excellent_times":0,"header":{"request_time":"2018-05-23 00:16:43","response_time":"2018-05-23 00:16:43"},"id":0,"insurance_date":"1900-01-31","km_past":179256,"km_per_day":84,"km_period":11004,"loy_coef":9.33827002571,"maint_single":0,"maint_single_pct":33,"maint_sum":0,"maint_sum_pct":36,"maint_times":8,"month_past":71,"name":"罗","period":131.608959327,"plate_num":"赣D-L1838","repair_times":1,"small_scratch_number":0,"submit_appoint":0,"submit_continue":0,"submit_giveup":0,"submit_loss":0,"survey_speed":0,"wechat_appoint":0,"wechat_id":"0.0","zhe":7.5}
*/
private int error_code;
private String reason;
private ResultBean result;
public int getError_code() {
return error_code;
}
public void setError_code(int error_code) {
this.error_code = error_code;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
public static class ResultBean implements Serializable{
/**
* M1 : 0
* M2 : 0
* Numb : 13766286568
* T1_threshold : 430.0
* birthday : 1900-01-31
* body_shop_times : 0
* car_age : 7
* car_care_times : 0
* car_model : 汉兰达
* continue_insurance_times : 0
* count_appoint : 0
* count_continue : 0
* count_giveup : 0
* cred_score : [0,15,0,168,0]
* cred_score_ratio : [0,15,0,168,0]
* day_km_recent : 77
* economy_times : 0
* excellent_times : 0
* header : {"request_time":"2018-05-23 00:16:43","response_time":"2018-05-23 00:16:43"}
* id : 0
* insurance_date : 1900-01-31
* km_past : 179256
* km_per_day : 84
* km_period : 11004
* loy_coef : 9.33827002571
* maint_single : 0
* maint_single_pct : 33
* maint_sum : 0
* maint_sum_pct : 36
* maint_times : 8
* month_past : 71
* name : 罗
* period : 131.608959327
* plate_num : 赣D-L1838
* repair_times : 1
* small_scratch_number : 0
* submit_appoint : 0
* submit_continue : 0
* submit_giveup : 0
* submit_loss : 0
* survey_speed : 0
* wechat_appoint : 0
* wechat_id : 0.0
* zhe : 7.5
*/
private int M1;
private int M2;
private String Numb;
private int T1_threshold;
private String birthday;
private int body_shop_times;
private int car_age;
private int car_care_times;
private String car_model;
private int continue_insurance_times;
private int count_appoint;
private int count_continue;
private int count_giveup;
private int day_km_recent;
private int economy_times;
private int excellent_times;
private HeaderBean header;
private int userid;
private String insurance_date;
private int km_past;
private int km_per_day;
private int km_period;
private double loy_coef;
private int maint_single;
private int maint_single_pct;
private int maint_sum;
private int maint_sum_pct;
private int maint_times;
private int month_past;
private String name;
private double period;
private String plate_num;
private int repair_times;
private int small_scratch_number;
private int submit_appoint;
private int submit_continue;
private int submit_giveup;
private int submit_loss;
private int survey_speed;
private int wechat_appoint;
private String wechat_id;
private double zhe;
private List<Integer> cred_score;
private List<Double> cred_score_ratio;
public int getM1() {
return M1;
}
public void setM1(int M1) {
this.M1 = M1;
}
public int getM2() {
return M2;
}
public void setM2(int M2) {
this.M2 = M2;
}
public String getNumb() {
return Numb;
}
public void setNumb(String Numb) {
this.Numb = Numb;
}
public int getT1_threshold() {
return T1_threshold;
}
public void setT1_threshold(int T1_threshold) {
this.T1_threshold = T1_threshold;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public int getBody_shop_times() {
return body_shop_times;
}
public void setBody_shop_times(int body_shop_times) {
this.body_shop_times = body_shop_times;
}
public int getCar_age() {
return car_age;
}
public void setCar_age(int car_age) {
this.car_age = car_age;
}
public int getCar_care_times() {
return car_care_times;
}
public void setCar_care_times(int car_care_times) {
this.car_care_times = car_care_times;
}
public String getCar_model() {
return car_model;
}
public void setCar_model(String car_model) {
this.car_model = car_model;
}
public int getContinue_insurance_times() {
return continue_insurance_times;
}
public void setContinue_insurance_times(int continue_insurance_times) {
this.continue_insurance_times = continue_insurance_times;
}
public int getCount_appoint() {
return count_appoint;
}
public void setCount_appoint(int count_appoint) {
this.count_appoint = count_appoint;
}
public int getCount_continue() {
return count_continue;
}
public void setCount_continue(int count_continue) {
this.count_continue = count_continue;
}
public int getCount_giveup() {
return count_giveup;
}
public void setCount_giveup(int count_giveup) {
this.count_giveup = count_giveup;
}
public int getDay_km_recent() {
return day_km_recent;
}
public void setDay_km_recent(int day_km_recent) {
this.day_km_recent = day_km_recent;
}
public int getEconomy_times() {
return economy_times;
}
public void setEconomy_times(int economy_times) {
this.economy_times = economy_times;
}
public int getExcellent_times() {
return excellent_times;
}
public void setExcellent_times(int excellent_times) {
this.excellent_times = excellent_times;
}
public HeaderBean getHeader() {
return header;
}
public void setHeader(HeaderBean header) {
this.header = header;
}
public int getUserid() {
return userid;
}
public void setUserid(int userid) {
this.userid = userid;
}
public String getInsurance_date() {
return insurance_date;
}
public void setInsurance_date(String insurance_date) {
this.insurance_date = insurance_date;
}
public int getKm_past() {
return km_past;
}
public void setKm_past(int km_past) {
this.km_past = km_past;
}
public int getKm_per_day() {
return km_per_day;
}
public void setKm_per_day(int km_per_day) {
this.km_per_day = km_per_day;
}
public int getKm_period() {
return km_period;
}
public void setKm_period(int km_period) {
this.km_period = km_period;
}
public double getLoy_coef() {
return loy_coef;
}
public void setLoy_coef(double loy_coef) {
this.loy_coef = loy_coef;
}
public int getMaint_single() {
return maint_single;
}
public void setMaint_single(int maint_single) {
this.maint_single = maint_single;
}
public int getMaint_single_pct() {
return maint_single_pct;
}
public void setMaint_single_pct(int maint_single_pct) {
this.maint_single_pct = maint_single_pct;
}
public int getMaint_sum() {
return maint_sum;
}
public void setMaint_sum(int maint_sum) {
this.maint_sum = maint_sum;
}
public int getMaint_sum_pct() {
return maint_sum_pct;
}
public void setMaint_sum_pct(int maint_sum_pct) {
this.maint_sum_pct = maint_sum_pct;
}
public int getMaint_times() {
return maint_times;
}
public void setMaint_times(int maint_times) {
this.maint_times = maint_times;
}
public int getMonth_past() {
return month_past;
}
public void setMonth_past(int month_past) {
this.month_past = month_past;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPeriod() {
return period;
}
public void setPeriod(double period) {
this.period = period;
}
public String getPlate_num() {
return plate_num;
}
public void setPlate_num(String plate_num) {
this.plate_num = plate_num;
}
public int getRepair_times() {
return repair_times;
}
public void setRepair_times(int repair_times) {
this.repair_times = repair_times;
}
public int getSmall_scratch_number() {
return small_scratch_number;
}
public void setSmall_scratch_number(int small_scratch_number) {
this.small_scratch_number = small_scratch_number;
}
public int getSubmit_appoint() {
return submit_appoint;
}
public void setSubmit_appoint(int submit_appoint) {
this.submit_appoint = submit_appoint;
}
public int getSubmit_continue() {
return submit_continue;
}
public void setSubmit_continue(int submit_continue) {
this.submit_continue = submit_continue;
}
public int getSubmit_giveup() {
return submit_giveup;
}
public void setSubmit_giveup(int submit_giveup) {
this.submit_giveup = submit_giveup;
}
public int getSubmit_loss() {
return submit_loss;
}
public void setSubmit_loss(int submit_loss) {
this.submit_loss = submit_loss;
}
public int getSurvey_speed() {
return survey_speed;
}
public void setSurvey_speed(int survey_speed) {
this.survey_speed = survey_speed;
}
public int getWechat_appoint() {
return wechat_appoint;
}
public void setWechat_appoint(int wechat_appoint) {
this.wechat_appoint = wechat_appoint;
}
public String getWechat_id() {
return wechat_id;
}
public void setWechat_id(String wechat_id) {
this.wechat_id = wechat_id;
}
public double getZhe() {
return zhe;
}
public void setZhe(double zhe) {
this.zhe = zhe;
}
public List<Integer> getCred_score() {
return cred_score;
}
public void setCred_score(List<Integer> cred_score) {
this.cred_score = cred_score;
}
public List<Double> getCred_score_ratio() {
return cred_score_ratio;
}
public void setCred_score_ratio(List<Double> cred_score_ratio) {
this.cred_score_ratio = cred_score_ratio;
}
public static class HeaderBean {
/**
* request_time : 2018-05-23 00:16:43
* response_time : 2018-05-23 00:16:43
*/
private String request_time;
private String response_time;
public String getRequest_time() {
return request_time;
}
public void setRequest_time(String request_time) {
this.request_time = request_time;
}
public String getResponse_time() {
return response_time;
}
public void setResponse_time(String response_time) {
this.response_time = response_time;
}
}
}
}
| 13,838
| 0.536242
| 0.509351
| 518
| 25.635136
| 43.056084
| 905
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.407336
| false
| false
|
2
|
4ff0b3dcc13e7f6353c540bc0f09427bba09cc39
| 10,264,971,905,850
|
cd8eb2ba8003459a460d98de67998e31c70f9da8
|
/src/main/java/br/com/lifetime/domain/HistoricoAai.java
|
0669c16462ec1216e93541b829cdf5efc2cd4a2f
|
[] |
no_license
|
SirPeters020/ModCampJava-Spring-Hibernate
|
https://github.com/SirPeters020/ModCampJava-Spring-Hibernate
|
ebc36745e205915b9e7077cb4a213e67b88547c8
|
80a37f5b8fb31710e86b8a6ae6541cff9729aff9
|
refs/heads/master
| 2023-04-28T19:00:33.381000
| 2020-03-10T17:32:33
| 2020-03-10T17:32:33
| 246,301,339
| 0
| 0
| null | false
| 2023-04-14T17:57:46
| 2020-03-10T12:57:57
| 2020-03-10T17:32:25
| 2023-04-14T17:57:46
| 4,788
| 0
| 0
| 2
|
HTML
| false
| false
|
package br.com.lifetime.domain;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
/**
*
* @author pedro.silva
* Tabela para armazenar historico de registro Aai
*
*/
@Entity
public class HistoricoAai implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; // id do registro no historico
// @ManyToOne(cascade = CascadeType.ALL)
// @JoinColumn(name = "controle_campanha_id")
private Aai aai;
private Integer aaiId; //id registro Aai
private String nmAai;
private String email;
private int nmTelefone;
private boolean status;
private String dataAtualizacao;
private boolean ativo;
public HistoricoAai () {
}
public HistoricoAai (Aai obj) {
aaiId = obj.getId();
nmAai = obj.getNmAai();
email = obj.getEmail();
nmTelefone = obj.getNmTelefone();
status = obj.isStatus();
dataAtualizacao = obj.getDataAtualizacao();
ativo = obj.isAtivo();
}
public HistoricoAai(Integer id, Aai aai, Integer aaiId, String nmAai, String email, int nmTelefone, boolean status,
String dataAtualizacao, boolean ativo) {
super();
this.id = id;
this.aai = aai;
this.aaiId = aaiId;
this.nmAai = nmAai;
this.email = email;
this.nmTelefone = nmTelefone;
this.status = status;
this.dataAtualizacao = dataAtualizacao;
this.ativo = ativo;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Aai getAai() {
return aai;
}
public void setAai(Aai aai) {
this.aai = aai;
}
public Integer getAaiId() {
return aaiId;
}
public void setAaiId(Integer aaiId) {
this.aaiId = aaiId;
}
public String getNmAai() {
return nmAai;
}
public void setNmAai(String nmAai) {
this.nmAai = nmAai;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getNmTelefone() {
return nmTelefone;
}
public void setNmTelefone(int nmTelefone) {
this.nmTelefone = nmTelefone;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public String getDataAtualizacao() {
return dataAtualizacao;
}
public void setDataAtualizacao(String dataAtualizacao) {
this.dataAtualizacao = dataAtualizacao;
}
public boolean isAtivo() {
return ativo;
}
public void setAtivo(boolean ativo) {
this.ativo = ativo;
}
}
|
UTF-8
|
Java
| 2,686
|
java
|
HistoricoAai.java
|
Java
|
[
{
"context": "t javax.persistence.ManyToOne;\n\n/**\n * \n * @author pedro.silva\n * Tabela para armazenar historico de registro Aa",
"end": 349,
"score": 0.8934321403503418,
"start": 338,
"tag": "NAME",
"value": "pedro.silva"
}
] | null |
[] |
package br.com.lifetime.domain;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
/**
*
* @author pedro.silva
* Tabela para armazenar historico de registro Aai
*
*/
@Entity
public class HistoricoAai implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; // id do registro no historico
// @ManyToOne(cascade = CascadeType.ALL)
// @JoinColumn(name = "controle_campanha_id")
private Aai aai;
private Integer aaiId; //id registro Aai
private String nmAai;
private String email;
private int nmTelefone;
private boolean status;
private String dataAtualizacao;
private boolean ativo;
public HistoricoAai () {
}
public HistoricoAai (Aai obj) {
aaiId = obj.getId();
nmAai = obj.getNmAai();
email = obj.getEmail();
nmTelefone = obj.getNmTelefone();
status = obj.isStatus();
dataAtualizacao = obj.getDataAtualizacao();
ativo = obj.isAtivo();
}
public HistoricoAai(Integer id, Aai aai, Integer aaiId, String nmAai, String email, int nmTelefone, boolean status,
String dataAtualizacao, boolean ativo) {
super();
this.id = id;
this.aai = aai;
this.aaiId = aaiId;
this.nmAai = nmAai;
this.email = email;
this.nmTelefone = nmTelefone;
this.status = status;
this.dataAtualizacao = dataAtualizacao;
this.ativo = ativo;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Aai getAai() {
return aai;
}
public void setAai(Aai aai) {
this.aai = aai;
}
public Integer getAaiId() {
return aaiId;
}
public void setAaiId(Integer aaiId) {
this.aaiId = aaiId;
}
public String getNmAai() {
return nmAai;
}
public void setNmAai(String nmAai) {
this.nmAai = nmAai;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getNmTelefone() {
return nmTelefone;
}
public void setNmTelefone(int nmTelefone) {
this.nmTelefone = nmTelefone;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public String getDataAtualizacao() {
return dataAtualizacao;
}
public void setDataAtualizacao(String dataAtualizacao) {
this.dataAtualizacao = dataAtualizacao;
}
public boolean isAtivo() {
return ativo;
}
public void setAtivo(boolean ativo) {
this.ativo = ativo;
}
}
| 2,686
| 0.714445
| 0.714073
| 140
| 18.185715
| 17.972433
| 116
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.428571
| false
| false
|
2
|
41cb460c4eb0d2657b89c62a70c6429fff6423d4
| 30,545,807,473,197
|
f19612658eac2182524b8eb5a1ff98c7b09f1e1f
|
/29_interfaces/src/service/Item.java
|
13e378ad016ef8790b8fd9778103269d39d454a2
|
[] |
no_license
|
nachomirsol/ejercicios_curso_java_profesional
|
https://github.com/nachomirsol/ejercicios_curso_java_profesional
|
de51619dcc3c5f0c59b99e8fd694517f792d2491
|
ae89018b5a390c49187e0302ccc962d421e78c57
|
refs/heads/master
| 2022-11-17T16:21:57.566000
| 2020-07-16T10:23:06
| 2020-07-16T10:23:06
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package service;
public interface Item {
boolean activo();
void procesar();
}
|
UTF-8
|
Java
| 89
|
java
|
Item.java
|
Java
|
[] | null |
[] |
package service;
public interface Item {
boolean activo();
void procesar();
}
| 89
| 0.651685
| 0.651685
| 6
| 12.5
| 8.770215
| 23
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.833333
| false
| false
|
2
|
acad536aa68a1adbda10ab1eb89ce96d3ed0c8db
| 28,114,855,961,210
|
e9027da3d0f4a9dd9a5b48537f6c60b8dbdd8719
|
/src/sve/core/Generator.java
|
0e372e3470dd0829a09969c2c111d656cfd7d991
|
[
"MIT"
] |
permissive
|
TommyTeaVee/Simple-Virtual-Ecosystem
|
https://github.com/TommyTeaVee/Simple-Virtual-Ecosystem
|
33fa66ff4c68d2c2b3265a01619ff649fc0c721f
|
14dd64483b61860c17e35df03dd510a133d8510d
|
refs/heads/master
| 2022-11-08T06:40:11.023000
| 2020-06-24T18:03:38
| 2020-06-24T18:03:38
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package sve.core;
import java.util.ArrayList;
public interface Generator<E> {
ArrayList<E> generate(int count);
}
|
UTF-8
|
Java
| 118
|
java
|
Generator.java
|
Java
|
[] | null |
[] |
package sve.core;
import java.util.ArrayList;
public interface Generator<E> {
ArrayList<E> generate(int count);
}
| 118
| 0.745763
| 0.745763
| 8
| 13.75
| 14.245613
| 34
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
2
|
d3a74181e2c38217922d6f3c3e8db8b1d258e575
| 3,985,729,711,284
|
86e4b6b77665fba90eb9a0d4e10e4646bf1e2ac4
|
/Spring03_MyBatis/src/main/java/com/gura/spring03/member/service/MemberService.java
|
39c99a9fbaa2217c42eaa242085233e92738af92
|
[] |
no_license
|
hs-keko/acorn2021_Spring
|
https://github.com/hs-keko/acorn2021_Spring
|
8eda65bda0037250f80d3c95e392cd64568595ae
|
6adacc578cd0401a71172d96581b9e81592bdec7
|
refs/heads/master
| 2023-07-08T20:17:34.811000
| 2021-08-18T06:26:36
| 2021-08-18T06:26:36
| 389,577,675
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gura.spring03.member.service;
import org.springframework.web.servlet.ModelAndView;
import com.gura.spring03.member.dto.MemberDto;
public interface MemberService {
//회원 정보를 추가 해주는 메소드
public void addMember(MemberDto dto);
//회원 정보를 수정 해주는 메소드
public void updateMember(MemberDto dto);
//회원 정보를 삭제 해주는 메소드
public void deleteMember(int num);
//회원 한명의 정보를 인자로 전달한 ModelAndView 객체에 담아주는 메소드
public void getMember(int num, ModelAndView mView);
//회원 전체의 정보를 인자로 전달한 ModelAndView 객체에 담아주는 메소드
public void getListMember(ModelAndView mView);
}
|
UTF-8
|
Java
| 732
|
java
|
MemberService.java
|
Java
|
[] | null |
[] |
package com.gura.spring03.member.service;
import org.springframework.web.servlet.ModelAndView;
import com.gura.spring03.member.dto.MemberDto;
public interface MemberService {
//회원 정보를 추가 해주는 메소드
public void addMember(MemberDto dto);
//회원 정보를 수정 해주는 메소드
public void updateMember(MemberDto dto);
//회원 정보를 삭제 해주는 메소드
public void deleteMember(int num);
//회원 한명의 정보를 인자로 전달한 ModelAndView 객체에 담아주는 메소드
public void getMember(int num, ModelAndView mView);
//회원 전체의 정보를 인자로 전달한 ModelAndView 객체에 담아주는 메소드
public void getListMember(ModelAndView mView);
}
| 732
| 0.777778
| 0.770609
| 18
| 30
| 18.630919
| 52
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.055556
| false
| false
|
2
|
1249b67c2eeb8ccb40ccf315407362cd35f71ca3
| 18,691,697,729,858
|
b4a6475cc7fb7b2f13d8a248f4752aa3a87bc41d
|
/app/src/main/java/anand/com/currencyapp/activities/MainActivity.java
|
2fc77a09f0c1ab5546d72f035b87270bf4361788
|
[] |
no_license
|
anandmjoseph/CurrencylayerAPIAPP
|
https://github.com/anandmjoseph/CurrencylayerAPIAPP
|
4450627c0abf00331217baf845cf627c305d1136
|
724fe86a73d54429da3fa49e75d9756510fdf230
|
refs/heads/master
| 2021-03-11T01:20:04.583000
| 2020-03-15T11:56:53
| 2020-03-15T11:56:53
| 246,501,297
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package anand.com.currencyapp.activities;
import anand.com.currencyapp.R;
import anand.com.currencyapp.adapters.CurrencyTypeListAdapter;
import anand.com.currencyapp.adapters.LeftDrawerAdapter;
import anand.com.currencyapp.fragments.ChangeAmountFragment;
import anand.com.currencyapp.managers.Repository;
import anand.com.currencyapp.managers.StorageManager;
import anand.com.currencyapp.tasks.CacheDataTask;
import anand.com.currencyapp.tasks.PrepareDataTask;
import anand.com.currencyapp.tasks.PrepareDataTaskInterface;
import anand.com.currencyapp.ui.CurrencyOverviewActivity;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.MenuItemCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;
import io.realm.Realm;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends AppCompatActivity implements PrepareDataTaskInterface {
private static final String TAG = MainActivity.class.getName();
private ProgressDialog mDialog;
private ActionBarDrawerToggle mDrawerToggle;
private CurrencyTypeListAdapter adapter;
List<String> menuItems = Arrays.asList("Add Expense","Change amount", "Clear cache", "Exit");
@BindView(R.id.currencyList) ListView currencyListView;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.drawer_layout) DrawerLayout mDrawerLayout;
@BindView(R.id.left_drawer) ListView leftDrawer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
Repository.getInstance().mAppContext = getApplicationContext();
Realm.init(this);
this.setupToolbar();
prepareData();
}
private void setupToolbar() {
toolbar.setTitle("Currency list from ApiLayer");
toolbar.setNavigationIcon(R.drawable.ic_menu_white_36dp);
setSupportActionBar(toolbar);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
toolbar, R.string.drawer_open, R.string.drawer_close) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
};
leftDrawer.setAdapter(new LeftDrawerAdapter(this, menuItems));
// Set the drawer toggle as the DrawerListener
mDrawerLayout.addDrawerListener(mDrawerToggle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Pass the event to ActionBarDrawerToggle, if it returns
// true, then it has handled the app icon touch event
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// Handle your other action bar items...
return super.onOptionsItemSelected(item);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_currency_overview, menu);
// Retrieve the SearchView and plug it into SearchManager
final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
adapter.filter(newText);
return true;
}
});
return true;
}
private Activity getActivityContext() {
return this;
}
//region Data preparation
private void prepareData() {
mDialog = new ProgressDialog(this);
mDialog.setMessage("Please wait...");
mDialog.setCancelable(false);
mDialog.show();
PrepareDataTask t = new PrepareDataTask();
t.delegate = this;
t.execute();
}
@Override
public void prepareDataFinished(Boolean finished) {
Log.d(TAG, finished ? "FINISHED" : "NOT FINISHED");
if (finished) {
adapter = new CurrencyTypeListAdapter(MainActivity.this.getActivityContext());
currencyListView.setAdapter(adapter);
if (mDialog != null)
mDialog.cancel();
CacheDataTask task = new CacheDataTask();
task.execute();
}
}
//endregion
//region UI Events
@OnItemClick(R.id.left_drawer)
void onDrawerItemSelected(int position){
mDrawerLayout.closeDrawers();
switch (position){
case 0:
callExpense();
break;
case 1:
this.showChangeAmountDialog();
break;
case 2:
// Clear data from DB
StorageManager s = new StorageManager();
s.clearDB();
prepareData();
break;
case 3:
finish();
break;
}
}
@OnItemClick(R.id.currencyList)
void onCurrencyItemSelected(int position) {
Repository.getInstance().selectedID = adapter.mData.get(position).ID;
Intent intent = new Intent(this, CurrencyOverviewActivity.class);
startActivity(intent);
}
void callExpense(){
Intent intent = new Intent(this, ExpenseActivity.class);
startActivity(intent);
}
//endregion
void showChangeAmountDialog(){
ChangeAmountFragment dialog = new ChangeAmountFragment();
dialog.show(getFragmentManager(),"Change base amount");
}
}
|
UTF-8
|
Java
| 7,161
|
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package anand.com.currencyapp.activities;
import anand.com.currencyapp.R;
import anand.com.currencyapp.adapters.CurrencyTypeListAdapter;
import anand.com.currencyapp.adapters.LeftDrawerAdapter;
import anand.com.currencyapp.fragments.ChangeAmountFragment;
import anand.com.currencyapp.managers.Repository;
import anand.com.currencyapp.managers.StorageManager;
import anand.com.currencyapp.tasks.CacheDataTask;
import anand.com.currencyapp.tasks.PrepareDataTask;
import anand.com.currencyapp.tasks.PrepareDataTaskInterface;
import anand.com.currencyapp.ui.CurrencyOverviewActivity;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.MenuItemCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;
import io.realm.Realm;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends AppCompatActivity implements PrepareDataTaskInterface {
private static final String TAG = MainActivity.class.getName();
private ProgressDialog mDialog;
private ActionBarDrawerToggle mDrawerToggle;
private CurrencyTypeListAdapter adapter;
List<String> menuItems = Arrays.asList("Add Expense","Change amount", "Clear cache", "Exit");
@BindView(R.id.currencyList) ListView currencyListView;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.drawer_layout) DrawerLayout mDrawerLayout;
@BindView(R.id.left_drawer) ListView leftDrawer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
Repository.getInstance().mAppContext = getApplicationContext();
Realm.init(this);
this.setupToolbar();
prepareData();
}
private void setupToolbar() {
toolbar.setTitle("Currency list from ApiLayer");
toolbar.setNavigationIcon(R.drawable.ic_menu_white_36dp);
setSupportActionBar(toolbar);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
toolbar, R.string.drawer_open, R.string.drawer_close) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
};
leftDrawer.setAdapter(new LeftDrawerAdapter(this, menuItems));
// Set the drawer toggle as the DrawerListener
mDrawerLayout.addDrawerListener(mDrawerToggle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Pass the event to ActionBarDrawerToggle, if it returns
// true, then it has handled the app icon touch event
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// Handle your other action bar items...
return super.onOptionsItemSelected(item);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_currency_overview, menu);
// Retrieve the SearchView and plug it into SearchManager
final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
adapter.filter(newText);
return true;
}
});
return true;
}
private Activity getActivityContext() {
return this;
}
//region Data preparation
private void prepareData() {
mDialog = new ProgressDialog(this);
mDialog.setMessage("Please wait...");
mDialog.setCancelable(false);
mDialog.show();
PrepareDataTask t = new PrepareDataTask();
t.delegate = this;
t.execute();
}
@Override
public void prepareDataFinished(Boolean finished) {
Log.d(TAG, finished ? "FINISHED" : "NOT FINISHED");
if (finished) {
adapter = new CurrencyTypeListAdapter(MainActivity.this.getActivityContext());
currencyListView.setAdapter(adapter);
if (mDialog != null)
mDialog.cancel();
CacheDataTask task = new CacheDataTask();
task.execute();
}
}
//endregion
//region UI Events
@OnItemClick(R.id.left_drawer)
void onDrawerItemSelected(int position){
mDrawerLayout.closeDrawers();
switch (position){
case 0:
callExpense();
break;
case 1:
this.showChangeAmountDialog();
break;
case 2:
// Clear data from DB
StorageManager s = new StorageManager();
s.clearDB();
prepareData();
break;
case 3:
finish();
break;
}
}
@OnItemClick(R.id.currencyList)
void onCurrencyItemSelected(int position) {
Repository.getInstance().selectedID = adapter.mData.get(position).ID;
Intent intent = new Intent(this, CurrencyOverviewActivity.class);
startActivity(intent);
}
void callExpense(){
Intent intent = new Intent(this, ExpenseActivity.class);
startActivity(intent);
}
//endregion
void showChangeAmountDialog(){
ChangeAmountFragment dialog = new ChangeAmountFragment();
dialog.show(getFragmentManager(),"Change base amount");
}
}
| 7,161
| 0.671415
| 0.670577
| 210
| 33.104763
| 24.632315
| 115
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.57619
| false
| false
|
2
|
a78de5407ec2cf7039ef4417fe93d61a81bdda43
| 18,691,697,732,666
|
da3ec14615365ea89232184ff3c6b6d68a38b6c8
|
/stubs/Plane.java
|
3eb6e42e9423a973c408b43bc9310718092ea344
|
[] |
no_license
|
andyw330/software_testing_hw3
|
https://github.com/andyw330/software_testing_hw3
|
5b1576d76d06ccb77e01877a526810f45b68efb2
|
1d97917dab2572ee04609dbff9c95500ad3cb1c8
|
refs/heads/master
| 2021-01-21T19:28:02.745000
| 2017-06-02T12:03:41
| 2017-06-02T12:03:41
| 92,140,552
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package stubs;
import java.io.*;
public class Plane {
public SeatType[] planeSeatTypes = new SeatType[TYPE.number];
public Seat[]
A = new Seat[72],
B = new Seat[72],
C = new Seat[72],
D = new Seat[72],
E = new Seat[72],
F = new Seat[72],
G = new Seat[72],
H = new Seat[72],
J = new Seat[72],
K = new Seat[72];
public Seat[][] seatList = new Seat[10][];
public FoodOrder[] foodList = new FoodOrder[4];
public SeatType[] typeList = new SeatType[4];
public RandomCode[] codeList = new RandomCode[99999];
public int numberCode = 0;
public void boot() {
seatList[0] = A;
seatList[1] = B;
seatList[2] = C;
seatList[3] = D;
seatList[4] = E;
seatList[5] = F;
seatList[6] = G;
seatList[7] = H;
seatList[8] = J;
seatList[9] = K;
foodList[0] = FOOD.NONE;
foodList[1] = FOOD.VEGETABLE;
foodList[2] = FOOD.PORK;
foodList[3] = FOOD.BEEF;
typeList[0] = TYPE.EC;
typeList[1] = TYPE.EDC;
typeList[2] = TYPE.SBC;
typeList[3] = TYPE.SFC;
}
public void insertSeats() {
planeSeatTypes[0] = TYPE.SFC;
planeSeatTypes[1] = TYPE.SBC;
planeSeatTypes[2] = TYPE.EDC;
planeSeatTypes[3] = TYPE.EC;
//Making seats
for (int j = 0; j <= 70; j++) {
A[j] = B[j] = C[j] = D[j] = E[j] = F[j] = G[j] = H[j] = J[j] = K[j] = new Seat();
}
//Inserting seats
for (int i = 0; i <= 1; i++) {
for (int j = planeSeatTypes[i].seatStart; j <= planeSeatTypes[i].seatEnd; j++) {
A[j] = new Seat(planeSeatTypes[i], j, 'A');
C[j] = new Seat(planeSeatTypes[i], j, 'C');
H[j] = new Seat(planeSeatTypes[i], j, 'H');
K[j] = new Seat(planeSeatTypes[i], j, 'K');
//A[j] = C[j] = H[j] = K[j] = new Seat(planeSeatTypes[i], j);
}
}
for (int i = 2; i <= 2; i++) {
for (int j = planeSeatTypes[i].seatStart; j <= planeSeatTypes[i].seatEnd; j++) {
A[j] = new Seat(planeSeatTypes[i], j, 'A');
C[j] = new Seat(planeSeatTypes[i], j, 'C');
D[j] = new Seat(planeSeatTypes[i], j, 'D');
E[j] = new Seat(planeSeatTypes[i], j, 'E');
F[j] = new Seat(planeSeatTypes[i], j, 'F');
G[j] = new Seat(planeSeatTypes[i], j, 'G');
H[j] = new Seat(planeSeatTypes[i], j, 'H');
K[j] = new Seat(planeSeatTypes[i], j, 'K');
//A[j] = C[j] = D[j] = E[j] = F[j] = G[j] = H[j] = K[j] = new Seat(planeSeatTypes[i], j);
}
}
for (int i = 3; i <= 3; i++) {
for (int j = planeSeatTypes[i].seatStart; j <= planeSeatTypes[i].seatEnd; j++) {
A[j] = new Seat(planeSeatTypes[i], j, 'A');
B[j] = new Seat(planeSeatTypes[i], j, 'B');
C[j] = new Seat(planeSeatTypes[i], j, 'C');
D[j] = new Seat(planeSeatTypes[i], j, 'D');
E[j] = new Seat(planeSeatTypes[i], j, 'E');
F[j] = new Seat(planeSeatTypes[i], j, 'F');
G[j] = new Seat(planeSeatTypes[i], j, 'G');
H[j] = new Seat(planeSeatTypes[i], j, 'H');
J[j] = new Seat(planeSeatTypes[i], j, 'J');
K[j] = new Seat(planeSeatTypes[i], j, 'K');
//A[j] = B[j] = C[j] = D[j] = E[j] = F[j] = G[j] = H[j] = J[j] = K[j] = new Seat(planeSeatTypes[i], j);
}
}
}
public void removeRowA(int row) {
A[row].notAvailable();
}
public void removeRowB(int row) {
B[row].notAvailable();
}
public void removeRowC(int row) {
C[row].notAvailable();
}
public void removeRowD(int row) {
D[row].notAvailable();
}
public void removeRowE(int row) {
E[row].notAvailable();
}
public void removeRowF(int row) {
F[row].notAvailable();
}
public void removeRowG(int row) {
G[row].notAvailable();
}
public void removeRowH(int row) {
H[row].notAvailable();
}
public void removeRowJ(int row) {
J[row].notAvailable();
}
public void removeRowK(int row) {
K[row].notAvailable();
}
//Making a new plane
public Plane() {
boot();
insertSeats();
//Removing seats
removeRowD(45);
removeRowE(45);
removeRowF(45);
removeRowG(45);
for (int i = 54; i <= 59; i++) {
removeRowD(i);
removeRowE(i);
removeRowF(i);
removeRowG(i);
}
for (int i = 67; i <= 69; i++) {
removeRowB(i);
removeRowJ(i);
}
removeRowA(70);
removeRowB(70);
removeRowC(70);
removeRowH(70);
removeRowJ(70);
removeRowK(70);
}
public int seatsLeft() {
int temp = 0;
for (int i = 0; i < seatList.length; i++) {
for (int j = 0; j <= 70; j++) {
if (this.seatList[i][j].isBookable()) {
temp++;
}
}
}
return temp;
}
public int seatsLeft(SeatType tempType) {
int temp = 0;
for (int i = 0; i < this.seatList.length; i++) {
for (int j = tempType.seatStart; j <= tempType.seatEnd; j++) {
if (this.seatList[i][j].isBookable()) {
temp++;
}
}
}
return temp;
}
public boolean registerAble(SeatType tempType, int nums) {
if (seatsLeft(tempType) >= nums) {
return true;
} else {
return false;
}
}
public void unregisterSeat(Seat temp) {
this.codeList[temp.getCode() - 1].removeSeat(temp);
temp.unregister();
}
public void registerType(SeatType tempType, int nums) {
if (nums < 1) return;
for (int i = 0; i < this.typeList.length; i++) {
if (tempType.type.equals(this.typeList[i].type)) {
for (int j = tempType.seatStart; j <= tempType.seatEnd; j++) {
for (int k = 0; k < this.seatList.length; k++) {
if (nums < 1) {
return;
}
if (this.seatList[k][j].isBookable()) {
this.seatList[k][j].register(this.numberCode + 1);
codeList[numberCode].addSeat(this.seatList[k][j]);
nums--;
}
}
}
}
if (nums < 1) {
return;
}
}
}
public void resetData() {
FileInputStream fin;
BufferedReader reader;
try {
fin = new FileInputStream("memBACKUP.txt");
reader = new BufferedReader(new InputStreamReader(fin));
String tempString;
String[] tempBreak = new String[400];
String temp;
int tempCount = 0;
int tempReg;
String tempFood;
int tempCode;
int tempSeats;
String tempName;
int tempUsable;
for (int i = 0; i < this.seatList.length; i++) {
for (int j = 0; j < 70; j++) {
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
temp = tempBreak[tempCount++];
tempReg = Integer.parseInt(temp);
temp = tempBreak[tempCount++];
tempFood = temp;
temp = tempBreak[tempCount++];
tempCode = Integer.parseInt(temp);
if (tempReg == 1) {
this.seatList[i][j].register(tempCode);
for (int k = 0; k < this.foodList.length; k++) {
if (tempFood.equals(this.foodList[k].food)) {
this.seatList[i][j].orderFood(this.foodList[k]);
break;
}
}
} else {
this.seatList[i][j].unregister();
this.seatList[i][j].orderFood(FOOD.NONE);
}
}
}
tempString = reader.readLine();
tempCode = Integer.parseInt(tempString);
this.numberCode = tempCode;
for (int i = 0; i < tempCode; i++) {
this.codeList[i] = new RandomCode(i + 1);
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
tempSeats = Integer.parseInt(temp);
if (tempSeats > 1)
for (int k = 0; k < tempSeats; k++) {
temp = tempBreak[tempCount++];
tempName = temp;
if (tempName.charAt(0) >= 'A' && tempName.charAt(0) <= 'H') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A'][Integer.parseInt(intValue)]);
} else if (temp.charAt(0) >= 'J' && temp.charAt(0) <= 'K') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A' - 1][Integer.parseInt(intValue)]);
}
}
temp = tempBreak[tempCount++];
tempUsable = Integer.parseInt(temp);
if (tempUsable == 1) {
this.codeList[i].usable = true;
} else {
this.codeList[i].usable = false;
}
}
fin.close();
} catch (Exception ex) {
System.out.println("Data could not be reset.");
return;
}
this.saveData();
System.out.println("Data is reset.");
}
public void getData() {
FileInputStream fin;
BufferedReader reader;
try {
fin = new FileInputStream("mem.txt");
reader = new BufferedReader(new InputStreamReader(fin));
String tempString;
String[] tempBreak = new String[400];
String temp;
int tempCount = 0;
int tempReg;
String tempFood;
int tempCode;
int tempSeats;
String tempName;
int tempUsable;
for (int i = 0; i < this.seatList.length; i++) {
for (int j = 0; j < 70; j++) {
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
temp = tempBreak[tempCount++];
tempReg = Integer.parseInt(temp);
temp = tempBreak[tempCount++];
tempFood = temp;
temp = tempBreak[tempCount++];
tempCode = Integer.parseInt(temp);
if (tempReg == 1) {
this.seatList[i][j].register(tempCode);
for (int k = 0; k < this.foodList.length; k++) {
if (tempFood.equals(this.foodList[k].food)) {
this.seatList[i][j].orderFood(this.foodList[k]);
break;
}
}
} else {
this.seatList[i][j].unregister();
this.seatList[i][j].orderFood(FOOD.NONE);
}
}
}
tempString = reader.readLine();
tempCode = Integer.parseInt(tempString);
this.numberCode = tempCode;
for (int i = 0; i < tempCode; i++) {
this.codeList[i] = new RandomCode(i + 1);
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
tempSeats = Integer.parseInt(temp);
if (tempSeats == 0) this.codeList[i].usable = false;
for (int k = 0; k < tempSeats; k++) {
temp = tempBreak[tempCount++];
tempName = temp;
if (tempName.charAt(0) >= 'A' && tempName.charAt(0) <= 'H') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A'][Integer.parseInt(intValue)]);
} else if (temp.charAt(0) >= 'J' && temp.charAt(0) <= 'K') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A' - 1][Integer.parseInt(intValue)]);
}
}
temp = tempBreak[tempCount++];
tempUsable = Integer.parseInt(temp);
if (tempUsable == 1) {
this.codeList[i].usable = true;
} else {
this.codeList[i].usable = false;
}
}
fin.close();
} catch (Exception ex) {
System.out.println("Data is corrupted and will be reset.");
this.resetData();
return;
}
}
public void saveData() {
FileOutputStream fout;
try {
byte[] buf;
fout = new FileOutputStream("mem.txt");
for (int i = 0; i < this.seatList.length; i++) {
for (int j = 0; j < 70; j++) {
if (this.seatList[i][j].isAvailable()) {
buf = "1 ".getBytes();
} else {
buf = "0 ".getBytes();
}
fout.write(buf);
if (this.seatList[i][j].isRegistered()) {
buf = "1 ".getBytes();
} else {
buf = "0 ".getBytes();
}
fout.write(buf);
buf = this.seatList[i][j].foodType().getBytes();
fout.write(buf);
buf = " ".getBytes();
fout.write(buf);
buf = String.valueOf(this.seatList[i][j].getCode()).getBytes();
fout.write(buf);
buf = "\n".getBytes();
fout.write(buf);
}
}
buf = String.valueOf(this.numberCode).getBytes();
fout.write(buf);
buf = "\n".getBytes();
fout.write(buf);
for (int i = 0; i < this.numberCode; i++) {
buf = String.valueOf(this.codeList[i].numberSeats()).getBytes();
fout.write(buf);
buf = " ".getBytes();
fout.write(buf);
for (int j = 0; j < this.codeList[i].numberSeats(); j++) {
buf = this.codeList[i].seats[j].seatName.getBytes();
fout.write(buf);
buf = " ".getBytes();
fout.write(buf);
}
if (this.codeList[i].usable) {
buf = "1".getBytes();
} else {
buf = "0".getBytes();
}
fout.write(buf);
buf = "\n".getBytes();
fout.write(buf);
}
fout.close();
} catch (Exception ex) {
System.out.println("File write fail.");
return;
}
}
}
|
UTF-8
|
Java
| 12,120
|
java
|
Plane.java
|
Java
|
[] | null |
[] |
package stubs;
import java.io.*;
public class Plane {
public SeatType[] planeSeatTypes = new SeatType[TYPE.number];
public Seat[]
A = new Seat[72],
B = new Seat[72],
C = new Seat[72],
D = new Seat[72],
E = new Seat[72],
F = new Seat[72],
G = new Seat[72],
H = new Seat[72],
J = new Seat[72],
K = new Seat[72];
public Seat[][] seatList = new Seat[10][];
public FoodOrder[] foodList = new FoodOrder[4];
public SeatType[] typeList = new SeatType[4];
public RandomCode[] codeList = new RandomCode[99999];
public int numberCode = 0;
public void boot() {
seatList[0] = A;
seatList[1] = B;
seatList[2] = C;
seatList[3] = D;
seatList[4] = E;
seatList[5] = F;
seatList[6] = G;
seatList[7] = H;
seatList[8] = J;
seatList[9] = K;
foodList[0] = FOOD.NONE;
foodList[1] = FOOD.VEGETABLE;
foodList[2] = FOOD.PORK;
foodList[3] = FOOD.BEEF;
typeList[0] = TYPE.EC;
typeList[1] = TYPE.EDC;
typeList[2] = TYPE.SBC;
typeList[3] = TYPE.SFC;
}
public void insertSeats() {
planeSeatTypes[0] = TYPE.SFC;
planeSeatTypes[1] = TYPE.SBC;
planeSeatTypes[2] = TYPE.EDC;
planeSeatTypes[3] = TYPE.EC;
//Making seats
for (int j = 0; j <= 70; j++) {
A[j] = B[j] = C[j] = D[j] = E[j] = F[j] = G[j] = H[j] = J[j] = K[j] = new Seat();
}
//Inserting seats
for (int i = 0; i <= 1; i++) {
for (int j = planeSeatTypes[i].seatStart; j <= planeSeatTypes[i].seatEnd; j++) {
A[j] = new Seat(planeSeatTypes[i], j, 'A');
C[j] = new Seat(planeSeatTypes[i], j, 'C');
H[j] = new Seat(planeSeatTypes[i], j, 'H');
K[j] = new Seat(planeSeatTypes[i], j, 'K');
//A[j] = C[j] = H[j] = K[j] = new Seat(planeSeatTypes[i], j);
}
}
for (int i = 2; i <= 2; i++) {
for (int j = planeSeatTypes[i].seatStart; j <= planeSeatTypes[i].seatEnd; j++) {
A[j] = new Seat(planeSeatTypes[i], j, 'A');
C[j] = new Seat(planeSeatTypes[i], j, 'C');
D[j] = new Seat(planeSeatTypes[i], j, 'D');
E[j] = new Seat(planeSeatTypes[i], j, 'E');
F[j] = new Seat(planeSeatTypes[i], j, 'F');
G[j] = new Seat(planeSeatTypes[i], j, 'G');
H[j] = new Seat(planeSeatTypes[i], j, 'H');
K[j] = new Seat(planeSeatTypes[i], j, 'K');
//A[j] = C[j] = D[j] = E[j] = F[j] = G[j] = H[j] = K[j] = new Seat(planeSeatTypes[i], j);
}
}
for (int i = 3; i <= 3; i++) {
for (int j = planeSeatTypes[i].seatStart; j <= planeSeatTypes[i].seatEnd; j++) {
A[j] = new Seat(planeSeatTypes[i], j, 'A');
B[j] = new Seat(planeSeatTypes[i], j, 'B');
C[j] = new Seat(planeSeatTypes[i], j, 'C');
D[j] = new Seat(planeSeatTypes[i], j, 'D');
E[j] = new Seat(planeSeatTypes[i], j, 'E');
F[j] = new Seat(planeSeatTypes[i], j, 'F');
G[j] = new Seat(planeSeatTypes[i], j, 'G');
H[j] = new Seat(planeSeatTypes[i], j, 'H');
J[j] = new Seat(planeSeatTypes[i], j, 'J');
K[j] = new Seat(planeSeatTypes[i], j, 'K');
//A[j] = B[j] = C[j] = D[j] = E[j] = F[j] = G[j] = H[j] = J[j] = K[j] = new Seat(planeSeatTypes[i], j);
}
}
}
public void removeRowA(int row) {
A[row].notAvailable();
}
public void removeRowB(int row) {
B[row].notAvailable();
}
public void removeRowC(int row) {
C[row].notAvailable();
}
public void removeRowD(int row) {
D[row].notAvailable();
}
public void removeRowE(int row) {
E[row].notAvailable();
}
public void removeRowF(int row) {
F[row].notAvailable();
}
public void removeRowG(int row) {
G[row].notAvailable();
}
public void removeRowH(int row) {
H[row].notAvailable();
}
public void removeRowJ(int row) {
J[row].notAvailable();
}
public void removeRowK(int row) {
K[row].notAvailable();
}
//Making a new plane
public Plane() {
boot();
insertSeats();
//Removing seats
removeRowD(45);
removeRowE(45);
removeRowF(45);
removeRowG(45);
for (int i = 54; i <= 59; i++) {
removeRowD(i);
removeRowE(i);
removeRowF(i);
removeRowG(i);
}
for (int i = 67; i <= 69; i++) {
removeRowB(i);
removeRowJ(i);
}
removeRowA(70);
removeRowB(70);
removeRowC(70);
removeRowH(70);
removeRowJ(70);
removeRowK(70);
}
public int seatsLeft() {
int temp = 0;
for (int i = 0; i < seatList.length; i++) {
for (int j = 0; j <= 70; j++) {
if (this.seatList[i][j].isBookable()) {
temp++;
}
}
}
return temp;
}
public int seatsLeft(SeatType tempType) {
int temp = 0;
for (int i = 0; i < this.seatList.length; i++) {
for (int j = tempType.seatStart; j <= tempType.seatEnd; j++) {
if (this.seatList[i][j].isBookable()) {
temp++;
}
}
}
return temp;
}
public boolean registerAble(SeatType tempType, int nums) {
if (seatsLeft(tempType) >= nums) {
return true;
} else {
return false;
}
}
public void unregisterSeat(Seat temp) {
this.codeList[temp.getCode() - 1].removeSeat(temp);
temp.unregister();
}
public void registerType(SeatType tempType, int nums) {
if (nums < 1) return;
for (int i = 0; i < this.typeList.length; i++) {
if (tempType.type.equals(this.typeList[i].type)) {
for (int j = tempType.seatStart; j <= tempType.seatEnd; j++) {
for (int k = 0; k < this.seatList.length; k++) {
if (nums < 1) {
return;
}
if (this.seatList[k][j].isBookable()) {
this.seatList[k][j].register(this.numberCode + 1);
codeList[numberCode].addSeat(this.seatList[k][j]);
nums--;
}
}
}
}
if (nums < 1) {
return;
}
}
}
public void resetData() {
FileInputStream fin;
BufferedReader reader;
try {
fin = new FileInputStream("memBACKUP.txt");
reader = new BufferedReader(new InputStreamReader(fin));
String tempString;
String[] tempBreak = new String[400];
String temp;
int tempCount = 0;
int tempReg;
String tempFood;
int tempCode;
int tempSeats;
String tempName;
int tempUsable;
for (int i = 0; i < this.seatList.length; i++) {
for (int j = 0; j < 70; j++) {
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
temp = tempBreak[tempCount++];
tempReg = Integer.parseInt(temp);
temp = tempBreak[tempCount++];
tempFood = temp;
temp = tempBreak[tempCount++];
tempCode = Integer.parseInt(temp);
if (tempReg == 1) {
this.seatList[i][j].register(tempCode);
for (int k = 0; k < this.foodList.length; k++) {
if (tempFood.equals(this.foodList[k].food)) {
this.seatList[i][j].orderFood(this.foodList[k]);
break;
}
}
} else {
this.seatList[i][j].unregister();
this.seatList[i][j].orderFood(FOOD.NONE);
}
}
}
tempString = reader.readLine();
tempCode = Integer.parseInt(tempString);
this.numberCode = tempCode;
for (int i = 0; i < tempCode; i++) {
this.codeList[i] = new RandomCode(i + 1);
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
tempSeats = Integer.parseInt(temp);
if (tempSeats > 1)
for (int k = 0; k < tempSeats; k++) {
temp = tempBreak[tempCount++];
tempName = temp;
if (tempName.charAt(0) >= 'A' && tempName.charAt(0) <= 'H') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A'][Integer.parseInt(intValue)]);
} else if (temp.charAt(0) >= 'J' && temp.charAt(0) <= 'K') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A' - 1][Integer.parseInt(intValue)]);
}
}
temp = tempBreak[tempCount++];
tempUsable = Integer.parseInt(temp);
if (tempUsable == 1) {
this.codeList[i].usable = true;
} else {
this.codeList[i].usable = false;
}
}
fin.close();
} catch (Exception ex) {
System.out.println("Data could not be reset.");
return;
}
this.saveData();
System.out.println("Data is reset.");
}
public void getData() {
FileInputStream fin;
BufferedReader reader;
try {
fin = new FileInputStream("mem.txt");
reader = new BufferedReader(new InputStreamReader(fin));
String tempString;
String[] tempBreak = new String[400];
String temp;
int tempCount = 0;
int tempReg;
String tempFood;
int tempCode;
int tempSeats;
String tempName;
int tempUsable;
for (int i = 0; i < this.seatList.length; i++) {
for (int j = 0; j < 70; j++) {
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
temp = tempBreak[tempCount++];
tempReg = Integer.parseInt(temp);
temp = tempBreak[tempCount++];
tempFood = temp;
temp = tempBreak[tempCount++];
tempCode = Integer.parseInt(temp);
if (tempReg == 1) {
this.seatList[i][j].register(tempCode);
for (int k = 0; k < this.foodList.length; k++) {
if (tempFood.equals(this.foodList[k].food)) {
this.seatList[i][j].orderFood(this.foodList[k]);
break;
}
}
} else {
this.seatList[i][j].unregister();
this.seatList[i][j].orderFood(FOOD.NONE);
}
}
}
tempString = reader.readLine();
tempCode = Integer.parseInt(tempString);
this.numberCode = tempCode;
for (int i = 0; i < tempCode; i++) {
this.codeList[i] = new RandomCode(i + 1);
tempCount = 0;
tempString = reader.readLine();
tempBreak = tempString.split(" ");
temp = tempBreak[tempCount++];
tempSeats = Integer.parseInt(temp);
if (tempSeats == 0) this.codeList[i].usable = false;
for (int k = 0; k < tempSeats; k++) {
temp = tempBreak[tempCount++];
tempName = temp;
if (tempName.charAt(0) >= 'A' && tempName.charAt(0) <= 'H') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A'][Integer.parseInt(intValue)]);
} else if (temp.charAt(0) >= 'J' && temp.charAt(0) <= 'K') {
String intValue = temp.replaceAll("[A-Z]", "");
this.codeList[i].addSeat(this.seatList[tempName.charAt(0) - 'A' - 1][Integer.parseInt(intValue)]);
}
}
temp = tempBreak[tempCount++];
tempUsable = Integer.parseInt(temp);
if (tempUsable == 1) {
this.codeList[i].usable = true;
} else {
this.codeList[i].usable = false;
}
}
fin.close();
} catch (Exception ex) {
System.out.println("Data is corrupted and will be reset.");
this.resetData();
return;
}
}
public void saveData() {
FileOutputStream fout;
try {
byte[] buf;
fout = new FileOutputStream("mem.txt");
for (int i = 0; i < this.seatList.length; i++) {
for (int j = 0; j < 70; j++) {
if (this.seatList[i][j].isAvailable()) {
buf = "1 ".getBytes();
} else {
buf = "0 ".getBytes();
}
fout.write(buf);
if (this.seatList[i][j].isRegistered()) {
buf = "1 ".getBytes();
} else {
buf = "0 ".getBytes();
}
fout.write(buf);
buf = this.seatList[i][j].foodType().getBytes();
fout.write(buf);
buf = " ".getBytes();
fout.write(buf);
buf = String.valueOf(this.seatList[i][j].getCode()).getBytes();
fout.write(buf);
buf = "\n".getBytes();
fout.write(buf);
}
}
buf = String.valueOf(this.numberCode).getBytes();
fout.write(buf);
buf = "\n".getBytes();
fout.write(buf);
for (int i = 0; i < this.numberCode; i++) {
buf = String.valueOf(this.codeList[i].numberSeats()).getBytes();
fout.write(buf);
buf = " ".getBytes();
fout.write(buf);
for (int j = 0; j < this.codeList[i].numberSeats(); j++) {
buf = this.codeList[i].seats[j].seatName.getBytes();
fout.write(buf);
buf = " ".getBytes();
fout.write(buf);
}
if (this.codeList[i].usable) {
buf = "1".getBytes();
} else {
buf = "0".getBytes();
}
fout.write(buf);
buf = "\n".getBytes();
fout.write(buf);
}
fout.close();
} catch (Exception ex) {
System.out.println("File write fail.");
return;
}
}
}
| 12,120
| 0.575082
| 0.561634
| 457
| 25.520788
| 20.331392
| 107
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.824945
| false
| false
|
2
|
a1c50e9b12d86048fe73ace9481b49747a9354b5
| 25,855,703,182,400
|
c7ba93563487983b4dc59fa77335e241f760ce1b
|
/src/main/java/io/swagger/api/InformationApi.java
|
cf2e56d088449efa42e1ca457bd2001a3b588952
|
[] |
no_license
|
KRolla16/SpringBootApp_AikidoSeminar
|
https://github.com/KRolla16/SpringBootApp_AikidoSeminar
|
345d77fd9182f604244891a17cdc3b814510be7c
|
ed0c7be09d9b1a738264bb1dfc881f2cbf88c3c4
|
refs/heads/master
| 2022-05-27T22:39:53.911000
| 2020-04-30T17:33:27
| 2020-04-30T17:33:27
| 260,275,572
| 1
| 0
| null | false
| 2020-04-30T18:04:52
| 2020-04-30T17:32:19
| 2020-04-30T17:33:58
| 2020-04-30T18:04:51
| 0
| 0
| 0
| 1
|
Java
| false
| false
|
/**
* NOTE: This class is auto generated by the swagger code generator program (2.4.13).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package io.swagger.api;
import io.swagger.model.Exam;
import io.swagger.model.Information;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Optional;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-02T21:58:31.998Z")
@Api(value = "Information", description = "the Information API")
@RequestMapping(value = "")
public interface InformationApi {
Logger log = LoggerFactory.getLogger(InformationApi.class);
default Optional<ObjectMapper> getObjectMapper() {
return Optional.empty();
}
default Optional<HttpServletRequest> getRequest() {
return Optional.empty();
}
default Optional<String> getAcceptHeader() {
return getRequest().map(r -> r.getHeader("Accept"));
}
@ApiOperation(value = "Add a new Post to the seminar", nickname = "addInformation", notes = "Add a new Information to the Seminar", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/Information",
produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" },
method = RequestMethod.POST)
default ResponseEntity<Information> addInformation(@ApiParam(value = "informations to be added to the seminar." ,required=true ) @Valid @RequestBody Information body) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Deletes a post", nickname = "deletePost", notes = "", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Post not found") })
@RequestMapping(value = "/Information/{InformationId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE)
default ResponseEntity<Information> deletePost(@ApiParam(value = "Post id to delete",required=true) @PathVariable("InformationId") Long informationId, @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Find info by ID", nickname = "getinformationById", notes = "Returns a single post", response = Information.class, authorizations = {
@Authorization(value = "api_key")
}, tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Information.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Post not found") })
@RequestMapping(value = "/Information/{InformationId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
default ResponseEntity<Information> getinformationById(@ApiParam(value = "ID of post to return",required=true) @PathVariable("InformationId") Long informationId) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
if (getAcceptHeader().get().contains("application/xml")) {
try {
return new ResponseEntity<>(getObjectMapper().get().readValue("<Information> <id>123456789</id> <name>Post 1</name> <description>Training 1 date has been postponed by half an hour</description> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <date>15.03.2020</date> <author>Kamila Rolla</author></Information>", Information.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/xml", e);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
if (getAcceptHeader().get().contains("application/json")) {
try {
return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"date\" : \"15.03.2020\", \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"author\" : \"Kamila Rolla\", \"name\" : \"Post 1\", \"description\" : \"Training 1 date has been postponed by half an hour\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ]}", Information.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Update an existing Information", nickname = "updateInfo", notes = "Change or add information / post", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Exam not found"),
@ApiResponse(code = 405, message = "Validation exception") })
@RequestMapping(value = "/Information",
produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT)
default ResponseEntity<Information> updateInfo(@ApiParam(value = "informations that needs to be added to the Seminar" ,required=true ) @Valid @RequestBody Exam body) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Updates an post in the Seminar with form data", nickname = "updatePosttWithForm", notes = "", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/Information/{InformationId}",
produces = { "application/xml", "application/json" },
consumes = { "application/x-www-form-urlencoded" },
method = RequestMethod.POST)
default ResponseEntity<Void> updatePosttWithForm(@ApiParam(value = "ID of post that needs to be updated",required=true) @PathVariable("InformationId") Long informationId,@ApiParam(value = "Updated name of the information") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the information") @RequestParam(value="status", required=false) String status) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}
|
UTF-8
|
Java
| 8,588
|
java
|
InformationApi.java
|
Java
|
[
{
"context": "generator program (2.4.13).\n * https://github.com/swagger-api/swagger-codegen\n * Do not edit the class manually",
"end": 123,
"score": 0.9995774626731873,
"start": 112,
"tag": "USERNAME",
"value": "swagger-api"
},
{
"context": "<tags> </tags> <date>15.03.2020</date> <author>Kamila Rolla</author></Information>\", Information.class), Http",
"end": 4895,
"score": 0.9998977780342102,
"start": 4883,
"tag": "NAME",
"value": "Kamila Rolla"
},
{
"context": "[ \\\"photoUrls\\\", \\\"photoUrls\\\" ], \\\"author\\\" : \\\"Kamila Rolla\\\", \\\"name\\\" : \\\"Post 1\\\", \\\"description\\\" : \\\"T",
"end": 5511,
"score": 0.9998895525932312,
"start": 5499,
"tag": "NAME",
"value": "Kamila Rolla"
},
{
"context": "e = \"Update an existing Information\", nickname = \"updateInfo\", notes = \"Change or add information / post\",",
"end": 6414,
"score": 0.7220600843429565,
"start": 6408,
"tag": "USERNAME",
"value": "update"
}
] | null |
[] |
/**
* NOTE: This class is auto generated by the swagger code generator program (2.4.13).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package io.swagger.api;
import io.swagger.model.Exam;
import io.swagger.model.Information;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Optional;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-02T21:58:31.998Z")
@Api(value = "Information", description = "the Information API")
@RequestMapping(value = "")
public interface InformationApi {
Logger log = LoggerFactory.getLogger(InformationApi.class);
default Optional<ObjectMapper> getObjectMapper() {
return Optional.empty();
}
default Optional<HttpServletRequest> getRequest() {
return Optional.empty();
}
default Optional<String> getAcceptHeader() {
return getRequest().map(r -> r.getHeader("Accept"));
}
@ApiOperation(value = "Add a new Post to the seminar", nickname = "addInformation", notes = "Add a new Information to the Seminar", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/Information",
produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" },
method = RequestMethod.POST)
default ResponseEntity<Information> addInformation(@ApiParam(value = "informations to be added to the seminar." ,required=true ) @Valid @RequestBody Information body) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Deletes a post", nickname = "deletePost", notes = "", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Post not found") })
@RequestMapping(value = "/Information/{InformationId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE)
default ResponseEntity<Information> deletePost(@ApiParam(value = "Post id to delete",required=true) @PathVariable("InformationId") Long informationId, @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Find info by ID", nickname = "getinformationById", notes = "Returns a single post", response = Information.class, authorizations = {
@Authorization(value = "api_key")
}, tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Information.class),
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Post not found") })
@RequestMapping(value = "/Information/{InformationId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
default ResponseEntity<Information> getinformationById(@ApiParam(value = "ID of post to return",required=true) @PathVariable("InformationId") Long informationId) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
if (getAcceptHeader().get().contains("application/xml")) {
try {
return new ResponseEntity<>(getObjectMapper().get().readValue("<Information> <id>123456789</id> <name>Post 1</name> <description>Training 1 date has been postponed by half an hour</description> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <date>15.03.2020</date> <author><NAME></author></Information>", Information.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/xml", e);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
if (getAcceptHeader().get().contains("application/json")) {
try {
return new ResponseEntity<>(getObjectMapper().get().readValue("{ \"date\" : \"15.03.2020\", \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"author\" : \"<NAME>\", \"name\" : \"Post 1\", \"description\" : \"Training 1 date has been postponed by half an hour\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ]}", Information.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Update an existing Information", nickname = "updateInfo", notes = "Change or add information / post", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Exam not found"),
@ApiResponse(code = 405, message = "Validation exception") })
@RequestMapping(value = "/Information",
produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT)
default ResponseEntity<Information> updateInfo(@ApiParam(value = "informations that needs to be added to the Seminar" ,required=true ) @Valid @RequestBody Exam body) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ApiOperation(value = "Updates an post in the Seminar with form data", nickname = "updatePosttWithForm", notes = "", tags={ "Information", })
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/Information/{InformationId}",
produces = { "application/xml", "application/json" },
consumes = { "application/x-www-form-urlencoded" },
method = RequestMethod.POST)
default ResponseEntity<Void> updatePosttWithForm(@ApiParam(value = "ID of post that needs to be updated",required=true) @PathVariable("InformationId") Long informationId,@ApiParam(value = "Updated name of the information") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the information") @RequestParam(value="status", required=false) String status) {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default InformationApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}
| 8,576
| 0.668607
| 0.658593
| 148
| 57.027027
| 71.58712
| 522
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.864865
| false
| false
|
2
|
573a33b8b634c4855f8da3a3947d69b37c1f32f9
| 6,210,522,772,810
|
4e862ceb8fe96981cdfbcb5799d81075106cfbb5
|
/test/it/marteEngine/test/fuzzy/FuzzyGreenSlime.java
|
fd04473102af599fc6dbea04de9a366cce08fe6b
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
Gornova/MarteEngine
|
https://github.com/Gornova/MarteEngine
|
4b2063a71d6709e9a35c688ae5ef4b0aae9fd6e4
|
89756429c3856e48b3b390de45da2e749d47f761
|
refs/heads/master
| 2021-01-01T16:56:35.497000
| 2018-03-04T16:44:19
| 2018-03-04T16:44:19
| 912,225
| 47
| 23
| null | false
| 2017-12-31T14:41:07
| 2010-09-15T10:25:14
| 2017-12-30T17:12:46
| 2017-12-31T14:41:06
| 15,042
| 73
| 16
| 22
|
Java
| false
| null |
package it.marteEngine.test.fuzzy;
import it.marteEngine.ME;
import it.marteEngine.entity.Entity;
import it.marteEngine.entity.PhysicsEntity;
import it.marteEngine.entity.PlatformerEntity;
import it.marteEngine.resource.ResourceManager;
import it.marteEngine.tween.Tweener;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
public class FuzzyGreenSlime extends PhysicsEntity {
public static final String SLIME = "slime";
private float moveSpeed = 1;
protected boolean faceRight = false;
private boolean toRemove;
/**
* To handle effects
**/
private Tweener tweener = FuzzyFactory.getFadeMoveTweener();
private float ty;
public FuzzyGreenSlime(float x, float y) throws SlickException {
super(x, y);
addAnimation(ResourceManager.getSpriteSheet("slime"), "move", true, 0,
0, 1, 2, 3);
addType(SLIME);
setHitBox(0, 0, 40, 20);
// make Slime sloow
maxSpeed.x = 1;
setAnim("move");
}
@Override
public void update(GameContainer container, int delta)
throws SlickException {
if (!toRemove) {
super.update(container, delta);
checkGround(true, false);
ty = y;
faceRight = speed.x > 0;
Entity player = collide(PLAYER, x, y - 1);
if (player != null) {
toRemove = true;
((PlatformerEntity) player).jump();
FuzzyGameWorld.addPoints(100);
}
player = collide(PLAYER, x + 1, y);
damagePlayer(player);
player = collide(PLAYER, x - 1, y);
damagePlayer(player);
} else {
tweener.update(delta);
}
if (getAlpha() == 0f) {
if (!FuzzyGameWorld.killSound.playing()) {
FuzzyGameWorld.killSound.play();
}
ME.world.remove(this);
}
}
@Override
public void render(GameContainer container, Graphics g)
throws SlickException {
super.render(container, g);
if (toRemove) {
// if to remove, apply effects
setAlpha(tweener.getTween(FuzzyFactory.FADE).getValue());
ty -= tweener.getTween(FuzzyFactory.MOVE_UP).getValue();
FuzzyMain.font.drawString(x, ty, "100");
}
}
/**
* Check if falling
*/
public void checkGround(boolean revertHorizontal, boolean revertVertical) {
boolean blocked = ((FuzzyGameWorld) world).blocked(this.x
+ this.speed.x + ((faceRight) ? this.width : 0), this.y
+ this.height + 1);
if (!blocked) {
if (revertHorizontal && speed.x != 0)
speed.x = -speed.x;
if (revertVertical && speed.y != 0)
speed.y = -speed.y;
}
}
@Override
public void collisionResponse(Entity other) {
// try to move in old direction
if (faceRight && this.speed.x == 0) {
this.speed.x = -moveSpeed;
faceRight = false;
} else if (!faceRight && this.speed.x == 0) {
this.speed.x = moveSpeed;
faceRight = true;
}
}
private void damagePlayer(Entity player) {
if (player != null) {
FuzzyPlayer pl = (FuzzyPlayer) ME.world.find(PLAYER);
pl.damage(-1);
// change direction
if (faceRight) {
this.x -= 5;
faceRight = false;
this.speed.x = -moveSpeed;
} else {
this.x += 5;
faceRight = true;
this.speed.x = +moveSpeed;
}
}
}
}
|
UTF-8
|
Java
| 3,454
|
java
|
FuzzyGreenSlime.java
|
Java
|
[] | null |
[] |
package it.marteEngine.test.fuzzy;
import it.marteEngine.ME;
import it.marteEngine.entity.Entity;
import it.marteEngine.entity.PhysicsEntity;
import it.marteEngine.entity.PlatformerEntity;
import it.marteEngine.resource.ResourceManager;
import it.marteEngine.tween.Tweener;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
public class FuzzyGreenSlime extends PhysicsEntity {
public static final String SLIME = "slime";
private float moveSpeed = 1;
protected boolean faceRight = false;
private boolean toRemove;
/**
* To handle effects
**/
private Tweener tweener = FuzzyFactory.getFadeMoveTweener();
private float ty;
public FuzzyGreenSlime(float x, float y) throws SlickException {
super(x, y);
addAnimation(ResourceManager.getSpriteSheet("slime"), "move", true, 0,
0, 1, 2, 3);
addType(SLIME);
setHitBox(0, 0, 40, 20);
// make Slime sloow
maxSpeed.x = 1;
setAnim("move");
}
@Override
public void update(GameContainer container, int delta)
throws SlickException {
if (!toRemove) {
super.update(container, delta);
checkGround(true, false);
ty = y;
faceRight = speed.x > 0;
Entity player = collide(PLAYER, x, y - 1);
if (player != null) {
toRemove = true;
((PlatformerEntity) player).jump();
FuzzyGameWorld.addPoints(100);
}
player = collide(PLAYER, x + 1, y);
damagePlayer(player);
player = collide(PLAYER, x - 1, y);
damagePlayer(player);
} else {
tweener.update(delta);
}
if (getAlpha() == 0f) {
if (!FuzzyGameWorld.killSound.playing()) {
FuzzyGameWorld.killSound.play();
}
ME.world.remove(this);
}
}
@Override
public void render(GameContainer container, Graphics g)
throws SlickException {
super.render(container, g);
if (toRemove) {
// if to remove, apply effects
setAlpha(tweener.getTween(FuzzyFactory.FADE).getValue());
ty -= tweener.getTween(FuzzyFactory.MOVE_UP).getValue();
FuzzyMain.font.drawString(x, ty, "100");
}
}
/**
* Check if falling
*/
public void checkGround(boolean revertHorizontal, boolean revertVertical) {
boolean blocked = ((FuzzyGameWorld) world).blocked(this.x
+ this.speed.x + ((faceRight) ? this.width : 0), this.y
+ this.height + 1);
if (!blocked) {
if (revertHorizontal && speed.x != 0)
speed.x = -speed.x;
if (revertVertical && speed.y != 0)
speed.y = -speed.y;
}
}
@Override
public void collisionResponse(Entity other) {
// try to move in old direction
if (faceRight && this.speed.x == 0) {
this.speed.x = -moveSpeed;
faceRight = false;
} else if (!faceRight && this.speed.x == 0) {
this.speed.x = moveSpeed;
faceRight = true;
}
}
private void damagePlayer(Entity player) {
if (player != null) {
FuzzyPlayer pl = (FuzzyPlayer) ME.world.find(PLAYER);
pl.damage(-1);
// change direction
if (faceRight) {
this.x -= 5;
faceRight = false;
this.speed.x = -moveSpeed;
} else {
this.x += 5;
faceRight = true;
this.speed.x = +moveSpeed;
}
}
}
}
| 3,454
| 0.599305
| 0.589751
| 128
| 24.984375
| 19.069767
| 77
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.65625
| false
| false
|
2
|
16f63eeee71252a9562d8376afd66d2d4a7e90c4
| 18,889,266,195,979
|
bfac2a10882a4756058ace967e04b29f7583a89e
|
/qugou-parent/qugou-bg-manager-web/src/main/java/com/ityb/qugou/dao/content/SearchKeywordDao.java
|
93397c2d4f0b5096465b8d3b23dc9d4daa647db1
|
[] |
no_license
|
ityb/ityb-qugou-repository
|
https://github.com/ityb/ityb-qugou-repository
|
419b59d1cd023bc474926a17950900432aff5b9e
|
3f8fbc18d12b6312ae23445d5c7c823920f3da38
|
refs/heads/master
| 2021-01-24T17:43:42.650000
| 2020-03-26T13:22:13
| 2020-03-26T13:22:13
| 123,233,557
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ityb.qugou.dao.content;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.ityb.qugou.base.builder.SqlCondition;
import com.ityb.qugou.base.dao.BaseDao;
import com.ityb.qugou.base.mapper.BaseMapper;
import com.ityb.qugou.po.manager.SearchKeyword;
/**
* 搜索关键字dao
* @author yangbin
* @copyright 2017-2018.yangbin.All rights reserved.
*/
@Repository
public class SearchKeywordDao extends BaseDao<SearchKeyword>{
@Autowired
private BaseMapper baseMapper;
@Override
protected BaseMapper getMapper() {
return baseMapper;
}
@Override
protected Class<?> getModelClass() {
return SearchKeyword.class;
}
@Override
public SqlCondition getCondition(SqlCondition sqlCondition, Map<String, Object> params) {
sqlCondition.addOrderItem("ctime");
sqlCondition.addOrderItem("mtime");
return sqlCondition;
}
}
|
UTF-8
|
Java
| 939
|
java
|
SearchKeywordDao.java
|
Java
|
[
{
"context": "manager.SearchKeyword;\n\n/**\n * 搜索关键字dao\n * @author yangbin\n * @copyright 2017-2018.yangbin.All rights reserv",
"end": 390,
"score": 0.9994189739227295,
"start": 383,
"tag": "USERNAME",
"value": "yangbin"
}
] | null |
[] |
package com.ityb.qugou.dao.content;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.ityb.qugou.base.builder.SqlCondition;
import com.ityb.qugou.base.dao.BaseDao;
import com.ityb.qugou.base.mapper.BaseMapper;
import com.ityb.qugou.po.manager.SearchKeyword;
/**
* 搜索关键字dao
* @author yangbin
* @copyright 2017-2018.yangbin.All rights reserved.
*/
@Repository
public class SearchKeywordDao extends BaseDao<SearchKeyword>{
@Autowired
private BaseMapper baseMapper;
@Override
protected BaseMapper getMapper() {
return baseMapper;
}
@Override
protected Class<?> getModelClass() {
return SearchKeyword.class;
}
@Override
public SqlCondition getCondition(SqlCondition sqlCondition, Map<String, Object> params) {
sqlCondition.addOrderItem("ctime");
sqlCondition.addOrderItem("mtime");
return sqlCondition;
}
}
| 939
| 0.783638
| 0.775027
| 37
| 24.108109
| 22.073322
| 90
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.027027
| false
| false
|
2
|
508a3347636d7381ec19e6a80290de76c8b96bf6
| 9,560,597,215,251
|
8c1ba3cd6b9cc5fe11af1503140df7ba07406f74
|
/niuniu-server/niuniu-dubbo/src/main/java/com/mouchina/moumou_server_dubbo/provider/award/TreasureAwardHistoryServiceSupport.java
|
ccedeae31eaaaa3d2a7ba9610a5010d91338a006
|
[] |
no_license
|
hxxy2003/niuniu-parent1
|
https://github.com/hxxy2003/niuniu-parent1
|
1404c784793fe949552524a24a78993f2224a8f7
|
c4414b9b74f084f16b1b47fde9ffc8c8cc200f3b
|
refs/heads/master
| 2018-03-24T21:33:58.595000
| 2016-12-23T07:43:49
| 2016-12-23T07:43:49
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mouchina.moumou_server_dubbo.provider.award;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.mouchina.base.utils.PercentUtil;
import com.mouchina.moumou_server.dao.advert.RedEnvelopeMapper;
import com.mouchina.moumou_server.dao.award.TreasureAwardHistoryMapper;
import com.mouchina.moumou_server.dao.award.TreasureBoxConfigMapper;
import com.mouchina.moumou_server.dao.member.UserAssetsMapper;
import com.mouchina.moumou_server.dao.member.UserMapper;
import com.mouchina.moumou_server.dao.member.UserPartMapper;
import com.mouchina.moumou_server.entity.advert.RedEnvelope;
import com.mouchina.moumou_server.entity.award.TreasureAwardHistory;
import com.mouchina.moumou_server.entity.award.TreasureBoxConfig;
import com.mouchina.moumou_server.entity.member.User;
import com.mouchina.moumou_server.entity.member.UserAssets;
import com.mouchina.moumou_server_interface.award.TreasureAwardHistoryService;
@Service(value="treasureAwardHistoryServiceSupport")
public class TreasureAwardHistoryServiceSupport implements TreasureAwardHistoryService {
private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
private static SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss");
private static SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Resource
private TreasureAwardHistoryMapper treasureAwardHistoryMapper;
@Resource
private TreasureBoxConfigMapper treasureBoxConfigMapper;
@Resource
private UserAssetsMapper userAssetsMapper;
@Resource
private UserPartMapper userPartMapper;
@Resource
private RedEnvelopeMapper redEnvelopeMapper;
@Resource
private UserMapper userMapper;
@Override
public TreasureAwardHistory addOpenUserTreasureAward(Long userId,String isQuery) {
try {
TreasureAwardHistory treasureAwardHistory = treasureAwardHistoryMapper.selectByUserId(userId);
//第一次领取宝箱
if(treasureAwardHistory == null) {
treasureAwardHistory = new TreasureAwardHistory();
//获取宝箱的奖励值
Map<String,Object> map = this.openAwardBox(null,isQuery);
TreasureBoxConfig treasureBoxConfig = this.getTreasureBoxConfig(sdfTime.format(map.get("openAwardBoxTime")));
treasureAwardHistory.setUserId(userId);
treasureAwardHistory.setTreasureBoxConfigId(treasureBoxConfig.getId());
treasureAwardHistory.setCreateTime(new Date());
treasureAwardHistory.setCountDown((Long) map.get("countDown"));
treasureAwardHistory.setIsClick((String) map.get("isClick"));
//如果是0只进行查询
if("1".equals(isQuery)) {
treasureAwardHistoryMapper.insert(treasureAwardHistory);
//更新用户的财富
Byte awardType = treasureBoxConfig.getType();
Integer awardValue = treasureBoxConfig.getValue();
this.updateUserAward(userId, awardType, awardValue);
//添加收益明细
if(awardType == 1) {
Map<String,String> userPartMap = new HashMap<String,String>();
userPartMap.put("mapprerValue", String.valueOf(userId));
Integer tableIndex = userPartMapper.selectModel(userPartMap).getNum();
Map<String,Object> userMap = new HashMap<String,Object>();
userMap.put("id", userId);
userMap.put("tableNum", tableIndex);
User user = userMapper.selectModel(userMap);
RedEnvelope redEnvelope = new RedEnvelope();
redEnvelope.setAdvertId(Long.valueOf("0"));
redEnvelope.setPublisherId(Long.valueOf("0"));
redEnvelope.setUserId(userId);
redEnvelope.setAmout(awardValue);
redEnvelope.setCreateTime(new Date());
redEnvelope.setUserSex((byte)1);
redEnvelope.setUserNickName(user.getNickName());
redEnvelope.setAdverName("任务奖励");
redEnvelope.setState((byte)1);
redEnvelope.setOriginalAmout(awardValue);
redEnvelope.setAwardTime(new Date());
redEnvelope.setBirthday(user.getBirthday());
redEnvelope.setAwardTime(new Date());
redEnvelopeMapper.insertSelective(redEnvelope);
}
treasureAwardHistory.setType(treasureBoxConfig.getType());
treasureAwardHistory.setValue(treasureBoxConfig.getValue());
}
return treasureAwardHistory;
}
//是否已经开启过宝箱
Date openTreasureTime = treasureAwardHistory.getCreateTime();
Map<String,Object> map = this.openAwardBox(openTreasureTime,isQuery);
TreasureBoxConfig treasureBoxConfig = this.getTreasureBoxConfig(sdfTime.format(map.get("openAwardBoxTime")));
treasureAwardHistory.setUserId(userId);
treasureAwardHistory.setTreasureBoxConfigId(treasureBoxConfig.getId());
treasureAwardHistory.setCreateTime(new Date());
treasureAwardHistory.setCountDown((Long) map.get("countDown"));
treasureAwardHistory.setIsClick((String) map.get("isClick"));
if("1".equals(isQuery)) {
treasureAwardHistoryMapper.updateByPrimaryKey(treasureAwardHistory);
//更新用户的财富
Byte awardType = treasureBoxConfig.getType();
Integer awardValue = treasureBoxConfig.getValue();
this.updateUserAward(userId, awardType, awardValue);
//添加收益明细
if(awardType == 1) {
Map<String,String> userPartMap = new HashMap<String,String>();
userPartMap.put("mapprerValue", String.valueOf(userId));
Integer tableIndex = userPartMapper.selectModel(userPartMap).getNum();
Map<String,Object> userMap = new HashMap<String,Object>();
userMap.put("id", userId);
userMap.put("tableNum", tableIndex);
User user = userMapper.selectModel(userMap);
RedEnvelope redEnvelope = new RedEnvelope();
redEnvelope.setAdvertId(Long.valueOf("0"));
redEnvelope.setPublisherId(Long.valueOf("0"));
redEnvelope.setUserId(userId);
redEnvelope.setAmout(awardValue);
redEnvelope.setCreateTime(new Date());
redEnvelope.setUserSex((byte)1);
redEnvelope.setUserNickName(user.getNickName());
redEnvelope.setAdverName("任务奖励");
redEnvelope.setState((byte)1);
redEnvelope.setOriginalAmout(awardValue);
redEnvelope.setAwardTime(new Date());
redEnvelope.setBirthday(user.getBirthday());
redEnvelope.setAwardTime(new Date());
redEnvelopeMapper.insertSelective(redEnvelope);
}
treasureAwardHistory.setType(treasureBoxConfig.getType());
treasureAwardHistory.setValue(treasureBoxConfig.getValue());
}
return treasureAwardHistory;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 可以开启几点的宝箱
* @param openTreasureTime 上次开宝时间
* @return
* @throws ParseException
*/
public Map<String,Object> openAwardBox(Date openTreasureTime,String isQuery) throws ParseException {
if(openTreasureTime != null) openTreasureTime = sdfTime.parse(sdfTime.format(openTreasureTime));
Date currentTime = sdfTime.parse(sdfTime.format(new Date()));
List<Date> treasureBoxTimes = treasureBoxConfigMapper.getTreasureBoxTimes();
//如果在最开始的时间之前,是不能领取宝箱的
Map<String,Object> map = new HashMap<String,Object>();
if(currentTime.before(treasureBoxTimes.get(0) )) {
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(0));
map.put("countDown", treasureBoxTimes.get(0).getTime() - currentTime.getTime());
return map;
}
for(int i=0; i < treasureBoxTimes.size() ; i++) {
//只有在9点到12点之间才能开启9点的宝箱
if(currentTime.before(treasureBoxTimes.get(i))) {
if( openTreasureTime == null || !(openTreasureTime.after(treasureBoxTimes.get(i-1)) && openTreasureTime.before(treasureBoxTimes.get(i)) ) ) {
//只有 没有打开宝箱的用户 或者 没有在该时间段之内开启过宝箱的用户 才能签到
/*map.put("isClick", "1");
map.put("openAwardBoxTime", treasureBoxTimes.get(i-1));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());*/
if("1".equals(isQuery)) {
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());
} else if("0".equals(isQuery)) {
map.put("isClick", "1");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());
}
return map;
} else if(openTreasureTime.after(treasureBoxTimes.get(i-1)) && openTreasureTime.before(treasureBoxTimes.get(i)) ) {
//在9点到12点之间已经签过到,不能再次签到
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(i));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());
return map;
}
}
}
// 凌晨24点之前可以领取20的宝箱
if(currentTime.before(sdfTime.parse("23:59:59"))) {
//开启时间如果在20点之后已经开启过,那么就不能再次开启
if(openTreasureTime == null || openTreasureTime.before(treasureBoxTimes.get(treasureBoxTimes.size()-1)) ) {
//领取宝箱
if("1".equals(isQuery)) {
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
} else if("0".equals(isQuery)) {
map.put("isClick", "1");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
}
return map;
}
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
return map;
}
return null;
}
/**
* 更新财富值
* @param userId 用户id
* @param awardType 财富类型
* @param awardValue 财富值
*/
private void updateUserAward(Long userId,byte awardType,Integer awardValue) {
Map<String,String> userPartMap = new HashMap<String,String>();
userPartMap.put("mapprerValue", String.valueOf(userId));
Integer tableIndex = userPartMapper.selectModel(userPartMap).getNum();
//查询用户的财富
Map<String,Object> userAssetsMap = new HashMap<String,Object>();
userAssetsMap.put("userId", userId);
userAssetsMap.put("tableNum", tableIndex);
UserAssets userAssets = userAssetsMapper.selectModel(userAssetsMap);
userAssets.setTableNum(tableIndex);
if(awardType == 0) {
//如果是经验 增加经验值
userAssets.setGrowthValue(userAssets.getGrowthValue() + awardValue);
} else if(awardType == 1) {
//如果是红包 增加红包钱数
userAssets.setRedEnvelopeBalance(userAssets.getRedEnvelopeBalance() + awardValue);
}
//更新财富值
userAssetsMapper.updateByUserId(userAssets);
}
/**
* 获取宝箱的类型和财富值
* @param openTreasureTime 几点的宝箱
* @return
*/
private TreasureBoxConfig getTreasureBoxConfig(String openTreasureTime) {
//查询命中率
List<Double> hitRates = treasureBoxConfigMapper.selectHitRate();
Map<String, Object> hitRateMap = PercentUtil.getRandomPercent(hitRates);
Double hitRate = (Double) hitRateMap.get("percent");
//查询命中几率
Map<String,Object> map = new HashMap<String,Object>();
map.put("openTime", "1970-01-01 " + openTreasureTime);
map.put("hitRate", hitRate);
return treasureBoxConfigMapper.selectModel(map);
}
/**
* byte转换成字符串
* @return
*/
public String byteToChar(byte value) {
return new Byte(value).toString();
}
/**
* 查询宝箱当前状态
* @param userId
*/
public void selectAwardStatus(Long userId) {
Map<String,Object> treasureAwardHistoryMap = new HashMap<String,Object>();
treasureAwardHistoryMap.put("userId", userId);
List<TreasureAwardHistory> treasureAwardHistorys = treasureAwardHistoryMapper.selectList(treasureAwardHistoryMap);
Map<String,Object> treasureBoxConfigMap = new HashMap<String,Object>();
List<TreasureBoxConfig> treasureBoxConfigs = treasureBoxConfigMapper.selectList(treasureBoxConfigMap);
if(treasureAwardHistorys == null) {
for(TreasureBoxConfig treasureBoxConfig:treasureBoxConfigs) {
//treasureAwardHistoryMapper.insert(record);
}
}
for(TreasureAwardHistory treasureAwardHistory:treasureAwardHistorys) {
}
}
/**
* 获取一天宝箱的数量
*/
public Integer getAwardNum() {
return 4;
}
/**
* 获取宝箱的种类
*/
public Integer getAwardKind() {
//获取当前宝箱的种类
return 2;
}
/**
* 开启宝箱的id
*/
public void openAwardId() {
}
/**
* 用户可以开启宝箱的时间
*/
public void userOpenAwardTime() {
}
public Object insertOpenUserTreasureAward(Long userId,String isQuery) {
if("0".equals(isQuery)) {
//查询
//this.isMayOpenAwardBox(currentDate, userId, treasureBoxConfigId);
Map<String,Object> treasureAwardHistoryMap = new HashMap<String,Object>();
treasureAwardHistoryMap.put("userId", userId);
TreasureAwardHistory treasureAwardHistory = treasureAwardHistoryMapper.selectModel(treasureAwardHistoryMap);
//如果没有领取过宝箱,那么进行初始化
List<Date> openAwardBoxDates = treasureBoxConfigMapper.getTreasureBoxTimes();
if(treasureAwardHistory == null) {
//treasureAwardHistoryMapper.insert(record);
}
} else if("1".equals(isQuery)) {
//领取奖励
}
return null;
}
}
|
UTF-8
|
Java
| 13,515
|
java
|
TreasureAwardHistoryServiceSupport.java
|
Java
|
[
{
"context": "er.getNickName());\n\t\t\t\t\tredEnvelope.setAdverName(\"任务奖励\");\n\t\t\t\t\tredEnvelope.setState((byte)1);\n\t\t\t\t\tredEn",
"end": 6012,
"score": 0.6022358536720276,
"start": 6008,
"tag": "NAME",
"value": "任务奖励"
}
] | null |
[] |
package com.mouchina.moumou_server_dubbo.provider.award;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.mouchina.base.utils.PercentUtil;
import com.mouchina.moumou_server.dao.advert.RedEnvelopeMapper;
import com.mouchina.moumou_server.dao.award.TreasureAwardHistoryMapper;
import com.mouchina.moumou_server.dao.award.TreasureBoxConfigMapper;
import com.mouchina.moumou_server.dao.member.UserAssetsMapper;
import com.mouchina.moumou_server.dao.member.UserMapper;
import com.mouchina.moumou_server.dao.member.UserPartMapper;
import com.mouchina.moumou_server.entity.advert.RedEnvelope;
import com.mouchina.moumou_server.entity.award.TreasureAwardHistory;
import com.mouchina.moumou_server.entity.award.TreasureBoxConfig;
import com.mouchina.moumou_server.entity.member.User;
import com.mouchina.moumou_server.entity.member.UserAssets;
import com.mouchina.moumou_server_interface.award.TreasureAwardHistoryService;
@Service(value="treasureAwardHistoryServiceSupport")
public class TreasureAwardHistoryServiceSupport implements TreasureAwardHistoryService {
private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
private static SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss");
private static SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Resource
private TreasureAwardHistoryMapper treasureAwardHistoryMapper;
@Resource
private TreasureBoxConfigMapper treasureBoxConfigMapper;
@Resource
private UserAssetsMapper userAssetsMapper;
@Resource
private UserPartMapper userPartMapper;
@Resource
private RedEnvelopeMapper redEnvelopeMapper;
@Resource
private UserMapper userMapper;
@Override
public TreasureAwardHistory addOpenUserTreasureAward(Long userId,String isQuery) {
try {
TreasureAwardHistory treasureAwardHistory = treasureAwardHistoryMapper.selectByUserId(userId);
//第一次领取宝箱
if(treasureAwardHistory == null) {
treasureAwardHistory = new TreasureAwardHistory();
//获取宝箱的奖励值
Map<String,Object> map = this.openAwardBox(null,isQuery);
TreasureBoxConfig treasureBoxConfig = this.getTreasureBoxConfig(sdfTime.format(map.get("openAwardBoxTime")));
treasureAwardHistory.setUserId(userId);
treasureAwardHistory.setTreasureBoxConfigId(treasureBoxConfig.getId());
treasureAwardHistory.setCreateTime(new Date());
treasureAwardHistory.setCountDown((Long) map.get("countDown"));
treasureAwardHistory.setIsClick((String) map.get("isClick"));
//如果是0只进行查询
if("1".equals(isQuery)) {
treasureAwardHistoryMapper.insert(treasureAwardHistory);
//更新用户的财富
Byte awardType = treasureBoxConfig.getType();
Integer awardValue = treasureBoxConfig.getValue();
this.updateUserAward(userId, awardType, awardValue);
//添加收益明细
if(awardType == 1) {
Map<String,String> userPartMap = new HashMap<String,String>();
userPartMap.put("mapprerValue", String.valueOf(userId));
Integer tableIndex = userPartMapper.selectModel(userPartMap).getNum();
Map<String,Object> userMap = new HashMap<String,Object>();
userMap.put("id", userId);
userMap.put("tableNum", tableIndex);
User user = userMapper.selectModel(userMap);
RedEnvelope redEnvelope = new RedEnvelope();
redEnvelope.setAdvertId(Long.valueOf("0"));
redEnvelope.setPublisherId(Long.valueOf("0"));
redEnvelope.setUserId(userId);
redEnvelope.setAmout(awardValue);
redEnvelope.setCreateTime(new Date());
redEnvelope.setUserSex((byte)1);
redEnvelope.setUserNickName(user.getNickName());
redEnvelope.setAdverName("任务奖励");
redEnvelope.setState((byte)1);
redEnvelope.setOriginalAmout(awardValue);
redEnvelope.setAwardTime(new Date());
redEnvelope.setBirthday(user.getBirthday());
redEnvelope.setAwardTime(new Date());
redEnvelopeMapper.insertSelective(redEnvelope);
}
treasureAwardHistory.setType(treasureBoxConfig.getType());
treasureAwardHistory.setValue(treasureBoxConfig.getValue());
}
return treasureAwardHistory;
}
//是否已经开启过宝箱
Date openTreasureTime = treasureAwardHistory.getCreateTime();
Map<String,Object> map = this.openAwardBox(openTreasureTime,isQuery);
TreasureBoxConfig treasureBoxConfig = this.getTreasureBoxConfig(sdfTime.format(map.get("openAwardBoxTime")));
treasureAwardHistory.setUserId(userId);
treasureAwardHistory.setTreasureBoxConfigId(treasureBoxConfig.getId());
treasureAwardHistory.setCreateTime(new Date());
treasureAwardHistory.setCountDown((Long) map.get("countDown"));
treasureAwardHistory.setIsClick((String) map.get("isClick"));
if("1".equals(isQuery)) {
treasureAwardHistoryMapper.updateByPrimaryKey(treasureAwardHistory);
//更新用户的财富
Byte awardType = treasureBoxConfig.getType();
Integer awardValue = treasureBoxConfig.getValue();
this.updateUserAward(userId, awardType, awardValue);
//添加收益明细
if(awardType == 1) {
Map<String,String> userPartMap = new HashMap<String,String>();
userPartMap.put("mapprerValue", String.valueOf(userId));
Integer tableIndex = userPartMapper.selectModel(userPartMap).getNum();
Map<String,Object> userMap = new HashMap<String,Object>();
userMap.put("id", userId);
userMap.put("tableNum", tableIndex);
User user = userMapper.selectModel(userMap);
RedEnvelope redEnvelope = new RedEnvelope();
redEnvelope.setAdvertId(Long.valueOf("0"));
redEnvelope.setPublisherId(Long.valueOf("0"));
redEnvelope.setUserId(userId);
redEnvelope.setAmout(awardValue);
redEnvelope.setCreateTime(new Date());
redEnvelope.setUserSex((byte)1);
redEnvelope.setUserNickName(user.getNickName());
redEnvelope.setAdverName("任务奖励");
redEnvelope.setState((byte)1);
redEnvelope.setOriginalAmout(awardValue);
redEnvelope.setAwardTime(new Date());
redEnvelope.setBirthday(user.getBirthday());
redEnvelope.setAwardTime(new Date());
redEnvelopeMapper.insertSelective(redEnvelope);
}
treasureAwardHistory.setType(treasureBoxConfig.getType());
treasureAwardHistory.setValue(treasureBoxConfig.getValue());
}
return treasureAwardHistory;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 可以开启几点的宝箱
* @param openTreasureTime 上次开宝时间
* @return
* @throws ParseException
*/
public Map<String,Object> openAwardBox(Date openTreasureTime,String isQuery) throws ParseException {
if(openTreasureTime != null) openTreasureTime = sdfTime.parse(sdfTime.format(openTreasureTime));
Date currentTime = sdfTime.parse(sdfTime.format(new Date()));
List<Date> treasureBoxTimes = treasureBoxConfigMapper.getTreasureBoxTimes();
//如果在最开始的时间之前,是不能领取宝箱的
Map<String,Object> map = new HashMap<String,Object>();
if(currentTime.before(treasureBoxTimes.get(0) )) {
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(0));
map.put("countDown", treasureBoxTimes.get(0).getTime() - currentTime.getTime());
return map;
}
for(int i=0; i < treasureBoxTimes.size() ; i++) {
//只有在9点到12点之间才能开启9点的宝箱
if(currentTime.before(treasureBoxTimes.get(i))) {
if( openTreasureTime == null || !(openTreasureTime.after(treasureBoxTimes.get(i-1)) && openTreasureTime.before(treasureBoxTimes.get(i)) ) ) {
//只有 没有打开宝箱的用户 或者 没有在该时间段之内开启过宝箱的用户 才能签到
/*map.put("isClick", "1");
map.put("openAwardBoxTime", treasureBoxTimes.get(i-1));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());*/
if("1".equals(isQuery)) {
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());
} else if("0".equals(isQuery)) {
map.put("isClick", "1");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());
}
return map;
} else if(openTreasureTime.after(treasureBoxTimes.get(i-1)) && openTreasureTime.before(treasureBoxTimes.get(i)) ) {
//在9点到12点之间已经签过到,不能再次签到
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(i));
map.put("countDown", treasureBoxTimes.get(i).getTime() - currentTime.getTime());
return map;
}
}
}
// 凌晨24点之前可以领取20的宝箱
if(currentTime.before(sdfTime.parse("23:59:59"))) {
//开启时间如果在20点之后已经开启过,那么就不能再次开启
if(openTreasureTime == null || openTreasureTime.before(treasureBoxTimes.get(treasureBoxTimes.size()-1)) ) {
//领取宝箱
if("1".equals(isQuery)) {
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
} else if("0".equals(isQuery)) {
map.put("isClick", "1");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
}
return map;
}
map.put("isClick", "0");
map.put("openAwardBoxTime", treasureBoxTimes.get(treasureBoxTimes.size()-1));
return map;
}
return null;
}
/**
* 更新财富值
* @param userId 用户id
* @param awardType 财富类型
* @param awardValue 财富值
*/
private void updateUserAward(Long userId,byte awardType,Integer awardValue) {
Map<String,String> userPartMap = new HashMap<String,String>();
userPartMap.put("mapprerValue", String.valueOf(userId));
Integer tableIndex = userPartMapper.selectModel(userPartMap).getNum();
//查询用户的财富
Map<String,Object> userAssetsMap = new HashMap<String,Object>();
userAssetsMap.put("userId", userId);
userAssetsMap.put("tableNum", tableIndex);
UserAssets userAssets = userAssetsMapper.selectModel(userAssetsMap);
userAssets.setTableNum(tableIndex);
if(awardType == 0) {
//如果是经验 增加经验值
userAssets.setGrowthValue(userAssets.getGrowthValue() + awardValue);
} else if(awardType == 1) {
//如果是红包 增加红包钱数
userAssets.setRedEnvelopeBalance(userAssets.getRedEnvelopeBalance() + awardValue);
}
//更新财富值
userAssetsMapper.updateByUserId(userAssets);
}
/**
* 获取宝箱的类型和财富值
* @param openTreasureTime 几点的宝箱
* @return
*/
private TreasureBoxConfig getTreasureBoxConfig(String openTreasureTime) {
//查询命中率
List<Double> hitRates = treasureBoxConfigMapper.selectHitRate();
Map<String, Object> hitRateMap = PercentUtil.getRandomPercent(hitRates);
Double hitRate = (Double) hitRateMap.get("percent");
//查询命中几率
Map<String,Object> map = new HashMap<String,Object>();
map.put("openTime", "1970-01-01 " + openTreasureTime);
map.put("hitRate", hitRate);
return treasureBoxConfigMapper.selectModel(map);
}
/**
* byte转换成字符串
* @return
*/
public String byteToChar(byte value) {
return new Byte(value).toString();
}
/**
* 查询宝箱当前状态
* @param userId
*/
public void selectAwardStatus(Long userId) {
Map<String,Object> treasureAwardHistoryMap = new HashMap<String,Object>();
treasureAwardHistoryMap.put("userId", userId);
List<TreasureAwardHistory> treasureAwardHistorys = treasureAwardHistoryMapper.selectList(treasureAwardHistoryMap);
Map<String,Object> treasureBoxConfigMap = new HashMap<String,Object>();
List<TreasureBoxConfig> treasureBoxConfigs = treasureBoxConfigMapper.selectList(treasureBoxConfigMap);
if(treasureAwardHistorys == null) {
for(TreasureBoxConfig treasureBoxConfig:treasureBoxConfigs) {
//treasureAwardHistoryMapper.insert(record);
}
}
for(TreasureAwardHistory treasureAwardHistory:treasureAwardHistorys) {
}
}
/**
* 获取一天宝箱的数量
*/
public Integer getAwardNum() {
return 4;
}
/**
* 获取宝箱的种类
*/
public Integer getAwardKind() {
//获取当前宝箱的种类
return 2;
}
/**
* 开启宝箱的id
*/
public void openAwardId() {
}
/**
* 用户可以开启宝箱的时间
*/
public void userOpenAwardTime() {
}
public Object insertOpenUserTreasureAward(Long userId,String isQuery) {
if("0".equals(isQuery)) {
//查询
//this.isMayOpenAwardBox(currentDate, userId, treasureBoxConfigId);
Map<String,Object> treasureAwardHistoryMap = new HashMap<String,Object>();
treasureAwardHistoryMap.put("userId", userId);
TreasureAwardHistory treasureAwardHistory = treasureAwardHistoryMapper.selectModel(treasureAwardHistoryMap);
//如果没有领取过宝箱,那么进行初始化
List<Date> openAwardBoxDates = treasureBoxConfigMapper.getTreasureBoxTimes();
if(treasureAwardHistory == null) {
//treasureAwardHistoryMapper.insert(record);
}
} else if("1".equals(isQuery)) {
//领取奖励
}
return null;
}
}
| 13,515
| 0.729419
| 0.723868
| 363
| 34.236916
| 29.30657
| 145
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.4573
| false
| false
|
2
|
f2e03c97d1245dce782db50506345027cb241554
| 17,343,077,992,175
|
a412d1e784ec8b41b0174f7cbf90e23dda2b4206
|
/src/Synatx_Analysis/ExprTTT.java
|
8fb92408072b512c219dd3d93d7306c8d0647a9c
|
[] |
no_license
|
Sa2a/CompilerProject
|
https://github.com/Sa2a/CompilerProject
|
8c417de506e397396e5553c778dc0b524e2893d1
|
de16e35335106498cf815e63898053f59fda40f4
|
refs/heads/master
| 2020-04-29T05:57:22.773000
| 2019-04-30T22:44:00
| 2019-04-30T22:44:00
| 175,900,816
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package Synatx_Analysis;
public class ExprTTT extends Node {
private String name;
private Token token1;
private Token token2;
private Token token3;
public ExprTTT(String name, Token token1, Token token2, Token token3) {
this.name = name;
this.token1 = token1;
this.token2 = token2;
this.token3 = token3;
}
@Override
public void printNode() {
try{
System.out.println("----------------"+ name +"---------------");
printToken(token1,"");
printToken(token2,"");
printToken(token3,"");
System.out.println("--------------"+ name +"-End-------------");
}catch (Exception e)
{
System.out.println("Syntax Error");
System.exit(0);
}
}
}
|
UTF-8
|
Java
| 815
|
java
|
ExprTTT.java
|
Java
|
[] | null |
[] |
package Synatx_Analysis;
public class ExprTTT extends Node {
private String name;
private Token token1;
private Token token2;
private Token token3;
public ExprTTT(String name, Token token1, Token token2, Token token3) {
this.name = name;
this.token1 = token1;
this.token2 = token2;
this.token3 = token3;
}
@Override
public void printNode() {
try{
System.out.println("----------------"+ name +"---------------");
printToken(token1,"");
printToken(token2,"");
printToken(token3,"");
System.out.println("--------------"+ name +"-End-------------");
}catch (Exception e)
{
System.out.println("Syntax Error");
System.exit(0);
}
}
}
| 815
| 0.504294
| 0.484663
| 31
| 25.290323
| 20.718067
| 76
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.709677
| false
| false
|
2
|
82bf9180dddcb2dbda6ceb52971c83c38426c1d6
| 18,399,639,914,099
|
19599ad278e170175f31f3544f140a8bc4ee6bab
|
/src/com/ametis/cms/util/parser/validator/SalaryValidator.java
|
5ad7dd5bc66f4a60cee27c5eb1abf94b96dfb880
|
[] |
no_license
|
andreHer/owlexaGIT
|
https://github.com/andreHer/owlexaGIT
|
a2a0df83cd64a399e1c57bb6451262434e089631
|
426df1790443e8e8dd492690d6b7bd8fd37fa3d7
|
refs/heads/master
| 2021-01-01T04:26:16.039000
| 2016-05-12T07:37:20
| 2016-05-12T07:37:20
| 58,693,624
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ametis.cms.util.parser.validator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SalaryValidator {
public static String isValid (String input){
String result = "";
if (input != null){
if (input.trim().length() <= 12){
String regex = "[0-9]*";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
if (matcher.matches()){
result = "OK";
}
else {
result = "Field Salary harus diisi dengan format numeric dengan maksimal 12 digit, contoh: 1000000000";
}
}
else {
result = "Field Salary harus diisi dengan format numeric dengan maksimal 12 digit, contoh: 1000000000";
}
}
else {
result = "OK";
}
return result;
}
}
|
UTF-8
|
Java
| 768
|
java
|
SalaryValidator.java
|
Java
|
[] | null |
[] |
package com.ametis.cms.util.parser.validator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SalaryValidator {
public static String isValid (String input){
String result = "";
if (input != null){
if (input.trim().length() <= 12){
String regex = "[0-9]*";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
if (matcher.matches()){
result = "OK";
}
else {
result = "Field Salary harus diisi dengan format numeric dengan maksimal 12 digit, contoh: 1000000000";
}
}
else {
result = "Field Salary harus diisi dengan format numeric dengan maksimal 12 digit, contoh: 1000000000";
}
}
else {
result = "OK";
}
return result;
}
}
| 768
| 0.644531
| 0.608073
| 34
| 21.588236
| 26.099491
| 108
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.735294
| false
| false
|
2
|
12e6787c6e528a0eaf85bf7b47376052aa471375
| 11,905,649,368,890
|
c8d21e0f701656fb6f81be905f9c2de8e8f1c9fb
|
/niord-core/src/main/java/org/niord/core/category/TemplateExecutionService.java
|
a88a34b2210de7b3c17661e3ddc68258b0bb7109
|
[
"Apache-2.0"
] |
permissive
|
NiordOrg/niord
|
https://github.com/NiordOrg/niord
|
0bb8b6080db54cdcf51f8c533d29609a04131ae9
|
246ddca7eb4d69deb3ae6e093db45137e41ea82a
|
refs/heads/master
| 2023-07-07T21:06:01.497000
| 2023-04-24T06:25:07
| 2023-04-24T06:25:07
| 51,736,407
| 8
| 11
|
NOASSERTION
| false
| 2023-08-30T07:29:23
| 2016-02-15T06:50:19
| 2023-05-25T08:06:25
| 2023-08-30T07:29:22
| 18,678
| 5
| 7
| 12
|
JavaScript
| false
| false
|
/*
* Copyright 2017 Danish Maritime Authority.
*
* 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.niord.core.category;
import freemarker.template.TemplateException;
import org.apache.commons.lang.StringUtils;
import org.niord.core.NiordApp;
import org.niord.core.category.FieldTemplateProcessor.FieldTemplate;
import org.niord.core.category.vo.SystemCategoryVo;
import org.niord.core.dictionary.DictionaryService;
import org.niord.core.message.MessageService;
import org.niord.core.message.vo.SystemMessageVo;
import org.niord.core.promulgation.PromulgationException;
import org.niord.core.promulgation.PromulgationManager;
import org.niord.core.promulgation.PromulgationType;
import org.niord.core.promulgation.PromulgationTypeService;
import org.niord.core.promulgation.vo.BaseMessagePromulgationVo;
import org.niord.core.script.FmTemplateService;
import org.niord.core.script.JsResourceService;
import org.niord.core.script.ScriptResource;
import org.niord.core.service.BaseService;
import org.niord.model.DataFilter;
import org.niord.model.message.MessagePartType;
import org.niord.model.message.MessagePartVo;
import org.slf4j.Logger;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* Business interface for executing template categories
*/
@Stateless
@SuppressWarnings("unused")
public class TemplateExecutionService extends BaseService {
@Inject
private Logger log;
@Inject
FmTemplateService templateService;
@Inject
PromulgationTypeService promulgationTypeService;
@Inject
PromulgationManager promulgationManager;
@Inject
JsResourceService javaScriptService;
@Inject
MessageService messageService;
@Inject
CategoryService categoryService;
@Inject
DictionaryService dictionaryService;
@Inject
NiordApp app;
/**
* *******************************************
* parameter types functionality
* *******************************************
*/
/**
* Returns the parameter types
* @return the parameter types
*/
public List<ParamType> getParamTypes() {
return new ArrayList<>(
em.createNamedQuery("ParamType.findAll", ParamType.class)
.getResultList());
}
/**
* Returns the parameter type with the given id. Returns null if the parameter type does not exist.
* @param id the id
* @return the parameter type with the given id
*/
public ParamType getParamType(Integer id) {
return getByPrimaryKey(ParamType.class, id);
}
/**
* Returns the parameter type with the given name. Returns null if the parameter type does not exist.
* @param name the name
* @return the parameter type with the given name
*/
public ParamType getParamTypeByName(String name) {
try {
return em.createNamedQuery("ParamType.findByName", ParamType.class)
.setParameter("name", name)
.getSingleResult();
} catch (Exception e) {
return null;
}
}
/**
* Creates a new parameter type from the given template
* @param type the parameter type value object
* @return the new entity
*/
public ParamType createParamType(ParamType type) {
// Ensure validity of the type name
if (StringUtils.isBlank(type.getName())) {
throw new IllegalArgumentException("Invalid parameter type name: " + type.getName());
}
// Replace the dictionary entry values with the persisted once
updatePersistedValues(type, type);
type = saveEntity(type);
log.info("Created parameter type " + type);
return type;
}
/**
* Updates an existing parameter type from the given template
* @param type the parameter type value object
* @return the updated entity
*/
public ParamType updateParamType(ParamType type) {
ParamType original = getParamType(type.getId());
original.setName(type.getName());
// Replace the dictionary entry values with the persisted once
updatePersistedValues(type, original);
if (original instanceof CompositeParamType && type instanceof CompositeParamType) {
CompositeParamType from = (CompositeParamType)type;
CompositeParamType to = (CompositeParamType)original;
to.getTemplateParams().clear();
to.getTemplateParams().addAll(from.getTemplateParams());
}
original = saveEntity(original);
log.info("Updated parameter type " + original);
return original;
}
/**
* Deletes the parameter type with the given id
* @param id the id of the parameter type to delete
* @noinspection all
*/
public boolean deleteParamType(Integer id) {
ParamType type = getByPrimaryKey(ParamType.class, id);
if (type != null) {
remove(type);
log.info("Deleted parameter type " + id);
return true;
}
return false;
}
/** Updates the persisted values of the parameter type **/
private void updatePersistedValues(ParamType source, ParamType dest) {
if (source != null && source instanceof ListParamType && dest != null && dest instanceof ListParamType) {
ListParamType srclistParamType = (ListParamType)source;
ListParamType dstlistParamType = (ListParamType)dest;
dstlistParamType.setValues(dictionaryService.persistedList(srclistParamType.getValues()));
}
}
/**
* *******************************************
* Template Execution
* *******************************************
*/
/**
* Executes a message category template on the given message.
* If no category template is specified, all the category template of the message are used.
*
* @param templateCategory the template to execute
* @param message the message to apply the template to
* @param templateParams the template-specific parameters
* @return the resulting message
*/
public SystemMessageVo executeTemplate(Category templateCategory, SystemMessageVo message, List templateParams) throws Exception {
// Sanity check
if (templateCategory != null && templateCategory.getType() != CategoryType.TEMPLATE) {
throw new IllegalArgumentException("Only categories of type TEMPLATE are executable");
}
// Either use the specified category or the ones associated with the message
List<Category> templateCategories =
templateCategory != null
? Collections.singletonList(templateCategory)
: message.getCategories().stream()
.map(c -> categoryService.getCategoryDetails(c.getId()))
.filter(Objects::nonNull)
.filter(c -> c.getType() == CategoryType.TEMPLATE)
.collect(Collectors.toList());
List<MessagePartVo> detailParts = checkCreateDetailParts(message, templateCategories);
long t0 = System.currentTimeMillis();
// Adjust the message prior to executing the template
preExecuteTemplate(message);
// Create context data to use with Freemarker templates and JavaScript updates
Map<String, Object> contextData = new HashMap<>();
contextData.put("languages", app.getLanguages());
contextData.put("message", message);
// Execute the category templates one by one
for (int x = 0; x < templateCategories.size(); x++) {
Category template = templateCategories.get(x);
MessagePartVo detailPart = detailParts.get(x);
Object params = templateParams != null && x < templateParams.size()
? templateParams.get(x)
: new HashMap<>();
contextData.put("template", template.toVo(SystemCategoryVo.class, DataFilter.get()));
contextData.put("part", detailPart);
contextData.put("params", params);
executeScriptResources(template.getScriptResourcePaths(), contextData);
}
// Next, for each associated promulgation type, execute any script resources associated with these
List<PromulgationType> types = promulgationTypeService.getPromulgationTypes(message, true).stream()
.filter(type -> !type.getScriptResourcePaths().isEmpty())
.collect(Collectors.toList());
for (PromulgationType type : types) {
BaseMessagePromulgationVo promulgation = message.promulgation(type.getTypeId());
Map<String, Object> promulgationContextData = new HashMap<>(contextData);
promulgationContextData.put("promulgation", promulgation);
promulgationContextData.put("promulgationType", promulgation.getType());
executeScriptResources(type.getScriptResourcePaths(), promulgationContextData);
}
// Adjust the message after executing the template
postExecuteTemplate(message);
log.info("Executed " + templateCategories.size() + " templates on message " + message.getId()
+ " in " + (System.currentTimeMillis() - t0) + " ms");
return message;
}
/**
* Executes the list of script resources on the context data
* @param scriptResourcePaths the list of script resources
* @param contextData the context data, i.e. current message, part, etc.
*/
public void executeScriptResources(List<String> scriptResourcePaths, Map<String, Object> contextData) throws Exception {
for (String scriptResourcePath : scriptResourcePaths) {
ScriptResource.Type type = ScriptResource.path2type(scriptResourcePath);
if (type == ScriptResource.Type.JS) {
// JavaScript update
evalJavaScriptResource(contextData, scriptResourcePath);
} else if (type == ScriptResource.Type.FM) {
// Freemarker Template update
applyFreemarkerTemplate(contextData, scriptResourcePath);
}
}
}
/** Ensures that we have at least 1 message part per template category of type DETAILS **/
private List<MessagePartVo> checkCreateDetailParts(SystemMessageVo message, List<Category> templateCategories) {
List<MessagePartVo> detailParts = message.partsOfType(MessagePartType.DETAILS);
if (detailParts.size() < templateCategories.size()) {
int noToAdd = templateCategories.size() - detailParts.size();
for (int x = 0; x < noToAdd; x++) {
int index = detailParts.isEmpty() ? 0 : message.getParts().size();
message.checkCreatePart(MessagePartType.DETAILS, index);
}
}
return message.partsOfType(MessagePartType.DETAILS);
}
/**
* Adjust the message prior to executing a template
* @param message the message to adjust
*/
private void preExecuteTemplate(SystemMessageVo message) throws PromulgationException {
// Update base data to ensure that we have all language variants
message = messageService.updateBaseDate(message);
// Ensure that description records exists for all supported languages
message.checkCreateDescs(app.getLanguages());
// Reset all promulgations
promulgationManager.resetMessagePromulgations(message);
// If message areas are undefined, compute them from the message geometry.
// messageService.adjustMessage(message, MessageService.AdjustmentType.AREAS);
}
/**
* Adjust the message after executing a template
* @param message the message to adjust
*/
private void postExecuteTemplate(SystemMessageVo message) throws Exception {
// Update auto-title fields, etc.
messageService.adjustMessage(message, MessageService.AdjustmentType.AREAS, MessageService.AdjustmentType.TITLE);
// If there is only one DETAILS message part, hide the subject
List<MessagePartVo> detailParts = message.partsOfType(MessagePartType.DETAILS);
if (detailParts.size() >= 1) {
detailParts.get(0).setHideSubject(detailParts.size() == 1);
}
// Allow the promulgation services to clean up
promulgationManager.messagePromulgationGenerated(message);
}
/**
* Executes the Freemarker template at the given path and updates the message accordingly
*
* @param contextData the context data to use in the Freemarker template
* @param scriptResourcePath the path to the Freemarker template
*/
private void applyFreemarkerTemplate(
Map<String, Object> contextData,
String scriptResourcePath) throws IOException, TemplateException {
// Run the associated Freemarker template to get a result in the "FieldTemplates" format
String fieldTemplateTxt = templateService.newFmTemplateBuilder()
.templatePath(scriptResourcePath)
.data(contextData)
.dictionaryNames("message", "template")
.process();
List<FieldTemplate> fieldTemplates = FieldTemplateProcessor.parse(fieldTemplateTxt);
applyFieldTemplates(fieldTemplates, contextData);
}
/**
* Updates the fields of the message using the FieldTemplate templates.
* <p>
* A FieldTemplate field may have the format "message.promulgation('twitter').tweet"
* and will be assigned the body content of the field template.
*
* @param fieldTemplates the field templates to apply
*/
private void applyFieldTemplates(List<FieldTemplate> fieldTemplates, Map<String, Object> contextData) {
ScriptEngine jsEngine = new ScriptEngineManager()
.getEngineByName("Nashorn");
// Update the JavaScript engine bindings from the context data
Bindings bindings = new SimpleBindings();
contextData.forEach(bindings::put);
jsEngine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
for (FieldTemplate fieldTemplate : fieldTemplates) {
bindings.put("content", fieldTemplate.getContent());
String script = getUpdateScript(fieldTemplate);
try {
jsEngine.eval(script);
} catch (ScriptException e) {
// Apply the result of the field templates
log.error("Error applying field template " + fieldTemplate + ": " + e.getMessage());
}
}
}
/** Returns a JavaScript that either assigns or appends the content to the field **/
private String getUpdateScript(FieldTemplate fieldTemplate) {
String field = fieldTemplate.getField();
// Either append or assign
if ("append".equalsIgnoreCase(fieldTemplate.getUpdate())) {
// Append the content variable to the field
return String.format("%s = (%s == null) ? content : %s + '\\n' + content;", field, field, field);
} else {
// Assign the content variable to the field
return field + " = content;";
}
}
/**
* Evaluates the JavaScript resource at the given path
*
* @param contextData the context data to use in the Freemarker template
* @param scriptResourcePath the path to the Freemarker template
*/
private void evalJavaScriptResource(Map<String, Object> contextData, String scriptResourcePath) throws Exception {
javaScriptService.newJsResourceBuilder()
.resourcePath(scriptResourcePath)
.data(contextData)
.evaluate();
}
}
|
UTF-8
|
Java
| 16,731
|
java
|
TemplateExecutionService.java
|
Java
|
[] | null |
[] |
/*
* Copyright 2017 Danish Maritime Authority.
*
* 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.niord.core.category;
import freemarker.template.TemplateException;
import org.apache.commons.lang.StringUtils;
import org.niord.core.NiordApp;
import org.niord.core.category.FieldTemplateProcessor.FieldTemplate;
import org.niord.core.category.vo.SystemCategoryVo;
import org.niord.core.dictionary.DictionaryService;
import org.niord.core.message.MessageService;
import org.niord.core.message.vo.SystemMessageVo;
import org.niord.core.promulgation.PromulgationException;
import org.niord.core.promulgation.PromulgationManager;
import org.niord.core.promulgation.PromulgationType;
import org.niord.core.promulgation.PromulgationTypeService;
import org.niord.core.promulgation.vo.BaseMessagePromulgationVo;
import org.niord.core.script.FmTemplateService;
import org.niord.core.script.JsResourceService;
import org.niord.core.script.ScriptResource;
import org.niord.core.service.BaseService;
import org.niord.model.DataFilter;
import org.niord.model.message.MessagePartType;
import org.niord.model.message.MessagePartVo;
import org.slf4j.Logger;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* Business interface for executing template categories
*/
@Stateless
@SuppressWarnings("unused")
public class TemplateExecutionService extends BaseService {
@Inject
private Logger log;
@Inject
FmTemplateService templateService;
@Inject
PromulgationTypeService promulgationTypeService;
@Inject
PromulgationManager promulgationManager;
@Inject
JsResourceService javaScriptService;
@Inject
MessageService messageService;
@Inject
CategoryService categoryService;
@Inject
DictionaryService dictionaryService;
@Inject
NiordApp app;
/**
* *******************************************
* parameter types functionality
* *******************************************
*/
/**
* Returns the parameter types
* @return the parameter types
*/
public List<ParamType> getParamTypes() {
return new ArrayList<>(
em.createNamedQuery("ParamType.findAll", ParamType.class)
.getResultList());
}
/**
* Returns the parameter type with the given id. Returns null if the parameter type does not exist.
* @param id the id
* @return the parameter type with the given id
*/
public ParamType getParamType(Integer id) {
return getByPrimaryKey(ParamType.class, id);
}
/**
* Returns the parameter type with the given name. Returns null if the parameter type does not exist.
* @param name the name
* @return the parameter type with the given name
*/
public ParamType getParamTypeByName(String name) {
try {
return em.createNamedQuery("ParamType.findByName", ParamType.class)
.setParameter("name", name)
.getSingleResult();
} catch (Exception e) {
return null;
}
}
/**
* Creates a new parameter type from the given template
* @param type the parameter type value object
* @return the new entity
*/
public ParamType createParamType(ParamType type) {
// Ensure validity of the type name
if (StringUtils.isBlank(type.getName())) {
throw new IllegalArgumentException("Invalid parameter type name: " + type.getName());
}
// Replace the dictionary entry values with the persisted once
updatePersistedValues(type, type);
type = saveEntity(type);
log.info("Created parameter type " + type);
return type;
}
/**
* Updates an existing parameter type from the given template
* @param type the parameter type value object
* @return the updated entity
*/
public ParamType updateParamType(ParamType type) {
ParamType original = getParamType(type.getId());
original.setName(type.getName());
// Replace the dictionary entry values with the persisted once
updatePersistedValues(type, original);
if (original instanceof CompositeParamType && type instanceof CompositeParamType) {
CompositeParamType from = (CompositeParamType)type;
CompositeParamType to = (CompositeParamType)original;
to.getTemplateParams().clear();
to.getTemplateParams().addAll(from.getTemplateParams());
}
original = saveEntity(original);
log.info("Updated parameter type " + original);
return original;
}
/**
* Deletes the parameter type with the given id
* @param id the id of the parameter type to delete
* @noinspection all
*/
public boolean deleteParamType(Integer id) {
ParamType type = getByPrimaryKey(ParamType.class, id);
if (type != null) {
remove(type);
log.info("Deleted parameter type " + id);
return true;
}
return false;
}
/** Updates the persisted values of the parameter type **/
private void updatePersistedValues(ParamType source, ParamType dest) {
if (source != null && source instanceof ListParamType && dest != null && dest instanceof ListParamType) {
ListParamType srclistParamType = (ListParamType)source;
ListParamType dstlistParamType = (ListParamType)dest;
dstlistParamType.setValues(dictionaryService.persistedList(srclistParamType.getValues()));
}
}
/**
* *******************************************
* Template Execution
* *******************************************
*/
/**
* Executes a message category template on the given message.
* If no category template is specified, all the category template of the message are used.
*
* @param templateCategory the template to execute
* @param message the message to apply the template to
* @param templateParams the template-specific parameters
* @return the resulting message
*/
public SystemMessageVo executeTemplate(Category templateCategory, SystemMessageVo message, List templateParams) throws Exception {
// Sanity check
if (templateCategory != null && templateCategory.getType() != CategoryType.TEMPLATE) {
throw new IllegalArgumentException("Only categories of type TEMPLATE are executable");
}
// Either use the specified category or the ones associated with the message
List<Category> templateCategories =
templateCategory != null
? Collections.singletonList(templateCategory)
: message.getCategories().stream()
.map(c -> categoryService.getCategoryDetails(c.getId()))
.filter(Objects::nonNull)
.filter(c -> c.getType() == CategoryType.TEMPLATE)
.collect(Collectors.toList());
List<MessagePartVo> detailParts = checkCreateDetailParts(message, templateCategories);
long t0 = System.currentTimeMillis();
// Adjust the message prior to executing the template
preExecuteTemplate(message);
// Create context data to use with Freemarker templates and JavaScript updates
Map<String, Object> contextData = new HashMap<>();
contextData.put("languages", app.getLanguages());
contextData.put("message", message);
// Execute the category templates one by one
for (int x = 0; x < templateCategories.size(); x++) {
Category template = templateCategories.get(x);
MessagePartVo detailPart = detailParts.get(x);
Object params = templateParams != null && x < templateParams.size()
? templateParams.get(x)
: new HashMap<>();
contextData.put("template", template.toVo(SystemCategoryVo.class, DataFilter.get()));
contextData.put("part", detailPart);
contextData.put("params", params);
executeScriptResources(template.getScriptResourcePaths(), contextData);
}
// Next, for each associated promulgation type, execute any script resources associated with these
List<PromulgationType> types = promulgationTypeService.getPromulgationTypes(message, true).stream()
.filter(type -> !type.getScriptResourcePaths().isEmpty())
.collect(Collectors.toList());
for (PromulgationType type : types) {
BaseMessagePromulgationVo promulgation = message.promulgation(type.getTypeId());
Map<String, Object> promulgationContextData = new HashMap<>(contextData);
promulgationContextData.put("promulgation", promulgation);
promulgationContextData.put("promulgationType", promulgation.getType());
executeScriptResources(type.getScriptResourcePaths(), promulgationContextData);
}
// Adjust the message after executing the template
postExecuteTemplate(message);
log.info("Executed " + templateCategories.size() + " templates on message " + message.getId()
+ " in " + (System.currentTimeMillis() - t0) + " ms");
return message;
}
/**
* Executes the list of script resources on the context data
* @param scriptResourcePaths the list of script resources
* @param contextData the context data, i.e. current message, part, etc.
*/
public void executeScriptResources(List<String> scriptResourcePaths, Map<String, Object> contextData) throws Exception {
for (String scriptResourcePath : scriptResourcePaths) {
ScriptResource.Type type = ScriptResource.path2type(scriptResourcePath);
if (type == ScriptResource.Type.JS) {
// JavaScript update
evalJavaScriptResource(contextData, scriptResourcePath);
} else if (type == ScriptResource.Type.FM) {
// Freemarker Template update
applyFreemarkerTemplate(contextData, scriptResourcePath);
}
}
}
/** Ensures that we have at least 1 message part per template category of type DETAILS **/
private List<MessagePartVo> checkCreateDetailParts(SystemMessageVo message, List<Category> templateCategories) {
List<MessagePartVo> detailParts = message.partsOfType(MessagePartType.DETAILS);
if (detailParts.size() < templateCategories.size()) {
int noToAdd = templateCategories.size() - detailParts.size();
for (int x = 0; x < noToAdd; x++) {
int index = detailParts.isEmpty() ? 0 : message.getParts().size();
message.checkCreatePart(MessagePartType.DETAILS, index);
}
}
return message.partsOfType(MessagePartType.DETAILS);
}
/**
* Adjust the message prior to executing a template
* @param message the message to adjust
*/
private void preExecuteTemplate(SystemMessageVo message) throws PromulgationException {
// Update base data to ensure that we have all language variants
message = messageService.updateBaseDate(message);
// Ensure that description records exists for all supported languages
message.checkCreateDescs(app.getLanguages());
// Reset all promulgations
promulgationManager.resetMessagePromulgations(message);
// If message areas are undefined, compute them from the message geometry.
// messageService.adjustMessage(message, MessageService.AdjustmentType.AREAS);
}
/**
* Adjust the message after executing a template
* @param message the message to adjust
*/
private void postExecuteTemplate(SystemMessageVo message) throws Exception {
// Update auto-title fields, etc.
messageService.adjustMessage(message, MessageService.AdjustmentType.AREAS, MessageService.AdjustmentType.TITLE);
// If there is only one DETAILS message part, hide the subject
List<MessagePartVo> detailParts = message.partsOfType(MessagePartType.DETAILS);
if (detailParts.size() >= 1) {
detailParts.get(0).setHideSubject(detailParts.size() == 1);
}
// Allow the promulgation services to clean up
promulgationManager.messagePromulgationGenerated(message);
}
/**
* Executes the Freemarker template at the given path and updates the message accordingly
*
* @param contextData the context data to use in the Freemarker template
* @param scriptResourcePath the path to the Freemarker template
*/
private void applyFreemarkerTemplate(
Map<String, Object> contextData,
String scriptResourcePath) throws IOException, TemplateException {
// Run the associated Freemarker template to get a result in the "FieldTemplates" format
String fieldTemplateTxt = templateService.newFmTemplateBuilder()
.templatePath(scriptResourcePath)
.data(contextData)
.dictionaryNames("message", "template")
.process();
List<FieldTemplate> fieldTemplates = FieldTemplateProcessor.parse(fieldTemplateTxt);
applyFieldTemplates(fieldTemplates, contextData);
}
/**
* Updates the fields of the message using the FieldTemplate templates.
* <p>
* A FieldTemplate field may have the format "message.promulgation('twitter').tweet"
* and will be assigned the body content of the field template.
*
* @param fieldTemplates the field templates to apply
*/
private void applyFieldTemplates(List<FieldTemplate> fieldTemplates, Map<String, Object> contextData) {
ScriptEngine jsEngine = new ScriptEngineManager()
.getEngineByName("Nashorn");
// Update the JavaScript engine bindings from the context data
Bindings bindings = new SimpleBindings();
contextData.forEach(bindings::put);
jsEngine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
for (FieldTemplate fieldTemplate : fieldTemplates) {
bindings.put("content", fieldTemplate.getContent());
String script = getUpdateScript(fieldTemplate);
try {
jsEngine.eval(script);
} catch (ScriptException e) {
// Apply the result of the field templates
log.error("Error applying field template " + fieldTemplate + ": " + e.getMessage());
}
}
}
/** Returns a JavaScript that either assigns or appends the content to the field **/
private String getUpdateScript(FieldTemplate fieldTemplate) {
String field = fieldTemplate.getField();
// Either append or assign
if ("append".equalsIgnoreCase(fieldTemplate.getUpdate())) {
// Append the content variable to the field
return String.format("%s = (%s == null) ? content : %s + '\\n' + content;", field, field, field);
} else {
// Assign the content variable to the field
return field + " = content;";
}
}
/**
* Evaluates the JavaScript resource at the given path
*
* @param contextData the context data to use in the Freemarker template
* @param scriptResourcePath the path to the Freemarker template
*/
private void evalJavaScriptResource(Map<String, Object> contextData, String scriptResourcePath) throws Exception {
javaScriptService.newJsResourceBuilder()
.resourcePath(scriptResourcePath)
.data(contextData)
.evaluate();
}
}
| 16,731
| 0.661885
| 0.660749
| 461
| 35.292843
| 31.62022
| 134
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.425163
| false
| false
|
2
|
05b0705687993a94603e2cbdff69822c61a23d70
| 10,187,662,487,450
|
63d4c851ab8ce7e2c0c1e0bebb0db0ebe49d32cd
|
/blog-common/src/main/java/org/lsliang/common/model/ResponseVO.java
|
df7c2465ad5bf39b3944d8d169bce4b52d60442e
|
[] |
no_license
|
lslkk/blog
|
https://github.com/lslkk/blog
|
12957ccd7ecd11304bc2837da86ad0c79f63758a
|
a2225d68752d41146f3edf1a0d13ccba3020d462
|
refs/heads/master
| 2020-04-17T03:23:02.629000
| 2019-01-17T08:00:54
| 2019-01-17T08:00:54
| 166,180,405
| 0
| 0
| null | false
| 2019-01-17T08:00:55
| 2019-01-17T07:25:16
| 2019-01-17T07:40:27
| 2019-01-17T08:00:54
| 0
| 0
| 0
| 0
|
Java
| false
| null |
/**
* @Title: ResponseVO.java
* @Package org.lsliang.common.model
* @author: 我长不高了
* @date: 2019年1月12日 下午4:32:11
* @version 1.0.0
*/
package org.lsliang.common.model;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.lsliang.common.enumerate.ResponseEnum;
/**
**************************************************
* @Description r响应实体类
*
* @version 1.0.0
* @author lsliang
**************************************************
*/
public class ResponseVO<T> {
/**
* response code
*/
private Integer code;
/**
* error message
*/
private String msg;
/**
* response data
*/
private T data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
/**
* @Title ResponseVO
* @Description 含参的构造函数
*/
public ResponseVO(Integer code, String msg, T data) {
super();
this.code = code;
this.msg = msg;
this.data = data;
}
/**
* @Title ResponseVO
* @Description 无参的构造方法
*/
public ResponseVO() {
super();
}
/**
*
**************************************************
* @Description ResponseVO 构建
*
* @version 1.0.0
* @author lsliang
**************************************************
*/
public static class Builder<T> {
private Integer code;
private String msg;
private T data;
public Builder<T> code(Integer code) {
this.code = code;
return this;
}
public Builder<T> msg(String msg) {
this.msg = msg;
return this;
}
public Builder<T> data(T data) {
this.data = data;
return this;
}
public Builder<T> responseEnum(ResponseEnum responseEnum) {
this.code = responseEnum.getCode();
this.msg = responseEnum.getMsg();
return this;
}
public ResponseVO<T> builder() {
return new ResponseVO<T>(code, msg, data);
}
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
}
}
|
UTF-8
|
Java
| 2,272
|
java
|
ResponseVO.java
|
Java
|
[
{
"context": "ackage org.lsliang.common.model \n * @author: 我长不高了 \n * @date: 2019年1月12日 下午4:32:11 \n * @versio",
"end": 93,
"score": 0.5103157162666321,
"start": 92,
"tag": "NAME",
"value": "高"
},
{
"context": "escription r响应实体类\n * \n * @version 1.0.0\n * @author lsliang\n ************************************************",
"end": 483,
"score": 0.9996245503425598,
"start": 476,
"tag": "USERNAME",
"value": "lsliang"
},
{
"context": " ResponseVO 构建\n\t * \n\t * @version 1.0.0\n\t * @author lsliang\n\t ***********************************************",
"end": 1439,
"score": 0.9996046423912048,
"start": 1432,
"tag": "USERNAME",
"value": "lsliang"
}
] | null |
[] |
/**
* @Title: ResponseVO.java
* @Package org.lsliang.common.model
* @author: 我长不高了
* @date: 2019年1月12日 下午4:32:11
* @version 1.0.0
*/
package org.lsliang.common.model;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.lsliang.common.enumerate.ResponseEnum;
/**
**************************************************
* @Description r响应实体类
*
* @version 1.0.0
* @author lsliang
**************************************************
*/
public class ResponseVO<T> {
/**
* response code
*/
private Integer code;
/**
* error message
*/
private String msg;
/**
* response data
*/
private T data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
/**
* @Title ResponseVO
* @Description 含参的构造函数
*/
public ResponseVO(Integer code, String msg, T data) {
super();
this.code = code;
this.msg = msg;
this.data = data;
}
/**
* @Title ResponseVO
* @Description 无参的构造方法
*/
public ResponseVO() {
super();
}
/**
*
**************************************************
* @Description ResponseVO 构建
*
* @version 1.0.0
* @author lsliang
**************************************************
*/
public static class Builder<T> {
private Integer code;
private String msg;
private T data;
public Builder<T> code(Integer code) {
this.code = code;
return this;
}
public Builder<T> msg(String msg) {
this.msg = msg;
return this;
}
public Builder<T> data(T data) {
this.data = data;
return this;
}
public Builder<T> responseEnum(ResponseEnum responseEnum) {
this.code = responseEnum.getCode();
this.msg = responseEnum.getMsg();
return this;
}
public ResponseVO<T> builder() {
return new ResponseVO<T>(code, msg, data);
}
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
}
}
| 2,272
| 0.5819
| 0.571493
| 129
| 16.131783
| 16.69906
| 76
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.310078
| false
| false
|
2
|
e5f37b52faa90e85bc98756b053b1ee991b77790
| 20,306,605,408,703
|
20b4c8b127c057ea7c2a92ebe14dc554cdd87c37
|
/src/main/java/otvoreni/repository/PrvorangiraniRepository.java
|
7a4be80551e11dc0149a90cfc4d30c5d18c7fbe2
|
[] |
no_license
|
drasko-kosovic/otvoreni-micro-master
|
https://github.com/drasko-kosovic/otvoreni-micro-master
|
2656162e13eb5fb3520ed807614ff65dad45836d
|
abfac53be0c1c595ad9de733e0d561a554d494d6
|
refs/heads/master
| 2023-07-31T03:46:37.970000
| 2021-09-13T18:33:09
| 2021-09-13T18:33:09
| 406,085,858
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package otvoreni.repository;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
import otvoreni.domain.Prvorangirani;
/**
* Spring Data SQL repository for the Prvorangirani entity.
*/
@SuppressWarnings("unused")
@Repository
public interface PrvorangiraniRepository extends JpaRepository<Prvorangirani, Long> {}
|
UTF-8
|
Java
| 364
|
java
|
PrvorangiraniRepository.java
|
Java
|
[] | null |
[] |
package otvoreni.repository;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
import otvoreni.domain.Prvorangirani;
/**
* Spring Data SQL repository for the Prvorangirani entity.
*/
@SuppressWarnings("unused")
@Repository
public interface PrvorangiraniRepository extends JpaRepository<Prvorangirani, Long> {}
| 364
| 0.818681
| 0.818681
| 12
| 29.333334
| 26.417587
| 86
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.416667
| false
| false
|
2
|
fcc724811f7541d3fb01f4ba6e8c8d412af78530
| 29,798,483,131,616
|
37239b181c82156e77e71007140e5c567d41b62f
|
/TeamCode/src/main/java/org/firstinspires/ftc/clockworks/helpers/WaitableInteger.java
|
47604f260029be9af7b62f3fd9d0ec2f313af46c
|
[
"BSD-3-Clause"
] |
permissive
|
clockworksteam/ftc-2020
|
https://github.com/clockworksteam/ftc-2020
|
b4eca8ddc55e815919e6925ccd0560098e6924ba
|
0e233f08d2f917ed4d528ae68e6a417be78c6241
|
refs/heads/master
| 2022-11-12T14:25:37.862000
| 2020-06-30T15:59:10
| 2020-06-30T15:59:10
| 275,879,991
| 0
| 0
| null | false
| 2020-06-29T17:38:37
| 2020-06-29T17:15:02
| 2020-06-29T17:16:31
| 2020-06-29T17:38:37
| 0
| 0
| 0
| 0
|
Java
| false
| false
|
package org.firstinspires.ftc.clockworks.helpers;
import java.util.function.Predicate;
public class WaitableInteger {
private final Object integerLock = new Object();
private final Object waitersLock = new Object();
private volatile int integer = 0;
public void inc() {
synchronized (integerLock) {
integer++;
updateWaiters();
}
}
public void dec() {
synchronized (integerLock) {
integer--;
updateWaiters();
}
}
public void set(int val) {
synchronized (integerLock) {
int last = integer;
integer = val;
if (last != val) updateWaiters();
}
}
public int get() {
int val = 0;
synchronized (integerLock) {
val = integer;
}
return val;
}
public void waitFor(int val) {
if (val == integer) return;
boolean intExec = false;
while (val != integer) {
try {
waitersLock.wait();
} catch (InterruptedException iex) {
intExec = true;
}
}
if (intExec) Thread.currentThread().interrupt();
}
public void waitUnless(int val) {
if (val != integer) return;
boolean intExec = false;
while (val == integer) {
try {
waitersLock.wait();
} catch (InterruptedException iex) {
intExec = true;
}
}
if (intExec) Thread.currentThread().interrupt();
}
private void updateWaiters() {
waitersLock.notifyAll();
}
}
|
UTF-8
|
Java
| 1,659
|
java
|
WaitableInteger.java
|
Java
|
[] | null |
[] |
package org.firstinspires.ftc.clockworks.helpers;
import java.util.function.Predicate;
public class WaitableInteger {
private final Object integerLock = new Object();
private final Object waitersLock = new Object();
private volatile int integer = 0;
public void inc() {
synchronized (integerLock) {
integer++;
updateWaiters();
}
}
public void dec() {
synchronized (integerLock) {
integer--;
updateWaiters();
}
}
public void set(int val) {
synchronized (integerLock) {
int last = integer;
integer = val;
if (last != val) updateWaiters();
}
}
public int get() {
int val = 0;
synchronized (integerLock) {
val = integer;
}
return val;
}
public void waitFor(int val) {
if (val == integer) return;
boolean intExec = false;
while (val != integer) {
try {
waitersLock.wait();
} catch (InterruptedException iex) {
intExec = true;
}
}
if (intExec) Thread.currentThread().interrupt();
}
public void waitUnless(int val) {
if (val != integer) return;
boolean intExec = false;
while (val == integer) {
try {
waitersLock.wait();
} catch (InterruptedException iex) {
intExec = true;
}
}
if (intExec) Thread.currentThread().interrupt();
}
private void updateWaiters() {
waitersLock.notifyAll();
}
}
| 1,659
| 0.511151
| 0.509946
| 69
| 23.043478
| 16.185907
| 56
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.376812
| false
| false
|
2
|
747c3d0badae2401361059801446317d0275320d
| 18,408,229,849,603
|
96de5d8cfcec274c2df0cf198ce29df1ed980bd5
|
/code/src/main/java/cz/cvut/fel/cs/sin/controller/Controller.java
|
5706cf6a5fc2fdbb20bbb3e000ef094d24e3e588
|
[
"MIT"
] |
permissive
|
LukasForst/SIN
|
https://github.com/LukasForst/SIN
|
724578230b6fb8f6b87088b24ac68f9fda5f5548
|
2592af4d57a382b8a3e0a3464b99f535e66dd029
|
refs/heads/master
| 2020-04-01T05:27:14.465000
| 2019-01-09T13:06:15
| 2019-01-09T13:06:15
| 152,903,790
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package cz.cvut.fel.cs.sin.controller;
import cz.cvut.fel.cs.sin.dao.AuthorDAOImpl;
import cz.cvut.fel.cs.sin.dao.BookDAOImpl;
import cz.cvut.fel.cs.sin.dao.LibraryDAOImpl;
import cz.cvut.fel.cs.sin.dao.PublisherDAOImpl;
import cz.cvut.fel.cs.sin.entity.Author;
import cz.cvut.fel.cs.sin.entity.Book;
import cz.cvut.fel.cs.sin.entity.Library;
import cz.cvut.fel.cs.sin.entity.Publisher;
import cz.cvut.fel.cs.sin.service.AuthorService;
import cz.cvut.fel.cs.sin.service.BookService;
import cz.cvut.fel.cs.sin.service.LibraryService;
import cz.cvut.fel.cs.sin.service.PublisherService;
import javax.annotation.PostConstruct;
import javax.enterprise.inject.Model;
import javax.enterprise.inject.Produces;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
@Model
public class Controller {
@Inject
Logger logger;
@Inject
private BookService bookService;
@Inject
private PublisherService publisherService;
@Inject
private LibraryService libraryService;
@Inject
private AuthorService authorService;
@Inject
private BookDAOImpl bookDAO;
@Inject
private LibraryDAOImpl libraryDAO;
@Inject
private PublisherDAOImpl publisherDAO;
@Inject
private AuthorDAOImpl authorDAO;
@Inject
private FacesContext facesContext;
@Named
@Produces
private Book book;
@Produces
@Named
private Book newBook;
@Produces
@Named
private String newBookAuthorId;
public String getNewBookAuthorId() {
return newBookAuthorId;
}
public void setNewBookAuthorId(String value) {
this.newBookAuthorId = value;
}
@Named
@Produces
private List<Book> books;
@Named
@Produces
private List<Author> authors;
@Named
@Produces
private List<Publisher> publishers;
@Named
@Produces
private List<Library> libraries;
@Named
@Produces
private Author APAuthor;
@Produces
@Named
private Author newAuthor;
@Named
@Produces
private Publisher APPublisher;
@Named
@Produces
private Publisher PBPublisher;
@Named
@Produces
private Book PBBook;
@Named
@Produces
private Book BLBook;
@Named
@Produces
private Library BLLibrary;
@PostConstruct
public void initNewBook() {
if (logger != null) logger.info("Recreating!");
newBook = new Book();
newBookAuthorId = "";
newAuthor = new Author();
APPublisher = new Publisher();
APAuthor = new Author();
PBPublisher = new Publisher();
PBBook = new Book();
BLBook = new Book();
BLLibrary = new Library();
if (bookDAO != null) books = bookDAO.list();
if (libraryDAO != null) libraries = libraryDAO.list();
if (publisherDAO != null) publishers = publisherDAO.list();
if (authorDAO != null) authors = authorDAO.list();
}
public void APMakeContract() {
try {
publisherService.singContract(APPublisher.getPublisherId(), APAuthor.getAuthorId());
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_INFO, "Contract signed!", "Contract signed");
facesContext.addMessage(null, m);
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addPublisherToBook() {
try {
publisherService.publishBook(PBPublisher.getPublisherId(), PBBook.getBookId());
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addBookToLibrary() {
try {
libraryService.addBook(BLLibrary.getLibraryId(), BLBook.getBookId());
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addBok() {
try {
Set<Author> s = new HashSet<>();
Author a = authorService.find(Integer.parseInt(newBookAuthorId));
if(a == null){
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Author Id not valid", "Author ID is invalid!");
facesContext.addMessage(null, m);
return;
}
s.add(a);
logger.info("Adding book " + newBook.getTitle());
newBook.setAuthors(s);
bookService.add(newBook);
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addAuthor() {
try {
logger.info("Adding author " + newAuthor.getName());
authorService.add(newAuthor);
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_INFO, "Author added!", "Author added!");
facesContext.addMessage(null, m);
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
}
|
UTF-8
|
Java
| 5,822
|
java
|
Controller.java
|
Java
|
[] | null |
[] |
package cz.cvut.fel.cs.sin.controller;
import cz.cvut.fel.cs.sin.dao.AuthorDAOImpl;
import cz.cvut.fel.cs.sin.dao.BookDAOImpl;
import cz.cvut.fel.cs.sin.dao.LibraryDAOImpl;
import cz.cvut.fel.cs.sin.dao.PublisherDAOImpl;
import cz.cvut.fel.cs.sin.entity.Author;
import cz.cvut.fel.cs.sin.entity.Book;
import cz.cvut.fel.cs.sin.entity.Library;
import cz.cvut.fel.cs.sin.entity.Publisher;
import cz.cvut.fel.cs.sin.service.AuthorService;
import cz.cvut.fel.cs.sin.service.BookService;
import cz.cvut.fel.cs.sin.service.LibraryService;
import cz.cvut.fel.cs.sin.service.PublisherService;
import javax.annotation.PostConstruct;
import javax.enterprise.inject.Model;
import javax.enterprise.inject.Produces;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
@Model
public class Controller {
@Inject
Logger logger;
@Inject
private BookService bookService;
@Inject
private PublisherService publisherService;
@Inject
private LibraryService libraryService;
@Inject
private AuthorService authorService;
@Inject
private BookDAOImpl bookDAO;
@Inject
private LibraryDAOImpl libraryDAO;
@Inject
private PublisherDAOImpl publisherDAO;
@Inject
private AuthorDAOImpl authorDAO;
@Inject
private FacesContext facesContext;
@Named
@Produces
private Book book;
@Produces
@Named
private Book newBook;
@Produces
@Named
private String newBookAuthorId;
public String getNewBookAuthorId() {
return newBookAuthorId;
}
public void setNewBookAuthorId(String value) {
this.newBookAuthorId = value;
}
@Named
@Produces
private List<Book> books;
@Named
@Produces
private List<Author> authors;
@Named
@Produces
private List<Publisher> publishers;
@Named
@Produces
private List<Library> libraries;
@Named
@Produces
private Author APAuthor;
@Produces
@Named
private Author newAuthor;
@Named
@Produces
private Publisher APPublisher;
@Named
@Produces
private Publisher PBPublisher;
@Named
@Produces
private Book PBBook;
@Named
@Produces
private Book BLBook;
@Named
@Produces
private Library BLLibrary;
@PostConstruct
public void initNewBook() {
if (logger != null) logger.info("Recreating!");
newBook = new Book();
newBookAuthorId = "";
newAuthor = new Author();
APPublisher = new Publisher();
APAuthor = new Author();
PBPublisher = new Publisher();
PBBook = new Book();
BLBook = new Book();
BLLibrary = new Library();
if (bookDAO != null) books = bookDAO.list();
if (libraryDAO != null) libraries = libraryDAO.list();
if (publisherDAO != null) publishers = publisherDAO.list();
if (authorDAO != null) authors = authorDAO.list();
}
public void APMakeContract() {
try {
publisherService.singContract(APPublisher.getPublisherId(), APAuthor.getAuthorId());
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_INFO, "Contract signed!", "Contract signed");
facesContext.addMessage(null, m);
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addPublisherToBook() {
try {
publisherService.publishBook(PBPublisher.getPublisherId(), PBBook.getBookId());
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addBookToLibrary() {
try {
libraryService.addBook(BLLibrary.getLibraryId(), BLBook.getBookId());
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addBok() {
try {
Set<Author> s = new HashSet<>();
Author a = authorService.find(Integer.parseInt(newBookAuthorId));
if(a == null){
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Author Id not valid", "Author ID is invalid!");
facesContext.addMessage(null, m);
return;
}
s.add(a);
logger.info("Adding book " + newBook.getTitle());
newBook.setAuthors(s);
bookService.add(newBook);
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
public void addAuthor() {
try {
logger.info("Adding author " + newAuthor.getName());
authorService.add(newAuthor);
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_INFO, "Author added!", "Author added!");
facesContext.addMessage(null, m);
initNewBook();
} catch (Exception e) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Exception during persistence!", e.getMessage());
facesContext.addMessage(null, m);
}
}
}
| 5,822
| 0.639986
| 0.639986
| 215
| 26.079069
| 26.696543
| 127
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.576744
| false
| false
|
2
|
47ec42bf7c8db3044ef3e6a672c95a71c5d477a6
| 10,127,532,926,415
|
2689bb229130fe2808dec893c89d700db03bf14b
|
/src/main/java/com/example/demojsp/action/IndexController.java
|
97e3118c8a8dfdf14fdcdbffa4cd8cd9b342bc1b
|
[] |
no_license
|
wutong1992/SpringBootJSPDemo
|
https://github.com/wutong1992/SpringBootJSPDemo
|
26ba8689c61879e0b34b420bc948012c24e61e53
|
72da1956db1a88e2afa518d20318871a649b0ebc
|
refs/heads/master
| 2020-03-24T12:54:08.598000
| 2019-11-15T10:36:39
| 2019-11-15T10:36:39
| 142,728,300
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.demojsp.action;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class IndexController {
@RequestMapping(value = "/index",method = RequestMethod.GET)
public String index() {
return "login";
}
@RequestMapping(value = "/user/login",method = RequestMethod.GET)
public String login(String name, String pwd) {
String result = "login";
System.out.println("name : " + name);
System.out.println("pwd : " + pwd);
if(name.equals("root") && pwd.equals("root")) {
result = "index";
}
return result;
}
}
|
UTF-8
|
Java
| 752
|
java
|
IndexController.java
|
Java
|
[
{
"context": "d);\n if(name.equals(\"root\") && pwd.equals(\"root\")) {\n result = \"index\";\n }\n ",
"end": 675,
"score": 0.9535118937492371,
"start": 671,
"tag": "PASSWORD",
"value": "root"
}
] | null |
[] |
package com.example.demojsp.action;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class IndexController {
@RequestMapping(value = "/index",method = RequestMethod.GET)
public String index() {
return "login";
}
@RequestMapping(value = "/user/login",method = RequestMethod.GET)
public String login(String name, String pwd) {
String result = "login";
System.out.println("name : " + name);
System.out.println("pwd : " + pwd);
if(name.equals("root") && pwd.equals("<PASSWORD>")) {
result = "index";
}
return result;
}
}
| 758
| 0.656915
| 0.656915
| 25
| 29.08
| 22.861181
| 69
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.52
| false
| false
|
2
|
e688a0ea71f238dffd4fef9c0779c3d87927dd17
| 20,203,526,210,811
|
fd8c6ef1ea96c618f9e1326d1ad5d097498fd45d
|
/library/src/main/java/ch/sbi/minigit/debug/Connection.java
|
da68a16e6a268728afe03252c65e6caff3ae7838
|
[
"MIT"
] |
permissive
|
SBI-/minigit
|
https://github.com/SBI-/minigit
|
d51b83692e7b951b5c4a2b3b41fc7a77a6e574f7
|
3aafacb30ab6bf487917476c2432303348a18d8e
|
refs/heads/master
| 2022-05-29T08:02:19.080000
| 2019-12-10T09:11:11
| 2019-12-10T09:11:11
| 133,270,783
| 1
| 0
|
MIT
| false
| 2021-03-31T21:40:07
| 2018-05-13T20:11:19
| 2019-12-12T15:52:28
| 2021-03-31T21:40:06
| 155
| 1
| 0
| 2
|
Java
| false
| false
|
package ch.sbi.minigit.debug;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
public class Connection {
public void printHeaders(URLConnection connection) {
Map<String, List<String>> fields = connection.getHeaderFields();
for (String key : fields.keySet()) {
System.out.println(String.format("Key: %s", key));
for (String v : fields.get(key)) {
System.out.println(String.format("\t %s", v));
}
}
}
}
|
UTF-8
|
Java
| 472
|
java
|
Connection.java
|
Java
|
[] | null |
[] |
package ch.sbi.minigit.debug;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
public class Connection {
public void printHeaders(URLConnection connection) {
Map<String, List<String>> fields = connection.getHeaderFields();
for (String key : fields.keySet()) {
System.out.println(String.format("Key: %s", key));
for (String v : fields.get(key)) {
System.out.println(String.format("\t %s", v));
}
}
}
}
| 472
| 0.663136
| 0.663136
| 17
| 26.764706
| 21.678207
| 68
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.588235
| false
| false
|
2
|
1f7456b4b6d127dcb166aa6010ebe8b4af158ed6
| 2,456,721,307,179
|
1f6f0985918686e320539206e405b485e2906958
|
/src/service/SortProductsByName.java
|
0ddfca38f18429d5e66dbace293591cbd7b2b444
|
[] |
no_license
|
ngovanngoc1234/DA-cuoi-khoa
|
https://github.com/ngovanngoc1234/DA-cuoi-khoa
|
16f6163cbf66137e6b2ea0b8a7c846fb73cdaee6
|
9fcbfa3697d260c2e33ca2d214f6fc6130ae5b8d
|
refs/heads/master
| 2023-03-14T02:09:17.351000
| 2021-03-09T22:56:19
| 2021-03-09T22:56:19
| 318,111,601
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package service;
import model.Products;
import java.util.Comparator;
public class SortProductsByName implements Comparator<Products> {
@Override
public int compare(Products o1, Products o2) {
return o1.getProductsName().compareTo(o2.getProductsName());
}
}
|
UTF-8
|
Java
| 282
|
java
|
SortProductsByName.java
|
Java
|
[] | null |
[] |
package service;
import model.Products;
import java.util.Comparator;
public class SortProductsByName implements Comparator<Products> {
@Override
public int compare(Products o1, Products o2) {
return o1.getProductsName().compareTo(o2.getProductsName());
}
}
| 282
| 0.734043
| 0.719858
| 14
| 19.142857
| 23.811333
| 68
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.357143
| false
| false
|
2
|
9a25516d99839f6b1baf01d6b044168646317c19
| 11,845,519,804,283
|
9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3
|
/cab.snapp.passenger.play_184.apk-decompiled/sources/com/google/zxing/c/e.java
|
d032301de62b31c35bb7172d7e2f0a62a8d07d1b
|
[] |
no_license
|
BaseMax/PopularAndroidSource
|
https://github.com/BaseMax/PopularAndroidSource
|
a395ccac5c0a7334d90c2594db8273aca39550ed
|
bcae15340907797a91d39f89b9d7266e0292a184
|
refs/heads/master
| 2020-08-05T08:19:34.146000
| 2019-10-06T20:06:31
| 2019-10-06T20:06:31
| 212,433,298
| 2
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.google.zxing.c;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.a;
import com.google.zxing.h;
public final class e extends p {
/* renamed from: a reason: collision with root package name */
static final int[] f4280a = {0, 11, 13, 14, 19, 25, 28, 21, 22, 26};
private final int[] g = new int[4];
/* access modifiers changed from: protected */
public final int a(a aVar, int[] iArr, StringBuilder sb) throws h {
int[] iArr2 = this.g;
iArr2[0] = 0;
iArr2[1] = 0;
iArr2[2] = 0;
iArr2[3] = 0;
int size = aVar.getSize();
int i = iArr[1];
int i2 = 0;
int i3 = 0;
while (i2 < 6 && i < size) {
int a2 = a(aVar, iArr2, i, f);
sb.append((char) ((a2 % 10) + 48));
int i4 = i;
for (int i5 : iArr2) {
i4 += i5;
}
if (a2 >= 10) {
i3 = (1 << (5 - i2)) | i3;
}
i2++;
i = i4;
}
for (int i6 = 0; i6 < 10; i6++) {
if (i3 == f4280a[i6]) {
sb.insert(0, (char) (i6 + 48));
int i7 = a(aVar, i, true, c)[1];
int i8 = 0;
while (i8 < 6 && i7 < size) {
sb.append((char) (a(aVar, iArr2, i7, e) + 48));
int i9 = i7;
for (int i10 : iArr2) {
i9 += i10;
}
i8++;
i7 = i9;
}
return i7;
}
}
throw h.getNotFoundInstance();
}
/* access modifiers changed from: package-private */
public final BarcodeFormat a() {
return BarcodeFormat.EAN_13;
}
}
|
UTF-8
|
Java
| 1,807
|
java
|
e.java
|
Java
|
[] | null |
[] |
package com.google.zxing.c;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.a;
import com.google.zxing.h;
public final class e extends p {
/* renamed from: a reason: collision with root package name */
static final int[] f4280a = {0, 11, 13, 14, 19, 25, 28, 21, 22, 26};
private final int[] g = new int[4];
/* access modifiers changed from: protected */
public final int a(a aVar, int[] iArr, StringBuilder sb) throws h {
int[] iArr2 = this.g;
iArr2[0] = 0;
iArr2[1] = 0;
iArr2[2] = 0;
iArr2[3] = 0;
int size = aVar.getSize();
int i = iArr[1];
int i2 = 0;
int i3 = 0;
while (i2 < 6 && i < size) {
int a2 = a(aVar, iArr2, i, f);
sb.append((char) ((a2 % 10) + 48));
int i4 = i;
for (int i5 : iArr2) {
i4 += i5;
}
if (a2 >= 10) {
i3 = (1 << (5 - i2)) | i3;
}
i2++;
i = i4;
}
for (int i6 = 0; i6 < 10; i6++) {
if (i3 == f4280a[i6]) {
sb.insert(0, (char) (i6 + 48));
int i7 = a(aVar, i, true, c)[1];
int i8 = 0;
while (i8 < 6 && i7 < size) {
sb.append((char) (a(aVar, iArr2, i7, e) + 48));
int i9 = i7;
for (int i10 : iArr2) {
i9 += i10;
}
i8++;
i7 = i9;
}
return i7;
}
}
throw h.getNotFoundInstance();
}
/* access modifiers changed from: package-private */
public final BarcodeFormat a() {
return BarcodeFormat.EAN_13;
}
}
| 1,807
| 0.416159
| 0.356945
| 61
| 28.622952
| 17.602314
| 72
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.934426
| false
| false
|
2
|
3d8d4d730262a9ebc7318cb062f893b2995e9ccd
| 21,698,174,792,190
|
aa71ab22f6a6e779250bcba7ddc685fa6e4e143e
|
/chain/Ledger.java
|
5371bc5e75e56d57e8e08dd5fd06b466aa074f3d
|
[] |
no_license
|
smspillaz/simple-blockchain
|
https://github.com/smspillaz/simple-blockchain
|
bf771a8957d8b0b51954da3bdeb48e3fefef2b33
|
9c4771fa72aa6d9d692aa4a491acbb387b99568d
|
refs/heads/master
| 2021-03-16T07:37:18.255000
| 2020-10-28T21:37:53
| 2020-10-28T21:37:53
| 92,177,918
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import javax.xml.bind.DatatypeConverter;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* The Ledger class uses a blockchain internally to store transactions, but
* is also responsible for validating transactions as they come into the
* system. If a transaction is invalid, it gets rejected silently and never
* ends up on the blockchain.
*
* The way this is done is that we maintain a 'view' over who owns what
* amount of Chriscoins as determined by the blockchain itself. This object
* will validate the individual transactions themselves to ensure that nobody
* spends money that they don't own, but it does not validate that the sequence
* of transactions was correct. That is the responsibility of the whoever is
* validating a downloaded blockchain.
*/
public class Ledger {
protected Blockchain chain;
protected Map<String, Long> ownership;
protected static <K, V> void maybeInitialiseMapEntry(Map<K, V> map,
K key,
V init) {
if (!map.containsKey(key)) {
map.put(key, init);
}
}
public static class TransactionValidationFailedException extends Blockchain.WalkFailedException {
@SuppressFBWarnings
public TransactionValidationFailedException(byte[] src,
long srcCoins,
byte[] dst,
long amount) {
super("Transaction validation failed: " + DatatypeConverter.printHexBinary(src) +
" -> " + DatatypeConverter.printHexBinary(dst) + ". " +
DatatypeConverter.printHexBinary(src) + " only has " +
srcCoins + " Chriscoins, but attempted to " +
"spend " + amount + " chriscoins");
}
}
public static class BlobSignatureValidationFailedException extends Blockchain.WalkFailedException {
@SuppressFBWarnings
public BlobSignatureValidationFailedException(Transaction transaction,
byte[] signature) {
super("Signature validation failed: signature " +
DatatypeConverter.printHexBinary(signature) + " " +
" was not valid for transaction " +
transaction.toString());
}
}
public interface TransactionObserver {
void consume(Transaction transaction);
}
/* Check that a payload makes sense. This function returns normally
* if everything is fine, but throws exceptions in cases where
* a payload is malformed or nonsensical.
*
* If the payload made sense, update our internal view of
* the blockchain state. */
protected static void validateAndProcessPayload(byte[] payload,
int index,
Map<String, Long> ownership,
List<TransactionObserver> observers) throws TransactionValidationFailedException,
Blockchain.WalkFailedException,
BlobSignatureValidationFailedException {
SignedObject blob = new SignedObject(payload);
Transaction transaction = new Transaction(blob.payload);
String srcMapKey = DatatypeConverter.printHexBinary(transaction.sPubKey);
String dstMapKey = DatatypeConverter.printHexBinary(transaction.rPubKey);
/* If the map doesn't contain an address, then add it with
* a balance of zero chriscoins.
*
* NOTE: Converting from byte arrays to digest strings like
* this is a pretty lazy way to get into a map, but perhaps
* later we can make the public keys a first class object */
Ledger.maybeInitialiseMapEntry(ownership,
srcMapKey,
0L);
Ledger.maybeInitialiseMapEntry(ownership,
dstMapKey,
0L);
long srcCoins = ownership.get(srcMapKey);
/* Reverse transactions are never allowed */
if (transaction.amount < 0) {
throw new TransactionValidationFailedException(transaction.sPubKey,
srcCoins,
transaction.rPubKey,
transaction.amount);
}
/* On non-genesis blocks we need to perform transaction
* validation to ensure that nobody spends money that they
* don't have. On the genesis block however, we don't deduct
* money, only add it */
if (index > 0 &&
ownership.get(srcMapKey) < transaction.amount) {
throw new TransactionValidationFailedException(transaction.sPubKey,
srcCoins,
transaction.rPubKey,
transaction.amount);
}
/* Self-transactions are not valid on genesis blocks */
if (index > 0 && srcMapKey.equals(dstMapKey)) {
throw new Blockchain.WalkFailedException(transaction +
" is a self transaction on a non-genesis block");
}
boolean signatureVerificationResult = false;
try {
signatureVerificationResult = SignedObject.signatureIsValid(blob.payload,
blob.signature,
transaction.sPubKey);
} catch (NoSuchAlgorithmException e) {
/* Not much we can do here other than re-throw and abort
* the walk process */
throw new Blockchain.WalkFailedException(e.getMessage());
} catch (InvalidKeyException e) {
throw new Blockchain.WalkFailedException(transaction +
" does not have a processable signature: " +
e.getMessage());
} catch (InvalidKeySpecException e) {
throw new Blockchain.WalkFailedException(transaction +
"has an invalid public key PEM contents: " +
e.getMessage());
} catch (SignatureException e) {
throw new Blockchain.WalkFailedException(transaction +
" has an invalid public key: " +
e.getMessage());
}
/* Check to make sure that the signature is valid on the blob */
if (!signatureVerificationResult) {
throw new BlobSignatureValidationFailedException(transaction,
blob.signature);
}
/* Transaction would have been successful. Allow this transaction
* on the chain and update our view */
if (index > 0) {
ownership.put(srcMapKey,
Math.max(ownership.get(srcMapKey) -
transaction.amount, 0L));
}
ownership.put(dstMapKey,
ownership.get(dstMapKey) + transaction.amount);
for (TransactionObserver observer : observers) {
observer.consume(transaction);
}
}
/* Build up a view the transaction history for each public key and
* address, optionally calling out to a TransactionObserver for each
* transaction */
private static Map<String, Long> walkTransactions(Blockchain chain,
final List<TransactionObserver> observers) throws Blockchain.WalkFailedException {
final Map<String, Long> ownership = new HashMap<String, Long>();
chain.walk(new Blockchain.BlockEnumerator() {
public void consume(int index, Block block) throws Blockchain.WalkFailedException {
validateAndProcessPayload(block.payload,
index,
ownership,
observers);
}
});
return ownership;
}
/* Construct a new ledger from a Blockchain. */
public Ledger(Blockchain chain) throws Blockchain.WalkFailedException {
this.chain = chain;
this.ownership = Ledger.walkTransactions(this.chain,
new ArrayList<TransactionObserver>());
}
/* Construct a new ledger from a Blockchain, but also observe
* transactions as they are validated */
public Ledger(Blockchain chain,
TransactionObserver observer) throws Blockchain.WalkFailedException {
this.chain = chain;
this.ownership = Ledger.walkTransactions(this.chain,
Arrays.asList(new TransactionObserver[] {
observer
}));
}
public Ledger(Blockchain chain,
List<TransactionObserver> observers) throws Blockchain.WalkFailedException {
this.chain = chain;
this.ownership = Ledger.walkTransactions(this.chain, observers);
}
}
|
UTF-8
|
Java
| 10,243
|
java
|
Ledger.java
|
Java
|
[] | null |
[] |
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import javax.xml.bind.DatatypeConverter;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* The Ledger class uses a blockchain internally to store transactions, but
* is also responsible for validating transactions as they come into the
* system. If a transaction is invalid, it gets rejected silently and never
* ends up on the blockchain.
*
* The way this is done is that we maintain a 'view' over who owns what
* amount of Chriscoins as determined by the blockchain itself. This object
* will validate the individual transactions themselves to ensure that nobody
* spends money that they don't own, but it does not validate that the sequence
* of transactions was correct. That is the responsibility of the whoever is
* validating a downloaded blockchain.
*/
public class Ledger {
protected Blockchain chain;
protected Map<String, Long> ownership;
protected static <K, V> void maybeInitialiseMapEntry(Map<K, V> map,
K key,
V init) {
if (!map.containsKey(key)) {
map.put(key, init);
}
}
public static class TransactionValidationFailedException extends Blockchain.WalkFailedException {
@SuppressFBWarnings
public TransactionValidationFailedException(byte[] src,
long srcCoins,
byte[] dst,
long amount) {
super("Transaction validation failed: " + DatatypeConverter.printHexBinary(src) +
" -> " + DatatypeConverter.printHexBinary(dst) + ". " +
DatatypeConverter.printHexBinary(src) + " only has " +
srcCoins + " Chriscoins, but attempted to " +
"spend " + amount + " chriscoins");
}
}
public static class BlobSignatureValidationFailedException extends Blockchain.WalkFailedException {
@SuppressFBWarnings
public BlobSignatureValidationFailedException(Transaction transaction,
byte[] signature) {
super("Signature validation failed: signature " +
DatatypeConverter.printHexBinary(signature) + " " +
" was not valid for transaction " +
transaction.toString());
}
}
public interface TransactionObserver {
void consume(Transaction transaction);
}
/* Check that a payload makes sense. This function returns normally
* if everything is fine, but throws exceptions in cases where
* a payload is malformed or nonsensical.
*
* If the payload made sense, update our internal view of
* the blockchain state. */
protected static void validateAndProcessPayload(byte[] payload,
int index,
Map<String, Long> ownership,
List<TransactionObserver> observers) throws TransactionValidationFailedException,
Blockchain.WalkFailedException,
BlobSignatureValidationFailedException {
SignedObject blob = new SignedObject(payload);
Transaction transaction = new Transaction(blob.payload);
String srcMapKey = DatatypeConverter.printHexBinary(transaction.sPubKey);
String dstMapKey = DatatypeConverter.printHexBinary(transaction.rPubKey);
/* If the map doesn't contain an address, then add it with
* a balance of zero chriscoins.
*
* NOTE: Converting from byte arrays to digest strings like
* this is a pretty lazy way to get into a map, but perhaps
* later we can make the public keys a first class object */
Ledger.maybeInitialiseMapEntry(ownership,
srcMapKey,
0L);
Ledger.maybeInitialiseMapEntry(ownership,
dstMapKey,
0L);
long srcCoins = ownership.get(srcMapKey);
/* Reverse transactions are never allowed */
if (transaction.amount < 0) {
throw new TransactionValidationFailedException(transaction.sPubKey,
srcCoins,
transaction.rPubKey,
transaction.amount);
}
/* On non-genesis blocks we need to perform transaction
* validation to ensure that nobody spends money that they
* don't have. On the genesis block however, we don't deduct
* money, only add it */
if (index > 0 &&
ownership.get(srcMapKey) < transaction.amount) {
throw new TransactionValidationFailedException(transaction.sPubKey,
srcCoins,
transaction.rPubKey,
transaction.amount);
}
/* Self-transactions are not valid on genesis blocks */
if (index > 0 && srcMapKey.equals(dstMapKey)) {
throw new Blockchain.WalkFailedException(transaction +
" is a self transaction on a non-genesis block");
}
boolean signatureVerificationResult = false;
try {
signatureVerificationResult = SignedObject.signatureIsValid(blob.payload,
blob.signature,
transaction.sPubKey);
} catch (NoSuchAlgorithmException e) {
/* Not much we can do here other than re-throw and abort
* the walk process */
throw new Blockchain.WalkFailedException(e.getMessage());
} catch (InvalidKeyException e) {
throw new Blockchain.WalkFailedException(transaction +
" does not have a processable signature: " +
e.getMessage());
} catch (InvalidKeySpecException e) {
throw new Blockchain.WalkFailedException(transaction +
"has an invalid public key PEM contents: " +
e.getMessage());
} catch (SignatureException e) {
throw new Blockchain.WalkFailedException(transaction +
" has an invalid public key: " +
e.getMessage());
}
/* Check to make sure that the signature is valid on the blob */
if (!signatureVerificationResult) {
throw new BlobSignatureValidationFailedException(transaction,
blob.signature);
}
/* Transaction would have been successful. Allow this transaction
* on the chain and update our view */
if (index > 0) {
ownership.put(srcMapKey,
Math.max(ownership.get(srcMapKey) -
transaction.amount, 0L));
}
ownership.put(dstMapKey,
ownership.get(dstMapKey) + transaction.amount);
for (TransactionObserver observer : observers) {
observer.consume(transaction);
}
}
/* Build up a view the transaction history for each public key and
* address, optionally calling out to a TransactionObserver for each
* transaction */
private static Map<String, Long> walkTransactions(Blockchain chain,
final List<TransactionObserver> observers) throws Blockchain.WalkFailedException {
final Map<String, Long> ownership = new HashMap<String, Long>();
chain.walk(new Blockchain.BlockEnumerator() {
public void consume(int index, Block block) throws Blockchain.WalkFailedException {
validateAndProcessPayload(block.payload,
index,
ownership,
observers);
}
});
return ownership;
}
/* Construct a new ledger from a Blockchain. */
public Ledger(Blockchain chain) throws Blockchain.WalkFailedException {
this.chain = chain;
this.ownership = Ledger.walkTransactions(this.chain,
new ArrayList<TransactionObserver>());
}
/* Construct a new ledger from a Blockchain, but also observe
* transactions as they are validated */
public Ledger(Blockchain chain,
TransactionObserver observer) throws Blockchain.WalkFailedException {
this.chain = chain;
this.ownership = Ledger.walkTransactions(this.chain,
Arrays.asList(new TransactionObserver[] {
observer
}));
}
public Ledger(Blockchain chain,
List<TransactionObserver> observers) throws Blockchain.WalkFailedException {
this.chain = chain;
this.ownership = Ledger.walkTransactions(this.chain, observers);
}
}
| 10,243
| 0.538124
| 0.53744
| 218
| 45.990826
| 31.765047
| 136
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.477064
| false
| false
|
2
|
e12ea0fb698a2e02f301d707d8e4abfbe56e5409
| 33,947,421,535,401
|
e1520517adcdd4ee45fb7b19e7002fdd5a46a02a
|
/polardbx-executor/src/test/java/com/alibaba/polardbx/executor/operator/SingleExecTest.java
|
83fa7d69017352edee20a2e14005b3d731918fb4
|
[
"Apache-2.0"
] |
permissive
|
huashen/galaxysql
|
https://github.com/huashen/galaxysql
|
7702969269d7f126d36f269e3331ed1c8da4dc20
|
b6c88d516367af105d85c6db60126431a7e4df4c
|
refs/heads/main
| 2023-09-04T11:40:36.590000
| 2021-10-25T15:43:14
| 2021-10-25T15:43:14
| 421,088,419
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright [2013-2021], Alibaba Group Holding Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.polardbx.executor.operator;
import com.google.common.util.concurrent.ListenableFuture;
import com.alibaba.polardbx.optimizer.chunk.Chunk;
import com.alibaba.polardbx.executor.operator.spill.MemoryRevoker;
import java.util.List;
import static io.airlift.concurrent.MoreFutures.getFutureValue;
/**
* test for only one op
*
*/
public class SingleExecTest {
public enum ConsumeSource {
PRODUCER,
CHUNK_LIST,
NOT_CONSUMER,
}
;
final Executor exec;
final ExecTestDriver driver;
final ExecTestDriver.ProduceTask produceTask; // to get result
final Runnable afterRevoker;
private void handleMemoryRevoking() {
MemoryRevoker memoryRevoker = (MemoryRevoker) exec;
ListenableFuture<?> future = memoryRevoker.startMemoryRevoke();
getFutureValue(future);
memoryRevoker.finishMemoryRevoke();
memoryRevoker.getMemoryAllocatorCtx().resetMemoryRevokingRequested();
if (afterRevoker != null) {
afterRevoker.run();
}
}
private SingleExecTest(Builder builder) {
this.exec = builder.exec;
this.afterRevoker = builder.afterRevoke;
ConsumerExecutor consumer = null;
Executor producer = null;
try {
final int maxSpillCnt = builder.maxSpillCnt;
if (builder.consumeSource == ConsumeSource.NOT_CONSUMER) {
consumer = null;
} else if (builder.consumeNeedRevoke()) {
TriggerProxy.Builder proxyBuilder = new TriggerProxy.Builder(exec);
if (builder.revokeChunkNumInConsume > 0) {
proxyBuilder
.addTrigger(ConsumerExecutor.class.getDeclaredMethod("consumeChunk", Chunk.class), () -> {
if (maxSpillCnt != 0
&& ((AbstractExecutor) exec).getStatistics().getSpillCnt() >= maxSpillCnt) {
return;
}
getFutureValue(((ConsumerExecutor) exec).consumeIsBlocked());
handleMemoryRevoking();
}, builder.revokeChunkNumInConsume);
}
if (builder.revokeAfterConsume) {
proxyBuilder.addTrigger(ConsumerExecutor.class.getDeclaredMethod("buildConsume"), () -> {
if (maxSpillCnt != 0
&& ((AbstractExecutor) exec).getStatistics().getSpillCnt() >= maxSpillCnt) {
return;
}
handleMemoryRevoking();
});
}
consumer = (ConsumerExecutor) proxyBuilder.build().getProxyWithInterface(ConsumerExecutor.class);
} else {
consumer = (ConsumerExecutor) exec;
}
if (builder.produceNeedRevoke()) {
TriggerProxy.Builder proxyBuilder = new TriggerProxy.Builder(exec);
if (builder.revokeChunkNumInProduce > 0) {
proxyBuilder.addTrigger(Executor.class.getDeclaredMethod("nextChunk"), () -> {
if (maxSpillCnt != 0
&& ((AbstractExecutor) exec).getStatistics().getSpillCnt() >= maxSpillCnt) {
return;
}
getFutureValue(exec.produceIsBlocked());
handleMemoryRevoking();
}, builder.revokeChunkNumInProduce);
}
// TODO: only use Excutor
producer = (Executor) proxyBuilder.build()
.getProxyWithInterfaces(new Class<?>[] {Executor.class, ProducerExecutor.class});
} else {
producer = exec;
}
} catch (Exception e) {
e.printStackTrace();
}
this.produceTask =
ExecTestDriver.TaskFactory.getProduce(producer, builder.produceParallelism);
ExecTestDriver.ConsumeTask consumeTask;
switch (builder.consumeSource) {
case CHUNK_LIST:
consumeTask = ExecTestDriver.TaskFactory
.getConsume(consumer, builder.inputChunks, builder.consumeParallelism);
break;
case PRODUCER:
consumeTask = ExecTestDriver.TaskFactory
.getConsume(consumer, builder.inputProducer, builder.consumeParallelism);
break;
case NOT_CONSUMER:
consumeTask = ExecTestDriver.TaskFactory.NULL_CONSUME_TASK;
break;
default:
throw new UnsupportedOperationException(String.valueOf(builder.consumeSource));
}
this.driver = new ExecTestDriver.Builder().addConsumer(consumeTask).addProducer(this.produceTask).build();
}
void exec() {
driver.exec();
}
public List<Chunk> result() {
return produceTask.result();
}
static class Builder {
final Executor exec;
final List<Chunk> inputChunks;
final Executor inputProducer;
final ConsumeSource consumeSource;
int consumeParallelism = 1;
int produceParallelism = 1;
int revokeChunkNumInConsume = 0;
public boolean revokeAfterConsume;
int revokeChunkNumInProduce = 0;
int maxSpillCnt = 0;
Runnable afterRevoke = null;
boolean consumeNeedRevoke() {
return revokeChunkNumInConsume > 0 || revokeAfterConsume;
}
boolean produceNeedRevoke() {
return revokeChunkNumInProduce > 0;
}
Builder(Executor exec) {
this.consumeSource = ConsumeSource.NOT_CONSUMER;
this.exec = exec;
this.inputChunks = null;
this.inputProducer = null;
}
Builder(Executor exec, List<Chunk> inputChunks) {
this.consumeSource = ConsumeSource.CHUNK_LIST;
this.exec = exec;
this.inputChunks = inputChunks;
this.inputProducer = null;
}
Builder(Executor exec, Executor inputProducer) {
this.consumeSource = ConsumeSource.PRODUCER;
this.exec = exec;
this.inputChunks = null;
this.inputProducer = inputProducer;
}
Builder setParallelism(int consumeParallelism, int produceParallelism) {
this.consumeParallelism = consumeParallelism;
this.produceParallelism = produceParallelism;
return this;
}
// when revokeNum == 0, then not revoke
Builder setRevoke(int revokeChunkNumInConsume, boolean revokeAfterConsume, int revokeChunkNumInProduce,
int maxSpillCnt) {
this.revokeChunkNumInConsume = revokeChunkNumInConsume;
this.revokeChunkNumInProduce = revokeChunkNumInProduce;
this.revokeAfterConsume = revokeAfterConsume;
this.maxSpillCnt = maxSpillCnt;
return this;
}
Builder setRevoke(int revokeChunkNumInConsume, boolean revokeAfterConsume, int revokeChunkNumInProduce) {
return setRevoke(revokeChunkNumInConsume, revokeAfterConsume, revokeChunkNumInProduce, 0);
}
public void setAfterRevoke(Runnable afterRevoker) {
this.afterRevoke = afterRevoker;
}
SingleExecTest build() {
return new SingleExecTest(this);
}
}
}
|
UTF-8
|
Java
| 8,119
|
java
|
SingleExecTest.java
|
Java
|
[] | null |
[] |
/*
* Copyright [2013-2021], Alibaba Group Holding Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.polardbx.executor.operator;
import com.google.common.util.concurrent.ListenableFuture;
import com.alibaba.polardbx.optimizer.chunk.Chunk;
import com.alibaba.polardbx.executor.operator.spill.MemoryRevoker;
import java.util.List;
import static io.airlift.concurrent.MoreFutures.getFutureValue;
/**
* test for only one op
*
*/
public class SingleExecTest {
public enum ConsumeSource {
PRODUCER,
CHUNK_LIST,
NOT_CONSUMER,
}
;
final Executor exec;
final ExecTestDriver driver;
final ExecTestDriver.ProduceTask produceTask; // to get result
final Runnable afterRevoker;
private void handleMemoryRevoking() {
MemoryRevoker memoryRevoker = (MemoryRevoker) exec;
ListenableFuture<?> future = memoryRevoker.startMemoryRevoke();
getFutureValue(future);
memoryRevoker.finishMemoryRevoke();
memoryRevoker.getMemoryAllocatorCtx().resetMemoryRevokingRequested();
if (afterRevoker != null) {
afterRevoker.run();
}
}
private SingleExecTest(Builder builder) {
this.exec = builder.exec;
this.afterRevoker = builder.afterRevoke;
ConsumerExecutor consumer = null;
Executor producer = null;
try {
final int maxSpillCnt = builder.maxSpillCnt;
if (builder.consumeSource == ConsumeSource.NOT_CONSUMER) {
consumer = null;
} else if (builder.consumeNeedRevoke()) {
TriggerProxy.Builder proxyBuilder = new TriggerProxy.Builder(exec);
if (builder.revokeChunkNumInConsume > 0) {
proxyBuilder
.addTrigger(ConsumerExecutor.class.getDeclaredMethod("consumeChunk", Chunk.class), () -> {
if (maxSpillCnt != 0
&& ((AbstractExecutor) exec).getStatistics().getSpillCnt() >= maxSpillCnt) {
return;
}
getFutureValue(((ConsumerExecutor) exec).consumeIsBlocked());
handleMemoryRevoking();
}, builder.revokeChunkNumInConsume);
}
if (builder.revokeAfterConsume) {
proxyBuilder.addTrigger(ConsumerExecutor.class.getDeclaredMethod("buildConsume"), () -> {
if (maxSpillCnt != 0
&& ((AbstractExecutor) exec).getStatistics().getSpillCnt() >= maxSpillCnt) {
return;
}
handleMemoryRevoking();
});
}
consumer = (ConsumerExecutor) proxyBuilder.build().getProxyWithInterface(ConsumerExecutor.class);
} else {
consumer = (ConsumerExecutor) exec;
}
if (builder.produceNeedRevoke()) {
TriggerProxy.Builder proxyBuilder = new TriggerProxy.Builder(exec);
if (builder.revokeChunkNumInProduce > 0) {
proxyBuilder.addTrigger(Executor.class.getDeclaredMethod("nextChunk"), () -> {
if (maxSpillCnt != 0
&& ((AbstractExecutor) exec).getStatistics().getSpillCnt() >= maxSpillCnt) {
return;
}
getFutureValue(exec.produceIsBlocked());
handleMemoryRevoking();
}, builder.revokeChunkNumInProduce);
}
// TODO: only use Excutor
producer = (Executor) proxyBuilder.build()
.getProxyWithInterfaces(new Class<?>[] {Executor.class, ProducerExecutor.class});
} else {
producer = exec;
}
} catch (Exception e) {
e.printStackTrace();
}
this.produceTask =
ExecTestDriver.TaskFactory.getProduce(producer, builder.produceParallelism);
ExecTestDriver.ConsumeTask consumeTask;
switch (builder.consumeSource) {
case CHUNK_LIST:
consumeTask = ExecTestDriver.TaskFactory
.getConsume(consumer, builder.inputChunks, builder.consumeParallelism);
break;
case PRODUCER:
consumeTask = ExecTestDriver.TaskFactory
.getConsume(consumer, builder.inputProducer, builder.consumeParallelism);
break;
case NOT_CONSUMER:
consumeTask = ExecTestDriver.TaskFactory.NULL_CONSUME_TASK;
break;
default:
throw new UnsupportedOperationException(String.valueOf(builder.consumeSource));
}
this.driver = new ExecTestDriver.Builder().addConsumer(consumeTask).addProducer(this.produceTask).build();
}
void exec() {
driver.exec();
}
public List<Chunk> result() {
return produceTask.result();
}
static class Builder {
final Executor exec;
final List<Chunk> inputChunks;
final Executor inputProducer;
final ConsumeSource consumeSource;
int consumeParallelism = 1;
int produceParallelism = 1;
int revokeChunkNumInConsume = 0;
public boolean revokeAfterConsume;
int revokeChunkNumInProduce = 0;
int maxSpillCnt = 0;
Runnable afterRevoke = null;
boolean consumeNeedRevoke() {
return revokeChunkNumInConsume > 0 || revokeAfterConsume;
}
boolean produceNeedRevoke() {
return revokeChunkNumInProduce > 0;
}
Builder(Executor exec) {
this.consumeSource = ConsumeSource.NOT_CONSUMER;
this.exec = exec;
this.inputChunks = null;
this.inputProducer = null;
}
Builder(Executor exec, List<Chunk> inputChunks) {
this.consumeSource = ConsumeSource.CHUNK_LIST;
this.exec = exec;
this.inputChunks = inputChunks;
this.inputProducer = null;
}
Builder(Executor exec, Executor inputProducer) {
this.consumeSource = ConsumeSource.PRODUCER;
this.exec = exec;
this.inputChunks = null;
this.inputProducer = inputProducer;
}
Builder setParallelism(int consumeParallelism, int produceParallelism) {
this.consumeParallelism = consumeParallelism;
this.produceParallelism = produceParallelism;
return this;
}
// when revokeNum == 0, then not revoke
Builder setRevoke(int revokeChunkNumInConsume, boolean revokeAfterConsume, int revokeChunkNumInProduce,
int maxSpillCnt) {
this.revokeChunkNumInConsume = revokeChunkNumInConsume;
this.revokeChunkNumInProduce = revokeChunkNumInProduce;
this.revokeAfterConsume = revokeAfterConsume;
this.maxSpillCnt = maxSpillCnt;
return this;
}
Builder setRevoke(int revokeChunkNumInConsume, boolean revokeAfterConsume, int revokeChunkNumInProduce) {
return setRevoke(revokeChunkNumInConsume, revokeAfterConsume, revokeChunkNumInProduce, 0);
}
public void setAfterRevoke(Runnable afterRevoker) {
this.afterRevoke = afterRevoker;
}
SingleExecTest build() {
return new SingleExecTest(this);
}
}
}
| 8,119
| 0.597487
| 0.594285
| 218
| 36.243118
| 29.142494
| 114
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.568807
| false
| false
|
2
|
49656fe61f95ca5c087d90626d3dd22200e51d4e
| 35,081,292,884,353
|
1b80237e2979eefc4aa6c634e31accd613fbfa5c
|
/app/src/main/java/com/example/user/bulletfalls/Game/Management/Medium.java
|
6c29645f3b9a852f5b7c575238c06061e0430b52
|
[] |
no_license
|
Astorn12/BulletFalls
|
https://github.com/Astorn12/BulletFalls
|
9b3aaa4cc98ca35f43f2e642be5e2e57f7771b7b
|
568b6ece5b2e582dddbcca01792da6bd0d8f7338
|
refs/heads/master
| 2021-08-07T12:17:53.934000
| 2020-05-11T13:15:29
| 2020-05-11T13:15:29
| 174,234,767
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.user.bulletfalls.Game.Management;
import com.example.user.bulletfalls.Game.Elements.Ability.Specyfication.WaitAbilitySpecyfication;
import com.example.user.bulletfalls.Game.Elements.Enemy.EnemySpecyfication;
import com.example.user.bulletfalls.Missions.Missionable;
import com.example.user.bulletfalls.Missions.Requirements.OveralStatisticChecker;
import com.example.user.bulletfalls.Profile.Currency;
import com.example.user.bulletfalls.Game.Elements.Ability.Specyfication.AbilitySpecyfication;
import com.example.user.bulletfalls.Game.Strategies.Bounty.Bounty;
import com.example.user.bulletfalls.Game.Elements.Ability.Ability;
import com.example.user.bulletfalls.Game.Elements.Bullet.Specyfication.BulletSpecyfication;
import com.example.user.bulletfalls.Game.Elements.Hero.HeroSpecyfication;
import org.apache.commons.lang3.tuple.MutablePair;
import java.util.LinkedList;
import java.util.List;
public class Medium implements Missionable {
HeroSpecyfication heroSpecyfication;
List<EnemySpecyfication> deathEnemySpecyficationList;
List<EnemySpecyfication> pushedEnemySpecyfications;
long startTime;
long endTime;
ArchivContainer<AbilitySpecyfication> usedAbilities;
ArchivContainer<BulletSpecyfication> heroBullets;
ArchivContainer<EnemyShot> enemyBullets;
List<Hitt> enemyHits;
//List<MutablePair<Integer,BulletSpecyfication>> takenDamage;
// ArchivContainer<BulletSpecyfication> takenDamage;
Bounty bounty;
List<HeroHited> hitsFromEnemyToHero;
String result;
public Medium()
{
this.deathEnemySpecyficationList = new LinkedList<>();
this.pushedEnemySpecyfications = new LinkedList<>();
this.heroBullets= new ArchivContainer<>();
this.enemyBullets= new ArchivContainer<>();
this.enemyHits=new LinkedList<>();
this.usedAbilities= new ArchivContainer<>();
//takenDamage= new ArchivContainer<>();
hitsFromEnemyToHero=new LinkedList<>();
this.bounty= new Bounty();
this.hitsFromEnemyToHero=new LinkedList<>();
result="Win";
}
public void startTimer()
{
this.startTime= System.currentTimeMillis();
}
public void stopTime()
{
this.endTime=System.currentTimeMillis();
}
public long getDuration()
{
if(startTime>0&& endTime>0)
{
return endTime-startTime;
}
return 0;
}
public void heroBorning(HeroSpecyfication heroSpecyfication)
{
this.heroSpecyfication = heroSpecyfication;
}
public void enemyBorning(EnemySpecyfication enemySpecyficationSpecyfication){this.pushedEnemySpecyfications.add(enemySpecyficationSpecyfication);}
public void heroShot(BulletSpecyfication bulletSpecyfication, List<Ability> abilities){
heroBullets.add(bulletSpecyfication);
for(Ability av: abilities)
{
if(av.getAbilitySpecyfication().getClass().equals(WaitAbilitySpecyfication.class))
{
WaitAbilitySpecyfication wa=(WaitAbilitySpecyfication)av.getAbilitySpecyfication();
if(heroBullets.hasEnought(wa.getWaitedBulletSpecyfication(),wa.getAmount()))
{
wa.activate();
av.checkActivation();
}
}
}
}
public void enemyShot(EnemyShot enemyShot)
{
enemyBullets.add(enemyShot);
}
public void abilityUse(AbilitySpecyfication abilitySpecyfication)
{
usedAbilities.add(abilitySpecyfication);
}
public void deathOfEnemy(EnemySpecyfication enemySpecyficationSpecyfication)
{
this.deathEnemySpecyficationList.add(enemySpecyficationSpecyfication);
}
public void enemyHited(Hitt hit)
{
this.enemyHits.add(hit);
}
public void takedDamage(MutablePair<Integer,BulletSpecyfication> hit)
{
// this.takenDamage.add(hit.getRight(),hit.getLeft());
this.hitsFromEnemyToHero.add(new HeroHited(System.currentTimeMillis(),hit.getLeft(),hit.getRight()));
}
public int getTakenDamage()
{
//return this.takenDamage.countAll();
int sum=0;
for(HeroHited h: this.hitsFromEnemyToHero)
{
sum+=h.damage;
}
return sum;
}
public int dealedDamage(){
int sum=0;
for(Hitt h: this.enemyHits){
sum+=h.damage;
}
return sum;
}
/**Do zaprogramowania*/
// lista zdobytych obietów i obiekt item
//lista herosupporters stworzyć herosupporter
public Bounty getBounty() {
return bounty;
}
public List<EnemySpecyfication> getKilledEnemys()
{
return this.deathEnemySpecyficationList;
}
public int getAbilityUseCounter(AbilitySpecyfication abilitySpecyfication)
{
return this.usedAbilities.getUseCounter(abilitySpecyfication);
}
public int getShootedByHero()
{
return this.heroBullets.countAll();
}
public int timeJumpHeal(long time)
{
int takenDamage=0;
long now=System.currentTimeMillis();
for(HeroHited h: this.hitsFromEnemyToHero)
{
if(now-time<h.time) {
takenDamage += h.damage;
}
}
return takenDamage;
}
public void registerItem(Currency currency) {
this.bounty.addItem(currency);
}
public String getResult() {
return result;
}
public void addMoney(int gold){
this.bounty.addMoney(gold);
}
public HeroSpecyfication getHeroSpecyfication() {
return heroSpecyfication;
}
@Override
public int acceptChecking(OveralStatisticChecker checker,int i) {
return checker.check(this,i);
}
}
|
UTF-8
|
Java
| 5,808
|
java
|
Medium.java
|
Java
|
[] | null |
[] |
package com.example.user.bulletfalls.Game.Management;
import com.example.user.bulletfalls.Game.Elements.Ability.Specyfication.WaitAbilitySpecyfication;
import com.example.user.bulletfalls.Game.Elements.Enemy.EnemySpecyfication;
import com.example.user.bulletfalls.Missions.Missionable;
import com.example.user.bulletfalls.Missions.Requirements.OveralStatisticChecker;
import com.example.user.bulletfalls.Profile.Currency;
import com.example.user.bulletfalls.Game.Elements.Ability.Specyfication.AbilitySpecyfication;
import com.example.user.bulletfalls.Game.Strategies.Bounty.Bounty;
import com.example.user.bulletfalls.Game.Elements.Ability.Ability;
import com.example.user.bulletfalls.Game.Elements.Bullet.Specyfication.BulletSpecyfication;
import com.example.user.bulletfalls.Game.Elements.Hero.HeroSpecyfication;
import org.apache.commons.lang3.tuple.MutablePair;
import java.util.LinkedList;
import java.util.List;
public class Medium implements Missionable {
HeroSpecyfication heroSpecyfication;
List<EnemySpecyfication> deathEnemySpecyficationList;
List<EnemySpecyfication> pushedEnemySpecyfications;
long startTime;
long endTime;
ArchivContainer<AbilitySpecyfication> usedAbilities;
ArchivContainer<BulletSpecyfication> heroBullets;
ArchivContainer<EnemyShot> enemyBullets;
List<Hitt> enemyHits;
//List<MutablePair<Integer,BulletSpecyfication>> takenDamage;
// ArchivContainer<BulletSpecyfication> takenDamage;
Bounty bounty;
List<HeroHited> hitsFromEnemyToHero;
String result;
public Medium()
{
this.deathEnemySpecyficationList = new LinkedList<>();
this.pushedEnemySpecyfications = new LinkedList<>();
this.heroBullets= new ArchivContainer<>();
this.enemyBullets= new ArchivContainer<>();
this.enemyHits=new LinkedList<>();
this.usedAbilities= new ArchivContainer<>();
//takenDamage= new ArchivContainer<>();
hitsFromEnemyToHero=new LinkedList<>();
this.bounty= new Bounty();
this.hitsFromEnemyToHero=new LinkedList<>();
result="Win";
}
public void startTimer()
{
this.startTime= System.currentTimeMillis();
}
public void stopTime()
{
this.endTime=System.currentTimeMillis();
}
public long getDuration()
{
if(startTime>0&& endTime>0)
{
return endTime-startTime;
}
return 0;
}
public void heroBorning(HeroSpecyfication heroSpecyfication)
{
this.heroSpecyfication = heroSpecyfication;
}
public void enemyBorning(EnemySpecyfication enemySpecyficationSpecyfication){this.pushedEnemySpecyfications.add(enemySpecyficationSpecyfication);}
public void heroShot(BulletSpecyfication bulletSpecyfication, List<Ability> abilities){
heroBullets.add(bulletSpecyfication);
for(Ability av: abilities)
{
if(av.getAbilitySpecyfication().getClass().equals(WaitAbilitySpecyfication.class))
{
WaitAbilitySpecyfication wa=(WaitAbilitySpecyfication)av.getAbilitySpecyfication();
if(heroBullets.hasEnought(wa.getWaitedBulletSpecyfication(),wa.getAmount()))
{
wa.activate();
av.checkActivation();
}
}
}
}
public void enemyShot(EnemyShot enemyShot)
{
enemyBullets.add(enemyShot);
}
public void abilityUse(AbilitySpecyfication abilitySpecyfication)
{
usedAbilities.add(abilitySpecyfication);
}
public void deathOfEnemy(EnemySpecyfication enemySpecyficationSpecyfication)
{
this.deathEnemySpecyficationList.add(enemySpecyficationSpecyfication);
}
public void enemyHited(Hitt hit)
{
this.enemyHits.add(hit);
}
public void takedDamage(MutablePair<Integer,BulletSpecyfication> hit)
{
// this.takenDamage.add(hit.getRight(),hit.getLeft());
this.hitsFromEnemyToHero.add(new HeroHited(System.currentTimeMillis(),hit.getLeft(),hit.getRight()));
}
public int getTakenDamage()
{
//return this.takenDamage.countAll();
int sum=0;
for(HeroHited h: this.hitsFromEnemyToHero)
{
sum+=h.damage;
}
return sum;
}
public int dealedDamage(){
int sum=0;
for(Hitt h: this.enemyHits){
sum+=h.damage;
}
return sum;
}
/**Do zaprogramowania*/
// lista zdobytych obietów i obiekt item
//lista herosupporters stworzyć herosupporter
public Bounty getBounty() {
return bounty;
}
public List<EnemySpecyfication> getKilledEnemys()
{
return this.deathEnemySpecyficationList;
}
public int getAbilityUseCounter(AbilitySpecyfication abilitySpecyfication)
{
return this.usedAbilities.getUseCounter(abilitySpecyfication);
}
public int getShootedByHero()
{
return this.heroBullets.countAll();
}
public int timeJumpHeal(long time)
{
int takenDamage=0;
long now=System.currentTimeMillis();
for(HeroHited h: this.hitsFromEnemyToHero)
{
if(now-time<h.time) {
takenDamage += h.damage;
}
}
return takenDamage;
}
public void registerItem(Currency currency) {
this.bounty.addItem(currency);
}
public String getResult() {
return result;
}
public void addMoney(int gold){
this.bounty.addMoney(gold);
}
public HeroSpecyfication getHeroSpecyfication() {
return heroSpecyfication;
}
@Override
public int acceptChecking(OveralStatisticChecker checker,int i) {
return checker.check(this,i);
}
}
| 5,808
| 0.679814
| 0.678608
| 190
| 29.557896
| 27.806934
| 150
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.442105
| false
| false
|
2
|
ecb1631c3b0e8b7f5f86929dfd92f458a4c5d760
| 36,902,359,008,717
|
1e662720ca7094952ed59c018d756404c2cf849f
|
/app/src/main/java/com/nsromapa/uchat/recyclerchatactivity/ChatsViewHolder.java
|
f00c3622212cc28d9a92f3f28876de0ed348b03a
|
[] |
no_license
|
saytoonz/UChat
|
https://github.com/saytoonz/UChat
|
f5c9b035479035c5f32ccd558bb8c13fc48a1737
|
b0ef98d4101ec9855ac91817a5c40431c6ce999b
|
refs/heads/master
| 2020-04-20T15:01:53.432000
| 2019-03-06T07:18:42
| 2019-03-06T07:18:42
| 168,917,019
| 3
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nsromapa.uchat.recyclerchatactivity;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.nsromapa.emoticompack.samsung.SamsungEmoticonProvider;
import com.nsromapa.say.emogifstickerkeyboard.widget.EmoticonTextView;
import com.nsromapa.uchat.R;
public class ChatsViewHolder extends RecyclerView.ViewHolder {
EmoticonTextView senderMessage, receiverMessage;
TextView senderMessageDateTime, receiverMessageDateTime;
LinearLayout receiver_message_ImageFull,sender_message_ImageFull;
ImageView senderMessageImage, receiverMessageImage;
ImageView receiver_message_VideoThumbnail_play,sender_message_VideoThumbnail_play;
ImageView sender_message_imageVideoUpload;
ProgressBar sender_imageVideo_progressBar;
ImageView senderStickerSoundGifImage, recieverStickerSoundGifImage;
ImageView senderSoundImage, recieverSoundImage;
LinearLayout receiver_contactFull, sender_contactFull;
TextView receiver_contactName, sender_contactName;
TextView receiver_contactNumber, sender_contactNumber;
ImageView receiver_contactIcon, sender_contactIcon;
LinearLayout receiver_document_attachmentFull, sender_document_attachmentFull;
EmoticonTextView receiver_document_attachmentName, sender_document_attachmentName;
LinearLayout receiver_message_audioFull,sender_message_audioFull;
TextView receiver_message_audioFileName,sender_message_audioFileName;
LinearLayout receiver_message_findMeFull, sender_message_findMeFull;
TextView receiver_message_findMeTextNotification, sender_message_findMeTextNotification;
Button receiver_message_findMeBtnNo,receiver_message_findMeBtnYes;
View senderMessage_state;
public ChatsViewHolder(@NonNull View itemView) {
super(itemView);
senderMessage = itemView.findViewById(R.id.sender_message_text);
receiverMessage = itemView.findViewById(R.id.receiver_message_text);
sender_message_ImageFull= itemView.findViewById(R.id.sender_message_ImageFull);
receiver_message_ImageFull= itemView.findViewById(R.id.receiver_message_ImageFull);
sender_message_VideoThumbnail_play = itemView.findViewById(R.id.sender_message_VideoThumbnail_play);
receiver_message_VideoThumbnail_play = itemView.findViewById(R.id.receiver_message_VideoThumbnail_play);
senderMessageImage = itemView.findViewById(R.id.sender_message_Image);
receiverMessageImage = itemView.findViewById(R.id.receiver_message_Image);
sender_message_imageVideoUpload = itemView.findViewById(R.id.sender_message_imageVideoUpload);
sender_imageVideo_progressBar = itemView.findViewById(R.id.sender_imageVideo_progressBar);
senderMessageDateTime = itemView.findViewById(R.id.senderMessage_dateTime);
receiverMessageDateTime = itemView.findViewById(R.id.receiverMessage_dateTime);
senderStickerSoundGifImage = itemView.findViewById(R.id.sender_sticker_gif_Image);
recieverStickerSoundGifImage = itemView.findViewById(R.id.receiver_sticker_gif_Image);
senderSoundImage = itemView.findViewById(R.id.sender_sound_Image);
recieverSoundImage = itemView.findViewById(R.id.receiver_sound_Image);
receiver_contactFull = itemView.findViewById(R.id.receiver_contactFull);
sender_contactFull = itemView.findViewById(R.id.sender_contactFull);
receiver_contactName = itemView.findViewById(R.id.receiver_contactName);
sender_contactName = itemView.findViewById(R.id.sender_contactName);
receiver_contactNumber = itemView.findViewById(R.id.receiver_contactNumber);
sender_contactNumber = itemView.findViewById(R.id.sender_contactNumber);
sender_contactIcon = itemView.findViewById(R.id.sender_contactIcon);
receiver_contactIcon = itemView.findViewById(R.id.receiver_contactIcon);
receiver_document_attachmentName = itemView.findViewById(R.id.receiver_document_attachmentName);
sender_document_attachmentName = itemView.findViewById(R.id.sender_document_attachmentName);
receiver_document_attachmentFull = itemView.findViewById(R.id.receiver_document_attachmentFull);
sender_document_attachmentFull = itemView.findViewById(R.id.sender_document_attachmentFull);
receiver_message_audioFull = itemView.findViewById(R.id.receiver_message_audioFull);
sender_message_audioFull = itemView.findViewById(R.id.sender_message_audioFull);
receiver_message_audioFileName = itemView.findViewById(R.id.receiver_message_audioFileName);
sender_message_audioFileName = itemView.findViewById(R.id.sender_message_audioFileName);
receiver_message_findMeFull = itemView.findViewById(R.id.receiver_message_findMeFull);
sender_message_findMeFull = itemView.findViewById(R.id.sender_message_findMeFull);
receiver_message_findMeTextNotification = itemView.findViewById(R.id.receiver_message_findMeTextNotification);
sender_message_findMeTextNotification = itemView.findViewById(R.id.sender_message_findMeTextNotification);
receiver_message_findMeBtnNo = itemView.findViewById(R.id.receiver_message_findMeBtnNo);
receiver_message_findMeBtnYes = itemView.findViewById(R.id.receiver_message_findMeBtnYes);
senderMessage_state = itemView.findViewById(R.id.senderMessage_state);
senderMessage.setEmoticonProvider(SamsungEmoticonProvider.create());
receiverMessage.setEmoticonProvider(SamsungEmoticonProvider.create());
}
}
|
UTF-8
|
Java
| 5,741
|
java
|
ChatsViewHolder.java
|
Java
|
[] | null |
[] |
package com.nsromapa.uchat.recyclerchatactivity;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.nsromapa.emoticompack.samsung.SamsungEmoticonProvider;
import com.nsromapa.say.emogifstickerkeyboard.widget.EmoticonTextView;
import com.nsromapa.uchat.R;
public class ChatsViewHolder extends RecyclerView.ViewHolder {
EmoticonTextView senderMessage, receiverMessage;
TextView senderMessageDateTime, receiverMessageDateTime;
LinearLayout receiver_message_ImageFull,sender_message_ImageFull;
ImageView senderMessageImage, receiverMessageImage;
ImageView receiver_message_VideoThumbnail_play,sender_message_VideoThumbnail_play;
ImageView sender_message_imageVideoUpload;
ProgressBar sender_imageVideo_progressBar;
ImageView senderStickerSoundGifImage, recieverStickerSoundGifImage;
ImageView senderSoundImage, recieverSoundImage;
LinearLayout receiver_contactFull, sender_contactFull;
TextView receiver_contactName, sender_contactName;
TextView receiver_contactNumber, sender_contactNumber;
ImageView receiver_contactIcon, sender_contactIcon;
LinearLayout receiver_document_attachmentFull, sender_document_attachmentFull;
EmoticonTextView receiver_document_attachmentName, sender_document_attachmentName;
LinearLayout receiver_message_audioFull,sender_message_audioFull;
TextView receiver_message_audioFileName,sender_message_audioFileName;
LinearLayout receiver_message_findMeFull, sender_message_findMeFull;
TextView receiver_message_findMeTextNotification, sender_message_findMeTextNotification;
Button receiver_message_findMeBtnNo,receiver_message_findMeBtnYes;
View senderMessage_state;
public ChatsViewHolder(@NonNull View itemView) {
super(itemView);
senderMessage = itemView.findViewById(R.id.sender_message_text);
receiverMessage = itemView.findViewById(R.id.receiver_message_text);
sender_message_ImageFull= itemView.findViewById(R.id.sender_message_ImageFull);
receiver_message_ImageFull= itemView.findViewById(R.id.receiver_message_ImageFull);
sender_message_VideoThumbnail_play = itemView.findViewById(R.id.sender_message_VideoThumbnail_play);
receiver_message_VideoThumbnail_play = itemView.findViewById(R.id.receiver_message_VideoThumbnail_play);
senderMessageImage = itemView.findViewById(R.id.sender_message_Image);
receiverMessageImage = itemView.findViewById(R.id.receiver_message_Image);
sender_message_imageVideoUpload = itemView.findViewById(R.id.sender_message_imageVideoUpload);
sender_imageVideo_progressBar = itemView.findViewById(R.id.sender_imageVideo_progressBar);
senderMessageDateTime = itemView.findViewById(R.id.senderMessage_dateTime);
receiverMessageDateTime = itemView.findViewById(R.id.receiverMessage_dateTime);
senderStickerSoundGifImage = itemView.findViewById(R.id.sender_sticker_gif_Image);
recieverStickerSoundGifImage = itemView.findViewById(R.id.receiver_sticker_gif_Image);
senderSoundImage = itemView.findViewById(R.id.sender_sound_Image);
recieverSoundImage = itemView.findViewById(R.id.receiver_sound_Image);
receiver_contactFull = itemView.findViewById(R.id.receiver_contactFull);
sender_contactFull = itemView.findViewById(R.id.sender_contactFull);
receiver_contactName = itemView.findViewById(R.id.receiver_contactName);
sender_contactName = itemView.findViewById(R.id.sender_contactName);
receiver_contactNumber = itemView.findViewById(R.id.receiver_contactNumber);
sender_contactNumber = itemView.findViewById(R.id.sender_contactNumber);
sender_contactIcon = itemView.findViewById(R.id.sender_contactIcon);
receiver_contactIcon = itemView.findViewById(R.id.receiver_contactIcon);
receiver_document_attachmentName = itemView.findViewById(R.id.receiver_document_attachmentName);
sender_document_attachmentName = itemView.findViewById(R.id.sender_document_attachmentName);
receiver_document_attachmentFull = itemView.findViewById(R.id.receiver_document_attachmentFull);
sender_document_attachmentFull = itemView.findViewById(R.id.sender_document_attachmentFull);
receiver_message_audioFull = itemView.findViewById(R.id.receiver_message_audioFull);
sender_message_audioFull = itemView.findViewById(R.id.sender_message_audioFull);
receiver_message_audioFileName = itemView.findViewById(R.id.receiver_message_audioFileName);
sender_message_audioFileName = itemView.findViewById(R.id.sender_message_audioFileName);
receiver_message_findMeFull = itemView.findViewById(R.id.receiver_message_findMeFull);
sender_message_findMeFull = itemView.findViewById(R.id.sender_message_findMeFull);
receiver_message_findMeTextNotification = itemView.findViewById(R.id.receiver_message_findMeTextNotification);
sender_message_findMeTextNotification = itemView.findViewById(R.id.sender_message_findMeTextNotification);
receiver_message_findMeBtnNo = itemView.findViewById(R.id.receiver_message_findMeBtnNo);
receiver_message_findMeBtnYes = itemView.findViewById(R.id.receiver_message_findMeBtnYes);
senderMessage_state = itemView.findViewById(R.id.senderMessage_state);
senderMessage.setEmoticonProvider(SamsungEmoticonProvider.create());
receiverMessage.setEmoticonProvider(SamsungEmoticonProvider.create());
}
}
| 5,741
| 0.786971
| 0.786797
| 108
| 52.157406
| 38.411552
| 118
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.861111
| false
| false
|
2
|
210b4dd8cb04a6373168d20266e6a215a7326eb8
| 33,517,924,836,570
|
0b5adf99e91e47cd1d429c2bfabac48cf0de6296
|
/app/src/main/java/trungduc/tripfun/Adapters/TripdetailsAdapter.java
|
779c39547f513cb026d24f3fd718f6e9725d0138
|
[] |
no_license
|
DucCoderIT/TRIPFUN
|
https://github.com/DucCoderIT/TRIPFUN
|
1bf66b2f87fcf757e978dd199385b605451ce1bf
|
224cba13ead55983a851da6a1e277fe1834e7841
|
refs/heads/master
| 2020-04-07T01:21:43.411000
| 2018-12-10T12:46:23
| 2018-12-10T12:46:23
| 157,939,284
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package trungduc.tripfun.Adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.ArrayList;
import trungduc.tripfun.R;
import trungduc.tripfun.Models.Tripdetails;
public class TripdetailsAdapter extends BaseAdapter {
Context context;
ArrayList<Tripdetails> listTripdetails;
public TripdetailsAdapter(Context context, ArrayList<Tripdetails> listTripdetails)
{
this.context = context;
this.listTripdetails = listTripdetails;
}
@Override
public int getCount() {
return listTripdetails.size();
}
@Override
public Object getItem(int i) {
return listTripdetails.get(i);
}
@Override
public long getItemId(int i) {
return 0;
}
public static class ViewHolder {
//CHANGE--------------------
TextView tvTripID,tvOri,tvDes,tvVehicle,tvSeatPrice,tvDriveGender,tvEvalua;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
LayoutInflater inflater = (LayoutInflater)
context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
ViewHolder viewHolder;
if (view == null) {
viewHolder = new ViewHolder();
view = inflater.inflate(R.layout.list_item, null);
/////CHANGE----------================================
viewHolder.tvTripID = (TextView) view.findViewById(R.id.tvTripID);
viewHolder.tvOri = (TextView) view.findViewById(R.id.tvOri);
viewHolder.tvDes = (TextView) view.findViewById(R.id.tvDes);
viewHolder.tvVehicle = (TextView) view.findViewById(R.id.tvVehicle);
viewHolder.tvSeatPrice = (TextView) view.findViewById(R.id.tvSeatPrice);
viewHolder.tvDriveGender = (TextView) view.findViewById(R.id.tvDriveGender);
viewHolder.tvEvalua = (TextView) view.findViewById(R.id.tvEvalua);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder)view.getTag();
}
///CHANGE =========================================
Tripdetails tripdetails = listTripdetails.get(i);
viewHolder.tvTripID.setText(tripdetails.getTripID()+"");
viewHolder.tvOri.setText(tripdetails.getOrigin());
viewHolder.tvDes.setText(tripdetails.getDestination());
viewHolder.tvVehicle.setText(tripdetails.getTypevehicle());
if(tripdetails.getSeatprice()<1000||tripdetails.getSeatprice()==0){
viewHolder.tvSeatPrice.setText("FREE");
}else{
viewHolder.tvSeatPrice.setText(tripdetails.getSeatprice()/1000+"K");
}
viewHolder.tvDriveGender.setText(tripdetails.getGender());
viewHolder.tvEvalua.setText(tripdetails.getEvaluation());
return view;
}
}
|
UTF-8
|
Java
| 2,990
|
java
|
TripdetailsAdapter.java
|
Java
|
[] | null |
[] |
package trungduc.tripfun.Adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.ArrayList;
import trungduc.tripfun.R;
import trungduc.tripfun.Models.Tripdetails;
public class TripdetailsAdapter extends BaseAdapter {
Context context;
ArrayList<Tripdetails> listTripdetails;
public TripdetailsAdapter(Context context, ArrayList<Tripdetails> listTripdetails)
{
this.context = context;
this.listTripdetails = listTripdetails;
}
@Override
public int getCount() {
return listTripdetails.size();
}
@Override
public Object getItem(int i) {
return listTripdetails.get(i);
}
@Override
public long getItemId(int i) {
return 0;
}
public static class ViewHolder {
//CHANGE--------------------
TextView tvTripID,tvOri,tvDes,tvVehicle,tvSeatPrice,tvDriveGender,tvEvalua;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
LayoutInflater inflater = (LayoutInflater)
context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
ViewHolder viewHolder;
if (view == null) {
viewHolder = new ViewHolder();
view = inflater.inflate(R.layout.list_item, null);
/////CHANGE----------================================
viewHolder.tvTripID = (TextView) view.findViewById(R.id.tvTripID);
viewHolder.tvOri = (TextView) view.findViewById(R.id.tvOri);
viewHolder.tvDes = (TextView) view.findViewById(R.id.tvDes);
viewHolder.tvVehicle = (TextView) view.findViewById(R.id.tvVehicle);
viewHolder.tvSeatPrice = (TextView) view.findViewById(R.id.tvSeatPrice);
viewHolder.tvDriveGender = (TextView) view.findViewById(R.id.tvDriveGender);
viewHolder.tvEvalua = (TextView) view.findViewById(R.id.tvEvalua);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder)view.getTag();
}
///CHANGE =========================================
Tripdetails tripdetails = listTripdetails.get(i);
viewHolder.tvTripID.setText(tripdetails.getTripID()+"");
viewHolder.tvOri.setText(tripdetails.getOrigin());
viewHolder.tvDes.setText(tripdetails.getDestination());
viewHolder.tvVehicle.setText(tripdetails.getTypevehicle());
if(tripdetails.getSeatprice()<1000||tripdetails.getSeatprice()==0){
viewHolder.tvSeatPrice.setText("FREE");
}else{
viewHolder.tvSeatPrice.setText(tripdetails.getSeatprice()/1000+"K");
}
viewHolder.tvDriveGender.setText(tripdetails.getGender());
viewHolder.tvEvalua.setText(tripdetails.getEvaluation());
return view;
}
}
| 2,990
| 0.649833
| 0.646154
| 80
| 36.362499
| 26.521334
| 88
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.6875
| false
| false
|
2
|
ab90be847486c628ff9671cf804b2b0bc9e501ad
| 33,930,241,662,342
|
8ee44058ea6a4edcf6ff03e2eb1a84a34238cbed
|
/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/GrantApiKeyRequest.java
|
4daf3c84df61cf4e768558b018c910c64b9ac924
|
[
"Elastic-2.0",
"LicenseRef-scancode-elastic-license-2018",
"Apache-2.0",
"LicenseRef-scancode-other-permissive"
] |
permissive
|
dadoonet/elasticsearch
|
https://github.com/dadoonet/elasticsearch
|
36f1df82e6390bf0007833ec9e79ef5481d18e69
|
e67eab6ae951c2aef9ea742e74d2058723be60f8
|
refs/heads/master
| 2021-12-25T20:08:05.810000
| 2020-04-10T12:51:40
| 2020-04-10T12:52:22
| 2,521,491
| 1
| 1
|
Apache-2.0
| true
| 2018-02-21T14:53:40
| 2011-10-05T19:24:28
| 2017-09-18T22:25:18
| 2018-02-20T21:03:10
| 326,853
| 3
| 1
| 0
|
Java
| false
| null |
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.security.action;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.settings.SecureString;
import java.io.IOException;
import java.util.Objects;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* Request class used for the creation of an API key on behalf of another user.
* Logically this is similar to {@link CreateApiKeyRequest}, but is for cases when the user that has permission to call this action
* is different to the user for whom the API key should be created
*/
public final class GrantApiKeyRequest extends ActionRequest {
public static final String PASSWORD_GRANT_TYPE = "password";
public static final String ACCESS_TOKEN_GRANT_TYPE = "access_token";
/**
* Fields related to the end user authentication
*/
public static class Grant implements Writeable {
private String type;
private String username;
private SecureString password;
private SecureString accessToken;
public Grant() {
}
public Grant(StreamInput in) throws IOException {
this.type = in.readString();
this.username = in.readOptionalString();
this.password = in.readOptionalSecureString();
this.accessToken = in.readOptionalSecureString();
}
public void writeTo(StreamOutput out) throws IOException {
out.writeString(type);
out.writeOptionalString(username);
out.writeOptionalSecureString(password);
out.writeOptionalSecureString(accessToken);
}
public String getType() {
return type;
}
public String getUsername() {
return username;
}
public SecureString getPassword() {
return password;
}
public SecureString getAccessToken() {
return accessToken;
}
public void setType(String type) {
this.type = type;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(SecureString password) {
this.password = password;
}
public void setAccessToken(SecureString accessToken) {
this.accessToken = accessToken;
}
}
private final Grant grant;
private CreateApiKeyRequest apiKey;
public GrantApiKeyRequest() {
this.grant = new Grant();
this.apiKey = new CreateApiKeyRequest();
}
public GrantApiKeyRequest(StreamInput in) throws IOException {
super(in);
this.grant = new Grant(in);
this.apiKey = new CreateApiKeyRequest(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
grant.writeTo(out);
apiKey.writeTo(out);
}
public WriteRequest.RefreshPolicy getRefreshPolicy() {
return apiKey.getRefreshPolicy();
}
public void setRefreshPolicy(WriteRequest.RefreshPolicy refreshPolicy) {
apiKey.setRefreshPolicy(refreshPolicy);
}
public Grant getGrant() {
return grant;
}
public CreateApiKeyRequest getApiKeyRequest() {
return apiKey;
}
public void setApiKeyRequest(CreateApiKeyRequest apiKeyRequest) {
this.apiKey = Objects.requireNonNull(apiKeyRequest, "Cannot set a null api_key");
}
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = apiKey.validate();
if (grant.type == null) {
validationException = addValidationError("[grant_type] is required", validationException);
} else if (grant.type.equals(PASSWORD_GRANT_TYPE)) {
validationException = validateRequiredField("username", grant.username, validationException);
validationException = validateRequiredField("password", grant.password, validationException);
validationException = validateUnsupportedField("access_token", grant.accessToken, validationException);
} else if (grant.type.equals(ACCESS_TOKEN_GRANT_TYPE)) {
validationException = validateRequiredField("access_token", grant.accessToken, validationException);
validationException = validateUnsupportedField("username", grant.username, validationException);
validationException = validateUnsupportedField("password", grant.password, validationException);
} else {
validationException = addValidationError("grant_type [" + grant.type + "] is not supported", validationException);
}
return validationException;
}
private ActionRequestValidationException validateRequiredField(String fieldName, CharSequence fieldValue,
ActionRequestValidationException validationException) {
if (fieldValue == null || fieldValue.length() == 0) {
return addValidationError("[" + fieldName + "] is required for grant_type [" + grant.type + "]", validationException);
}
return validationException;
}
private ActionRequestValidationException validateUnsupportedField(String fieldName, CharSequence fieldValue,
ActionRequestValidationException validationException) {
if (fieldValue != null && fieldValue.length() > 0) {
return addValidationError("[" + fieldName + "] is not supported for grant_type [" + grant.type + "]", validationException);
}
return validationException;
}
}
|
UTF-8
|
Java
| 6,230
|
java
|
GrantApiKeyRequest.java
|
Java
|
[
{
"context": " public String getUsername() {\n return username;\n }\n\n public SecureString getPasswo",
"end": 2295,
"score": 0.9641919732093811,
"start": 2287,
"tag": "USERNAME",
"value": "username"
},
{
"context": "ame(String username) {\n this.username = username;\n }\n\n public void setPassword(Secur",
"end": 2653,
"score": 0.920575737953186,
"start": 2645,
"tag": "USERNAME",
"value": "username"
},
{
"context": "cureString password) {\n this.password = password;\n }\n\n public void setAccessToken(Se",
"end": 2759,
"score": 0.856219470500946,
"start": 2751,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.security.action;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.settings.SecureString;
import java.io.IOException;
import java.util.Objects;
import static org.elasticsearch.action.ValidateActions.addValidationError;
/**
* Request class used for the creation of an API key on behalf of another user.
* Logically this is similar to {@link CreateApiKeyRequest}, but is for cases when the user that has permission to call this action
* is different to the user for whom the API key should be created
*/
public final class GrantApiKeyRequest extends ActionRequest {
public static final String PASSWORD_GRANT_TYPE = "password";
public static final String ACCESS_TOKEN_GRANT_TYPE = "access_token";
/**
* Fields related to the end user authentication
*/
public static class Grant implements Writeable {
private String type;
private String username;
private SecureString password;
private SecureString accessToken;
public Grant() {
}
public Grant(StreamInput in) throws IOException {
this.type = in.readString();
this.username = in.readOptionalString();
this.password = in.readOptionalSecureString();
this.accessToken = in.readOptionalSecureString();
}
public void writeTo(StreamOutput out) throws IOException {
out.writeString(type);
out.writeOptionalString(username);
out.writeOptionalSecureString(password);
out.writeOptionalSecureString(accessToken);
}
public String getType() {
return type;
}
public String getUsername() {
return username;
}
public SecureString getPassword() {
return password;
}
public SecureString getAccessToken() {
return accessToken;
}
public void setType(String type) {
this.type = type;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(SecureString password) {
this.password = <PASSWORD>;
}
public void setAccessToken(SecureString accessToken) {
this.accessToken = accessToken;
}
}
private final Grant grant;
private CreateApiKeyRequest apiKey;
public GrantApiKeyRequest() {
this.grant = new Grant();
this.apiKey = new CreateApiKeyRequest();
}
public GrantApiKeyRequest(StreamInput in) throws IOException {
super(in);
this.grant = new Grant(in);
this.apiKey = new CreateApiKeyRequest(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
grant.writeTo(out);
apiKey.writeTo(out);
}
public WriteRequest.RefreshPolicy getRefreshPolicy() {
return apiKey.getRefreshPolicy();
}
public void setRefreshPolicy(WriteRequest.RefreshPolicy refreshPolicy) {
apiKey.setRefreshPolicy(refreshPolicy);
}
public Grant getGrant() {
return grant;
}
public CreateApiKeyRequest getApiKeyRequest() {
return apiKey;
}
public void setApiKeyRequest(CreateApiKeyRequest apiKeyRequest) {
this.apiKey = Objects.requireNonNull(apiKeyRequest, "Cannot set a null api_key");
}
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = apiKey.validate();
if (grant.type == null) {
validationException = addValidationError("[grant_type] is required", validationException);
} else if (grant.type.equals(PASSWORD_GRANT_TYPE)) {
validationException = validateRequiredField("username", grant.username, validationException);
validationException = validateRequiredField("password", grant.password, validationException);
validationException = validateUnsupportedField("access_token", grant.accessToken, validationException);
} else if (grant.type.equals(ACCESS_TOKEN_GRANT_TYPE)) {
validationException = validateRequiredField("access_token", grant.accessToken, validationException);
validationException = validateUnsupportedField("username", grant.username, validationException);
validationException = validateUnsupportedField("password", grant.password, validationException);
} else {
validationException = addValidationError("grant_type [" + grant.type + "] is not supported", validationException);
}
return validationException;
}
private ActionRequestValidationException validateRequiredField(String fieldName, CharSequence fieldValue,
ActionRequestValidationException validationException) {
if (fieldValue == null || fieldValue.length() == 0) {
return addValidationError("[" + fieldName + "] is required for grant_type [" + grant.type + "]", validationException);
}
return validationException;
}
private ActionRequestValidationException validateUnsupportedField(String fieldName, CharSequence fieldValue,
ActionRequestValidationException validationException) {
if (fieldValue != null && fieldValue.length() > 0) {
return addValidationError("[" + fieldName + "] is not supported for grant_type [" + grant.type + "]", validationException);
}
return validationException;
}
}
| 6,232
| 0.670947
| 0.670626
| 166
| 36.530121
| 34.991165
| 135
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.524096
| false
| false
|
2
|
56e84a6fa3a2706da075fbd3c604607f57a65bb6
| 8,340,826,552,331
|
6c24d430f0b138800302de8931119d303f008f2a
|
/320-Generalized-Abbreviation/solution.java
|
581a5a4066bb82c282c0d743bcc24ee102a0c076
|
[] |
no_license
|
Charliebob/LeetCode
|
https://github.com/Charliebob/LeetCode
|
740981c80769924bb5d9b150346971b2c8d05347
|
a230b1ba0fe4ae289ef67c91f4c8c9e649c8cb8a
|
refs/heads/master
| 2020-12-07T15:32:05.206000
| 2016-10-12T22:04:53
| 2016-10-12T22:04:53
| 58,330,106
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Solution {
public List<String> generateAbbreviations(String word) {
List<String> result = new ArrayList<String>();
backtrack(result, word, 0, "", 0);
return result;
}
private void backtrack(List<String> result, String word, int pos, String cur, int count){
if(pos==word.length()){
if(count>0) cur+=count;
result.add(cur);
}else{
backtrack(result, word, pos+1, cur, count+1);
backtrack(result, word, pos+1, cur+(count>0?count:"")+word.charAt(pos),0);
}
}
}
|
UTF-8
|
Java
| 590
|
java
|
solution.java
|
Java
|
[] | null |
[] |
public class Solution {
public List<String> generateAbbreviations(String word) {
List<String> result = new ArrayList<String>();
backtrack(result, word, 0, "", 0);
return result;
}
private void backtrack(List<String> result, String word, int pos, String cur, int count){
if(pos==word.length()){
if(count>0) cur+=count;
result.add(cur);
}else{
backtrack(result, word, pos+1, cur, count+1);
backtrack(result, word, pos+1, cur+(count>0?count:"")+word.charAt(pos),0);
}
}
}
| 590
| 0.562712
| 0.549153
| 17
| 33.705883
| 27.262913
| 93
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.352941
| false
| false
|
2
|
89e28595cd661c1f585b9b671d6a0fafd9ec4696
| 25,632,364,835,787
|
927568a3afc68ef038f0d4cd9402ce0004d6227d
|
/Lesson04/edu/uwex/apc390/lesson4_3/Rectangle.java
|
06b97702bb988978cdbd70f92963f994a2ba6cb1
|
[] |
no_license
|
tonyva/apc390
|
https://github.com/tonyva/apc390
|
1686a4700c89b5e729fee5b87e0c5dba5b2de7c2
|
9665d67ba23b033ef1bbcad7df141b7da0132974
|
refs/heads/master
| 2020-03-31T23:47:05.787000
| 2018-10-12T00:09:09
| 2018-10-12T00:09:09
| 152,669,534
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.uwex.apc390.lesson4_3;
public class Rectangle extends Shape {
private float length, width;
public Rectangle(float l, float w) { length = l; width = w; }
public float area() { return length * width; }
public String toString() { return "Rectangle with sides " + length + ", " + width; }
}
|
UTF-8
|
Java
| 304
|
java
|
Rectangle.java
|
Java
|
[] | null |
[] |
package edu.uwex.apc390.lesson4_3;
public class Rectangle extends Shape {
private float length, width;
public Rectangle(float l, float w) { length = l; width = w; }
public float area() { return length * width; }
public String toString() { return "Rectangle with sides " + length + ", " + width; }
}
| 304
| 0.690789
| 0.674342
| 8
| 37
| 26.851442
| 85
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.625
| false
| false
|
2
|
4184a008fbbf64fb384936f7c07bafac954ec271
| 31,250,182,075,308
|
44d916036b85a9bb242c64ca11dee16e1c5d4c4d
|
/src/iannotate/gui/SignUp.java
|
ddfd84ee8dc54dd99dbfc42ad1ba7945bdcc6c65
|
[] |
no_license
|
sameerror/IAnnotate
|
https://github.com/sameerror/IAnnotate
|
9cd869ea3ba836eec6f043a5b8f415056db19fba
|
10219067ba5610b2e5b5a3b4f3649dabdcb26fc8
|
refs/heads/master
| 2020-12-30T17:44:58.862000
| 2012-07-09T07:20:53
| 2012-07-09T07:20:53
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package iannotate.gui;
import iannotate.database.DbInterface;
import iannotate.database.SqlQuery;
/**
*
* @author Sameer
*/
public class SignUp extends javax.swing.JFrame {
static public SignUp sign = new SignUp();
/**
* Creates new form SignUp
*/
public SignUp() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
buttonGroup3 = new javax.swing.ButtonGroup();
buttonGroup4 = new javax.swing.ButtonGroup();
jLayeredPane1 = new javax.swing.JLayeredPane();
userNameLabel = new javax.swing.JLabel();
passWordLabel = new javax.swing.JLabel();
rePassLabel = new javax.swing.JLabel();
dobLabel = new javax.swing.JLabel();
contactLabel = new javax.swing.JLabel();
addressLabel = new javax.swing.JLabel();
userName = new javax.swing.JTextField();
passWord = new javax.swing.JPasswordField();
rePass = new javax.swing.JPasswordField();
dob = new javax.swing.JTextField();
contact = new javax.swing.JTextField();
address = new javax.swing.JTextField();
MaleRadioButton = new javax.swing.JRadioButton();
FemaleRadioButton = new javax.swing.JRadioButton();
sexLabel = new javax.swing.JLabel();
save = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
userNameLabel.setText("username :");
userNameLabel.setBounds(0, 40, 100, 30);
jLayeredPane1.add(userNameLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
passWordLabel.setText("password :");
passWordLabel.setBounds(0, 80, 100, 30);
jLayeredPane1.add(passWordLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
rePassLabel.setText("re-enter password :");
rePassLabel.setBounds(0, 120, 150, 30);
jLayeredPane1.add(rePassLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
dobLabel.setText("date of birth :");
dobLabel.setBounds(0, 160, 100, 30);
jLayeredPane1.add(dobLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
contactLabel.setText("contact :");
contactLabel.setBounds(0, 200, 100, 30);
jLayeredPane1.add(contactLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
addressLabel.setText("address :");
addressLabel.setBounds(0, 240, 100, 30);
jLayeredPane1.add(addressLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
userName.setBounds(130, 40, 140, 30);
jLayeredPane1.add(userName, javax.swing.JLayeredPane.DEFAULT_LAYER);
userName.getAccessibleContext().setAccessibleName("");
passWord.setBounds(130, 80, 140, 30);
jLayeredPane1.add(passWord, javax.swing.JLayeredPane.DEFAULT_LAYER);
rePass.setBounds(130, 120, 140, 30);
jLayeredPane1.add(rePass, javax.swing.JLayeredPane.DEFAULT_LAYER);
dob.setBounds(130, 160, 140, 30);
jLayeredPane1.add(dob, javax.swing.JLayeredPane.DEFAULT_LAYER);
contact.setBounds(130, 200, 140, 30);
jLayeredPane1.add(contact, javax.swing.JLayeredPane.DEFAULT_LAYER);
address.setBounds(130, 240, 140, 30);
jLayeredPane1.add(address, javax.swing.JLayeredPane.DEFAULT_LAYER);
buttonGroup1.add(MaleRadioButton);
MaleRadioButton.setText("Male");
MaleRadioButton.setBounds(100, 280, 80, 30);
jLayeredPane1.add(MaleRadioButton, javax.swing.JLayeredPane.DEFAULT_LAYER);
buttonGroup1.add(FemaleRadioButton);
FemaleRadioButton.setText("Female");
FemaleRadioButton.setBounds(190, 280, 70, 30);
jLayeredPane1.add(FemaleRadioButton, javax.swing.JLayeredPane.DEFAULT_LAYER);
sexLabel.setText("sex:");
sexLabel.setBounds(0, 280, 100, 30);
jLayeredPane1.add(sexLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
save.setText("Save");
save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(save)
.addGap(0, 313, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 365, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(65, Short.MAX_VALUE)
.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(save)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
// TODO add your handling code here:
DbInterface[] db = new DbInterface[1];
db[0] = new SqlQuery("major_project");
}//GEN-LAST:event_saveActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SignUp().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JRadioButton FemaleRadioButton;
private javax.swing.JRadioButton MaleRadioButton;
private javax.swing.JTextField address;
private javax.swing.JLabel addressLabel;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.ButtonGroup buttonGroup4;
private javax.swing.JTextField contact;
private javax.swing.JLabel contactLabel;
private javax.swing.JTextField dob;
private javax.swing.JLabel dobLabel;
private javax.swing.JLayeredPane jLayeredPane1;
private javax.swing.JPasswordField passWord;
private javax.swing.JLabel passWordLabel;
private javax.swing.JPasswordField rePass;
private javax.swing.JLabel rePassLabel;
private javax.swing.JButton save;
private javax.swing.JLabel sexLabel;
private javax.swing.JTextField userName;
private javax.swing.JLabel userNameLabel;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 9,400
|
java
|
SignUp.java
|
Java
|
[
{
"context": "rt iannotate.database.SqlQuery;\n\n/**\n *\n * @author Sameer\n */\npublic class SignUp extends javax.swing.JFram",
"end": 224,
"score": 0.9996692538261414,
"start": 218,
"tag": "NAME",
"value": "Sameer"
},
{
"context": "w javax.swing.JTextField();\n passWord = new javax.swing.JPasswordField();\n rePass = new javax.swing.JPasswor",
"end": 1463,
"score": 0.7948206067085266,
"start": 1442,
"tag": "PASSWORD",
"value": "javax.swing.JPassword"
},
{
"context": "javax.swing.JPasswordField();\n rePass = new javax.swing.JPasswordField();\n dob = new javax.swing.J",
"end": 1504,
"score": 0.6584679484367371,
"start": 1493,
"tag": "PASSWORD",
"value": "javax.swing"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package iannotate.gui;
import iannotate.database.DbInterface;
import iannotate.database.SqlQuery;
/**
*
* @author Sameer
*/
public class SignUp extends javax.swing.JFrame {
static public SignUp sign = new SignUp();
/**
* Creates new form SignUp
*/
public SignUp() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
buttonGroup3 = new javax.swing.ButtonGroup();
buttonGroup4 = new javax.swing.ButtonGroup();
jLayeredPane1 = new javax.swing.JLayeredPane();
userNameLabel = new javax.swing.JLabel();
passWordLabel = new javax.swing.JLabel();
rePassLabel = new javax.swing.JLabel();
dobLabel = new javax.swing.JLabel();
contactLabel = new javax.swing.JLabel();
addressLabel = new javax.swing.JLabel();
userName = new javax.swing.JTextField();
passWord = new <PASSWORD>Field();
rePass = new <PASSWORD>.JPasswordField();
dob = new javax.swing.JTextField();
contact = new javax.swing.JTextField();
address = new javax.swing.JTextField();
MaleRadioButton = new javax.swing.JRadioButton();
FemaleRadioButton = new javax.swing.JRadioButton();
sexLabel = new javax.swing.JLabel();
save = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
userNameLabel.setText("username :");
userNameLabel.setBounds(0, 40, 100, 30);
jLayeredPane1.add(userNameLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
passWordLabel.setText("password :");
passWordLabel.setBounds(0, 80, 100, 30);
jLayeredPane1.add(passWordLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
rePassLabel.setText("re-enter password :");
rePassLabel.setBounds(0, 120, 150, 30);
jLayeredPane1.add(rePassLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
dobLabel.setText("date of birth :");
dobLabel.setBounds(0, 160, 100, 30);
jLayeredPane1.add(dobLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
contactLabel.setText("contact :");
contactLabel.setBounds(0, 200, 100, 30);
jLayeredPane1.add(contactLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
addressLabel.setText("address :");
addressLabel.setBounds(0, 240, 100, 30);
jLayeredPane1.add(addressLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
userName.setBounds(130, 40, 140, 30);
jLayeredPane1.add(userName, javax.swing.JLayeredPane.DEFAULT_LAYER);
userName.getAccessibleContext().setAccessibleName("");
passWord.setBounds(130, 80, 140, 30);
jLayeredPane1.add(passWord, javax.swing.JLayeredPane.DEFAULT_LAYER);
rePass.setBounds(130, 120, 140, 30);
jLayeredPane1.add(rePass, javax.swing.JLayeredPane.DEFAULT_LAYER);
dob.setBounds(130, 160, 140, 30);
jLayeredPane1.add(dob, javax.swing.JLayeredPane.DEFAULT_LAYER);
contact.setBounds(130, 200, 140, 30);
jLayeredPane1.add(contact, javax.swing.JLayeredPane.DEFAULT_LAYER);
address.setBounds(130, 240, 140, 30);
jLayeredPane1.add(address, javax.swing.JLayeredPane.DEFAULT_LAYER);
buttonGroup1.add(MaleRadioButton);
MaleRadioButton.setText("Male");
MaleRadioButton.setBounds(100, 280, 80, 30);
jLayeredPane1.add(MaleRadioButton, javax.swing.JLayeredPane.DEFAULT_LAYER);
buttonGroup1.add(FemaleRadioButton);
FemaleRadioButton.setText("Female");
FemaleRadioButton.setBounds(190, 280, 70, 30);
jLayeredPane1.add(FemaleRadioButton, javax.swing.JLayeredPane.DEFAULT_LAYER);
sexLabel.setText("sex:");
sexLabel.setBounds(0, 280, 100, 30);
jLayeredPane1.add(sexLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
save.setText("Save");
save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(save)
.addGap(0, 313, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 365, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(65, Short.MAX_VALUE)
.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(save)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
// TODO add your handling code here:
DbInterface[] db = new DbInterface[1];
db[0] = new SqlQuery("major_project");
}//GEN-LAST:event_saveActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(SignUp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SignUp().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JRadioButton FemaleRadioButton;
private javax.swing.JRadioButton MaleRadioButton;
private javax.swing.JTextField address;
private javax.swing.JLabel addressLabel;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.ButtonGroup buttonGroup4;
private javax.swing.JTextField contact;
private javax.swing.JLabel contactLabel;
private javax.swing.JTextField dob;
private javax.swing.JLabel dobLabel;
private javax.swing.JLayeredPane jLayeredPane1;
private javax.swing.JPasswordField passWord;
private javax.swing.JLabel passWordLabel;
private javax.swing.JPasswordField rePass;
private javax.swing.JLabel rePassLabel;
private javax.swing.JButton save;
private javax.swing.JLabel sexLabel;
private javax.swing.JTextField userName;
private javax.swing.JLabel userNameLabel;
// End of variables declaration//GEN-END:variables
}
| 9,388
| 0.655851
| 0.634468
| 217
| 42.317974
| 29.542055
| 139
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.898618
| false
| false
|
2
|
e69973670c1d7acb8de0216cb111ca33df4afced
| 31,250,182,078,355
|
52c304559dfe59f506061f0509d67a0485735915
|
/src/main/java/top/codermartin/webexplorer/Dao/VideoDao.java
|
5e214c46ccaa880109243c091dab7f0bdbe7414c
|
[
"Apache-2.0"
] |
permissive
|
codermartin/webexplorer
|
https://github.com/codermartin/webexplorer
|
288190c0f037506b74c60cbba716825cda36ef84
|
944e7f9474759fae37a98d4a38c34b1f387c485c
|
refs/heads/master
| 2020-03-16T00:14:10.254000
| 2018-05-07T05:30:41
| 2018-05-07T05:30:41
| 132,411,149
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package top.codermartin.webexplorer.Dao;
public class VideoDao extends FileDao {
public VideoDao(String name, String path, String format) {
super(name, path);
this.format = format;
}
private String format = "mp4";
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
}
|
UTF-8
|
Java
| 340
|
java
|
VideoDao.java
|
Java
|
[] | null |
[] |
package top.codermartin.webexplorer.Dao;
public class VideoDao extends FileDao {
public VideoDao(String name, String path, String format) {
super(name, path);
this.format = format;
}
private String format = "mp4";
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
}
| 340
| 0.720588
| 0.717647
| 15
| 21.666666
| 17.422846
| 59
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.6
| false
| false
|
2
|
d9925141811abd0da570b9518afb4fbbd9a2c397
| 19,731,079,805,816
|
5f14068bc906c90d1a8fcd006e830a325218658b
|
/TestHibernate/src/com/test/TestHQL.java
|
be50aaf4ba5ff5b69e5acd3b73f325abcd828a2a
|
[] |
no_license
|
ltw546166132/SQLExample
|
https://github.com/ltw546166132/SQLExample
|
d5f05bce07820e3261af2a17e387b509ee972f41
|
902b559af384bd28c99f07a514d144a557702c5a
|
refs/heads/master
| 2020-03-22T08:03:32.339000
| 2018-09-12T14:03:51
| 2018-09-12T14:03:51
| 139,741,734
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test;
import java.util.Arrays;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import org.junit.Test;
import com.Utils.HibernateUtil;
import com.javabean.Customer;
import com.javabean.LinkMan;
public class TestHQL {
// @Test
// public void buildcustomer() {
// Session session = HibernateUtil.getCurrentSession();
// Transaction transaction = session.beginTransaction();
// Customer customer = new Customer();
// customer.setC_name("王五");
// for(int i=1;i<=10;i++) {
// LinkMan linkMan = new LinkMan();
// linkMan.setL_name("LinkMan3"+i);
// linkMan.setCustomer(customer);
// session.save(linkMan);
// }
// transaction.commit();
// }
@Test
public void testHQL() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
// List<Customer> list = session.createQuery("from Customer").list();
// for (Customer customer : list) {
// System.out.println(customer.toString());
// }
//按名称绑定参数
Query query = session.createQuery("from Customer where c_source = :来源 and c_name like :名称");
query.setParameter("来源", "朋友");
query.setParameter("名称", "李%");
List<Customer> list2 = query.list();
for (Customer cus : list2) {
System.out.println(cus);
}
transaction.commit();
}
@Test
/**
* 投影查询
*/
public void demotouy() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
// Query query = session.createQuery("select c.c_name from Customer c");
// List<Object> list = query.list();
// for (Object obj : list) {
// System.out.println(obj.toString());
// }
//
// Query query1 = session.createQuery("select c.c_name, c.c_level from Customer c");
// List<Object[]> list2 = query1.list();
// for (Object[] objects : list2) {
// System.out.println(objects[0]);
// System.out.println(objects[1]);
// }
List<Customer> list3 = session.createQuery("select new Customer(c_name,c_level) from Customer").list();
for (Customer customer : list3) {
System.out.println(customer.toString());
}
transaction.commit();
}
@Test
/**
* 分页查询
*/
public void hqlfenye() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("from LinkMan");
query.setFirstResult(10);
query.setMaxResults(10);
List<LinkMan> list = query.list();
for (LinkMan linkMan : list) {
System.out.println(linkMan.toString());
}
transaction.commit();
}
@Test
/**
* 分组查询
*/
public void hqlfenzhu() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
List<Object[]> list = session.createQuery("select c_name,count(*) from Customer group by c_name having count(*)>=2").list();
for (Object[] object : list) {
System.out.println(Arrays.toString(object));
}
transaction.commit();
}
@Test
/**
* HQL多表查询
*/
public void testduobiao() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
//SQL: select * from c_customer c inner join linkman l on c.c_id=l.l_cust_id
//HQL内连接: from Customer c inner join c.linkmans
//HQL迫切内连接 : from Customer c inner join fetch c.linkmans
Query query = session.createQuery("from Customer c inner join c.linkmans");
List<Object[]> list = query.list();
for (Object[] objects : list) {
System.out.println(objects.length);
System.out.println(Arrays.toString(objects));
}
transaction.commit();
}
@Test
/**
* HQL迫切内连
*/
public void testpoqie() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("select distinct c from Customer c inner join fetch c.linkmans");
List<Customer> list = query.list();
for (Customer customer : list) {
System.out.println(customer.toString());
}
transaction.commit();
}
}
|
UTF-8
|
Java
| 4,148
|
java
|
TestHQL.java
|
Java
|
[
{
"context": "ustomer = new Customer();\n//\t\tcustomer.setC_name(\"王五\");\n//\t\tfor(int i=1;i<=10;i++) {\n//\t\t\tLinkMan link",
"end": 526,
"score": 0.9990979433059692,
"start": 524,
"tag": "NAME",
"value": "王五"
}
] | null |
[] |
package com.test;
import java.util.Arrays;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import org.junit.Test;
import com.Utils.HibernateUtil;
import com.javabean.Customer;
import com.javabean.LinkMan;
public class TestHQL {
// @Test
// public void buildcustomer() {
// Session session = HibernateUtil.getCurrentSession();
// Transaction transaction = session.beginTransaction();
// Customer customer = new Customer();
// customer.setC_name("王五");
// for(int i=1;i<=10;i++) {
// LinkMan linkMan = new LinkMan();
// linkMan.setL_name("LinkMan3"+i);
// linkMan.setCustomer(customer);
// session.save(linkMan);
// }
// transaction.commit();
// }
@Test
public void testHQL() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
// List<Customer> list = session.createQuery("from Customer").list();
// for (Customer customer : list) {
// System.out.println(customer.toString());
// }
//按名称绑定参数
Query query = session.createQuery("from Customer where c_source = :来源 and c_name like :名称");
query.setParameter("来源", "朋友");
query.setParameter("名称", "李%");
List<Customer> list2 = query.list();
for (Customer cus : list2) {
System.out.println(cus);
}
transaction.commit();
}
@Test
/**
* 投影查询
*/
public void demotouy() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
// Query query = session.createQuery("select c.c_name from Customer c");
// List<Object> list = query.list();
// for (Object obj : list) {
// System.out.println(obj.toString());
// }
//
// Query query1 = session.createQuery("select c.c_name, c.c_level from Customer c");
// List<Object[]> list2 = query1.list();
// for (Object[] objects : list2) {
// System.out.println(objects[0]);
// System.out.println(objects[1]);
// }
List<Customer> list3 = session.createQuery("select new Customer(c_name,c_level) from Customer").list();
for (Customer customer : list3) {
System.out.println(customer.toString());
}
transaction.commit();
}
@Test
/**
* 分页查询
*/
public void hqlfenye() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("from LinkMan");
query.setFirstResult(10);
query.setMaxResults(10);
List<LinkMan> list = query.list();
for (LinkMan linkMan : list) {
System.out.println(linkMan.toString());
}
transaction.commit();
}
@Test
/**
* 分组查询
*/
public void hqlfenzhu() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
List<Object[]> list = session.createQuery("select c_name,count(*) from Customer group by c_name having count(*)>=2").list();
for (Object[] object : list) {
System.out.println(Arrays.toString(object));
}
transaction.commit();
}
@Test
/**
* HQL多表查询
*/
public void testduobiao() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
//SQL: select * from c_customer c inner join linkman l on c.c_id=l.l_cust_id
//HQL内连接: from Customer c inner join c.linkmans
//HQL迫切内连接 : from Customer c inner join fetch c.linkmans
Query query = session.createQuery("from Customer c inner join c.linkmans");
List<Object[]> list = query.list();
for (Object[] objects : list) {
System.out.println(objects.length);
System.out.println(Arrays.toString(objects));
}
transaction.commit();
}
@Test
/**
* HQL迫切内连
*/
public void testpoqie() {
Session session = HibernateUtil.getCurrentSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("select distinct c from Customer c inner join fetch c.linkmans");
List<Customer> list = query.list();
for (Customer customer : list) {
System.out.println(customer.toString());
}
transaction.commit();
}
}
| 4,148
| 0.686328
| 0.681639
| 141
| 27.737589
| 24.376959
| 126
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.170213
| false
| false
|
2
|
f1f7227fbe50d32ab55e0bc5339cc68c96717c4c
| 31,052,613,578,051
|
41daa830573d7825f2631e535a00f03469f5ffa9
|
/src/main/java/com/hsjry/plutus/sdk/jms/BaseProducer.java
|
d6211aa09d3b56b7e694b3b02d85d0e02f2e8eb4
|
[] |
no_license
|
quyanfeng/rocketmq-sdk
|
https://github.com/quyanfeng/rocketmq-sdk
|
09cdbafcc165e0d4eba5c473cd77da3b7b8ff143
|
fde2daa02ee3855dc4ce88ee9d13dd1cb0f31ac3
|
refs/heads/master
| 2022-05-01T00:09:24.262000
| 2019-10-21T03:26:06
| 2019-10-21T03:26:06
| 216,469,632
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hsjry.plutus.sdk.jms;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.OnExceptionContext;
import com.aliyun.openservices.ons.api.SendCallback;
import com.aliyun.openservices.ons.api.SendResult;
import com.aliyun.openservices.ons.api.bean.ProducerBean;
import com.aliyun.openservices.ons.api.exception.ONSClientException;
import com.hsjry.plutus.sdk.utils.UUIDUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* producer基础类
* @Author qyf
* @Date 2019/7/17 17:41
**/
public class BaseProducer extends ProducerBean {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private String topic;
public BaseProducer(String risktopic) {
this.topic = risktopic;
}
public void sendMsg(String content, String tag, String keyId, int delayTime) {
Message msg = new Message(topic, tag, content.getBytes());
if (keyId != null) {
msg.setKey(keyId);
}
try {
//定时
if (delayTime != 0) {
msg.setStartDeliverTime(System.currentTimeMillis() + (60 * 1000 * delayTime));
}
SendResult sendResult = this.send(msg);
assert sendResult != null;
logger.debug("消息发送成功:keyId:{}, tag:{}, msgId:{} ", keyId, tag, sendResult.getMessageId());
} catch (ONSClientException e) {
logger.error("消息发送失败,e:{}", e);
}
}
public void sendMsg(String content, String tag, int delayTime) {
this.sendMsg(content,tag, UUIDUtil.getUUID(), delayTime);
}
/**
* 异步发送消息
* 可靠异步发送:发送方发出数据后,不等接收方发回响应,接着发送下个数据包的通讯方式;
* 特点:速度快;有结果反馈;数据可靠;
* 应用场景:异步发送一般用于链路耗时较长,对 rt响应时间较为敏感的业务场景,例如用户视频上传后通知启动转码服务,转码完成后通知推送转码结果等;
* @param content
* @return
*/
public boolean sendMsgAsy(String content, String tag, int delayTime) {
Long startTime = System.currentTimeMillis();
Message message = new Message(topic, tag, content.getBytes());
//定时
if (delayTime != 0) {
message.setStartDeliverTime(System.currentTimeMillis() + (60 * 1000 * delayTime));
}
this.sendAsync(message, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
///消息发送成功
System.out.println("send message success. topic=" + sendResult.getMessageId());
}
@Override
public void onException(OnExceptionContext context) {
//消息发送失败
System.out.println("send message failed. execption=" + context.getException());
}
});
Long endTime = System.currentTimeMillis();
System.out.println("单次生产耗时:"+(endTime-startTime)/1000);
return true;
}
/**
* 单向发送
* 单向发送:只负责发送消息,不等待服务器回应且没有回调函数触发,即只发送请求不等待应答;此方式发送消息的过程耗时非常短,一般在微秒级别;
* 特点:速度最快,耗时非常短,毫秒级别;无结果反馈;数据不可靠,可能会丢失;
* 应用场景:适用于某些耗时非常短,但对可靠性要求并不高的场景,例如日志收集;
* @return
*/
public boolean sendMsgOneway(String content, String tag, int delayTime) {
Long startTime = System.currentTimeMillis();
Message message = new Message(topic, tag, content.getBytes());
//定时
if (delayTime != 0) {
message.setStartDeliverTime(System.currentTimeMillis() + (60 * 1000 * delayTime));
}
this.sendOneway(message);
Long endTime = System.currentTimeMillis();
System.out.println("单次生产耗时:"+(endTime-startTime)/1000);
return true;
}
}
|
UTF-8
|
Java
| 4,204
|
java
|
BaseProducer.java
|
Java
|
[
{
"context": "lf4j.LoggerFactory;\n\n/**\n * producer基础类\n * @Author qyf \n * @Date 2019/7/17 17:41\n **/\npublic class BaseP",
"end": 508,
"score": 0.9997023344039917,
"start": 505,
"tag": "USERNAME",
"value": "qyf"
}
] | null |
[] |
package com.hsjry.plutus.sdk.jms;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.OnExceptionContext;
import com.aliyun.openservices.ons.api.SendCallback;
import com.aliyun.openservices.ons.api.SendResult;
import com.aliyun.openservices.ons.api.bean.ProducerBean;
import com.aliyun.openservices.ons.api.exception.ONSClientException;
import com.hsjry.plutus.sdk.utils.UUIDUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* producer基础类
* @Author qyf
* @Date 2019/7/17 17:41
**/
public class BaseProducer extends ProducerBean {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private String topic;
public BaseProducer(String risktopic) {
this.topic = risktopic;
}
public void sendMsg(String content, String tag, String keyId, int delayTime) {
Message msg = new Message(topic, tag, content.getBytes());
if (keyId != null) {
msg.setKey(keyId);
}
try {
//定时
if (delayTime != 0) {
msg.setStartDeliverTime(System.currentTimeMillis() + (60 * 1000 * delayTime));
}
SendResult sendResult = this.send(msg);
assert sendResult != null;
logger.debug("消息发送成功:keyId:{}, tag:{}, msgId:{} ", keyId, tag, sendResult.getMessageId());
} catch (ONSClientException e) {
logger.error("消息发送失败,e:{}", e);
}
}
public void sendMsg(String content, String tag, int delayTime) {
this.sendMsg(content,tag, UUIDUtil.getUUID(), delayTime);
}
/**
* 异步发送消息
* 可靠异步发送:发送方发出数据后,不等接收方发回响应,接着发送下个数据包的通讯方式;
* 特点:速度快;有结果反馈;数据可靠;
* 应用场景:异步发送一般用于链路耗时较长,对 rt响应时间较为敏感的业务场景,例如用户视频上传后通知启动转码服务,转码完成后通知推送转码结果等;
* @param content
* @return
*/
public boolean sendMsgAsy(String content, String tag, int delayTime) {
Long startTime = System.currentTimeMillis();
Message message = new Message(topic, tag, content.getBytes());
//定时
if (delayTime != 0) {
message.setStartDeliverTime(System.currentTimeMillis() + (60 * 1000 * delayTime));
}
this.sendAsync(message, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
///消息发送成功
System.out.println("send message success. topic=" + sendResult.getMessageId());
}
@Override
public void onException(OnExceptionContext context) {
//消息发送失败
System.out.println("send message failed. execption=" + context.getException());
}
});
Long endTime = System.currentTimeMillis();
System.out.println("单次生产耗时:"+(endTime-startTime)/1000);
return true;
}
/**
* 单向发送
* 单向发送:只负责发送消息,不等待服务器回应且没有回调函数触发,即只发送请求不等待应答;此方式发送消息的过程耗时非常短,一般在微秒级别;
* 特点:速度最快,耗时非常短,毫秒级别;无结果反馈;数据不可靠,可能会丢失;
* 应用场景:适用于某些耗时非常短,但对可靠性要求并不高的场景,例如日志收集;
* @return
*/
public boolean sendMsgOneway(String content, String tag, int delayTime) {
Long startTime = System.currentTimeMillis();
Message message = new Message(topic, tag, content.getBytes());
//定时
if (delayTime != 0) {
message.setStartDeliverTime(System.currentTimeMillis() + (60 * 1000 * delayTime));
}
this.sendOneway(message);
Long endTime = System.currentTimeMillis();
System.out.println("单次生产耗时:"+(endTime-startTime)/1000);
return true;
}
}
| 4,204
| 0.627109
| 0.615298
| 103
| 33.524273
| 28.023169
| 102
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.631068
| false
| false
|
2
|
f408e0a4d95c7cf3c58db33b8bced21031cad213
| 19,662,360,303,467
|
31245831451850bb729c9f740de6ccba92b6cde8
|
/app/src/main/java/hekasian/travistune/AutotalentController.java
|
32bd6968f7cf3314c2339b16841709f50b25c399
|
[] |
no_license
|
haekwanglee/TravisTune
|
https://github.com/haekwanglee/TravisTune
|
29884f714bfa1fc1b517b345113b6a791ebd60d8
|
9e777d099db1b1bd6b0f1e370b22b432921e18b3
|
refs/heads/master
| 2021-04-06T05:41:42.717000
| 2019-01-14T13:22:33
| 2019-01-14T13:22:33
| 124,630,254
| 2
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/* AutotalentController.java
An auto-tune app for Android
Copyright (c) 2016 Ethan Chen
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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package hekasian.travistune;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import net.sourceforge.autotalent.Autotalent;
public class AutotalentController {
private static final String TAG = "AutotalentController";
private static final float CONCERT_A = 440.0f;
private static final int DEFAULT_SCALE_ROTATE = 0;
private static final float DEFAULT_FIXED_PITCH = 0.0f;
private static final float DEFAULT_LFO_DEPTH = 0.0f;
private static final float DEFAULT_LFO_RATE = 5.0f;
private static final float DEFAULT_LFO_SHAPE = 0.0f;
private static final float DEFAULT_LFO_SYM = 0.0f;
private static final int DEFAULT_LFO_QUANT = 0;
private Autotalent mAutotalent;
private Context mContext;
public AutotalentController(Context context) {
mContext = context;
}
public void initializeAutotalent(int sampleRate) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mAutotalent = Autotalent.getInstance(sampleRate);
mAutotalent.setConcertA(CONCERT_A);
mAutotalent.setFixedPitch(DEFAULT_FIXED_PITCH);
mAutotalent.setScaleRotate(DEFAULT_SCALE_ROTATE);
mAutotalent.setLfoDepth(DEFAULT_LFO_DEPTH);
mAutotalent.setLfoRate(DEFAULT_LFO_RATE);
mAutotalent.setLfoShape(DEFAULT_LFO_SHAPE);
mAutotalent.setLfoSymmetric(DEFAULT_LFO_SYM);
mAutotalent.setLfoQuantization(DEFAULT_LFO_QUANT);
// TODO: shared prefs values
mAutotalent.setKey('C');
mAutotalent.setFixedPull(0.0f);
mAutotalent.setPitchShift(0.0f);
mAutotalent.setStrength(1.0f);
mAutotalent.setSmoothness(0.0f);
mAutotalent.enableFormantCorrection(false);
mAutotalent.setFormantWarp(-1.0f);
mAutotalent.setMix(1.0f);
/*
char key = sharedPrefs.getString(
mContext.getResources().getString(R.string.prefs_key_key),
mContext.getResources().getString(R.string.prefs_key_default)).charAt(0);
mAutotalent.setKey(key);
float fixedPull = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_pull_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_pull_default)) / 100.0f;
mAutotalent.setFixedPull(fixedPull);
float pitchShift = sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_shift_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_shift_default));
mAutotalent.setPitchShift(pitchShift);
float strength = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_str_key),
mContext.getResources().getInteger(R.integer.prefs_corr_str_default)) / 100.0f;
mAutotalent.setStrength(strength);
float smoothness = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_smooth_key),
mContext.getResources().getInteger(R.integer.prefs_corr_smooth_default)) / 100.0f;
mAutotalent.setSmoothness(smoothness);
boolean formantCorrection = sharedPrefs.getBoolean(
mContext.getResources().getString(R.string.prefs_formant_corr_key),
mContext.getResources().getBoolean(R.bool.prefs_formant_corr_default));
mAutotalent.enableFormantCorrection(formantCorrection);
float formantWarp = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_formant_warp_key),
mContext.getResources().getInteger(R.integer.prefs_formant_warp_default)) / 100.0f;
mAutotalent.setFormantWarp(formantWarp);
float mix = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_mix_key),
mContext.getResources().getInteger(R.integer.prefs_corr_mix_default)) / 100.0f;
mAutotalent.setMix(mix);
*/
sharedPrefs.registerOnSharedPreferenceChangeListener(mPrefListener);
}
public void process(short[] samples, int numSamples) {
mAutotalent.process(samples, numSamples);
}
public void closeAutotalent() {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
sharedPrefs.unregisterOnSharedPreferenceChangeListener(mPrefListener);
mAutotalent.close();
}
private SharedPreferences.OnSharedPreferenceChangeListener mPrefListener =
new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPrefs, String key) {
/*
if (mContext.getString(R.string.prefs_key_key).equals(key)) {
char autotalentKey = sharedPrefs.getString(
mContext.getResources().getString(R.string.prefs_key_key),
mContext.getResources().getString(R.string.prefs_key_default)).charAt(0);
mAutotalent.setKey(autotalentKey);
} else if (mContext.getString(R.string.prefs_pitch_pull_key).equals(key)) {
float fixedPull = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_pull_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_pull_default)) / 100.0f;
mAutotalent.setFixedPull(fixedPull);
} else if (mContext.getString(R.string.prefs_pitch_shift_key).equals(key)) {
float pitchShift = sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_shift_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_shift_default));
mAutotalent.setPitchShift(pitchShift);
} else if (mContext.getString(R.string.prefs_corr_str_key).equals(key)) {
float strength = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_str_key),
mContext.getResources().getInteger(R.integer.prefs_corr_str_default)) / 100.0f;
mAutotalent.setStrength(strength);
} else if (mContext.getString(R.string.prefs_corr_smooth_key).equals(key)) {
float smoothness = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_smooth_key),
mContext.getResources().getInteger(R.integer.prefs_corr_smooth_default)) / 100.0f;
mAutotalent.setSmoothness(smoothness);
} else if (mContext.getString(R.string.prefs_formant_corr_key).equals(key)) {
boolean enabled = sharedPrefs.getBoolean(
mContext.getResources().getString(R.string.prefs_formant_corr_key),
mContext.getResources().getBoolean(R.bool.prefs_formant_corr_default));
mAutotalent.enableFormantCorrection(enabled);
} else if (mContext.getString(R.string.prefs_formant_warp_key).equals(key)) {
float formantWarp = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_formant_warp_key),
mContext.getResources().getInteger(R.integer.prefs_formant_warp_default)) / 100.0f;
mAutotalent.setFormantWarp(formantWarp);
} else if (mContext.getString(R.string.prefs_corr_mix_key).equals(key)) {
float mix = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_mix_key),
mContext.getResources().getInteger(R.integer.prefs_corr_mix_default)) / 100.0f;
mAutotalent.setMix(mix);
}
*/
}
};
}
|
UTF-8
|
Java
| 9,197
|
java
|
AutotalentController.java
|
Java
|
[
{
"context": "n auto-tune app for Android\n\n Copyright (c) 2016 Ethan Chen\n\n This program is free software; you can redist",
"end": 94,
"score": 0.9996348023414612,
"start": 84,
"tag": "NAME",
"value": "Ethan Chen"
}
] | null |
[] |
/* AutotalentController.java
An auto-tune app for Android
Copyright (c) 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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package hekasian.travistune;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import net.sourceforge.autotalent.Autotalent;
public class AutotalentController {
private static final String TAG = "AutotalentController";
private static final float CONCERT_A = 440.0f;
private static final int DEFAULT_SCALE_ROTATE = 0;
private static final float DEFAULT_FIXED_PITCH = 0.0f;
private static final float DEFAULT_LFO_DEPTH = 0.0f;
private static final float DEFAULT_LFO_RATE = 5.0f;
private static final float DEFAULT_LFO_SHAPE = 0.0f;
private static final float DEFAULT_LFO_SYM = 0.0f;
private static final int DEFAULT_LFO_QUANT = 0;
private Autotalent mAutotalent;
private Context mContext;
public AutotalentController(Context context) {
mContext = context;
}
public void initializeAutotalent(int sampleRate) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
mAutotalent = Autotalent.getInstance(sampleRate);
mAutotalent.setConcertA(CONCERT_A);
mAutotalent.setFixedPitch(DEFAULT_FIXED_PITCH);
mAutotalent.setScaleRotate(DEFAULT_SCALE_ROTATE);
mAutotalent.setLfoDepth(DEFAULT_LFO_DEPTH);
mAutotalent.setLfoRate(DEFAULT_LFO_RATE);
mAutotalent.setLfoShape(DEFAULT_LFO_SHAPE);
mAutotalent.setLfoSymmetric(DEFAULT_LFO_SYM);
mAutotalent.setLfoQuantization(DEFAULT_LFO_QUANT);
// TODO: shared prefs values
mAutotalent.setKey('C');
mAutotalent.setFixedPull(0.0f);
mAutotalent.setPitchShift(0.0f);
mAutotalent.setStrength(1.0f);
mAutotalent.setSmoothness(0.0f);
mAutotalent.enableFormantCorrection(false);
mAutotalent.setFormantWarp(-1.0f);
mAutotalent.setMix(1.0f);
/*
char key = sharedPrefs.getString(
mContext.getResources().getString(R.string.prefs_key_key),
mContext.getResources().getString(R.string.prefs_key_default)).charAt(0);
mAutotalent.setKey(key);
float fixedPull = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_pull_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_pull_default)) / 100.0f;
mAutotalent.setFixedPull(fixedPull);
float pitchShift = sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_shift_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_shift_default));
mAutotalent.setPitchShift(pitchShift);
float strength = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_str_key),
mContext.getResources().getInteger(R.integer.prefs_corr_str_default)) / 100.0f;
mAutotalent.setStrength(strength);
float smoothness = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_smooth_key),
mContext.getResources().getInteger(R.integer.prefs_corr_smooth_default)) / 100.0f;
mAutotalent.setSmoothness(smoothness);
boolean formantCorrection = sharedPrefs.getBoolean(
mContext.getResources().getString(R.string.prefs_formant_corr_key),
mContext.getResources().getBoolean(R.bool.prefs_formant_corr_default));
mAutotalent.enableFormantCorrection(formantCorrection);
float formantWarp = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_formant_warp_key),
mContext.getResources().getInteger(R.integer.prefs_formant_warp_default)) / 100.0f;
mAutotalent.setFormantWarp(formantWarp);
float mix = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_mix_key),
mContext.getResources().getInteger(R.integer.prefs_corr_mix_default)) / 100.0f;
mAutotalent.setMix(mix);
*/
sharedPrefs.registerOnSharedPreferenceChangeListener(mPrefListener);
}
public void process(short[] samples, int numSamples) {
mAutotalent.process(samples, numSamples);
}
public void closeAutotalent() {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
sharedPrefs.unregisterOnSharedPreferenceChangeListener(mPrefListener);
mAutotalent.close();
}
private SharedPreferences.OnSharedPreferenceChangeListener mPrefListener =
new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPrefs, String key) {
/*
if (mContext.getString(R.string.prefs_key_key).equals(key)) {
char autotalentKey = sharedPrefs.getString(
mContext.getResources().getString(R.string.prefs_key_key),
mContext.getResources().getString(R.string.prefs_key_default)).charAt(0);
mAutotalent.setKey(autotalentKey);
} else if (mContext.getString(R.string.prefs_pitch_pull_key).equals(key)) {
float fixedPull = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_pull_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_pull_default)) / 100.0f;
mAutotalent.setFixedPull(fixedPull);
} else if (mContext.getString(R.string.prefs_pitch_shift_key).equals(key)) {
float pitchShift = sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_pitch_shift_key),
mContext.getResources().getInteger(R.integer.prefs_pitch_shift_default));
mAutotalent.setPitchShift(pitchShift);
} else if (mContext.getString(R.string.prefs_corr_str_key).equals(key)) {
float strength = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_str_key),
mContext.getResources().getInteger(R.integer.prefs_corr_str_default)) / 100.0f;
mAutotalent.setStrength(strength);
} else if (mContext.getString(R.string.prefs_corr_smooth_key).equals(key)) {
float smoothness = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_smooth_key),
mContext.getResources().getInteger(R.integer.prefs_corr_smooth_default)) / 100.0f;
mAutotalent.setSmoothness(smoothness);
} else if (mContext.getString(R.string.prefs_formant_corr_key).equals(key)) {
boolean enabled = sharedPrefs.getBoolean(
mContext.getResources().getString(R.string.prefs_formant_corr_key),
mContext.getResources().getBoolean(R.bool.prefs_formant_corr_default));
mAutotalent.enableFormantCorrection(enabled);
} else if (mContext.getString(R.string.prefs_formant_warp_key).equals(key)) {
float formantWarp = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_formant_warp_key),
mContext.getResources().getInteger(R.integer.prefs_formant_warp_default)) / 100.0f;
mAutotalent.setFormantWarp(formantWarp);
} else if (mContext.getString(R.string.prefs_corr_mix_key).equals(key)) {
float mix = (float) sharedPrefs.getInt(
mContext.getResources().getString(R.string.prefs_corr_mix_key),
mContext.getResources().getInteger(R.integer.prefs_corr_mix_default)) / 100.0f;
mAutotalent.setMix(mix);
}
*/
}
};
}
| 9,193
| 0.636838
| 0.627487
| 176
| 51.25568
| 33.368595
| 115
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.590909
| false
| false
|
2
|
146996ed15aae4f9e8ed9520c5d3dac7ecbc2043
| 927,712,960,422
|
14a44eaa62df3aed9a429b8dec700b62da688a08
|
/src/main/java/HibernateProyect/HibernateProyect/modelo/Persona.java
|
8e11ed0c3d1b3fa2a419bf84bc7111e49bc92389
|
[] |
no_license
|
daniatenciano/HibernateProyect
|
https://github.com/daniatenciano/HibernateProyect
|
23374f35f8efde0d04fe3da6b82773158c025d6e
|
cb1a524d043bd66055836ed1bde106b2313ad678
|
refs/heads/master
| 2020-03-11T09:05:47.791000
| 2018-04-20T12:12:58
| 2018-04-20T12:12:58
| 129,901,827
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package HibernateProyect.HibernateProyect.modelo;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.*;
import org.hibernate.annotations.SortComparator;
import es.aytos.hibernate.hibernate.comparadores.ComparadorTelefonos;
import es.aytos.hibernate.hibernate.conversores.Conversores;
@Entity
@Table(name = "A_PER")
public class Persona extends Usuario {
@Column(name = "PER_NOM", nullable = false, length = 50)
private String nombre;
@Column(name = "PER_APE", nullable = false, length = 250)
private String apellidos;
@Column(name = "PER_DNI", nullable = false, length = 9, unique = true)
private String dni;
@Column(name = "PER_EDA", nullable = false)
private Integer edad;
@Column(name = "PER_ECV", nullable = false)
@Enumerated(value = EnumType.ORDINAL)
private EstadoCivil estadoCivil;
@ManyToMany(cascade = CascadeType.ALL)
private List<Direccion> direcciones;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "persona", fetch = FetchType.EAGER)
@SortComparator(ComparadorTelefonos.class)
private Set<Telefono> telefonos;
@OneToOne
@JoinColumn(name = "detalles_id")
private DetallesPersonas detalles;
@Column(name = "PER_GEN", nullable = false, length = 1)
@Convert(converter = Conversores.class)
private Genero genero;
public Persona() {
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public String getDni() {
return dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public Integer getEdad() {
return edad;
}
public void setEdad(Integer edad) {
this.edad = edad;
}
public EstadoCivil getEstadoCivil() {
return estadoCivil;
}
public void setEstadoCivil(EstadoCivil estadoCivil) {
this.estadoCivil = estadoCivil;
}
public List<Telefono> getPhones() {
return (List<Telefono>) telefonos;
}
// public void addPhone(Telefono phone) {
// telefonos.add( phone );
// phone.setPersona( this );
// }
public void removePhone(Telefono phone) {
telefonos.remove( phone );
phone.setPersona( null );
}
public void addDireccion(Direccion address) {
direcciones.add( address );
address.getPropietarios().add( this );
}
public void removeAddress(Direccion address) {
direcciones.remove( address );
address.getPropietarios().remove( this );
}
public DetallesPersonas getDetails() {
return detalles;
}
public void setDetalles(DetallesPersonas details) {
this.detalles = details;
}
public void setGenero(Genero genero) {
this.genero =genero;
}
public Genero getGenero() {
return genero;
}
public void addTelefono(Telefono telefono) {
telefonos.add( telefono );
telefono.setPersona(this);
}
public void setTelefonos(Set<Telefono> telefonos) {
this.telefonos = telefonos;
}
public void setDirecciones(List<Direccion> direcciones) {
this.direcciones = direcciones;
}
}
|
UTF-8
|
Java
| 3,305
|
java
|
Persona.java
|
Java
|
[] | null |
[] |
package HibernateProyect.HibernateProyect.modelo;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.*;
import org.hibernate.annotations.SortComparator;
import es.aytos.hibernate.hibernate.comparadores.ComparadorTelefonos;
import es.aytos.hibernate.hibernate.conversores.Conversores;
@Entity
@Table(name = "A_PER")
public class Persona extends Usuario {
@Column(name = "PER_NOM", nullable = false, length = 50)
private String nombre;
@Column(name = "PER_APE", nullable = false, length = 250)
private String apellidos;
@Column(name = "PER_DNI", nullable = false, length = 9, unique = true)
private String dni;
@Column(name = "PER_EDA", nullable = false)
private Integer edad;
@Column(name = "PER_ECV", nullable = false)
@Enumerated(value = EnumType.ORDINAL)
private EstadoCivil estadoCivil;
@ManyToMany(cascade = CascadeType.ALL)
private List<Direccion> direcciones;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "persona", fetch = FetchType.EAGER)
@SortComparator(ComparadorTelefonos.class)
private Set<Telefono> telefonos;
@OneToOne
@JoinColumn(name = "detalles_id")
private DetallesPersonas detalles;
@Column(name = "PER_GEN", nullable = false, length = 1)
@Convert(converter = Conversores.class)
private Genero genero;
public Persona() {
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public String getDni() {
return dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public Integer getEdad() {
return edad;
}
public void setEdad(Integer edad) {
this.edad = edad;
}
public EstadoCivil getEstadoCivil() {
return estadoCivil;
}
public void setEstadoCivil(EstadoCivil estadoCivil) {
this.estadoCivil = estadoCivil;
}
public List<Telefono> getPhones() {
return (List<Telefono>) telefonos;
}
// public void addPhone(Telefono phone) {
// telefonos.add( phone );
// phone.setPersona( this );
// }
public void removePhone(Telefono phone) {
telefonos.remove( phone );
phone.setPersona( null );
}
public void addDireccion(Direccion address) {
direcciones.add( address );
address.getPropietarios().add( this );
}
public void removeAddress(Direccion address) {
direcciones.remove( address );
address.getPropietarios().remove( this );
}
public DetallesPersonas getDetails() {
return detalles;
}
public void setDetalles(DetallesPersonas details) {
this.detalles = details;
}
public void setGenero(Genero genero) {
this.genero =genero;
}
public Genero getGenero() {
return genero;
}
public void addTelefono(Telefono telefono) {
telefonos.add( telefono );
telefono.setPersona(this);
}
public void setTelefonos(Set<Telefono> telefonos) {
this.telefonos = telefonos;
}
public void setDirecciones(List<Direccion> direcciones) {
this.direcciones = direcciones;
}
}
| 3,305
| 0.681392
| 0.679274
| 145
| 21.799999
| 20.827568
| 110
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.255172
| false
| false
|
2
|
6d7f56d680ef57046423fc49d6bbaab069f49580
| 7,490,423,017,862
|
174d1ad991585db6911eef5047f897e06ce70fec
|
/Sourcecode/Android/Weather_parse/app/src/main/java/kr/ac/knu/bist/wheather_parse/Connection/JSONParser.java
|
96d482f00e8deee210caf7580335408672e89c47
|
[] |
no_license
|
KKIID/KNUCapstone17
|
https://github.com/KKIID/KNUCapstone17
|
7595ba0465c3552af17d9f621e43361bd0b41955
|
7254fb448d043889d1d46b47f062c312089f289e
|
refs/heads/master
| 2020-06-21T20:24:11.041000
| 2017-06-19T14:08:25
| 2017-06-19T14:08:25
| 74,772,386
| 0
| 10
| null | false
| 2017-05-09T13:36:03
| 2016-11-25T16:11:45
| 2017-04-02T08:02:01
| 2017-05-09T13:36:03
| 31,283
| 0
| 4
| 0
|
Java
| null | null |
package kr.ac.knu.bist.wheather_parse.Connection;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.concurrent.ExecutionException;
/**
* Created by Bist on 2017-06-18.
*/
public class JSONParser {
public static JSONArray parseJSONString(String string) throws JSONException {
return new JSONArray(string);
}
public static String requestJSONString() throws ExecutionException, InterruptedException {
ConnManager conn = new ConnManager();
conn.execute("GET", ConnManager.main_url + ConnManager.dev_url);
return conn.get();
}
}
|
UTF-8
|
Java
| 603
|
java
|
JSONParser.java
|
Java
|
[
{
"context": ".concurrent.ExecutionException;\n\n/**\n * Created by Bist on 2017-06-18.\n */\n\npublic class JSONParser {\n ",
"end": 181,
"score": 0.7000182867050171,
"start": 177,
"tag": "USERNAME",
"value": "Bist"
}
] | null |
[] |
package kr.ac.knu.bist.wheather_parse.Connection;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.concurrent.ExecutionException;
/**
* Created by Bist on 2017-06-18.
*/
public class JSONParser {
public static JSONArray parseJSONString(String string) throws JSONException {
return new JSONArray(string);
}
public static String requestJSONString() throws ExecutionException, InterruptedException {
ConnManager conn = new ConnManager();
conn.execute("GET", ConnManager.main_url + ConnManager.dev_url);
return conn.get();
}
}
| 603
| 0.723051
| 0.709784
| 21
| 27.714285
| 28.022343
| 94
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.47619
| false
| false
|
2
|
4a4bfd1f76a0955ba318814499474be41634d40b
| 19,198,503,861,591
|
6631c7b2a2c81adabf588c44b310aa2a74eec21f
|
/src/concurrency/TestBlockingQueues.java
|
9af7d9ccbe8b78bd404cc0672616c3e30b1c26c7
|
[] |
no_license
|
wenjiechen/practice
|
https://github.com/wenjiechen/practice
|
7f60cef6dd82ec54ecd91371b4ce28b318a2e528
|
e684da73c4ba51f52eb1071ef1256d61aafcf685
|
refs/heads/master
| 2021-01-19T07:13:30.976000
| 2014-04-17T01:27:33
| 2014-04-17T01:27:33
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package concurrency;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
class LiftOffRunner implements Runnable {
private BlockingQueue<LiftOff> rockets;
public LiftOffRunner(BlockingQueue<LiftOff> queue) {
rockets = queue;
}
public void add(LiftOff lo) {
try {
rockets.put(lo); // Inserts the specified element into this queue, waiting
// if necessary for space to become available.
} catch (InterruptedException e) {
System.out.println("Interrupted during put()");
}
}
public void run() {
try {
while (!Thread.interrupted()) {
// Retrieves and removes the head of this queue, waiting if necessary
// until an element becomes available.
LiftOff rocket = rockets.take();
rocket.run();
}
} catch (InterruptedException e) {
System.out.println("waking from take()");
}
System.out.println("Exiting LiftOffRunner");
}
}
public class TestBlockingQueues {
static void test(BlockingQueue<LiftOff> queue) {
LiftOffRunner runner = new LiftOffRunner(queue);
Thread t = new Thread(runner);
t.start();
for (int i = 0; i < 5; i++) {
runner.add(new LiftOff(5));
}
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
t.interrupt();
}
public static void main(String[] args) {
// test(new LinkedBlockingQueue<LiftOff>());
test(new ArrayBlockingQueue<LiftOff>(3));
}
}
|
UTF-8
|
Java
| 1,576
|
java
|
TestBlockingQueues.java
|
Java
|
[] | null |
[] |
package concurrency;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
class LiftOffRunner implements Runnable {
private BlockingQueue<LiftOff> rockets;
public LiftOffRunner(BlockingQueue<LiftOff> queue) {
rockets = queue;
}
public void add(LiftOff lo) {
try {
rockets.put(lo); // Inserts the specified element into this queue, waiting
// if necessary for space to become available.
} catch (InterruptedException e) {
System.out.println("Interrupted during put()");
}
}
public void run() {
try {
while (!Thread.interrupted()) {
// Retrieves and removes the head of this queue, waiting if necessary
// until an element becomes available.
LiftOff rocket = rockets.take();
rocket.run();
}
} catch (InterruptedException e) {
System.out.println("waking from take()");
}
System.out.println("Exiting LiftOffRunner");
}
}
public class TestBlockingQueues {
static void test(BlockingQueue<LiftOff> queue) {
LiftOffRunner runner = new LiftOffRunner(queue);
Thread t = new Thread(runner);
t.start();
for (int i = 0; i < 5; i++) {
runner.add(new LiftOff(5));
}
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
t.interrupt();
}
public static void main(String[] args) {
// test(new LinkedBlockingQueue<LiftOff>());
test(new ArrayBlockingQueue<LiftOff>(3));
}
}
| 1,576
| 0.649112
| 0.645939
| 59
| 25.711864
| 21.576078
| 80
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.423729
| false
| false
|
2
|
912388040aed3dd69329b72a3f4d3892a1badb5b
| 19,198,503,862,917
|
6a18d8cb11065aa65131eeded409ad29960bb998
|
/03-lukema/work/ChinaEasternAirlineBoxerFinal/ChinaEasternAirline/src/main/java/com/ezway/common/IdDOCS.java
|
31c5d069d28cb6edc9e010e9ba1113b7cf164d6c
|
[] |
no_license
|
xlukema/RemoteLukeMaWorkGit
|
https://github.com/xlukema/RemoteLukeMaWorkGit
|
810b42263c768232b42cff51bb881ab8a53054c4
|
b8fc97e0eddc113c2d5293a78edc6600e6eef057
|
refs/heads/master
| 2017-05-04T04:04:37.487000
| 2017-05-03T01:32:43
| 2017-05-03T01:32:43
| 32,882,681
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ezway.common;
import java.util.Date;
public class IdDOCS
extends IdBase
{
private static final long serialVersionUID = 1L;
private Gender gender;
private String nationality;
private String issuingCountryOrRegion;
private String typeOfId;
private Date dateOfBirth;
private Date expirationDate;
private String ownerMark;
public void setIdType()
{
setIdType(IdType.DOCS);
}
public Gender getGender()
{
return gender;
}
public void setGender(Gender gender)
{
this.gender = gender;
}
public String getNationality()
{
return nationality;
}
public void setNationality(String nationality)
{
this.nationality = nationality;
}
public Date getDateOfBirth()
{
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth)
{
this.dateOfBirth = dateOfBirth;
}
public void setTypeOfId(String typeOfId)
{
this.typeOfId = typeOfId;
}
public String getTypeOfId()
{
return typeOfId;
}
public void setExpirationDate(Date expirationDate)
{
this.expirationDate = expirationDate;
}
public Date getExpirationDate()
{
return expirationDate;
}
public void setOwnerMark(String ownerMark)
{
this.ownerMark = ownerMark;
}
public String getOwnerMark()
{
return ownerMark;
}
public void setIssuingCountryOrRegion(String issuingCountryOrRegion)
{
this.issuingCountryOrRegion = issuingCountryOrRegion;
}
public String getIssuingCountryOrRegion()
{
return issuingCountryOrRegion;
}
}
|
UTF-8
|
Java
| 1,828
|
java
|
IdDOCS.java
|
Java
|
[] | null |
[] |
package com.ezway.common;
import java.util.Date;
public class IdDOCS
extends IdBase
{
private static final long serialVersionUID = 1L;
private Gender gender;
private String nationality;
private String issuingCountryOrRegion;
private String typeOfId;
private Date dateOfBirth;
private Date expirationDate;
private String ownerMark;
public void setIdType()
{
setIdType(IdType.DOCS);
}
public Gender getGender()
{
return gender;
}
public void setGender(Gender gender)
{
this.gender = gender;
}
public String getNationality()
{
return nationality;
}
public void setNationality(String nationality)
{
this.nationality = nationality;
}
public Date getDateOfBirth()
{
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth)
{
this.dateOfBirth = dateOfBirth;
}
public void setTypeOfId(String typeOfId)
{
this.typeOfId = typeOfId;
}
public String getTypeOfId()
{
return typeOfId;
}
public void setExpirationDate(Date expirationDate)
{
this.expirationDate = expirationDate;
}
public Date getExpirationDate()
{
return expirationDate;
}
public void setOwnerMark(String ownerMark)
{
this.ownerMark = ownerMark;
}
public String getOwnerMark()
{
return ownerMark;
}
public void setIssuingCountryOrRegion(String issuingCountryOrRegion)
{
this.issuingCountryOrRegion = issuingCountryOrRegion;
}
public String getIssuingCountryOrRegion()
{
return issuingCountryOrRegion;
}
}
| 1,828
| 0.602298
| 0.601751
| 101
| 16.09901
| 18.260223
| 71
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.247525
| false
| false
|
2
|
80ae729ae531f01d5b191804560232b4d79f6313
| 19,198,503,862,604
|
717879a96853fdb0850b90fa9515530e5875531b
|
/ata/src/ata/Gui.java
|
6eed1ffe19e90fb6c67942a5243a6a43749e28a8
|
[] |
no_license
|
fenwastaken/ata-manager
|
https://github.com/fenwastaken/ata-manager
|
24164768c947bd1b53137316f7eca5eda10b3711
|
5ca8c248dc38b91886064c5380da5997ec3c7c60
|
refs/heads/master
| 2020-12-24T12:29:23.164000
| 2017-01-02T10:38:30
| 2017-01-02T10:38:30
| 72,995,016
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package ata;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Vector;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Gui extends JFrame{
String version = "Version 1.0";
JPanel zoneclient;
Pancategory panName = new Pancategory("Nom", true, false);
Pancategory panDate = new Pancategory("Date", true, false);
Pancategory panType = new Pancategory("Type A/C", true, false);
Pancategory panImmat = new Pancategory("IMMAT", true, false);
Pancategory panAta = new Pancategory("ATA", true, false);
Pancategory panTache = new Pancategory("Tache", true, false);
Pancategory panCheck = new Pancategory("Fonctions", false, true);
JComboBox<String> boxAta = new JComboBox<String>();
JComboBox<String> boxType = new JComboBox<String>();
JComboBox<String> boxImma = new JComboBox<String>();
JComboBox<String> boxTask = new JComboBox<String>();
JComboBox<String> boxName = new JComboBox<String>();
JComboBox<String> boxDate = new JComboBox<String>();
JButton btOK = new JButton("Ajouter");
//JButton btDis = new JButton("Afficher");
//JButton btExcel = new JButton("Excel");
JButton btEdit = new JButton("Trier");
JLabel labRetour = new JLabel();
public Gui(){
this.setSize(650, 350);
this.setTitle("Ata manager - " + version);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(false);
this.setLocationRelativeTo(null);
try {
initControles();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void initControles() throws IOException{
zoneclient = (JPanel)this.getContentPane();
zoneclient.setLayout(new BoxLayout(zoneclient, BoxLayout.Y_AXIS));
Date currentDate = new Date(System.currentTimeMillis());
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String result = df.format(currentDate);
panDate.getTf().setText(result);
panName.getTf().setText("Claude Leyour");
zoneclient.add(panName);
zoneclient.add(panDate);
zoneclient.add(panType);
zoneclient.add(panImmat);
zoneclient.add(panAta);
zoneclient.add(panTache);
zoneclient.add(panCheck);
panAta.add(boxAta);
panType.add(boxType);
panTache.add(boxTask);
panImmat.add(boxImma);
//panDate.add(boxDate);
panName.add(boxName);
feedBoxAta();
feedBoxType();
feedBoxImmat();
feedBoxTask();
feedBoxName();
JPanel panBT = new JPanel();
panBT.add(labRetour);
panBT.add(btOK);
//panBT.add(btDis);
//panBT.add(btExcel);
panBT.add(btEdit);
panBT.add(Box.createRigidArea(new Dimension(30,10)));
panBT.setLayout(new FlowLayout(FlowLayout.RIGHT));
zoneclient.add(panBT);
boxAta.addItemListener(new appItemListener());
boxAta.addFocusListener(new appFocusListener());
btOK.addFocusListener(new appFocusListener());
btOK.addActionListener(new appActionListener());
//btDis.addActionListener(new appActionListener());
//btExcel.addActionListener(new appActionListener());
btEdit.addActionListener(new appActionListener());
boxType.addItemListener(new appItemListener());
boxType.addFocusListener(new appFocusListener());
boxImma.addItemListener(new appItemListener());
boxImma.addFocusListener(new appFocusListener());
boxTask.addItemListener(new appItemListener());
boxTask.addFocusListener(new appFocusListener());
boxName.addItemListener(new appItemListener());
boxName.addFocusListener(new appFocusListener());
}
public void feedBoxAta(){
boxAta.removeAllItems();
boxAta.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllAtas();
for(String str : vecStr){
boxAta.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxType(){
boxType.removeAllItems();
boxType.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllTypes();
for(String str : vecStr){
boxType.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxImmat(){
boxImma.removeAllItems();
boxImma.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllImmats();
for(String str : vecStr){
boxImma.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxTask(){
boxTask.removeAllItems();
boxTask.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllTasks();
for(String str : vecStr){
boxTask.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxName(){
boxName.removeAllItems();
boxName.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllNames();
for(String str : vecStr){
boxName.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void display(){
try {
Vector<String> vec = Manager.getAllLinesToString();
GuiDisplay gd = new GuiDisplay(vec);
gd.setVisible(true);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void insertLine(){
String name = panName.getTf().getText();
Date date = new Date();
System.out.println("INIT " + date);
try {
//here
String strDate = panDate.getTf().getText();
System.out.println("pan : " + strDate);
System.out.println("1 : " + date.toString());
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
date = df.parse(strDate);
System.out.println("2 : " + date.toString());
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
labRetour.setText("Date erronnée");
}
String type = panType.getTf().getText();;
String immat = panImmat.getTf().getText();
String ata = panAta.getTf().getText();
String task = panTache.getTf().getText();
int formation = 0;
int execution = 0;
int controle = 0;
int encadrement = 0;
int aprs = 0;
if(panCheck.getCb1().getState()){
formation = 1;
}
if(panCheck.getCb2().getState()){
execution = 1;
}
if(panCheck.getCb3().getState()){
controle = 1;
}
if(panCheck.getCb4().getState()){
encadrement = 1;
}
if(panCheck.getCb5().getState()){
aprs = 1;
}
try {
int ret = Manager.saveLine(name, date, type, immat, ata, task, formation, execution, controle, encadrement, aprs);
if(ret == 1){
labRetour.setText("Ligne insérée!");
panAta.getTf().setText("");
panImmat.getTf().setText("");
panTache.getTf().setText("");
panType.getTf().setText("");
panCheck.getCb1().setState(false);
panCheck.getCb2().setState(false);
panCheck.getCb3().setState(false);
panCheck.getCb4().setState(false);
panCheck.getCb5().setState(false);
feedAll();
}
else{
labRetour.setText("Echec insertion");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static String cutter(String message){
Vector<Integer> vec = new Vector<Integer>();
message = message.replace(" ", "");
String separator = ",";
int start = 0;
int stop = message.indexOf(separator, start);
String ret = "";
while(stop <= message.length() && stop != -1){
ret = message.substring(start, stop);
vec.add(Integer.parseInt(ret));
start = stop + 1;
stop = message.indexOf(separator, start);
}
ret = message.substring(start);
vec.add(Integer.parseInt(ret));
System.out.println("Original : " + vec.toString());
Collections.sort(vec);
System.out.println("SORTED: " + vec.toString());
String atas = "";
for(int integer : vec){
atas += integer + ", ";
}
atas = atas.substring(0, atas.length() - 2);
System.out.println("ATAS " + atas);
return atas;
}
public void feedAll(){
feedBoxAta();
feedBoxType();
feedBoxImmat();
feedBoxTask();
feedBoxName();
}
class appActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == btOK){
if(panType.getTf().getText().isEmpty() || panImmat.getTf().getText().isEmpty() || panTache.getTf().getText().isEmpty()){
labRetour.setText("Veuillez renseigner le type, l'immatriculation et la tache.");
}
else{
insertLine();
}
}
// if(e.getSource() == btDis){
// display();
// }
//
// if(e.getSource() == btExcel){
// excelify();
// }
if(e.getSource() == btEdit){
GuiSelect gui = new GuiSelect();
gui.setVisible(true);
}
}
}
class appItemListener implements ItemListener{
@Override
public void itemStateChanged(ItemEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == boxAta && e.getStateChange() == 1 && boxAta.getSelectedIndex() != 0){
String text = panAta.getTf().getText();
String ata = boxAta.getSelectedItem().toString();
ata = ata.substring(0, ata.indexOf(","));
if(text.indexOf(ata) < 0){
if(!text.isEmpty()){
text = text + ", " + ata;
panAta.getTf().setText(cutter(text));
}
else{
panAta.getTf().setText(ata);
}
}
}
if(e.getSource() == boxType && e.getStateChange() == 1 && boxType.getSelectedIndex() != 0){
String type = boxType.getSelectedItem().toString();
panType.getTf().setText("");
panType.getTf().setText(type);
}
if(e.getSource() == boxImma && e.getStateChange() == 1 && boxImma.getSelectedIndex() != 0){
String imma = boxImma.getSelectedItem().toString();
panImmat.getTf().setText("");
panImmat.getTf().setText(imma);
try {
if(Manager.ImmatExists(imma)){
String type = Manager.getTypeFromImmat(imma);
panType.getTf().setText(type);
boxType.setSelectedItem(type);
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
if(e.getSource() == boxTask && e.getStateChange() == 1 && boxTask.getSelectedIndex() != 0){
String Task = boxTask.getSelectedItem().toString();
panTache.getTf().setText("");
panTache.getTf().setText(Task);
}
if(e.getSource() == boxName && e.getStateChange() == 1 && boxName.getSelectedIndex() != 0){
String Name = boxName.getSelectedItem().toString();
panName.getTf().setText("");
panName.getTf().setText(Name);
}
fixGui();
}
}
public void fixGui(){
zoneclient.revalidate();
zoneclient.repaint();
panCheck.repaint();
panCheck.revalidate();
}
class appFocusListener implements FocusListener{
@Override
public void focusGained(FocusEvent arg0) {
// TODO Auto-generated method stub
zoneclient.revalidate();
zoneclient.repaint();
}
@Override
public void focusLost(FocusEvent arg0) {
// TODO Auto-generated method stub
fixGui();
if(arg0.getSource() == btOK){
labRetour.setText("");
}
}
}
}
|
UTF-8
|
Java
| 11,630
|
java
|
Gui.java
|
Java
|
[
{
"context": "().setText(result);\n\t\t\n\t\tpanName.getTf().setText(\"Claude Leyour\");\n\t\t\n\t\tzoneclient.add(panName);\n\t\tzoneclient.add",
"end": 2514,
"score": 0.9998816847801208,
"start": 2501,
"tag": "NAME",
"value": "Claude Leyour"
}
] | null |
[] |
package ata;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Vector;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Gui extends JFrame{
String version = "Version 1.0";
JPanel zoneclient;
Pancategory panName = new Pancategory("Nom", true, false);
Pancategory panDate = new Pancategory("Date", true, false);
Pancategory panType = new Pancategory("Type A/C", true, false);
Pancategory panImmat = new Pancategory("IMMAT", true, false);
Pancategory panAta = new Pancategory("ATA", true, false);
Pancategory panTache = new Pancategory("Tache", true, false);
Pancategory panCheck = new Pancategory("Fonctions", false, true);
JComboBox<String> boxAta = new JComboBox<String>();
JComboBox<String> boxType = new JComboBox<String>();
JComboBox<String> boxImma = new JComboBox<String>();
JComboBox<String> boxTask = new JComboBox<String>();
JComboBox<String> boxName = new JComboBox<String>();
JComboBox<String> boxDate = new JComboBox<String>();
JButton btOK = new JButton("Ajouter");
//JButton btDis = new JButton("Afficher");
//JButton btExcel = new JButton("Excel");
JButton btEdit = new JButton("Trier");
JLabel labRetour = new JLabel();
public Gui(){
this.setSize(650, 350);
this.setTitle("Ata manager - " + version);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(false);
this.setLocationRelativeTo(null);
try {
initControles();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void initControles() throws IOException{
zoneclient = (JPanel)this.getContentPane();
zoneclient.setLayout(new BoxLayout(zoneclient, BoxLayout.Y_AXIS));
Date currentDate = new Date(System.currentTimeMillis());
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String result = df.format(currentDate);
panDate.getTf().setText(result);
panName.getTf().setText("<NAME>");
zoneclient.add(panName);
zoneclient.add(panDate);
zoneclient.add(panType);
zoneclient.add(panImmat);
zoneclient.add(panAta);
zoneclient.add(panTache);
zoneclient.add(panCheck);
panAta.add(boxAta);
panType.add(boxType);
panTache.add(boxTask);
panImmat.add(boxImma);
//panDate.add(boxDate);
panName.add(boxName);
feedBoxAta();
feedBoxType();
feedBoxImmat();
feedBoxTask();
feedBoxName();
JPanel panBT = new JPanel();
panBT.add(labRetour);
panBT.add(btOK);
//panBT.add(btDis);
//panBT.add(btExcel);
panBT.add(btEdit);
panBT.add(Box.createRigidArea(new Dimension(30,10)));
panBT.setLayout(new FlowLayout(FlowLayout.RIGHT));
zoneclient.add(panBT);
boxAta.addItemListener(new appItemListener());
boxAta.addFocusListener(new appFocusListener());
btOK.addFocusListener(new appFocusListener());
btOK.addActionListener(new appActionListener());
//btDis.addActionListener(new appActionListener());
//btExcel.addActionListener(new appActionListener());
btEdit.addActionListener(new appActionListener());
boxType.addItemListener(new appItemListener());
boxType.addFocusListener(new appFocusListener());
boxImma.addItemListener(new appItemListener());
boxImma.addFocusListener(new appFocusListener());
boxTask.addItemListener(new appItemListener());
boxTask.addFocusListener(new appFocusListener());
boxName.addItemListener(new appItemListener());
boxName.addFocusListener(new appFocusListener());
}
public void feedBoxAta(){
boxAta.removeAllItems();
boxAta.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllAtas();
for(String str : vecStr){
boxAta.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxType(){
boxType.removeAllItems();
boxType.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllTypes();
for(String str : vecStr){
boxType.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxImmat(){
boxImma.removeAllItems();
boxImma.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllImmats();
for(String str : vecStr){
boxImma.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxTask(){
boxTask.removeAllItems();
boxTask.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllTasks();
for(String str : vecStr){
boxTask.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void feedBoxName(){
boxName.removeAllItems();
boxName.addItem(" ");
Vector<String> vecStr;
try {
vecStr = Manager.getAllNames();
for(String str : vecStr){
boxName.addItem(str);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void display(){
try {
Vector<String> vec = Manager.getAllLinesToString();
GuiDisplay gd = new GuiDisplay(vec);
gd.setVisible(true);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void insertLine(){
String name = panName.getTf().getText();
Date date = new Date();
System.out.println("INIT " + date);
try {
//here
String strDate = panDate.getTf().getText();
System.out.println("pan : " + strDate);
System.out.println("1 : " + date.toString());
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
date = df.parse(strDate);
System.out.println("2 : " + date.toString());
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
labRetour.setText("Date erronnée");
}
String type = panType.getTf().getText();;
String immat = panImmat.getTf().getText();
String ata = panAta.getTf().getText();
String task = panTache.getTf().getText();
int formation = 0;
int execution = 0;
int controle = 0;
int encadrement = 0;
int aprs = 0;
if(panCheck.getCb1().getState()){
formation = 1;
}
if(panCheck.getCb2().getState()){
execution = 1;
}
if(panCheck.getCb3().getState()){
controle = 1;
}
if(panCheck.getCb4().getState()){
encadrement = 1;
}
if(panCheck.getCb5().getState()){
aprs = 1;
}
try {
int ret = Manager.saveLine(name, date, type, immat, ata, task, formation, execution, controle, encadrement, aprs);
if(ret == 1){
labRetour.setText("Ligne insérée!");
panAta.getTf().setText("");
panImmat.getTf().setText("");
panTache.getTf().setText("");
panType.getTf().setText("");
panCheck.getCb1().setState(false);
panCheck.getCb2().setState(false);
panCheck.getCb3().setState(false);
panCheck.getCb4().setState(false);
panCheck.getCb5().setState(false);
feedAll();
}
else{
labRetour.setText("Echec insertion");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static String cutter(String message){
Vector<Integer> vec = new Vector<Integer>();
message = message.replace(" ", "");
String separator = ",";
int start = 0;
int stop = message.indexOf(separator, start);
String ret = "";
while(stop <= message.length() && stop != -1){
ret = message.substring(start, stop);
vec.add(Integer.parseInt(ret));
start = stop + 1;
stop = message.indexOf(separator, start);
}
ret = message.substring(start);
vec.add(Integer.parseInt(ret));
System.out.println("Original : " + vec.toString());
Collections.sort(vec);
System.out.println("SORTED: " + vec.toString());
String atas = "";
for(int integer : vec){
atas += integer + ", ";
}
atas = atas.substring(0, atas.length() - 2);
System.out.println("ATAS " + atas);
return atas;
}
public void feedAll(){
feedBoxAta();
feedBoxType();
feedBoxImmat();
feedBoxTask();
feedBoxName();
}
class appActionListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == btOK){
if(panType.getTf().getText().isEmpty() || panImmat.getTf().getText().isEmpty() || panTache.getTf().getText().isEmpty()){
labRetour.setText("Veuillez renseigner le type, l'immatriculation et la tache.");
}
else{
insertLine();
}
}
// if(e.getSource() == btDis){
// display();
// }
//
// if(e.getSource() == btExcel){
// excelify();
// }
if(e.getSource() == btEdit){
GuiSelect gui = new GuiSelect();
gui.setVisible(true);
}
}
}
class appItemListener implements ItemListener{
@Override
public void itemStateChanged(ItemEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == boxAta && e.getStateChange() == 1 && boxAta.getSelectedIndex() != 0){
String text = panAta.getTf().getText();
String ata = boxAta.getSelectedItem().toString();
ata = ata.substring(0, ata.indexOf(","));
if(text.indexOf(ata) < 0){
if(!text.isEmpty()){
text = text + ", " + ata;
panAta.getTf().setText(cutter(text));
}
else{
panAta.getTf().setText(ata);
}
}
}
if(e.getSource() == boxType && e.getStateChange() == 1 && boxType.getSelectedIndex() != 0){
String type = boxType.getSelectedItem().toString();
panType.getTf().setText("");
panType.getTf().setText(type);
}
if(e.getSource() == boxImma && e.getStateChange() == 1 && boxImma.getSelectedIndex() != 0){
String imma = boxImma.getSelectedItem().toString();
panImmat.getTf().setText("");
panImmat.getTf().setText(imma);
try {
if(Manager.ImmatExists(imma)){
String type = Manager.getTypeFromImmat(imma);
panType.getTf().setText(type);
boxType.setSelectedItem(type);
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
if(e.getSource() == boxTask && e.getStateChange() == 1 && boxTask.getSelectedIndex() != 0){
String Task = boxTask.getSelectedItem().toString();
panTache.getTf().setText("");
panTache.getTf().setText(Task);
}
if(e.getSource() == boxName && e.getStateChange() == 1 && boxName.getSelectedIndex() != 0){
String Name = boxName.getSelectedItem().toString();
panName.getTf().setText("");
panName.getTf().setText(Name);
}
fixGui();
}
}
public void fixGui(){
zoneclient.revalidate();
zoneclient.repaint();
panCheck.repaint();
panCheck.revalidate();
}
class appFocusListener implements FocusListener{
@Override
public void focusGained(FocusEvent arg0) {
// TODO Auto-generated method stub
zoneclient.revalidate();
zoneclient.repaint();
}
@Override
public void focusLost(FocusEvent arg0) {
// TODO Auto-generated method stub
fixGui();
if(arg0.getSource() == btOK){
labRetour.setText("");
}
}
}
}
| 11,623
| 0.665262
| 0.660187
| 468
| 23.844017
| 20.085587
| 124
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 2.724359
| false
| false
|
2
|
4ab140e2162048744b2e5debeb3d3cb81c0c05a2
| 24,189,255,859,520
|
b84d196408a8c54f09a7414a13d3135dbeead7a5
|
/sage-java/src/main/java/health/state/mn/us/sage/action/report/SageReportParamTypeList.java
|
9db2d99e3181ae1b451f839e768fe7bba1e2ea9f
|
[] |
no_license
|
kellyt1/test
|
https://github.com/kellyt1/test
|
c5a4839a98710f5db6094f810550ac167dd7d289
|
b6ed064a3a97a9f2323216fca2148a28c48d901c
|
refs/heads/master
| 2016-08-10T11:26:47.789000
| 2015-11-04T00:30:02
| 2015-11-04T00:30:02
| 45,482,059
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package health.state.mn.us.sage.action.report;
import com.google.common.base.Strings;
import health.state.mn.us.sage.model.report.SageReport;
import health.state.mn.us.sage.model.report.SageReportParam;
import health.state.mn.us.sage.model.report.SageReportParamType;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.framework.EntityQuery;
import javax.persistence.Query;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Created with IntelliJ IDEA.
* User: vangc2
* Date: 3/29/13
* Time: 10:00 AM
* To change this template use File | Settings | File Templates.
*/
@Scope(ScopeType.CONVERSATION)
@Name("sageReportParamTypeList")
public class SageReportParamTypeList extends EntityQuery<SageReportParamType> {
private static final String EJBQL = "select t from SageReportParamType t ";
public SageReportParamTypeList() {
setEjbql(EJBQL);
setMaxResults(25);
}
public List<SageReportParamType> getParamTypeList(){
List<SageReportParamType> returnList = new ArrayList<SageReportParamType>(0);
String hsql = "select distinct t from SageReportParamType t where 1 = 1 ";
try{
hsql = hsql + "order by t.name asc " ;
Query q = getEntityManager().createQuery(hsql);
returnList = q.getResultList();
}catch (Exception e){
System.out.println(">>>Error in query - SageReportParamTypeList");
}
return returnList;
}
public List<SageReportParam> getReportParam(SageReport sageReport){
List<SageReportParam> returnList = new ArrayList<SageReportParam>(0);
try{
if(sageReport != null && sageReport.getReportId() != null && sageReport.getReportId() != 0){
String hsql = "select distinct params from SageReport r " +
"join r.params params " +
"where 1 = 1 ";
hsql = hsql + "and r = :sageReport ";
hsql = hsql + "and params.hidden = false ";
hsql = hsql + "order by params.sortOrder asc ";
Query q = getEntityManager().createQuery(hsql);
q.setParameter("sageReport",sageReport);
returnList = q.getResultList();
if(!returnList.isEmpty()){
for(SageReportParam p: returnList){
if(!Strings.isNullOrEmpty(p.getDefaultValue())){
if (p.getType().getName().equalsIgnoreCase("TEXTFIELD")) {
p.setInputString(p.getDefaultValue());
} else if (p.getType().getName().equalsIgnoreCase("CHECKBOX")) {
p.setInputBoolean(Boolean.valueOf(p.getDefaultValue()));
} else if (p.getType().getName().equalsIgnoreCase("RADIO-TRUE-FALSE")) {
p.setInputBoolean(Boolean.valueOf(p.getDefaultValue()));
} else if (p.getType().getName().equalsIgnoreCase("RADIO-YES-NO")) {
p.setInputBoolean(Boolean.valueOf(p.getDefaultValue()));
} else if (p.getType().getName().equalsIgnoreCase("MENU-ALL-TRUE-FALSE")) {
p.setInputString(p.getDefaultValue());
} else if (p.getType().getName().equalsIgnoreCase("DATE")) {
DateFormat format = new SimpleDateFormat("MM/dd/yyyy");
Date date = format.parse(p.getDefaultValue());
p.setInputDate(date);
} else if (p.getType().getName().equalsIgnoreCase("MENU-SQL-ONE")) {
p.setInputString(p.getDefaultValue());
} else if (p.getType().getName().equalsIgnoreCase("MENU-SQL-MULTI")) {
List<String> inputList = Arrays.asList(p.getDefaultValue().split(","));
Integer count = 0;
for(String s: inputList){
count++;
}
String[] inputString = new String[count];
Integer loop = 0;
for(String s: inputList){
inputString[loop] = s;
}
p.setInputSelect(inputString);
}
}
}
}
}
}catch (Exception e){
System.out.println(">>>Error in query - getReportParam");
}
return returnList;
}
}
|
UTF-8
|
Java
| 4,933
|
java
|
SageReportParamTypeList.java
|
Java
|
[
{
"context": "il.*;\n\n/**\n * Created with IntelliJ IDEA.\n * User: vangc2\n * Date: 3/29/13\n * Time: 10:00 AM\n * To change t",
"end": 596,
"score": 0.9996082186698914,
"start": 590,
"tag": "USERNAME",
"value": "vangc2"
}
] | null |
[] |
package health.state.mn.us.sage.action.report;
import com.google.common.base.Strings;
import health.state.mn.us.sage.model.report.SageReport;
import health.state.mn.us.sage.model.report.SageReportParam;
import health.state.mn.us.sage.model.report.SageReportParamType;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.framework.EntityQuery;
import javax.persistence.Query;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Created with IntelliJ IDEA.
* User: vangc2
* Date: 3/29/13
* Time: 10:00 AM
* To change this template use File | Settings | File Templates.
*/
@Scope(ScopeType.CONVERSATION)
@Name("sageReportParamTypeList")
public class SageReportParamTypeList extends EntityQuery<SageReportParamType> {
private static final String EJBQL = "select t from SageReportParamType t ";
public SageReportParamTypeList() {
setEjbql(EJBQL);
setMaxResults(25);
}
public List<SageReportParamType> getParamTypeList(){
List<SageReportParamType> returnList = new ArrayList<SageReportParamType>(0);
String hsql = "select distinct t from SageReportParamType t where 1 = 1 ";
try{
hsql = hsql + "order by t.name asc " ;
Query q = getEntityManager().createQuery(hsql);
returnList = q.getResultList();
}catch (Exception e){
System.out.println(">>>Error in query - SageReportParamTypeList");
}
return returnList;
}
public List<SageReportParam> getReportParam(SageReport sageReport){
List<SageReportParam> returnList = new ArrayList<SageReportParam>(0);
try{
if(sageReport != null && sageReport.getReportId() != null && sageReport.getReportId() != 0){
String hsql = "select distinct params from SageReport r " +
"join r.params params " +
"where 1 = 1 ";
hsql = hsql + "and r = :sageReport ";
hsql = hsql + "and params.hidden = false ";
hsql = hsql + "order by params.sortOrder asc ";
Query q = getEntityManager().createQuery(hsql);
q.setParameter("sageReport",sageReport);
returnList = q.getResultList();
if(!returnList.isEmpty()){
for(SageReportParam p: returnList){
if(!Strings.isNullOrEmpty(p.getDefaultValue())){
if (p.getType().getName().equalsIgnoreCase("TEXTFIELD")) {
p.setInputString(p.getDefaultValue());
} else if (p.getType().getName().equalsIgnoreCase("CHECKBOX")) {
p.setInputBoolean(Boolean.valueOf(p.getDefaultValue()));
} else if (p.getType().getName().equalsIgnoreCase("RADIO-TRUE-FALSE")) {
p.setInputBoolean(Boolean.valueOf(p.getDefaultValue()));
} else if (p.getType().getName().equalsIgnoreCase("RADIO-YES-NO")) {
p.setInputBoolean(Boolean.valueOf(p.getDefaultValue()));
} else if (p.getType().getName().equalsIgnoreCase("MENU-ALL-TRUE-FALSE")) {
p.setInputString(p.getDefaultValue());
} else if (p.getType().getName().equalsIgnoreCase("DATE")) {
DateFormat format = new SimpleDateFormat("MM/dd/yyyy");
Date date = format.parse(p.getDefaultValue());
p.setInputDate(date);
} else if (p.getType().getName().equalsIgnoreCase("MENU-SQL-ONE")) {
p.setInputString(p.getDefaultValue());
} else if (p.getType().getName().equalsIgnoreCase("MENU-SQL-MULTI")) {
List<String> inputList = Arrays.asList(p.getDefaultValue().split(","));
Integer count = 0;
for(String s: inputList){
count++;
}
String[] inputString = new String[count];
Integer loop = 0;
for(String s: inputList){
inputString[loop] = s;
}
p.setInputSelect(inputString);
}
}
}
}
}
}catch (Exception e){
System.out.println(">>>Error in query - getReportParam");
}
return returnList;
}
}
| 4,933
| 0.528279
| 0.524022
| 133
| 36.090225
| 32.804607
| 108
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.398496
| false
| false
|
2
|
b261302d0a2608e6594a177f5213ca8fc4c9d766
| 23,871,428,300,758
|
eed0403680db6090679bce1ae8584740a126d0ba
|
/src/java/machir/fishandfarm/client/renderer/tileentity/TileEntityStoveRenderer.java
|
c47c22c0912a9d63c73e0ba3116a313042d56dbb
|
[
"MIT"
] |
permissive
|
Searge-DP/FishAndFarm
|
https://github.com/Searge-DP/FishAndFarm
|
3783b003310216ece1f2a08194c440b077cdff28
|
56f9456c858e13b682f15dfbd0e617c12a814bf5
|
refs/heads/master
| 2021-01-15T09:24:05.511000
| 2014-09-14T13:30:01
| 2014-09-14T13:30:01
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package machir.fishandfarm.client.renderer.tileentity;
import machir.fishandfarm.ModInfo;
import machir.fishandfarm.client.model.ModelFryingPan;
import machir.fishandfarm.client.model.ModelStove;
import machir.fishandfarm.tileentity.TileEntityStove;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class TileEntityStoveRenderer extends TileEntitySpecialRenderer implements IItemRenderer {
private ModelStove stove;
private ModelFryingPan fryingPan;
public TileEntityStoveRenderer()
{
stove = new ModelStove();
fryingPan = new ModelFryingPan();
}
public void renderModelAt(TileEntityStove tileEntityStove, double d, double d1, double d2, float f)
{
int i;
if (tileEntityStove.worldObj == null)
{
i = 0;
}
else
{
Block block = tileEntityStove.getBlockType();
i = tileEntityStove.getBlockMetadata();
}
int j = 180;
float xOffset = 1.0F;
float zOffset = 0.0F;
if (i == 2)
{
j = 180;
}
if (i == 3)
{
j = 0;
xOffset = 0.0F;
zOffset = 1.0F;
}
if (i == 4)
{
j = -90;
xOffset = 0.0F;
zOffset = 0.0F;
}
if (i == 5)
{
j = 90;
xOffset = 1.0F;
zOffset = 1.0F;
}
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef((float)d + xOffset, (float)d1 + 1.5F, (float)d2 + zOffset);
GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
if (tileEntityStove.worldObj != null && tileEntityStove.tool != null) {
switch (tileEntityStove.tool) {
case FRYINGPAN:
// Render the fryingPan
renderFryingPan();
break;
default:
break;
}
} else {
renderStove();
}
// Fix textures if it's placed
if (tileEntityStove.worldObj != null) {
this.bindTexture(TextureMap.locationBlocksTexture);
}
// Stop
GL11.glPopMatrix();
}
public void renderStove() {
// Set texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModInfo.STOVE_MODEL_TEXTURE);
// Start for rotation and rendering stove
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
stove.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
// Stop rotation and rendering stove
GL11.glPopMatrix();
}
public void renderFryingPan() {
// Set texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModInfo.FRYINGPAN_MODEL_TEXTURE);
// Start for rotation and rendering frying pan
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
// Render! :3
fryingPan.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
// Stop rotation and rendering stove
GL11.glPopMatrix();
}
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f)
{
renderModelAt((TileEntityStove)tileentity, d, d1, d2, f);
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY:
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef(-0.5F, 1.0F, 0.5F);
// Start the model render
GL11.glPushMatrix();
// Rotation
GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
// Stop the model render
GL11.glPopMatrix();
// Stop
GL11.glPopMatrix();
break;
case EQUIPPED:
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef(-0.0F, 1.5F, 1.0F);
// Start the model render
GL11.glPushMatrix();
// Rotation
GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
// Stop the model render
GL11.glPopMatrix();
// Stop
GL11.glPopMatrix();
break;
case INVENTORY:
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef(-3.0F, -1.0F, -2.0F);
// Start the model render
GL11.glPushMatrix();
// Rotation
GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
// Stop the model render
GL11.glPopMatrix();
// Stop
GL11.glPopMatrix();
break;
default:
break;
}
}
}
|
UTF-8
|
Java
| 5,468
|
java
|
TileEntityStoveRenderer.java
|
Java
|
[] | null |
[] |
package machir.fishandfarm.client.renderer.tileentity;
import machir.fishandfarm.ModInfo;
import machir.fishandfarm.client.model.ModelFryingPan;
import machir.fishandfarm.client.model.ModelStove;
import machir.fishandfarm.tileentity.TileEntityStove;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class TileEntityStoveRenderer extends TileEntitySpecialRenderer implements IItemRenderer {
private ModelStove stove;
private ModelFryingPan fryingPan;
public TileEntityStoveRenderer()
{
stove = new ModelStove();
fryingPan = new ModelFryingPan();
}
public void renderModelAt(TileEntityStove tileEntityStove, double d, double d1, double d2, float f)
{
int i;
if (tileEntityStove.worldObj == null)
{
i = 0;
}
else
{
Block block = tileEntityStove.getBlockType();
i = tileEntityStove.getBlockMetadata();
}
int j = 180;
float xOffset = 1.0F;
float zOffset = 0.0F;
if (i == 2)
{
j = 180;
}
if (i == 3)
{
j = 0;
xOffset = 0.0F;
zOffset = 1.0F;
}
if (i == 4)
{
j = -90;
xOffset = 0.0F;
zOffset = 0.0F;
}
if (i == 5)
{
j = 90;
xOffset = 1.0F;
zOffset = 1.0F;
}
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef((float)d + xOffset, (float)d1 + 1.5F, (float)d2 + zOffset);
GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
if (tileEntityStove.worldObj != null && tileEntityStove.tool != null) {
switch (tileEntityStove.tool) {
case FRYINGPAN:
// Render the fryingPan
renderFryingPan();
break;
default:
break;
}
} else {
renderStove();
}
// Fix textures if it's placed
if (tileEntityStove.worldObj != null) {
this.bindTexture(TextureMap.locationBlocksTexture);
}
// Stop
GL11.glPopMatrix();
}
public void renderStove() {
// Set texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModInfo.STOVE_MODEL_TEXTURE);
// Start for rotation and rendering stove
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
stove.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
// Stop rotation and rendering stove
GL11.glPopMatrix();
}
public void renderFryingPan() {
// Set texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModInfo.FRYINGPAN_MODEL_TEXTURE);
// Start for rotation and rendering frying pan
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
// Render! :3
fryingPan.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
// Stop rotation and rendering stove
GL11.glPopMatrix();
}
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f)
{
renderModelAt((TileEntityStove)tileentity, d, d1, d2, f);
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY:
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef(-0.5F, 1.0F, 0.5F);
// Start the model render
GL11.glPushMatrix();
// Rotation
GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
// Stop the model render
GL11.glPopMatrix();
// Stop
GL11.glPopMatrix();
break;
case EQUIPPED:
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef(-0.0F, 1.5F, 1.0F);
// Start the model render
GL11.glPushMatrix();
// Rotation
GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
// Stop the model render
GL11.glPopMatrix();
// Stop
GL11.glPopMatrix();
break;
case INVENTORY:
// Start
GL11.glPushMatrix();
// Positioning
GL11.glTranslatef(-3.0F, -1.0F, -2.0F);
// Start the model render
GL11.glPushMatrix();
// Rotation
GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F);
// Render the stove
renderStove();
// Stop the model render
GL11.glPopMatrix();
// Stop
GL11.glPopMatrix();
break;
default:
break;
}
}
}
| 5,468
| 0.570227
| 0.534199
| 224
| 23.40625
| 21.585382
| 103
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.473214
| false
| false
|
2
|
236fb7ae4c00bbe6ffb654ff34f2e7e6b3a1dabc
| 29,643,864,277,332
|
712b23fcd80834f0367a68b3ceef0b39b7163df4
|
/BackEnd/jdbc/src/com/capgemini/jdbc/bean/UserBean.java
|
2e81d69c8e99ca2442049a0588e966181072e254
|
[] |
no_license
|
MamathaManchala/TY_CG_HTD_BangloreNovember_JFS_MamathaManchala
|
https://github.com/MamathaManchala/TY_CG_HTD_BangloreNovember_JFS_MamathaManchala
|
66c70625ecdc2b626b9952d03eccdec447a75c40
|
1f14961656cd6766d288f1534b033739f5768ef1
|
refs/heads/master
| 2023-01-12T08:47:46.084000
| 2020-01-28T02:52:14
| 2020-01-28T02:52:14
| 225,846,293
| 0
| 0
| null | false
| 2023-01-07T14:35:45
| 2019-12-04T11:01:52
| 2020-01-28T02:52:44
| 2023-01-07T14:35:44
| 51,076
| 0
| 0
| 249
|
Java
| false
| false
|
package com.capgemini.jdbc.bean;
import java.io.Serializable;
import lombok.Data;
//@Data//no need to write all the set and get methods
@Data
public class UserBean implements Serializable {
private int userid;
private String username;
private String email;
private String password;
private String address;
@Override
public String toString() {
return "UserBean [userid=" + userid + ", username=" + username + ", email=" + email + ", password=" + password
+ ", address=" + address + "]";
}
}
|
UTF-8
|
Java
| 516
|
java
|
UserBean.java
|
Java
|
[
{
"context": "urn \"UserBean [userid=\" + userid + \", username=\" + username + \", email=\" + email + \", password=\" + password\n\t",
"end": 417,
"score": 0.9989408850669861,
"start": 409,
"tag": "USERNAME",
"value": "username"
},
{
"context": " + username + \", email=\" + email + \", password=\" + password\n\t\t\t\t+ \", address=\" + address + \"]\";\n\t}\n\t\n\t\n\t\n\t\n\n}",
"end": 465,
"score": 0.9633212089538574,
"start": 457,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
package com.capgemini.jdbc.bean;
import java.io.Serializable;
import lombok.Data;
//@Data//no need to write all the set and get methods
@Data
public class UserBean implements Serializable {
private int userid;
private String username;
private String email;
private String password;
private String address;
@Override
public String toString() {
return "UserBean [userid=" + userid + ", username=" + username + ", email=" + email + ", password=" + <PASSWORD>
+ ", address=" + address + "]";
}
}
| 518
| 0.69186
| 0.69186
| 25
| 19.639999
| 24.386684
| 112
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.24
| false
| false
|
2
|
e4598e6b71e0bf5492db1836936f1dbd59f15d7b
| 29,643,864,280,948
|
86a8c7928d10714cf02073404c33ca607aa0522a
|
/NetBeansProjects/NetBeansProjects3/Java2curs3LoginMD5Password/src/service/LoginService.java
|
310f25064e41d77926559b7a718652e29f165e97
|
[] |
no_license
|
stefanbanu/telacad-proiecte
|
https://github.com/stefanbanu/telacad-proiecte
|
84cc403823086860320c4ea15ad62c810c3ca869
|
fba0e1ccb1799156a613eae1485f7d305f979ecb
|
refs/heads/master
| 2021-01-11T06:09:24.070000
| 2016-10-29T17:34:45
| 2016-10-29T17:34:45
| 72,298,229
| 0
| 1
| null | false
| 2020-06-16T02:22:50
| 2016-10-29T17:05:02
| 2016-10-29T17:25:09
| 2020-06-16T02:22:48
| 122,649
| 0
| 0
| 1
|
Java
| false
| false
|
/*
* 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 service;
import dao.UserDao;
import java.util.List;
import model.User;
import tx.TransactionManager;
import utils.Utils;
/**
*
* @author student
*/
public class LoginService {
private UserDao userDao;
private LoginService(){
userDao = new UserDao();
}
private static final class SingletonHolder{
private static final LoginService SINGLETON = new LoginService();
}
public static LoginService getInstance(){
return SingletonHolder.SINGLETON;
}
public User login(String username, String password) {
try {
TransactionManager.getInstance().startTransaction();
User user = userDao.findUserByUsername(username);
if (user != null) {
password = Utils.encryptPasswordMD5(password);
if (user.getPassword().equals(password)) {
return user;
}
}
TransactionManager.getInstance().commit();
} catch (Exception e) {
TransactionManager.getInstance().rollback();
}
return null;
}
public boolean register(String username, String password){
try{
TransactionManager.getInstance().startTransaction();
User user = userDao.findUserByUsername(username);
if(user == null){
password = Utils.encryptPasswordMD5(password);
user = new User();
user.setUsername(username);
user.setPassword(password);
userDao.adaugaUser(user);
TransactionManager.getInstance().commit();
return true;
}
}catch(Exception e){
TransactionManager.getInstance().rollback();
}
return false;
}
public List<User> getAllOtherUsers(int userID){
List<User> users = null;
try{
TransactionManager.getInstance().startTransaction();
users = userDao.getAllOtherUsers(userID);
TransactionManager.getInstance().commit();
}catch(Exception e){
TransactionManager.getInstance().rollback();
}
return users;
}
}
|
UTF-8
|
Java
| 2,407
|
java
|
LoginService.java
|
Java
|
[
{
"context": "ionManager;\nimport utils.Utils;\n\n/**\n *\n * @author student\n */\npublic class LoginService {\n private UserD",
"end": 342,
"score": 0.9979825019836426,
"start": 335,
"tag": "USERNAME",
"value": "student"
},
{
"context": "= null) {\n password = Utils.encryptPasswordMD5(password);\n if (user.getPassword()",
"end": 995,
"score": 0.622811496257782,
"start": 984,
"tag": "PASSWORD",
"value": "PasswordMD5"
},
{
"context": " if(user == null){\n password = Utils.encryptPasswordMD5(password);\n use",
"end": 1582,
"score": 0.5569575428962708,
"start": 1577,
"tag": "PASSWORD",
"value": "Utils"
},
{
"context": "f(user == null){\n password = Utils.encryptPasswordMD5(password);\n user = new User();\n",
"end": 1598,
"score": 0.5549078583717346,
"start": 1583,
"tag": "PASSWORD",
"value": "encryptPassword"
},
{
"context": " password = Utils.encryptPasswordMD5(password);\n user = new User();\n ",
"end": 1601,
"score": 0.681730329990387,
"start": 1600,
"tag": "PASSWORD",
"value": "5"
},
{
"context": "er = new User();\n user.setUsername(username);\n user.setPassword(password);\n ",
"end": 1689,
"score": 0.6418770551681519,
"start": 1681,
"tag": "USERNAME",
"value": "username"
}
] | 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 service;
import dao.UserDao;
import java.util.List;
import model.User;
import tx.TransactionManager;
import utils.Utils;
/**
*
* @author student
*/
public class LoginService {
private UserDao userDao;
private LoginService(){
userDao = new UserDao();
}
private static final class SingletonHolder{
private static final LoginService SINGLETON = new LoginService();
}
public static LoginService getInstance(){
return SingletonHolder.SINGLETON;
}
public User login(String username, String password) {
try {
TransactionManager.getInstance().startTransaction();
User user = userDao.findUserByUsername(username);
if (user != null) {
password = Utils.encrypt<PASSWORD>(password);
if (user.getPassword().equals(password)) {
return user;
}
}
TransactionManager.getInstance().commit();
} catch (Exception e) {
TransactionManager.getInstance().rollback();
}
return null;
}
public boolean register(String username, String password){
try{
TransactionManager.getInstance().startTransaction();
User user = userDao.findUserByUsername(username);
if(user == null){
password = <PASSWORD>.<PASSWORD>MD5(password);
user = new User();
user.setUsername(username);
user.setPassword(password);
userDao.adaugaUser(user);
TransactionManager.getInstance().commit();
return true;
}
}catch(Exception e){
TransactionManager.getInstance().rollback();
}
return false;
}
public List<User> getAllOtherUsers(int userID){
List<User> users = null;
try{
TransactionManager.getInstance().startTransaction();
users = userDao.getAllOtherUsers(userID);
TransactionManager.getInstance().commit();
}catch(Exception e){
TransactionManager.getInstance().rollback();
}
return users;
}
}
| 2,406
| 0.589946
| 0.589115
| 81
| 28.716049
| 22.265644
| 79
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.481481
| false
| false
|
2
|
e9e9b431ef0c4afd34b07d4ead75fd34bce22929
| 23,880,018,169,777
|
32e7ef09ea9748e6c84f0ffeb08b7e0a16839ca6
|
/src/test/java/com/bitpanda/launcher/SerenityStoriesLauncher.java
|
5c0d153e63912a5228995016d50cb8a692965a92
|
[] |
no_license
|
bodaganj/BitpandaWebsiteTesting
|
https://github.com/bodaganj/BitpandaWebsiteTesting
|
9b0849487564289de35a3025fde0eccc2f5d5bdf
|
08360349b60ca1e259b71e09d9f5b89d1f1ea592
|
refs/heads/master
| 2023-08-27T03:26:42.818000
| 2021-10-08T19:52:35
| 2021-10-08T19:52:35
| 390,124,045
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bitpanda.launcher;
import net.serenitybdd.jbehave.SerenityStories;
public class SerenityStoriesLauncher extends SerenityStories {
}
|
UTF-8
|
Java
| 147
|
java
|
SerenityStoriesLauncher.java
|
Java
|
[] | null |
[] |
package com.bitpanda.launcher;
import net.serenitybdd.jbehave.SerenityStories;
public class SerenityStoriesLauncher extends SerenityStories {
}
| 147
| 0.843537
| 0.843537
| 7
| 20
| 24.36039
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.285714
| false
| false
|
2
|
eb18f9a1fc8e2ffa96c4ebbea2983fbebdb905e3
| 31,035,433,746,779
|
3a7d2ff48d479c08d69e37ebba5a44e207ea89e5
|
/src/com/gulanb/echoserver/EchoServer.java
|
2a26b880cacbf0fd35eb4d1f6fb5e4906eeb7f3f
|
[] |
no_license
|
gulanb/Echo-server
|
https://github.com/gulanb/Echo-server
|
4800655f9f3eacf282e8c4da29ebc74db48298be
|
8247e06eb7e8da4dbd4befc5856703eef148893f
|
HEAD
| 2016-08-06T05:00:00.450000
| 2015-03-30T16:23:57
| 2015-03-30T16:23:57
| 33,134,275
| 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 com.gulanb.echoserver;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
/**
*
* @author gulan
*/
public class EchoServer {
private int port;
public EchoServer(int port) {
this.port=port;
}
public void run() {
ServerSocket serversocket = null;
try {
serversocket = new ServerSocket(port);
} catch (IOException ex) {
System.out.println("Server cannot connect at port 10009: " + ex.getMessage());
}
Socket clientsocket = null;
System.out.println("Waiting for connection...");
try {
clientsocket = serversocket.accept();
} catch (IOException ex) {
System.out.println("Accept failed: " + ex.getMessage());
}
if (clientsocket != null) {
System.out.println("Connection successful!: " + clientsocket.getInetAddress().toString());
InputStream in = null;
try {
in = clientsocket.getInputStream();
} catch (IOException ex) {
System.out.println("Cannot read input stream: " + ex.getMessage());
}
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
try {
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException ex) {
System.out.println("Read error: " + ex.getMessage());
}
}
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}
|
UTF-8
|
Java
| 2,065
|
java
|
EchoServer.java
|
Java
|
[
{
"context": "t;\r\nimport java.net.Socket;\r\n\r\n/**\r\n *\r\n * @author gulan\r\n */\r\npublic class EchoServer {\r\n private int ",
"end": 432,
"score": 0.9989509582519531,
"start": 427,
"tag": "USERNAME",
"value": "gulan"
}
] | 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 com.gulanb.echoserver;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
/**
*
* @author gulan
*/
public class EchoServer {
private int port;
public EchoServer(int port) {
this.port=port;
}
public void run() {
ServerSocket serversocket = null;
try {
serversocket = new ServerSocket(port);
} catch (IOException ex) {
System.out.println("Server cannot connect at port 10009: " + ex.getMessage());
}
Socket clientsocket = null;
System.out.println("Waiting for connection...");
try {
clientsocket = serversocket.accept();
} catch (IOException ex) {
System.out.println("Accept failed: " + ex.getMessage());
}
if (clientsocket != null) {
System.out.println("Connection successful!: " + clientsocket.getInetAddress().toString());
InputStream in = null;
try {
in = clientsocket.getInputStream();
} catch (IOException ex) {
System.out.println("Cannot read input stream: " + ex.getMessage());
}
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
try {
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException ex) {
System.out.println("Read error: " + ex.getMessage());
}
}
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}
| 2,065
| 0.546247
| 0.543826
| 71
| 27.084507
| 24.517166
| 102
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.408451
| false
| false
|
2
|
4a413cd7bb08fff53854e94decdae9096fc532ff
| 6,030,134,150,871
|
1f560ffc505878084324f311d5b93bed6d6870a3
|
/app/src/main/java/com/example/instagrammemeshare/MainActivity.java
|
9f0c9a7b7b984aaeb51c05b4126044e28fbaa892
|
[] |
no_license
|
Rohitohlyan66/Instagram_Bottomsheet
|
https://github.com/Rohitohlyan66/Instagram_Bottomsheet
|
d97d560307ef0be4092f5d6d46cbb5139d753adb
|
d3d3ee1d1b99538552cc38ddb513b9173f47a266
|
refs/heads/master
| 2022-12-20T07:42:15.467000
| 2020-10-08T11:23:53
| 2020-10-08T11:23:53
| 301,772,213
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.instagrammemeshare;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowId;
import android.view.WindowManager;
import android.widget.Adapter;
import android.widget.Button;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
Button share;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
share = findViewById(R.id.share);
//click on Share Button------------------------>
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showBottomSheet();
}
});
}
//Showing BottomSheetDialog------------------------>
private void showBottomSheet() {
View view = getLayoutInflater().inflate(R.layout.bottom_sheet_layout, null);
BottomSheetDialog dialog = new BottomSheetDialog(this);
dialog.setContentView(view);
dialog.show();
dialog.getWindow().setNavigationBarColor(getResources().getColor(R.color.white));
List<Model> data = new ArrayList<>();
//Recycler View------------->
RecyclerView recyclerView = dialog.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
data.add(new Model(R.drawable.one, "MARIA", "_maria_"));
data.add(new Model(R.drawable.two, "linda", "Linda202"));
data.add(new Model(R.drawable.three, "QUEEN", "queen202"));
data.add(new Model(R.drawable.four, "Angel", "angel_90"));
data.add(new Model(R.drawable.one, "MARIA", "_maria_"));
data.add(new Model(R.drawable.two, "linda", "Linda202"));
data.add(new Model(R.drawable.three, "QUEEN", "queen202"));
data.add(new Model(R.drawable.four, "Angel", "angel_90"));
data.add(new Model(R.drawable.one, "MARIA", "_maria_"));
data.add(new Model(R.drawable.two, "linda", "Linda202"));
data.add(new Model(R.drawable.three, "QUEEN", "queen202"));
data.add(new Model(R.drawable.four, "Angel", "angel_90"));
RecyclerAdapter adapter = new RecyclerAdapter(data, this);
recyclerView.setAdapter(adapter);
}
}
|
UTF-8
|
Java
| 2,655
|
java
|
MainActivity.java
|
Java
|
[
{
"context": "s));\n\n data.add(new Model(R.drawable.one, \"MARIA\", \"_maria_\"));\n data.add(new Model(R.drawa",
"end": 1786,
"score": 0.9853873252868652,
"start": 1781,
"tag": "NAME",
"value": "MARIA"
},
{
"context": "));\n data.add(new Model(R.drawable.three, \"QUEEN\", \"queen202\"));\n data.add(new Model(R.dr",
"end": 1917,
"score": 0.7401623129844666,
"start": 1914,
"tag": "NAME",
"value": "QUE"
},
{
"context": "\"));\n data.add(new Model(R.drawable.four, \"Angel\", \"angel_90\"));\n data.add(new Model(R.draw",
"end": 1986,
"score": 0.9802866578102112,
"start": 1981,
"tag": "NAME",
"value": "Angel"
},
{
"context": "0\"));\n data.add(new Model(R.drawable.one, \"MARIA\", \"_maria_\"));\n data.add(new Model(R.drawa",
"end": 2052,
"score": 0.9813870191574097,
"start": 2047,
"tag": "NAME",
"value": "MARIA"
},
{
"context": "\"));\n data.add(new Model(R.drawable.four, \"Angel\", \"angel_90\"));\n data.add(new Model(R.draw",
"end": 2252,
"score": 0.9973773956298828,
"start": 2247,
"tag": "NAME",
"value": "Angel"
},
{
"context": "0\"));\n data.add(new Model(R.drawable.one, \"MARIA\", \"_maria_\"));\n data.add(new Model(R.drawa",
"end": 2318,
"score": 0.9989296197891235,
"start": 2313,
"tag": "NAME",
"value": "MARIA"
},
{
"context": "_\"));\n data.add(new Model(R.drawable.two, \"linda\", \"Linda202\"));\n data.add(new Model(R.draw",
"end": 2383,
"score": 0.9911987781524658,
"start": 2378,
"tag": "NAME",
"value": "linda"
},
{
"context": "\"));\n data.add(new Model(R.drawable.four, \"Angel\", \"angel_90\"));\n\n\n RecyclerAdapter adapter",
"end": 2518,
"score": 0.9974881410598755,
"start": 2513,
"tag": "NAME",
"value": "Angel"
}
] | null |
[] |
package com.example.instagrammemeshare;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowId;
import android.view.WindowManager;
import android.widget.Adapter;
import android.widget.Button;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
Button share;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
share = findViewById(R.id.share);
//click on Share Button------------------------>
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showBottomSheet();
}
});
}
//Showing BottomSheetDialog------------------------>
private void showBottomSheet() {
View view = getLayoutInflater().inflate(R.layout.bottom_sheet_layout, null);
BottomSheetDialog dialog = new BottomSheetDialog(this);
dialog.setContentView(view);
dialog.show();
dialog.getWindow().setNavigationBarColor(getResources().getColor(R.color.white));
List<Model> data = new ArrayList<>();
//Recycler View------------->
RecyclerView recyclerView = dialog.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
data.add(new Model(R.drawable.one, "MARIA", "_maria_"));
data.add(new Model(R.drawable.two, "linda", "Linda202"));
data.add(new Model(R.drawable.three, "QUEEN", "queen202"));
data.add(new Model(R.drawable.four, "Angel", "angel_90"));
data.add(new Model(R.drawable.one, "MARIA", "_maria_"));
data.add(new Model(R.drawable.two, "linda", "Linda202"));
data.add(new Model(R.drawable.three, "QUEEN", "queen202"));
data.add(new Model(R.drawable.four, "Angel", "angel_90"));
data.add(new Model(R.drawable.one, "MARIA", "_maria_"));
data.add(new Model(R.drawable.two, "linda", "Linda202"));
data.add(new Model(R.drawable.three, "QUEEN", "queen202"));
data.add(new Model(R.drawable.four, "Angel", "angel_90"));
RecyclerAdapter adapter = new RecyclerAdapter(data, this);
recyclerView.setAdapter(adapter);
}
}
| 2,655
| 0.65951
| 0.650471
| 82
| 31.390244
| 27.235538
| 89
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.841463
| false
| false
|
2
|
f0f230e5177ec4eff0900b2ca50da0e35e3ff49f
| 6,038,724,018,993
|
aa167c72e863a9ee830e5aa71836bf62b8f05661
|
/Tetris_re/src/Renderer.java
|
c55c7b35f2cd314255090cdd57183a3dda72f88e
|
[] |
no_license
|
askldfghj/MyTetris
|
https://github.com/askldfghj/MyTetris
|
6f12664fc4d8d65ef7a1dffb60a991dfc9c9b93c
|
828888b4054faf87799fa2bf2d958e5bdfd7dbea
|
refs/heads/master
| 2021-01-13T03:14:46.643000
| 2017-01-01T11:11:25
| 2017-01-01T11:11:25
| 77,461,368
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
public class Renderer extends JPanel {
private static final long serialVersionUID = 1L;
private static final int SCENE1 = 1;
private static final int SCENE2 = 2;
private static final int SCENE3 = 3;
private Image[] mBlocks;
private Image mEndBlock;
private Image mBackGround;
private Image mPauseImage;
private Image mTitleImage;
private Image mStartButton;
private Image mStartButton_N;
private Image mExitButton;
private Image mExitButton_N;
private Image mArrowImage;
private Image[] mPerfectBlocks;
private Image[] mNumbers;
private Image[] mLines;
private Image[] mRanks;
private Image mResultBackGround;
private Image mPressEnterImage;
private int mHoldNum;
private int mNextNum;
private int mLevel;
private int mBlockCount;
private int mHundredNum;
private int mTenNum;
private int mOneNum;
private boolean mFlagPausePress;
private int mSceneStatus;
private int mOneAndNine;
private boolean mFlagStart;
private int[] mEraseLineResult;
private int line1_one;
private int line1_ten;
private int line1_hund;
private int line2_one;
private int line2_ten;
private int line2_hund;
private int line3_one;
private int line3_ten;
private int line3_hund;
private int line4_one;
private int line4_ten;
private int line4_hund;
private int mScore;
private int[][] mFixedArr;
public Renderer()
{
mBlocks = new Image[7];
mNumbers = new Image[10];
mPerfectBlocks = new Image[8];
mLines = new Image[4];
mRanks = new Image[7];
mHoldNum = 7;
mNextNum = 0;
mLevel = 1;
mHundredNum = 0;
mTenNum = 0;
mOneNum = 0;
mOneAndNine = 0;
mFlagPausePress = false;
mScore = 0;
ImageIcon b1 = new ImageIcon("images/block1.jpg");
ImageIcon b2 = new ImageIcon("images/block2.jpg");
ImageIcon b3 = new ImageIcon("images/block3.jpg");
ImageIcon b4 = new ImageIcon("images/block4.jpg");
ImageIcon b5 = new ImageIcon("images/block5.jpg");
ImageIcon b6 = new ImageIcon("images/block6.jpg");
ImageIcon b7 = new ImageIcon("images/block7.jpg");
ImageIcon pa = new ImageIcon("images/pause.png");
ImageIcon i = new ImageIcon("images/I.jpg");
ImageIcon o = new ImageIcon("images/O.jpg");
ImageIcon l = new ImageIcon("images/L.jpg");
ImageIcon j = new ImageIcon("images/J.jpg");
ImageIcon s = new ImageIcon("images/S.jpg");
ImageIcon z = new ImageIcon("images/Z.jpg");
ImageIcon t = new ImageIcon("images/T.jpg");
ImageIcon q = new ImageIcon("images/Q.jpg");
ImageIcon num0 = new ImageIcon("images/0.png");
ImageIcon num1 = new ImageIcon("images/1.png");
ImageIcon num2 = new ImageIcon("images/2.png");
ImageIcon num3 = new ImageIcon("images/3.png");
ImageIcon num4 = new ImageIcon("images/4.png");
ImageIcon num5 = new ImageIcon("images/5.png");
ImageIcon num6 = new ImageIcon("images/6.png");
ImageIcon num7 = new ImageIcon("images/7.png");
ImageIcon num8 = new ImageIcon("images/8.png");
ImageIcon num9 = new ImageIcon("images/9.png");
ImageIcon end = new ImageIcon("images/end_block.jpg");
ImageIcon back = new ImageIcon("images/BackGround2.jpg");
ImageIcon Titled = new ImageIcon("images/TITLE.jpg");
ImageIcon START = new ImageIcon("images/start.png");
ImageIcon N_START = new ImageIcon("images/n_start.png");
ImageIcon EXIT = new ImageIcon("images/exit.png");
ImageIcon N_EXIT = new ImageIcon("images/n_exit.png");
ImageIcon ARROW = new ImageIcon("images/arrow.png");
ImageIcon one_line = new ImageIcon("images/line_1.png");
ImageIcon two_line = new ImageIcon("images/line_2.png");
ImageIcon three_line = new ImageIcon("images/line_3.png");
ImageIcon four_line = new ImageIcon("images/line_4.png");
ImageIcon R_S = new ImageIcon("images/S.png");
ImageIcon R_A = new ImageIcon("images/A.png");
ImageIcon R_B = new ImageIcon("images/B.png");
ImageIcon R_C = new ImageIcon("images/C.png");
ImageIcon R_D = new ImageIcon("images/D.png");
ImageIcon R_E = new ImageIcon("images/E.png");
ImageIcon R_F = new ImageIcon("images/F.png");
ImageIcon EP = new ImageIcon("images/phase3.jpg");
ImageIcon Penter = new ImageIcon("images/press_enter.png");
mBlocks[0] = b1.getImage();
mBlocks[1] = b2.getImage();
mBlocks[2] = b3.getImage();
mBlocks[3] = b4.getImage();
mBlocks[4] = b5.getImage();
mBlocks[5] = b6.getImage();
mBlocks[6] = b7.getImage();
mPauseImage = pa.getImage();
mPerfectBlocks[0] = i.getImage();
mPerfectBlocks[1] = o.getImage();
mPerfectBlocks[2] = l.getImage();
mPerfectBlocks[3] = j.getImage();
mPerfectBlocks[4] = s.getImage();
mPerfectBlocks[5] = z.getImage();
mPerfectBlocks[6] = t.getImage();
mPerfectBlocks[7] = q.getImage();
mNumbers[0] = num0.getImage();
mNumbers[1] = num1.getImage();
mNumbers[2] = num2.getImage();
mNumbers[3] = num3.getImage();
mNumbers[4] = num4.getImage();
mNumbers[5] = num5.getImage();
mNumbers[6] = num6.getImage();
mNumbers[7] = num7.getImage();
mNumbers[8] = num8.getImage();
mNumbers[9] = num9.getImage();
mLines[0] = one_line.getImage();
mLines[1] = two_line.getImage();
mLines[2] = three_line.getImage();
mLines[3] = four_line.getImage();
mRanks[0] = R_S.getImage();
mRanks[1] = R_A.getImage();
mRanks[2] = R_B.getImage();
mRanks[3] = R_C.getImage();
mRanks[4] = R_D.getImage();
mRanks[5] = R_E.getImage();
mRanks[6] = R_F.getImage();
mResultBackGround = EP.getImage();
mPressEnterImage = Penter.getImage();
mEndBlock = end.getImage();
mBackGround = back.getImage();
mTitleImage = Titled.getImage();
mStartButton = START.getImage();
mStartButton_N = N_START.getImage();
mExitButton = EXIT.getImage();
mExitButton_N = N_EXIT.getImage();
mArrowImage = ARROW.getImage();
}
public void Init(){
mHoldNum = 7;
mNextNum = 0;
mLevel = 1;
mHundredNum = 0;
mTenNum = 0;
mOneNum = 0;
mOneAndNine = 0;
mFlagPausePress = false;
mEraseLineResult = new int[5];
mScore = 0;
mFlagStart = true;
}
public void ArrangeScoreBoard() {
if (mBlockCount <= 999)
{
mHundredNum = mBlockCount / 100;
mBlockCount -= mHundredNum * 100;
mTenNum = mBlockCount / 10;
mOneNum = mBlockCount - mTenNum * 10;
}
else
{
mHundredNum = 9;
mTenNum = 9;
mOneNum = 9;
}
if (mHundredNum < 9)
{
mLevel = mHundredNum + 1;
}
else
{
mLevel = mHundredNum;
mOneAndNine = 9;
}
}
public void ResultBoardArrange(){
line1_hund = mEraseLineResult[0] / 100;
mEraseLineResult[0] = mEraseLineResult[0]-(line1_hund*100);
line1_ten = mEraseLineResult[0] / 10;
line1_one = mEraseLineResult[0]-(line1_ten*10);
line2_hund = mEraseLineResult[1] / 100;
mEraseLineResult[1] = mEraseLineResult[1]-(line2_hund*100);
line2_ten = mEraseLineResult[1] / 10;
line2_one = mEraseLineResult[1] -(line2_ten*10);
line3_hund = mEraseLineResult[2] / 100;
mEraseLineResult[2] = mEraseLineResult[2]-(line3_hund*100);
line3_ten = mEraseLineResult[2] / 10;
line3_one = mEraseLineResult[2]-(line3_ten*10);
line4_hund = mEraseLineResult[3] / 100;
mEraseLineResult[3] = mEraseLineResult[3]-(line4_hund*100);
line4_ten = mEraseLineResult[3] / 10;
line4_one = mEraseLineResult[3]-(line4_ten*10);
mScore = mEraseLineResult[4];
}
public void SetFixedArr(int[][] fixedarr)
{
mFixedArr = fixedarr;
}
public void paint(Graphics g) {
switch(mSceneStatus)
{
case SCENE1 :
Scene1Render(g);
break;
case SCENE2 :
Scene2Render(g);
break;
case SCENE3 :
Scene3Render(g);
break;
}
}
public void SetNextBlockNum(int num)
{
mNextNum = num;
}
public void SetHoldBlockNum(int num)
{
mHoldNum = num;
}
public void SetBlockCount(int num)
{
mBlockCount = num;
}
public void SetGameStatus(boolean stat)
{
mFlagPausePress = stat;
}
public void SetSceneStatus(int scene_num)
{
mSceneStatus = scene_num;
}
public void SetStartFlag(boolean start_status)
{
mFlagStart = start_status;
}
public void SetErasedLineResult(int[] result)
{
mEraseLineResult = result;
}
void Scene1Render(Graphics g)
{
g.drawImage(mTitleImage, 0, 0, null);
if (mFlagStart){
g.drawImage(mStartButton, 513, 424, null);
g.drawImage(mExitButton_N, 578, 525, null);
g.drawImage(mArrowImage, 460, 433, null);
}
else {
g.drawImage(mStartButton_N, 541, 430, null);
g.drawImage(mExitButton, 565, 517, null);
g.drawImage(mArrowImage, 510, 529, null);
}
}
void Scene2Render(Graphics g)
{
ArrangeScoreBoard();
g.drawImage(mBackGround, 0, 0, null);
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 10; j++) {
if (mFixedArr[i][j] == 1) {
g.drawImage(mBlocks[0], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 2) {
g.drawImage(mBlocks[1], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 3) {
g.drawImage(mBlocks[2], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 4) {
g.drawImage(mBlocks[3], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 5) {
g.drawImage(mBlocks[4], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 6) {
g.drawImage(mBlocks[5], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 7) {
g.drawImage(mBlocks[6], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 8) {
g.drawImage(mEndBlock, j * 32 + 464, i * 32 + 64, null);
} else if ((mFixedArr[i][j] != 0)
|| (mFixedArr[i][j] > 8)) {
g.drawImage(mEndBlock, j * 32 + 464, i * 32 + 64, null);
}
}
}
g.drawImage(mPerfectBlocks[mNextNum], 794, 64, null);
g.drawImage(mPerfectBlocks[mHoldNum], 314, 64, null);
g.drawImage(mNumbers[mLevel], 891, 436, null);
g.drawImage(mNumbers[mLevel], 829, 626, null);
g.drawImage(mNumbers[mOneAndNine], 859, 626, null);
g.drawImage(mNumbers[mOneAndNine], 889, 626, null);
g.drawImage(mNumbers[mHundredNum], 829, 550, null);
g.drawImage(mNumbers[mTenNum], 859, 550, null);
g.drawImage(mNumbers[mOneNum], 889, 550, null);
if (mFlagPausePress) {
g.drawImage(mPauseImage, 330, 186, null);
}
}
void Scene3Render(Graphics g)
{
g.drawImage(mResultBackGround, 0, 0, null);
g.drawImage(mLines[0], 350, 250, null);
g.drawImage(mLines[1], 350, 310, null);
g.drawImage(mLines[2], 350, 370, null);
g.drawImage(mLines[3], 350, 430, null);
g.drawImage(mNumbers[line1_hund], 490, 258, null);
g.drawImage(mNumbers[line1_ten], 515, 258, null);
g.drawImage(mNumbers[line1_one], 540, 258, null);
g.drawImage(mNumbers[line2_hund], 490, 318, null);
g.drawImage(mNumbers[line2_ten], 515, 318, null);
g.drawImage(mNumbers[line2_one], 540, 318, null);
g.drawImage(mNumbers[line3_hund], 490, 378, null);
g.drawImage(mNumbers[line3_ten], 515, 378, null);
g.drawImage(mNumbers[line3_one], 540, 378, null);
g.drawImage(mNumbers[line4_hund], 490, 438, null);
g.drawImage(mNumbers[line4_ten], 515, 438, null);
g.drawImage(mNumbers[line4_one], 540, 438, null);
g.drawImage(mPressEnterImage, 450, 600, null);
if(mScore < 300){
g.drawImage(mRanks[6], 750, 300, null);
}
else if (mScore < 700){
g.drawImage(mRanks[5], 750, 300, null);
}
else if (mScore < 1200){
g.drawImage(mRanks[4], 750, 300, null);
}
else if (mScore < 3000){
g.drawImage(mRanks[3], 750, 300, null);
}
else if (mScore < 5000){
g.drawImage(mRanks[2], 750, 300, null);
}
else if (mScore < 9000){
g.drawImage(mRanks[1], 750, 300, null);
}
else if (mScore >= 9000){
g.drawImage(mRanks[0], 750, 300, null);
}
}
}
|
UTF-8
|
Java
| 11,595
|
java
|
Renderer.java
|
Java
|
[] | null |
[] |
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
public class Renderer extends JPanel {
private static final long serialVersionUID = 1L;
private static final int SCENE1 = 1;
private static final int SCENE2 = 2;
private static final int SCENE3 = 3;
private Image[] mBlocks;
private Image mEndBlock;
private Image mBackGround;
private Image mPauseImage;
private Image mTitleImage;
private Image mStartButton;
private Image mStartButton_N;
private Image mExitButton;
private Image mExitButton_N;
private Image mArrowImage;
private Image[] mPerfectBlocks;
private Image[] mNumbers;
private Image[] mLines;
private Image[] mRanks;
private Image mResultBackGround;
private Image mPressEnterImage;
private int mHoldNum;
private int mNextNum;
private int mLevel;
private int mBlockCount;
private int mHundredNum;
private int mTenNum;
private int mOneNum;
private boolean mFlagPausePress;
private int mSceneStatus;
private int mOneAndNine;
private boolean mFlagStart;
private int[] mEraseLineResult;
private int line1_one;
private int line1_ten;
private int line1_hund;
private int line2_one;
private int line2_ten;
private int line2_hund;
private int line3_one;
private int line3_ten;
private int line3_hund;
private int line4_one;
private int line4_ten;
private int line4_hund;
private int mScore;
private int[][] mFixedArr;
public Renderer()
{
mBlocks = new Image[7];
mNumbers = new Image[10];
mPerfectBlocks = new Image[8];
mLines = new Image[4];
mRanks = new Image[7];
mHoldNum = 7;
mNextNum = 0;
mLevel = 1;
mHundredNum = 0;
mTenNum = 0;
mOneNum = 0;
mOneAndNine = 0;
mFlagPausePress = false;
mScore = 0;
ImageIcon b1 = new ImageIcon("images/block1.jpg");
ImageIcon b2 = new ImageIcon("images/block2.jpg");
ImageIcon b3 = new ImageIcon("images/block3.jpg");
ImageIcon b4 = new ImageIcon("images/block4.jpg");
ImageIcon b5 = new ImageIcon("images/block5.jpg");
ImageIcon b6 = new ImageIcon("images/block6.jpg");
ImageIcon b7 = new ImageIcon("images/block7.jpg");
ImageIcon pa = new ImageIcon("images/pause.png");
ImageIcon i = new ImageIcon("images/I.jpg");
ImageIcon o = new ImageIcon("images/O.jpg");
ImageIcon l = new ImageIcon("images/L.jpg");
ImageIcon j = new ImageIcon("images/J.jpg");
ImageIcon s = new ImageIcon("images/S.jpg");
ImageIcon z = new ImageIcon("images/Z.jpg");
ImageIcon t = new ImageIcon("images/T.jpg");
ImageIcon q = new ImageIcon("images/Q.jpg");
ImageIcon num0 = new ImageIcon("images/0.png");
ImageIcon num1 = new ImageIcon("images/1.png");
ImageIcon num2 = new ImageIcon("images/2.png");
ImageIcon num3 = new ImageIcon("images/3.png");
ImageIcon num4 = new ImageIcon("images/4.png");
ImageIcon num5 = new ImageIcon("images/5.png");
ImageIcon num6 = new ImageIcon("images/6.png");
ImageIcon num7 = new ImageIcon("images/7.png");
ImageIcon num8 = new ImageIcon("images/8.png");
ImageIcon num9 = new ImageIcon("images/9.png");
ImageIcon end = new ImageIcon("images/end_block.jpg");
ImageIcon back = new ImageIcon("images/BackGround2.jpg");
ImageIcon Titled = new ImageIcon("images/TITLE.jpg");
ImageIcon START = new ImageIcon("images/start.png");
ImageIcon N_START = new ImageIcon("images/n_start.png");
ImageIcon EXIT = new ImageIcon("images/exit.png");
ImageIcon N_EXIT = new ImageIcon("images/n_exit.png");
ImageIcon ARROW = new ImageIcon("images/arrow.png");
ImageIcon one_line = new ImageIcon("images/line_1.png");
ImageIcon two_line = new ImageIcon("images/line_2.png");
ImageIcon three_line = new ImageIcon("images/line_3.png");
ImageIcon four_line = new ImageIcon("images/line_4.png");
ImageIcon R_S = new ImageIcon("images/S.png");
ImageIcon R_A = new ImageIcon("images/A.png");
ImageIcon R_B = new ImageIcon("images/B.png");
ImageIcon R_C = new ImageIcon("images/C.png");
ImageIcon R_D = new ImageIcon("images/D.png");
ImageIcon R_E = new ImageIcon("images/E.png");
ImageIcon R_F = new ImageIcon("images/F.png");
ImageIcon EP = new ImageIcon("images/phase3.jpg");
ImageIcon Penter = new ImageIcon("images/press_enter.png");
mBlocks[0] = b1.getImage();
mBlocks[1] = b2.getImage();
mBlocks[2] = b3.getImage();
mBlocks[3] = b4.getImage();
mBlocks[4] = b5.getImage();
mBlocks[5] = b6.getImage();
mBlocks[6] = b7.getImage();
mPauseImage = pa.getImage();
mPerfectBlocks[0] = i.getImage();
mPerfectBlocks[1] = o.getImage();
mPerfectBlocks[2] = l.getImage();
mPerfectBlocks[3] = j.getImage();
mPerfectBlocks[4] = s.getImage();
mPerfectBlocks[5] = z.getImage();
mPerfectBlocks[6] = t.getImage();
mPerfectBlocks[7] = q.getImage();
mNumbers[0] = num0.getImage();
mNumbers[1] = num1.getImage();
mNumbers[2] = num2.getImage();
mNumbers[3] = num3.getImage();
mNumbers[4] = num4.getImage();
mNumbers[5] = num5.getImage();
mNumbers[6] = num6.getImage();
mNumbers[7] = num7.getImage();
mNumbers[8] = num8.getImage();
mNumbers[9] = num9.getImage();
mLines[0] = one_line.getImage();
mLines[1] = two_line.getImage();
mLines[2] = three_line.getImage();
mLines[3] = four_line.getImage();
mRanks[0] = R_S.getImage();
mRanks[1] = R_A.getImage();
mRanks[2] = R_B.getImage();
mRanks[3] = R_C.getImage();
mRanks[4] = R_D.getImage();
mRanks[5] = R_E.getImage();
mRanks[6] = R_F.getImage();
mResultBackGround = EP.getImage();
mPressEnterImage = Penter.getImage();
mEndBlock = end.getImage();
mBackGround = back.getImage();
mTitleImage = Titled.getImage();
mStartButton = START.getImage();
mStartButton_N = N_START.getImage();
mExitButton = EXIT.getImage();
mExitButton_N = N_EXIT.getImage();
mArrowImage = ARROW.getImage();
}
public void Init(){
mHoldNum = 7;
mNextNum = 0;
mLevel = 1;
mHundredNum = 0;
mTenNum = 0;
mOneNum = 0;
mOneAndNine = 0;
mFlagPausePress = false;
mEraseLineResult = new int[5];
mScore = 0;
mFlagStart = true;
}
public void ArrangeScoreBoard() {
if (mBlockCount <= 999)
{
mHundredNum = mBlockCount / 100;
mBlockCount -= mHundredNum * 100;
mTenNum = mBlockCount / 10;
mOneNum = mBlockCount - mTenNum * 10;
}
else
{
mHundredNum = 9;
mTenNum = 9;
mOneNum = 9;
}
if (mHundredNum < 9)
{
mLevel = mHundredNum + 1;
}
else
{
mLevel = mHundredNum;
mOneAndNine = 9;
}
}
public void ResultBoardArrange(){
line1_hund = mEraseLineResult[0] / 100;
mEraseLineResult[0] = mEraseLineResult[0]-(line1_hund*100);
line1_ten = mEraseLineResult[0] / 10;
line1_one = mEraseLineResult[0]-(line1_ten*10);
line2_hund = mEraseLineResult[1] / 100;
mEraseLineResult[1] = mEraseLineResult[1]-(line2_hund*100);
line2_ten = mEraseLineResult[1] / 10;
line2_one = mEraseLineResult[1] -(line2_ten*10);
line3_hund = mEraseLineResult[2] / 100;
mEraseLineResult[2] = mEraseLineResult[2]-(line3_hund*100);
line3_ten = mEraseLineResult[2] / 10;
line3_one = mEraseLineResult[2]-(line3_ten*10);
line4_hund = mEraseLineResult[3] / 100;
mEraseLineResult[3] = mEraseLineResult[3]-(line4_hund*100);
line4_ten = mEraseLineResult[3] / 10;
line4_one = mEraseLineResult[3]-(line4_ten*10);
mScore = mEraseLineResult[4];
}
public void SetFixedArr(int[][] fixedarr)
{
mFixedArr = fixedarr;
}
public void paint(Graphics g) {
switch(mSceneStatus)
{
case SCENE1 :
Scene1Render(g);
break;
case SCENE2 :
Scene2Render(g);
break;
case SCENE3 :
Scene3Render(g);
break;
}
}
public void SetNextBlockNum(int num)
{
mNextNum = num;
}
public void SetHoldBlockNum(int num)
{
mHoldNum = num;
}
public void SetBlockCount(int num)
{
mBlockCount = num;
}
public void SetGameStatus(boolean stat)
{
mFlagPausePress = stat;
}
public void SetSceneStatus(int scene_num)
{
mSceneStatus = scene_num;
}
public void SetStartFlag(boolean start_status)
{
mFlagStart = start_status;
}
public void SetErasedLineResult(int[] result)
{
mEraseLineResult = result;
}
void Scene1Render(Graphics g)
{
g.drawImage(mTitleImage, 0, 0, null);
if (mFlagStart){
g.drawImage(mStartButton, 513, 424, null);
g.drawImage(mExitButton_N, 578, 525, null);
g.drawImage(mArrowImage, 460, 433, null);
}
else {
g.drawImage(mStartButton_N, 541, 430, null);
g.drawImage(mExitButton, 565, 517, null);
g.drawImage(mArrowImage, 510, 529, null);
}
}
void Scene2Render(Graphics g)
{
ArrangeScoreBoard();
g.drawImage(mBackGround, 0, 0, null);
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 10; j++) {
if (mFixedArr[i][j] == 1) {
g.drawImage(mBlocks[0], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 2) {
g.drawImage(mBlocks[1], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 3) {
g.drawImage(mBlocks[2], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 4) {
g.drawImage(mBlocks[3], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 5) {
g.drawImage(mBlocks[4], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 6) {
g.drawImage(mBlocks[5], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 7) {
g.drawImage(mBlocks[6], j * 32 + 464, i * 32 + 64, null);
} else if (mFixedArr[i][j] == 8) {
g.drawImage(mEndBlock, j * 32 + 464, i * 32 + 64, null);
} else if ((mFixedArr[i][j] != 0)
|| (mFixedArr[i][j] > 8)) {
g.drawImage(mEndBlock, j * 32 + 464, i * 32 + 64, null);
}
}
}
g.drawImage(mPerfectBlocks[mNextNum], 794, 64, null);
g.drawImage(mPerfectBlocks[mHoldNum], 314, 64, null);
g.drawImage(mNumbers[mLevel], 891, 436, null);
g.drawImage(mNumbers[mLevel], 829, 626, null);
g.drawImage(mNumbers[mOneAndNine], 859, 626, null);
g.drawImage(mNumbers[mOneAndNine], 889, 626, null);
g.drawImage(mNumbers[mHundredNum], 829, 550, null);
g.drawImage(mNumbers[mTenNum], 859, 550, null);
g.drawImage(mNumbers[mOneNum], 889, 550, null);
if (mFlagPausePress) {
g.drawImage(mPauseImage, 330, 186, null);
}
}
void Scene3Render(Graphics g)
{
g.drawImage(mResultBackGround, 0, 0, null);
g.drawImage(mLines[0], 350, 250, null);
g.drawImage(mLines[1], 350, 310, null);
g.drawImage(mLines[2], 350, 370, null);
g.drawImage(mLines[3], 350, 430, null);
g.drawImage(mNumbers[line1_hund], 490, 258, null);
g.drawImage(mNumbers[line1_ten], 515, 258, null);
g.drawImage(mNumbers[line1_one], 540, 258, null);
g.drawImage(mNumbers[line2_hund], 490, 318, null);
g.drawImage(mNumbers[line2_ten], 515, 318, null);
g.drawImage(mNumbers[line2_one], 540, 318, null);
g.drawImage(mNumbers[line3_hund], 490, 378, null);
g.drawImage(mNumbers[line3_ten], 515, 378, null);
g.drawImage(mNumbers[line3_one], 540, 378, null);
g.drawImage(mNumbers[line4_hund], 490, 438, null);
g.drawImage(mNumbers[line4_ten], 515, 438, null);
g.drawImage(mNumbers[line4_one], 540, 438, null);
g.drawImage(mPressEnterImage, 450, 600, null);
if(mScore < 300){
g.drawImage(mRanks[6], 750, 300, null);
}
else if (mScore < 700){
g.drawImage(mRanks[5], 750, 300, null);
}
else if (mScore < 1200){
g.drawImage(mRanks[4], 750, 300, null);
}
else if (mScore < 3000){
g.drawImage(mRanks[3], 750, 300, null);
}
else if (mScore < 5000){
g.drawImage(mRanks[2], 750, 300, null);
}
else if (mScore < 9000){
g.drawImage(mRanks[1], 750, 300, null);
}
else if (mScore >= 9000){
g.drawImage(mRanks[0], 750, 300, null);
}
}
}
| 11,595
| 0.662786
| 0.607503
| 389
| 28.807198
| 18.040695
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.03599
| false
| false
|
2
|
268d4702418cf73631c7b933135f733cb2e28919
| 6,030,134,150,205
|
0aae0fe752a5a78d5c6bf93665b45ea975b2d3d2
|
/Steela/app/src/main/java/com/example/steela/Order_Class.java
|
6fd05333da06527b80a5ab6a34022b8c3899ed4e
|
[] |
no_license
|
SelahattinAksoy/TUBITAK_2209B_Andoid_App
|
https://github.com/SelahattinAksoy/TUBITAK_2209B_Andoid_App
|
0faf08cca5b1a6d8615cb4576218e9e090725923
|
4473ed84ac14ff16daf32cfbc4ed1792294f6a1a
|
refs/heads/main
| 2023-02-27T15:41:46.183000
| 2021-02-06T15:46:34
| 2021-02-06T15:46:34
| 336,566,376
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.steela;
public class Order_Class {
public String product_name;
public String product_date;
public String product_amount;
public String customer_name;
public String customer_address;
public String order_taker;
public String delivery_date;
public String delivery_situation;
public Double latitude;
public Double longitude;
public Order_Class(String product_name, String product_date,
String product_amount, String customer_name, String customer_address, String order_taker,
String delivery_date, String delivery_situation,Double latitude,Double longitude) {
this.product_name = product_name;
this.product_date = product_date;
this.product_amount = product_amount;
this.customer_name = customer_name;
this.customer_address = customer_address;
this.order_taker = order_taker;
this.delivery_date=delivery_date;
this.delivery_situation=delivery_situation;
this.latitude=latitude;
this.longitude=longitude;
}
public Order_Class(String product_name, String customer_name, String product_amount){
this.product_name = product_name;
this.customer_name = customer_name;
this.product_amount = product_amount;
}
public String getProduct_name() {
return product_name;
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
public String getProduct_date() {
return product_date;
}
public void setProduct_date(String product_date) {
this.product_date = product_date;
}
public String getProduct_amount() {
return product_amount;
}
public void setProduct_amount(String product_amount) {
this.product_amount = product_amount;
}
public String getCustomer_name() {
return customer_name;
}
public void setCustomer_name(String customer_name) {
this.customer_name = customer_name;
}
public String getCustomer_address() {
return customer_address;
}
public void setCustomer_address(String customer_address) {
this.customer_address = customer_address;
}
public String getOrder_taker() {
return order_taker;
}
public void setOrder_taker(String order_taker) {
this.order_taker = order_taker;
}
public String getDelivery_date() {
return delivery_date;
}
public void setDelivery_date(String delivery_date) {
this.delivery_date = delivery_date;
}
public String getDelivery_situation() {
return delivery_situation;
}
public void setDelivery_situation(String delivery_situation) {
this.delivery_situation = delivery_situation;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
}
|
UTF-8
|
Java
| 3,148
|
java
|
Order_Class.java
|
Java
|
[] | null |
[] |
package com.example.steela;
public class Order_Class {
public String product_name;
public String product_date;
public String product_amount;
public String customer_name;
public String customer_address;
public String order_taker;
public String delivery_date;
public String delivery_situation;
public Double latitude;
public Double longitude;
public Order_Class(String product_name, String product_date,
String product_amount, String customer_name, String customer_address, String order_taker,
String delivery_date, String delivery_situation,Double latitude,Double longitude) {
this.product_name = product_name;
this.product_date = product_date;
this.product_amount = product_amount;
this.customer_name = customer_name;
this.customer_address = customer_address;
this.order_taker = order_taker;
this.delivery_date=delivery_date;
this.delivery_situation=delivery_situation;
this.latitude=latitude;
this.longitude=longitude;
}
public Order_Class(String product_name, String customer_name, String product_amount){
this.product_name = product_name;
this.customer_name = customer_name;
this.product_amount = product_amount;
}
public String getProduct_name() {
return product_name;
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
public String getProduct_date() {
return product_date;
}
public void setProduct_date(String product_date) {
this.product_date = product_date;
}
public String getProduct_amount() {
return product_amount;
}
public void setProduct_amount(String product_amount) {
this.product_amount = product_amount;
}
public String getCustomer_name() {
return customer_name;
}
public void setCustomer_name(String customer_name) {
this.customer_name = customer_name;
}
public String getCustomer_address() {
return customer_address;
}
public void setCustomer_address(String customer_address) {
this.customer_address = customer_address;
}
public String getOrder_taker() {
return order_taker;
}
public void setOrder_taker(String order_taker) {
this.order_taker = order_taker;
}
public String getDelivery_date() {
return delivery_date;
}
public void setDelivery_date(String delivery_date) {
this.delivery_date = delivery_date;
}
public String getDelivery_situation() {
return delivery_situation;
}
public void setDelivery_situation(String delivery_situation) {
this.delivery_situation = delivery_situation;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
}
| 3,148
| 0.652478
| 0.652478
| 117
| 25.905983
| 23.373951
| 112
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.470085
| false
| false
|
2
|
6c9b014782fb83d3c0ad4dff442e936f69c89f09
| 1,090,921,761,280
|
76a9bc6f1263d1aa7d586bbe11159e81eaf85f53
|
/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/EssentiaCompatEnabled.java
|
484377b179dc6db92446e47c7c2124ec7f73a587
|
[
"MIT"
] |
permissive
|
SirFell/TecTech
|
https://github.com/SirFell/TecTech
|
43a170a9889be3093336a9036fa48c37a2881bc6
|
023479dafb85262398df2db407e015371c0c0a86
|
refs/heads/master
| 2021-06-13T18:44:54.575000
| 2021-03-15T05:30:53
| 2021-03-15T05:30:53
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi;
import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.iElementalAspect;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.common.tiles.TileEssentiaReservoir;
import thaumcraft.common.tiles.TileJarFillable;
import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectToDef;
/**
* Created by Tec on 21.05.2017.
*/
public class EssentiaCompatEnabled extends EssentiaCompat {
@Override
public boolean check(GT_MetaTileEntity_MultiblockBase_EM meta) {
TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing());
return tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable;
}
@Override
public TileEntity getContainer(GT_MetaTileEntity_MultiblockBase_EM meta) {
TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing());
return tile!=null && !tile.isInvalid() && tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable ?tile:null;
}
@Override
public boolean putElementalInstanceStack(TileEntity container,cElementalInstanceStack stack){
if(container==null || container.isInvalid()) {
return false;
}
if(container instanceof IAspectContainer && stack.definition instanceof iElementalAspect){
Aspect aspect=(Aspect) ((iElementalAspect) stack.definition).materializeIntoAspect();
if(aspect!=null){
((IAspectContainer) container).addToContainer(aspect,1);
return true;
}
}
return false;
}
@Override
public cElementalInstanceStack getFromContainer(TileEntity container){
if(container==null || container.isInvalid()) {
return null;
}
if(container instanceof IAspectContainer){
AspectList aspects=((IAspectContainer) container).getAspects();
if(aspects!=null){
Aspect[] aspectsArr= aspects.getAspects();
if(aspectsArr!=null && aspectsArr[0]!=null){
if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){
cElementalDefinition def=aspectToDef.get(aspectsArr[0].getTag());
if(def!=null){
return new cElementalInstanceStack(def,1);
}
}
}
}
}
return null;
}
}
|
UTF-8
|
Java
| 3,113
|
java
|
EssentiaCompatEnabled.java
|
Java
|
[
{
"context": "ctDefinitionCompat.aspectToDef;\n\n/**\n * Created by Tec on 21.05.2017.\n */\npublic class EssentiaCompatEna",
"end": 918,
"score": 0.7951233386993408,
"start": 915,
"tag": "USERNAME",
"value": "Tec"
}
] | null |
[] |
package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi;
import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.iElementalAspect;
import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack;
import com.github.technus.tectech.mechanics.elementalMatter.core.templates.cElementalDefinition;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.common.tiles.TileEssentiaReservoir;
import thaumcraft.common.tiles.TileJarFillable;
import static com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.AspectDefinitionCompat.aspectToDef;
/**
* Created by Tec on 21.05.2017.
*/
public class EssentiaCompatEnabled extends EssentiaCompat {
@Override
public boolean check(GT_MetaTileEntity_MultiblockBase_EM meta) {
TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing());
return tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable;
}
@Override
public TileEntity getContainer(GT_MetaTileEntity_MultiblockBase_EM meta) {
TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing());
return tile!=null && !tile.isInvalid() && tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable ?tile:null;
}
@Override
public boolean putElementalInstanceStack(TileEntity container,cElementalInstanceStack stack){
if(container==null || container.isInvalid()) {
return false;
}
if(container instanceof IAspectContainer && stack.definition instanceof iElementalAspect){
Aspect aspect=(Aspect) ((iElementalAspect) stack.definition).materializeIntoAspect();
if(aspect!=null){
((IAspectContainer) container).addToContainer(aspect,1);
return true;
}
}
return false;
}
@Override
public cElementalInstanceStack getFromContainer(TileEntity container){
if(container==null || container.isInvalid()) {
return null;
}
if(container instanceof IAspectContainer){
AspectList aspects=((IAspectContainer) container).getAspects();
if(aspects!=null){
Aspect[] aspectsArr= aspects.getAspects();
if(aspectsArr!=null && aspectsArr[0]!=null){
if (((IAspectContainer) container).takeFromContainer(aspectsArr[0],1)){
cElementalDefinition def=aspectToDef.get(aspectsArr[0].getTag());
if(def!=null){
return new cElementalInstanceStack(def,1);
}
}
}
}
}
return null;
}
}
| 3,113
| 0.696113
| 0.691616
| 68
| 44.779411
| 38.3386
| 134
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.573529
| false
| false
|
2
|
55cd12be3e38dbceaff6b9d39121239d9dd8db13
| 24,902,220,435,383
|
6b7a00e2039b5672ec5c0eeba778b8ee4c9dc569
|
/src/main/java/strings/Anagram.java
|
022bcfc0b74309e9bc0c907aa5a4aa02a4f9ddf4
|
[] |
no_license
|
ankush-sharmaa/CompetitiveProgramming
|
https://github.com/ankush-sharmaa/CompetitiveProgramming
|
a8fd3df99b5da25f6f0646966f462578a9a9e1a8
|
baf37d0e4285b92d3db41695a99285dc51658e5b
|
refs/heads/master
| 2023-06-20T14:32:25.706000
| 2021-07-23T08:32:41
| 2021-07-23T08:32:41
| 316,541,350
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package strings;
public class Anagram {
static boolean isAnagram(String s1, String s2){
if (s1.length() != s2.length())
return false;
char[] ch = new char[256];
System.out.println(ch[0]);
for(int i=0; i < 256; i++) {
ch[i] = 0;
}
for(int i=0; i < s1.length(); i++) {
char curr = s1.charAt(i);
ch[curr] += 1;
}
for(int i=0; i < s2.length(); i++) {
char curr = s2.charAt(i);
ch[curr] -= 1;
}
for(int i=0; i < 256; i++) {
if(ch[i] != 0) {
return false;
}
}
return true;
}
public static void main(String[] args) {
String s1 = "keepi";
String s2 = "pekie ";
boolean result = isAnagram(s1,s2);
System.out.println("Result "+result);
}
}
|
UTF-8
|
Java
| 901
|
java
|
Anagram.java
|
Java
|
[
{
"context": "c void main(String[] args) {\n String s1 = \"keepi\";\n String s2 = \"pekie \";\n\n boolean",
"end": 768,
"score": 0.9902970790863037,
"start": 763,
"tag": "NAME",
"value": "keepi"
},
{
"context": " String s1 = \"keepi\";\n String s2 = \"pekie \";\n\n boolean result = isAnagram(s1,s2);\n\n",
"end": 797,
"score": 0.9878412485122681,
"start": 792,
"tag": "NAME",
"value": "pekie"
}
] | null |
[] |
package strings;
public class Anagram {
static boolean isAnagram(String s1, String s2){
if (s1.length() != s2.length())
return false;
char[] ch = new char[256];
System.out.println(ch[0]);
for(int i=0; i < 256; i++) {
ch[i] = 0;
}
for(int i=0; i < s1.length(); i++) {
char curr = s1.charAt(i);
ch[curr] += 1;
}
for(int i=0; i < s2.length(); i++) {
char curr = s2.charAt(i);
ch[curr] -= 1;
}
for(int i=0; i < 256; i++) {
if(ch[i] != 0) {
return false;
}
}
return true;
}
public static void main(String[] args) {
String s1 = "keepi";
String s2 = "pekie ";
boolean result = isAnagram(s1,s2);
System.out.println("Result "+result);
}
}
| 901
| 0.427303
| 0.394007
| 46
| 18.586956
| 16.761208
| 51
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.543478
| false
| false
|
2
|
ba17df690aeaf550831a8b904245d25dce423f41
| 21,517,786,213,350
|
932ec1443fb0e0e692bf71ac626c1c90da3c4b14
|
/src/test/java/Rough/LinksByLoop.java
|
eb9fbe419694d75abc90a2875f8aec627102e278
|
[] |
no_license
|
GitAccountTesting/AAPC001
|
https://github.com/GitAccountTesting/AAPC001
|
c4600994eb51c5644468335a3f861f12eb480693
|
4c1e273fe280f569e52d6afbf283488709ffb448
|
refs/heads/master
| 2021-01-20T20:35:42.417000
| 2016-07-29T07:23:07
| 2016-07-29T07:23:07
| 64,413,718
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package Rough;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class LinksByLoop {
public static List<WebElement> listoflinks;
public static WebDriver driver = new FirefoxDriver();
public static WebElement getElementwithIndex(By by, int index)
{
listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
return listoflinks.get(index);
}
public static void main(String[] args) throws InterruptedException {
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.navigate().to("https://www.aapc.com/");
listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
int linkcount = listoflinks.size();
System.out.println(linkcount);
for (WebElement linkelement : listoflinks) {
String linktext = linkelement.getText();
if (!(linktext.isEmpty())) {
System.out.println(linktext);
linkelement.click();
driver.navigate().back();
listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
}
/*
for(int i=0;i<linkcount;i++)
{
WebElement abc=listoflinks.get(i);
abc.click();
//System.out.println("jahdh"+listoflinks.get(i+1).getText());
driver.navigate().back();
//listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
}*/
/*for(int i=0;i<linkcount;i++)
{
getElementwithIndex(By.tagName("a"), i).click();
driver.navigate().back();
}*/
}
}
}
|
UTF-8
|
Java
| 1,945
|
java
|
LinksByLoop.java
|
Java
|
[] | null |
[] |
package Rough;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class LinksByLoop {
public static List<WebElement> listoflinks;
public static WebDriver driver = new FirefoxDriver();
public static WebElement getElementwithIndex(By by, int index)
{
listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
return listoflinks.get(index);
}
public static void main(String[] args) throws InterruptedException {
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.navigate().to("https://www.aapc.com/");
listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
int linkcount = listoflinks.size();
System.out.println(linkcount);
for (WebElement linkelement : listoflinks) {
String linktext = linkelement.getText();
if (!(linktext.isEmpty())) {
System.out.println(linktext);
linkelement.click();
driver.navigate().back();
listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
}
/*
for(int i=0;i<linkcount;i++)
{
WebElement abc=listoflinks.get(i);
abc.click();
//System.out.println("jahdh"+listoflinks.get(i+1).getText());
driver.navigate().back();
//listoflinks = driver.findElement(By.cssSelector(".nav.navbar-nav.navbar-right")).findElements(By.tagName("a"));
}*/
/*for(int i=0;i<linkcount;i++)
{
getElementwithIndex(By.tagName("a"), i).click();
driver.navigate().back();
}*/
}
}
}
| 1,945
| 0.711568
| 0.708997
| 65
| 28.923077
| 30.290037
| 116
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.969231
| false
| false
|
2
|
ec6116d385f2b18b3daf2790b091f37b506a85a7
| 21,517,786,214,279
|
62b9954ab540844d6294beaf87ac4253471953b7
|
/app/src/main/java/com/example/myapplication/view/MyScrollView.java
|
af4f05397a73cc6d2b8c74a9a55cba446e74d458
|
[] |
no_license
|
Wood-Water-Peng/DataStructureDemo
|
https://github.com/Wood-Water-Peng/DataStructureDemo
|
0142f2d5a20041f36c4fff3c91fb5de127c5751e
|
e66184e832ee97423703400ebfaf353cff52515c
|
refs/heads/master
| 2023-03-30T09:23:00.081000
| 2021-03-31T10:46:38
| 2021-03-31T10:46:38
| 290,455,177
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.myapplication.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ScrollView;
import androidx.core.view.ViewCompat;
public class MyScrollView extends ScrollView {
public MyScrollView(Context context) {
super(context);
}
public MyScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_MOVE) {
int action = ev.getAction();
}
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_MOVE) {
int action = ev.getAction();
}
return super.onTouchEvent(ev);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_MOVE) {
int action = ev.getAction();
}
return super.onInterceptTouchEvent(ev);
}
@Override
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {
if (canScrollVertically(1)) {
scrollBy(0, dy);
consumed[1] = dy;
}
}
@Override
public boolean onNestedPreFling(View target, float velocityX, float velocityY) {
if (canScrollVertically(1)) {
fling((int) velocityY);
return true;
} else {
return false;
}
}
}
|
UTF-8
|
Java
| 1,747
|
java
|
MyScrollView.java
|
Java
|
[] | null |
[] |
package com.example.myapplication.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ScrollView;
import androidx.core.view.ViewCompat;
public class MyScrollView extends ScrollView {
public MyScrollView(Context context) {
super(context);
}
public MyScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_MOVE) {
int action = ev.getAction();
}
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_MOVE) {
int action = ev.getAction();
}
return super.onTouchEvent(ev);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_MOVE) {
int action = ev.getAction();
}
return super.onInterceptTouchEvent(ev);
}
@Override
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {
if (canScrollVertically(1)) {
scrollBy(0, dy);
consumed[1] = dy;
}
}
@Override
public boolean onNestedPreFling(View target, float velocityX, float velocityY) {
if (canScrollVertically(1)) {
fling((int) velocityY);
return true;
} else {
return false;
}
}
}
| 1,747
| 0.627934
| 0.625644
| 65
| 25.876923
| 22.250675
| 84
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.507692
| false
| false
|
2
|
e5b2999c71a7b2ee6205d9b101a084cb15c9e04a
| 15,710,990,434,197
|
48e3dc2c564c5b5179581dd0357f9239a6718f2d
|
/.svn/pristine/e5/e5b2999c71a7b2ee6205d9b101a084cb15c9e04a.svn-base
|
f1b8689ee4b777aa8b5eb19b19669795d611d740
|
[] |
no_license
|
GithubTestForHx/CourseSelectionServer
|
https://github.com/GithubTestForHx/CourseSelectionServer
|
f3fe0f55572f7bfbf7280a99879d91637cd474c7
|
b7f8c3e4f5c0c462a34705e5f3b2f5893b08bd51
|
refs/heads/master
| 2020-05-18T14:16:39.020000
| 2013-11-07T11:37:39
| 2013-11-07T11:37:39
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.server.test;
import java.util.List;
import com.data.po.Teacher;
import com.logic.method.TeacherRelative.TeacherGetter;
import junit.framework.TestCase;
public class GetTeacherTest extends TestCase{
public void testGetTeacher(){
}
}
|
UTF-8
|
Java
| 253
|
e5b2999c71a7b2ee6205d9b101a084cb15c9e04a.svn-base
|
Java
|
[] | null |
[] |
package com.server.test;
import java.util.List;
import com.data.po.Teacher;
import com.logic.method.TeacherRelative.TeacherGetter;
import junit.framework.TestCase;
public class GetTeacherTest extends TestCase{
public void testGetTeacher(){
}
}
| 253
| 0.790514
| 0.790514
| 14
| 17.071428
| 18.092873
| 54
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.642857
| false
| false
|
2
|
|
a078667a656d352f0906053110f8fa7bf8ea2cc2
| 18,743,237,344,610
|
e59436205ff56f1efef83606ab696b6e713373bf
|
/src/main/java/graphics/leyout/views/tools/ToolBoardView.java
|
405f010ce9c62e21aa1a9990d13629a881de392b
|
[] |
no_license
|
shuripa/Boards
|
https://github.com/shuripa/Boards
|
c28472bcdb6e5fc106e4949807a403bcd5d8ab5c
|
4f14cc08fe39a2c872960df897f18e7d8d5fb8b4
|
refs/heads/master
| 2022-09-13T11:22:29.488000
| 2020-07-19T12:45:39
| 2020-07-19T12:45:39
| 193,386,398
| 0
| 0
| null | false
| 2022-09-08T01:01:08
| 2019-06-23T19:15:33
| 2020-07-19T12:45:57
| 2022-09-08T01:01:06
| 1,944
| 0
| 0
| 3
|
Java
| false
| false
|
package graphics.leyout.views.tools;
import graphics.leyout.controllers.LeyoutComponentController;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
public class ToolBoardView extends ToolView {
Rectangle rb;
Line l;
public ToolBoardView(LeyoutComponentController controller){
super (controller);
rb = new Rectangle(.5 ,.5, 55, 20);
l = new Line(1, 9.5, 53, 9.5);
addActiveElements(rb, l);
}
@Override
public void paint(){
ti.relocate(2,-5);
tt.relocate(2,5);
super.paint();
}
@Override
public void repaint() {
rb.setWidth(controller().S()-5);
l.setEndX(controller().S()-5);
}
}
|
UTF-8
|
Java
| 716
|
java
|
ToolBoardView.java
|
Java
|
[] | null |
[] |
package graphics.leyout.views.tools;
import graphics.leyout.controllers.LeyoutComponentController;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
public class ToolBoardView extends ToolView {
Rectangle rb;
Line l;
public ToolBoardView(LeyoutComponentController controller){
super (controller);
rb = new Rectangle(.5 ,.5, 55, 20);
l = new Line(1, 9.5, 53, 9.5);
addActiveElements(rb, l);
}
@Override
public void paint(){
ti.relocate(2,-5);
tt.relocate(2,5);
super.paint();
}
@Override
public void repaint() {
rb.setWidth(controller().S()-5);
l.setEndX(controller().S()-5);
}
}
| 716
| 0.624302
| 0.597765
| 32
| 21.40625
| 18.263453
| 63
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.75
| false
| false
|
2
|
944e34ca4bed6c400267cc93429860fac7153721
| 28,080,496,207,302
|
e4fddba8f194da0d181cc20c6692cc4a10b65942
|
/scm-test/src/main/java/com/test/entity/BookDetails.java
|
c13e4cdd87a656199f832b98f8963b48356dd918
|
[] |
no_license
|
Thuvethika/jsp-servlet-projects
|
https://github.com/Thuvethika/jsp-servlet-projects
|
14826669b7fcc6089d0164fe5d560228b310f4d9
|
f5ce73972553f5bc7b59e1377a1ef23578e8a8a8
|
refs/heads/master
| 2023-02-04T15:48:28.698000
| 2020-12-23T13:53:26
| 2020-12-23T13:53:26
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test.entity;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name="book_details")
public class BookDetails {
@Id
@Column(name="book_id")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int bookId;
@Column(name="book_author", length =100)
private String bookAuthor;
@Column(name="book_name", length =100)
private String bookName;
@Column(name="book_price", length =10)
private Double bookPrice;
@Column(name="book_isbn_number", length =40)
private String bookNumber;
@Column(name="status", length =20)
private String status;
@Column(name="edition", length =20)
private String edition;
@Column(name="date_purchage", length =40)
@Temporal(TemporalType.DATE)
private Calendar purchageDate;
@Column(name="number_copies", length =10)
private int numberOfCopies;
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public String getBookAuthor() {
return bookAuthor;
}
public void setBookAuthor(String bookAuthor) {
this.bookAuthor = bookAuthor;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public Double getBookPrice() {
return bookPrice;
}
public void setBookPrice(Double bookPrice) {
this.bookPrice = bookPrice;
}
public String getBookNumber() {
return bookNumber;
}
public void setBookNumber(String bookNumber) {
this.bookNumber = bookNumber;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getEdition() {
return edition;
}
public void setEdition(String edition) {
this.edition = edition;
}
public Calendar getPurchageDate() {
return purchageDate;
}
public void setPurchageDate(Calendar purchageDate) {
this.purchageDate = purchageDate;
}
public int getNumberOfCopies() {
return numberOfCopies;
}
public void setNumberOfCopies(int numberOfCopies) {
this.numberOfCopies = numberOfCopies;
}
@Override
public String toString() {
return "BookDetails [bookId=" + bookId + ", bookAuthor=" + bookAuthor + ", bookName=" + bookName
+ ", bookPrice=" + bookPrice + ", bookNumber=" + bookNumber + ", status=" + status + ", edition="
+ edition + ", purchageDate=" + purchageDate + ", numberOfCopies=" + numberOfCopies + "]";
}
}
|
UTF-8
|
Java
| 2,760
|
java
|
BookDetails.java
|
Java
|
[] | null |
[] |
package com.test.entity;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name="book_details")
public class BookDetails {
@Id
@Column(name="book_id")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int bookId;
@Column(name="book_author", length =100)
private String bookAuthor;
@Column(name="book_name", length =100)
private String bookName;
@Column(name="book_price", length =10)
private Double bookPrice;
@Column(name="book_isbn_number", length =40)
private String bookNumber;
@Column(name="status", length =20)
private String status;
@Column(name="edition", length =20)
private String edition;
@Column(name="date_purchage", length =40)
@Temporal(TemporalType.DATE)
private Calendar purchageDate;
@Column(name="number_copies", length =10)
private int numberOfCopies;
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public String getBookAuthor() {
return bookAuthor;
}
public void setBookAuthor(String bookAuthor) {
this.bookAuthor = bookAuthor;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public Double getBookPrice() {
return bookPrice;
}
public void setBookPrice(Double bookPrice) {
this.bookPrice = bookPrice;
}
public String getBookNumber() {
return bookNumber;
}
public void setBookNumber(String bookNumber) {
this.bookNumber = bookNumber;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getEdition() {
return edition;
}
public void setEdition(String edition) {
this.edition = edition;
}
public Calendar getPurchageDate() {
return purchageDate;
}
public void setPurchageDate(Calendar purchageDate) {
this.purchageDate = purchageDate;
}
public int getNumberOfCopies() {
return numberOfCopies;
}
public void setNumberOfCopies(int numberOfCopies) {
this.numberOfCopies = numberOfCopies;
}
@Override
public String toString() {
return "BookDetails [bookId=" + bookId + ", bookAuthor=" + bookAuthor + ", bookName=" + bookName
+ ", bookPrice=" + bookPrice + ", bookNumber=" + bookNumber + ", status=" + status + ", edition="
+ edition + ", purchageDate=" + purchageDate + ", numberOfCopies=" + numberOfCopies + "]";
}
}
| 2,760
| 0.70471
| 0.698188
| 104
| 24.538462
| 19.750328
| 101
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.586538
| false
| false
|
2
|
b274cded517c5897d50c76b049cc9a5511024f8f
| 28,080,496,207,869
|
36fb3e1ebadce45cc51fcb9b820ed80f0dd466cf
|
/TP3/Café/TP3.java
|
2a06e3b4a0befbe3146673adec4751daf5118ea4
|
[] |
no_license
|
AsukaETS/Algorithme-et-structure-de-donnes
|
https://github.com/AsukaETS/Algorithme-et-structure-de-donnes
|
ebe15bfb7f15f8c6bdc93c4513d1121b5c099d83
|
812b96bbf3d05f26775bf4c5e57e60c2542699c1
|
refs/heads/master
| 2020-12-31T06:22:00.238000
| 2017-11-08T08:31:20
| 2017-11-08T08:31:20
| 68,798,352
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.ArrayList ;
class TP3 {
public static void main (String[] args) {
Café c1 = new Café ("Le Chat qui Croque", 50) ; //Création du café
c1.ouverture(6) ; //Test de la méthode ouverture
c1.gestion() ; //Test de la méthode gestion
c1.fermeture() ; //Test de la méthode fermeture
}
}
|
ISO-8859-1
|
Java
| 329
|
java
|
TP3.java
|
Java
|
[] | null |
[] |
import java.util.ArrayList ;
class TP3 {
public static void main (String[] args) {
Café c1 = new Café ("Le Chat qui Croque", 50) ; //Création du café
c1.ouverture(6) ; //Test de la méthode ouverture
c1.gestion() ; //Test de la méthode gestion
c1.fermeture() ; //Test de la méthode fermeture
}
}
| 329
| 0.642857
| 0.618012
| 12
| 25.916666
| 23.956413
| 69
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.5
| false
| false
|
2
|
339058e3900293ab1548de56837a64c3288662e3
| 31,774,168,114,384
|
c173fc0a3d23ffda1a23b87da425036a6b890260
|
/hrsaas/src/org/paradyne/model/settlement/SettlementRegisterModel.java
|
d541197a0eb0812391c8d8f8b6d3b031a7a9e2f1
|
[
"Apache-2.0"
] |
permissive
|
ThirdIInc/Third-I-Portal
|
https://github.com/ThirdIInc/Third-I-Portal
|
a0e89e6f3140bc5e5d0fe320595d9b02d04d3124
|
f93f5867ba7a089c36b1fce3672344423412fa6e
|
refs/heads/master
| 2021-06-03T05:40:49.544000
| 2016-08-03T07:27:44
| 2016-08-03T07:27:44
| 62,725,738
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.paradyne.model.settlement;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import javax.servlet.http.HttpServletResponse;
import org.paradyne.bean.settlement.SettlementRegister;
import org.paradyne.lib.ModelBase;
import org.paradyne.lib.Utility;
import org.paradyne.lib.report.ReportGenerator;
public class SettlementRegisterModel extends ModelBase {
static org.apache.log4j.Logger logger = org.apache.log4j.Logger
.getLogger(ModelBase.class);
HttpServletResponse response;
NumberFormat formatter = new DecimalFormat("#0.00");
/**
*
* Added on Date:22-10-2008 Following function is called in the
* getReportDataUnCheck() function to generate the debit amount for each
* employee when the check box for Branch and Department wise is not
* checked.
*
* @param emp_id
* @param month
* @param year
* @param settlReg
* @return
*/
public Object[][] getSalaryDebitDataUncheck(String settlCode
,String fromMonth,String toMonth,String fromYear,String toYear) {
Object[][] credit_amount = null;
try {
String sal_Amount = "SELECT DEBIT_CODE,SUM(NVL(SETTL_AMT,0.00)) FROM HRMS_DEBIT_HEAD "
+" LEFT JOIN HRMS_SETTL_DEBITS ON (SETTL_DEBIT_CODE = DEBIT_CODE AND SETTL_CODE="+settlCode+" and ((SETTL_MTH>="+fromMonth+" and HRMS_SETTL_DEBITS.SETTL_YEAR="+fromYear+") OR (SETTL_MTH<="+toMonth+" and HRMS_SETTL_DEBITS.SETTL_YEAR="+toYear+"))) "
//+" LEFT JOIN HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_DEBITS.SETTL_CODE AND SETTL_MONTH=SETTL_MTH AND HRMS_SETTL_DEBITS.SETTL_YEAR=HRMS_SETTL_DTL.SETTL_YEAR)"
+" WHERE DEBIT_PAYFLAG='Y' AND SETTL_MTH_TYPE='CO' GROUP BY DEBIT_CODE ORDER BY DEBIT_CODE";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return credit_amount;
}
/**
* Added on Date:22-10-2008 following function is called to generate the
* credit amount for the employee in the function getReportDataUnCheck()
* function when the check box for Branch and department wise is not
* checked.
*
* @param empCode
* @param year
* @param month
* @param settlReg
* @return
*/
public Object[][] getSalaryCreditDataUncheck(String settlCode
,String fromMonth,String toMonth,String fromYear,String toYear) {
Object[][] credit_amount = null;
try {
String sal_Amount = "SELECT CREDIT_CODE,SUM(NVL(SETTL_AMT,0.00)),CREDIT_APPLICABLE_ESI FROM HRMS_CREDIT_HEAD "
+" LEFT JOIN HRMS_SETTL_CREDITS ON (SETTL_CREDIT_CODE = CREDIT_CODE AND SETTL_CODE="+settlCode+" and ((SETTL_MTH>="+fromMonth+" and HRMS_SETTL_CREDITS.SETTL_YEAR="+fromYear+") OR (SETTL_MTH<="+toMonth+" and HRMS_SETTL_CREDITS.SETTL_YEAR="+toYear+"))) "
//+" LEFT JOIN HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_CREDITS.SETTL_CODE AND SETTL_MONTH=SETTL_MTH AND HRMS_SETTL_CREDITS.SETTL_YEAR=HRMS_SETTL_DTL.SETTL_YEAR )"
+" WHERE CREDIT_PAYFLAG='Y' AND SETTL_MTH_TYPE='CO' GROUP BY CREDIT_CODE,CREDIT_APPLICABLE_ESI ORDER BY CREDIT_CODE";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return credit_amount;
}
/**
* Added on date:22-10-2008 following function is called when the branch and
* department wise check box is unchecked.
*
* @param settlReg
* @param response
* @param typeName
* @param desgName
* @param deptName
* @param branchName
* @param settlReg
*/
public void genReport(String reportType,String fromMonth,String fromYear,String toMonth,String toYear,
String divCode, String brnCode, String deptCode,
String empTypeCode, String desgCode, HttpServletResponse response, String divisionName) {
try {
int check = 0;
int colTotal = 0;
String reportName = "Settlement Register of " + divisionName
+ " from "
+ Utility.month(Integer.parseInt(fromMonth)) + "," + fromYear
+ " To "+ Utility.month(Integer.parseInt(toMonth)) + "," + toYear;
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Settlement Register of " + divisionName
+ " from "
+ Utility.month(Integer.parseInt(fromMonth)) + "," + fromYear
+ " To "+ Utility.month(Integer.parseInt(toMonth)) + "," + toYear, 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Settlement Register of " + divisionName
+ " from "
+ Utility.month(Integer.parseInt(fromMonth)) + "," + fromYear
+ " To "+ Utility.month(Integer.parseInt(toMonth)) + "," + toYear;
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
/*String selectSalaryLoop = "SELECT HRMS_SALARY_" + year
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (brnChk.equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (deptChk.equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (desgChk.equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ year
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ year
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ year
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ year
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ month
+ " AND LEDGER_YEAR="
+ year
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (brnChk.equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ year + ".SAL_EMP_CENTER)";
}
if (deptChk.equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ year + ".SAL_DEPT)";
}
if (desgChk.equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ year + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION=" + divCode;
if (!(brnCode.equals(""))) {
selectSalaryLoop += " AND SAL_EMP_CENTER=" + brnCode + " ";
}
if (!(onHoldCode.equals("A"))) {
selectSalaryLoop += "AND sal_onhold='" + onHoldCode + "' ";
}
if (!(deptCode.equals(""))) {
selectSalaryLoop += "and SAL_DEPT=" + deptCode;
}
if (!empTypeCode.equals("")) {
selectSalaryLoop += " AND SAL_EMP_TYPE=" + empTypeCode;
}
if (!desgCode.equals("")) {
selectSalaryLoop += " AND SAL_EMP_RANK=" + desgCode;
}
selectSalaryLoop += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";*/
/*String selectEmpLoop="SELECT HRMS_SETTL_HDR.SETTL_ECODE ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '|| EMP_LNAME, NVL(TYPE_NAME,' '),SETTL_DAYS,SETTL_MONTH, SETTL_YEAR,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' '),' ',NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),"
+" CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other'"
+" END,'',HRMS_SETTL_DTL.SETTL_CODE "
+" FROM HRMS_SETTL_HDR "
+" inner join HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_HDR.SETTL_CODE)"
+" INNER JOIN HRMS_EMP_OFFC ON HRMS_SETTL_HDR.SETTL_ECODE = HRMS_EMP_OFFC.EMP_ID "
+" LEFT JOIN HRMS_EMP_TYPE ON(EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID) "
+" LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID) "
+" LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR) "
+" LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE "
+" WHERE SETTL_TYPE='CO' AND EMP_DIV="+divCode;*/
String selectEmpLoop="SELECT DISTINCT HRMS_SETTL_HDR.SETTL_ECODE ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '|| EMP_LNAME, "
+" HRMS_SETTL_HDR.SETTL_CODE,TO_CHAR(SETTL_SETTLDT,'DD-MM-YYYY'), NVL(SETTL_LEAVE_ENCASH,0),NVL(SETTL_GRATUITY,0), NVL(SETTL_REIMBURSE,0), NVL(SETTL_DEDUCTION,0),"
+" NVL(SETTL_TAX_AMT,0) FROM HRMS_SETTL_HDR "
+" INNER JOIN HRMS_EMP_OFFC ON HRMS_SETTL_HDR.SETTL_ECODE = HRMS_EMP_OFFC.EMP_ID "
+" inner join HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_HDR.SETTL_CODE)"
+" WHERE EMP_DIV="+divCode+" AND SETTL_TYPE='CO' and "
+"((SETTL_MONTH>="+fromMonth+" and SETTL_YEAR="+fromYear+") OR (SETTL_MONTH<="+toMonth+" and SETTL_YEAR="+toYear+"))";
if (!(brnCode.equals(""))) {
selectEmpLoop += " AND EMP_CENTER=" + brnCode + " ";
}
if (!(deptCode.equals(""))) {
selectEmpLoop += " AND EMP_DEPT=" + deptCode;
}
if (!empTypeCode.equals("")) {
selectEmpLoop += " AND EMP_TYPE=" + empTypeCode;
}
if (!desgCode.equals("")) {
selectEmpLoop += " AND EMP_RANK=" + desgCode;
}
selectEmpLoop +=" ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
// UPDATED BY REEBA
Object[][] reportDataPay = getReportDataUnCheck(selectEmpLoop,
fromMonth, fromYear, toMonth, toYear, check,
divisionName);
// Object[][] reportDataPay =
// getReportDataUnCheck(selectSalaryLoop,settlReg,arrEmpLength,check);
if (reportDataPay.length > 1) {
String finalHeader[] = null;
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
// String finalHeader[] = new String[reportDataPay[0].length];
// * Following loop is used to set the cell width
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 2;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}// End of cell width loop
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
// * Following loop is used to set the credit and debit values
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = String
.valueOf(reportDataPay[i + 1][j]);
}
}// End of finalData loop
Object totalByColumn[][] = null;
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals("")
|| String.valueOf(finalData[j][i]).equals(
"null.00")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1])
.contains("Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
}
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[2][4]; filterObj[0][0] =
* "Branch : "; filterObj[0][1] = branchName; filterObj[0][2] =
* "Department : "; filterObj[0][3] = deptName;
*
* filterObj[1][0] = "Designation : "; filterObj[1][1] =
* desgName; filterObj[1][2] = "Employee Type : ";
* filterObj[1][3] = typeName;
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.tableBody(finalHeader, finalData, cellWidth, alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
rg.createReport(response);
} catch (Exception e) {
e.printStackTrace();
}
}
// GET EMP_ID THOSE FULLFILL SORTING CRITERIA
public Object[][] getEmpId(SettlementRegister settlReg) {
Object emp_id[][] = null;
try {
/*
* FOR SELECTING THE EMPLOYEE THOSE FULL FILL SORTING CRITERIA
*
*/
// String selectSalary = " SELECT EMP_ID ,EMP_TOKEN ,EMP_FNAME ||'
// '||EMP_MNAME ||' '||EMP_LNAME FROM HRMS_EMP_OFFC WHERE
// EMP_PAYBILL IS NOT NULL ";
String selectSalary = " SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||EMP_LNAME "
+ " FROM HRMS_SALARY_" + settlReg.getYear()
+ " inner join HRMS_EMP_OFFC on HRMS_SALARY_"
+ settlReg.getYear() + ".EMP_ID = HRMS_EMP_OFFC.EMP_ID " +
/*
* " left join hrms_center on (hrms_center.CENTER_ID=
* HRMS_EMP_OFFC.EMP_CENTER) "+ " left join HRMS_LOCATION on
* (HRMS_LOCATION.LOCATION_CODE =
* hrms_center.CENTER_LOCATION) " +
*/
" WHERE EMP_PAYBILL IS NOT NULL ";
String where = " ";
try {
where = where + " AND SAL_MONTH=" + settlReg.getMonth();
selectSalary = selectSalary + where;
} catch (Exception e) {
e.printStackTrace();
}
emp_id = getSqlModel().getSingleResult(selectSalary);
} catch (Exception e) {
logger.error(e.getMessage());
}
return emp_id;
}
/*
* Following function is used in getReportDataNoBranchDept() method to
* return the employee details.
*/
public Object[][] getEmpIdNew(String selectSalary) {
Object emp_id[][] = null;
try {
emp_id = getSqlModel().getSingleResult(selectSalary);
} catch (Exception e) {
logger.error(e.getMessage());
}
return emp_id;
}
// Following function is called when branch or department is not selected at
// all
// This method returns the salary amount and the corresponding credit code
public Object[][] getSalaryCreditDataNoSelect(String empCode, String year,
String month, SettlementRegister settlReg, String brnCode, String deptCode) {
Object[][] credit_amount = null;
try {
String ledgCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year=" + year;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkBrnOrder().equals("Y")) {
ledgCode += " and sal_emp_center=" + brnCode;
}
if (settlReg.getChkDeptOrder().equals("Y")) {
ledgCode += " AND SAL_DEPT=" + deptCode;
}
// UPDATED BY REEBA ENDS
ledgCode += " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
// UPDATED BY REEBA
String selectCredits = "SELECT SAL_CREDIT_CODE,SAL_AMOUNT , CREDIT_APPLICABLE_ESI FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[0][0])
+ " ) "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY SAL_CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
} catch (Exception e) {
credit_amount = new Object[0][0];
logger.error(e.getMessage());
e.printStackTrace();
}
return credit_amount;
}
/*
* Following function is called to return the arrear credit amount from
* HRMS_ARREARS_CREDIT_2008(Year Entered) when the arrear type is
* promotional.
*/
public Object[][] arrearCreditData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String promCode, String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
// String query=" SELECT NVL(ARREARS_AMT,0) FROM
// HRMS_ARREARS_credit_"+settlReg.getYear()+" INNER JOIN
// HRMS_ARREARS_"+settlReg.getYear()+"
// on(hrms_arrears_"+settlReg.getYear()+".arrears_code=hrms_arrears_credit_"+settlReg.getYear()+".arrears_code)
// WHERE
// hrms_arrears_credit_"+settlReg.getYear()+".ARREARS_EMP_ID="+empId+"
// AND
// HRMS_ARREARS_CREDIT_"+settlReg.getYear()+".ARREARS_CODE="+arrearCode+"
// ORDER BY ARREARS_CREDIT_CODE";
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
String query = " SELECT distinct NVL(ARREARS_AMT,0),CREDIT_APPLICABLE_ESI FROM HRMS_ARREARS_credit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_credit_"
+ salYear
+ ".arrears_code)"
+ " INNER JOIN HRMS_CREDIT_HEAD ON(CREDIT_CODE=ARREARS_CREDIT_CODE)"
+ " WHERE hrms_arrears_credit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_CREDIT_CODE="
+ arrear[i][0]
+ " AND PROM_CODE="
+ promCode
+ " and arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount.length == 0 || amount == null) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
/*
* Following function is called to return the arrear credit amount from
* HRMS_ARREARS_CREDIT_2008(Year Entered) when the promotional type is
* monthly.
*/
public Object[][] arrearCreditData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
String query = " SELECT distinct NVL(ARREARS_AMT,0),CREDIT_APPLICABLE_ESI FROM HRMS_ARREARS_credit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_credit_"
+ salYear
+ ".arrears_code)"
+ " INNER JOIN HRMS_CREDIT_HEAD ON(CREDIT_CODE=ARREARS_CREDIT_CODE)"
+ " WHERE hrms_arrears_credit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_CREDIT_CODE="
+ arrear[i][0]
+ " AND arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount.length == 0 || amount == null) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
/*
* Following function is called to return the arrear debit amount from
* HRMS_ARREARS_DEBIT_2008(Year Entered) when the arrear type is
* promotional.
*/
public Object[][] arrearDebitData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String promCode, String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
String query = " SELECT distinct NVL(ARREARS_AMT,0),ARREARS_DEBIT_CODE FROM HRMS_ARREARS_debit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_debit_"
+ salYear
+ ".arrears_code)"
+ " WHERE hrms_arrears_debit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_debit_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_DEBIT_CODE="
+ arrear[i][0]
+ " AND PROM_CODE="
+ promCode
+ "and arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount == null || amount.length == 0) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
/*
* Following function is called to return the arrear debit amount from
* HRMS_ARREARS_DEBIT_2008(Year Entered) when the arrear type is monthly.
*/
public Object[][] arrearDebitData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
// String query=" SELECT NVL(ARREARS_AMT,0) FROM
// HRMS_ARREARS_DEBIT_"+settlReg.getYear()+" INNER JOIN
// HRMS_ARREARS_"+settlReg.getYear()+"
// on(hrms_arrears_"+settlReg.getYear()+".arrears_code=hrms_arrears_debit_"+settlReg.getYear()+".arrears_code)
// WHERE
// hrms_arrears_debit_"+settlReg.getYear()+".ARREARS_EMP_ID="+empId+"
// AND
// HRMS_ARREARS_DEBIT_"+settlReg.getYear()+".ARREARS_CODE="+arrearCode+"
// ORDER BY ARREARS_debit_CODE";
String query = " SELECT distinct NVL(ARREARS_AMT,0),ARREARS_DEBIT_CODE FROM HRMS_ARREARS_debit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_debit_"
+ salYear
+ ".arrears_code)"
+ " WHERE hrms_arrears_debit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_debit_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_DEBIT_CODE="
+ arrear[i][0]
+ " and arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount == null || amount.length == 0) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
// Following function is called when branch or department or both are
// selected
public Object[][] getSalaryCreditData(String empCode, String year,
String month, SettlementRegister settlReg, String Id) {
Object[][] credit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getBranchCode().equals(""))
&& settlReg.getDeptCode().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " AND SAL_DEPT="
+ Id
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (settlReg.getBranchCode().equals("")
&& (!(settlReg.getDeptCode().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and sal_emp_center="
+ Id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getBranchCode().equals(""))
&& !(settlReg.getDeptCode().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode()+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
// UPDATED BY REEBA
String sal_Amount = "SELECT SAL_CREDIT_CODE,SAL_AMOUNT,CREDIT_APPLICABLE_ESI FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY SAL_CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return credit_amount;
}
// Following function is called when pay bill or emp type is not selected at
// all
public Object[][] getSalaryCreditDataNoEmpTypePayBill(String empCode,
String year, String month, SettlementRegister settlReg, String typeId,
String payId) {
Object[][] credit_amount = null;
try {
// String ledgCode="SELECT LEDGER_CODE FROM HRMS_SALARY_LEDGER WHERE
// LEDGER_MONTH="+month+" and ledger_year="+year+" and
// ledger_emptype="+typeId+" and ledger_paybill="+payId+" and
// LEDGER_STATUS='SAL_FINAL' order by ledger_code";
String ledgCode = " select sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ typeId
+ " AND SAL_emp_paybill="
+ payId
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
String selectCredits = "SELECT SAL_CREDIT_CODE,SAL_AMOUNT FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[0][0])
+ ") "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY SAL_CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
} catch (Exception e) {
credit_amount = new Object[0][0];
}
return credit_amount;
}
// Following function is called emp type or pay bill or both are selected.
public Object[][] getSalaryCreditDataEmpTypePayBill(String empCode,
String year, String month, SettlementRegister settlReg, String id,
String id1) {
Object[][] credit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getTypeCode().equals(""))
&& settlReg.getPayBillNo().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if ((settlReg.getTypeCode().equals("") && !(settlReg
.getPayBillNo().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and sal_emp_type="
+ id1
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getTypeCode().equals(""))
&& !(settlReg.getPayBillNo().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode()+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
String sal_Amount = "SELECT CREDIT_CODE,SAL_AMOUNT FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
}
return credit_amount;
}
/**
* Following method is used in getReportDataNoBranchDept() which returns the
* credit code,credit abbr to set the credit head names.
*
* @return
*/
public Object[][] getCreditHeader() {
Object credit_header[][] = null;
try {
String selectCredit = "SELECT CREDIT_CODE, CREDIT_ABBR FROM HRMS_CREDIT_HEAD WHERE CREDIT_PAYFLAG='Y' order BY CREDIT_CODE";
credit_header = getSqlModel().getSingleResult(selectCredit);
} catch (Exception e) {
e.printStackTrace();
}
return credit_header;
}
/**
* Following method is used in getReportDataNoBranchDept() which returns the
* debit code,debit abbr to set the debit head names.
*
* @return
*/
public Object[][] getDebitHeader() {
Object debit_header[][] = null;
try {
String selectDebit = "SELECT DEBIT_CODE, DEBIT_ABBR FROM HRMS_DEBIT_HEAD WHERE DEBIT_PAYFLAG='Y' "
+ " ORDER BY DEBIT_CODE";
debit_header = getSqlModel().getSingleResult(selectDebit);
} catch (Exception e) {
logger.error(e.getMessage());
}
return debit_header;
}
// //Following function is called emp type or pay bill or both are selected.
public Object[][] getSalDebitEmpTypePayBill(String emp_id, String month,
String year, SettlementRegister settlReg, String id, String id1) {
Object[][] debit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getTypeCode().equals(""))
&& settlReg.getPayBillNo().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if ((settlReg.getTypeCode().equals("") && !(settlReg
.getPayBillNo().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and sal_emp_type="
+ id1
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getTypeCode().equals(""))
&& !(settlReg.getPayBillNo().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode()+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
String sal_Amount = "SELECT SAL_DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY SAL_DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return debit_amount;
}
// Following function is called emp type or pay bill or both are not
// selected at all.
public Object[][] getSalDebitNoEmpTypePayBill(String emp_id, String month,
String year, SettlementRegister settlReg, String typeId, String payId) {
Object[][] debit_amount = null;
try {
String ledgCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ typeId
+ " AND SAL_emp_paybill="
+ payId
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
String selectCredits = "SELECT SAL_DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[0][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY SAL_DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
} catch (Exception e) {
debit_amount = new Object[0][0];
logger.error(e.getMessage());
}
return debit_amount;
}
// Following function is called branch or department or both are selected.
public Object[][] getSalDebit(String emp_id, String month, String year,
SettlementRegister settlReg, String Id) {
Object[][] debit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getBranchCode().equals(""))
&& settlReg.getDeptCode().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " AND SAL_DEPT="
+ Id
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (settlReg.getBranchCode().equals("")
&& (!(settlReg.getDeptCode().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and sal_emp_center="
+ Id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getBranchCode().equals(""))
&& !(settlReg.getDeptCode().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode()+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
String sal_Amount = "SELECT DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY DEBIT_PRIORITY,DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return debit_amount;
}
// Following function is called branch or department not selected at all.
// Following function is called in getReportDataNoBrnDept() method which
// returns the debit head amount and debit code
public Object[][] getSalDebitNotSelect(String emp_id, String month,
String year, SettlementRegister settlReg, String brnCode, String deptCode) {
Object[][] debit_amount = null;
try {
String ledgCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year=" + year;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkBrnOrder().equals("Y")) {
ledgCode += " and sal_emp_center=" + brnCode;
}
if (settlReg.getChkDeptOrder().equals("Y")) {
ledgCode += " AND SAL_DEPT=" + deptCode;
}
// UPDATED BY REEBA ENDS
ledgCode += " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
for (int i = 0; i < ledger_code.length; i++) {
String selectCredits = "SELECT DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[i][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
}
} catch (Exception e) {
debit_amount = new Object[0][0];
logger.error(e.getMessage());
}
return debit_amount;
}
/*
* Following function is called in the action class to generate the report.
*/
public void generateReport(SettlementRegister settlReg,
HttpServletResponse response) {
// String radioChk = settlReg.getRadioChk();
String reportType = settlReg.getReport();
String reportName = "Salary Register_" + settlReg.getDivName() + " for "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + "_"
+ settlReg.getYear();
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ", 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ";
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
rg.addText("\n", 0, 1, 0);
if ((!(settlReg.getBranchCode().equals("")) && settlReg.getDeptCode()
.equals(""))) {
String selectQuery = "SELECT DEPT_ID,DEPT_NAME from HRMS_DEPT";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportDataBranch(loop_data, rg, settlReg);
} else if (settlReg.getBranchCode().equals("")
&& (!(settlReg.getDeptCode().equals("")))) {
String selectQuery = "SELECT CENTER_ID,CENTER_NAME FROM HRMS_CENTER";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportDataDept(loop_data, rg, settlReg);
} else if (!(settlReg.getBranchCode().equals(""))
&& !(settlReg.getDeptCode().equals(""))) {
// String selectQuery= "SELECT CENTER_ID,CENTER_NAME FROM
// HRMS_CENTER";
Object[][] loop_data = new Object[1][2];
loop_data[0][0] = settlReg.getBranchCode();
loop_data[0][1] = settlReg.getDeptCode();
reportDataBraDept(loop_data, rg, settlReg);
} else if (settlReg.getBranchCode().equals("")
&& settlReg.getDeptCode().equals("")) {
String selectQuery = "SELECT CENTER_ID,CENTER_NAME FROM HRMS_CENTER";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportDataNoSelect(loop_data, rg, settlReg);
}
rg.createReport(response);
}
/*
* Following function is called when department is not selected and branch
* selected.
*/
public void reportDataBranch(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0, arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
String finalHeader[] = null;
int colTotal = 0;
if(loop_data.length>0){
for (int a = 0; a < loop_data.length; a++) {
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ " ,CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
/*
* String selectSalaryLoop =" SELECT
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN ,EMP_FNAME
* ||' '||EMP_MNAME ||' '||EMP_LNAME,NVL(TYPE_NAME,'
* '),NVL(SAL_DAYS,0) " +" FROM HRMS_SALARY_"+settlReg.getYear()+"
* INNER JOIN HRMS_EMP_OFFC " +" ON
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID =
* HRMS_EMP_OFFC.EMP_ID " +" LEFT JOIN HRMS_EMP_TYPE
* ON(HRMS_SALARY_"+settlReg.getYear()+".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)" +"
* INNER JOIN HRMS_SALARY_LEDGER ON " +"
* (HRMS_SALARY_LEDGER.LEDGER_CODE =
* HRMS_SALARY_"+settlReg.getYear()+".SAL_LEDGER_CODE AND
* LEDGER_MONTH="+settlReg.getMonth()+" AND
* LEDGER_YEAR="+settlReg.getYear()+") AND
* SAL_DIVISION="+settlReg.getDivCode();
*/
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + settlReg.getBranchCode()
+ " ";
if (!(settlReg.getOnHold().equals("A"))) {
where += "AND sal_onhold='" + settlReg.getOnHold() + "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE FROM
* HRMS_ARREARS_"+settlReg.getYear()+" " + " inner join
* HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" + " and
* arrears_type='M' and EMP_CENTER="+settlReg.getBranchCode()+ "
* and EMP_DEPT="+String.valueOf(loop_data[a][0]);
*/
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' "
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + settlReg.getBranchCode()
+ " and SAL_DEPT="
+ String.valueOf(loop_data[a][0]);
if (!(settlReg.getOnHold().equals("A"))) {
arrearEmp += "AND sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
arrearEmp += " AND SAL_EMP_TYPE="
+ settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
arrearEmp += " AND SAL_EMP_RANK="
+ settlReg.getDesgCode();
}
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
// int b=0;
Object[][] reportDataPay = getReportData(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), arrEmpLength,
check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}// End of cell width loop
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}
}// End of finalData loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
// Following loop is used to set the sum of the individual
// credit and debit amount values
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals(
"")
|| String.valueOf(finalData[j][i]).equals(
"null.00")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner for loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer for loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4]; filterObj[0][0] =
* "Designation : "; filterObj[0][1] = settlReg.getDesgName();
* filterObj[0][2] = "Employee Type : "; filterObj[0][3] =
* settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + settlReg.getBranchName()
+ " Department : " + loop_data[a][1], 0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportData if condition
}// End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = totList.get(arrCount);
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] ="GRAND TOTAL :-";
grand_total[0][1] =" ";
grand_total[0][2]=" ";
grand_total[0][3]=" ";
/*
* Following loop is used to set the grand total values
*/
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}// End of inner for loop
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
}else {
rg.addText("Records are not available.",0,1,0);
}
} // End of loop_data condition
}
/*
* Following function is called when department is selected and branch not
* selected.
*/
public void reportDataDept(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
String finalHeader[] = null;
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0, arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
int colTotal = 0;
if (loop_data.length > 0) {
for (int a = 0; a < loop_data.length; a++) {
/*
* " SELECT HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN
* ,EMP_FNAME ||' '||EMP_MNAME ||' '||EMP_LNAME, NVL(TYPE_NAME,'
* '),NVL(SAL_DAYS,0)" +" FROM HRMS_SALARY_"+settlReg.getYear()+"
* INNER JOIN HRMS_EMP_OFFC " +" ON
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID =
* HRMS_EMP_OFFC.EMP_ID " +" LEFT JOIN HRMS_EMP_TYPE
* ON(HRMS_SALARY_"+settlReg.getYear()+".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)" +"
* INNER JOIN HRMS_SALARY_LEDGER ON " +"
* (HRMS_SALARY_LEDGER.LEDGER_CODE =
* HRMS_SALARY_"+settlReg.getYear()+".SAL_LEDGER_CODE AND
* LEDGER_MONTH="+settlReg.getMonth()+" AND
* LEDGER_YEAR="+settlReg.getYear()+") WHERE
* SAL_DIVISION="+settlReg.getDivCode();
*
*/
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0] + " ";
if (!(settlReg.getOnHold().equals("A"))) {
where += "and sal_onhold='" + settlReg.getOnHold() + "' ";
}
where += "AND SAL_DEPT=" + settlReg.getDeptCode();
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' "
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ " and SAL_DEPT=" + settlReg.getDeptCode();
if (!(settlReg.getOnHold().equals("A"))) {
arrearEmp += "AND sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
arrearEmp += " AND SAL_EMP_TYPE="
+ settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
arrearEmp += " AND SAL_EMP_RANK="
+ settlReg.getDesgCode();
}
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE
* FROM HRMS_ARREARS_"+settlReg.getYear()+" " + " inner join
* HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" + " and
* arrears_type='M' and EMP_CENTER="+loop_data[a][0]+ " and
* EMP_DEPT="+settlReg.getDeptCode();
*/
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
// int aa=0;
Object[][] reportDataPay = getReportData(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), arrEmpLength,
check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
// Object[][] reportDataPay =
// getReportDataDept(selectSalaryLoop,settlReg);
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width of the table
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* values.
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}
}
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
/**
* Following loop is used to calculate the sum of the
* individual credit and debit head amount.
*/
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4]; filterObj[0][0] =
* "Designation : "; filterObj[0][1] = settlReg.getDesgName();
* filterObj[0][2] = "Employee Type : "; filterObj[0][3] =
* settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + loop_data[a][1]
+ " Department : " + settlReg.getDeptName(), 0, 0,
0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportDataPay if condition
} // End of for loop loop_data
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = totList.get(arrCount);
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] ="GRAND TOTAL :-";
grand_total[0][1] =" ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
/*
* Following loop is used to calculate the grand total
* amount
*/
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}// End of inner loop
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
} // End of loop_data if condition
}
/*
* Following function is called to generate the report when both branch and
* department are selected.
*/
public void reportDataBraDept(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
/*
* String selectSalaryLoop = " SELECT
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||'
* '||EMP_MNAME ||' '||EMP_LNAME,NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) " +"
* FROM HRMS_SALARY_"+settlReg.getYear()+" INNER JOIN HRMS_EMP_OFFC " +"
* ON HRMS_SALARY_"+settlReg.getYear()+".EMP_ID = HRMS_EMP_OFFC.EMP_ID " +"
* LEFT JOIN HRMS_EMP_TYPE
* ON(HRMS_SALARY_"+settlReg.getYear()+".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)" +"
* INNER JOIN HRMS_SALARY_LEDGER ON" +" (HRMS_SALARY_LEDGER.LEDGER_CODE =
* HRMS_SALARY_"+settlReg.getYear()+".SAL_LEDGER_CODE " +" AND
* LEDGER_MONTH="+ settlReg.getMonth()+" AND
* LEDGER_YEAR="+settlReg.getYear()+") WHERE
* SAL_DIVISION="+settlReg.getDivCode();
*
* " SELECT HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN
* ,EMP_FNAME ||' '||EMP_MNAME ||' '||EMP_LNAME " + " FROM
* HRMS_SALARY_"+settlReg.getYear()+" inner join HRMS_EMP_OFFC on
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID = HRMS_EMP_OFFC.EMP_ID " + "
* inner join hrms_center on (hrms_center.CENTER_ID=
* HRMS_EMP_OFFC.EMP_CENTER) "+ " inner join hrms_dept on
* (hrms_dept.DEPT_ID= HRMS_EMP_OFFC.EMP_DEPT) "+ " WHERE SAL_MONTH="+
* settlReg.getMonth();
*/
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0, arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
String finalHeader[] = null;
int colTotal = 0;
if (loop_data.length > 0) {
for (int a = 0; a < loop_data.length; a++) {
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ " ,CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0] + " ";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold() + "' ";
}
where += "AND SAL_DEPT=" + loop_data[a][1];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE FROM
* HRMS_ARREARS_"+settlReg.getYear()+" " + " inner join
* HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" +
* " and arrears_type='M' and
* EMP_CENTER="+settlReg.getBranchCode()+ " and
* EMP_DEPT="+settlReg.getDeptCode();
*/
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' "
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + settlReg.getBranchCode()
+ " and SAL_DEPT=" + settlReg.getDeptCode();
if (!(settlReg.getOnHold().equals("A"))) {
arrearEmp += "AND sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
arrearEmp += " AND SAL_EMP_TYPE="
+ settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
arrearEmp += " AND SAL_EMP_RANK="
+ settlReg.getDesgCode();
}
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
Object[][] reportDataPay = getReportData(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), arrEmpLength,
check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width of the
* table.
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* amount
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
/*
* Following loop is used to set the sum of individual
* credit and debit head values.
*/
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner for loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer for loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4]; filterObj[0][0] =
* "Designation : "; filterObj[0][1] = settlReg.getDesgName();
* filterObj[0][2] = "Employee Type : "; filterObj[0][3] =
* settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + settlReg.getBranchName()
+ " Department : " + settlReg.getDeptName(), 0, 0,
0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportDataPay if condition
}// End of for loop loop_data
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = totList.get(arrCount);
arrCount++;
// logger.info("-----------------values are
// listValues["+i+"]["+j+"]="+listValues[i][j]);
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] ="GRAND TOTAL :-";
grand_total[0][1] =" ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
/**
* Following loop is used to set the grand total values
*/
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}// End of inner loop
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}// End of for loop
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
// rg.addText("GRAND TOTAL",0,0,0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
}// End of loop_data if condition
}
/**
* @author REEBA_JOSEPH
* @param loop_data
* @param rg
* @param settlReg
*/
public void reportOnlyForBranch(Object[][] loop_data,ReportGenerator rg,SettlementRegister settlReg){
ArrayList<String> totList=new ArrayList<String>();
int recCount=0;
int arrEmpLength=0;
int check=0;
String finalHeader[] = null;
if(settlReg.getCheckBrn().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDob().equals("Y")){
check=check+1;
}
if(settlReg.getCheckBank().equals("Y")){
check=check+1;
}
if(settlReg.getCheckAccount().equals("Y")){
check=check+1;
}
if(settlReg.getCheckPan().equals("Y")){
check=check+1;
}
if(settlReg.getCheckEmpType().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDept().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDesg().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDoj().equals("Y")){
check=check+1;
}
if(settlReg.getCheckGender().equals("Y")){
check=check+1;
}
if(settlReg.getCheckHold().equals("Y")){
check=check+1;
}
if(settlReg.getCheckGrade().equals("Y")){
check=check+1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
int colTotal = 0;
if (loop_data.length > 0) {
// logger.info("Loop count ============= " + loop_data.length);
for (int a = 0; a < loop_data.length; a++) {
// logger.info("For Branch ============= " + loop_data[a][0]);
String selectSalaryLoop = "";
try {
selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ "";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
// where+=" AND SAL_DEPT="+loop_data_inner[b][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
} catch (Exception e) {
logger.error("Error in Salary query : " + e);
e.printStackTrace();
}
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type IN('M','P') AND ARREARS_PAY_IN_SAL = 'Y'"
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + loop_data[a][0];
// +" and SAL_DEPT="+loop_data_inner[b][0];
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error("Error in arrears query : " + e);
e.printStackTrace();
}
/*
* Object[][] reportDataPay = getReportDataNoBranchDept(
* selectSalaryLoop, settlReg, String .valueOf(loop_data[a][0]),
* String .valueOf(loop_data_inner[b][0]), arrEmpLength, check);
*/
Object[][] reportDataPay = null;
try {
reportDataPay = getReportDataNoBranchDept(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), "0",
arrEmpLength, check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
} catch (Exception e) {
logger.error("Error in getting report data : " + e);
e.printStackTrace();
}
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// logger.info("finalData["+i+"]["+j+"]=========="+finalData[i][j]);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
/**
* Following loop is used to set the sum of the individual
* credit and debit head values.
*/
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals(
"null.00")
|| String.valueOf(finalData[j][i]).equals(
"")
|| String.valueOf(finalData[j][i]) == null) {
finalData[j][i] = "0";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
rg.addText("Branch : " + loop_data[a][1], 0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
/*
* Object[][] summaryObj = new
* Object[1][reportDataPay[0].length-1];
* summaryObj[0][0] = " ";
*/
/*logger
.info("finalHeader length=="
+ finalHeader.length);
logger.info("cellWidth length==" + cellWidth.length);
logger.info("alignment length==" + alignment.length);
logger.info("totalByColumn length=="
+ totalByColumn[0].length);*/
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
} // End of reportDataPay if condition
} // End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = formatter.format(Double
.parseDouble(String.valueOf(totList
.get(arrCount))));
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] = "GRAND TOTAL :-";
grand_total[0][1] = " ";
//grand_total[0][2] = " ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
finalHeader[1]="";
rg.addText("\n", 0, 0, 0);
rg.tableBody(finalHeader,grand_total, cellWidth, alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
} // End of loop_data if condition
}
/*
* Following function is used to set cell width
*/
public int[] getCellWidth(int dataLength) {
int[] cellWidth = new int[dataLength];
for (int i = 0; i < dataLength; i++) {
if (i > 1) {
cellWidth[i] = 7;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
cellWidth[2] = 10;
cellWidth[3] = 7;
}
}
return cellWidth;
}
/*
* Following function is used to set the alignment
*/
public int[] getAlignment(int dataLength) {
int[] alignment = new int[dataLength];
for (int i = 0; i < dataLength; i++) {
alignment[i] = 0;
}
return alignment;
}
/**
* following function is called in genReport() function when the branch wise
* and department wise check box is unchecked.
*
* @param query
* @param settlReg
* @param arrEmpLength
* @param colTotal
* @param settlReg
* @return
*/
public Object[][] getReportDataUnCheck(String query, String fromMonth,
String fromYear, String toMonth, String toYear, int colTotal, String divisionName) {
int dataIndex = 0;
Object[][] dataWithHeader = null;
try {
Object emp_id[][] = getEmpIdNew(query);
Object credit_header[][] = getCreditHeader();
Object debit_header[][] = getDebitHeader();
double totArrearAmt = 0;
// Object debit_recovery[][]= getDebitHeader_recovery();
int totalCol = credit_header.length + debit_header.length
+ colTotal + 6 + 5;
int counter = 0;
String[] colNames = null;
colNames = new String[totalCol];
colNames[counter] = "Emp Id";
counter = counter + 1;
colNames[counter] = "Employee Name";
counter = counter + 1;
colNames[counter] = "Settlement Date";
counter = counter + 1;
/*
* Following loop sets the credit head names
*/
for (int i = 0; i < credit_header.length; i++) {
colNames[counter] = String.valueOf(credit_header[i][1]);
counter++;
}
colNames[counter] = "Leave Encashment";
counter = counter + 1;
colNames[counter] = "Gratuity";
counter = counter + 1;
colNames[counter] = "Other Reimbursement";
counter = counter + 1;
colNames[counter] = "Tot Credit";
counter = counter + 1;
/*
* Following loop sets the debit head names
*/
for (int i = 0; i < debit_header.length; i++) {
colNames[counter] = String.valueOf(debit_header[i][1]);
counter++;
}
colNames[counter] = "Other Deduction";
counter = counter + 1;
colNames[counter] = "Outstanding TDS";
counter = counter + 1;
colNames[counter] = "Total Debit";
counter = counter + 1;
colNames[counter] = "Net-Pay";
counter = counter + 1;
Object[][] data = new Object[emp_id.length][totalCol];
/*
* Following loop sets the emp id,emp name,credit head value,debit
* head value and arrear values.
*/
for (int i = 0; i < emp_id.length; i++) {
data[dataIndex][0] = emp_id[i][1];
data[dataIndex][1] = emp_id[i][2];
data[dataIndex][2] = emp_id[i][4];
int column = 3;
double totArrACredit = 0;
double totArrDebit = 0;
int position_totalPay = 0;
/** set credit values */
double total_credit = 0.00;
double employerESIC = 0.0;
double esicCredit = 0.0;
double employerPF = 0.0;
Object salCredit[][] = getSalaryCreditDataUncheck(String
.valueOf(emp_id[i][3]),fromMonth,toMonth,fromYear,toYear);
/*Object leaveEncashData[][] = getLeaveEncashmentDataUncheck(
String.valueOf(emp_id[i][0]), year, month);*/
/*
* Following loop sets the credit head values
*/
for (int j = 0; j < credit_header.length; j++) {
esicCredit = 0.0;
data[dataIndex][column] = 0.00;
if (!(salCredit == null || salCredit.length == 0))
for (int k = 0; k < salCredit.length; k++) {
// UPDATED BY REEBA BEGINS
try {// totalESICCredit
if (String.valueOf(salCredit[k][2]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
// logger.info("employerESIC========="+employerESIC);
}
} catch (Exception e) {
logger
.error("Exception in employerESIC :"
+ e);
}
// UPDATED BY REEBA ENDS
/*
* Following if condition compares the credit code
* from hrms_credit_head table with
* hrms_sal_cedits_2008 table
*/
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(salCredit[k][0]))) {
if (salCredit[k][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary credit amount will be added
* with the arrear credit amount
*/
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salCredit[k][1]));// +Double.parseDouble("0.00");
total_credit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
}// End of salCredit if condition
} // End of credit code comparison if condition
} // End of salCredit for loop
//logger.info("employerESIC========="
// + esicCredit);
/*try {
if (leaveEncashData != null
|| leaveEncashData.length > 0) {
for (int k2 = 0; k2 < leaveEncashData.length; k2++) {
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(leaveEncashData[k2][1]))) {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(leaveEncashData[k2][0]));//
total_credit += Double.parseDouble(String
.valueOf(leaveEncashData[k2][0]));
}
}
}
} catch (Exception e) {
logger.error("exception in leaveEncahData " + e);
// e.printStackTrace();
}*/
data[dataIndex][column] = checkNullToZero(String
.valueOf(data[dataIndex][column]));
column++;
} // End of credit header for loop
/*
* for (int j = 0; j < credit_header.length; j++) {
* data[dataIndex][column] = 0.00; if(!(salCredit==null ||
* salCredit.length ==0)) for (int k = 0; k < salCredit.length;
* k++) {
* if(String.valueOf(credit_header[j][0]).equals(String.valueOf(salCredit[k][0]))){
* if(salCredit[k][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salCredit[k][1]));
* total_credit
* +=Double.parseDouble(String.valueOf(salCredit[k][1])); } }
*
*
*
*
* column++; }
*/
data[dataIndex][column++] = checkNullToZero(String
.valueOf(String.valueOf(emp_id[i][5]))); // leave enachment
data[dataIndex][column++] = checkNullToZero(String
.valueOf(String.valueOf(emp_id[i][6]))); // gratuity
data[dataIndex][column++] = checkNullToZero(String
.valueOf(String.valueOf(emp_id[i][7]))); // other reimbursement
total_credit = total_credit+(Double.parseDouble(String
.valueOf(emp_id[i][5])))+Double.parseDouble(String
.valueOf(String.valueOf(emp_id[i][6])))+Double.parseDouble(String
.valueOf(String.valueOf(emp_id[i][7])));
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_credit));
column = column + 1;
/** set non-recovery debits */
Object salDebit[][] = getSalaryDebitDataUncheck(String
.valueOf(emp_id[i][3]),fromMonth,toMonth,fromYear,toYear);
double total_nonRecovery = 0;
// UPDATED BY REEBA BEGINS
Object[][] esi_addata = null;
// UPDATED BY REEBA ENDS
/*
* Following loop is used to set the debit head amount values.
*/
for (int k = 0; k < debit_header.length; k++) {
data[dataIndex][column] = 0;
if (!(salDebit == null || salDebit.length == 0))
for (int index = 0; index < salDebit.length; index++) {
/*
* Following loop compares the debit code from
* hrms_debit_head with the debit code from
* hrms_sal_debits_2008(Year entered)
*/
if (String.valueOf(debit_header[k][0]).equals(
String.valueOf(salDebit[index][0]))) {
if (salDebit[index][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary debit amount will be added
* with the arrear debit amount
*/
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salDebit[index][1]));
total_nonRecovery += Double
.parseDouble(String
.valueOf(salDebit[index][1]));
}// End of salDebit if condition
}// End of debit code comparison
} // End of salDebit for loop
column++;
}// End of debit header for loop
/*
* for (int k = 0; k < debit_header.length; k++) {
* data[dataIndex][column] = Utility.twoDecimals("0");
* if(!(salDebit==null || salDebit.length ==0)) for (int index =
* 0; index < salDebit.length; index++) {
* if(String.valueOf(debit_header[k][0]).equals(String.valueOf(salDebit[index][0]))){
* if(salDebit[index][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salDebit[index][1]));
* total_nonRecovery
* +=Double.parseDouble(String.valueOf(salDebit[index][1])); } }
*
*
*
* column++; }
*/
logger.info("total_nonRecovery=="+total_nonRecovery);
data[dataIndex][column++] = Utility.twoDecimals(String.valueOf(emp_id[i][8])); // other deductions
data[dataIndex][column++] = Utility.twoDecimals(String.valueOf(emp_id[i][9])); // outstanding tax
total_nonRecovery = total_nonRecovery + (Double.parseDouble(String.valueOf(emp_id[i][8]))+Double.parseDouble(String.valueOf(emp_id[i][9])));
logger.info("total_nonRecovery=="+total_nonRecovery);
data[dataIndex][column] = formatter.format(total_nonRecovery);
double total_pay = 0;
total_pay = total_credit
- total_nonRecovery;
column = column + 1;
if (Double.parseDouble(String.valueOf(total_pay)) < 0) {
data[dataIndex][column] = "0.00";
} else {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_pay));
}
position_totalPay = column;
esicCredit =0;
employerESIC=0;
employerPF=0;
try {
/**
* Following condition is used to select the arrears for the
* employees.
*/
} catch (Exception e) {
logger.error(e.getMessage());
}
dataIndex++;
} // End of emp_id for loop
dataWithHeader = new Object[data.length + 1][totalCol];
/*
* Following query is used to set the credit and debit head names.
*/
for (int i = 0; i < colNames.length; i++) {
dataWithHeader[0][i] = colNames[i];
}
/*
* Following query is used to set the credit and debit head amount.
*/
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[0].length; j++) {
dataWithHeader[i + 1][j] = data[i][j];
}
}
} catch (Exception e) {
e.printStackTrace();
}
return dataWithHeader;
}
// Following function is called when branch is selected or department is
// selected or both got selected for credit and debit details of the
// employee
public Object[][] getReportData(String query, SettlementRegister settlReg,
String Id, int arrEmpLength, int colTotal, String PFChk, String ESICChk) {
int dataIndex = 0;
String year = settlReg.getYear();
String month = settlReg.getMonth();
Object[][] dataWithHeader = null;
Object[][] arrearCreditAmt = null;
Object[][] arrearDebitAmt = null;
try {
Object emp_id[][] = getEmpIdNew(query);
Object credit_header[][] = getCreditHeader();
Object debit_header[][] = getDebitHeader();
double totArrearAmt = 0;
// Object debit_recovery[][]= getDebitHeader_recovery();
int totalCol = credit_header.length + debit_header.length
+ colTotal + 6;
String[] colNames = null;
int counter = 0;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkConsSummary().equals("N")) {
colNames = new String[totalCol];
colNames[counter] = "Emp Id";
counter = counter + 1;
colNames[counter] = "Employee Name";
counter = counter + 1;
colNames[counter] = "Sal Days";
counter = counter + 1;
} else {
colNames = new String[totalCol - 1];
colNames[counter] = "";
counter = counter + 1;
colNames[counter] = "No. of Employees";
counter = counter + 1;
}
// UPDATED BY REEBA ENDS
/*
* If any check box is selected then that name will appear in the
* column head of the report except consolidated arrears.
*/
if (settlReg.getCheckBrn().equals("Y")) {
colNames[counter] = "Branch";
counter = counter + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
colNames[counter] = "Dept";
counter = counter + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
colNames[counter] = "Desg";
counter = counter + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
colNames[counter] = "Date of\nJoining";
counter = counter + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
colNames[counter] = "Date of\nBirth";
counter = counter + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
colNames[counter] = "Emp Type";
counter = counter + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
colNames[counter] = "Bank";
counter = counter + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
colNames[counter] = "Acc. No.";
counter = counter + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
colNames[counter] = "Pan No.";
counter = counter + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
colNames[counter] = "Gender";
counter = counter + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
colNames[counter] = "On Hold";
counter = counter + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
colNames[counter] = "Grade";
counter = counter + 1;
}
/*
* Following loop sets the credit head names
*/
for (int i = 0; i < credit_header.length; i++) {
colNames[counter] = String.valueOf(credit_header[i][1]);
counter++;
}
colNames[counter] = "Tot Credit";
counter = counter + 1;
/*
* Following loop sets the debit head names
*/
for (int i = 0; i < debit_header.length; i++) {
colNames[counter] = String.valueOf(debit_header[i][1]);
counter++;
}
colNames[counter] = "Tot Debit";
counter = counter + 1;
colNames[counter] = "Net-Pay";
// UPDATED BY REEBA BEGINS
counter = counter + 1;
if (PFChk.equals("Y")) {
colNames[counter] = "Employer contribution to PF";
counter = counter + 1;
}
if (ESICChk.equals("Y")) {
colNames[counter] = "Employer contribution to ESIC";
}
if (PFChk.equals("Y") && ESICChk.equals("Y")) {
colTotal = colTotal - 2;
} else if (PFChk.equals("Y")) {
colTotal = colTotal - 1;
} else if (ESICChk.equals("Y")) {
colTotal = colTotal - 1;
}
// UPDATED BY REEBA ENDS
Object[][] data = null;
if (settlReg.getCheckFlag().equals("N")) {
data = new Object[emp_id.length + arrEmpLength][totalCol];
} else {
data = new Object[emp_id.length][totalCol];
}
/*
* Following loop sets the emp id,emp name,credit head value,debit
* head value and arrear values.
*/
for (int i = 0; i < emp_id.length; i++) {
data[dataIndex][0] = emp_id[i][1];
data[dataIndex][1] = emp_id[i][2];
if (settlReg.getCheckFlag().equals("Y")) {
String arrearDaysQuery = "SELECT NVL(SUM(ARREARS_DAYS),0)FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER "
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE)"
+ " WHERE HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " AND ARREARS_TYPE IN ('M','P') AND HRMS_ARREARS_LEDGER.ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " AND "
+ " ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";// +" group by
// ARREARS_CREDITS_AMT,arrears_net_amt
// " ;
Object[][] arrears_days = getSqlModel().getSingleResult(
arrearDaysQuery);
if (arrears_days != null || arrears_days.length != 0) {
data[dataIndex][2] = Double.parseDouble(String
.valueOf(arrears_days[0][0]))
+ Double.parseDouble(String
.valueOf(emp_id[i][4]));
}
} else {
data[dataIndex][2] = emp_id[i][4];
}
int column = 3;
double totArrACredit = 0;
double totArrDebit = 0;
int position_totalPay = 0;
/*
* If any check box is selected then the value for that column
* will appear in the report.
*/
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex][column] = emp_id[i][5];// Branch
column++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex][column] = emp_id[i][6];// Department
column++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex][column] = emp_id[i][11];// Designation
column++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex][column] = emp_id[i][12];// Date of Joining
column++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex][column] = emp_id[i][7];// Date of Birth
column++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex][column] = emp_id[i][3];// Employee Type
column++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex][column] = emp_id[i][8];// Bank
column++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex][column] = emp_id[i][9];// Salary Account
// Number
column++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex][column] = emp_id[i][10];// Pan number
column++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13]).equals("")
|| String.valueOf(emp_id[i][13]).equals("null")) {
data[dataIndex][column] = "";
} else {
data[dataIndex][column] = emp_id[i][13];// Gender
}
column++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex][column] = emp_id[i][14];// On Hold
column++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex][column] = emp_id[i][15];// Grade
column++;
}
/** set credit values */
double total_credit = 0.00;
Object salCredit[][] = getSalaryCreditData(String
.valueOf(emp_id[i][0]), year, month, settlReg, Id);
// UPDATED BY REEBA BEGINS
double employerESIC = 0.0;
double esicCredit = 0.0;
double employerPF = 0.0;
// UPDATED BY REEBA ENDS
/*
* Following loop sets the credit head values
*/
for (int j = 0; j < credit_header.length; j++) {
// UPDATED BY REEBA
esicCredit = 0.0;
data[dataIndex][column] = 0.00;
if (!(salCredit == null || salCredit.length == 0))
for (int k = 0; k < salCredit.length; k++) {
// UPDATED BY REEBA BEGINS
try {// totalESICCredit
if (String.valueOf(salCredit[k][2]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
// logger.info("employerESIC========="+employerESIC);
}
} catch (Exception e) {
logger
.error("Exception in employerESIC :"
+ e);
}
// UPDATED BY REEBA ENDS
/*
* Following if condition compares the credit code
* from hrms_credit_head table with
* hrms_sal_cedits_2008 table
*/
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(salCredit[k][0]))) {
if (salCredit[k][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary credit amount will be added
* with the arrear credit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_CREDIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_CREDIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_CREDIT_CODE="
+ salCredit[k][0]
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salCredit[k][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_credit += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of checkFlag if condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salCredit[k][1]));
total_credit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
}
}// End of salCredit if condition
}// End of credit code comparison if condition
}// End of salCredit for loop
column++;
}// End of credit header for loop
/*
* for (int j = 0; j < credit_header.length; j++) {
* data[dataIndex][column] = 0.00; if(!(salCredit==null ||
* salCredit.length ==0)) for (int k = 0; k < salCredit.length;
* k++) {
* if(String.valueOf(credit_header[j][0]).equals(String.valueOf(salCredit[k][0]))){
* if(salCredit[k][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salCredit[k][1]));
* total_credit
* +=Double.parseDouble(String.valueOf(salCredit[k][1])); } }
*
*
*
*
* column++; }
*/
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_credit));
column = column + 1;
/** set non-recovery debits */
Object salDebit[][] = getSalDebit(String.valueOf(emp_id[i][0]),
month, year, settlReg, Id);
double total_nonRecovery = 0;
// UPDATED BY REEBA BEGINS
Object[][] esi_data = null;
try {
String esi_query = " SELECT ESI_CODE, ESI_DATE, ESI_COMP_PERCENTAGE, ESI_DEBIT_CODE FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'DD-MON-YYYY') = (SELECT MAX(ESI_DATE) FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'YYYY-MM') <= '"
+ year
+ "-" + month + "') ";
esi_data = getSqlModel().getSingleResult(esi_query);
} catch (Exception e) {
logger.error("Error in calculation employer ESIC: " + e);
}
Object[][] pf_data = null;
try {
String pf_query = " SELECT PF_CODE, PF_DATE, PF_PERCENTAGE, PF_DEBIT_CODE FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'DD-MON-YYYY') = (SELECT MAX(PF_DATE) FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'YYYY-MM') <='"
+ year
+ "-" + month + "') ";
pf_data = getSqlModel().getSingleResult(pf_query);
} catch (Exception e) {
logger.error("Error in calculation employer PF: " + e);
}
// UPDATED BY REEBA ENDS
/*
* Following loop is used to set the debit head amount values.
*/
for (int k = 0; k < debit_header.length; k++) {
data[dataIndex][column] = 0;
if (!(salDebit == null || salDebit.length == 0))
for (int index = 0; index < salDebit.length; index++) {
/*
* Following loop compares the debit code from
* hrms_debit_head with the debit code from
* hrms_sal_debits_2008(Year entered)
*/
if (String.valueOf(debit_header[k][0]).equals(
String.valueOf(salDebit[index][0]))) {
if (salDebit[index][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary debit amount will be added
* with the arrear debit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_DEBIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_DEBIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_DEBIT_CODE="
+ salDebit[index][0]
+ "AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
} else {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble("0.00")));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of check flag condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salDebit[index][1]));
total_nonRecovery += Double
.parseDouble(String
.valueOf(salDebit[index][1]));
}
}// End of salDebit if condition
}// End of debit code comparison
// UPDATED BY REEBA BEGINS
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
if (Double.parseDouble(String
.valueOf(salDebit[index][1])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
employerPF = Double.parseDouble(String.valueOf(salDebit[index][1]));
}
}
// UPDATED BY REEBA ENDS
}// End of salDebit for loop
column++;
}// End of debit header for loop
/*
* for (int k = 0; k < debit_header.length; k++) {
* data[dataIndex][column] = Utility.twoDecimals("0");
* if(!(salDebit==null || salDebit.length ==0)) for (int index =
* 0; index < salDebit.length; index++) {
* if(String.valueOf(debit_header[k][0]).equals(String.valueOf(salDebit[index][0]))){
* if(salDebit[index][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salDebit[index][1]));
* total_nonRecovery
* +=Double.parseDouble(String.valueOf(salDebit[index][1])); } }
*
*
*
* column++; }
*/
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_nonRecovery));
double total_pay = 0;
total_pay = Double.parseDouble(String
.valueOf(data[dataIndex][credit_header.length + 3
+ colTotal]))
- Double.parseDouble(String
.valueOf(data[dataIndex][column]));
column = column + 1;
if (Double.parseDouble(Utility.twoDecimals(total_pay)) < 0) {
data[dataIndex][column] = Utility.twoDecimals("0");
} else {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_pay));
}
// UPDATED BY REEBA BEGINS
column = column + 1;
if (PFChk.equals("Y")) {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerPF));// Employer contribution to
// PF
column++;
}
if (ESICChk.equals("Y")) {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerESIC));
;// Employer contribution to ESIC
}
// UPDATED BY REEBA ENDS
position_totalPay = column;
employerESIC = 0;
employerPF =0;
esicCredit=0;
try {
/**
* Following condition is used to select the arrears for the
* employees.
*/
if (settlReg.getCheckFlag().equals("N")) {
if (arrEmpLength != 0) {
String arrear = " SELECT HRMS_ARREARS_LEDGER.ARREARS_CODE,ARREARS_MONTH,ARREARS_YEAR,ARREARS_DAYS,ARREARS_TYPE,ARREARS_PROMCODE,DECODE(NVL(ARREARS_PAY_TYPE,'ADD'),'ADD','Arrears',"
+ " 'DED','Recovery') FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE) WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' AND EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " ORDER BY ARREARS_MONTH,ARREARS_YEAR";
Object[][] arrearCode = getSqlModel()
.getSingleResult(arrear);
if (!(arrearCode == null || arrearCode.length == 0)) {
for (int arrCode = 0; arrCode < arrearCode.length; arrCode++) {
totArrACredit = 0;
totArrDebit = 0;
if (String.valueOf(arrearCode[arrCode][5])
.equals("")
|| String.valueOf(
arrearCode[arrCode][5])
.equals("null")) {
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
} else {
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
}
String arrMonth = Utility
.month(Integer
.parseInt(String
.valueOf(arrearCode[arrCode][1])));
int arrearCol = 0;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][1];// Emp id
arrearCol = arrearCol + 1;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][2]
+ "\n"
+ String
.valueOf(arrearCode[arrCode][6])
+ " for "
+ arrMonth
+ "-"
+ String
.valueOf(arrearCode[arrCode][2]);// Employee
// Name
arrearCol = arrearCol + 1;
if (String.valueOf(arrearCode[arrCode][3])
.equals("null")
|| String.valueOf(
arrearCode[arrCode][3])
.equals("")) {
data[dataIndex + 1][arrearCol] = "";// Arrears
// Days
} else {
data[dataIndex + 1][arrearCol] = ""
+ String
.valueOf(arrearCode[arrCode][3]);
}
arrearCol = arrearCol + 1;
/*
* Following conditions set the values for
* the selected check boxes in the salary
* register report.
*/
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][5];// Branch
arrearCol++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][6];// Department
arrearCol++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][11];// Designation
arrearCol++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][12];// Date
// of
// Joining
arrearCol++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][7];// Date
// of
// Birth
arrearCol++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][3];// Employee
// Type
arrearCol++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][8];// Bank
// Name
arrearCol++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][9];// Salary
// Account
// No.
arrearCol++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][10];// Pan
// Number
arrearCol++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13])
.equals("")
|| String
.valueOf(emp_id[i][13])
.equals("null")) {
data[dataIndex + 1][arrearCol] = "";
} else {
data[dataIndex + 1][arrearCol] = emp_id[i][13];// Gender
}
arrearCol++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][14];// On
// Hold
arrearCol++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][15];// Grade
arrearCol++;
}
/*
* Following loop is used to set the arrear
* credit amount from
* HRMS_ARREARS_CREDIT_2008(*Year Entered)
* table
*/
for (int ac = 0; ac < arrearCreditAmt.length; ac++) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(
arrearCreditAmt[ac][0]).equals(
"null")
|| String.valueOf(
arrearCreditAmt[ac][0])
.equals("")
|| String.valueOf(
arrearCreditAmt[ac][0])
.equals("")) {
totArrACredit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrACredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(arrearCreditAmt[ac][1]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
}
}
arrearCol++;
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrACredit));
arrearCol = arrearCol + 1;
/*
* Following loop is used to set the arrear
* debit amount from HRMS_ARREARS_DEBIT_2008
*/
for (int ad = 0; ad < arrearDebitAmt.length; ad++) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearDebitAmt[ad][0]));
if (String.valueOf(
arrearDebitAmt[ad][0]).equals(
"null")
|| String.valueOf(
arrearDebitAmt[ad][0])
.equals("")) {
totArrDebit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrDebit += Double
.parseDouble(String
.valueOf(arrearDebitAmt[ad][0]));
}
arrearCol++;
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
if (Double.parseDouble(String
.valueOf(arrearDebitAmt[ad][0])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
employerPF = Double.parseDouble(String.valueOf(arrearDebitAmt[ad][0]));
}
}
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrDebit));
totArrearAmt = Double
.parseDouble(String
.valueOf(data[dataIndex + 1][credit_header.length
+ colTotal + 3]))
- Double
.parseDouble(String
.valueOf(data[dataIndex + 1][arrearCol]));
// data[dataIndex+1][arrearCol]=Utility.twoDecimals(totArrDebit);
arrearCol = arrearCol + 1;
if (Double.parseDouble(String
.valueOf(totArrearAmt)) < 0) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals("0.00");
} else {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrearAmt));
}
// UPDATED BY REEBA BEGINS
arrearCol++;
if (PFChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerPF)); // Employer
// contribution
// to
// PF
arrearCol++;
}
if (ESICChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerESIC)); ;// Employer
// contribution
// to
// ESIC
}
// UPDATED BY REEBA ENDS
dataIndex++;
}// End of arrear code for loop
}// End of arrear code if condition
}// End of arrearEmpLength if condition
}// End of check flag
} catch (Exception e) {
logger.error(e.getMessage());
}
dataIndex++;
}// End of emp_id for loop
dataWithHeader = new Object[data.length + 1][totalCol];
/*
* Following query is used to set the credit and debit head names.
*/
for (int i = 0; i < colNames.length; i++) {
dataWithHeader[0][i] = colNames[i];
}
/*
* Following query is used to set the credit and debit head amount.
*/
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[0].length; j++) {
dataWithHeader[i + 1][j] = data[i][j];
}
}
String finalHeader[] = new String[dataWithHeader[0].length];
int[] cellWidth = new int[dataWithHeader[0].length];
int[] alignment = new int[dataWithHeader[0].length];
for (int i = 0; i < dataWithHeader[0].length; i++) {
finalHeader[i] = (String) dataWithHeader[0][i];
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
cellWidth[2] = 10;
cellWidth[3] = 7;
}
}
Object finalData[][] = new Object[dataWithHeader.length - 1][dataWithHeader[0].length];
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = dataWithHeader[i + 1][j];
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return dataWithHeader;
}
/*
* Following function is called in the reportDatanoSelect() method.This
* method returns the emp id,emp name,credit head,debit head and values and
* also the arrear value if any.
*/
public Object[][] getReportDataNoBranchDept(String query,
SettlementRegister settlReg, String brnCode, String deptCode,
int arrEmpLength, int colTotal, String PFChk, String ESICChk) {
int dataIndex = 0;
String year = settlReg.getYear();
String month = settlReg.getMonth();
Object[][] dataWithHeader = null;
Object[][] arrearCreditAmt = null;
Object[][] arrearDebitAmt = null;
try {
Object emp_id[][] = getEmpIdNew(query);
Object credit_header[][] = getCreditHeader();
Object debit_header[][] = getDebitHeader();
double totArrearAmt = 0;
// Object debit_recovery[][]= getDebitHeader_recovery();
int totalCol = credit_header.length + debit_header.length
+ colTotal + 6;
int counter = 0;
String[] colNames = null;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkConsSummary().equals("N")) {
colNames = new String[totalCol];
colNames[counter] = "Emp Id";
counter = counter + 1;
colNames[counter] = "Employee Name";
counter = counter + 1;
colNames[counter] = "Sal Days";
counter = counter + 1;
} else {
colNames = new String[totalCol - 1];
colNames[counter] = "";
counter = counter + 1;
colNames[counter] = "No. of Employees";
counter = counter + 1;
}
// UPDATED BY REEBA ENDS
if (settlReg.getCheckBrn().equals("Y")) {
colNames[counter] = "Branch";
counter = counter + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
colNames[counter] = "Dept";
counter = counter + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
colNames[counter] = "Desg";
counter = counter + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
colNames[counter] = "Date Of\nJoining";
counter = counter + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
colNames[counter] = "Date of\nBirth";
counter = counter + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
colNames[counter] = "Emp Type";
counter = counter + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
colNames[counter] = "Bank";
counter = counter + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
colNames[counter] = "Acc. No.";
counter = counter + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
colNames[counter] = "Pan No.";
counter = counter + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
colNames[counter] = "Gender";
counter = counter + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
colNames[counter] = "On Hold";
counter = counter + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
colNames[counter] = "Grade";
counter = counter + 1;
}
/*
* Following loop sets the credit head names
*/
for (int i = 0; i < credit_header.length; i++) {
colNames[counter] = String.valueOf(credit_header[i][1]);
counter++;
}
colNames[counter] = "TOT CREDIT";
counter = counter + 1;
/*
* Following loop sets the debit head names
*/
for (int i = 0; i < debit_header.length; i++) {
colNames[counter] = String.valueOf(debit_header[i][1]);
counter++;
}
colNames[counter] = "TOT DEBIT";
counter = counter + 1;
colNames[counter] = "NET-PAY";
// UPDATED BY REEBA BEGINS
counter = counter + 1;
if (PFChk.equals("Y")) {
colNames[counter] = "Employer contribution to PF";
counter = counter + 1;
}
if (ESICChk.equals("Y")) {
colNames[counter] = "Employer contribution to ESIC";
}
if (PFChk.equals("Y") && ESICChk.equals("Y")) {
colTotal = colTotal - 2;
} else if (PFChk.equals("Y")) {
colTotal = colTotal - 1;
} else if (ESICChk.equals("Y")) {
colTotal = colTotal - 1;
}
// UPDATED BY REEBA ENDS
Object[][] data = null;
if (settlReg.getCheckFlag().equals("N")) {
data = new Object[emp_id.length + arrEmpLength][totalCol];
} else {
data = new Object[emp_id.length][totalCol];
}
/*
* Following loop sets the corresponding values to the headers
*/
for (int i = 0; i < emp_id.length; i++) {
data[dataIndex][0] = emp_id[i][1];
data[dataIndex][1] = emp_id[i][2];
if (settlReg.getCheckFlag().equals("Y")) {
String arrearDaysQuery = "SELECT NVL(SUM(ARREARS_DAYS),0)FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER "
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE)"
+ " WHERE HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " AND ARREARS_TYPE IN ('M','P') AND HRMS_ARREARS_LEDGER.ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " AND "
+ " ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ "AND ARREARS_PAY_IN_SAL = 'Y' ";// +" group by
// ARREARS_CREDITS_AMT,arrears_net_amt
// " ;
Object[][] arrears_days = getSqlModel().getSingleResult(
arrearDaysQuery);
if (arrears_days != null || arrears_days.length != 0) {
data[dataIndex][2] = Double.parseDouble(String
.valueOf(arrears_days[0][0]))
+ Double.parseDouble(String
.valueOf(emp_id[i][4]));
}
} else {
data[dataIndex][2] = emp_id[i][4];
}
// data[dataIndex][3]=emp_id[i][4];
int column = 3;
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex][column] = emp_id[i][5];
column++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex][column] = emp_id[i][6];
column++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex][column] = emp_id[i][11];
column++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex][column] = emp_id[i][12];
column++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex][column] = emp_id[i][7];
column++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex][column] = emp_id[i][3];
column++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex][column] = emp_id[i][8];
column++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex][column] = emp_id[i][9];
column++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex][column] = emp_id[i][10];
column++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13]).equals("")
|| String.valueOf(emp_id[i][13]).equals("null")) {
data[dataIndex][column] = "";
} else {
data[dataIndex][column] = emp_id[i][13];// Gender
}
column++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex][column] = emp_id[i][14];// On Hold
column++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex][column] = emp_id[i][15];// Grade
column++;
}
double totArrACredit = 0;
double totArrDebit = 0;
int position_totalPay = 0;
/** set credit values */
double total_credit = 0.00;
// UPDATED BY REEBA BEGINS
double employerESIC = 0.0;
double esicCredit = 0.0;
double employerPF = 0.0;
// UPDATED BY REEBA ENDS
Object salCredit[][] = getSalaryCreditDataNoSelect(String
.valueOf(emp_id[i][0]), year, month, settlReg, brnCode,
deptCode);
// getSalaryCreditData(String.valueOf(emp_id[i][0]), year,
// month,settlReg,Id) ;
/*
* Following query is used to set the credit head amount
*/
for (int j = 0; j < credit_header.length; j++) {
// UPDATED BY REEBA
esicCredit = 0.0;
data[dataIndex][column] = 0.00;
if (!(salCredit == null || salCredit.length == 0))
/**
* Following loop compares the credit code from
* HRMS_CREDIT_HEAD with HRMS_SAL_CREDIT_2008(Year
* Entered)
*/
for (int k = 0; k < salCredit.length; k++) {
// UPDATED BY REEBA BEGINS
try {// totalESICCredit
if (String.valueOf(salCredit[k][2]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
// logger.info("employerESIC========="+employerESIC);
}
} catch (Exception e) {
logger
.error("Exception in employerESIC :"
+ e);
}
// UPDATED BY REEBA ENDS
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(salCredit[k][0]))) {
if (salCredit[k][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary credit amount will be added
* with the arrear credit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_CREDIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_CREDIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_CREDIT_CODE="
+ salCredit[k][0]
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salCredit[k][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_credit += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of the check flag condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salCredit[k][1]));
total_credit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
}
}// End of Salcredit condition
}
}// End of inner for loop
column++;
}// End of outer for loop
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_credit));
column = column + 1;
/** set non-recovery debits */
Object salDebit[][] = getSalDebitNotSelect(String
.valueOf(emp_id[i][0]), month, year, settlReg, brnCode,
deptCode);
// getSalDebit(String.valueOf(emp_id[i][0]),month,year,settlReg,Id)
// ;
double total_nonRecovery = 0;
// UPDATED BY REEBA BEGINS
Object[][] esi_data = null;
try {
String esi_query = " SELECT ESI_CODE, ESI_DATE, ESI_COMP_PERCENTAGE, ESI_DEBIT_CODE FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'DD-MON-YYYY') = (SELECT MAX(ESI_DATE) FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'YYYY-MM') <= '"
+ year
+ "-" + month + "') ";
esi_data = getSqlModel().getSingleResult(esi_query);
} catch (Exception e) {
logger.error("Error in calculation employer ESIC: " + e);
}
Object[][] pf_data = null;
try {
String pf_query = " SELECT PF_CODE, PF_DATE, PF_PERCENTAGE, PF_DEBIT_CODE FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'DD-MON-YYYY') = (SELECT MAX(PF_DATE) FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'YYYY-MM') <='"
+ year
+ "-" + month + "') ";
pf_data = getSqlModel().getSingleResult(pf_query);
} catch (Exception e) {
logger.error("Error in calculation employer PF: " + e);
}
// UPDATED BY REEBA ENDS
/*
* Following loop is used to set the debit head amount.
*/
for (int k = 0; k < debit_header.length; k++) {
data[dataIndex][column] = 0;
if (!(salDebit == null || salDebit.length == 0))
/*
* Following loop compares the debit code from
* hrms_debit_head with the debit code from
* hrms_sal_debits_2008(Year entered)
*/
for (int index = 0; index < salDebit.length; index++) {
if (String.valueOf(debit_header[k][0]).equals(
String.valueOf(salDebit[index][0]))) {
if (salDebit[index][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary debit amount will be added
* with the arrear debit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_DEBIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_DEBIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_DEBIT_CODE="
+ salDebit[index][0]
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
} else {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble("0.00")));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of check flag condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salDebit[index][1]));
total_nonRecovery += Double
.parseDouble(String
.valueOf(salDebit[index][1]));
}
}// end of sal debit if condition
}// End of comparison of debit code condition
// UPDATED BY REEBA BEGINS
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
if (Double.parseDouble(String
.valueOf(salDebit[index][1])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
employerPF = Double.parseDouble(String.valueOf(salDebit[index][1]));
}
}
// UPDATED BY REEBA ENDS
}// End of sal debit for loop
column++;
}// End of debit head loop
// logger.info("Length of arrear Debit code
// pkppp"+arrearDebitCode.length);
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_nonRecovery));
double total_pay = 0;
total_pay = Double.parseDouble(String
.valueOf(data[dataIndex][credit_header.length
+ colTotal + 3]))
- Double.parseDouble(String
.valueOf(data[dataIndex][column]));
column = column + 1;
if (Double.parseDouble(Utility.twoDecimals(total_pay)) < 0) {
data[dataIndex][column] = Utility.twoDecimals("0");
} else {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_pay));
}
// UPDATED BY REEBA BEGINS
column = column + 1;
if (PFChk.equals("Y")) {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerPF));// Employer contribution to
// PF
column++;
}
if (ESICChk.equals("Y")) {
//logger.info("employerESIC last=========" + employerESIC);
//logger.info("employerESIC column=========" + column);
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerESIC));
;// Employer contribution to ESIC
}
// UPDATED BY REEBA ENDS
position_totalPay = column;
employerESIC = 0;
employerPF =0;
esicCredit=0;
//logger.info("position_totalPay :" + position_totalPay);
try {
/**
* Following condition is used to select the arrears for the
* employees.
*/
if (settlReg.getCheckFlag().equals("N")) {
if (arrEmpLength != 0) {
String arrear = " SELECT HRMS_ARREARS_LEDGER.ARREARS_CODE,ARREARS_MONTH,ARREARS_YEAR,ARREARS_DAYS,ARREARS_TYPE,"
+ "ARREARS_PROMCODE,DECODE(NVL(ARREARS_PAY_TYPE,'ADD'),'ADD','Arrears',"
+ " 'DED','Recovery') FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' AND EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " ORDER BY ARREARS_MONTH,ARREARS_YEAR";
Object[][] arrearCode = getSqlModel()
.getSingleResult(arrear);
if (!(arrearCode == null || arrearCode.length == 0)) {
for (int arrCode = 0; arrCode < arrearCode.length; arrCode++) {
totArrACredit = 0;
totArrDebit = 0;
if (String.valueOf(arrearCode[arrCode][5])
.equals("")
|| String.valueOf(
arrearCode[arrCode][5])
.equals("null")) {
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
} else {
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
}
String arrMonth = Utility
.month(Integer
.parseInt(String
.valueOf(arrearCode[arrCode][1])));
// arrearCreditAmt=arrearCreditData(String.valueOf(arrearCode[arrCode][0]),String.valueOf(emp_id[i][0]),String.valueOf(arrearCode[arrCode][1]),String.valueOf(arrearCode[arrCode][2]),credit_header,String.valueOf(arrearCode[arrCode][4]),String.valueOf(arrearCode[arrCode][5]),settlReg);
// arrearDebitAmt=arrearDebitData(String.valueOf(arrearCode[arrCode][0]),String.valueOf(emp_id[i][0]),String.valueOf(arrearCode[arrCode][1]),String.valueOf(arrearCode[arrCode][2]),debit_header,String.valueOf(arrearCode[arrCode][4]),String.valueOf(arrearCode[arrCode][5]),settlReg);
// String
// arrMonth=Utility.month(Integer.parseInt(String.valueOf(arrearCode[arrCode][1])));
int arrearCol = 0;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][1];
arrearCol = arrearCol + 1;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][2]
+ "\n"
+ String
.valueOf(arrearCode[arrCode][6])
+ " for "
+ arrMonth
+ "-"
+ String
.valueOf(arrearCode[arrCode][2]);
arrearCol = arrearCol + 1;
if (String.valueOf(arrearCode[arrCode][3])
.equals("null")
|| String.valueOf(
arrearCode[arrCode][3])
.equals("")) {
data[dataIndex + 1][arrearCol] = "";// +String.valueOf(arrearCode[arrCode][3]);
} else {
data[dataIndex + 1][arrearCol] = ""
+ String
.valueOf(arrearCode[arrCode][3]);
}
arrearCol = arrearCol + 1;
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][5];
arrearCol++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][6];
arrearCol++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][11];
arrearCol++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][12];
arrearCol++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][7];
arrearCol++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][3];
arrearCol++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][8];
arrearCol++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][9];
arrearCol++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][10];
arrearCol++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13])
.equals("")
|| String
.valueOf(emp_id[i][13])
.equals("null")) {
data[dataIndex + 1][arrearCol] = "";
} else {
data[dataIndex + 1][arrearCol] = emp_id[i][13];// Gender
}
arrearCol++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][14];
arrearCol++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][15];
arrearCol++;
}
/*
* arrearCol=arrearCol+1;
* data[dataIndex+1][arrearCol]=""+emp_id[i][3];//Emp
* type
*/
// Following loop is used to set the arrear
// credit amount.
for (int ac = 0; ac < arrearCreditAmt.length; ac++) {
if (arrearCreditAmt != null)
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(
arrearCreditAmt[ac][0]).equals(
"null")
|| String.valueOf(
arrearCreditAmt[ac][0])
.equals("")) {
totArrACredit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrACredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(arrearCreditAmt[ac][1]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
}
}
arrearCol++;
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrACredit));
arrearCol = arrearCol + 1;
/*
* Following loop is used to the arrear
* debit amount
*/
for (int ad = 0; ad < arrearDebitAmt.length; ad++) {
if (arrearDebitAmt != null)
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearDebitAmt[ad][0]));
if (String.valueOf(
arrearDebitAmt[ad][0]).equals(
"")
|| String.valueOf(
arrearDebitAmt[ad][0])
.equals("null")) {
totArrDebit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrDebit += Double
.parseDouble(String
.valueOf(arrearDebitAmt[ad][0]));
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
if (Double.parseDouble(String
.valueOf(arrearDebitAmt[ad][0])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
employerPF = Double.parseDouble(String.valueOf(arrearDebitAmt[ad][0]));
}
}
}
arrearCol++;
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrDebit));
// arrearCol=arrearCol+1;
// data[dataIndex+1][arrearCol]=Utility.twoDecimals(totArrDebit);
totArrearAmt = Double
.parseDouble(String
.valueOf(data[dataIndex + 1][credit_header.length
+ colTotal + 3]))
- Double
.parseDouble(String
.valueOf(data[dataIndex + 1][arrearCol]));
arrearCol = arrearCol + 1;
if (Double.parseDouble(String
.valueOf(totArrearAmt)) < 0) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals("0.00");
} else {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrearAmt));
}
// UPDATED BY REEBA BEGINS
arrearCol++;
if (PFChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerPF));// Employer
// contribution
// to
// PF
arrearCol++;
}
if (ESICChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerESIC));// Employer;// Employer
// contribution
// to
// ESIC
}
// UPDATED BY REEBA ENDS
dataIndex++;
}// End of arrear code for loop
}
}// End of arrearEmpLength if condition
}// End of check flag
} catch (Exception e) {
logger.error(e.getMessage());
}
dataIndex++;
}// End of emp_id for loop
dataWithHeader = new Object[data.length + 1][totalCol];
/*
* Following loop sets the column names
*/
for (int i = 0; i < colNames.length; i++) {
dataWithHeader[0][i] = colNames[i];
}
/*
* Following loop sets the column values
*/
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[0].length; j++) {
dataWithHeader[i + 1][j] = data[i][j];
}
}
String finalHeader[] = new String[dataWithHeader[0].length];
int[] cellWidth = new int[dataWithHeader[0].length];
int[] alignment = new int[dataWithHeader[0].length];
for (int i = 0; i < dataWithHeader[0].length; i++) {
finalHeader[i] = (String) dataWithHeader[0][i];
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
cellWidth[2] = 10;
cellWidth[3] = 7;
}
}
Object finalData[][] = new Object[dataWithHeader.length - 1][dataWithHeader[0].length];
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = dataWithHeader[i + 1][j];
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return dataWithHeader;
}
public Object[][] getLeaveEncashmentDataUncheck(String emp_id, String year,
String month) {
String query = "SELECT SUM(NVL(ENCASHMENT_ENCASH_AMOUNT,0)),ENCASHMENT_CREDIT_CODE FROM HRMS_ENCASHMENT_PROCESS_HDR"
+ " LEFT JOIN HRMS_ENCASHMENT_PROCESS_DTL ON(HRMS_ENCASHMENT_PROCESS_HDR.ENCASHMENT_PROCESS_CODE=HRMS_ENCASHMENT_PROCESS_DTL.ENCASHMENT_PROCESS_CODE AND EMP_ID="
+ emp_id
+ ")"
+ " WHERE ENCASHMENT_PROCESS_FLAG= 'Y' AND ENCASHMENT_INCLUDE_SAL_FLAG ='Y' AND ENCASHMENT_INCLUDE_SAL_MONTH="
+ month
+ " AND ENCASHMENT_INCLUDE_SAL_YEAR="
+ year
+ " GROUP BY ENCASHMENT_CREDIT_CODE";
Object leaveEncashData[][] = getSqlModel().getSingleResult(query);
return leaveEncashData;
}
/**
* Checks for the null value and if it finds it to be null then replaces it
* with blank.
*
* @param result :-
* Input String to be checked
* @return : - returns the checked string
*/
public static String checkNullToZero(String result) {
if (result == null || result.equals("null")) {
return "0";
} else {
return result;
}
}
public void reportDataNoSelect(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0;
int arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
String finalHeader[] = null;
int colTotal = 0;
String selectQueryInner = "SELECT DEPT_ID,DEPT_NAME from HRMS_DEPT";
Object[][] loop_data_inner = getSqlModel().getSingleResult(
selectQueryInner);
if (loop_data.length > 0) {
for (int a = 0; a < loop_data.length; a++) {
for (int b = 0; b < loop_data_inner.length; b++) {
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ "";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += " AND SAL_DEPT=" + loop_data_inner[b][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type IN('M','P') AND ARREARS_PAY_IN_SAL = 'Y'"
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ " and SAL_DEPT=" + loop_data_inner[b][0];
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE
* FROM HRMS_ARREARS_"+settlReg.getYear()+" " + " inner
* join HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" + " and
* arrears_type='M' and EMP_CENTER="+loop_data[a][0]+ "
* and EMP_DEPT="+loop_data_inner[b][0];
*/
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
Object[][] reportDataPay = getReportDataNoBranchDept(
selectSalaryLoop, settlReg, String
.valueOf(loop_data[a][0]), String
.valueOf(loop_data_inner[b][0]),
arrEmpLength, check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
// getReportDataNotSelect(selectSalaryLoop,settlReg,String.valueOf(loop_data[a][0]),String.valueOf(loop_data_inner[b][0]),arrEmpLength);//getReportData(selectSalaryLoop,settlReg);
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String
.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit
* head values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
/**
* Following loop is used to set the sum of the
* individual credit and debit head values.
*/
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals(
"null")
|| String.valueOf(finalData[j][i])
.equals("null.00")
|| String.valueOf(finalData[j][i])
.equals("")
|| String.valueOf(finalData[j][i]) == null) {
finalData[j][i] = "0";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility.twoDecimals(formatter
.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility
.twoDecimals(formatter.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4];
* filterObj[0][0] = "Designation : "; filterObj[0][1] =
* settlReg.getDesgName(); filterObj[0][2] = "Employee
* Type : "; filterObj[0][3] = settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + loop_data[a][1]
+ " Department : " + loop_data_inner[b][1],
0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth,
// alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportDataPay if condition
}// End of loop_data_inner loop
}// End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = formatter.format(Double
.parseDouble(String.valueOf(totList
.get(arrCount))));
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] = "GRAND TOTAL :-";
grand_total[0][1] = " ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
//rg.addText("GRAND TOTAL",0,0,0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
}//End of loop_data if condition
}
/**
* @author REEBA_JOSEPH
* To generate report Branchwise
* @param settlReg
* @param response
*/
public void generateBranchwiseReport(SettlementRegister settlReg,
HttpServletResponse response) {
String reportType = settlReg.getReport();
String reportName = "Salary Register_" + settlReg.getDivName() + " for "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + "_"
+ settlReg.getYear();
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ", 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ";
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
rg.addText("\n", 0, 1, 0);
if (settlReg.getBranchCode().equals("")) {
//logger.info("Only Branch====Branch code nil");
String selectQuery = "SELECT CENTER_ID,CENTER_NAME FROM HRMS_CENTER ORDER BY CENTER_ID";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportOnlyForBranch(loop_data, rg, settlReg);
} else {
//logger.info("Only Branch====Branch code present : "
// + settlReg.getBranchCode());
Object[][] loop_data = new Object[1][2];
loop_data[0][0] = settlReg.getBranchCode();
loop_data[0][1] = settlReg.getBranchName();
reportOnlyForBranch(loop_data, rg, settlReg);
}
rg.createReport(response);
}
/**
* @author REEBA_JOSEPH
* To generate report Departmentwise
* @param settlReg
* @param response
*/
public void generateDepartmentwiseReport(SettlementRegister settlReg,
HttpServletResponse response) {
String reportType = settlReg.getReport();
String reportName = "Salary Register_" + settlReg.getDivName() + " for "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + "_"
+ settlReg.getYear();
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ", 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ";
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
rg.addText("\n", 0, 1, 0);
if (settlReg.getDeptCode().equals("")) {
//logger.info("Only Department====Department code nil");
String selectQuery = "SELECT DEPT_ID,DEPT_NAME FROM HRMS_DEPT ORDER BY DEPT_ID";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportOnlyForDepartment(loop_data, rg, settlReg);
} else {
//logger.info("Only Department====Department code present : "
// + settlReg.getDeptCode());
Object[][] loop_data = new Object[1][2];
loop_data[0][0] = settlReg.getDeptCode();
loop_data[0][1] = settlReg.getDeptName();
reportOnlyForDepartment(loop_data, rg, settlReg);
}
rg.createReport(response);
}
/**
* @author REEBA_JOSEPH
* @param loop_data
* @param rg
* @param settlReg
*/
public void reportOnlyForDepartment(Object[][] loop_data,
ReportGenerator rg, SettlementRegister settlReg) {
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0;
int arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
String finalHeader[] = null;
int colTotal = 0;
if (loop_data.length > 0) {
//logger.info("Loop count ============= " + loop_data.length);
for (int a = 0; a < loop_data.length; a++) {
//logger.info("For Department ============= " + loop_data[a][0]);
String selectSalaryLoop = "";
try {
selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
//String where = " AND SAL_EMP_CENTER=" + loop_data[a][0]
// + "";
String where = " AND SAL_DEPT=" + loop_data[a][0] + "";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
// where+=" AND SAL_DEPT="+loop_data_inner[b][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
} catch (Exception e) {
logger.error("Error in Salary query : " + e);
e.printStackTrace();
}
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_REF_YEAR="
+ settlReg.getYear()
+ " and arrears_type IN('M','P') AND ARREARS_PAY_IN_SAL = 'Y'"
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
//+ " AND SAL_EMP_CENTER=" + loop_data[a][0];
+ " AND SAL_DEPT=" + loop_data[a][0];
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error("Error in arrears query : " + e);
e.printStackTrace();
}
Object[][] reportDataPay = null;
try {
reportDataPay = getReportDataNoBranchDept(selectSalaryLoop,
settlReg, "0", String.valueOf(loop_data[a][0]),
arrEmpLength, check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
} catch (Exception e) {
logger.error("Error in getting report data : " + e);
e.printStackTrace();
}
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
//String finalHeader[] = new String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
//logger.info("finalData["+i+"]["+j+"]=========="+finalData[i][j]);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
/**
* Following loop is used to set the sum of the individual
* credit and debit head values.
*/
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals(
"null.00")
|| String.valueOf(finalData[j][i]).equals(
"")
|| String.valueOf(finalData[j][i]) == null) {
finalData[j][i] = "0";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
rg.addText("Department : " + loop_data[a][1], 0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
//Object[][] summaryObj = new Object[1][1];
//summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
//rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
}// End of reportDataPay if condition
} // End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = formatter.format(Double
.parseDouble(String.valueOf(totList
.get(arrCount))));
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] = "GRAND TOTAL :-";
grand_total[0][1] = " ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
// rg.addText("GRAND TOTAL",0,0,0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total, cellWidth, alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
} //End of loop_data if condition
}
}
|
UTF-8
|
Java
| 205,960
|
java
|
SettlementRegisterModel.java
|
Java
|
[
{
"context": "|HRMS_EMP_OFFC.EMP_LNAME) \";\r\n\t\r\n\r\n\t// UPDATED BY REEBA\r\n\tObject[][] reportDataPay = getReportDataUnCheck",
"end": 10072,
"score": 0.9985970854759216,
"start": 10067,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "= \" AND SAL_DEPT=\" + deptCode;\r\n\t}\r\n\t// UPDATED BY REEBA ENDS\r\n\tledgCode += \" AND LEDGER_STATUS IN ('SAL_F",
"end": 15648,
"score": 0.9983088970184326,
"start": 15643,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "ledgCode,\r\n\t\t\tnew Object[0][0]);\r\n\r\n\t// UPDATED BY REEBA\r\n\tString selectCredits = \"SELECT SAL_CREDIT_COD",
"end": 15859,
"score": 0.9970347881317139,
"start": 15854,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "e,\r\n\t\t\t\tnew Object[0][0]);\r\n\r\n\t}\r\n\r\n\t// UPDATED BY REEBA\r\n\tString sal_Amount = \"SELECT SAL_CREDIT_CODE,S",
"end": 27634,
"score": 0.9974715113639832,
"start": 27629,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "= \" AND SAL_DEPT=\" + deptCode;\r\n\t}\r\n\t// UPDATED BY REEBA ENDS\r\n\tledgCode += \" AND LEDGER_STATUS IN ('SAL_FINAL'",
"end": 43284,
"score": 0.9409198760986328,
"start": 43274,
"tag": "NAME",
"value": "REEBA ENDS"
},
{
"context": "s(\"Y\")) {\r\n\tcheck = check + 1;\r\n}\r\n\r\n// UPDATED BY REEBA BEGINS\r\nif (settlReg.getCheckEmployerPF().equals(\"Y\")) {",
"end": 47711,
"score": 0.9261554479598999,
"start": 47699,
"tag": "NAME",
"value": "REEBA BEGINS"
},
{
"context": "als(\"Y\")) {\r\n\tcheck = check + 1;\r\n}\r\n// UPDATED BY REEBA ENDS\r\n\r\n\r\nString finalHeader[] = null;\r\nint colTo",
"end": 47884,
"score": 0.9971818923950195,
"start": 47879,
"tag": "NAME",
"value": "REEBA"
},
{
"context": " {\r\n\tcheck = check + 1;\r\n}\r\n// UPDATED BY REEBA ENDS\r\n\r\n\r\nString finalHeader[] = null;\r\nint colTotal =",
"end": 47889,
"score": 0.5128441452980042,
"start": 47887,
"tag": "NAME",
"value": "DS"
},
{
"context": "End of loop_data if condition\r\n}\r\n\r\n/**\r\n* @author REEBA_JOSEPH\r\n* @param loop_data\r\n* @param rg\r\n* @param settlR",
"end": 90542,
"score": 0.9987400770187378,
"start": 90530,
"tag": "USERNAME",
"value": "REEBA_JOSEPH"
},
{
"context": "equals(\"Y\")){\r\n\tcheck=check+1;\r\n}\r\n\r\n// UPDATED BY REEBA BEGINS\r\nif (settlReg.getCheckEmployerPF().equals(",
"end": 91619,
"score": 0.9985654354095459,
"start": 91614,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "als(\"Y\")) {\r\n\tcheck = check + 1;\r\n}\r\n// UPDATED BY REEBA ENDS\r\nint colTotal = 0;\r\nif (loop_data.length > 0",
"end": 91799,
"score": 0.9983577728271484,
"start": 91794,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "; k < salCredit.length; k++) {\r\n\t\t\t\t\t// UPDATED BY REEBA BEGINS\r\n\t\t\t\t\ttry {// totalESICCredit\r\n\t\t\t\t\t\tif (S",
"end": 107544,
"score": 0.9898564219474792,
"start": 107539,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "IC :\"\r\n\t\t\t\t\t\t\t\t\t\t+ e);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// UPDATED BY REEBA ENDS\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Following if condit",
"end": 107967,
"score": 0.9968075752258301,
"start": 107962,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "\r\n\t\tdouble total_nonRecovery = 0;\r\n\t\t// UPDATED BY REEBA BEGINS\r\n\t\tObject[][] esi_addata = null;\r\n\t\t\r\n\t\t\r\n",
"end": 111196,
"score": 0.9919039607048035,
"start": 111191,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "ct[][] esi_addata = null;\r\n\t\t\r\n\t\t\r\n\t\t// UPDATED BY REEBA ENDS\r\n\t\t\r\n\t\t/*\r\n\t\t * Following loop is used to se",
"end": 111267,
"score": 0.993487536907196,
"start": 111262,
"tag": "NAME",
"value": "REEBA"
},
{
"context": " {\r\n\t\tcolTotal = colTotal - 1;\r\n\t}\r\n\t// UPDATED BY REEBA ENDS\r\n\t\r\n\tObject[][] data = null;\r\n\tif (settlReg.getCh",
"end": 118672,
"score": 0.8746845126152039,
"start": 118662,
"tag": "NAME",
"value": "REEBA ENDS"
},
{
"context": "[0]), year, month, settlReg, Id);\r\n\t\t// UPDATED BY REEBA BEGINS\r\n\t\tdouble employerESIC = 0.0;\r\n\t\tdouble ",
"end": 122307,
"score": 0.704902172088623,
"start": 122304,
"tag": "NAME",
"value": "REE"
},
{
"context": " 0.0;\r\n\t\tdouble employerPF = 0.0;\r\n\t\t// UPDATED BY REEBA ENDS\r\n\t\t/*\r\n\t\t * Following loop sets the credit h",
"end": 122425,
"score": 0.9982612133026123,
"start": 122420,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "j < credit_header.length; j++) {\r\n\t\t\t// UPDATED BY REEBA\r\n\t\t\tesicCredit = 0.0;\r\n\t\t\t\r\n\t\t\tdata[dataIndex][co",
"end": 122568,
"score": 0.9979705810546875,
"start": 122563,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "alCredit.length; k++) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t// UPDATED BY REEBA BEGINS\r\n\t\t\t\t\ttry {// totalESICCredit\r\n\t\t\t\t\t\tif (S",
"end": 122769,
"score": 0.97491055727005,
"start": 122764,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "IC :\"\r\n\t\t\t\t\t\t\t\t\t\t+ e);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// UPDATED BY REEBA ENDS\r\n\t\t\t\t\t\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * Following if condit",
"end": 123192,
"score": 0.9984569549560547,
"start": 123187,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "f debit code comparison\r\n\t\t\t\t\t\r\n\t\t\t\t\t// UPDATED BY REEBA BEGINS\r\n\t\t\t\t\tif (esi_data != null && esi_data.len",
"end": 130011,
"score": 0.993082582950592,
"start": 130006,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "[index][1]));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// UPDATED BY REEBA ENDS\r\n\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t}// End of salDebit for",
"end": 130753,
"score": 0.9889793395996094,
"start": 130748,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "rmat(total_pay));\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t// UPDATED BY REEBA BEGINS\r\n\t\tcolumn = column + 1;\r\n\r\n\t\tif (PFChk.e",
"end": 132033,
"score": 0.5358684062957764,
"start": 132032,
"tag": "NAME",
"value": "E"
},
{
"context": "mployer contribution to ESIC\r\n\t\t}\r\n\t\t// UPDATED BY REEBA ENDS\r\n\t\t\r\n\r\n\t\tposition_totalPay = column;\r\n\t\templ",
"end": 132436,
"score": 0.7442584037780762,
"start": 132431,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "earAmt));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// UPDATED BY REEBA BEGINS\r\n\t\t\t\t\t\t\tarrearCol++;\r\n\t\t\t\t\t\t\tif (PFChk.equals(\"Y\"",
"end": 142823,
"score": 0.9430547952651978,
"start": 142811,
"tag": "NAME",
"value": "REEBA BEGINS"
},
{
"context": "\t\t\t\t\t\t\t\t\t\t\t// ESIC\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// UPDATED BY REEBA ENDS\r\n\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\tdataIndex++;\r\n\t\t\t\t\t\t}// End of",
"end": 143400,
"score": 0.9769706726074219,
"start": 143390,
"tag": "NAME",
"value": "REEBA ENDS"
},
{
"context": "es\";\r\n\t\tcounter = counter + 1;\r\n\t}\r\n\t// UPDATED BY REEBA ENDS\r\n\r\n\tif (settlReg.getCheckBrn().equals(\"Y\")) ",
"end": 146396,
"score": 0.7352402806282043,
"start": 146391,
"tag": "NAME",
"value": "REEBA"
},
{
"context": " {\r\n\t\tcolTotal = colTotal - 1;\r\n\t}\r\n\t// UPDATED BY REEBA ENDS\r\n\t\r\n\tObject[][] data = null;\r\n\tif (settlReg.getCh",
"end": 148786,
"score": 0.9849392175674438,
"start": 148776,
"tag": "NAME",
"value": "REEBA ENDS"
},
{
"context": "\t\tdouble total_credit = 0.00;\r\n\t\t\r\n\t\t// UPDATED BY REEBA BEGINS\r\n\t\tdouble employerESIC = 0.0;\r\n\t\tdouble es",
"end": 152053,
"score": 0.9980012774467468,
"start": 152048,
"tag": "NAME",
"value": "REEBA"
},
{
"context": " 0.0;\r\n\t\tdouble employerPF = 0.0;\r\n\t\t// UPDATED BY REEBA ENDS\r\n\t\t\r\n\t\tObject salCredit[][] = getSalaryCredi",
"end": 152169,
"score": 0.9986160397529602,
"start": 152164,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "< credit_header.length; j++) {\r\n\r\n\t\t\t// UPDATED BY REEBA\r\n\t\t\tesicCredit = 0.0;\r\n\t\t\t\r\n\t\t\tdata[dataIndex][co",
"end": 152558,
"score": 0.9981021881103516,
"start": 152553,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "alCredit.length; k++) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t// UPDATED BY REEBA BEGINS\r\n\t\t\t\t\ttry {// totalESICCredit\r\n\t\t\t\t\t\tif (S",
"end": 152903,
"score": 0.6988000869750977,
"start": 152898,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "IC :\"\r\n\t\t\t\t\t\t\t\t\t\t+ e);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// UPDATED BY REEBA ENDS\r\n\r\n\t\t\t\t\tif (String.valueOf(credit_header[j][",
"end": 153326,
"score": 0.6425819396972656,
"start": 153321,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "ulation employer PF: \" + e);\r\n\t\t}\r\n\t\t// UPDATED BY REEBA ENDS\r\n\t\t\r\n\t\t\r\n\t\t/*\r\n\t\t * Following loop is used t",
"end": 156675,
"score": 0.8752482533454895,
"start": 156670,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "[index][1]));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// UPDATED BY REEBA ENDS\r\n\t\t\t\t\t\r\n\t\t\t\t}// End of sal debit for loop\r\n\r",
"end": 160232,
"score": 0.9398627877235413,
"start": 160227,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "mployer contribution to ESIC\r\n\t\t}\r\n\t\t// UPDATED BY REEBA ENDS\r\n\r\n\t\tposition_totalPay = column;\r\n\t\temployerESIC ",
"end": 161529,
"score": 0.999424934387207,
"start": 161519,
"tag": "NAME",
"value": "REEBA ENDS"
},
{
"context": "earAmt));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// UPDATED BY REEBA BEGINS\r\n\t\t\t\t\t\t\tarrearCol++;\r\n\t\t\t\t\t\t\tif (PFChk.equ",
"end": 172136,
"score": 0.9947657585144043,
"start": 172131,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "\t\t\t\t\t\t\t\t\t\t\t// ESIC\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// UPDATED BY REEBA ENDS\r\n\r\n\t\t\t\t\t\t\tdataIndex++;\r\n\t\t\t\t\t\t}// End of arr",
"end": 172722,
"score": 0.9957559704780579,
"start": 172717,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "s(\"Y\")) {\r\n\tcheck = check + 1;\r\n}\r\n\r\n// UPDATED BY REEBA BEGINS\r\nif (settlReg.getCheckEmployerPF().equals(",
"end": 176334,
"score": 0.8923099637031555,
"start": 176329,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "als(\"Y\")) {\r\n\tcheck = check + 1;\r\n}\r\n// UPDATED BY REEBA ENDS\r\nString finalHeader[] = null;\r\nint colTotal ",
"end": 176514,
"score": 0.8352465629577637,
"start": 176509,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "d of loop_data if condition\r\n\r\n}\r\n\r\n/**\r\n* @author REEBA_JOSEPH\r\n* To generate report Branchwise\r\n* @param settlR",
"end": 189301,
"score": 0.9989376068115234,
"start": 189289,
"tag": "USERNAME",
"value": "REEBA_JOSEPH"
},
{
"context": "\n\r\nrg.createReport(response);\r\n}\r\n\r\n/**\r\n* @author REEBA_JOSEPH\r\n* To generate report Departmentwise\r\n* @param se",
"end": 191162,
"score": 0.99961918592453,
"start": 191150,
"tag": "USERNAME",
"value": "REEBA_JOSEPH"
},
{
"context": "\n\r\nrg.createReport(response);\r\n}\r\n\r\n/**\r\n* @author REEBA_JOSEPH\r\n* @param loop_data\r\n* @param rg\r\n* @param settlR",
"end": 193039,
"score": 0.9906519651412964,
"start": 193027,
"tag": "USERNAME",
"value": "REEBA_JOSEPH"
},
{
"context": "s(\"Y\")) {\r\n\tcheck = check + 1;\r\n}\r\n\r\n// UPDATED BY REEBA BEGINS\r\nif (settlReg.getCheckEmployerPF().equals(",
"end": 194171,
"score": 0.8091718554496765,
"start": 194166,
"tag": "NAME",
"value": "REEBA"
},
{
"context": "als(\"Y\")) {\r\n\tcheck = check + 1;\r\n}\r\n// UPDATED BY REEBA ENDS\r\n\r\nString finalHeader[] = null;\r\nint colTotal = 0",
"end": 194356,
"score": 0.9974624514579773,
"start": 194346,
"tag": "NAME",
"value": "REEBA ENDS"
}
] | null |
[] |
package org.paradyne.model.settlement;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import javax.servlet.http.HttpServletResponse;
import org.paradyne.bean.settlement.SettlementRegister;
import org.paradyne.lib.ModelBase;
import org.paradyne.lib.Utility;
import org.paradyne.lib.report.ReportGenerator;
public class SettlementRegisterModel extends ModelBase {
static org.apache.log4j.Logger logger = org.apache.log4j.Logger
.getLogger(ModelBase.class);
HttpServletResponse response;
NumberFormat formatter = new DecimalFormat("#0.00");
/**
*
* Added on Date:22-10-2008 Following function is called in the
* getReportDataUnCheck() function to generate the debit amount for each
* employee when the check box for Branch and Department wise is not
* checked.
*
* @param emp_id
* @param month
* @param year
* @param settlReg
* @return
*/
public Object[][] getSalaryDebitDataUncheck(String settlCode
,String fromMonth,String toMonth,String fromYear,String toYear) {
Object[][] credit_amount = null;
try {
String sal_Amount = "SELECT DEBIT_CODE,SUM(NVL(SETTL_AMT,0.00)) FROM HRMS_DEBIT_HEAD "
+" LEFT JOIN HRMS_SETTL_DEBITS ON (SETTL_DEBIT_CODE = DEBIT_CODE AND SETTL_CODE="+settlCode+" and ((SETTL_MTH>="+fromMonth+" and HRMS_SETTL_DEBITS.SETTL_YEAR="+fromYear+") OR (SETTL_MTH<="+toMonth+" and HRMS_SETTL_DEBITS.SETTL_YEAR="+toYear+"))) "
//+" LEFT JOIN HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_DEBITS.SETTL_CODE AND SETTL_MONTH=SETTL_MTH AND HRMS_SETTL_DEBITS.SETTL_YEAR=HRMS_SETTL_DTL.SETTL_YEAR)"
+" WHERE DEBIT_PAYFLAG='Y' AND SETTL_MTH_TYPE='CO' GROUP BY DEBIT_CODE ORDER BY DEBIT_CODE";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return credit_amount;
}
/**
* Added on Date:22-10-2008 following function is called to generate the
* credit amount for the employee in the function getReportDataUnCheck()
* function when the check box for Branch and department wise is not
* checked.
*
* @param empCode
* @param year
* @param month
* @param settlReg
* @return
*/
public Object[][] getSalaryCreditDataUncheck(String settlCode
,String fromMonth,String toMonth,String fromYear,String toYear) {
Object[][] credit_amount = null;
try {
String sal_Amount = "SELECT CREDIT_CODE,SUM(NVL(SETTL_AMT,0.00)),CREDIT_APPLICABLE_ESI FROM HRMS_CREDIT_HEAD "
+" LEFT JOIN HRMS_SETTL_CREDITS ON (SETTL_CREDIT_CODE = CREDIT_CODE AND SETTL_CODE="+settlCode+" and ((SETTL_MTH>="+fromMonth+" and HRMS_SETTL_CREDITS.SETTL_YEAR="+fromYear+") OR (SETTL_MTH<="+toMonth+" and HRMS_SETTL_CREDITS.SETTL_YEAR="+toYear+"))) "
//+" LEFT JOIN HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_CREDITS.SETTL_CODE AND SETTL_MONTH=SETTL_MTH AND HRMS_SETTL_CREDITS.SETTL_YEAR=HRMS_SETTL_DTL.SETTL_YEAR )"
+" WHERE CREDIT_PAYFLAG='Y' AND SETTL_MTH_TYPE='CO' GROUP BY CREDIT_CODE,CREDIT_APPLICABLE_ESI ORDER BY CREDIT_CODE";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return credit_amount;
}
/**
* Added on date:22-10-2008 following function is called when the branch and
* department wise check box is unchecked.
*
* @param settlReg
* @param response
* @param typeName
* @param desgName
* @param deptName
* @param branchName
* @param settlReg
*/
public void genReport(String reportType,String fromMonth,String fromYear,String toMonth,String toYear,
String divCode, String brnCode, String deptCode,
String empTypeCode, String desgCode, HttpServletResponse response, String divisionName) {
try {
int check = 0;
int colTotal = 0;
String reportName = "Settlement Register of " + divisionName
+ " from "
+ Utility.month(Integer.parseInt(fromMonth)) + "," + fromYear
+ " To "+ Utility.month(Integer.parseInt(toMonth)) + "," + toYear;
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Settlement Register of " + divisionName
+ " from "
+ Utility.month(Integer.parseInt(fromMonth)) + "," + fromYear
+ " To "+ Utility.month(Integer.parseInt(toMonth)) + "," + toYear, 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Settlement Register of " + divisionName
+ " from "
+ Utility.month(Integer.parseInt(fromMonth)) + "," + fromYear
+ " To "+ Utility.month(Integer.parseInt(toMonth)) + "," + toYear;
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
/*String selectSalaryLoop = "SELECT HRMS_SALARY_" + year
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (brnChk.equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (deptChk.equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (desgChk.equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ year
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ year
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ year
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ year
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ month
+ " AND LEDGER_YEAR="
+ year
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (brnChk.equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ year + ".SAL_EMP_CENTER)";
}
if (deptChk.equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ year + ".SAL_DEPT)";
}
if (desgChk.equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ year + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION=" + divCode;
if (!(brnCode.equals(""))) {
selectSalaryLoop += " AND SAL_EMP_CENTER=" + brnCode + " ";
}
if (!(onHoldCode.equals("A"))) {
selectSalaryLoop += "AND sal_onhold='" + onHoldCode + "' ";
}
if (!(deptCode.equals(""))) {
selectSalaryLoop += "and SAL_DEPT=" + deptCode;
}
if (!empTypeCode.equals("")) {
selectSalaryLoop += " AND SAL_EMP_TYPE=" + empTypeCode;
}
if (!desgCode.equals("")) {
selectSalaryLoop += " AND SAL_EMP_RANK=" + desgCode;
}
selectSalaryLoop += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";*/
/*String selectEmpLoop="SELECT HRMS_SETTL_HDR.SETTL_ECODE ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '|| EMP_LNAME, NVL(TYPE_NAME,' '),SETTL_DAYS,SETTL_MONTH, SETTL_YEAR,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' '),' ',NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),"
+" CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other'"
+" END,'',HRMS_SETTL_DTL.SETTL_CODE "
+" FROM HRMS_SETTL_HDR "
+" inner join HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_HDR.SETTL_CODE)"
+" INNER JOIN HRMS_EMP_OFFC ON HRMS_SETTL_HDR.SETTL_ECODE = HRMS_EMP_OFFC.EMP_ID "
+" LEFT JOIN HRMS_EMP_TYPE ON(EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID) "
+" LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID) "
+" LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR) "
+" LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE "
+" WHERE SETTL_TYPE='CO' AND EMP_DIV="+divCode;*/
String selectEmpLoop="SELECT DISTINCT HRMS_SETTL_HDR.SETTL_ECODE ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '|| EMP_LNAME, "
+" HRMS_SETTL_HDR.SETTL_CODE,TO_CHAR(SETTL_SETTLDT,'DD-MM-YYYY'), NVL(SETTL_LEAVE_ENCASH,0),NVL(SETTL_GRATUITY,0), NVL(SETTL_REIMBURSE,0), NVL(SETTL_DEDUCTION,0),"
+" NVL(SETTL_TAX_AMT,0) FROM HRMS_SETTL_HDR "
+" INNER JOIN HRMS_EMP_OFFC ON HRMS_SETTL_HDR.SETTL_ECODE = HRMS_EMP_OFFC.EMP_ID "
+" inner join HRMS_SETTL_DTL ON (HRMS_SETTL_DTL.SETTL_CODE=HRMS_SETTL_HDR.SETTL_CODE)"
+" WHERE EMP_DIV="+divCode+" AND SETTL_TYPE='CO' and "
+"((SETTL_MONTH>="+fromMonth+" and SETTL_YEAR="+fromYear+") OR (SETTL_MONTH<="+toMonth+" and SETTL_YEAR="+toYear+"))";
if (!(brnCode.equals(""))) {
selectEmpLoop += " AND EMP_CENTER=" + brnCode + " ";
}
if (!(deptCode.equals(""))) {
selectEmpLoop += " AND EMP_DEPT=" + deptCode;
}
if (!empTypeCode.equals("")) {
selectEmpLoop += " AND EMP_TYPE=" + empTypeCode;
}
if (!desgCode.equals("")) {
selectEmpLoop += " AND EMP_RANK=" + desgCode;
}
selectEmpLoop +=" ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
// UPDATED BY REEBA
Object[][] reportDataPay = getReportDataUnCheck(selectEmpLoop,
fromMonth, fromYear, toMonth, toYear, check,
divisionName);
// Object[][] reportDataPay =
// getReportDataUnCheck(selectSalaryLoop,settlReg,arrEmpLength,check);
if (reportDataPay.length > 1) {
String finalHeader[] = null;
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
// String finalHeader[] = new String[reportDataPay[0].length];
// * Following loop is used to set the cell width
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 2;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}// End of cell width loop
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
// * Following loop is used to set the credit and debit values
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = String
.valueOf(reportDataPay[i + 1][j]);
}
}// End of finalData loop
Object totalByColumn[][] = null;
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals("")
|| String.valueOf(finalData[j][i]).equals(
"null.00")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1])
.contains("Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
}
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[2][4]; filterObj[0][0] =
* "Branch : "; filterObj[0][1] = branchName; filterObj[0][2] =
* "Department : "; filterObj[0][3] = deptName;
*
* filterObj[1][0] = "Designation : "; filterObj[1][1] =
* desgName; filterObj[1][2] = "Employee Type : ";
* filterObj[1][3] = typeName;
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.tableBody(finalHeader, finalData, cellWidth, alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
rg.createReport(response);
} catch (Exception e) {
e.printStackTrace();
}
}
// GET EMP_ID THOSE FULLFILL SORTING CRITERIA
public Object[][] getEmpId(SettlementRegister settlReg) {
Object emp_id[][] = null;
try {
/*
* FOR SELECTING THE EMPLOYEE THOSE FULL FILL SORTING CRITERIA
*
*/
// String selectSalary = " SELECT EMP_ID ,EMP_TOKEN ,EMP_FNAME ||'
// '||EMP_MNAME ||' '||EMP_LNAME FROM HRMS_EMP_OFFC WHERE
// EMP_PAYBILL IS NOT NULL ";
String selectSalary = " SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||EMP_LNAME "
+ " FROM HRMS_SALARY_" + settlReg.getYear()
+ " inner join HRMS_EMP_OFFC on HRMS_SALARY_"
+ settlReg.getYear() + ".EMP_ID = HRMS_EMP_OFFC.EMP_ID " +
/*
* " left join hrms_center on (hrms_center.CENTER_ID=
* HRMS_EMP_OFFC.EMP_CENTER) "+ " left join HRMS_LOCATION on
* (HRMS_LOCATION.LOCATION_CODE =
* hrms_center.CENTER_LOCATION) " +
*/
" WHERE EMP_PAYBILL IS NOT NULL ";
String where = " ";
try {
where = where + " AND SAL_MONTH=" + settlReg.getMonth();
selectSalary = selectSalary + where;
} catch (Exception e) {
e.printStackTrace();
}
emp_id = getSqlModel().getSingleResult(selectSalary);
} catch (Exception e) {
logger.error(e.getMessage());
}
return emp_id;
}
/*
* Following function is used in getReportDataNoBranchDept() method to
* return the employee details.
*/
public Object[][] getEmpIdNew(String selectSalary) {
Object emp_id[][] = null;
try {
emp_id = getSqlModel().getSingleResult(selectSalary);
} catch (Exception e) {
logger.error(e.getMessage());
}
return emp_id;
}
// Following function is called when branch or department is not selected at
// all
// This method returns the salary amount and the corresponding credit code
public Object[][] getSalaryCreditDataNoSelect(String empCode, String year,
String month, SettlementRegister settlReg, String brnCode, String deptCode) {
Object[][] credit_amount = null;
try {
String ledgCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year=" + year;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkBrnOrder().equals("Y")) {
ledgCode += " and sal_emp_center=" + brnCode;
}
if (settlReg.getChkDeptOrder().equals("Y")) {
ledgCode += " AND SAL_DEPT=" + deptCode;
}
// UPDATED BY REEBA ENDS
ledgCode += " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
// UPDATED BY REEBA
String selectCredits = "SELECT SAL_CREDIT_CODE,SAL_AMOUNT , CREDIT_APPLICABLE_ESI FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[0][0])
+ " ) "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY SAL_CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
} catch (Exception e) {
credit_amount = new Object[0][0];
logger.error(e.getMessage());
e.printStackTrace();
}
return credit_amount;
}
/*
* Following function is called to return the arrear credit amount from
* HRMS_ARREARS_CREDIT_2008(Year Entered) when the arrear type is
* promotional.
*/
public Object[][] arrearCreditData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String promCode, String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
// String query=" SELECT NVL(ARREARS_AMT,0) FROM
// HRMS_ARREARS_credit_"+settlReg.getYear()+" INNER JOIN
// HRMS_ARREARS_"+settlReg.getYear()+"
// on(hrms_arrears_"+settlReg.getYear()+".arrears_code=hrms_arrears_credit_"+settlReg.getYear()+".arrears_code)
// WHERE
// hrms_arrears_credit_"+settlReg.getYear()+".ARREARS_EMP_ID="+empId+"
// AND
// HRMS_ARREARS_CREDIT_"+settlReg.getYear()+".ARREARS_CODE="+arrearCode+"
// ORDER BY ARREARS_CREDIT_CODE";
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
String query = " SELECT distinct NVL(ARREARS_AMT,0),CREDIT_APPLICABLE_ESI FROM HRMS_ARREARS_credit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_credit_"
+ salYear
+ ".arrears_code)"
+ " INNER JOIN HRMS_CREDIT_HEAD ON(CREDIT_CODE=ARREARS_CREDIT_CODE)"
+ " WHERE hrms_arrears_credit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_CREDIT_CODE="
+ arrear[i][0]
+ " AND PROM_CODE="
+ promCode
+ " and arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount.length == 0 || amount == null) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
/*
* Following function is called to return the arrear credit amount from
* HRMS_ARREARS_CREDIT_2008(Year Entered) when the promotional type is
* monthly.
*/
public Object[][] arrearCreditData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
String query = " SELECT distinct NVL(ARREARS_AMT,0),CREDIT_APPLICABLE_ESI FROM HRMS_ARREARS_credit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_credit_"
+ salYear
+ ".arrears_code)"
+ " INNER JOIN HRMS_CREDIT_HEAD ON(CREDIT_CODE=ARREARS_CREDIT_CODE)"
+ " WHERE hrms_arrears_credit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_CREDIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_CREDIT_CODE="
+ arrear[i][0]
+ " AND arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount.length == 0 || amount == null) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
/*
* Following function is called to return the arrear debit amount from
* HRMS_ARREARS_DEBIT_2008(Year Entered) when the arrear type is
* promotional.
*/
public Object[][] arrearDebitData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String promCode, String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
String query = " SELECT distinct NVL(ARREARS_AMT,0),ARREARS_DEBIT_CODE FROM HRMS_ARREARS_debit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_debit_"
+ salYear
+ ".arrears_code)"
+ " WHERE hrms_arrears_debit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_debit_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_DEBIT_CODE="
+ arrear[i][0]
+ " AND PROM_CODE="
+ promCode
+ "and arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount == null || amount.length == 0) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
/*
* Following function is called to return the arrear debit amount from
* HRMS_ARREARS_DEBIT_2008(Year Entered) when the arrear type is monthly.
*/
public Object[][] arrearDebitData(String arrearCode, String empId,
String month, String year, Object[][] arrear, String type,
String salYear) {
Object[][] amt = new Object[arrear.length][2];
try {
for (int i = 0; i < arrear.length; i++) {
if (arrear[i][0] != null) {
// String query=" SELECT NVL(ARREARS_AMT,0) FROM
// HRMS_ARREARS_DEBIT_"+settlReg.getYear()+" INNER JOIN
// HRMS_ARREARS_"+settlReg.getYear()+"
// on(hrms_arrears_"+settlReg.getYear()+".arrears_code=hrms_arrears_debit_"+settlReg.getYear()+".arrears_code)
// WHERE
// hrms_arrears_debit_"+settlReg.getYear()+".ARREARS_EMP_ID="+empId+"
// AND
// HRMS_ARREARS_DEBIT_"+settlReg.getYear()+".ARREARS_CODE="+arrearCode+"
// ORDER BY ARREARS_debit_CODE";
String query = " SELECT distinct NVL(ARREARS_AMT,0),ARREARS_DEBIT_CODE FROM HRMS_ARREARS_debit_"
+ salYear
+ " inner join hrms_arrears_ledger on(hrms_arrears_ledger.arrears_code=hrms_arrears_debit_"
+ salYear
+ ".arrears_code)"
+ " WHERE hrms_arrears_debit_"
+ salYear
+ ".ARREARS_EMP_ID="
+ empId
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_CODE="
+ arrearCode
+ " AND "
+ " HRMS_ARREARS_debit_"
+ salYear
+ ".ARREARS_MONTH="
+ month
+ " AND HRMS_ARREARS_DEBIT_"
+ salYear
+ ".ARREARS_YEAR="
+ year
+ " AND ARREARS_DEBIT_CODE="
+ arrear[i][0]
+ " and arrears_type="
+ "'"
+ type
+ "' AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amount = getSqlModel().getSingleResult(query,
new Object[0][0]);
if (amount == null || amount.length == 0) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
if (String.valueOf(amount[0][0]).equals("")
|| String.valueOf(amount[0][0]).equals("null")) {
amt[i][0] = "0.00";
amt[i][1] = "N";
} else {
amt[i][0] = amount[0][0];
amt[i][1] = amount[0][1];
}
}
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return amt;
}
// Following function is called when branch or department or both are
// selected
public Object[][] getSalaryCreditData(String empCode, String year,
String month, SettlementRegister settlReg, String Id) {
Object[][] credit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getBranchCode().equals(""))
&& settlReg.getDeptCode().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " AND SAL_DEPT="
+ Id
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (settlReg.getBranchCode().equals("")
&& (!(settlReg.getDeptCode().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and sal_emp_center="
+ Id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getBranchCode().equals(""))
&& !(settlReg.getDeptCode().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode()+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
// UPDATED BY REEBA
String sal_Amount = "SELECT SAL_CREDIT_CODE,SAL_AMOUNT,CREDIT_APPLICABLE_ESI FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY SAL_CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return credit_amount;
}
// Following function is called when pay bill or emp type is not selected at
// all
public Object[][] getSalaryCreditDataNoEmpTypePayBill(String empCode,
String year, String month, SettlementRegister settlReg, String typeId,
String payId) {
Object[][] credit_amount = null;
try {
// String ledgCode="SELECT LEDGER_CODE FROM HRMS_SALARY_LEDGER WHERE
// LEDGER_MONTH="+month+" and ledger_year="+year+" and
// ledger_emptype="+typeId+" and ledger_paybill="+payId+" and
// LEDGER_STATUS='SAL_FINAL' order by ledger_code";
String ledgCode = " select sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ typeId
+ " AND SAL_emp_paybill="
+ payId
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
String selectCredits = "SELECT SAL_CREDIT_CODE,SAL_AMOUNT FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[0][0])
+ ") "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY SAL_CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
} catch (Exception e) {
credit_amount = new Object[0][0];
}
return credit_amount;
}
// Following function is called emp type or pay bill or both are selected.
public Object[][] getSalaryCreditDataEmpTypePayBill(String empCode,
String year, String month, SettlementRegister settlReg, String id,
String id1) {
Object[][] credit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getTypeCode().equals(""))
&& settlReg.getPayBillNo().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if ((settlReg.getTypeCode().equals("") && !(settlReg
.getPayBillNo().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and sal_emp_type="
+ id1
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getTypeCode().equals(""))
&& !(settlReg.getPayBillNo().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode()+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ empCode;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
String sal_Amount = "SELECT CREDIT_CODE,SAL_AMOUNT FROM HRMS_CREDIT_HEAD LEFT JOIN HRMS_SAL_CREDITS_"
+ year
+ " ON (SAL_CREDIT_CODE = CREDIT_CODE and EMP_ID="
+ empCode
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE CREDIT_PAYFLAG='Y' ORDER BY CREDIT_CODE ";
credit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
}
return credit_amount;
}
/**
* Following method is used in getReportDataNoBranchDept() which returns the
* credit code,credit abbr to set the credit head names.
*
* @return
*/
public Object[][] getCreditHeader() {
Object credit_header[][] = null;
try {
String selectCredit = "SELECT CREDIT_CODE, CREDIT_ABBR FROM HRMS_CREDIT_HEAD WHERE CREDIT_PAYFLAG='Y' order BY CREDIT_CODE";
credit_header = getSqlModel().getSingleResult(selectCredit);
} catch (Exception e) {
e.printStackTrace();
}
return credit_header;
}
/**
* Following method is used in getReportDataNoBranchDept() which returns the
* debit code,debit abbr to set the debit head names.
*
* @return
*/
public Object[][] getDebitHeader() {
Object debit_header[][] = null;
try {
String selectDebit = "SELECT DEBIT_CODE, DEBIT_ABBR FROM HRMS_DEBIT_HEAD WHERE DEBIT_PAYFLAG='Y' "
+ " ORDER BY DEBIT_CODE";
debit_header = getSqlModel().getSingleResult(selectDebit);
} catch (Exception e) {
logger.error(e.getMessage());
}
return debit_header;
}
// //Following function is called emp type or pay bill or both are selected.
public Object[][] getSalDebitEmpTypePayBill(String emp_id, String month,
String year, SettlementRegister settlReg, String id, String id1) {
Object[][] debit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getTypeCode().equals(""))
&& settlReg.getPayBillNo().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if ((settlReg.getTypeCode().equals("") && !(settlReg
.getPayBillNo().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and sal_emp_type="
+ id1
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getTypeCode().equals(""))
&& !(settlReg.getPayBillNo().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_EMPTYPE="+settlReg.getTypeCode()+" AND
// LEDGER_PAYBILL="+settlReg.getPayBillNo();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ settlReg.getTypeCode()
+ " and sal_emp_paybill="
+ settlReg.getPayBillNo()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
String sal_Amount = "SELECT SAL_DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY SAL_DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return debit_amount;
}
// Following function is called emp type or pay bill or both are not
// selected at all.
public Object[][] getSalDebitNoEmpTypePayBill(String emp_id, String month,
String year, SettlementRegister settlReg, String typeId, String payId) {
Object[][] debit_amount = null;
try {
String ledgCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_type="
+ typeId
+ " AND SAL_emp_paybill="
+ payId
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
String selectCredits = "SELECT SAL_DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[0][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY SAL_DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
} catch (Exception e) {
debit_amount = new Object[0][0];
logger.error(e.getMessage());
}
return debit_amount;
}
// Following function is called branch or department or both are selected.
public Object[][] getSalDebit(String emp_id, String month, String year,
SettlementRegister settlReg, String Id) {
Object[][] debit_amount = null;
Object[][] ledgCode = null;
String ledgerCode = null;
try {
if (!(settlReg.getBranchCode().equals(""))
&& settlReg.getDeptCode().equals("")) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " AND SAL_DEPT="
+ Id
+ " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (settlReg.getBranchCode().equals("")
&& (!(settlReg.getDeptCode().equals("")))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and sal_emp_center="
+ Id
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
} else if (!(settlReg.getBranchCode().equals(""))
&& !(settlReg.getDeptCode().equals(""))) {
// ledgerCode=" SELECT LEDGER_CODE from HRMS_SALARY_LEDGER where
// LEDGER_MONTH="+month+" and LEDGER_YEAR="+year+" AND
// LEDGER_BRN="+settlReg.getBranchCode()+" AND
// LEDGER_DEPT="+settlReg.getDeptCode();
ledgerCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year="
+ year
+ " and sal_emp_center="
+ settlReg.getBranchCode()
+ " and sal_dept="
+ settlReg.getDeptCode()
+ " and LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
ledgCode = getSqlModel().getSingleResult(ledgerCode,
new Object[0][0]);
}
String sal_Amount = "SELECT DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledgCode[0][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY DEBIT_PRIORITY,DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(sal_Amount,
new Object[0][0]);
} catch (Exception e) {
logger.error(e.getMessage());
}
return debit_amount;
}
// Following function is called branch or department not selected at all.
// Following function is called in getReportDataNoBrnDept() method which
// returns the debit head amount and debit code
public Object[][] getSalDebitNotSelect(String emp_id, String month,
String year, SettlementRegister settlReg, String brnCode, String deptCode) {
Object[][] debit_amount = null;
try {
String ledgCode = " select distinct sal_ledger_code from hrms_salary_"
+ year
+ " inner join hrms_salary_ledger "
+ " on(hrms_salary_ledger.ledger_code=hrms_salary_"
+ year
+ ".sal_ledger_code)"
+ " where ledger_month="
+ month
+ " and ledger_year=" + year;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkBrnOrder().equals("Y")) {
ledgCode += " and sal_emp_center=" + brnCode;
}
if (settlReg.getChkDeptOrder().equals("Y")) {
ledgCode += " AND SAL_DEPT=" + deptCode;
}
// UPDATED BY <NAME>
ledgCode += " AND LEDGER_STATUS IN ('SAL_FINAL','SAL_START') AND EMP_ID="
+ emp_id;
Object[][] ledger_code = getSqlModel().getSingleResult(ledgCode,
new Object[0][0]);
for (int i = 0; i < ledger_code.length; i++) {
String selectCredits = "SELECT DEBIT_CODE,NVL(SAL_AMOUNT,0) FROM HRMS_DEBIT_HEAD LEFT JOIN HRMS_SAL_DEBITS_"
+ year
+ " ON (SAL_DEBIT_CODE = DEBIT_CODE and EMP_ID="
+ emp_id
+ " AND SAL_LEDGER_CODE="
+ String.valueOf(ledger_code[i][0])
+ ") "
+ " WHERE DEBIT_PAYFLAG='Y' ORDER BY DEBIT_CODE ";
debit_amount = getSqlModel().getSingleResult(selectCredits,
new Object[0][0]);
}
} catch (Exception e) {
debit_amount = new Object[0][0];
logger.error(e.getMessage());
}
return debit_amount;
}
/*
* Following function is called in the action class to generate the report.
*/
public void generateReport(SettlementRegister settlReg,
HttpServletResponse response) {
// String radioChk = settlReg.getRadioChk();
String reportType = settlReg.getReport();
String reportName = "Salary Register_" + settlReg.getDivName() + " for "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + "_"
+ settlReg.getYear();
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ", 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ";
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
rg.addText("\n", 0, 1, 0);
if ((!(settlReg.getBranchCode().equals("")) && settlReg.getDeptCode()
.equals(""))) {
String selectQuery = "SELECT DEPT_ID,DEPT_NAME from HRMS_DEPT";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportDataBranch(loop_data, rg, settlReg);
} else if (settlReg.getBranchCode().equals("")
&& (!(settlReg.getDeptCode().equals("")))) {
String selectQuery = "SELECT CENTER_ID,CENTER_NAME FROM HRMS_CENTER";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportDataDept(loop_data, rg, settlReg);
} else if (!(settlReg.getBranchCode().equals(""))
&& !(settlReg.getDeptCode().equals(""))) {
// String selectQuery= "SELECT CENTER_ID,CENTER_NAME FROM
// HRMS_CENTER";
Object[][] loop_data = new Object[1][2];
loop_data[0][0] = settlReg.getBranchCode();
loop_data[0][1] = settlReg.getDeptCode();
reportDataBraDept(loop_data, rg, settlReg);
} else if (settlReg.getBranchCode().equals("")
&& settlReg.getDeptCode().equals("")) {
String selectQuery = "SELECT CENTER_ID,CENTER_NAME FROM HRMS_CENTER";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportDataNoSelect(loop_data, rg, settlReg);
}
rg.createReport(response);
}
/*
* Following function is called when department is not selected and branch
* selected.
*/
public void reportDataBranch(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0, arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY <NAME>
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
String finalHeader[] = null;
int colTotal = 0;
if(loop_data.length>0){
for (int a = 0; a < loop_data.length; a++) {
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ " ,CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
/*
* String selectSalaryLoop =" SELECT
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN ,EMP_FNAME
* ||' '||EMP_MNAME ||' '||EMP_LNAME,NVL(TYPE_NAME,'
* '),NVL(SAL_DAYS,0) " +" FROM HRMS_SALARY_"+settlReg.getYear()+"
* INNER JOIN HRMS_EMP_OFFC " +" ON
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID =
* HRMS_EMP_OFFC.EMP_ID " +" LEFT JOIN HRMS_EMP_TYPE
* ON(HRMS_SALARY_"+settlReg.getYear()+".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)" +"
* INNER JOIN HRMS_SALARY_LEDGER ON " +"
* (HRMS_SALARY_LEDGER.LEDGER_CODE =
* HRMS_SALARY_"+settlReg.getYear()+".SAL_LEDGER_CODE AND
* LEDGER_MONTH="+settlReg.getMonth()+" AND
* LEDGER_YEAR="+settlReg.getYear()+") AND
* SAL_DIVISION="+settlReg.getDivCode();
*/
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + settlReg.getBranchCode()
+ " ";
if (!(settlReg.getOnHold().equals("A"))) {
where += "AND sal_onhold='" + settlReg.getOnHold() + "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE FROM
* HRMS_ARREARS_"+settlReg.getYear()+" " + " inner join
* HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" + " and
* arrears_type='M' and EMP_CENTER="+settlReg.getBranchCode()+ "
* and EMP_DEPT="+String.valueOf(loop_data[a][0]);
*/
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' "
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + settlReg.getBranchCode()
+ " and SAL_DEPT="
+ String.valueOf(loop_data[a][0]);
if (!(settlReg.getOnHold().equals("A"))) {
arrearEmp += "AND sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
arrearEmp += " AND SAL_EMP_TYPE="
+ settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
arrearEmp += " AND SAL_EMP_RANK="
+ settlReg.getDesgCode();
}
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
// int b=0;
Object[][] reportDataPay = getReportData(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), arrEmpLength,
check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}// End of cell width loop
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}
}// End of finalData loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
// Following loop is used to set the sum of the individual
// credit and debit amount values
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals(
"")
|| String.valueOf(finalData[j][i]).equals(
"null.00")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner for loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer for loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4]; filterObj[0][0] =
* "Designation : "; filterObj[0][1] = settlReg.getDesgName();
* filterObj[0][2] = "Employee Type : "; filterObj[0][3] =
* settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + settlReg.getBranchName()
+ " Department : " + loop_data[a][1], 0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportData if condition
}// End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = totList.get(arrCount);
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] ="GRAND TOTAL :-";
grand_total[0][1] =" ";
grand_total[0][2]=" ";
grand_total[0][3]=" ";
/*
* Following loop is used to set the grand total values
*/
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}// End of inner for loop
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
}else {
rg.addText("Records are not available.",0,1,0);
}
} // End of loop_data condition
}
/*
* Following function is called when department is selected and branch not
* selected.
*/
public void reportDataDept(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
String finalHeader[] = null;
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0, arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
int colTotal = 0;
if (loop_data.length > 0) {
for (int a = 0; a < loop_data.length; a++) {
/*
* " SELECT HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN
* ,EMP_FNAME ||' '||EMP_MNAME ||' '||EMP_LNAME, NVL(TYPE_NAME,'
* '),NVL(SAL_DAYS,0)" +" FROM HRMS_SALARY_"+settlReg.getYear()+"
* INNER JOIN HRMS_EMP_OFFC " +" ON
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID =
* HRMS_EMP_OFFC.EMP_ID " +" LEFT JOIN HRMS_EMP_TYPE
* ON(HRMS_SALARY_"+settlReg.getYear()+".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)" +"
* INNER JOIN HRMS_SALARY_LEDGER ON " +"
* (HRMS_SALARY_LEDGER.LEDGER_CODE =
* HRMS_SALARY_"+settlReg.getYear()+".SAL_LEDGER_CODE AND
* LEDGER_MONTH="+settlReg.getMonth()+" AND
* LEDGER_YEAR="+settlReg.getYear()+") WHERE
* SAL_DIVISION="+settlReg.getDivCode();
*
*/
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0] + " ";
if (!(settlReg.getOnHold().equals("A"))) {
where += "and sal_onhold='" + settlReg.getOnHold() + "' ";
}
where += "AND SAL_DEPT=" + settlReg.getDeptCode();
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' "
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ " and SAL_DEPT=" + settlReg.getDeptCode();
if (!(settlReg.getOnHold().equals("A"))) {
arrearEmp += "AND sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
arrearEmp += " AND SAL_EMP_TYPE="
+ settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
arrearEmp += " AND SAL_EMP_RANK="
+ settlReg.getDesgCode();
}
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE
* FROM HRMS_ARREARS_"+settlReg.getYear()+" " + " inner join
* HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" + " and
* arrears_type='M' and EMP_CENTER="+loop_data[a][0]+ " and
* EMP_DEPT="+settlReg.getDeptCode();
*/
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
// int aa=0;
Object[][] reportDataPay = getReportData(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), arrEmpLength,
check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
// Object[][] reportDataPay =
// getReportDataDept(selectSalaryLoop,settlReg);
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width of the table
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* values.
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}
}
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
/**
* Following loop is used to calculate the sum of the
* individual credit and debit head amount.
*/
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4]; filterObj[0][0] =
* "Designation : "; filterObj[0][1] = settlReg.getDesgName();
* filterObj[0][2] = "Employee Type : "; filterObj[0][3] =
* settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + loop_data[a][1]
+ " Department : " + settlReg.getDeptName(), 0, 0,
0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportDataPay if condition
} // End of for loop loop_data
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = totList.get(arrCount);
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] ="GRAND TOTAL :-";
grand_total[0][1] =" ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
/*
* Following loop is used to calculate the grand total
* amount
*/
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}// End of inner loop
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
} // End of loop_data if condition
}
/*
* Following function is called to generate the report when both branch and
* department are selected.
*/
public void reportDataBraDept(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
/*
* String selectSalaryLoop = " SELECT
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||'
* '||EMP_MNAME ||' '||EMP_LNAME,NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) " +"
* FROM HRMS_SALARY_"+settlReg.getYear()+" INNER JOIN HRMS_EMP_OFFC " +"
* ON HRMS_SALARY_"+settlReg.getYear()+".EMP_ID = HRMS_EMP_OFFC.EMP_ID " +"
* LEFT JOIN HRMS_EMP_TYPE
* ON(HRMS_SALARY_"+settlReg.getYear()+".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)" +"
* INNER JOIN HRMS_SALARY_LEDGER ON" +" (HRMS_SALARY_LEDGER.LEDGER_CODE =
* HRMS_SALARY_"+settlReg.getYear()+".SAL_LEDGER_CODE " +" AND
* LEDGER_MONTH="+ settlReg.getMonth()+" AND
* LEDGER_YEAR="+settlReg.getYear()+") WHERE
* SAL_DIVISION="+settlReg.getDivCode();
*
* " SELECT HRMS_SALARY_"+settlReg.getYear()+".EMP_ID ,EMP_TOKEN
* ,EMP_FNAME ||' '||EMP_MNAME ||' '||EMP_LNAME " + " FROM
* HRMS_SALARY_"+settlReg.getYear()+" inner join HRMS_EMP_OFFC on
* HRMS_SALARY_"+settlReg.getYear()+".EMP_ID = HRMS_EMP_OFFC.EMP_ID " + "
* inner join hrms_center on (hrms_center.CENTER_ID=
* HRMS_EMP_OFFC.EMP_CENTER) "+ " inner join hrms_dept on
* (hrms_dept.DEPT_ID= HRMS_EMP_OFFC.EMP_DEPT) "+ " WHERE SAL_MONTH="+
* settlReg.getMonth();
*/
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0, arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
String finalHeader[] = null;
int colTotal = 0;
if (loop_data.length > 0) {
for (int a = 0; a < loop_data.length; a++) {
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ " ,CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0] + " ";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold() + "' ";
}
where += "AND SAL_DEPT=" + loop_data[a][1];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE FROM
* HRMS_ARREARS_"+settlReg.getYear()+" " + " inner join
* HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" +
* " and arrears_type='M' and
* EMP_CENTER="+settlReg.getBranchCode()+ " and
* EMP_DEPT="+settlReg.getDeptCode();
*/
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' "
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + settlReg.getBranchCode()
+ " and SAL_DEPT=" + settlReg.getDeptCode();
if (!(settlReg.getOnHold().equals("A"))) {
arrearEmp += "AND sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += "and SAL_DEPT=" + loop_data[a][0];
if (!settlReg.getTypeCode().equals("")) {
arrearEmp += " AND SAL_EMP_TYPE="
+ settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
arrearEmp += " AND SAL_EMP_RANK="
+ settlReg.getDesgCode();
}
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
Object[][] reportDataPay = getReportData(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), arrEmpLength,
check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width of the
* table.
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* amount
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0.00;
/*
* Following loop is used to set the sum of individual
* credit and debit head values.
*/
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")) {
finalData[j][i] = "0.00";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner for loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer for loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4]; filterObj[0][0] =
* "Designation : "; filterObj[0][1] = settlReg.getDesgName();
* filterObj[0][2] = "Employee Type : "; filterObj[0][3] =
* settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + settlReg.getBranchName()
+ " Department : " + settlReg.getDeptName(), 0, 0,
0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportDataPay if condition
}// End of for loop loop_data
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = totList.get(arrCount);
arrCount++;
// logger.info("-----------------values are
// listValues["+i+"]["+j+"]="+listValues[i][j]);
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] ="GRAND TOTAL :-";
grand_total[0][1] =" ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
/**
* Following loop is used to set the grand total values
*/
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}// End of inner loop
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}// End of for loop
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
// rg.addText("GRAND TOTAL",0,0,0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
}// End of loop_data if condition
}
/**
* @author REEBA_JOSEPH
* @param loop_data
* @param rg
* @param settlReg
*/
public void reportOnlyForBranch(Object[][] loop_data,ReportGenerator rg,SettlementRegister settlReg){
ArrayList<String> totList=new ArrayList<String>();
int recCount=0;
int arrEmpLength=0;
int check=0;
String finalHeader[] = null;
if(settlReg.getCheckBrn().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDob().equals("Y")){
check=check+1;
}
if(settlReg.getCheckBank().equals("Y")){
check=check+1;
}
if(settlReg.getCheckAccount().equals("Y")){
check=check+1;
}
if(settlReg.getCheckPan().equals("Y")){
check=check+1;
}
if(settlReg.getCheckEmpType().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDept().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDesg().equals("Y")){
check=check+1;
}
if(settlReg.getCheckDoj().equals("Y")){
check=check+1;
}
if(settlReg.getCheckGender().equals("Y")){
check=check+1;
}
if(settlReg.getCheckHold().equals("Y")){
check=check+1;
}
if(settlReg.getCheckGrade().equals("Y")){
check=check+1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
int colTotal = 0;
if (loop_data.length > 0) {
// logger.info("Loop count ============= " + loop_data.length);
for (int a = 0; a < loop_data.length; a++) {
// logger.info("For Branch ============= " + loop_data[a][0]);
String selectSalaryLoop = "";
try {
selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ "";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
// where+=" AND SAL_DEPT="+loop_data_inner[b][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
} catch (Exception e) {
logger.error("Error in Salary query : " + e);
e.printStackTrace();
}
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type IN('M','P') AND ARREARS_PAY_IN_SAL = 'Y'"
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + loop_data[a][0];
// +" and SAL_DEPT="+loop_data_inner[b][0];
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error("Error in arrears query : " + e);
e.printStackTrace();
}
/*
* Object[][] reportDataPay = getReportDataNoBranchDept(
* selectSalaryLoop, settlReg, String .valueOf(loop_data[a][0]),
* String .valueOf(loop_data_inner[b][0]), arrEmpLength, check);
*/
Object[][] reportDataPay = null;
try {
reportDataPay = getReportDataNoBranchDept(selectSalaryLoop,
settlReg, String.valueOf(loop_data[a][0]), "0",
arrEmpLength, check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
} catch (Exception e) {
logger.error("Error in getting report data : " + e);
e.printStackTrace();
}
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// logger.info("finalData["+i+"]["+j+"]=========="+finalData[i][j]);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
/**
* Following loop is used to set the sum of the individual
* credit and debit head values.
*/
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals(
"null.00")
|| String.valueOf(finalData[j][i]).equals(
"")
|| String.valueOf(finalData[j][i]) == null) {
finalData[j][i] = "0";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
rg.addText("Branch : " + loop_data[a][1], 0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
/*
* Object[][] summaryObj = new
* Object[1][reportDataPay[0].length-1];
* summaryObj[0][0] = " ";
*/
/*logger
.info("finalHeader length=="
+ finalHeader.length);
logger.info("cellWidth length==" + cellWidth.length);
logger.info("alignment length==" + alignment.length);
logger.info("totalByColumn length=="
+ totalByColumn[0].length);*/
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
} // End of reportDataPay if condition
} // End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = formatter.format(Double
.parseDouble(String.valueOf(totList
.get(arrCount))));
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] = "GRAND TOTAL :-";
grand_total[0][1] = " ";
//grand_total[0][2] = " ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
finalHeader[1]="";
rg.addText("\n", 0, 0, 0);
rg.tableBody(finalHeader,grand_total, cellWidth, alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
} // End of loop_data if condition
}
/*
* Following function is used to set cell width
*/
public int[] getCellWidth(int dataLength) {
int[] cellWidth = new int[dataLength];
for (int i = 0; i < dataLength; i++) {
if (i > 1) {
cellWidth[i] = 7;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
cellWidth[2] = 10;
cellWidth[3] = 7;
}
}
return cellWidth;
}
/*
* Following function is used to set the alignment
*/
public int[] getAlignment(int dataLength) {
int[] alignment = new int[dataLength];
for (int i = 0; i < dataLength; i++) {
alignment[i] = 0;
}
return alignment;
}
/**
* following function is called in genReport() function when the branch wise
* and department wise check box is unchecked.
*
* @param query
* @param settlReg
* @param arrEmpLength
* @param colTotal
* @param settlReg
* @return
*/
public Object[][] getReportDataUnCheck(String query, String fromMonth,
String fromYear, String toMonth, String toYear, int colTotal, String divisionName) {
int dataIndex = 0;
Object[][] dataWithHeader = null;
try {
Object emp_id[][] = getEmpIdNew(query);
Object credit_header[][] = getCreditHeader();
Object debit_header[][] = getDebitHeader();
double totArrearAmt = 0;
// Object debit_recovery[][]= getDebitHeader_recovery();
int totalCol = credit_header.length + debit_header.length
+ colTotal + 6 + 5;
int counter = 0;
String[] colNames = null;
colNames = new String[totalCol];
colNames[counter] = "Emp Id";
counter = counter + 1;
colNames[counter] = "Employee Name";
counter = counter + 1;
colNames[counter] = "Settlement Date";
counter = counter + 1;
/*
* Following loop sets the credit head names
*/
for (int i = 0; i < credit_header.length; i++) {
colNames[counter] = String.valueOf(credit_header[i][1]);
counter++;
}
colNames[counter] = "Leave Encashment";
counter = counter + 1;
colNames[counter] = "Gratuity";
counter = counter + 1;
colNames[counter] = "Other Reimbursement";
counter = counter + 1;
colNames[counter] = "Tot Credit";
counter = counter + 1;
/*
* Following loop sets the debit head names
*/
for (int i = 0; i < debit_header.length; i++) {
colNames[counter] = String.valueOf(debit_header[i][1]);
counter++;
}
colNames[counter] = "Other Deduction";
counter = counter + 1;
colNames[counter] = "Outstanding TDS";
counter = counter + 1;
colNames[counter] = "Total Debit";
counter = counter + 1;
colNames[counter] = "Net-Pay";
counter = counter + 1;
Object[][] data = new Object[emp_id.length][totalCol];
/*
* Following loop sets the emp id,emp name,credit head value,debit
* head value and arrear values.
*/
for (int i = 0; i < emp_id.length; i++) {
data[dataIndex][0] = emp_id[i][1];
data[dataIndex][1] = emp_id[i][2];
data[dataIndex][2] = emp_id[i][4];
int column = 3;
double totArrACredit = 0;
double totArrDebit = 0;
int position_totalPay = 0;
/** set credit values */
double total_credit = 0.00;
double employerESIC = 0.0;
double esicCredit = 0.0;
double employerPF = 0.0;
Object salCredit[][] = getSalaryCreditDataUncheck(String
.valueOf(emp_id[i][3]),fromMonth,toMonth,fromYear,toYear);
/*Object leaveEncashData[][] = getLeaveEncashmentDataUncheck(
String.valueOf(emp_id[i][0]), year, month);*/
/*
* Following loop sets the credit head values
*/
for (int j = 0; j < credit_header.length; j++) {
esicCredit = 0.0;
data[dataIndex][column] = 0.00;
if (!(salCredit == null || salCredit.length == 0))
for (int k = 0; k < salCredit.length; k++) {
// UPDATED BY REEBA BEGINS
try {// totalESICCredit
if (String.valueOf(salCredit[k][2]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
// logger.info("employerESIC========="+employerESIC);
}
} catch (Exception e) {
logger
.error("Exception in employerESIC :"
+ e);
}
// UPDATED BY REEBA ENDS
/*
* Following if condition compares the credit code
* from hrms_credit_head table with
* hrms_sal_cedits_2008 table
*/
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(salCredit[k][0]))) {
if (salCredit[k][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary credit amount will be added
* with the arrear credit amount
*/
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salCredit[k][1]));// +Double.parseDouble("0.00");
total_credit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
}// End of salCredit if condition
} // End of credit code comparison if condition
} // End of salCredit for loop
//logger.info("employerESIC========="
// + esicCredit);
/*try {
if (leaveEncashData != null
|| leaveEncashData.length > 0) {
for (int k2 = 0; k2 < leaveEncashData.length; k2++) {
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(leaveEncashData[k2][1]))) {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(leaveEncashData[k2][0]));//
total_credit += Double.parseDouble(String
.valueOf(leaveEncashData[k2][0]));
}
}
}
} catch (Exception e) {
logger.error("exception in leaveEncahData " + e);
// e.printStackTrace();
}*/
data[dataIndex][column] = checkNullToZero(String
.valueOf(data[dataIndex][column]));
column++;
} // End of credit header for loop
/*
* for (int j = 0; j < credit_header.length; j++) {
* data[dataIndex][column] = 0.00; if(!(salCredit==null ||
* salCredit.length ==0)) for (int k = 0; k < salCredit.length;
* k++) {
* if(String.valueOf(credit_header[j][0]).equals(String.valueOf(salCredit[k][0]))){
* if(salCredit[k][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salCredit[k][1]));
* total_credit
* +=Double.parseDouble(String.valueOf(salCredit[k][1])); } }
*
*
*
*
* column++; }
*/
data[dataIndex][column++] = checkNullToZero(String
.valueOf(String.valueOf(emp_id[i][5]))); // leave enachment
data[dataIndex][column++] = checkNullToZero(String
.valueOf(String.valueOf(emp_id[i][6]))); // gratuity
data[dataIndex][column++] = checkNullToZero(String
.valueOf(String.valueOf(emp_id[i][7]))); // other reimbursement
total_credit = total_credit+(Double.parseDouble(String
.valueOf(emp_id[i][5])))+Double.parseDouble(String
.valueOf(String.valueOf(emp_id[i][6])))+Double.parseDouble(String
.valueOf(String.valueOf(emp_id[i][7])));
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_credit));
column = column + 1;
/** set non-recovery debits */
Object salDebit[][] = getSalaryDebitDataUncheck(String
.valueOf(emp_id[i][3]),fromMonth,toMonth,fromYear,toYear);
double total_nonRecovery = 0;
// UPDATED BY REEBA BEGINS
Object[][] esi_addata = null;
// UPDATED BY REEBA ENDS
/*
* Following loop is used to set the debit head amount values.
*/
for (int k = 0; k < debit_header.length; k++) {
data[dataIndex][column] = 0;
if (!(salDebit == null || salDebit.length == 0))
for (int index = 0; index < salDebit.length; index++) {
/*
* Following loop compares the debit code from
* hrms_debit_head with the debit code from
* hrms_sal_debits_2008(Year entered)
*/
if (String.valueOf(debit_header[k][0]).equals(
String.valueOf(salDebit[index][0]))) {
if (salDebit[index][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary debit amount will be added
* with the arrear debit amount
*/
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salDebit[index][1]));
total_nonRecovery += Double
.parseDouble(String
.valueOf(salDebit[index][1]));
}// End of salDebit if condition
}// End of debit code comparison
} // End of salDebit for loop
column++;
}// End of debit header for loop
/*
* for (int k = 0; k < debit_header.length; k++) {
* data[dataIndex][column] = Utility.twoDecimals("0");
* if(!(salDebit==null || salDebit.length ==0)) for (int index =
* 0; index < salDebit.length; index++) {
* if(String.valueOf(debit_header[k][0]).equals(String.valueOf(salDebit[index][0]))){
* if(salDebit[index][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salDebit[index][1]));
* total_nonRecovery
* +=Double.parseDouble(String.valueOf(salDebit[index][1])); } }
*
*
*
* column++; }
*/
logger.info("total_nonRecovery=="+total_nonRecovery);
data[dataIndex][column++] = Utility.twoDecimals(String.valueOf(emp_id[i][8])); // other deductions
data[dataIndex][column++] = Utility.twoDecimals(String.valueOf(emp_id[i][9])); // outstanding tax
total_nonRecovery = total_nonRecovery + (Double.parseDouble(String.valueOf(emp_id[i][8]))+Double.parseDouble(String.valueOf(emp_id[i][9])));
logger.info("total_nonRecovery=="+total_nonRecovery);
data[dataIndex][column] = formatter.format(total_nonRecovery);
double total_pay = 0;
total_pay = total_credit
- total_nonRecovery;
column = column + 1;
if (Double.parseDouble(String.valueOf(total_pay)) < 0) {
data[dataIndex][column] = "0.00";
} else {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_pay));
}
position_totalPay = column;
esicCredit =0;
employerESIC=0;
employerPF=0;
try {
/**
* Following condition is used to select the arrears for the
* employees.
*/
} catch (Exception e) {
logger.error(e.getMessage());
}
dataIndex++;
} // End of emp_id for loop
dataWithHeader = new Object[data.length + 1][totalCol];
/*
* Following query is used to set the credit and debit head names.
*/
for (int i = 0; i < colNames.length; i++) {
dataWithHeader[0][i] = colNames[i];
}
/*
* Following query is used to set the credit and debit head amount.
*/
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[0].length; j++) {
dataWithHeader[i + 1][j] = data[i][j];
}
}
} catch (Exception e) {
e.printStackTrace();
}
return dataWithHeader;
}
// Following function is called when branch is selected or department is
// selected or both got selected for credit and debit details of the
// employee
public Object[][] getReportData(String query, SettlementRegister settlReg,
String Id, int arrEmpLength, int colTotal, String PFChk, String ESICChk) {
int dataIndex = 0;
String year = settlReg.getYear();
String month = settlReg.getMonth();
Object[][] dataWithHeader = null;
Object[][] arrearCreditAmt = null;
Object[][] arrearDebitAmt = null;
try {
Object emp_id[][] = getEmpIdNew(query);
Object credit_header[][] = getCreditHeader();
Object debit_header[][] = getDebitHeader();
double totArrearAmt = 0;
// Object debit_recovery[][]= getDebitHeader_recovery();
int totalCol = credit_header.length + debit_header.length
+ colTotal + 6;
String[] colNames = null;
int counter = 0;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkConsSummary().equals("N")) {
colNames = new String[totalCol];
colNames[counter] = "Emp Id";
counter = counter + 1;
colNames[counter] = "Employee Name";
counter = counter + 1;
colNames[counter] = "Sal Days";
counter = counter + 1;
} else {
colNames = new String[totalCol - 1];
colNames[counter] = "";
counter = counter + 1;
colNames[counter] = "No. of Employees";
counter = counter + 1;
}
// UPDATED BY REEBA ENDS
/*
* If any check box is selected then that name will appear in the
* column head of the report except consolidated arrears.
*/
if (settlReg.getCheckBrn().equals("Y")) {
colNames[counter] = "Branch";
counter = counter + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
colNames[counter] = "Dept";
counter = counter + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
colNames[counter] = "Desg";
counter = counter + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
colNames[counter] = "Date of\nJoining";
counter = counter + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
colNames[counter] = "Date of\nBirth";
counter = counter + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
colNames[counter] = "Emp Type";
counter = counter + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
colNames[counter] = "Bank";
counter = counter + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
colNames[counter] = "Acc. No.";
counter = counter + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
colNames[counter] = "Pan No.";
counter = counter + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
colNames[counter] = "Gender";
counter = counter + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
colNames[counter] = "On Hold";
counter = counter + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
colNames[counter] = "Grade";
counter = counter + 1;
}
/*
* Following loop sets the credit head names
*/
for (int i = 0; i < credit_header.length; i++) {
colNames[counter] = String.valueOf(credit_header[i][1]);
counter++;
}
colNames[counter] = "Tot Credit";
counter = counter + 1;
/*
* Following loop sets the debit head names
*/
for (int i = 0; i < debit_header.length; i++) {
colNames[counter] = String.valueOf(debit_header[i][1]);
counter++;
}
colNames[counter] = "Tot Debit";
counter = counter + 1;
colNames[counter] = "Net-Pay";
// UPDATED BY REEBA BEGINS
counter = counter + 1;
if (PFChk.equals("Y")) {
colNames[counter] = "Employer contribution to PF";
counter = counter + 1;
}
if (ESICChk.equals("Y")) {
colNames[counter] = "Employer contribution to ESIC";
}
if (PFChk.equals("Y") && ESICChk.equals("Y")) {
colTotal = colTotal - 2;
} else if (PFChk.equals("Y")) {
colTotal = colTotal - 1;
} else if (ESICChk.equals("Y")) {
colTotal = colTotal - 1;
}
// UPDATED BY <NAME>
Object[][] data = null;
if (settlReg.getCheckFlag().equals("N")) {
data = new Object[emp_id.length + arrEmpLength][totalCol];
} else {
data = new Object[emp_id.length][totalCol];
}
/*
* Following loop sets the emp id,emp name,credit head value,debit
* head value and arrear values.
*/
for (int i = 0; i < emp_id.length; i++) {
data[dataIndex][0] = emp_id[i][1];
data[dataIndex][1] = emp_id[i][2];
if (settlReg.getCheckFlag().equals("Y")) {
String arrearDaysQuery = "SELECT NVL(SUM(ARREARS_DAYS),0)FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER "
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE)"
+ " WHERE HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " AND ARREARS_TYPE IN ('M','P') AND HRMS_ARREARS_LEDGER.ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " AND "
+ " ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";// +" group by
// ARREARS_CREDITS_AMT,arrears_net_amt
// " ;
Object[][] arrears_days = getSqlModel().getSingleResult(
arrearDaysQuery);
if (arrears_days != null || arrears_days.length != 0) {
data[dataIndex][2] = Double.parseDouble(String
.valueOf(arrears_days[0][0]))
+ Double.parseDouble(String
.valueOf(emp_id[i][4]));
}
} else {
data[dataIndex][2] = emp_id[i][4];
}
int column = 3;
double totArrACredit = 0;
double totArrDebit = 0;
int position_totalPay = 0;
/*
* If any check box is selected then the value for that column
* will appear in the report.
*/
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex][column] = emp_id[i][5];// Branch
column++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex][column] = emp_id[i][6];// Department
column++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex][column] = emp_id[i][11];// Designation
column++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex][column] = emp_id[i][12];// Date of Joining
column++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex][column] = emp_id[i][7];// Date of Birth
column++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex][column] = emp_id[i][3];// Employee Type
column++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex][column] = emp_id[i][8];// Bank
column++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex][column] = emp_id[i][9];// Salary Account
// Number
column++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex][column] = emp_id[i][10];// Pan number
column++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13]).equals("")
|| String.valueOf(emp_id[i][13]).equals("null")) {
data[dataIndex][column] = "";
} else {
data[dataIndex][column] = emp_id[i][13];// Gender
}
column++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex][column] = emp_id[i][14];// On Hold
column++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex][column] = emp_id[i][15];// Grade
column++;
}
/** set credit values */
double total_credit = 0.00;
Object salCredit[][] = getSalaryCreditData(String
.valueOf(emp_id[i][0]), year, month, settlReg, Id);
// UPDATED BY REEBA BEGINS
double employerESIC = 0.0;
double esicCredit = 0.0;
double employerPF = 0.0;
// UPDATED BY REEBA ENDS
/*
* Following loop sets the credit head values
*/
for (int j = 0; j < credit_header.length; j++) {
// UPDATED BY REEBA
esicCredit = 0.0;
data[dataIndex][column] = 0.00;
if (!(salCredit == null || salCredit.length == 0))
for (int k = 0; k < salCredit.length; k++) {
// UPDATED BY REEBA BEGINS
try {// totalESICCredit
if (String.valueOf(salCredit[k][2]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
// logger.info("employerESIC========="+employerESIC);
}
} catch (Exception e) {
logger
.error("Exception in employerESIC :"
+ e);
}
// UPDATED BY REEBA ENDS
/*
* Following if condition compares the credit code
* from hrms_credit_head table with
* hrms_sal_cedits_2008 table
*/
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(salCredit[k][0]))) {
if (salCredit[k][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary credit amount will be added
* with the arrear credit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_CREDIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_CREDIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_CREDIT_CODE="
+ salCredit[k][0]
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salCredit[k][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_credit += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of checkFlag if condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salCredit[k][1]));
total_credit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
}
}// End of salCredit if condition
}// End of credit code comparison if condition
}// End of salCredit for loop
column++;
}// End of credit header for loop
/*
* for (int j = 0; j < credit_header.length; j++) {
* data[dataIndex][column] = 0.00; if(!(salCredit==null ||
* salCredit.length ==0)) for (int k = 0; k < salCredit.length;
* k++) {
* if(String.valueOf(credit_header[j][0]).equals(String.valueOf(salCredit[k][0]))){
* if(salCredit[k][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salCredit[k][1]));
* total_credit
* +=Double.parseDouble(String.valueOf(salCredit[k][1])); } }
*
*
*
*
* column++; }
*/
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_credit));
column = column + 1;
/** set non-recovery debits */
Object salDebit[][] = getSalDebit(String.valueOf(emp_id[i][0]),
month, year, settlReg, Id);
double total_nonRecovery = 0;
// UPDATED BY REEBA BEGINS
Object[][] esi_data = null;
try {
String esi_query = " SELECT ESI_CODE, ESI_DATE, ESI_COMP_PERCENTAGE, ESI_DEBIT_CODE FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'DD-MON-YYYY') = (SELECT MAX(ESI_DATE) FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'YYYY-MM') <= '"
+ year
+ "-" + month + "') ";
esi_data = getSqlModel().getSingleResult(esi_query);
} catch (Exception e) {
logger.error("Error in calculation employer ESIC: " + e);
}
Object[][] pf_data = null;
try {
String pf_query = " SELECT PF_CODE, PF_DATE, PF_PERCENTAGE, PF_DEBIT_CODE FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'DD-MON-YYYY') = (SELECT MAX(PF_DATE) FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'YYYY-MM') <='"
+ year
+ "-" + month + "') ";
pf_data = getSqlModel().getSingleResult(pf_query);
} catch (Exception e) {
logger.error("Error in calculation employer PF: " + e);
}
// UPDATED BY REEBA ENDS
/*
* Following loop is used to set the debit head amount values.
*/
for (int k = 0; k < debit_header.length; k++) {
data[dataIndex][column] = 0;
if (!(salDebit == null || salDebit.length == 0))
for (int index = 0; index < salDebit.length; index++) {
/*
* Following loop compares the debit code from
* hrms_debit_head with the debit code from
* hrms_sal_debits_2008(Year entered)
*/
if (String.valueOf(debit_header[k][0]).equals(
String.valueOf(salDebit[index][0]))) {
if (salDebit[index][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary debit amount will be added
* with the arrear debit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_DEBIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_DEBIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_DEBIT_CODE="
+ salDebit[index][0]
+ "AND ARREARS_PAY_IN_SAL = 'Y'";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
} else {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble("0.00")));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of check flag condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salDebit[index][1]));
total_nonRecovery += Double
.parseDouble(String
.valueOf(salDebit[index][1]));
}
}// End of salDebit if condition
}// End of debit code comparison
// UPDATED BY REEBA BEGINS
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
if (Double.parseDouble(String
.valueOf(salDebit[index][1])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
employerPF = Double.parseDouble(String.valueOf(salDebit[index][1]));
}
}
// UPDATED BY REEBA ENDS
}// End of salDebit for loop
column++;
}// End of debit header for loop
/*
* for (int k = 0; k < debit_header.length; k++) {
* data[dataIndex][column] = Utility.twoDecimals("0");
* if(!(salDebit==null || salDebit.length ==0)) for (int index =
* 0; index < salDebit.length; index++) {
* if(String.valueOf(debit_header[k][0]).equals(String.valueOf(salDebit[index][0]))){
* if(salDebit[index][1]!=null) data[dataIndex][column] =
* Utility.twoDecimals(String.valueOf(salDebit[index][1]));
* total_nonRecovery
* +=Double.parseDouble(String.valueOf(salDebit[index][1])); } }
*
*
*
* column++; }
*/
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_nonRecovery));
double total_pay = 0;
total_pay = Double.parseDouble(String
.valueOf(data[dataIndex][credit_header.length + 3
+ colTotal]))
- Double.parseDouble(String
.valueOf(data[dataIndex][column]));
column = column + 1;
if (Double.parseDouble(Utility.twoDecimals(total_pay)) < 0) {
data[dataIndex][column] = Utility.twoDecimals("0");
} else {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_pay));
}
// UPDATED BY REEBA BEGINS
column = column + 1;
if (PFChk.equals("Y")) {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerPF));// Employer contribution to
// PF
column++;
}
if (ESICChk.equals("Y")) {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerESIC));
;// Employer contribution to ESIC
}
// UPDATED BY REEBA ENDS
position_totalPay = column;
employerESIC = 0;
employerPF =0;
esicCredit=0;
try {
/**
* Following condition is used to select the arrears for the
* employees.
*/
if (settlReg.getCheckFlag().equals("N")) {
if (arrEmpLength != 0) {
String arrear = " SELECT HRMS_ARREARS_LEDGER.ARREARS_CODE,ARREARS_MONTH,ARREARS_YEAR,ARREARS_DAYS,ARREARS_TYPE,ARREARS_PROMCODE,DECODE(NVL(ARREARS_PAY_TYPE,'ADD'),'ADD','Arrears',"
+ " 'DED','Recovery') FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE) WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' AND EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " ORDER BY ARREARS_MONTH,ARREARS_YEAR";
Object[][] arrearCode = getSqlModel()
.getSingleResult(arrear);
if (!(arrearCode == null || arrearCode.length == 0)) {
for (int arrCode = 0; arrCode < arrearCode.length; arrCode++) {
totArrACredit = 0;
totArrDebit = 0;
if (String.valueOf(arrearCode[arrCode][5])
.equals("")
|| String.valueOf(
arrearCode[arrCode][5])
.equals("null")) {
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
} else {
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
}
String arrMonth = Utility
.month(Integer
.parseInt(String
.valueOf(arrearCode[arrCode][1])));
int arrearCol = 0;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][1];// Emp id
arrearCol = arrearCol + 1;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][2]
+ "\n"
+ String
.valueOf(arrearCode[arrCode][6])
+ " for "
+ arrMonth
+ "-"
+ String
.valueOf(arrearCode[arrCode][2]);// Employee
// Name
arrearCol = arrearCol + 1;
if (String.valueOf(arrearCode[arrCode][3])
.equals("null")
|| String.valueOf(
arrearCode[arrCode][3])
.equals("")) {
data[dataIndex + 1][arrearCol] = "";// Arrears
// Days
} else {
data[dataIndex + 1][arrearCol] = ""
+ String
.valueOf(arrearCode[arrCode][3]);
}
arrearCol = arrearCol + 1;
/*
* Following conditions set the values for
* the selected check boxes in the salary
* register report.
*/
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][5];// Branch
arrearCol++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][6];// Department
arrearCol++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][11];// Designation
arrearCol++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][12];// Date
// of
// Joining
arrearCol++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][7];// Date
// of
// Birth
arrearCol++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][3];// Employee
// Type
arrearCol++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][8];// Bank
// Name
arrearCol++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][9];// Salary
// Account
// No.
arrearCol++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][10];// Pan
// Number
arrearCol++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13])
.equals("")
|| String
.valueOf(emp_id[i][13])
.equals("null")) {
data[dataIndex + 1][arrearCol] = "";
} else {
data[dataIndex + 1][arrearCol] = emp_id[i][13];// Gender
}
arrearCol++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][14];// On
// Hold
arrearCol++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][15];// Grade
arrearCol++;
}
/*
* Following loop is used to set the arrear
* credit amount from
* HRMS_ARREARS_CREDIT_2008(*Year Entered)
* table
*/
for (int ac = 0; ac < arrearCreditAmt.length; ac++) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(
arrearCreditAmt[ac][0]).equals(
"null")
|| String.valueOf(
arrearCreditAmt[ac][0])
.equals("")
|| String.valueOf(
arrearCreditAmt[ac][0])
.equals("")) {
totArrACredit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrACredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(arrearCreditAmt[ac][1]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
}
}
arrearCol++;
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrACredit));
arrearCol = arrearCol + 1;
/*
* Following loop is used to set the arrear
* debit amount from HRMS_ARREARS_DEBIT_2008
*/
for (int ad = 0; ad < arrearDebitAmt.length; ad++) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearDebitAmt[ad][0]));
if (String.valueOf(
arrearDebitAmt[ad][0]).equals(
"null")
|| String.valueOf(
arrearDebitAmt[ad][0])
.equals("")) {
totArrDebit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrDebit += Double
.parseDouble(String
.valueOf(arrearDebitAmt[ad][0]));
}
arrearCol++;
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
if (Double.parseDouble(String
.valueOf(arrearDebitAmt[ad][0])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
employerPF = Double.parseDouble(String.valueOf(arrearDebitAmt[ad][0]));
}
}
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrDebit));
totArrearAmt = Double
.parseDouble(String
.valueOf(data[dataIndex + 1][credit_header.length
+ colTotal + 3]))
- Double
.parseDouble(String
.valueOf(data[dataIndex + 1][arrearCol]));
// data[dataIndex+1][arrearCol]=Utility.twoDecimals(totArrDebit);
arrearCol = arrearCol + 1;
if (Double.parseDouble(String
.valueOf(totArrearAmt)) < 0) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals("0.00");
} else {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrearAmt));
}
// UPDATED BY <NAME>
arrearCol++;
if (PFChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerPF)); // Employer
// contribution
// to
// PF
arrearCol++;
}
if (ESICChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerESIC)); ;// Employer
// contribution
// to
// ESIC
}
// UPDATED BY <NAME>
dataIndex++;
}// End of arrear code for loop
}// End of arrear code if condition
}// End of arrearEmpLength if condition
}// End of check flag
} catch (Exception e) {
logger.error(e.getMessage());
}
dataIndex++;
}// End of emp_id for loop
dataWithHeader = new Object[data.length + 1][totalCol];
/*
* Following query is used to set the credit and debit head names.
*/
for (int i = 0; i < colNames.length; i++) {
dataWithHeader[0][i] = colNames[i];
}
/*
* Following query is used to set the credit and debit head amount.
*/
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[0].length; j++) {
dataWithHeader[i + 1][j] = data[i][j];
}
}
String finalHeader[] = new String[dataWithHeader[0].length];
int[] cellWidth = new int[dataWithHeader[0].length];
int[] alignment = new int[dataWithHeader[0].length];
for (int i = 0; i < dataWithHeader[0].length; i++) {
finalHeader[i] = (String) dataWithHeader[0][i];
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
cellWidth[2] = 10;
cellWidth[3] = 7;
}
}
Object finalData[][] = new Object[dataWithHeader.length - 1][dataWithHeader[0].length];
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = dataWithHeader[i + 1][j];
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return dataWithHeader;
}
/*
* Following function is called in the reportDatanoSelect() method.This
* method returns the emp id,emp name,credit head,debit head and values and
* also the arrear value if any.
*/
public Object[][] getReportDataNoBranchDept(String query,
SettlementRegister settlReg, String brnCode, String deptCode,
int arrEmpLength, int colTotal, String PFChk, String ESICChk) {
int dataIndex = 0;
String year = settlReg.getYear();
String month = settlReg.getMonth();
Object[][] dataWithHeader = null;
Object[][] arrearCreditAmt = null;
Object[][] arrearDebitAmt = null;
try {
Object emp_id[][] = getEmpIdNew(query);
Object credit_header[][] = getCreditHeader();
Object debit_header[][] = getDebitHeader();
double totArrearAmt = 0;
// Object debit_recovery[][]= getDebitHeader_recovery();
int totalCol = credit_header.length + debit_header.length
+ colTotal + 6;
int counter = 0;
String[] colNames = null;
// UPDATED BY REEBA BEGINS
if (settlReg.getChkConsSummary().equals("N")) {
colNames = new String[totalCol];
colNames[counter] = "Emp Id";
counter = counter + 1;
colNames[counter] = "Employee Name";
counter = counter + 1;
colNames[counter] = "Sal Days";
counter = counter + 1;
} else {
colNames = new String[totalCol - 1];
colNames[counter] = "";
counter = counter + 1;
colNames[counter] = "No. of Employees";
counter = counter + 1;
}
// UPDATED BY REEBA ENDS
if (settlReg.getCheckBrn().equals("Y")) {
colNames[counter] = "Branch";
counter = counter + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
colNames[counter] = "Dept";
counter = counter + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
colNames[counter] = "Desg";
counter = counter + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
colNames[counter] = "Date Of\nJoining";
counter = counter + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
colNames[counter] = "Date of\nBirth";
counter = counter + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
colNames[counter] = "Emp Type";
counter = counter + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
colNames[counter] = "Bank";
counter = counter + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
colNames[counter] = "Acc. No.";
counter = counter + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
colNames[counter] = "Pan No.";
counter = counter + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
colNames[counter] = "Gender";
counter = counter + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
colNames[counter] = "On Hold";
counter = counter + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
colNames[counter] = "Grade";
counter = counter + 1;
}
/*
* Following loop sets the credit head names
*/
for (int i = 0; i < credit_header.length; i++) {
colNames[counter] = String.valueOf(credit_header[i][1]);
counter++;
}
colNames[counter] = "TOT CREDIT";
counter = counter + 1;
/*
* Following loop sets the debit head names
*/
for (int i = 0; i < debit_header.length; i++) {
colNames[counter] = String.valueOf(debit_header[i][1]);
counter++;
}
colNames[counter] = "TOT DEBIT";
counter = counter + 1;
colNames[counter] = "NET-PAY";
// UPDATED BY REEBA BEGINS
counter = counter + 1;
if (PFChk.equals("Y")) {
colNames[counter] = "Employer contribution to PF";
counter = counter + 1;
}
if (ESICChk.equals("Y")) {
colNames[counter] = "Employer contribution to ESIC";
}
if (PFChk.equals("Y") && ESICChk.equals("Y")) {
colTotal = colTotal - 2;
} else if (PFChk.equals("Y")) {
colTotal = colTotal - 1;
} else if (ESICChk.equals("Y")) {
colTotal = colTotal - 1;
}
// UPDATED BY <NAME>
Object[][] data = null;
if (settlReg.getCheckFlag().equals("N")) {
data = new Object[emp_id.length + arrEmpLength][totalCol];
} else {
data = new Object[emp_id.length][totalCol];
}
/*
* Following loop sets the corresponding values to the headers
*/
for (int i = 0; i < emp_id.length; i++) {
data[dataIndex][0] = emp_id[i][1];
data[dataIndex][1] = emp_id[i][2];
if (settlReg.getCheckFlag().equals("Y")) {
String arrearDaysQuery = "SELECT NVL(SUM(ARREARS_DAYS),0)FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER "
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE)"
+ " WHERE HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " AND ARREARS_TYPE IN ('M','P') AND HRMS_ARREARS_LEDGER.ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " AND "
+ " ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ "AND ARREARS_PAY_IN_SAL = 'Y' ";// +" group by
// ARREARS_CREDITS_AMT,arrears_net_amt
// " ;
Object[][] arrears_days = getSqlModel().getSingleResult(
arrearDaysQuery);
if (arrears_days != null || arrears_days.length != 0) {
data[dataIndex][2] = Double.parseDouble(String
.valueOf(arrears_days[0][0]))
+ Double.parseDouble(String
.valueOf(emp_id[i][4]));
}
} else {
data[dataIndex][2] = emp_id[i][4];
}
// data[dataIndex][3]=emp_id[i][4];
int column = 3;
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex][column] = emp_id[i][5];
column++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex][column] = emp_id[i][6];
column++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex][column] = emp_id[i][11];
column++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex][column] = emp_id[i][12];
column++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex][column] = emp_id[i][7];
column++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex][column] = emp_id[i][3];
column++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex][column] = emp_id[i][8];
column++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex][column] = emp_id[i][9];
column++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex][column] = emp_id[i][10];
column++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13]).equals("")
|| String.valueOf(emp_id[i][13]).equals("null")) {
data[dataIndex][column] = "";
} else {
data[dataIndex][column] = emp_id[i][13];// Gender
}
column++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex][column] = emp_id[i][14];// On Hold
column++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex][column] = emp_id[i][15];// Grade
column++;
}
double totArrACredit = 0;
double totArrDebit = 0;
int position_totalPay = 0;
/** set credit values */
double total_credit = 0.00;
// UPDATED BY REEBA BEGINS
double employerESIC = 0.0;
double esicCredit = 0.0;
double employerPF = 0.0;
// UPDATED BY REEBA ENDS
Object salCredit[][] = getSalaryCreditDataNoSelect(String
.valueOf(emp_id[i][0]), year, month, settlReg, brnCode,
deptCode);
// getSalaryCreditData(String.valueOf(emp_id[i][0]), year,
// month,settlReg,Id) ;
/*
* Following query is used to set the credit head amount
*/
for (int j = 0; j < credit_header.length; j++) {
// UPDATED BY REEBA
esicCredit = 0.0;
data[dataIndex][column] = 0.00;
if (!(salCredit == null || salCredit.length == 0))
/**
* Following loop compares the credit code from
* HRMS_CREDIT_HEAD with HRMS_SAL_CREDIT_2008(Year
* Entered)
*/
for (int k = 0; k < salCredit.length; k++) {
// UPDATED BY REEBA BEGINS
try {// totalESICCredit
if (String.valueOf(salCredit[k][2]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
// logger.info("employerESIC========="+employerESIC);
}
} catch (Exception e) {
logger
.error("Exception in employerESIC :"
+ e);
}
// UPDATED BY REEBA ENDS
if (String.valueOf(credit_header[j][0]).equals(
String.valueOf(salCredit[k][0]))) {
if (salCredit[k][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary credit amount will be added
* with the arrear credit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_CREDIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_CREDIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_CREDIT_CODE="
+ salCredit[k][0]
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salCredit[k][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_credit += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of the check flag condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salCredit[k][1]));
total_credit += Double
.parseDouble(String
.valueOf(salCredit[k][1]));
}
}// End of Salcredit condition
}
}// End of inner for loop
column++;
}// End of outer for loop
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_credit));
column = column + 1;
/** set non-recovery debits */
Object salDebit[][] = getSalDebitNotSelect(String
.valueOf(emp_id[i][0]), month, year, settlReg, brnCode,
deptCode);
// getSalDebit(String.valueOf(emp_id[i][0]),month,year,settlReg,Id)
// ;
double total_nonRecovery = 0;
// UPDATED BY REEBA BEGINS
Object[][] esi_data = null;
try {
String esi_query = " SELECT ESI_CODE, ESI_DATE, ESI_COMP_PERCENTAGE, ESI_DEBIT_CODE FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'DD-MON-YYYY') = (SELECT MAX(ESI_DATE) FROM HRMS_ESI "
+ " WHERE TO_CHAR(ESI_DATE,'YYYY-MM') <= '"
+ year
+ "-" + month + "') ";
esi_data = getSqlModel().getSingleResult(esi_query);
} catch (Exception e) {
logger.error("Error in calculation employer ESIC: " + e);
}
Object[][] pf_data = null;
try {
String pf_query = " SELECT PF_CODE, PF_DATE, PF_PERCENTAGE, PF_DEBIT_CODE FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'DD-MON-YYYY') = (SELECT MAX(PF_DATE) FROM HRMS_PF_CONF "
+ " WHERE TO_CHAR(PF_DATE,'YYYY-MM') <='"
+ year
+ "-" + month + "') ";
pf_data = getSqlModel().getSingleResult(pf_query);
} catch (Exception e) {
logger.error("Error in calculation employer PF: " + e);
}
// UPDATED BY REEBA ENDS
/*
* Following loop is used to set the debit head amount.
*/
for (int k = 0; k < debit_header.length; k++) {
data[dataIndex][column] = 0;
if (!(salDebit == null || salDebit.length == 0))
/*
* Following loop compares the debit code from
* hrms_debit_head with the debit code from
* hrms_sal_debits_2008(Year entered)
*/
for (int index = 0; index < salDebit.length; index++) {
if (String.valueOf(debit_header[k][0]).equals(
String.valueOf(salDebit[index][0]))) {
if (salDebit[index][1] != null) {
/*
* Following if condition checks if
* consolidated arrears check box is checked
* then salary debit amount will be added
* with the arrear debit amount
*/
if (settlReg.getCheckFlag().equals("Y")) {
String sql = " SELECT NVL(SUM(ARREARS_AMT),0) from HRMS_ARREARS_DEBIT_"
+ year
+ " INNER JOIN HRMS_ARREARS_LEDGER ON "
+ " (HRMS_ARREARS_DEBIT_"
+ year
+ ".ARREARS_CODE=HRMS_ARREARS_LEDGER.ARREARS_CODE) WHERE ARREARS_EMP_ID="
+ emp_id[i][0]
+ ""
+ " AND ARREARS_PAID_MONTH="
+ month
+ " AND ARREARS_PAID_YEAR="
+ year
+ " AND ARREARS_TYPE IN('M','P') AND ARREARS_DEBIT_CODE="
+ salDebit[index][0]
+ " AND ARREARS_PAY_IN_SAL = 'Y' ";
Object[][] amt = getSqlModel()
.getSingleResult(sql);
if (amt != null || amt.length != 0) {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble(String
.valueOf(amt[0][0]))));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
} else {
data[dataIndex][column] = Utility
.twoDecimals(formatter
.format(Double
.parseDouble(String
.valueOf(salDebit[index][1]))
+ Double
.parseDouble("0.00")));
total_nonRecovery += Double
.parseDouble(String
.valueOf(data[dataIndex][column]));
}
}// End of check flag condition
else {
data[dataIndex][column] = Utility
.twoDecimals(String
.valueOf(salDebit[index][1]));
total_nonRecovery += Double
.parseDouble(String
.valueOf(salDebit[index][1]));
}
}// end of sal debit if condition
}// End of comparison of debit code condition
// UPDATED BY REEBA BEGINS
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
if (Double.parseDouble(String
.valueOf(salDebit[index][1])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(salDebit[index][0]))) {
employerPF = Double.parseDouble(String.valueOf(salDebit[index][1]));
}
}
// UPDATED BY REEBA ENDS
}// End of sal debit for loop
column++;
}// End of debit head loop
// logger.info("Length of arrear Debit code
// pkppp"+arrearDebitCode.length);
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_nonRecovery));
double total_pay = 0;
total_pay = Double.parseDouble(String
.valueOf(data[dataIndex][credit_header.length
+ colTotal + 3]))
- Double.parseDouble(String
.valueOf(data[dataIndex][column]));
column = column + 1;
if (Double.parseDouble(Utility.twoDecimals(total_pay)) < 0) {
data[dataIndex][column] = Utility.twoDecimals("0");
} else {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(total_pay));
}
// UPDATED BY REEBA BEGINS
column = column + 1;
if (PFChk.equals("Y")) {
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerPF));// Employer contribution to
// PF
column++;
}
if (ESICChk.equals("Y")) {
//logger.info("employerESIC last=========" + employerESIC);
//logger.info("employerESIC column=========" + column);
data[dataIndex][column] = Utility.twoDecimals(formatter
.format(employerESIC));
;// Employer contribution to ESIC
}
// UPDATED BY <NAME>
position_totalPay = column;
employerESIC = 0;
employerPF =0;
esicCredit=0;
//logger.info("position_totalPay :" + position_totalPay);
try {
/**
* Following condition is used to select the arrears for the
* employees.
*/
if (settlReg.getCheckFlag().equals("N")) {
if (arrEmpLength != 0) {
String arrear = " SELECT HRMS_ARREARS_LEDGER.ARREARS_CODE,ARREARS_MONTH,ARREARS_YEAR,ARREARS_DAYS,ARREARS_TYPE,"
+ "ARREARS_PROMCODE,DECODE(NVL(ARREARS_PAY_TYPE,'ADD'),'ADD','Arrears',"
+ " 'DED','Recovery') FROM HRMS_ARREARS_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type in('M','P') AND ARREARS_PAY_IN_SAL = 'Y' AND EMP_ID="
+ String.valueOf(emp_id[i][0])
+ " ORDER BY ARREARS_MONTH,ARREARS_YEAR";
Object[][] arrearCode = getSqlModel()
.getSingleResult(arrear);
if (!(arrearCode == null || arrearCode.length == 0)) {
for (int arrCode = 0; arrCode < arrearCode.length; arrCode++) {
totArrACredit = 0;
totArrDebit = 0;
if (String.valueOf(arrearCode[arrCode][5])
.equals("")
|| String.valueOf(
arrearCode[arrCode][5])
.equals("null")) {
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
year);
} else {
arrearDebitAmt = arrearDebitData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
debit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
arrearCreditAmt = arrearCreditData(
String
.valueOf(arrearCode[arrCode][0]),
String.valueOf(emp_id[i][0]),
String
.valueOf(arrearCode[arrCode][1]),
String
.valueOf(arrearCode[arrCode][2]),
credit_header,
String
.valueOf(arrearCode[arrCode][4]),
String
.valueOf(arrearCode[arrCode][5]),
year);
}
String arrMonth = Utility
.month(Integer
.parseInt(String
.valueOf(arrearCode[arrCode][1])));
// arrearCreditAmt=arrearCreditData(String.valueOf(arrearCode[arrCode][0]),String.valueOf(emp_id[i][0]),String.valueOf(arrearCode[arrCode][1]),String.valueOf(arrearCode[arrCode][2]),credit_header,String.valueOf(arrearCode[arrCode][4]),String.valueOf(arrearCode[arrCode][5]),settlReg);
// arrearDebitAmt=arrearDebitData(String.valueOf(arrearCode[arrCode][0]),String.valueOf(emp_id[i][0]),String.valueOf(arrearCode[arrCode][1]),String.valueOf(arrearCode[arrCode][2]),debit_header,String.valueOf(arrearCode[arrCode][4]),String.valueOf(arrearCode[arrCode][5]),settlReg);
// String
// arrMonth=Utility.month(Integer.parseInt(String.valueOf(arrearCode[arrCode][1])));
int arrearCol = 0;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][1];
arrearCol = arrearCol + 1;
data[dataIndex + 1][arrearCol] = ""
+ emp_id[i][2]
+ "\n"
+ String
.valueOf(arrearCode[arrCode][6])
+ " for "
+ arrMonth
+ "-"
+ String
.valueOf(arrearCode[arrCode][2]);
arrearCol = arrearCol + 1;
if (String.valueOf(arrearCode[arrCode][3])
.equals("null")
|| String.valueOf(
arrearCode[arrCode][3])
.equals("")) {
data[dataIndex + 1][arrearCol] = "";// +String.valueOf(arrearCode[arrCode][3]);
} else {
data[dataIndex + 1][arrearCol] = ""
+ String
.valueOf(arrearCode[arrCode][3]);
}
arrearCol = arrearCol + 1;
if (settlReg.getCheckBrn().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][5];
arrearCol++;
}
if (settlReg.getCheckDept().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][6];
arrearCol++;
}
if (settlReg.getCheckDesg().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][11];
arrearCol++;
}
if (settlReg.getCheckDoj().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][12];
arrearCol++;
}
if (settlReg.getCheckDob().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][7];
arrearCol++;
}
if (settlReg.getCheckEmpType().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][3];
arrearCol++;
}
if (settlReg.getCheckBank().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][8];
arrearCol++;
}
if (settlReg.getCheckAccount().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][9];
arrearCol++;
}
if (settlReg.getCheckPan().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][10];
arrearCol++;
}
if (settlReg.getCheckGender().equals("Y")) {
if (String.valueOf(emp_id[i][13])
.equals("")
|| String
.valueOf(emp_id[i][13])
.equals("null")) {
data[dataIndex + 1][arrearCol] = "";
} else {
data[dataIndex + 1][arrearCol] = emp_id[i][13];// Gender
}
arrearCol++;
}
if (settlReg.getCheckHold().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][14];
arrearCol++;
}
if (settlReg.getCheckGrade().equals("Y")) {
data[dataIndex + 1][arrearCol] = emp_id[i][15];
arrearCol++;
}
/*
* arrearCol=arrearCol+1;
* data[dataIndex+1][arrearCol]=""+emp_id[i][3];//Emp
* type
*/
// Following loop is used to set the arrear
// credit amount.
for (int ac = 0; ac < arrearCreditAmt.length; ac++) {
if (arrearCreditAmt != null)
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(
arrearCreditAmt[ac][0]).equals(
"null")
|| String.valueOf(
arrearCreditAmt[ac][0])
.equals("")) {
totArrACredit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrACredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
if (String.valueOf(arrearCreditAmt[ac][1]).trim()
.equals("Y")) {
esicCredit += Double
.parseDouble(String
.valueOf(arrearCreditAmt[ac][0]));
}
}
arrearCol++;
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrACredit));
arrearCol = arrearCol + 1;
/*
* Following loop is used to the arrear
* debit amount
*/
for (int ad = 0; ad < arrearDebitAmt.length; ad++) {
if (arrearDebitAmt != null)
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(String
.valueOf(arrearDebitAmt[ad][0]));
if (String.valueOf(
arrearDebitAmt[ad][0]).equals(
"")
|| String.valueOf(
arrearDebitAmt[ad][0])
.equals("null")) {
totArrDebit += Double
.parseDouble(String
.valueOf("0.00"));
} else {
totArrDebit += Double
.parseDouble(String
.valueOf(arrearDebitAmt[ad][0]));
if (esi_data != null && esi_data.length > 0) {
if (String.valueOf(esi_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
if (Double.parseDouble(String
.valueOf(arrearDebitAmt[ad][0])) > 0){
employerESIC = esicCredit
* Double
.parseDouble(String
.valueOf(esi_data[0][2]))
/ 100;
}else
employerESIC = 0.0;
}
}
if (pf_data != null && pf_data.length > 0) {
if (String.valueOf(pf_data[0][3]).equals(
String.valueOf(arrearDebitAmt[ad][1]))) {
employerPF = Double.parseDouble(String.valueOf(arrearDebitAmt[ad][0]));
}
}
}
arrearCol++;
}
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrDebit));
// arrearCol=arrearCol+1;
// data[dataIndex+1][arrearCol]=Utility.twoDecimals(totArrDebit);
totArrearAmt = Double
.parseDouble(String
.valueOf(data[dataIndex + 1][credit_header.length
+ colTotal + 3]))
- Double
.parseDouble(String
.valueOf(data[dataIndex + 1][arrearCol]));
arrearCol = arrearCol + 1;
if (Double.parseDouble(String
.valueOf(totArrearAmt)) < 0) {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals("0.00");
} else {
data[dataIndex + 1][arrearCol] = Utility
.twoDecimals(formatter
.format(totArrearAmt));
}
// UPDATED BY REEBA BEGINS
arrearCol++;
if (PFChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerPF));// Employer
// contribution
// to
// PF
arrearCol++;
}
if (ESICChk.equals("Y")) {
data[dataIndex + 1][arrearCol] = Utility.twoDecimals(formatter
.format(employerESIC));// Employer;// Employer
// contribution
// to
// ESIC
}
// UPDATED BY REEBA ENDS
dataIndex++;
}// End of arrear code for loop
}
}// End of arrearEmpLength if condition
}// End of check flag
} catch (Exception e) {
logger.error(e.getMessage());
}
dataIndex++;
}// End of emp_id for loop
dataWithHeader = new Object[data.length + 1][totalCol];
/*
* Following loop sets the column names
*/
for (int i = 0; i < colNames.length; i++) {
dataWithHeader[0][i] = colNames[i];
}
/*
* Following loop sets the column values
*/
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[0].length; j++) {
dataWithHeader[i + 1][j] = data[i][j];
}
}
String finalHeader[] = new String[dataWithHeader[0].length];
int[] cellWidth = new int[dataWithHeader[0].length];
int[] alignment = new int[dataWithHeader[0].length];
for (int i = 0; i < dataWithHeader[0].length; i++) {
finalHeader[i] = (String) dataWithHeader[0][i];
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
cellWidth[2] = 10;
cellWidth[3] = 7;
}
}
Object finalData[][] = new Object[dataWithHeader.length - 1][dataWithHeader[0].length];
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = dataWithHeader[i + 1][j];
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
return dataWithHeader;
}
public Object[][] getLeaveEncashmentDataUncheck(String emp_id, String year,
String month) {
String query = "SELECT SUM(NVL(ENCASHMENT_ENCASH_AMOUNT,0)),ENCASHMENT_CREDIT_CODE FROM HRMS_ENCASHMENT_PROCESS_HDR"
+ " LEFT JOIN HRMS_ENCASHMENT_PROCESS_DTL ON(HRMS_ENCASHMENT_PROCESS_HDR.ENCASHMENT_PROCESS_CODE=HRMS_ENCASHMENT_PROCESS_DTL.ENCASHMENT_PROCESS_CODE AND EMP_ID="
+ emp_id
+ ")"
+ " WHERE ENCASHMENT_PROCESS_FLAG= 'Y' AND ENCASHMENT_INCLUDE_SAL_FLAG ='Y' AND ENCASHMENT_INCLUDE_SAL_MONTH="
+ month
+ " AND ENCASHMENT_INCLUDE_SAL_YEAR="
+ year
+ " GROUP BY ENCASHMENT_CREDIT_CODE";
Object leaveEncashData[][] = getSqlModel().getSingleResult(query);
return leaveEncashData;
}
/**
* Checks for the null value and if it finds it to be null then replaces it
* with blank.
*
* @param result :-
* Input String to be checked
* @return : - returns the checked string
*/
public static String checkNullToZero(String result) {
if (result == null || result.equals("null")) {
return "0";
} else {
return result;
}
}
public void reportDataNoSelect(Object[][] loop_data, ReportGenerator rg,
SettlementRegister settlReg) {
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0;
int arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA ENDS
String finalHeader[] = null;
int colTotal = 0;
String selectQueryInner = "SELECT DEPT_ID,DEPT_NAME from HRMS_DEPT";
Object[][] loop_data_inner = getSqlModel().getSingleResult(
selectQueryInner);
if (loop_data.length > 0) {
for (int a = 0; a < loop_data.length; a++) {
for (int b = 0; b < loop_data_inner.length; b++) {
String selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
String where = " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ "";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
where += " AND SAL_DEPT=" + loop_data_inner[b][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_PAID_YEAR="
+ settlReg.getYear()
+ " and arrears_type IN('M','P') AND ARREARS_PAY_IN_SAL = 'Y'"
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
+ " AND SAL_EMP_CENTER=" + loop_data[a][0]
+ " and SAL_DEPT=" + loop_data_inner[b][0];
/*
* String arrearEmp="SELECT
* HRMS_ARREARS_"+settlReg.getYear()+".EMP_ID,ARREARS_CODE
* FROM HRMS_ARREARS_"+settlReg.getYear()+" " + " inner
* join HRMS_EMP_OFFC on HRMS_EMP_OFFC.emp_id =
* HRMS_ARREARS_"+settlReg.getYear()+".emp_id " + " WHERE
* ARREARS_PAID_MONTH="+settlReg.getMonth()+" AND
* ARREARS_PAID_YEAR="+settlReg.getYear()+"" + " and
* arrears_type='M' and EMP_CENTER="+loop_data[a][0]+ "
* and EMP_DEPT="+loop_data_inner[b][0];
*/
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error(e.getMessage());
}
Object[][] reportDataPay = getReportDataNoBranchDept(
selectSalaryLoop, settlReg, String
.valueOf(loop_data[a][0]), String
.valueOf(loop_data_inner[b][0]),
arrEmpLength, check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
// getReportDataNotSelect(selectSalaryLoop,settlReg,String.valueOf(loop_data[a][0]),String.valueOf(loop_data_inner[b][0]),arrEmpLength);//getReportData(selectSalaryLoop,settlReg);
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
// String finalHeader[] = new
// String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String
.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit
* head values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
// System.out.println("data----------------------"+String.valueOf(finalDataWithHeader[i+1][j])+"---"+j);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
/**
* Following loop is used to set the sum of the
* individual credit and debit head values.
*/
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals(
"null")
|| String.valueOf(finalData[j][i])
.equals("null.00")
|| String.valueOf(finalData[j][i])
.equals("")
|| String.valueOf(finalData[j][i]) == null) {
finalData[j][i] = "0";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility.twoDecimals(formatter
.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility
.twoDecimals(formatter.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
/*
* Object[][] filterObj = new Object[1][4];
* filterObj[0][0] = "Designation : "; filterObj[0][1] =
* settlReg.getDesgName(); filterObj[0][2] = "Employee
* Type : "; filterObj[0][3] = settlReg.getTypeName();
*
* rg.tableBody(filterObj,cellWidth,alignment);
* rg.addText("\n",0,0,0);
*/
rg.addText("Branch : " + loop_data[a][1]
+ " Department : " + loop_data_inner[b][1],
0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
// Object[][] summaryObj = new Object[1][1];
// summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
// rg.tableBody(totalByColumn, cellWidth,
// alignment);
}
recCount++;
// colCount=finalData[0].length;
}// End of reportDataPay if condition
}// End of loop_data_inner loop
}// End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = formatter.format(Double
.parseDouble(String.valueOf(totList
.get(arrCount))));
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] = "GRAND TOTAL :-";
grand_total[0][1] = " ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
//rg.addText("GRAND TOTAL",0,0,0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total,cellWidth,alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
}//End of loop_data if condition
}
/**
* @author REEBA_JOSEPH
* To generate report Branchwise
* @param settlReg
* @param response
*/
public void generateBranchwiseReport(SettlementRegister settlReg,
HttpServletResponse response) {
String reportType = settlReg.getReport();
String reportName = "Salary Register_" + settlReg.getDivName() + " for "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + "_"
+ settlReg.getYear();
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ", 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ";
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
rg.addText("\n", 0, 1, 0);
if (settlReg.getBranchCode().equals("")) {
//logger.info("Only Branch====Branch code nil");
String selectQuery = "SELECT CENTER_ID,CENTER_NAME FROM HRMS_CENTER ORDER BY CENTER_ID";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportOnlyForBranch(loop_data, rg, settlReg);
} else {
//logger.info("Only Branch====Branch code present : "
// + settlReg.getBranchCode());
Object[][] loop_data = new Object[1][2];
loop_data[0][0] = settlReg.getBranchCode();
loop_data[0][1] = settlReg.getBranchName();
reportOnlyForBranch(loop_data, rg, settlReg);
}
rg.createReport(response);
}
/**
* @author REEBA_JOSEPH
* To generate report Departmentwise
* @param settlReg
* @param response
*/
public void generateDepartmentwiseReport(SettlementRegister settlReg,
HttpServletResponse response) {
String reportType = settlReg.getReport();
String reportName = "Salary Register_" + settlReg.getDivName() + " for "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + "_"
+ settlReg.getYear();
org.paradyne.lib.report.ReportGenerator rg = new org.paradyne.lib.report.ReportGenerator(
reportType, reportName, "A4");
rg.setFName(reportName + "." + reportType);
if (reportType.equals("Pdf")) {
rg.addTextBold("Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ", 0, 1, 0);
} else {
Object[][] title = new Object[1][3];
title[0][0] = "";
title[0][1] = "";
title[0][2] = "Salary Register of " + settlReg.getDivName()
+ " for the month of "
+ Utility.month(Integer.parseInt(settlReg.getMonth())) + " "
+ settlReg.getYear() + " ";
int[] cols = { 20, 20, 50 };
int[] align = { 0, 0, 1 };
rg.tableBodyNoCellBorder(title, cols, align, 1);
}
rg.addText("\n", 0, 1, 0);
if (settlReg.getDeptCode().equals("")) {
//logger.info("Only Department====Department code nil");
String selectQuery = "SELECT DEPT_ID,DEPT_NAME FROM HRMS_DEPT ORDER BY DEPT_ID";
Object[][] loop_data = getSqlModel().getSingleResult(selectQuery);
reportOnlyForDepartment(loop_data, rg, settlReg);
} else {
//logger.info("Only Department====Department code present : "
// + settlReg.getDeptCode());
Object[][] loop_data = new Object[1][2];
loop_data[0][0] = settlReg.getDeptCode();
loop_data[0][1] = settlReg.getDeptName();
reportOnlyForDepartment(loop_data, rg, settlReg);
}
rg.createReport(response);
}
/**
* @author REEBA_JOSEPH
* @param loop_data
* @param rg
* @param settlReg
*/
public void reportOnlyForDepartment(Object[][] loop_data,
ReportGenerator rg, SettlementRegister settlReg) {
ArrayList<String> totList = new ArrayList<String>();
int recCount = 0;
int arrEmpLength = 0;
int check = 0;
if (settlReg.getCheckBrn().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDob().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckBank().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckAccount().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckPan().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmpType().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDept().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDesg().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckDoj().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGender().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckHold().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckGrade().equals("Y")) {
check = check + 1;
}
// UPDATED BY REEBA BEGINS
if (settlReg.getCheckEmployerPF().equals("Y")) {
check = check + 1;
}
if (settlReg.getCheckEmployerESIC().equals("Y")) {
check = check + 1;
}
// UPDATED BY <NAME>
String finalHeader[] = null;
int colTotal = 0;
if (loop_data.length > 0) {
//logger.info("Loop count ============= " + loop_data.length);
for (int a = 0; a < loop_data.length; a++) {
//logger.info("For Department ============= " + loop_data[a][0]);
String selectSalaryLoop = "";
try {
selectSalaryLoop = "SELECT HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID ,EMP_TOKEN ,EMP_FNAME ||' '||EMP_MNAME ||' '||"
+ " EMP_LNAME, NVL(TYPE_NAME,' '),NVL(SAL_DAYS,0) ";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += ",NVL(CENTER_NAME,' ') ";
} else {
selectSalaryLoop += ",' ' ";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += ",NVL(DEPT_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += " ,NVL(TO_CHAR(EMP_DOB,'DD-MM-YYYY'),' '),NVL(BANK_NAME,' '),nvl(SAL_ACCNO_REGULAR,' '),NVL(SAL_PANNO,' ')";
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += ",NVL(RANK_NAME,' ')";
} else {
selectSalaryLoop += ",' '";
}
selectSalaryLoop += ",NVL(TO_CHAR(EMP_REGULAR_DATE,'DD-MM-YYYY'),' '),CASE WHEN EMP_GENDER='M' THEN 'Male' WHEN EMP_GENDER='F' THEN 'Female' WHEN EMP_GENDER='O' THEN 'Other' END"
+ ",CASE WHEN SAL_ONHOLD='Y' THEN 'On Hold' WHEN SAL_ONHOLD='N' THEN ' ' END,NVL(SALGRADE_TYPE,' ') FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC "
+ " ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON"
+ " (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE "
+ " AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ") "
+ " LEFT JOIN HRMS_SALARY_MISC ON(HRMS_SALARY_MISC.EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " LEFT JOIN HRMS_BANK ON(HRMS_BANK.BANK_MICR_CODE=HRMS_SALARY_MISC.SAL_MICR_REGULAR)";
if (settlReg.getCheckBrn().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_CENTER ON(HRMS_CENTER.CENTER_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_CENTER)";
}
if (settlReg.getCheckDept().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_DEPT ON(HRMS_DEPT.DEPT_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_DEPT)";
}
if (settlReg.getCheckDesg().equals("Y")) {
selectSalaryLoop += " INNER JOIN HRMS_RANK ON(HRMS_RANK.RANK_ID=HRMS_SALARY_"
+ settlReg.getYear() + ".SAL_EMP_RANK)";
}
selectSalaryLoop += " LEFT JOIN HRMS_SALGRADE_HDR ON HRMS_SALGRADE_HDR.SALGRADE_CODE = HRMS_EMP_OFFC.EMP_SAL_GRADE ";
selectSalaryLoop += " WHERE SAL_DIVISION="
+ settlReg.getDivCode();
//String where = " AND SAL_EMP_CENTER=" + loop_data[a][0]
// + "";
String where = " AND SAL_DEPT=" + loop_data[a][0] + "";
if (!(settlReg.getOnHold().equals("A"))) {
where += " and sal_onhold='" + settlReg.getOnHold()
+ "' ";
}
// where+=" AND SAL_DEPT="+loop_data_inner[b][0];
if (!settlReg.getTypeCode().equals("")) {
where += " AND SAL_EMP_TYPE=" + settlReg.getTypeCode();
}
if (!settlReg.getDesgCode().equals("")) {
where += " AND SAL_EMP_RANK=" + settlReg.getDesgCode();
}
where += " ORDER BY UPPER(HRMS_EMP_OFFC.EMP_FNAME||' '||HRMS_EMP_OFFC.EMP_MNAME||' '||HRMS_EMP_OFFC.EMP_LNAME) ";
selectSalaryLoop = selectSalaryLoop + where;
} catch (Exception e) {
logger.error("Error in Salary query : " + e);
e.printStackTrace();
}
try {
String arrearEmp = " SELECT HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID ,HRMS_ARREARS_LEDGER.ARREARS_CODE FROM HRMS_SALARY_"
+ settlReg.getYear()
+ " INNER JOIN HRMS_EMP_OFFC ON HRMS_SALARY_"
+ settlReg.getYear()
+ ".EMP_ID = HRMS_EMP_OFFC.EMP_ID "
+ " LEFT JOIN HRMS_EMP_TYPE ON(HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_EMP_TYPE=HRMS_EMP_TYPE.TYPE_ID)"
+ " INNER JOIN HRMS_SALARY_LEDGER ON (HRMS_SALARY_LEDGER.LEDGER_CODE = HRMS_SALARY_"
+ settlReg.getYear()
+ ".SAL_LEDGER_CODE AND LEDGER_MONTH="
+ settlReg.getMonth()
+ " AND LEDGER_YEAR="
+ settlReg.getYear()
+ ")"
+ " INNER JOIN HRMS_ARREARS_"
+ settlReg.getYear()
+ " ON(HRMS_ARREARS_"
+ settlReg.getYear()
+ ".EMP_ID=HRMS_EMP_OFFC.EMP_ID)"
+ " INNER JOIN HRMS_ARREARS_LEDGER ON(HRMS_ARREARS_LEDGER.ARREARS_CODE=HRMS_ARREARS_"
+ settlReg.getYear()
+ ".ARREARS_CODE)"
+ " WHERE ARREARS_PAID_MONTH="
+ settlReg.getMonth()
+ " AND ARREARS_REF_YEAR="
+ settlReg.getYear()
+ " and arrears_type IN('M','P') AND ARREARS_PAY_IN_SAL = 'Y'"
+ " AND SAL_DIVISION=" + settlReg.getDivCode()
//+ " AND SAL_EMP_CENTER=" + loop_data[a][0];
+ " AND SAL_DEPT=" + loop_data[a][0];
Object[][] arrEmpChk = getSqlModel().getSingleResult(
arrearEmp);
if (arrEmpChk == null) {
arrEmpLength = 0;
} else if (arrEmpChk.length == 0) {
arrEmpLength = 0;
} else {
arrEmpLength = arrEmpChk.length;
}
} catch (Exception e) {
logger.error("Error in arrears query : " + e);
e.printStackTrace();
}
Object[][] reportDataPay = null;
try {
reportDataPay = getReportDataNoBranchDept(selectSalaryLoop,
settlReg, "0", String.valueOf(loop_data[a][0]),
arrEmpLength, check, settlReg.getCheckEmployerPF(), settlReg.getCheckEmployerESIC());
} catch (Exception e) {
logger.error("Error in getting report data : " + e);
e.printStackTrace();
}
if (reportDataPay.length > 1) {
int headerLength = 0;
int[] cellWidth = null;
int[] alignment = null;
if (settlReg.getChkConsSummary().equals("N")) {
finalHeader = new String[reportDataPay[0].length];
headerLength = reportDataPay[0].length;
cellWidth = new int[reportDataPay[0].length];
alignment = new int[reportDataPay[0].length];
} else {
finalHeader = new String[reportDataPay[0].length - 1];
headerLength = reportDataPay[0].length - 1;
cellWidth = new int[reportDataPay[0].length - 1];
alignment = new int[reportDataPay[0].length - 1];
}
//String finalHeader[] = new String[reportDataPay[0].length];
/*
* Following loop is used to set the cell width
*/
for (int i = 0; i < headerLength; i++) {
finalHeader[i] = String.valueOf(reportDataPay[0][i]);
alignment[i] = 0;
if (i > 1) {
cellWidth[i] = 7;
alignment[i] = 0;
} else {
cellWidth[0] = 8;
cellWidth[1] = 15;
}
}
Object finalData[][] = new Object[reportDataPay.length - 1][reportDataPay[0].length];
/*
* Following loop is used to set the credit and debit head
* values
*/
for (int i = 0; i < finalData.length; i++) {
for (int j = 0; j < finalData[0].length; j++) {
finalData[i][j] = reportDataPay[i + 1][j];
//logger.info("finalData["+i+"]["+j+"]=========="+finalData[i][j]);
}// End of inner loop
}// End of outer loop
Object totalByColumn[][] = null;
String totalHeader[] = new String[finalData.length];
totalHeader[0] = "";
// totalHeader[1] = "";
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn = new Object[1][finalData[0].length];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = "No. of Employees:"
+ finalData.length;
} else {
totalByColumn = new Object[1][finalData[0].length - 1];
totalByColumn[0][0] = "TOTAL :-";
totalByColumn[0][1] = finalData.length;
}
/**
* Following loop is used to set the sum of the individual
* credit and debit head values.
*/
if (settlReg.getCheckEmployerPF().equals("Y") && settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 1; //check+3-2
} else if (settlReg.getCheckEmployerPF().equals("Y")) {
colTotal = check + 2;//check+3-1
} else if (settlReg.getCheckEmployerESIC().equals("Y")) {
colTotal = check + 2;//check+3-1
}else
colTotal = check + 3;
for (int i = colTotal; i < finalData[0].length; i++) {
double total = 0;
for (int j = 0; j < finalData.length; j++) {
if (String.valueOf(finalData[j][i]).equals("null")
|| String.valueOf(finalData[j][i]).equals(
"null.00")
|| String.valueOf(finalData[j][i]).equals(
"")
|| String.valueOf(finalData[j][i]) == null) {
finalData[j][i] = "0";
}
if (String.valueOf(finalData[j][1]).contains(
"Recovery"))
total -= Double.parseDouble(String
.valueOf(finalData[j][i]));
else
total += Double.parseDouble(String
.valueOf(finalData[j][i]));
}// End of inner loop
// totalHeader[i] = "";
totList.add(Utility
.twoDecimals(formatter.format(total)));
if (settlReg.getChkConsSummary().equals("N")) {
totalByColumn[0][i] = Utility.twoDecimals(formatter
.format(total));
} else {
totalByColumn[0][i - 1] = Utility
.twoDecimals(formatter.format(total));
}
}// End of outer loop
rg.addText("\n", 0, 0, 0);
rg.addText("Department : " + loop_data[a][1], 0, 0, 0);
if (settlReg.getChkConsSummary().equals("N")) {
rg.tableBody(finalHeader, finalData, cellWidth,
alignment);
rg.tableBody(totalByColumn, cellWidth, alignment);
} else {
//Object[][] summaryObj = new Object[1][1];
//summaryObj[0][0] = "\n";
rg.tableBody(finalHeader, totalByColumn, cellWidth,
alignment);
//rg.tableBody(totalByColumn, cellWidth, alignment);
}
recCount++;
}// End of reportDataPay if condition
} // End of loop_data loop
if (recCount != 0) {
Object[][] listValues = new Object[recCount][(totList.size() / recCount)];
int arrCount = 0;
for (int i = 0; i < recCount; i++) {
for (int j = 0; j < (totList.size() / recCount); j++) {
listValues[i][j] = formatter.format(Double
.parseDouble(String.valueOf(totList
.get(arrCount))));
arrCount++;
}
}
Object[][] grand_total = null;
if (settlReg.getChkConsSummary().equals("N")) {
grand_total = new Object[1][listValues[0].length
+ colTotal ];
}else{
grand_total = new Object[1][listValues[0].length
+ colTotal - 1];
}
grand_total[0][0] = "GRAND TOTAL :-";
grand_total[0][1] = " ";
for (int i = 0; i < listValues[0].length; i++) {
double total = 0.00;
for (int j = 0; j < listValues.length; j++) {
if (String.valueOf(listValues[j][i]).equals("null")) {
listValues[j][i] = "0.00";
}
total += Double.parseDouble(String
.valueOf(listValues[j][i]));
}
if (settlReg.getChkConsSummary().equals("N")) {
grand_total[0][i + colTotal] = Utility
.twoDecimals(formatter.format(total));
} else {
grand_total[0][(i - 1) + colTotal] = Utility
.twoDecimals(formatter.format(total));
}
}
int[] cellWidth = getCellWidth(grand_total[0].length);
int[] alignment = getAlignment(grand_total[0].length);
rg.addText("\n", 0, 0, 0);
// rg.addText("GRAND TOTAL",0,0,0);
finalHeader[1]="";
rg.tableBody(finalHeader,grand_total, cellWidth, alignment);
} else {
rg.addText("Records are not available.", 0, 1, 0);
}
} //End of loop_data if condition
}
}
| 205,924
| 0.583803
| 0.572839
| 6,369
| 30.337887
| 25.175249
| 328
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.991521
| false
| false
|
2
|
7bcaf20b083ef0ad7381256efae68f7a4fdf254d
| 7,078,106,144,536
|
b859d31c15d53988c838b5b248116348551e17ce
|
/SegmentTree/src/construct.java
|
56aaceb7c8b3a2d9b5bd525b9d7a94aaa3b184d6
|
[] |
no_license
|
PratyushS7/CompetitiveProgramming
|
https://github.com/PratyushS7/CompetitiveProgramming
|
ce4acf6d4566497a4e979c90a0f2955c1f466729
|
6e7fba782b8ce1d88825046e3662af0f10f90a0e
|
refs/heads/master
| 2023-05-31T14:43:02.495000
| 2021-06-27T13:40:03
| 2021-06-27T13:40:03
| 380,747,683
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
public class construct
{
static int t[]=new int[4*40];
public static void main(String[] args)
{
int a[]= {3,5,1,-5,1,9,-5};
int i;
System.out.println(size(10));
build(a,1,0,6);
System.out.println(sum(1,0 ,a.length-1 ,2,3));
}
static int size(int n)
{
int size = 1;
for (; size < n; size <<= 1);
return size ;
}
static void build(int a[], int v, int lo, int hi)
{
if (lo == hi) t[v] = a[lo];
else
{
int mid = (lo + hi) / 2;
build(a, v*2, lo, mid); build(a, v*2+1, mid+1, hi);
t[v] = t[v*2] + t[v*2+1];
}
}
static int sum(int v, int lo, int hi, int l, int r)
{
if (l > r) return 0;
if (l == lo && r == hi) return t[v];
int mid = (lo + hi) / 2;
return sum(v*2, lo, mid, l, Math.min(r, mid))
+ sum(v*2+1, mid+1, hi, Math.max(l, mid+1), r);
}
static void update(int v, int lo, int hi, int pos, int new_val)
{
if (lo == hi)
{
t[v] = new_val; return;
}
int mid = (lo + hi) / 2;
if (pos <= mid) update(v*2, lo, mid, pos, new_val);
else update(v*2+1, mid+1, hi, pos, new_val);
t[v] = t[v*2] + t[v*2+1];
}
}
|
UTF-8
|
Java
| 1,088
|
java
|
construct.java
|
Java
|
[] | null |
[] |
public class construct
{
static int t[]=new int[4*40];
public static void main(String[] args)
{
int a[]= {3,5,1,-5,1,9,-5};
int i;
System.out.println(size(10));
build(a,1,0,6);
System.out.println(sum(1,0 ,a.length-1 ,2,3));
}
static int size(int n)
{
int size = 1;
for (; size < n; size <<= 1);
return size ;
}
static void build(int a[], int v, int lo, int hi)
{
if (lo == hi) t[v] = a[lo];
else
{
int mid = (lo + hi) / 2;
build(a, v*2, lo, mid); build(a, v*2+1, mid+1, hi);
t[v] = t[v*2] + t[v*2+1];
}
}
static int sum(int v, int lo, int hi, int l, int r)
{
if (l > r) return 0;
if (l == lo && r == hi) return t[v];
int mid = (lo + hi) / 2;
return sum(v*2, lo, mid, l, Math.min(r, mid))
+ sum(v*2+1, mid+1, hi, Math.max(l, mid+1), r);
}
static void update(int v, int lo, int hi, int pos, int new_val)
{
if (lo == hi)
{
t[v] = new_val; return;
}
int mid = (lo + hi) / 2;
if (pos <= mid) update(v*2, lo, mid, pos, new_val);
else update(v*2+1, mid+1, hi, pos, new_val);
t[v] = t[v*2] + t[v*2+1];
}
}
| 1,088
| 0.512868
| 0.471507
| 49
| 21.204082
| 18.82896
| 64
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.142857
| false
| false
|
2
|
caeee572d3fc46dba6c5cadd447170be51cac735
| 11,123,965,344,110
|
816f69d2e46c0e80be3f7ecb96a57ee363f8ead6
|
/NCalc +/Calculator_N_Lite3.5.8_[www.Apkleecher.com]_source_from_JADX/com/example/duy/calculator/RealToFractionActivity.java
|
c9ec15f35bef835928427f15e010332b73e9cf7d
|
[] |
no_license
|
vqthanh1412489/ProjectAndroidTemplete
|
https://github.com/vqthanh1412489/ProjectAndroidTemplete
|
fcee774758ae527b5068a03333093c24be46efdb
|
242795002459451fac3b4c83fa0cf4352645761d
|
refs/heads/master
| 2021-01-21T06:18:50.650000
| 2017-02-26T12:31:15
| 2017-02-26T12:31:15
| 83,206,789
| 1
| 2
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.duy.calculator;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MenuItem;
import android.widget.EditText;
import com.google.android.gms.R;
import io.github.kexanie.library.BuildConfig;
import io.github.kexanie.library.MathView;
import org.apache.commons.math4.fraction.Fraction;
import org.apache.commons.math4.geometry.VectorFormat;
@Deprecated
public class RealToFractionActivity extends AbstractCalculator implements TextWatcher, Calculator {
private EditText editInput;
private MathView txtResult;
public void setTextDisplay(String text) {
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView((int) R.layout.activity_real_to_fraction);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
((NavigationView) findViewById(R.id.nav_view)).setNavigationItemSelectedListener(this);
this.editInput = (EditText) findViewById(R.id.editInput);
this.txtResult = (MathView) findViewById(R.id.txtResult);
this.editInput.addTextChangedListener(this);
}
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == 16908332) {
finish();
}
return super.onOptionsItemSelected(item);
}
public void insertText(String s) {
}
public void insertOperator(String s) {
}
public String getTextClean() {
return null;
}
public void onHelpFunction(String s) {
}
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
onResult(null);
}
public void afterTextChanged(Editable editable) {
}
public void onResult(String result) {
if (this.editInput.getText().toString().isEmpty()) {
this.txtResult.setText(BuildConfig.FLAVOR);
return;
}
try {
Fraction fraction = new Fraction(Double.parseDouble(this.editInput.getText().toString()));
this.txtResult.setText("$$\\frac{" + fraction.getNumerator() + VectorFormat.DEFAULT_SUFFIX + VectorFormat.DEFAULT_PREFIX + fraction.getDenominator() + VectorFormat.DEFAULT_SUFFIX + "$$");
} catch (Exception e) {
super.showDialog(getString(R.string.error), e.getMessage());
}
}
public void onError(String errorResourceId) {
}
public void onDelete() {
}
public void onClear() {
}
public void onEqual() {
}
public void onInputVoice() {
}
}
|
UTF-8
|
Java
| 2,826
|
java
|
RealToFractionActivity.java
|
Java
|
[
{
"context": "mport com.google.android.gms.R;\nimport io.github.kexanie.library.BuildConfig;\nimport io.github.kexanie.lib",
"end": 340,
"score": 0.7685071229934692,
"start": 334,
"tag": "USERNAME",
"value": "exanie"
},
{
"context": "ub.kexanie.library.BuildConfig;\nimport io.github.kexanie.library.MathView;\nimport org.apache.commons.math4",
"end": 386,
"score": 0.880257248878479,
"start": 380,
"tag": "USERNAME",
"value": "exanie"
}
] | null |
[] |
package com.example.duy.calculator;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MenuItem;
import android.widget.EditText;
import com.google.android.gms.R;
import io.github.kexanie.library.BuildConfig;
import io.github.kexanie.library.MathView;
import org.apache.commons.math4.fraction.Fraction;
import org.apache.commons.math4.geometry.VectorFormat;
@Deprecated
public class RealToFractionActivity extends AbstractCalculator implements TextWatcher, Calculator {
private EditText editInput;
private MathView txtResult;
public void setTextDisplay(String text) {
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView((int) R.layout.activity_real_to_fraction);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
((NavigationView) findViewById(R.id.nav_view)).setNavigationItemSelectedListener(this);
this.editInput = (EditText) findViewById(R.id.editInput);
this.txtResult = (MathView) findViewById(R.id.txtResult);
this.editInput.addTextChangedListener(this);
}
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == 16908332) {
finish();
}
return super.onOptionsItemSelected(item);
}
public void insertText(String s) {
}
public void insertOperator(String s) {
}
public String getTextClean() {
return null;
}
public void onHelpFunction(String s) {
}
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
onResult(null);
}
public void afterTextChanged(Editable editable) {
}
public void onResult(String result) {
if (this.editInput.getText().toString().isEmpty()) {
this.txtResult.setText(BuildConfig.FLAVOR);
return;
}
try {
Fraction fraction = new Fraction(Double.parseDouble(this.editInput.getText().toString()));
this.txtResult.setText("$$\\frac{" + fraction.getNumerator() + VectorFormat.DEFAULT_SUFFIX + VectorFormat.DEFAULT_PREFIX + fraction.getDenominator() + VectorFormat.DEFAULT_SUFFIX + "$$");
} catch (Exception e) {
super.showDialog(getString(R.string.error), e.getMessage());
}
}
public void onError(String errorResourceId) {
}
public void onDelete() {
}
public void onClear() {
}
public void onEqual() {
}
public void onInputVoice() {
}
}
| 2,826
| 0.687544
| 0.682236
| 92
| 29.717392
| 31.833578
| 199
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.434783
| false
| false
|
2
|
dd33e72af25ed44452c37b6c2257c0318390a71b
| 10,213,432,281,601
|
0d326b667e93c1d8f186c484dd12faa887f495f0
|
/src/br/iff/campos/terminalmobileiff/Diario.java
|
89f63290448f7fed40d44e829f0d3a771401e1ac
|
[] |
no_license
|
lglmoura/AndroidAcademico
|
https://github.com/lglmoura/AndroidAcademico
|
7ee034dfeed62dbe04d587a8526ebb65063d36dd
|
e6557ae1c7247864ee7f7a7f9d75b82c0dddbac8
|
refs/heads/master
| 2021-01-18T06:17:25.474000
| 2013-10-01T21:56:00
| 2013-10-01T21:56:00
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.iff.campos.terminalmobileiff;
public class Diario {
private String id;
private String nome;
private String nota;
private String frequencia;
private String disciplina;
private String aluno;
public Diario() {
super();
}
public Diario(String id, String nome, String nota, String frequencia,
String disciplina) {
super();
this.id = id;
this.nome = nome;
this.nota = nota;
this.frequencia = frequencia;
this.disciplina = disciplina;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getNota() {
return nota;
}
public void setNota(String nota) {
this.nota = nota;
}
public String getFrequencia() {
return frequencia;
}
public void setFrequencia(String frequencia) {
this.frequencia = frequencia;
}
public String getDisciplina() {
return disciplina;
}
public void setDisciplina(String disciplina) {
this.disciplina = disciplina;
}
public String getAluno() {
return aluno;
}
public void setAluno(String aluno) {
this.aluno = aluno;
}
}
|
UTF-8
|
Java
| 1,181
|
java
|
Diario.java
|
Java
|
[] | null |
[] |
package br.iff.campos.terminalmobileiff;
public class Diario {
private String id;
private String nome;
private String nota;
private String frequencia;
private String disciplina;
private String aluno;
public Diario() {
super();
}
public Diario(String id, String nome, String nota, String frequencia,
String disciplina) {
super();
this.id = id;
this.nome = nome;
this.nota = nota;
this.frequencia = frequencia;
this.disciplina = disciplina;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getNota() {
return nota;
}
public void setNota(String nota) {
this.nota = nota;
}
public String getFrequencia() {
return frequencia;
}
public void setFrequencia(String frequencia) {
this.frequencia = frequencia;
}
public String getDisciplina() {
return disciplina;
}
public void setDisciplina(String disciplina) {
this.disciplina = disciplina;
}
public String getAluno() {
return aluno;
}
public void setAluno(String aluno) {
this.aluno = aluno;
}
}
| 1,181
| 0.6884
| 0.6884
| 75
| 14.746667
| 14.864807
| 70
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.44
| false
| false
|
2
|
acf493b26db9f2cba382e2e20ef1e30d26107f4f
| 37,958,920,994,053
|
7d9f61f556f2b3cdb886fdf36f23e0140cd4476c
|
/common-misc/src/main/java/jef/tools/unrar/DefaultPassCallback.java
|
e2b55660a5fadc597f753fdf2ec9653cfaae9e47
|
[
"Apache-2.0"
] |
permissive
|
xuse/ef-others
|
https://github.com/xuse/ef-others
|
5682c692b1bd282d84abba73e1b5f58146aa250d
|
99f6857466337b4714f1921b70a3afa455b4ee1c
|
refs/heads/master
| 2022-07-03T10:12:31.471000
| 2019-07-13T13:20:18
| 2019-07-13T13:20:18
| 29,581,607
| 0
| 0
|
Apache-2.0
| false
| 2022-07-06T19:54:29
| 2015-01-21T09:17:48
| 2019-07-13T13:21:13
| 2022-07-06T19:54:27
| 995
| 0
| 0
| 16
|
Java
| false
| false
|
/*
* JEF - Copyright 2009-2010 Jiyi (mr.jiyi@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jef.tools.unrar;
import jef.ui.swing.Swing;
public class DefaultPassCallback implements NeedPasswordCallBack {
private String password;
public DefaultPassCallback(String pass){
this.password=pass;
}
public NeedPwdCallbackResult invoke() {
if(password==null){
password=(String) Swing.msgbox("Please input the password of file:", Swing.INPUT);
}
return (password==null)?NeedPwdCallbackResult.FALLBACK:new NeedPwdCallbackResult(password);
}
}
|
UTF-8
|
Java
| 1,089
|
java
|
DefaultPassCallback.java
|
Java
|
[
{
"context": "/*\n * JEF - Copyright 2009-2010 Jiyi (mr.jiyi@gmail.com)\n *\n * Licensed under the Apac",
"end": 36,
"score": 0.8681198954582214,
"start": 32,
"tag": "USERNAME",
"value": "Jiyi"
},
{
"context": "/*\n * JEF - Copyright 2009-2010 Jiyi (mr.jiyi@gmail.com)\n *\n * Licensed under the Apache License, Version",
"end": 55,
"score": 0.9999280571937561,
"start": 38,
"tag": "EMAIL",
"value": "mr.jiyi@gmail.com"
},
{
"context": "DefaultPassCallback(String pass){\n\t\tthis.password=pass;\n\t}\n\tpublic NeedPwdCallbackResult invoke() {\n\t\tif",
"end": 829,
"score": 0.9936133027076721,
"start": 825,
"tag": "PASSWORD",
"value": "pass"
}
] | null |
[] |
/*
* JEF - Copyright 2009-2010 Jiyi (<EMAIL>)
*
* 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 jef.tools.unrar;
import jef.ui.swing.Swing;
public class DefaultPassCallback implements NeedPasswordCallBack {
private String password;
public DefaultPassCallback(String pass){
this.password=<PASSWORD>;
}
public NeedPwdCallbackResult invoke() {
if(password==null){
password=(String) Swing.msgbox("Please input the password of file:", Swing.INPUT);
}
return (password==null)?NeedPwdCallbackResult.FALLBACK:new NeedPwdCallbackResult(password);
}
}
| 1,085
| 0.749311
| 0.738292
| 31
| 34.129032
| 29.950218
| 95
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| false
| false
|
2
|
fa438ac64b619df70802ba14bd162930569b43cd
| 39,633,958,223,072
|
8e0e9026f89ce7535710dc69f7e4c7cfa3026722
|
/app/src/main/java/com/pdam/recyclerview/FirstFragment.java
|
6ae469ea462e00874db369306615dc0043460032
|
[] |
no_license
|
IsaiasRVH/IRVH-RecyclerView
|
https://github.com/IsaiasRVH/IRVH-RecyclerView
|
1d6b9e569d50f751600276b0cfa3872d79f44de5
|
7f6690cd5ed56ca1c9c12cce05630e7564e31147
|
refs/heads/master
| 2023-04-26T06:20:40.849000
| 2021-05-04T02:11:40
| 2021-05-04T02:11:40
| 364,115,207
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pdam.recyclerview;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.LinkedList;
public class FirstFragment extends Fragment {
private final LinkedList<String> mWordList = new LinkedList<>();
private RecyclerView mRecyclerView;
private WordListAdapter mAdapter;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_first, container, false);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// Put initial data into the word list.
for (int i = 0; i < 20; i++) {
mWordList.addLast("Word " + i);
}
// Get a handle to the RecyclerView.
mRecyclerView = getActivity().findViewById(R.id.recyclerview);
// Create an adapter and supply the data to be displayed.
mAdapter = new WordListAdapter(getActivity(), mWordList);
// Connect the adapter with the RecyclerView.
mRecyclerView.setAdapter(mAdapter);
// Give the RecyclerView a default layout manager.
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int wordListSize = mWordList.size();
// Add a new word to the wordList.
mWordList.addLast("+ Word " + wordListSize);
// Notify the adapter, that the data has changed.
mRecyclerView.getAdapter().notifyItemInserted(wordListSize);
// Scroll to the bottom.
mRecyclerView.smoothScrollToPosition(wordListSize);
}
});
}
}
|
UTF-8
|
Java
| 2,461
|
java
|
FirstFragment.java
|
Java
|
[] | null |
[] |
package com.pdam.recyclerview;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.LinkedList;
public class FirstFragment extends Fragment {
private final LinkedList<String> mWordList = new LinkedList<>();
private RecyclerView mRecyclerView;
private WordListAdapter mAdapter;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_first, container, false);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// Put initial data into the word list.
for (int i = 0; i < 20; i++) {
mWordList.addLast("Word " + i);
}
// Get a handle to the RecyclerView.
mRecyclerView = getActivity().findViewById(R.id.recyclerview);
// Create an adapter and supply the data to be displayed.
mAdapter = new WordListAdapter(getActivity(), mWordList);
// Connect the adapter with the RecyclerView.
mRecyclerView.setAdapter(mAdapter);
// Give the RecyclerView a default layout manager.
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int wordListSize = mWordList.size();
// Add a new word to the wordList.
mWordList.addLast("+ Word " + wordListSize);
// Notify the adapter, that the data has changed.
mRecyclerView.getAdapter().notifyItemInserted(wordListSize);
// Scroll to the bottom.
mRecyclerView.smoothScrollToPosition(wordListSize);
}
});
}
}
| 2,461
| 0.686306
| 0.685087
| 65
| 36.876923
| 25.903078
| 95
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.6
| false
| false
|
2
|
1b025d06cf7cf68d2adfadeffdadf17450623871
| 16,896,401,354,103
|
b54f44d99186ea41a6d29818c82c4231acbdb6d1
|
/src/main/java/poker/kata_poker_hands/Kata.java
|
66b83666b51e235b3267fbea4ba98b2ae46248c9
|
[] |
no_license
|
andrbutler/kata_poker_hands
|
https://github.com/andrbutler/kata_poker_hands
|
d8ea345033984a68b4a5043897dae1ef9b88d504
|
5b56fccb2bd71e6e4e650c5b3cb211982881f0a5
|
refs/heads/master
| 2023-03-30T10:21:38.047000
| 2021-03-25T12:07:18
| 2021-03-25T12:07:18
| 351,419,270
| 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 poker.kata_poker_hands;
import Exceptions.InvalidCardLengthException;
import Exceptions.InvalidInputException;
import Exceptions.InvalidRankException;
import Exceptions.InvalidSuitException;
import java.io.IOException;
import java.util.Arrays;
/**
*
* @author andrb
*/
public class Kata {
/* string arrys used if generating deck and hands without input
private static final String[] suits = {"C", "D", "H", "S"};
private static final String[] ranks = {"2", "3", "4", "5", "6", "7", "8",
"9", "T", "J", "Q", "K", "A"};
*/
public static void main(String[] args) throws IOException {
/* logic for generating player hands and deck with no external input
Deck deck = new Deck();
int handSize = 5;
Player player1 = new Player("player1");
Player player2 = new Player("player2");
//build standard poker deck
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 13; j++) {
deck.addCard(new Card(ranks[j], suits[i], j + 1));
}
}
deck.shuffle();
//draw player starting hands and sort cards by rank
for(int i = 0; i < handSize; i++) {
player1.addCard(deck.draw());
player2.addCard(deck.draw());
}
*/
try {
if (args.length == 12) {
Player player1 = new Player(args[0].substring(0, args[0].length() - 1));
Player player2 = new Player(args[6].substring(0, args[6].length() - 1));
Parser parser = new Parser();
parser.parsePlayerHand(String.join(" ", Arrays.copyOfRange(args, 1, 6)), player1);
parser.parsePlayerHand(String.join(" ", Arrays.copyOfRange(args, 7, 12)), player2);
player1.calculateScore();
player2.calculateScore();
//print player hands;
System.out.println(player1.getName() + "'s hand: ");
player1.printHand();
System.out.println(player2.getName() + "'s hand: ");
player2.printHand();
new ResultDeterminer(player1, player2).determineResult();
} else {
throw new InvalidInputException();
}
} catch (InvalidInputException | InvalidRankException | InvalidCardLengthException | InvalidSuitException e) {
System.out.println(e.getMessage());
}
}
}
|
UTF-8
|
Java
| 2,699
|
java
|
Kata.java
|
Java
|
[
{
"context": "ption;\nimport java.util.Arrays;\n\n/**\n *\n * @author andrb\n */\npublic class Kata {\n \n /* string arrys ",
"end": 462,
"score": 0.9994341135025024,
"start": 457,
"tag": "USERNAME",
"value": "andrb"
}
] | 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 poker.kata_poker_hands;
import Exceptions.InvalidCardLengthException;
import Exceptions.InvalidInputException;
import Exceptions.InvalidRankException;
import Exceptions.InvalidSuitException;
import java.io.IOException;
import java.util.Arrays;
/**
*
* @author andrb
*/
public class Kata {
/* string arrys used if generating deck and hands without input
private static final String[] suits = {"C", "D", "H", "S"};
private static final String[] ranks = {"2", "3", "4", "5", "6", "7", "8",
"9", "T", "J", "Q", "K", "A"};
*/
public static void main(String[] args) throws IOException {
/* logic for generating player hands and deck with no external input
Deck deck = new Deck();
int handSize = 5;
Player player1 = new Player("player1");
Player player2 = new Player("player2");
//build standard poker deck
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 13; j++) {
deck.addCard(new Card(ranks[j], suits[i], j + 1));
}
}
deck.shuffle();
//draw player starting hands and sort cards by rank
for(int i = 0; i < handSize; i++) {
player1.addCard(deck.draw());
player2.addCard(deck.draw());
}
*/
try {
if (args.length == 12) {
Player player1 = new Player(args[0].substring(0, args[0].length() - 1));
Player player2 = new Player(args[6].substring(0, args[6].length() - 1));
Parser parser = new Parser();
parser.parsePlayerHand(String.join(" ", Arrays.copyOfRange(args, 1, 6)), player1);
parser.parsePlayerHand(String.join(" ", Arrays.copyOfRange(args, 7, 12)), player2);
player1.calculateScore();
player2.calculateScore();
//print player hands;
System.out.println(player1.getName() + "'s hand: ");
player1.printHand();
System.out.println(player2.getName() + "'s hand: ");
player2.printHand();
new ResultDeterminer(player1, player2).determineResult();
} else {
throw new InvalidInputException();
}
} catch (InvalidInputException | InvalidRankException | InvalidCardLengthException | InvalidSuitException e) {
System.out.println(e.getMessage());
}
}
}
| 2,699
| 0.558355
| 0.5402
| 75
| 34.986668
| 28.054943
| 118
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.96
| false
| false
|
4
|
6093883e5a1fee85d5879c6175fd47b1e27f78c4
| 5,205,500,382,939
|
4733545b3082c52e336c39959331b7a632e8396f
|
/Spring-Core/spring-core-1/src/main/java/com/javabydeveloper/spring/autowire/OptionalDITestService.java
|
5d41247c7caf37025eddd87bfb4ee11eebd1fbe1
|
[
"MIT"
] |
permissive
|
javabydeveloper/spring-boot
|
https://github.com/javabydeveloper/spring-boot
|
0ae02ad08c38da1390ed72dceafaca223864a7d1
|
88595ec17d6910f1f23a9da87f87d3912d823435
|
refs/heads/master
| 2023-08-24T00:29:49.633000
| 2023-08-23T10:05:54
| 2023-08-23T10:05:54
| 227,102,140
| 43
| 129
|
MIT
| false
| 2023-08-03T10:01:59
| 2019-12-10T11:24:49
| 2023-08-01T04:31:09
| 2023-08-03T10:01:58
| 317
| 41
| 119
| 5
|
Java
| false
| false
|
package com.javabydeveloper.spring.autowire;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.javabydeveloper.spring.autowire.service.ExampleService;
import com.javabydeveloper.spring.autowire.service.ExerciseService;
import com.javabydeveloper.spring.autowire.service.ParadigmService;
import com.javabydeveloper.spring.autowire.service.SampleService;
@Component
public class OptionalDITestService {
@Autowired(required = false)
private ExerciseService exerciseService;
@Autowired
private Optional<ParadigmService> paradigmService;
private Optional<ExampleService> exampleService;
private SampleService sampleService;
// to make only specific dependencies optional in constructor injection
@Autowired
public OptionalDITestService(Optional<ExampleService> exampleService,
SampleService sampleService) {
this.exampleService = exampleService;
this.sampleService = sampleService;
}
public void doStuff() {
System.out.println("\n ------ Autowiring Optional Dependency Injection Results ------");
if(exerciseService != null)
exerciseService.exercise();
if(paradigmService.isPresent())
paradigmService.get().paradigm();
if(exampleService.isPresent())
exampleService.get().example();
sampleService.sample();
}
}
|
UTF-8
|
Java
| 1,367
|
java
|
OptionalDITestService.java
|
Java
|
[] | null |
[] |
package com.javabydeveloper.spring.autowire;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.javabydeveloper.spring.autowire.service.ExampleService;
import com.javabydeveloper.spring.autowire.service.ExerciseService;
import com.javabydeveloper.spring.autowire.service.ParadigmService;
import com.javabydeveloper.spring.autowire.service.SampleService;
@Component
public class OptionalDITestService {
@Autowired(required = false)
private ExerciseService exerciseService;
@Autowired
private Optional<ParadigmService> paradigmService;
private Optional<ExampleService> exampleService;
private SampleService sampleService;
// to make only specific dependencies optional in constructor injection
@Autowired
public OptionalDITestService(Optional<ExampleService> exampleService,
SampleService sampleService) {
this.exampleService = exampleService;
this.sampleService = sampleService;
}
public void doStuff() {
System.out.println("\n ------ Autowiring Optional Dependency Injection Results ------");
if(exerciseService != null)
exerciseService.exercise();
if(paradigmService.isPresent())
paradigmService.get().paradigm();
if(exampleService.isPresent())
exampleService.get().example();
sampleService.sample();
}
}
| 1,367
| 0.795903
| 0.795903
| 48
| 27.479166
| 25.12468
| 90
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.416667
| false
| false
|
4
|
fe3626599a14ba23bd555933be6223ec3c8bd0b6
| 33,586,644,280,028
|
4809b34937525dda60e927e474058f229bb0b049
|
/src/org/ninehertzindia/clipped/fragment/MembershipFragment.java
|
e6ce01a32ba3715811815b18b35a32420aa3fbb2
|
[] |
no_license
|
mahendramahi/ClippedAfterService
|
https://github.com/mahendramahi/ClippedAfterService
|
429b73a87ad0655932c80944bdf30d0070de70f0
|
167313d94c3e64e8473b2d9f926ca6eb2be4a59b
|
refs/heads/master
| 2021-01-10T07:48:49.087000
| 2018-12-04T12:32:02
| 2018-12-04T12:32:02
| 54,869,464
| 2
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.ninehertzindia.clipped.fragment;
import org.ninehertzindia.clipped.R;
import org.ninehertzindia.clipped.util.CommonMethods;
import org.ninehertzindia.clipped.util.CustomViewPager;
import com.viewpagerindicator.CirclePageIndicator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@SuppressLint({ "NewApi" })
public class MembershipFragment extends Fragment {
private Activity activity;
private CommonMethods commonMethods;
private View view;
private TextView middletxt;
private ImageView imgback;
CirclePageIndicator mIndicator;
private CustomViewPager mViewPager;
public MembershipFragment() {
}
public static MembershipFragment newInstance() {
MembershipFragment fragment = new MembershipFragment();
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.membership_plans, container, false);
setBodyUI();
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mViewPager = (CustomViewPager) view.findViewById(R.id.viewPager);
mViewPager.setAdapter(new MyAdapter(getFragmentManager()));
mViewPager.setPagingEnabled(true);
mIndicator = (CirclePageIndicator) view.findViewById(R.id.indicator);
mIndicator.setViewPager(mViewPager);
}
public static class MyAdapter extends FragmentStatePagerAdapter {
public MyAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
@Override
public int getCount() {
return 1;
}
@Override
public android.support.v4.app.Fragment getItem(int position) {
Bundle args;
switch (position) {
case 0:
args = new Bundle();
args.putInt(MembershipBasicFragment.POSITION_KEY, position);
return MembershipBasicFragment.newInstance(args);
/*case 1:
args = new Bundle();
args.putInt(MembershipBasicFragment.POSITION_KEY, position);
return MembershipOnlineFragment.newInstance(args);
case 2:
args = new Bundle();
args.putInt(MembershipBasicFragment.POSITION_KEY, position);
return MembershipUnlimitddFragment.newInstance(args);*/
default:
break;
}
return null;
}
}
private void setBodyUI() {
activity = getActivity();
imgback = (ImageView) view.findViewById(R.id.imgback);
imgback.setVisibility(View.VISIBLE);
imgback.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
activity.onBackPressed();
}
});
middletxt = (TextView) view.findViewById(R.id.middletxt);
middletxt.setText("Membership plans");
commonMethods = new CommonMethods(activity, this);
}
@Override
public void onResume() {
super.onResume();
}
}
|
UTF-8
|
Java
| 3,189
|
java
|
MembershipFragment.java
|
Java
|
[] | null |
[] |
package org.ninehertzindia.clipped.fragment;
import org.ninehertzindia.clipped.R;
import org.ninehertzindia.clipped.util.CommonMethods;
import org.ninehertzindia.clipped.util.CustomViewPager;
import com.viewpagerindicator.CirclePageIndicator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@SuppressLint({ "NewApi" })
public class MembershipFragment extends Fragment {
private Activity activity;
private CommonMethods commonMethods;
private View view;
private TextView middletxt;
private ImageView imgback;
CirclePageIndicator mIndicator;
private CustomViewPager mViewPager;
public MembershipFragment() {
}
public static MembershipFragment newInstance() {
MembershipFragment fragment = new MembershipFragment();
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.membership_plans, container, false);
setBodyUI();
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mViewPager = (CustomViewPager) view.findViewById(R.id.viewPager);
mViewPager.setAdapter(new MyAdapter(getFragmentManager()));
mViewPager.setPagingEnabled(true);
mIndicator = (CirclePageIndicator) view.findViewById(R.id.indicator);
mIndicator.setViewPager(mViewPager);
}
public static class MyAdapter extends FragmentStatePagerAdapter {
public MyAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
@Override
public int getCount() {
return 1;
}
@Override
public android.support.v4.app.Fragment getItem(int position) {
Bundle args;
switch (position) {
case 0:
args = new Bundle();
args.putInt(MembershipBasicFragment.POSITION_KEY, position);
return MembershipBasicFragment.newInstance(args);
/*case 1:
args = new Bundle();
args.putInt(MembershipBasicFragment.POSITION_KEY, position);
return MembershipOnlineFragment.newInstance(args);
case 2:
args = new Bundle();
args.putInt(MembershipBasicFragment.POSITION_KEY, position);
return MembershipUnlimitddFragment.newInstance(args);*/
default:
break;
}
return null;
}
}
private void setBodyUI() {
activity = getActivity();
imgback = (ImageView) view.findViewById(R.id.imgback);
imgback.setVisibility(View.VISIBLE);
imgback.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
activity.onBackPressed();
}
});
middletxt = (TextView) view.findViewById(R.id.middletxt);
middletxt.setText("Membership plans");
commonMethods = new CommonMethods(activity, this);
}
@Override
public void onResume() {
super.onResume();
}
}
| 3,189
| 0.767639
| 0.764817
| 120
| 25.575001
| 22.906208
| 100
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.95
| false
| false
|
4
|
229c1edb82e02613bddb51c8a065e131b2221b67
| 721,554,560,663
|
5956ff7fa5ab1dee7b2cdd660132baa2c3c77008
|
/src/main/java/com/alexandreesl/handson/service/ClientService.java
|
4999d631ec64f0adf0d6e1803e9aebf10f88713d
|
[] |
no_license
|
mloayzagahona/mockitohandson
|
https://github.com/mloayzagahona/mockitohandson
|
2af4316c005ab0c89570194d2ed2b9c3ccc8c290
|
7b137dc6b37f8c1607b11b812c81431b379b4a22
|
refs/heads/master
| 2021-05-07T21:18:52.170000
| 2015-03-28T18:39:32
| 2015-03-28T18:39:32
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.alexandreesl.handson.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alexandreesl.handson.dao.ClientDAO;
import com.alexandreesl.handson.model.Client;
@Component
public class ClientService {
@Autowired
private ClientDAO clientDAO;
public ClientDAO getClientDAO() {
return clientDAO;
}
public void setClientDAO(ClientDAO clientDAO) {
this.clientDAO = clientDAO;
}
public Client find(long id) {
return clientDAO.find(id);
}
public void create(Client client) {
clientDAO.create(client);
}
public void update(Client client) {
clientDAO.update(client);
}
public void delete(Client client) {
clientDAO.delete(client);
}
}
|
UTF-8
|
Java
| 757
|
java
|
ClientService.java
|
Java
|
[] | null |
[] |
package com.alexandreesl.handson.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alexandreesl.handson.dao.ClientDAO;
import com.alexandreesl.handson.model.Client;
@Component
public class ClientService {
@Autowired
private ClientDAO clientDAO;
public ClientDAO getClientDAO() {
return clientDAO;
}
public void setClientDAO(ClientDAO clientDAO) {
this.clientDAO = clientDAO;
}
public Client find(long id) {
return clientDAO.find(id);
}
public void create(Client client) {
clientDAO.create(client);
}
public void update(Client client) {
clientDAO.update(client);
}
public void delete(Client client) {
clientDAO.delete(client);
}
}
| 757
| 0.758256
| 0.758256
| 47
| 15.106383
| 18.181396
| 62
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.808511
| false
| false
|
4
|
a43b6186965b0065cc0d140cb8c668e29821f746
| 2,156,073,609,771
|
a034831b60753168fcf1feef197a719b2f325a2b
|
/src/main/java/com/oriental/manage/core/utils/GenerateIdUtil.java
|
081fd7e28118b286b8c0acdc5573c02edfc52cb3
|
[] |
no_license
|
deeplyblue/manageWeb
|
https://github.com/deeplyblue/manageWeb
|
d61b1100575b51b635f15e96bb2f3ddf1be0e68f
|
ec8095732c9e962655401a3958d4636d61a8a40b
|
refs/heads/master
| 2021-01-19T09:24:10.283000
| 2017-04-10T03:19:35
| 2017-04-10T03:19:35
| 87,755,371
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.oriental.manage.core.utils;
/**
* Desc:
* Date: 2016/6/2
* User: ZhouBin
* See :
*/
public class GenerateIdUtil {
public static String generateId(){
return System.currentTimeMillis()+RandomMath.getNum(5);
}
}
|
UTF-8
|
Java
| 244
|
java
|
GenerateIdUtil.java
|
Java
|
[
{
"context": "re.utils;\n\n/**\n * Desc:\n * Date: 2016/6/2\n * User: ZhouBin\n * See :\n */\npublic class GenerateIdUtil {\n\n p",
"end": 88,
"score": 0.9785792827606201,
"start": 81,
"tag": "NAME",
"value": "ZhouBin"
}
] | null |
[] |
package com.oriental.manage.core.utils;
/**
* Desc:
* Date: 2016/6/2
* User: ZhouBin
* See :
*/
public class GenerateIdUtil {
public static String generateId(){
return System.currentTimeMillis()+RandomMath.getNum(5);
}
}
| 244
| 0.655738
| 0.627049
| 14
| 16.428572
| 18.348663
| 63
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| false
| false
|
4
|
a7cabd1055a023c7b73e1992b347f648400c8964
| 8,916,352,118,319
|
c8c0d3f2653ef130ed6f8900440b396a54c59dd9
|
/java/music/pitch/C_b.java
|
bf1c446e0a8f163f39f9e0560b12c188653370db
|
[] |
no_license
|
gazampa/codescraps
|
https://github.com/gazampa/codescraps
|
8f610730fd4af874533db46ccc1c85225b8e94b1
|
deea4261156b6f61e9ef04e3c15604fdaa377de3
|
refs/heads/master
| 2021-01-10T11:17:16.885000
| 2020-12-07T02:18:33
| 2020-12-07T02:18:33
| 54,793,067
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package pitch;
public class C_b{
private final String pitch="Cb";
public C_b(){}
private String getPitch(){
return pitch;
}
}
|
UTF-8
|
Java
| 146
|
java
|
C_b.java
|
Java
|
[] | null |
[] |
package pitch;
public class C_b{
private final String pitch="Cb";
public C_b(){}
private String getPitch(){
return pitch;
}
}
| 146
| 0.616438
| 0.616438
| 12
| 10.333333
| 11.09304
| 33
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.75
| false
| false
|
4
|
4d63f49a1e8e44acde1d949f33dd7598986e2d99
| 24,816,321,084,724
|
dbee40402ca665b9e0a5eb0bc69c63b019b1a630
|
/src/main/java/com/citi/exchange/controllers/StockController.java
|
3afae30dee9501c8fe7726ff472615e9ba3836b1
|
[] |
no_license
|
vlelee/javet-exchange
|
https://github.com/vlelee/javet-exchange
|
45487a0ba82e93abc62745c26f364990b0bd9512
|
8a467140edd489abacb80998e623762fff2549f6
|
refs/heads/master
| 2020-03-24T08:37:09.814000
| 2018-08-06T18:39:13
| 2018-08-06T18:39:13
| 142,601,537
| 0
| 1
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.citi.exchange.controllers;
import com.citi.exchange.entities.Stock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
// TODO: Deccide if we'd like to remove cross-origin. This in place to connect it to the frontend at the moment.
@CrossOrigin
@RestController
@RequestMapping("/api/stocks")
public class StockController {
@Autowired
private com.citi.exchange.services.StockService service;
@RequestMapping(method = RequestMethod.GET)
Iterable<Stock> findAll() {
return service.getStocks();
}
@RequestMapping(method = RequestMethod.GET, value="/{ticker}")
Stock getStockByTicker(@PathVariable("ticker") String ticker) {
return service.getStockByTicker(ticker);
}
@RequestMapping(method = RequestMethod.POST)
void addStock(@RequestBody Stock stock) {
service. addNewStock(stock);
}
@RequestMapping(method = RequestMethod.PUT, value="/{ticker}")
void addStock(@RequestBody Stock stock, @PathVariable("ticker") String ticker) {
service.updateStock(stock, ticker.trim());
}
}
|
UTF-8
|
Java
| 1,075
|
java
|
StockController.java
|
Java
|
[] | null |
[] |
package com.citi.exchange.controllers;
import com.citi.exchange.entities.Stock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
// TODO: Deccide if we'd like to remove cross-origin. This in place to connect it to the frontend at the moment.
@CrossOrigin
@RestController
@RequestMapping("/api/stocks")
public class StockController {
@Autowired
private com.citi.exchange.services.StockService service;
@RequestMapping(method = RequestMethod.GET)
Iterable<Stock> findAll() {
return service.getStocks();
}
@RequestMapping(method = RequestMethod.GET, value="/{ticker}")
Stock getStockByTicker(@PathVariable("ticker") String ticker) {
return service.getStockByTicker(ticker);
}
@RequestMapping(method = RequestMethod.POST)
void addStock(@RequestBody Stock stock) {
service. addNewStock(stock);
}
@RequestMapping(method = RequestMethod.PUT, value="/{ticker}")
void addStock(@RequestBody Stock stock, @PathVariable("ticker") String ticker) {
service.updateStock(stock, ticker.trim());
}
}
| 1,075
| 0.769302
| 0.769302
| 35
| 29.714285
| 27.790617
| 112
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| false
| false
|
4
|
9f71927ef552fec60d8929fe59b12a7cd04a4dac
| 20,590,073,218,738
|
5874501ec1320b70808b14fb320c12dd00df10eb
|
/src/huffman/Huffman.java
|
0aa794c1b05018ef83e62e4e94617e6b3bf46230
|
[] |
no_license
|
SecondMountain/MyTree
|
https://github.com/SecondMountain/MyTree
|
982566aacd2b1c1a50f3939b04830f738e287b09
|
c61463dd9ba910c9bfd20af0580fd9ff86fefdc0
|
refs/heads/master
| 2020-07-05T11:03:03.874000
| 2018-07-05T01:38:52
| 2018-07-05T01:38:52
| 66,800,244
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package huffman;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static Print.Print.println;
/**
* Created by zyf on 2016/8/28.
*/
public class Huffman {
/**
* make a huffman tree by a list
* @param pool this is a list
* @return
*/
public static DataNode makeHuffMan(List<DataNode> pool){
int size = pool.size()-1;
DataNode dataNode;
DataNode dataNode1;
DataNode dataNode2;
for (int i = 0;i<size;i++){
int min=findMin(pool);
dataNode1 = pool.get(min);
pool.remove(min);
min=findMin(pool);
dataNode2 = pool.get(min);
pool.remove(min);
dataNode = new DataNode(dataNode1.wight+dataNode2.wight,dataNode2,dataNode1);
pool.add(dataNode);
}
dataNode = pool.get(0);
return dataNode;
}
/**
* find a min wight in list
* @param pool
* @return
*/
public static int findMin(List<DataNode> pool){
int size = pool.size();
int min = 0;
DataNode dataNode1;
DataNode dataNode2;
for (int i = 0;i<size;i++){
dataNode1=pool.get(i);
dataNode2=pool.get(min);
if (dataNode1.wight<dataNode2.wight)
min=i;
}
return min;
}
/**
* print huffman tree that you just made
* @param dataNode huffman tree you make
* @param code just code
*/
public static void printHuffMan(DataNode dataNode,String code){
//find node util he doesn't have a child,in this time,this node is we want print
if (dataNode.left != null) {
printHuffMan(dataNode.left, code + "0");
printHuffMan(dataNode.right,code + "1");
}
else
println(code+" : "+dataNode.element);
}
public static void main(String[] args){
Random random = new Random(47);
List<DataNode> list=new ArrayList<DataNode>();
//random make ten node and add to a list
for (int i = 0;i<10;i++){
DataNode dataNode = new DataNode(String.valueOf(i),random.nextInt(),null,null);
list.add(dataNode);
}
for (int i = 0;i<10;i++){
DataNode dataNode = list.get(i);
println(dataNode.element+" : "+dataNode.wight);
}
printHuffMan(makeHuffMan(list),"");
}
}
|
UTF-8
|
Java
| 2,444
|
java
|
Huffman.java
|
Java
|
[
{
"context": "ort static Print.Print.println;\n\n/**\n * Created by zyf on 2016/8/28.\n */\npublic class Huffman {\n /**\n",
"end": 152,
"score": 0.9996408224105835,
"start": 149,
"tag": "USERNAME",
"value": "zyf"
}
] | null |
[] |
package huffman;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static Print.Print.println;
/**
* Created by zyf on 2016/8/28.
*/
public class Huffman {
/**
* make a huffman tree by a list
* @param pool this is a list
* @return
*/
public static DataNode makeHuffMan(List<DataNode> pool){
int size = pool.size()-1;
DataNode dataNode;
DataNode dataNode1;
DataNode dataNode2;
for (int i = 0;i<size;i++){
int min=findMin(pool);
dataNode1 = pool.get(min);
pool.remove(min);
min=findMin(pool);
dataNode2 = pool.get(min);
pool.remove(min);
dataNode = new DataNode(dataNode1.wight+dataNode2.wight,dataNode2,dataNode1);
pool.add(dataNode);
}
dataNode = pool.get(0);
return dataNode;
}
/**
* find a min wight in list
* @param pool
* @return
*/
public static int findMin(List<DataNode> pool){
int size = pool.size();
int min = 0;
DataNode dataNode1;
DataNode dataNode2;
for (int i = 0;i<size;i++){
dataNode1=pool.get(i);
dataNode2=pool.get(min);
if (dataNode1.wight<dataNode2.wight)
min=i;
}
return min;
}
/**
* print huffman tree that you just made
* @param dataNode huffman tree you make
* @param code just code
*/
public static void printHuffMan(DataNode dataNode,String code){
//find node util he doesn't have a child,in this time,this node is we want print
if (dataNode.left != null) {
printHuffMan(dataNode.left, code + "0");
printHuffMan(dataNode.right,code + "1");
}
else
println(code+" : "+dataNode.element);
}
public static void main(String[] args){
Random random = new Random(47);
List<DataNode> list=new ArrayList<DataNode>();
//random make ten node and add to a list
for (int i = 0;i<10;i++){
DataNode dataNode = new DataNode(String.valueOf(i),random.nextInt(),null,null);
list.add(dataNode);
}
for (int i = 0;i<10;i++){
DataNode dataNode = list.get(i);
println(dataNode.element+" : "+dataNode.wight);
}
printHuffMan(makeHuffMan(list),"");
}
}
| 2,444
| 0.553191
| 0.538462
| 84
| 28.095238
| 20.178146
| 91
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.666667
| false
| false
|
4
|
5a101d998b6a3709d0b136051cc7e9c8d026bc10
| 1,666,447,321,656
|
a0725148fe3273fe588423c4e6155d35f4e228f0
|
/2017115050614杨雨婷学期实训/onlineBooking/src/com/booking/util/ViewBackgroundUtil.java
|
9f13befde47663e5fc0c32e0e2db522325ac376f
|
[] |
no_license
|
HellenYangYvTing/onlineBo0king
|
https://github.com/HellenYangYvTing/onlineBo0king
|
fde6aec72871a885210b61457e07d2a7c2512327
|
02e93dbab7b2da601c8857bbca8d0f005b3d09f8
|
refs/heads/master
| 2020-06-20T14:40:07.769000
| 2019-07-16T08:36:01
| 2019-07-16T08:36:01
| 197,153,678
| 1
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* @Title: ViewBackgroundUtil.java
* @Package com.atm.util
* @author 姜向阳
* @date 2018年3月20日
* @version V1.0
*/
package com.booking.util;
import java.awt.Container;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* @ClassName: ViewBackgroundUtil
* @Description: 设置界面背景工具类
* @author 姜向阳
* @date 2018年3月20日
* @since JDK 1.8
*/
public class ViewBackgroundUtil {
/**
* @Title: setBG
* @Description: 设置界面背景图片
* @param view
* @param image
*/
public static void setBG(JFrame view, String image) {
// 设置背景图片
ImageIcon icon = new ImageIcon(image);
JLabel bgLabel = new JLabel(icon);
view.getLayeredPane().add(bgLabel, new Integer(Integer.MIN_VALUE));
// 设置背景标签的位置
bgLabel.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());
Container contentPane = view.getContentPane();
((JPanel) contentPane).setOpaque(false);
}
}
|
UTF-8
|
Java
| 1,021
|
java
|
ViewBackgroundUtil.java
|
Java
|
[
{
"context": "oundUtil.java\n * @Package com.atm.util\n * @author 姜向阳\n * @date 2018年3月20日\n * @version V1.0 \n */\npackag",
"end": 80,
"score": 0.9998316168785095,
"start": 77,
"tag": "NAME",
"value": "姜向阳"
},
{
"context": "kgroundUtil\n * @Description: 设置界面背景工具类\n * @author 姜向阳\n * @date 2018年3月20日\n * @since JDK 1.8\n */\npublic ",
"end": 370,
"score": 0.9997957348823547,
"start": 367,
"tag": "NAME",
"value": "姜向阳"
}
] | null |
[] |
/**
* @Title: ViewBackgroundUtil.java
* @Package com.atm.util
* @author 姜向阳
* @date 2018年3月20日
* @version V1.0
*/
package com.booking.util;
import java.awt.Container;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
* @ClassName: ViewBackgroundUtil
* @Description: 设置界面背景工具类
* @author 姜向阳
* @date 2018年3月20日
* @since JDK 1.8
*/
public class ViewBackgroundUtil {
/**
* @Title: setBG
* @Description: 设置界面背景图片
* @param view
* @param image
*/
public static void setBG(JFrame view, String image) {
// 设置背景图片
ImageIcon icon = new ImageIcon(image);
JLabel bgLabel = new JLabel(icon);
view.getLayeredPane().add(bgLabel, new Integer(Integer.MIN_VALUE));
// 设置背景标签的位置
bgLabel.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());
Container contentPane = view.getContentPane();
((JPanel) contentPane).setOpaque(false);
}
}
| 1,021
| 0.700965
| 0.679528
| 42
| 21.214285
| 17.481331
| 69
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.97619
| false
| false
|
4
|
a40d41df99257b83574eba58e4a9c4defdd41462
| 29,154,238,033,357
|
fd3989a72b6a07b472db70cc32cac5d99011b5cd
|
/src/com/algorithms/trees/SerializeDeserializeTree.java
|
d11bf75a8ede5dd6dd8773e88db6be0b07fd75c5
|
[] |
no_license
|
rishikeshct/Algorithms-Java
|
https://github.com/rishikeshct/Algorithms-Java
|
bf28b3dfe1152704d0661707e10f9c5a7a4cca83
|
e761fe482f2aa8991581137abd4819cb873725b8
|
refs/heads/master
| 2023-08-05T02:57:26.236000
| 2023-08-01T14:11:05
| 2023-08-01T14:11:05
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package trees;
import java.util.LinkedList;
import java.util.Queue;
public class SerializeDeserializeTree {
public static void main(String[] args) {
TreeNode root = new TreeNode(4);
TreeNode node2 = new TreeNode(2);
TreeNode node7 = new TreeNode(7);
TreeNode node1 = new TreeNode(1);
TreeNode node3 = new TreeNode(3);
TreeNode node6 = new TreeNode(6);
TreeNode node9 = new TreeNode(9);
TreeNode node10 = new TreeNode(10);
/**
* 4
* 2 7
* 1 3 6 9
* 10
*/
root.left = node2;
root.right = node7;
node2.left = node1;
node2.right = node3;
node7.left = node6;
node7.right = node9;
node3.right = node10;
new InvertBinaryTree().printTreeLines(root);
String str = SerializeTree(root);
System.out.println(str);
new InvertBinaryTree().printTreeLines(Deserialize(str));
}
private static TreeNode Deserialize(String str) {
String[] strings = str.split(" ");
Queue<TreeNode> queue = new LinkedList<>();
TreeNode root = new TreeNode(Integer.parseInt(strings[0]));
queue.add(root);
for (int i = 1; i < strings.length; i++) {
TreeNode parent = queue.poll();
if (!strings[i].equals("n")) {
TreeNode left = new TreeNode(Integer.parseInt(strings[i]));
parent.left = left;
queue.add(left);
}
if (!strings[++i].equals("n")) {
TreeNode right = new TreeNode(Integer.parseInt(strings[i]));
parent.right = right;
queue.add(right);
}
}
return root;
}
private static String SerializeTree(TreeNode root) {
Queue<TreeNode> queue = new LinkedList<>();
queue.add(root);
StringBuilder stringBuilder = new StringBuilder();
while (!queue.isEmpty()) {
TreeNode parent = queue.poll();
if (parent == null) {
stringBuilder.append("n ");
continue;
}
stringBuilder.append(parent.val + " ");
queue.add(parent.left);
queue.add(parent.right);
}
return stringBuilder.toString();
}
}
|
UTF-8
|
Java
| 2,342
|
java
|
SerializeDeserializeTree.java
|
Java
|
[] | null |
[] |
package trees;
import java.util.LinkedList;
import java.util.Queue;
public class SerializeDeserializeTree {
public static void main(String[] args) {
TreeNode root = new TreeNode(4);
TreeNode node2 = new TreeNode(2);
TreeNode node7 = new TreeNode(7);
TreeNode node1 = new TreeNode(1);
TreeNode node3 = new TreeNode(3);
TreeNode node6 = new TreeNode(6);
TreeNode node9 = new TreeNode(9);
TreeNode node10 = new TreeNode(10);
/**
* 4
* 2 7
* 1 3 6 9
* 10
*/
root.left = node2;
root.right = node7;
node2.left = node1;
node2.right = node3;
node7.left = node6;
node7.right = node9;
node3.right = node10;
new InvertBinaryTree().printTreeLines(root);
String str = SerializeTree(root);
System.out.println(str);
new InvertBinaryTree().printTreeLines(Deserialize(str));
}
private static TreeNode Deserialize(String str) {
String[] strings = str.split(" ");
Queue<TreeNode> queue = new LinkedList<>();
TreeNode root = new TreeNode(Integer.parseInt(strings[0]));
queue.add(root);
for (int i = 1; i < strings.length; i++) {
TreeNode parent = queue.poll();
if (!strings[i].equals("n")) {
TreeNode left = new TreeNode(Integer.parseInt(strings[i]));
parent.left = left;
queue.add(left);
}
if (!strings[++i].equals("n")) {
TreeNode right = new TreeNode(Integer.parseInt(strings[i]));
parent.right = right;
queue.add(right);
}
}
return root;
}
private static String SerializeTree(TreeNode root) {
Queue<TreeNode> queue = new LinkedList<>();
queue.add(root);
StringBuilder stringBuilder = new StringBuilder();
while (!queue.isEmpty()) {
TreeNode parent = queue.poll();
if (parent == null) {
stringBuilder.append("n ");
continue;
}
stringBuilder.append(parent.val + " ");
queue.add(parent.left);
queue.add(parent.right);
}
return stringBuilder.toString();
}
}
| 2,342
| 0.533732
| 0.516225
| 83
| 27.216867
| 19.61377
| 74
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.554217
| false
| false
|
4
|
a21de717d0c117d89bd9d47d231e3e399568238c
| 14,345,190,776,340
|
44d28a53aef21b173108e678690c5eba6b1d07df
|
/src/main/java/test/TestWx.java
|
0b0ee29a24bf31ab06acbccc7c2e724441375300
|
[] |
no_license
|
Railgun-Misaka/wechat
|
https://github.com/Railgun-Misaka/wechat
|
ccfc8ed104766a67884a25f5a0296368d4d12432
|
eaf1f0a75f7963ae8554b4aa23c81fc7673ede1d
|
refs/heads/master
| 2022-02-14T16:30:38.657000
| 2019-11-01T08:11:51
| 2019-11-01T08:11:51
| 218,941,814
| 0
| 0
| null | false
| 2022-02-01T01:00:20
| 2019-11-01T08:08:41
| 2019-11-01T08:19:00
| 2022-02-01T01:00:20
| 47,902
| 0
| 0
| 2
|
Java
| false
| false
|
package test;
import org.junit.Test;
import cn.hutool.json.JSONObject;
import entity.*;
import entity.massage.NewsMassage;
import entity.token.Get_access_token;
import util.EntitytoXML;
public class TestWx {
@Test
public void test() {
NewsMassage tm = new NewsMassage();
System.out.println(EntitytoXML.transform(tm));
}
@Test
public void test1() {
System.out.println(this.getClass().getResource("/"));
System.out.println(this.getClass().getResource(""));
System.out.println(System.getProperty("user.dir"));
System.out.println(ClassLoader.getSystemResource(""));
Get_access_token gat = new Get_access_token();
gat.getAccess_token();
}
@Test
public void test2() {
// String str = "{'access_token':'26_uTHkCfk6uXSrl2iKQc_cHOjqqrOKNDUv1ndjzV5oGny9ofjhiNE401a7EDIsngezueIZ9AK-GnaD96bjB0CDU0VK64EadUCPVvsV_15yUwQS0KH4FPxMBevnTR559k47l1OQ_hJIwyqAokWQETVfAEARGI','expires_in':7200}";
// JSONObject json = new JSONObject(str);
// System.out.println(json.getStr("access_token"));
}
}
|
UTF-8
|
Java
| 1,043
|
java
|
TestWx.java
|
Java
|
[
{
"context": "oid test2() {\r\n//\t\tString str = \"{'access_token':'26_uTHkCfk6uXSrl2iKQc_cHOjqqrOKNDUv1ndjzV5oGny9ofjhiNE401a7EDIsngezueIZ9AK-GnaD96bjB0CDU0VK64EadUCPVvsV_15yUwQS0KH4FPxMBevnTR559k47l1OQ_hJIwyqAokWQETVfAEARGI','expires_in':7200}\";\r\n//\t\tJSONObject json = new ",
"end": 914,
"score": 0.9974331259727478,
"start": 757,
"tag": "KEY",
"value": "26_uTHkCfk6uXSrl2iKQc_cHOjqqrOKNDUv1ndjzV5oGny9ofjhiNE401a7EDIsngezueIZ9AK-GnaD96bjB0CDU0VK64EadUCPVvsV_15yUwQS0KH4FPxMBevnTR559k47l1OQ_hJIwyqAokWQETVfAEARGI"
}
] | null |
[] |
package test;
import org.junit.Test;
import cn.hutool.json.JSONObject;
import entity.*;
import entity.massage.NewsMassage;
import entity.token.Get_access_token;
import util.EntitytoXML;
public class TestWx {
@Test
public void test() {
NewsMassage tm = new NewsMassage();
System.out.println(EntitytoXML.transform(tm));
}
@Test
public void test1() {
System.out.println(this.getClass().getResource("/"));
System.out.println(this.getClass().getResource(""));
System.out.println(System.getProperty("user.dir"));
System.out.println(ClassLoader.getSystemResource(""));
Get_access_token gat = new Get_access_token();
gat.getAccess_token();
}
@Test
public void test2() {
// String str = "{'access_token':'<KEY>','expires_in':7200}";
// JSONObject json = new JSONObject(str);
// System.out.println(json.getStr("access_token"));
}
}
| 891
| 0.722915
| 0.690316
| 34
| 28.67647
| 37.501152
| 214
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.529412
| false
| false
|
4
|
81583e361b331b19b717f157cf9e38948fbb328c
| 21,852,793,609,048
|
d8eac7035e373ccd085a6004ad3e39dfe9247f1e
|
/sprintboot+mysql/src/main/java/com/study/sportplay/dao/MenuDao.java
|
92ab39486961a4a1acbaf5c1de3ee982cfd425bf
|
[] |
no_license
|
Red-SK/sportplay
|
https://github.com/Red-SK/sportplay
|
fd6e80b5093c356c4bd8c40b04ed2b86ecce9340
|
7706d4187a39ee17468e0d01099675dea7cfb5f4
|
refs/heads/master
| 2023-02-28T18:54:29.045000
| 2021-02-04T16:25:09
| 2021-02-04T16:25:09
| null | 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.study.sportplay.dao;
import com.study.sportplay.bean.MainMenu;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MenuDao {
List<MainMenu> getMenus();
}
|
UTF-8
|
Java
| 225
|
java
|
MenuDao.java
|
Java
|
[] | null |
[] |
package com.study.sportplay.dao;
import com.study.sportplay.bean.MainMenu;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MenuDao {
List<MainMenu> getMenus();
}
| 225
| 0.782222
| 0.782222
| 12
| 17.75
| 17.243959
| 49
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.416667
| false
| false
|
4
|
8cb215a569f24ecb97118cac29020382a0606d11
| 26,568,667,700,470
|
05fd7cd359706784b4d4c395d76d1fd28e9bff7d
|
/rpc-server/src/main/java/com/rpc/bean/TestDemoTwo.java
|
86e4d1021192d3fa143dc386ccebf09e0da3f1d9
|
[] |
no_license
|
suoxun/zookeeper-rpc
|
https://github.com/suoxun/zookeeper-rpc
|
83be0531a8ed185810532a38329bd1bf00906c6e
|
ad01244a5f8ad2ee7d9f9de74ec906bf5f2700ef
|
refs/heads/master
| 2022-06-22T15:12:03.568000
| 2019-09-06T08:00:23
| 2019-09-06T08:00:23
| 173,667,844
| 0
| 0
| null | false
| 2022-06-17T02:05:04
| 2019-03-04T03:33:11
| 2019-09-06T08:04:29
| 2022-06-17T02:05:04
| 39
| 0
| 0
| 1
|
Java
| false
| false
|
package com.rpc.bean;
import com.rpc.server.annotation.RpcAnnotation;
@RpcAnnotation(value = TestDemo.class)
public class TestDemoTwo implements TestDemo {
public String test(String msg) {
return "我是8081端口,信息为:" + msg;
}
}
|
UTF-8
|
Java
| 254
|
java
|
TestDemoTwo.java
|
Java
|
[] | null |
[] |
package com.rpc.bean;
import com.rpc.server.annotation.RpcAnnotation;
@RpcAnnotation(value = TestDemo.class)
public class TestDemoTwo implements TestDemo {
public String test(String msg) {
return "我是8081端口,信息为:" + msg;
}
}
| 254
| 0.725
| 0.708333
| 12
| 19
| 19.065676
| 47
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.416667
| false
| false
|
4
|
a8db246e2a2e0e0cbc327541ade046ddc21b9e70
| 30,691,836,305,062
|
ee34b0f9d8902e064204bce804be873f5554adfd
|
/jobtest/src/com/hcx/astage1jobtest/StringTest2.java
|
07bb9376af57558a062fd5da710bdb952777194f
|
[] |
no_license
|
tiger-hcx/studyproject
|
https://github.com/tiger-hcx/studyproject
|
ab222c449d5a59d9a3f1ad55c4365e7bc6af01fb
|
bd39526d21ae6d77065fbe389f33fb14c9005d2e
|
refs/heads/master
| 2019-07-09T18:36:38.803000
| 2017-05-07T11:34:52
| 2017-05-07T11:34:52
| 90,528,337
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hcx.astage1jobtest;
import org.junit.Test;
/**
* 面试题
* 在大串中统计小串出现的次数
* Created by Administrator on 2017/4/19.
*/
public class StringTest2 {
@Test
public void fun1(){
String max = "adfd_ha_nkhanknk_haha_ni";
String min = "ha";
int count=0;//计数器
int index=0;//索引
while ((index = max.indexOf(min)) !=-1){//如果查不到那就会等于-1,,不等于-1那就说明查到了
count++;
max = max.substring(index+min.length());//把大串变成未查找的部分。
}
System.out.println(count);
}
}
|
UTF-8
|
Java
| 654
|
java
|
StringTest2.java
|
Java
|
[] | null |
[] |
package com.hcx.astage1jobtest;
import org.junit.Test;
/**
* 面试题
* 在大串中统计小串出现的次数
* Created by Administrator on 2017/4/19.
*/
public class StringTest2 {
@Test
public void fun1(){
String max = "adfd_ha_nkhanknk_haha_ni";
String min = "ha";
int count=0;//计数器
int index=0;//索引
while ((index = max.indexOf(min)) !=-1){//如果查不到那就会等于-1,,不等于-1那就说明查到了
count++;
max = max.substring(index+min.length());//把大串变成未查找的部分。
}
System.out.println(count);
}
}
| 654
| 0.564338
| 0.536765
| 25
| 20.76
| 20.108267
| 76
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.36
| false
| false
|
4
|
b71885d3cbc60b6aaca181961b940285cd37bead
| 32,727,650,812,209
|
7795063e7823adc26f545b7a701f940d1cf427c9
|
/qrland/ccp/web-admin-affiliate/src/main/java/jp/co/cloudcard/ccp/dto/MemberMasterUploadErrCsvDto.java
|
1cbd50ef9b2f6057a2a4b5ed76cee504dd827c5d
|
[] |
no_license
|
upcshamsu/Nps_home
|
https://github.com/upcshamsu/Nps_home
|
36f0b458dc178c154318da0aaf194c541ead144d
|
5e9da530f3ccc1405486e6c6581b13610673b2ff
|
refs/heads/master
| 2016-08-19T22:38:51.385000
| 2016-08-10T05:40:22
| 2016-08-10T05:40:22
| 65,343,375
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package jp.co.cloudcard.ccp.dto;
import org.seasar.s2csv.csv.annotation.column.CSVColumn;
import org.seasar.s2csv.csv.annotation.entity.CSVEntity;
@CSVEntity(header=true)
public class MemberMasterUploadErrCsvDto {
@CSVColumn(columnIndex=0, columnName="バッチタスクID")
public Integer memberMasterUploadNo;
@CSVColumn(columnIndex=1, columnName="会員マスタアップロードエラー内容")
public String memberMaseterUploadMessage;
}
|
UTF-8
|
Java
| 452
|
java
|
MemberMasterUploadErrCsvDto.java
|
Java
|
[] | null |
[] |
package jp.co.cloudcard.ccp.dto;
import org.seasar.s2csv.csv.annotation.column.CSVColumn;
import org.seasar.s2csv.csv.annotation.entity.CSVEntity;
@CSVEntity(header=true)
public class MemberMasterUploadErrCsvDto {
@CSVColumn(columnIndex=0, columnName="バッチタスクID")
public Integer memberMasterUploadNo;
@CSVColumn(columnIndex=1, columnName="会員マスタアップロードエラー内容")
public String memberMaseterUploadMessage;
}
| 452
| 0.823529
| 0.813725
| 13
| 30.384615
| 22.137815
| 57
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.846154
| false
| false
|
4
|
d007769f7ac330f2e96b77cb80adafb14a1b6444
| 2,894,807,970,735
|
10324c70370fc5b69b2c86d575d58c10d0168e0e
|
/src/com/frba/abclandia/adapters/AlumnoAdapter.java
|
fc7653810949554291e4fe400818b388225322d8
|
[
"MIT"
] |
permissive
|
ProyectoDane/ABCLandia-Colegios
|
https://github.com/ProyectoDane/ABCLandia-Colegios
|
e4e5386c70410277c2642afd15d3c98a4292e3bc
|
38d2d9ae7862ce00014a20661a170a64e596e48f
|
refs/heads/master
| 2021-01-01T19:41:55.178000
| 2015-06-17T02:33:56
| 2015-06-17T02:33:56
| 37,325,400
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.frba.abclandia.adapters;
import java.util.List;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.frba.abclandia.R;
import com.frba.abclandia.dtos.Alumno;
public class AlumnoAdapter extends BaseAdapter {
private Context mContext;
private List<Alumno> mAlumnos;
private int[] colors = new int[] { Color.parseColor("#656D78"), Color.parseColor("#D2E4FC") };
public AlumnoAdapter(Context context, List<Alumno> alumnos){
mContext = context;
mAlumnos = alumnos;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mAlumnos.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return mAlumnos.get(position);
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
Alumno alumno = mAlumnos.get(arg0);
return alumno.getId();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView;
if (convertView == null){
rowView = inflater.inflate(R.layout.alumno_row, parent,false);
} else {
rowView = convertView;
}
TextView lblAlumnoApellido = (TextView) rowView.findViewById(R.id.lblAlumnoApellido);
TextView lblAlumnoNombre = (TextView) rowView.findViewById(R.id.lblAlumnoNombre);
Alumno alumno = mAlumnos.get(position);
lblAlumnoApellido.setText(alumno.getApellido());
lblAlumnoNombre.setText(alumno.getNombre());
// if (position % 2 == 0)
// rowView.setBackgroundColor(Color.parseColor("#656D78"));
return rowView;
}
}
|
UTF-8
|
Java
| 1,873
|
java
|
AlumnoAdapter.java
|
Java
|
[] | null |
[] |
package com.frba.abclandia.adapters;
import java.util.List;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.frba.abclandia.R;
import com.frba.abclandia.dtos.Alumno;
public class AlumnoAdapter extends BaseAdapter {
private Context mContext;
private List<Alumno> mAlumnos;
private int[] colors = new int[] { Color.parseColor("#656D78"), Color.parseColor("#D2E4FC") };
public AlumnoAdapter(Context context, List<Alumno> alumnos){
mContext = context;
mAlumnos = alumnos;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mAlumnos.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return mAlumnos.get(position);
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
Alumno alumno = mAlumnos.get(arg0);
return alumno.getId();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView;
if (convertView == null){
rowView = inflater.inflate(R.layout.alumno_row, parent,false);
} else {
rowView = convertView;
}
TextView lblAlumnoApellido = (TextView) rowView.findViewById(R.id.lblAlumnoApellido);
TextView lblAlumnoNombre = (TextView) rowView.findViewById(R.id.lblAlumnoNombre);
Alumno alumno = mAlumnos.get(position);
lblAlumnoApellido.setText(alumno.getApellido());
lblAlumnoNombre.setText(alumno.getNombre());
// if (position % 2 == 0)
// rowView.setBackgroundColor(Color.parseColor("#656D78"));
return rowView;
}
}
| 1,873
| 0.742125
| 0.733582
| 73
| 24.657534
| 24.562595
| 104
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.657534
| false
| false
|
4
|
2ac99c75147ea597e3df957a1e92471e8a2d5a30
| 2,894,807,967,667
|
5fd8a56bd7c8badbdc3dc6f41fbfc482975d988d
|
/src/main/java/com/hg/hgc/web/model/ProjectImage.java
|
685288c05ce9758244a5aa42f8cfd6f4968c4936
|
[] |
no_license
|
Maverick8liu/travle
|
https://github.com/Maverick8liu/travle
|
927c3fd5330779f42c612134c88fa4b7180ef57b
|
61ef860bef89e0268f6cee9eae90a2e65ebb02a8
|
refs/heads/master
| 2021-01-01T17:53:37.711000
| 2017-07-24T14:45:02
| 2017-07-24T14:45:02
| 98,190,627
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hg.hgc.web.model;
import java.util.Date;
public class ProjectImage {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.projectImageID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private Integer projectimageid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.customID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private Integer customid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.imageTips
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private String imagetips;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.imagePath
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private String imagepath;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.imageType
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private String imagetype;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.createDate
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private Date createdate;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.projectImageID
*
* @return the value of project_image.projectImageID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public Integer getProjectimageid() {
return projectimageid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.projectImageID
*
* @param projectimageid the value for project_image.projectImageID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setProjectimageid(Integer projectimageid) {
this.projectimageid = projectimageid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.customID
*
* @return the value of project_image.customID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public Integer getCustomid() {
return customid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.customID
*
* @param customid the value for project_image.customID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setCustomid(Integer customid) {
this.customid = customid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.imageTips
*
* @return the value of project_image.imageTips
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public String getImagetips() {
return imagetips;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.imageTips
*
* @param imagetips the value for project_image.imageTips
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setImagetips(String imagetips) {
this.imagetips = imagetips;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.imagePath
*
* @return the value of project_image.imagePath
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public String getImagepath() {
return imagepath;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.imagePath
*
* @param imagepath the value for project_image.imagePath
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setImagepath(String imagepath) {
this.imagepath = imagepath;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.imageType
*
* @return the value of project_image.imageType
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public String getImagetype() {
return imagetype;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.imageType
*
* @param imagetype the value for project_image.imageType
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setImagetype(String imagetype) {
this.imagetype = imagetype;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.createDate
*
* @return the value of project_image.createDate
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public Date getCreatedate() {
return createdate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.createDate
*
* @param createdate the value for project_image.createDate
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setCreatedate(Date createdate) {
this.createdate = createdate;
}
}
|
UTF-8
|
Java
| 6,074
|
java
|
ProjectImage.java
|
Java
|
[] | null |
[] |
package com.hg.hgc.web.model;
import java.util.Date;
public class ProjectImage {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.projectImageID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private Integer projectimageid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.customID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private Integer customid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.imageTips
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private String imagetips;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.imagePath
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private String imagepath;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.imageType
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private String imagetype;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column project_image.createDate
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
private Date createdate;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.projectImageID
*
* @return the value of project_image.projectImageID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public Integer getProjectimageid() {
return projectimageid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.projectImageID
*
* @param projectimageid the value for project_image.projectImageID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setProjectimageid(Integer projectimageid) {
this.projectimageid = projectimageid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.customID
*
* @return the value of project_image.customID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public Integer getCustomid() {
return customid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.customID
*
* @param customid the value for project_image.customID
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setCustomid(Integer customid) {
this.customid = customid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.imageTips
*
* @return the value of project_image.imageTips
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public String getImagetips() {
return imagetips;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.imageTips
*
* @param imagetips the value for project_image.imageTips
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setImagetips(String imagetips) {
this.imagetips = imagetips;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.imagePath
*
* @return the value of project_image.imagePath
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public String getImagepath() {
return imagepath;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.imagePath
*
* @param imagepath the value for project_image.imagePath
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setImagepath(String imagepath) {
this.imagepath = imagepath;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.imageType
*
* @return the value of project_image.imageType
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public String getImagetype() {
return imagetype;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.imageType
*
* @param imagetype the value for project_image.imageType
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setImagetype(String imagetype) {
this.imagetype = imagetype;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column project_image.createDate
*
* @return the value of project_image.createDate
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public Date getCreatedate() {
return createdate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column project_image.createDate
*
* @param createdate the value for project_image.createDate
*
* @mbg.generated Sun Jul 02 22:48:21 CST 2017
*/
public void setCreatedate(Date createdate) {
this.createdate = createdate;
}
}
| 6,074
| 0.621831
| 0.586269
| 203
| 27.931034
| 26.291941
| 88
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098522
| false
| false
|
4
|
03291177451e3afd42e2226a874d4e5f34d8950b
| 7,687,991,469,304
|
c17a97e1f2ff1717ef10cce659bd43f8a6987807
|
/AACoding/src/queue/MinimumTimeToRotAllOranges.java
|
ada7775050eba162b8f50637b70096225ab88c78
|
[] |
no_license
|
csprojectlab/CQ
|
https://github.com/csprojectlab/CQ
|
95134b2de291ad58059e7e251bc7c6f5970f14e4
|
e2f3852e5622c23847024213996dea995a5e98d6
|
refs/heads/master
| 2020-04-04T02:05:19.788000
| 2020-02-01T07:27:11
| 2020-02-01T07:27:11
| 155,688,687
| 0
| 0
| null | false
| 2020-02-01T07:27:13
| 2018-11-01T09:02:24
| 2019-07-25T07:26:27
| 2020-02-01T07:27:12
| 164
| 0
| 0
| 0
|
Java
| false
| false
|
package queue;
import java.util.LinkedList;
import java.util.Queue;
/*
* 0 means no orange there.
* 1 means fresh orange.
* 2 means rotten orange.
* Find the minimum time to rot all the oranges.
*/
public class MinimumTimeToRotAllOranges {
class Pair {
int x;
int y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return "{" + this.x + "," + this.y + "}";
}
}
public boolean isDelimeter(Pair p) {
return (p.x == -1 && p.y == -1);
}
public int timeToRot(int[][] matrix) {
Queue<Pair> queue = new LinkedList<>(); // This will store all the rotten oranges.
for(int i = 0; i < matrix.length; i++)
for(int j = 0; j < matrix[i].length; j++)
if(matrix[i][j] == 2)
queue.add(new Pair(i, j)); // Indexes of rotten.
// Adding a delimiter.
queue.add(new Pair(-1,-1));
System.out.println("Initial rotten oranges: " + queue);
int time = 0;
while(!queue.isEmpty()) {
boolean flag = false; // Flags the start of a new frame only once.
while(!this.isDelimeter(queue.peek())) {
Pair p = queue.poll();
// Looking right.
if(p.y + 1 < matrix[0].length && matrix[p.x][p.y+1] == 1) {
matrix[p.x][p.y+1] = 2; // rot the orange.
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x, p.y+1));
}
if(p.y - 1 >= 0 && matrix[p.x][p.y-1] == 1) { // left
matrix[p.x][p.y-1] = 2;
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x, p.y-1));
}
if(p.x + 1 < matrix.length && matrix[p.x+1][p.y] == 1) {
matrix[p.x+1][p.y] = 2;
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x+1, p.y));
}
if(p.x - 1 >= 0 && matrix[p.x-1][p.y] == 1) {
matrix[p.x-1][p.y] = 2;
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x-1, p.y));
}
}
queue.poll(); // Deque the delimiter
System.out.println("New Rotten: " + queue);
if(!queue.isEmpty()) // if queue is not empty. Means some rotten are left.
queue.add(new Pair(-1,-1));
}
System.out.println("Time required to rot all oranges: " + time);
return -1;
}
public static void main(String[] args) {
int[][] matrix = new int[][] {
{2,1,0,2,1}, {1,0,1,2,1}, {1,0,0,2,1}
};
MinimumTimeToRotAllOranges m = new MinimumTimeToRotAllOranges();
m.timeToRot(matrix);
}
}
|
UTF-8
|
Java
| 2,431
|
java
|
MinimumTimeToRotAllOranges.java
|
Java
|
[] | null |
[] |
package queue;
import java.util.LinkedList;
import java.util.Queue;
/*
* 0 means no orange there.
* 1 means fresh orange.
* 2 means rotten orange.
* Find the minimum time to rot all the oranges.
*/
public class MinimumTimeToRotAllOranges {
class Pair {
int x;
int y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return "{" + this.x + "," + this.y + "}";
}
}
public boolean isDelimeter(Pair p) {
return (p.x == -1 && p.y == -1);
}
public int timeToRot(int[][] matrix) {
Queue<Pair> queue = new LinkedList<>(); // This will store all the rotten oranges.
for(int i = 0; i < matrix.length; i++)
for(int j = 0; j < matrix[i].length; j++)
if(matrix[i][j] == 2)
queue.add(new Pair(i, j)); // Indexes of rotten.
// Adding a delimiter.
queue.add(new Pair(-1,-1));
System.out.println("Initial rotten oranges: " + queue);
int time = 0;
while(!queue.isEmpty()) {
boolean flag = false; // Flags the start of a new frame only once.
while(!this.isDelimeter(queue.peek())) {
Pair p = queue.poll();
// Looking right.
if(p.y + 1 < matrix[0].length && matrix[p.x][p.y+1] == 1) {
matrix[p.x][p.y+1] = 2; // rot the orange.
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x, p.y+1));
}
if(p.y - 1 >= 0 && matrix[p.x][p.y-1] == 1) { // left
matrix[p.x][p.y-1] = 2;
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x, p.y-1));
}
if(p.x + 1 < matrix.length && matrix[p.x+1][p.y] == 1) {
matrix[p.x+1][p.y] = 2;
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x+1, p.y));
}
if(p.x - 1 >= 0 && matrix[p.x-1][p.y] == 1) {
matrix[p.x-1][p.y] = 2;
if(!flag) { time++; flag = !flag;}
queue.add(new Pair(p.x-1, p.y));
}
}
queue.poll(); // Deque the delimiter
System.out.println("New Rotten: " + queue);
if(!queue.isEmpty()) // if queue is not empty. Means some rotten are left.
queue.add(new Pair(-1,-1));
}
System.out.println("Time required to rot all oranges: " + time);
return -1;
}
public static void main(String[] args) {
int[][] matrix = new int[][] {
{2,1,0,2,1}, {1,0,1,2,1}, {1,0,0,2,1}
};
MinimumTimeToRotAllOranges m = new MinimumTimeToRotAllOranges();
m.timeToRot(matrix);
}
}
| 2,431
| 0.536816
| 0.51378
| 83
| 27.289156
| 21.119015
| 85
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 3.228916
| false
| false
|
4
|
b71856bb66399b70cfc13d362e5d80b48e7bf4b7
| 14,989,435,875,869
|
f8c6a3ea49a3b1ab97d0bce14db4def145681698
|
/server/src/main/java/com/gshell/server/pojo/FuncExecMsg.java
|
a33b92e154fb24fd920b029ee3c5fcdacb5f3389
|
[] |
no_license
|
MrFIFA2016/NetHelper
|
https://github.com/MrFIFA2016/NetHelper
|
e71475e7dda0128f61612100bd61e2d1f7fa68da
|
e004fa9510a5db34ccf911482745e489b9faf332
|
refs/heads/master
| 2023-03-19T10:58:02.603000
| 2021-03-14T09:44:48
| 2021-03-14T09:44:48
| 341,797,393
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gshell.server.pojo;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import lombok.Data;
@Data
public class FuncExecMsg implements Msg, MsgResolver {
private String signature;
private List<Param> params;
private String method;
private Boolean newInstance;
@Override
public Msg resolveMsg(WsMsg msg) {
JSONObject obj = msg.getMsg();
return JSONObject.toJavaObject(obj, FuncExecMsg.class);
}
@Override
public String toString() {
return JSONObject.toJSONString(this, true);
}
}
|
UTF-8
|
Java
| 575
|
java
|
FuncExecMsg.java
|
Java
|
[] | null |
[] |
package com.gshell.server.pojo;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import lombok.Data;
@Data
public class FuncExecMsg implements Msg, MsgResolver {
private String signature;
private List<Param> params;
private String method;
private Boolean newInstance;
@Override
public Msg resolveMsg(WsMsg msg) {
JSONObject obj = msg.getMsg();
return JSONObject.toJavaObject(obj, FuncExecMsg.class);
}
@Override
public String toString() {
return JSONObject.toJSONString(this, true);
}
}
| 575
| 0.695652
| 0.695652
| 30
| 18.166666
| 18.811491
| 63
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.466667
| false
| false
|
4
|
c4a4d8a6465f144d8f9db07b33c73bab477e8010
| 15,564,961,493,809
|
b1ef919cacbfe9f1e07a93fd6536b57c18445b6c
|
/src/main/java/br/com/dbsoft/event/DBSEvent.java
|
c25237ab44816877d8f84e18fa86a5f2ed388310
|
[
"MIT"
] |
permissive
|
investira/dbssdk
|
https://github.com/investira/dbssdk
|
0c77db22556c0306c9a8da56e38a39f87d2a1dbe
|
59e8ab2a1c999f79d006a1afec55f01e04c16ee3
|
refs/heads/master
| 2023-08-19T03:00:38.816000
| 2023-08-15T22:05:29
| 2023-08-15T22:05:29
| 18,210,741
| 0
| 2
|
MIT
| false
| 2022-09-01T22:47:47
| 2014-03-28T12:05:17
| 2021-12-16T18:38:49
| 2022-09-01T22:47:44
| 1,606
| 0
| 2
| 7
|
Java
| false
| false
|
package br.com.dbsoft.event;
import br.com.dbsoft.message.DBSMessages;
import br.com.dbsoft.message.IDBSMessages;
/**
* Class da qual todos os eventos deverão ser extendidos
* @param <SourceObjectClass> Class do object que originará o evento
*/
public abstract class DBSEvent<SourceObjectClass> implements IDBSEvent<SourceObjectClass>{
private boolean wOk = true;
private IDBSMessages wMessages = new DBSMessages();
private SourceObjectClass wSourceObject;
/**
* Quando esta classe for extendida, deve-se alterar o tipo SourceObjectClass pelo objeto que será o padrão.
* @param pSourceObject
*/
public DBSEvent(SourceObjectClass pSourceObject){
wSourceObject = pSourceObject;
}
/**
* Se processamento foi Ok
* @return
*/
@Override
public final boolean isOk() {
return wOk;
}
/**
* Se processamento foi Ok
* @param pOk
*/
@Override
public final void setOk(boolean pOk) {
wOk = pOk;
}
/**
* Objeto origem que disparou o evento
* @return
*/
@Override
public final SourceObjectClass getSource() {
return wSourceObject;
}
@Override
public IDBSMessages getMessages() {
return wMessages;
}
}
|
UTF-8
|
Java
| 1,174
|
java
|
DBSEvent.java
|
Java
|
[] | null |
[] |
package br.com.dbsoft.event;
import br.com.dbsoft.message.DBSMessages;
import br.com.dbsoft.message.IDBSMessages;
/**
* Class da qual todos os eventos deverão ser extendidos
* @param <SourceObjectClass> Class do object que originará o evento
*/
public abstract class DBSEvent<SourceObjectClass> implements IDBSEvent<SourceObjectClass>{
private boolean wOk = true;
private IDBSMessages wMessages = new DBSMessages();
private SourceObjectClass wSourceObject;
/**
* Quando esta classe for extendida, deve-se alterar o tipo SourceObjectClass pelo objeto que será o padrão.
* @param pSourceObject
*/
public DBSEvent(SourceObjectClass pSourceObject){
wSourceObject = pSourceObject;
}
/**
* Se processamento foi Ok
* @return
*/
@Override
public final boolean isOk() {
return wOk;
}
/**
* Se processamento foi Ok
* @param pOk
*/
@Override
public final void setOk(boolean pOk) {
wOk = pOk;
}
/**
* Objeto origem que disparou o evento
* @return
*/
@Override
public final SourceObjectClass getSource() {
return wSourceObject;
}
@Override
public IDBSMessages getMessages() {
return wMessages;
}
}
| 1,174
| 0.715385
| 0.715385
| 59
| 18.830509
| 23.336994
| 109
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 1.20339
| false
| false
|
4
|
d3be39de7c18fee732904b13166120835544380c
| 10,453,950,411,797
|
f83db66c1a655ee0c68fa734599e58a8252e7367
|
/src/modeling-tool-base/stable/src/main/java/de/decidr/modelingtoolbase/client/model/connections/ConnectionModel.java
|
f2dd00ca77dc99dc6b5d9339409a59452399b127
|
[] |
no_license
|
matthiasmeyer/decidrplus
|
https://github.com/matthiasmeyer/decidrplus
|
3c5e7a474084cdbfae3d2e7d677256dfa00c6f2a
|
2bd36a35e936eeabbf8269d9677b3dfd308362a3
|
refs/heads/master
| 2020-03-26T17:12:12.772000
| 2011-06-03T09:52:18
| 2011-06-03T09:52:18
| 32,228,646
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* The DecidR Development Team licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package de.decidr.modelingtoolbase.client.model.connections;
import de.decidr.modelingtoolbase.client.model.AbstractModel;
import de.decidr.modelingtoolbase.client.model.container.HasChildModels;
import de.decidr.modelingtoolbase.client.model.nodes.NodeModel;
/**
* This is the basic model of all connections in the workflow. It contains
* pointers to its connection nodes and the parent model.
*
* @author Johannes Engelhardt
*/
public class ConnectionModel extends AbstractModel {
/** The parent model of the connection. */
private HasChildModels parentModel = null;
/** The source node of the connection. */
private NodeModel source = null;
/** The target node of the connection. */
private NodeModel target = null;
public ConnectionModel() {
this.name = this.getClass().getName();
}
public HasChildModels getParentModel() {
return parentModel;
}
public NodeModel getSource() {
return source;
}
public NodeModel getTarget() {
return target;
}
public void setParentModel(HasChildModels parentModel) {
this.parentModel = parentModel;
}
public void setSource(NodeModel source) {
this.source = source;
}
public void setTarget(NodeModel target) {
this.target = target;
}
}
|
UTF-8
|
Java
| 1,935
|
java
|
ConnectionModel.java
|
Java
|
[
{
"context": "nection nodes and the parent model.\n * \n * @author Johannes Engelhardt\n */\npublic class ConnectionModel extends Abstract",
"end": 1043,
"score": 0.9998642802238464,
"start": 1024,
"tag": "NAME",
"value": "Johannes Engelhardt"
}
] | null |
[] |
/*
* The DecidR Development Team licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package de.decidr.modelingtoolbase.client.model.connections;
import de.decidr.modelingtoolbase.client.model.AbstractModel;
import de.decidr.modelingtoolbase.client.model.container.HasChildModels;
import de.decidr.modelingtoolbase.client.model.nodes.NodeModel;
/**
* This is the basic model of all connections in the workflow. It contains
* pointers to its connection nodes and the parent model.
*
* @author <NAME>
*/
public class ConnectionModel extends AbstractModel {
/** The parent model of the connection. */
private HasChildModels parentModel = null;
/** The source node of the connection. */
private NodeModel source = null;
/** The target node of the connection. */
private NodeModel target = null;
public ConnectionModel() {
this.name = this.getClass().getName();
}
public HasChildModels getParentModel() {
return parentModel;
}
public NodeModel getSource() {
return source;
}
public NodeModel getTarget() {
return target;
}
public void setParentModel(HasChildModels parentModel) {
this.parentModel = parentModel;
}
public void setSource(NodeModel source) {
this.source = source;
}
public void setTarget(NodeModel target) {
this.target = target;
}
}
| 1,922
| 0.708527
| 0.70646
| 67
| 27.880596
| 24.534182
| 74
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.283582
| false
| false
|
4
|
cb01565b33af4e4c0dba0f6894a82b8c212dd297
| 489,626,289,652
|
f64103c935ff47469daec4ee1e7088f8740d337d
|
/src/shared/Request.java
|
8fdcd9e5af8b62fd3449418bfdca866908a9f349
|
[] |
no_license
|
jaxondk/cs340-phase0.5
|
https://github.com/jaxondk/cs340-phase0.5
|
ad8f01faf19893fea46ddc3eb6d46ad681b10a2d
|
9fc77703e0c520b8185b95e3b2ce4bd5bb6303c4
|
refs/heads/master
| 2021-09-04T17:51:22.385000
| 2018-01-20T19:16:22
| 2018-01-20T19:16:22
| 117,917,956
| 0
| 0
| null | null | null | null | null | null | null | null | null | null | null | null | null |
package shared;
/**
* Created by jaxon on 1/17/18.
*
* A request object
* If command is null, then we know the request body should consist of the text
*/
public class Request
{
private SPCommand command;
private String text;
public Request(String text, SPCommand command)
{
this.text = text;
this.command = command;
}
public SPCommand getCommand()
{
return command;
}
public String getText()
{
return text;
}
}
|
UTF-8
|
Java
| 496
|
java
|
Request.java
|
Java
|
[
{
"context": "package shared;\n\n/**\n * Created by jaxon on 1/17/18.\n *\n * A request object\n * If command ",
"end": 40,
"score": 0.9985865950584412,
"start": 35,
"tag": "USERNAME",
"value": "jaxon"
}
] | null |
[] |
package shared;
/**
* Created by jaxon on 1/17/18.
*
* A request object
* If command is null, then we know the request body should consist of the text
*/
public class Request
{
private SPCommand command;
private String text;
public Request(String text, SPCommand command)
{
this.text = text;
this.command = command;
}
public SPCommand getCommand()
{
return command;
}
public String getText()
{
return text;
}
}
| 496
| 0.610887
| 0.600806
| 29
| 16.103449
| 17.763474
| 79
| false
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0.310345
| false
| false
|
4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.