method_id
stringlengths 36
36
| cyclomatic_complexity
int32 0
9
| method_text
stringlengths 14
410k
|
|---|---|---|
17f11d10-6b14-4213-a338-ccbca75815fc
| 1
|
@Test
public void WhenComparingKeys_ExpectResults() {
Key key1 = new PGridKey("");
Key key2 = new PGridKey("");
Assert.assertTrue(key1.compareTo(key2) == 0);
key1 = new PGridKey("");
key2 = new PGridKey("00");
Assert.assertTrue(key1.compareTo(key2) == 1);
key1 = new PGridKey("11");
key2 = new PGridKey("");
Assert.assertTrue(key1.compareTo(key2) == -1);
key1 = new PGridKey("0000");
key2 = new PGridKey("000011111");
// in prefix relation
Assert.assertTrue(key1.compareTo(key2) == 0);
Key in = new PGridKey("000001");
// key is in the range [key1, key2]
Assert.assertTrue(in.compareTo(key1) >= 0 && in.compareTo(key2) <= 0);
}
|
c71fdbb5-66e4-4bd1-ad88-3923af2bba49
| 9
|
public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
}
if (c == q) {
return sb.toString();
}
sb.append(c);
}
}
for (;;) {
if (c == 0 || Character.isWhitespace(c)) {
return sb.toString();
}
sb.append(c);
c = next();
}
}
|
efc91b55-bf3b-47b9-84fc-ee62bb9f9e9a
| 8
|
public static void palette_change_color_16_static(int color, int red, int green, int blue) {
if (color == palette_transparent_color) {
int i;
palette_transparent_pen = shrinked_pens[rgbpenindex(red, green, blue)];
if (color == -1) {
return; /* by default, palette_transparent_color is -1 */
}
for (i = 0; i < Machine.drv.total_colors; i++) {
if ((old_used_colors.read(i) & (PALETTE_COLOR_VISIBLE | PALETTE_COLOR_TRANSPARENT_FLAG))
== (PALETTE_COLOR_VISIBLE | PALETTE_COLOR_TRANSPARENT_FLAG)) {
old_used_colors.write(i, old_used_colors.read(i) | PALETTE_COLOR_NEEDS_REMAP);
}
}
}
if (game_palette[3 * color + 0].read() == red
&& game_palette[3 * color + 1].read() == green
&& game_palette[3 * color + 2].read() == blue) {
return;
}
game_palette[3 * color + 0].set((char) red);
game_palette[3 * color + 1].set((char) green);
game_palette[3 * color + 2].set((char) blue);
if ((old_used_colors.read(color) & PALETTE_COLOR_VISIBLE) != 0) /* we'll have to reassign the color in palette_recalc() */ {
old_used_colors.write(color, old_used_colors.read(color) | PALETTE_COLOR_NEEDS_REMAP);
}
}
|
8f538f5f-b373-4c17-9d20-355163106db1
| 0
|
public IrcCommandSender(AprilonIrc plugin, IrcClient client, IrcMessage message)
{
this.Plugin = plugin;
this.Client = client;
this.Message = message;
this.User = message.getUser();
}
|
4b7e772d-d03e-4d78-86f7-4c627bffaad9
| 3
|
public static void removeConnectedClient(String btN)
{
for(int i = 0;i<=5;i++)
{
if(clientsTable.getModel().getValueAt(i, 0) != null)
{
if(clientsTable.getModel().getValueAt(i, 0).toString().equals(btN))
{
//Clear Device
clientsTable.getModel().setValueAt(null, i, 0);
clientsTable.getModel().setValueAt(null, i, 1);
numConnected--;
//Make Sure Table has no Breaks
cleanUpTable();
}
}
}
}
|
48c55063-2477-41f8-b6f7-504298dcda4b
| 0
|
public int getBumoncode() {
return this.bumoncode;
}
|
f0ad5e3d-f5c3-4212-a5a6-f792a52c541e
| 6
|
public void download( String source, String target )
{
try
{
String remote = convertPath( source );
String local = convertPath( target );
if ( isDirectory( local ) && !isDirectory( remote ) )
{
throw new IllegalStateException(
"Can not send a directory to a file!" );
}
File f = new File( target );
if ( !f.exists() )
{
if ( isDirectory( target ) )
{
f.mkdirs();
}
else
{
f.getParentFile().mkdirs();
}
}
Option[] options = getOptions( local );
scpSession.download( remote, local, options );
scpLog.logToConsole( source + " download successfully!",
LogCollector.INFO );
}
catch ( IllegalStateException e )
{
scpLog.logToConsole( "Can not send directory to a file!",
LogCollector.ERROR );
scpLog.logToConsole( e.getMessage(), LogCollector.ERROR );
}
catch ( IOException e )
{
// TODO Auto-generated catch block
scpLog.logToConsole( "Failed to download files!",
LogCollector.ERROR );
scpLog.logToConsole( e.getMessage(), LogCollector.ERROR );
}
}
|
87438601-c2b6-4321-9b77-0034cfe11b96
| 6
|
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(Ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Ventana.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
Ventana v = new Ventana();
v.setSize(600,600);
EnvioPaquetes ep = new EnvioPaquetes();
v.getContentPane().add(ep);
ep.setBounds(0,0,600,600);
v.setVisible(true);
ep.setVisible(true);
}
|
7c2b289e-76b0-4a60-9e1f-bb221733d8ad
| 7
|
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
dao.imp.DatabaseBean db = null;
synchronized (_jspx_page_context) {
db = (dao.imp.DatabaseBean) _jspx_page_context.getAttribute("db", PageContext.PAGE_SCOPE);
if (db == null){
db = new dao.imp.DatabaseBean();
_jspx_page_context.setAttribute("db", db, PageContext.PAGE_SCOPE);
}
}
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <head>\n");
out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
out.write(" <title>JSP Page</title>\n");
out.write(" \n");
out.write(" </head>\n");
out.write(" \n");
out.write(" <body>\n");
out.write(" ");
if (_jspx_meth_c_choose_0(_jspx_page_context))
return;
out.write("\n");
out.write(" </body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
|
1df3b665-a23a-4e6a-b673-9ae3bd9baf08
| 0
|
public void setId(Integer id) {
this.id = id;
}
|
6216c404-7826-4bba-8d29-00a6b38ab41c
| 8
|
private void getWavData() {
// Get the sample from the input thread
try {
// Add the data from the thread pipe to the circular buffer
circBuffer.addToCircBuffer(inPipeData.readInt());
// Process this data
processData();
// Update the progress bar
updateProgressBar();
// Check if the file has now all been read but we need to process all the data in the buffer
if (inputThread.getLoadingFileState()==false) {
int a;
for (a=0;a<circBuffer.retMax();a++) {
processData();
// Keep adding null data to the circular buffer to move it along
circBuffer.addToCircBuffer(0);
}
// Check if there is anything left to display
if (system==0) {
//if (crowd36Handler.getLineCount()>0) writeLine(crowd36Handler.getLineBuffer(),Color.BLACK,plainFont);
writeLine(crowd36Handler.lowHighFreqs(),Color.BLACK,plainFont);
crowd36Handler.toneResults();
}
else if (system==5) {
//writeLine(cis3650Handler.lineBuffer.toString(),Color.BLACK,plainFont);
}
else if (system==6) {
writeLine(fsk200500Handler.getQuailty(),Color.BLACK,plainFont);
}
else if (system==8) {
writeLine(fsk2001000Handler.getQuailty(),Color.BLACK,plainFont);
}
// Once the buffer data has been read we are done
if (wavFileLoadOngoing==true) {
String disp=getTimeStamp()+" WAV file loaded and analysis complete ("+Long.toString(inputThread.getSampleCounter())+" samples read)";
writeLine(disp,Color.BLACK,italicFont);
wavFileLoadOngoing=false;
}
}
}
catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(null,"Error in getWavData()","Rivet", JOptionPane.ERROR_MESSAGE);
}
}
|
2942c62f-b2da-4380-9840-d01872617c5f
| 1
|
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
newPersonDialog = new javax.swing.JDialog();
newNameField = new javax.swing.JTextField();
newAddressField = new javax.swing.JTextField();
newNumberField = new javax.swing.JTextField();
newMailField = new javax.swing.JTextField();
newUserButton = new javax.swing.JButton();
newNameLabel = new javax.swing.JLabel();
newAddressLabel = new javax.swing.JLabel();
newNumberLabel = new javax.swing.JLabel();
newMailLabel = new javax.swing.JLabel();
nameLabel = new javax.swing.JLabel();
addressLabel = new javax.swing.JLabel();
phoneLabel = new javax.swing.JLabel();
mailLabel = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
num1Label = new javax.swing.JLabel();
slashLabel = new javax.swing.JLabel();
num2Label = new javax.swing.JLabel();
openDialogButton = new javax.swing.JButton();
newAddressField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
newAddressFieldActionPerformed(evt);
}
});
newUserButton.setText("Legg til");
newUserButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
newUserButtonActionPerformed(evt);
}
});
newNameLabel.setText("Navn");
newAddressLabel.setText("Adresse");
newNumberLabel.setText("Nummer");
newMailLabel.setText("E-post");
javax.swing.GroupLayout newPersonDialogLayout = new javax.swing.GroupLayout(newPersonDialog.getContentPane());
newPersonDialog.getContentPane().setLayout(newPersonDialogLayout);
newPersonDialogLayout.setHorizontalGroup(
newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(newPersonDialogLayout.createSequentialGroup()
.addContainerGap()
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(newPersonDialogLayout.createSequentialGroup()
.addComponent(newUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, newPersonDialogLayout.createSequentialGroup()
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(newPersonDialogLayout.createSequentialGroup()
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(newNumberLabel)
.addComponent(newMailLabel))
.addGap(18, 18, 18)
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(newMailField, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(newNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(newPersonDialogLayout.createSequentialGroup()
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(newAddressLabel)
.addComponent(newNameLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(newNameField)
.addComponent(newAddressField))))
.addGap(85, 85, 85))))
);
newPersonDialogLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {newAddressField, newMailField, newNameField, newNumberField});
newPersonDialogLayout.setVerticalGroup(
newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(newPersonDialogLayout.createSequentialGroup()
.addContainerGap()
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(newNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(newNameLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(newAddressLabel)
.addComponent(newAddressField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(newNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(newNumberLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(newPersonDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(newMailLabel)
.addComponent(newMailField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32)
.addComponent(newUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
nameLabel.setFont(new java.awt.Font("Helvetica LT Std Light", 0, 14)); // NOI18N
nameLabel.setText("Navn");
addressLabel.setFont(new java.awt.Font("Helvetica LT Std Light", 0, 14)); // NOI18N
addressLabel.setText("Adresse");
phoneLabel.setFont(new java.awt.Font("Helvetica LT Std Light", 0, 14)); // NOI18N
phoneLabel.setText("Telefonnummer");
mailLabel.setFont(new java.awt.Font("Helvetica LT Std Light", 0, 14)); // NOI18N
mailLabel.setText("E-postadresse");
jButton1.setText("Next");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Previous");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
num1Label.setText("1");
slashLabel.setText("/");
try{
ReadFile hey = new ReadFile("storage.txt");
Integer lines = hey.readLines();
num2Label.setText(lines.toString());
}
catch(IOException e){}
openDialogButton.setText("Legg til");
openDialogButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
openDialogButtonActionPerformed(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()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(addressLabel)
.addComponent(phoneLabel)
.addComponent(mailLabel)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(nameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(num1Label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(openDialogButton)
.addGroup(layout.createSequentialGroup()
.addComponent(slashLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(num2Label)))))
.addGap(23, 23, 23))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addGap(0, 0, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nameLabel)
.addComponent(num1Label)
.addComponent(slashLabel)
.addComponent(num2Label))
.addGap(30, 30, 30)
.addComponent(addressLabel)
.addGap(30, 30, 30)
.addComponent(phoneLabel)
.addGap(30, 30, 30)
.addComponent(mailLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton1)
.addComponent(openDialogButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
|
6dda1608-a855-473c-8f5b-59feeeacece0
| 7
|
protected Target nextMoveTarget(Target dummy, Actor actor) {
float offs[] = null ; switch (drill) {
case (DRILL_MELEE ) : offs = MELEE_OFFS ; break ;
case (DRILL_RANGED ) : offs = RANGED_OFFS ; break ;
case (DRILL_ENDURANCE) : offs = ENDURE_OFFS ; break ;
case (DRILL_AID ) : offs = AID_OFFS ; break ;
default: return null ;
}
final Tile o = origin(), a = actor.origin() ;
Tile pick = null ;
for (int i = 0, n = 0 ; i < NUM_OFFSETS ; i++) {
final Tile t = world.tileAt(o.x + offs[n++], o.y + offs[n++]) ;
if (pick == null) pick = t ;
if (t == a) {
n = ((i + 1) % NUM_OFFSETS) * 2 ;
return world.tileAt(o.x + offs[n++], o.y + offs[n++]) ;
}
}
return pick ;
}
|
8f7a9ddb-cb7b-40d3-ad22-8c60e39d014b
| 2
|
private int partition(int[] array, int p, int r) {
int i = p;
int key = array[p];
for (int j = p + 1; j < r + 1; j++) {
if (array[j] < key) {
i++;
swap(array, i, j);
}
}
swap(array, p, i);
return i;
}
|
9b1559f3-f555-4413-9f97-faea8ba677a9
| 3
|
public void Render(GameContainer gc, Graphics g) {
g.setColor(INVENTORY_BACKGROUND_COLOR);
g.fillRect(600, 100, 180, 400);
g.setLineWidth(5f);
g.setColor(INVENTORY_OUTLINE_COLOR);
g.drawRect(600, 100, 180, 400);
g.resetLineWidth();
Vector2 currentlyDrawing = new Vector2(603, 112);
Inventory inv = player.getInventory();
int itemIndex = 0;
for(int i = 0; i < inv.getItemCount(); i++) {
Item item = inv.getItem(i);
if(item != null) {
if(itemIndex == currentlySelected) {
g.setColor(ITEM_HIGHLIGHTED_COLOR);
g.fillRect(currentlyDrawing.getX(), currentlyDrawing.getY(), 175, 26);
g.setColor(INVENTORY_OUTLINE_COLOR);
}
g.drawImage(item.getImage(), currentlyDrawing.getX(), currentlyDrawing.getY());
g.drawString(item.getName(), currentlyDrawing.getX() + 32, currentlyDrawing.getY() + 4);
currentlyDrawing.add(new Vector2(0, 32));
itemIndex++;
}
}
}
|
020d632e-acf4-4801-a795-3d2b4ed00559
| 9
|
public static void wordFrequencyCount(String s) {
int count = StringDemo.wordCount(s);
String ar[] = new String[count];
int ocr = 0;
for (int i = 0; i < count; i++) {
if (i == (count - 1)) {
ar[i] = s.substring(0);
} else {
ar[i] = s.substring(0, s.indexOf(' '));
s = s.substring(s.indexOf(' ') + 1);
}
}
for (int i = 0; i < count; i++) {
ocr = 0;
for (int j = 0; j < count; j++) {
if ((j < i) && (StringDemo.compare(ar[i], ar[j]) == 0)) {
break;
} else if ((j >= i) && (StringDemo.compare(ar[i], ar[j]) == 0)) {
ocr++;
}
}
if (ocr != 0) {
System.out.println(ar[i] + "\t:\t" + ocr);
}
}
}
|
ba1ad7a0-1b87-4992-9b16-44542673b405
| 5
|
*/
protected Rectangle repaintSelectionInternal() {
Rectangle area = new Rectangle();
Insets insets = getInsets();
Rectangle bounds = new Rectangle(insets.left, insets.top, getWidth() - (insets.left + insets.right), getHeight() - (insets.top + insets.bottom));
int last = getLastRowToDisplay();
List<Column> columns = mModel.getColumns();
for (int i = getFirstRowToDisplay(); i <= last; i++) {
Row row = mModel.getRowAtIndex(i);
if (!mModel.isRowFiltered(row)) {
int height = row.getHeight();
if (height == -1) {
height = row.getPreferredHeight(columns);
row.setHeight(height);
}
if (mDrawRowDividers) {
height++;
}
if (mModel.isRowSelected(row)) {
bounds.height = height;
repaint(bounds);
area = Geometry.union(area, bounds);
}
bounds.y += height;
}
}
return area;
}
|
c467f3eb-d544-46fb-8881-975e97ecf135
| 2
|
@Override
public boolean activate() {
if(Tabs.getCurrent() != Tabs.INVENTORY && hasSpinTicket()) {
return false;
}
return hasSpinTicket();
}
|
846a2c3f-164f-49c6-b8ba-13728bc52099
| 3
|
public List<Double> multiply(Business bus, double[] maxPerFeature){
double scoregiven = 0;
List<Double> sample = new ArrayList<Double>();
for(Review r:reviews){
if(r.b_id.equals(bus.id)){
scoregiven = r.stars;
break;
}
}
for(int i=0; i<features.size();i++){
sample.add(features.get(i)*scoregiven/maxPerFeature[i]);
features.set(i, features.get(i)/maxPerFeature[i]);
}
return sample;
}
|
08500631-14ae-4a7a-9031-702796f8229b
| 3
|
public int loadALData() {
AL10.alGenBuffers(buffer);
if(AL10.alGetError() != AL10.AL_NO_ERROR) {
return AL10.AL_FALSE;
}
/*
WaveData waveFile = WaveData.create("testi.wav");
AL10.alBufferData(buffer.get(0), waveFile.format, waveFile.data, waveFile.samplerate);
waveFile.dispose();
*
*/
AL10.alGenSources(source);
if(AL10.alGetError() != AL10.AL_NO_ERROR) {
return AL10.AL_FALSE;
}
AL10.alSourcei(source.get(0), AL10.AL_BUFFER, buffer.get(0));
AL10.alSourcei(source.get(0), AL10.AL_LOOPING, AL10.AL_TRUE);
AL10.alSourcef(source.get(0), AL10.AL_PITCH, 1.0f);
AL10.alSourcef(source.get(0), AL10.AL_GAIN, 1.0f);
AL10.alSource(source.get(0), AL10.AL_POSITION, sourcePos);
AL10.alSource(source.get(0), AL10.AL_VELOCITY, sourceVel);
if(AL10.alGetError() == AL10.AL_NO_ERROR) {
return AL10.AL_TRUE;
}
return AL10.AL_FALSE;
}
|
e97feaa0-df02-4bf3-b551-d14e0c870ffe
| 8
|
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
try{
OAuth2Message requestMessage = OAuth2Servlet.getMessage(request, null);
OAuth2Client client = SampleOAuth2Provider.getClient(requestMessage);
String userId = request.getParameter("userId");
if(userId == null){
SampleOAuth2Provider.VALIDATOR.validateRequestMessageForAuthorization(requestMessage,client);
sendToAuthorizePage(request, response, client);
}
OAuth2Accessor accessor = new OAuth2Accessor(client);
// set userId in accessor and mark it as authorized
SampleOAuth2Provider.markAsAuthorized(accessor, userId);
String requested = requestMessage.getParameter(OAuth2.RESPONSE_TYPE);
if (requested.equals(OAuth2.ResponseType.CODE)) {
SampleOAuth2Provider.generateCode(accessor);
returnToConsumer(request, response, accessor);
}else if (requested.equals(OAuth2.ResponseType.TOKEN)){
// generate refresh token here but do not send back that
SampleOAuth2Provider.generateAccessAndRefreshToken(accessor);
String redirect_uri = request.getParameter(OAuth2.REDIRECT_URI);
String state = request.getParameter(OAuth2.STATE);
List<Parameter> list = new ArrayList<Parameter>(5);
list.add(new Parameter(OAuth2.ACCESS_TOKEN,accessor.accessToken));
list.add(new Parameter(OAuth2.TOKEN_TYPE,accessor.tokenType));
list.add(new Parameter(OAuth2.EXPIRES_IN,"3600"));
if(accessor.scope!=null) list.add(new Parameter(OAuth2.SCOPE,accessor.scope));
if(state != null){
list.add(new Parameter(OAuth2.STATE, state));
}
redirect_uri = OAuth2.addParametersAsFragment(redirect_uri,list);
response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
response.setHeader("Location", OAuth2.decodePercent(redirect_uri));
}else if (requested.equals(OAuth2.ResponseType.CODE_AND_TOKEN)){
//TODO
}else{
//TODO
}
} catch (Exception e){
Boolean sendBodyInJson = false;
Boolean withAuthHeader = false;
if (e instanceof OAuth2ProblemException){
OAuth2ProblemException problem = (OAuth2ProblemException) e;
problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(302));
//problem.setParameters(OAuth2ProblemException.HTTP_LOCATION,)
}
SampleOAuth2Provider.handleException(e, request, response, sendBodyInJson,withAuthHeader);
}
}
|
56a12149-fe3f-48a0-a47b-67f68922868d
| 7
|
public void setSelected(boolean isSelected) {
if(this.isSelected && isSelected ) {
if ( isXSelected) {
isXSelected = false;
isYSelected = true;
}
else if (isYSelected) {
isYSelected = false;
isXSelected = false;
}
}
else if (!this.isSelected && isSelected) {
this.isSelected = true;
isXSelected = true;
}
else if(!isSelected) {
this.isSelected = false;
isXSelected = false;
isYSelected = false;
}
}
|
d4c0339f-9d63-413a-9d4d-1e7d765beabe
| 0
|
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
//set a Princess Peach Theme!
world.setThemes("Peach");
this.repaint();
}//GEN-LAST:event_jMenuItem7ActionPerformed
|
a7446937-8b65-438f-b6e5-2c485040976e
| 4
|
public STTPoint getNextPoint() {
long timeSinceLastPull = System.currentTimeMillis() - this.lastDataPullTime.getTime();
if (timeSinceLastPull > this.pointPollingTimeMS) {
ArrayList<STTPoint> newData = this.wrapperReference.getWrappedData();
this.mostRecentPoints = newData;
this.lastDataPullTime = new Timestamp(System.currentTimeMillis());
this.emagePointQueue.addAll(newData);
this.pointIterator = newData.iterator();
return getNextPoint();
} else {
if (pointIterator == null || !pointIterator.hasNext()) {
long sleepTime = 5 + this.pointPollingTimeMS - (System.currentTimeMillis() - this.lastDataPullTime.getTime());
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
return getNextPoint();
} else {
return pointIterator.next();
}
}
}
|
0c10b3ad-b46a-4824-a5bd-a54ca8d91488
| 9
|
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
int var3 = par2 & 7;
return var3 == 0 ? (par1 <= 1 ? 6 : 5) : (var3 == 1 ? (par1 == 0 ? 208 : (par1 == 1 ? 176 : 192)) : (var3 == 2 ? 4 : (var3 == 3 ? 16 : (var3 == 4 ? Block.brick.blockIndexInTexture : (var3 == 5 ? Block.stoneBrick.blockIndexInTexture : 6)))));
}
|
aee26fe7-434d-4f64-9742-780a38a07bc8
| 5
|
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
out.write("<head>\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n");
out.write("<title>Untitled Document</title>\n");
out.write("\n");
out.write("\n");
out.write("<script src=\"facefiles/jquery-1.2.2.pack.js\" type=\"text/javascript\"></script>\n");
out.write("<link href=\"facefiles/facebox.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
out.write("\n");
out.write("<link href=\"css/css1.css\" rel=\"stylesheet\" type=\"text/css\" />\n");
out.write("<script type=\"text/javascript\" src=\"jquery/jquery-1.7.1.min.js\"></script>\n");
out.write("</head>\n");
out.write("<script type=\"text/javascript\">\n");
out.write("function hideall(){\n");
out.write("$(\"#a11\").hide();\n");
out.write("$(\"#a12\").hide();\n");
out.write("$(\"#a14\").hide();\n");
out.write("$(\"#a15\").hide();\n");
out.write("$(\"#a21\").hide();\n");
out.write("$(\"#a23\").hide();\n");
out.write("$(\"#a24\").hide();\n");
out.write("}\n");
out.write("\n");
out.write("$(document).ready(function(){\n");
out.write("hideall();\n");
out.write("\n");
out.write("$(\"#q11\").click(function(){\n");
out.write("hideall();\n");
out.write("$(\"#a11\").toggle('slow');\n");
out.write("}\n");
out.write(");\n");
out.write("\n");
out.write("$(\"#q12\").click(function(){\n");
out.write("hideall();\n");
out.write("$(\"#a12\").toggle('slow');\n");
out.write("}\n");
out.write(");\n");
out.write("\n");
out.write("\n");
out.write("$(\"#q14\").click(function(){\n");
out.write("hideall();\n");
out.write("$(\"#a14\").toggle('slow');\n");
out.write("}\n");
out.write(");\n");
out.write("\n");
out.write("$(\"#q15\").click(function(){\n");
out.write("hideall();\n");
out.write("$(\"#a15\").toggle('slow');\n");
out.write("}\n");
out.write(");\n");
out.write("\n");
out.write("$(\"#q24\").click(function(){hideall();\n");
out.write("$(\"#a24\").toggle('slow');\n");
out.write("}\n");
out.write(");\n");
out.write("$(\"#q21\").click(function(){\n");
out.write("hideall();\n");
out.write("$(\"#a21\").toggle('slow');\n");
out.write("}\n");
out.write(");\n");
out.write("$(\"#q23\").click(function(){\n");
out.write("hideall();\n");
out.write("$(\"#a23\").toggle('slow');\n");
out.write("}\n");
out.write(");\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("$(\"#q21\").click(function(){\n");
out.write("$(\"#ResortRating\").toggle('slow');\n");
out.write("}\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write(");\n");
out.write("});\n");
out.write("</script>\n");
out.write("<body>\n");
out.write("<table width=\"895\" height=\"550\" border=\"1\">\n");
out.write(" <tr>\n");
out.write(" <td width=\"855\" align=\"left\"><div align=\"center\">Client Information</div></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td height=\"536\"><table width=\"890\" height=\"320\" border=\"1\">\n");
out.write(" <tr>\n");
out.write(" <td width=\"403\">Booking and Resort Information</td>\n");
out.write(" \n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td ><p id=\"q11\"><a href=\"JavaScript:void()\"> Find booking information</a></p>\n");
out.write(" \n");
out.write(" <p id=\"q22\"><a href=\"Query7.jsp?act=a22\"> Find resorts which have all amenities</a></p>\n");
out.write(" <p id=\"q23\"><a href=\"JavaScript:void()\">Most popular resorts in various countries</a></p>\n");
out.write(" <p id=\"q24\"><a href=\"JavaScript:void()\">List number of resorts by country</a></p>\n");
out.write(" <p id=\"q25\"><a href=\"query1.php?act=a25\"> Find the Country which has highest average Sun Rate</a></p></td>\n");
out.write(" </tr>\n");
out.write(" </table>\n");
out.write(" \n");
out.write(" <div id=\"a21\">\n");
out.write(" <p><strong>Resort Sun Rating</strong></p>\n");
out.write(" <form id=\"form2\" name=\"form1\" method=\"post\" action=\"Query5.jsp\">\n");
out.write(" <label> Resort Name\n");
out.write(" <input type=\"text\" name=\"v8\" id=\"value\" />\n");
out.write(" </label>\n");
out.write(" \n");
out.write(" <label>\n");
out.write(" <input type=\"submit\" name=\"button\" id=\"button\" value=\"Search\" />\n");
out.write(" </label>\n");
out.write(" </form>\n");
out.write(" </div> \n");
out.write(" <div id=\"a24\">\n");
out.write(" <p><strong>Find Resort by city</strong></p>\n");
out.write(" <form id=\"form3\" name=\"form1\" method=\"post\" action=\"Query8.jsp\">\n");
out.write(" <label>City\n");
out.write(" <input type=\"text\" name=\"v9\" id=\"value\" />\n");
out.write(" </label>\n");
out.write(" \n");
out.write(" <label>\n");
out.write(" <input type=\"submit\" name=\"button\" id=\"button\" value=\"Search\" />\n");
out.write(" </label>\n");
out.write(" </form>\n");
out.write(" </div> \n");
out.write(" \n");
out.write(" <div id=\"a25\">\n");
out.write(" <p><strong>Find Resort by country</strong></p>\n");
out.write(" <form id=\"form3\" name=\"form1\" method=\"post\" action=\"Query8b.jsp\">\n");
out.write(" <label>Country\n");
out.write(" <input type=\"text\" name=\"v20\" id=\"value\" />\n");
out.write(" </label>\n");
out.write(" \n");
out.write(" <label>\n");
out.write(" <input type=\"submit\" name=\"button\" id=\"button\" value=\"Search\" />\n");
out.write(" </label>\n");
out.write(" </form>\n");
out.write(" </div>\n");
out.write(" <div id=\"a12\">\n");
out.write(" <p><strong>Resort Room type price</strong></p>\n");
out.write(" <form id=\"form4\" name=\"form1\" method=\"post\" action=\"query..?act=a12\">\n");
out.write(" <label></label> \n");
out.write(" <label>\n");
out.write(" <input type=\"submit\" name=\"button\" id=\"button\" value=\"Search\" />\n");
out.write(" </label>\n");
out.write(" </form>\n");
out.write(" </div> \n");
out.write(" \n");
out.write(" <div id=\"a14\">\n");
out.write(" <p><strong>Find amenities by string</strong></p>\n");
out.write(" <form id=\"form5\" name=\"form1\" method=\"post\" action=\"Query10.jsp\">\n");
out.write(" <label>Amenity name\n");
out.write(" <input type=\"text\" name=\"v10\" id=\"value\" />\n");
out.write("</label>\n");
out.write(" \n");
out.write(" <label>\n");
out.write(" <input type=\"submit\" name=\"button\" id=\"button\" value=\"Search\" />\n");
out.write(" </label>\n");
out.write(" </form>\n");
out.write(" </div> \n");
out.write(" \n");
out.write(" <div id=\"a23\">\n");
out.write(" <p><strong>Most popular resorts:</strong></p>\n");
out.write(" <form id=\"form6\" name=\"form1\" method=\"post\" action=\"query...jsp?act=a23\">\n");
out.write(" \n");
out.write(" \n");
out.write(" <label></label>\n");
out.write(" <p>\n");
out.write(" <label>\n");
out.write(" <input type=\"radio\" name=\"radio\" id=\"radio\" value=\"radio1\" />\n");
out.write(" One Sun Rating</label>\n");
out.write(" <label>\n");
out.write(" <input type=\"radio\" name=\"radio\" id=\"radio\" value=\"radio2\" />\n");
out.write(" Two Sun Rating</label>\n");
out.write(" <label>\n");
out.write(" <input type=\"radio\" name=\"radio\" id=\"radio\" value=\"radio3\" />\n");
out.write(" Three Sun Rating</label>\n");
out.write(" <label>\n");
out.write(" <input type=\"radio\" name=\"radio\" id=\"radio\" value=\"radio4\" />\n");
out.write(" All</label>\n");
out.write(" \n");
out.write(" <input type=\"submit\" name=\"button2\" id=\"button2\" value=\"Search\" />\n");
out.write(" </p>\n");
out.write(" </form>\n");
out.write(" </div> \n");
out.write(" \n");
out.write(" <p> </p> </td>\n");
out.write(" </tr>\n");
out.write("</table>\n");
out.write("</body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
|
febe30ec-bd4b-414c-87ba-0af895361517
| 5
|
public int minDistance(String word1, String word2) {
int m = word1.length();
int n = word2.length();
int array[][]= new int[n+1][m+1];
//init
for(int i =0 ; i < n+1;i++)
array[i][0] = i;
for(int i = 0 ; i < m +1; i++)
array[0][i] = i;
for(int i = 1; i < n+1;i++)
for(int j = 1; j < m+1;j++){
if(word2.charAt(i-1) == word1.charAt(j-1))
array[i][j] = array[i-1][j-1];
else
array[i][j] = Math.min(array[i-1][j-1],Math.min(array[i-1][j],array[i][j-1]))+1;
}
return array[n][m];
}
|
e7af966c-a1e7-4992-a713-c33c4302bb89
| 2
|
public Upgrade getUpgradeByName(String name){
for(Upgrade u : allUpgrades){
if(u.getName() == name){
return u;
}
}
return null;
}
|
46442914-54cd-45df-81e6-b700686125a7
| 2
|
public PollItem getItem (int index)
{
if (index < 0 || index >= this.next)
return null;
return this.items[index];
}
|
2ae2b70c-b46a-448b-8920-08cc18f61271
| 0
|
@Override
public boolean supportsAttributes() {return true;}
|
520dd361-5602-45a1-bac8-11d02a2995d5
| 7
|
public static void setMarketComparisonStatistics(StatInfo setTo, int iD,
float emin, float emax) {
ArrayList<Float> over = new ArrayList<Float>();
ArrayList<Float> under = new ArrayList<Float>();
for (Entry<Float, float[][]> ent : Database.DB_ARRAY.entrySet()) {
// change in market forward 1wk
if (!Database.WEEKLY_MARKETCHANGE.containsKey(ent.getKey()))
continue;
float marketChange = Database.WEEKLY_MARKETCHANGE.get(ent.getKey());
System.out.println("MARKET WAS " + marketChange);
float[][] dats = ent.getValue();
float[] individualsChanges = Database.UNFORESEEN.get(ent.getKey());
if (individualsChanges != null)
for (int i = 0; i < dats.length; i++) {
if (individualsChanges[i] != individualsChanges[i])
continue;
if (individualsChanges[i] > marketChange)
over.add(dats[i][iD]);
else if (individualsChanges[i] < marketChange)
under.add(dats[i][iD]);
}
}
System.out.println("sizes: -------->" + over.size() + " "
+ under.size());
// overs - left = false -> right
setTo.beatMarket = new StatInfo(over, iD, StatInfo.DONT_SHOW, emin,
emax, false);
// unders- left = true
setTo.marketBeat = new StatInfo(under, iD, StatInfo.DONT_SHOW, emin,
emax, true);
}
|
28e5700e-239b-4196-b714-07bd44eceef9
| 3
|
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Location other = (Location) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
}
return true;
}
|
567712dc-4b66-41b2-86ff-bd65cd10ad8e
| 5
|
public void run() {
Plugin larvikGaming = Bukkit.getServer().getPluginManager().getPlugin("LarvikGaming");
int delay = larvikGaming.getConfig().getInt("RefreshGroupInMin", 10) * 60000;
long runTime = 0;
if (delay < 1) {
return;
}
try {
Thread.sleep(100);
}
catch (InterruptedException e) {
}
while (go) {
try {
Thread.sleep(delay - runTime);
}
catch (InterruptedException e) {
}
if (go) {
long startTime = System.currentTimeMillis();
PlayerGroups.refreshGroups();
runTime = System.currentTimeMillis() - startTime;
}
}
}
|
f26aec51-eeec-4230-ba40-fa98146ef0fa
| 3
|
@Override
public boolean verifier() throws Exception {
super.verifier();
if(!expression.verifier())
GestionnaireSemantique.getInstance().add(new SemantiqueException("La declaration de la variable "+((Identificateur) expression).getNom()+" a la ligne "+/*line+*/" est manquante"));
if(!expression.isBoolean())
GestionnaireSemantique.getInstance().add(new SemantiqueException("Expression entiere trouvee a la ligne "/*+line*/+", expression booleenne attendue"));
for(Instruction i : instructions){
i.verifier();
}
return true;
}
|
af81dfd0-d9d1-47ce-97cd-629e5811358a
| 1
|
@Override
protected ModelAndView onSubmit(Object command, BindException errors) throws Exception {
ModelAndView modelAndView = null;
NewUserForm newUserForm = (NewUserForm)command;
if (usersManager.existingUserName(newUserForm.getUserName())){
modelAndView = new ModelAndView(getFormView(), "startUserSession", command);
errors.rejectValue("userName", "error.user-exists", null, "User Exists");
modelAndView.addAllObjects(errors.getModel());
} else {
usersManager.addUser((NewUserForm)command);
modelAndView = new ModelAndView(new RedirectView(getSuccessView()));
}
return modelAndView;
}
|
dcf030de-0a6d-46ef-9f6f-48485fc3c024
| 3
|
void close() {
try {
Thread.sleep(100000);
} catch (InterruptedException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
try {
mySocket.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
serverAcceptingThread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
|
548f1699-5b03-48b2-89d7-9d05eac7dd06
| 0
|
@Override
public String toString() {
return "\nUser [id=" + getId() + ", " + firstName + " " + lastName + ", email: "
+ email + ", " + role + "]";
}
|
e2dd3b81-1588-4c3c-b590-16f248195904
| 4
|
private File ensureFolder( final File folder ) {
if( folder.exists() ) {
if( !folder.isDirectory() ) {
throw new IllegalArgumentException( "Given path " + folder.getAbsolutePath() + " is not a directory." );
}
if( !folder.canWrite() ) {
throw new IllegalArgumentException( "Can't write into directory " + folder.getAbsolutePath() );
}
}
else {
if( folder.mkdirs() == false ) {
throw new IllegalArgumentException( "Can't create directory " + folder.getAbsolutePath() );
}
}
return folder;
}
|
232fa443-67b1-4e45-aaa2-014e97c40e05
| 5
|
private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(delimiter).length == 2) {
final String remoteVersion = title.split(delimiter)[1].split(" ")[0]; // Get the newest file's version number
if (this.hasTag(localVersion) || !this.shouldUpdate(localVersion, remoteVersion)) {
// We already have the latest version, or this build is tagged for no-update
this.result = Updater.UpdateResult.NO_UPDATE;
return false;
}
} else {
// The file's name did not contain the string 'vVersion'
final String authorInfo = this.plugin.getDescription().getAuthors().size() == 0 ? "" : " (" + this.plugin.getDescription().getAuthors().get(0) + ")";
this.plugin.getLogger().warning("The author of this plugin" + authorInfo + " has misconfigured their Auto Update system");
this.plugin.getLogger().warning("File versions should follow the format 'PluginName vVERSION'");
this.plugin.getLogger().warning("Please notify the author of this error.");
this.result = Updater.UpdateResult.FAIL_NOVERSION;
return false;
}
}
return true;
}
|
2c46e1fc-73dc-4e8e-a70f-2ffd060a43c2
| 1
|
public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
writer.print("try");
writer.openBrace();
writer.tab();
subBlocks[0].dumpSource(writer);
writer.untab();
for (int i = 1; i < subBlocks.length; i++)
subBlocks[i].dumpSource(writer);
writer.closeBrace();
}
|
911a82a9-50a4-431c-98b6-5e6d0380c75c
| 9
|
protected StringBuilder appendIntValue(StringBuilder sb) {
if ("0".equals(number)) {
return sb.append(style.getNumbersText()[0]);
}
int length = number.length();
// 计算cell的个数
int size = length >> 2;
if (length % 4 != 0) {
size++;
}
// 循环截取4位数字字符串组装成cell,放入List中
List<Cell> cells = new ArrayList<Cell>(size);
do {
int startIndex = length - 4;
if (startIndex < 0) { // 如果开始索引小于0,重置为0
startIndex = 0;
}
Cell cell = new Cell(number.substring(startIndex, length), style);
cells.add(cell);
} while ((length -= 4) > 0);
// 反向迭代cell,从高位到低位取出
int index = size;
boolean leftEndWithZero = false; // 指示当前计算单元左侧的单元是否以0结尾
while (index-- > 0) {
Cell cell = cells.get(index);
if (cell.chinese.length() > 0) {
if (leftEndWithZero || cell.startWithZero) {
sb.append(style.getNumbersText()[0]);
}
sb.append(cell.chinese);
if (index > 0) { // 如果不是最后一个单元,并且当前单位不全是0,则追加单位'亿'或'万'
sb.append(CHINESE_BIG_UNITS[index & 1]);
}
}
leftEndWithZero = cell.endWithZero; // 传递给循环外的变量保存,便于下一个计算单元进行判断
}
return sb;
}
|
3248efb6-71ec-4525-92f7-b303e6d0621c
| 5
|
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Spot spot = (Spot) o;
if (col != spot.col) return false;
if (row != spot.row) return false;
return true;
}
|
be59456b-d394-4d75-8dc8-c37bd2e26aed
| 8
|
protected void getEvidenceDetail(String title) {
if (title != null) {
for (int i = 0; i < evidenceResultList.size(); i++) {
if (evidenceResultList.get(i).getTitle().equals(title)) {
if (!(evidenceResultList.get(i).getDescription() == null
|| evidenceResultList.get(i).getDescription().equals("null"))) {
descriptionJtxa.setText(evidenceResultList.get(i).getDescription());
}
evidenceCurrent = evidenceResultList.get(i);
if (evidenceCurrent.getParentClaim() != null) {
parentContentJlbl.setText(evidenceCurrent.getParentClaim().getTitle()); // Store parent title
parentIdJlbl.setText(evidenceCurrent.getParentClaim().getId()); // Store Parent id
} else {
parentContentJlbl.setText("None");
}
dialogContentJlbl.setText(evidenceCurrent.getDialogState());
playerContentJlbl.setText(evidenceCurrent.getName());
if (evidenceCurrent.getName().equals(userLogin.getName())
&& evidenceCurrent.getDialogState().equals("Private")) {
editDetailsJbtn.setEnabled(true);
deleteActionJbtn.setEnabled(true);
} else {
editDetailsJbtn.setEnabled(false);
deleteActionJbtn.setEnabled(false);
}
break;
}
}
}
}
|
81f9f1c1-e44e-4c7b-8140-ccafd466bcaf
| 6
|
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(BestaandPersoonFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(BestaandPersoonFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(BestaandPersoonFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(BestaandPersoonFrame.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 BestaandPersoonFrame().setVisible(true);
}
});
}
|
7900426c-dfc0-4e1d-a073-8457f53e7473
| 5
|
public void MI(HashMap<String, _stat> featureStat, int[] classMemberNo){
m_selectedFeatures.clear();
double[] PrCi = new double[classMemberNo.length];
double[] ItCi = new double[classMemberNo.length];
double N = Utils.sumOfArray(classMemberNo);
double Iavg = 0;
for (int i = 0; i < classMemberNo.length; i++)
PrCi[i] = classMemberNo[i] / N;
for (String f : featureStat.keySet()) {
// Filter the features which have smaller DFs.
int sumDF = Utils.sumOfArray(featureStat.get(f).getDF());
if (sumDF > m_minDF && sumDF < m_maxDF) {
Iavg = 0;
for (int i = 0; i < classMemberNo.length; i++) {
_stat temp = featureStat.get(f);
double A = temp.getDF()[i];
ItCi[i] = Math.log(A * N / classMemberNo[i]
* Utils.sumOfArray(temp.getDF()));
Iavg += ItCi[i] * PrCi[i];
}
m_selectedFeatures.add(new _RankItem(f, Iavg));
}
}
}
|
b6649ef5-ccf2-4eb6-b189-34b79f0d8092
| 3
|
public int compute()
{
subSequence[0] = seq[0];
len = 1;
for (int i = 1; i < seq.length; i++) {
if (seq[i] > subSequence[len-1]) {
subSequence[len++] = seq[i];
} else if (seq[i] < subSequence[0]) {
subSequence[0] = seq[i];
} else {
int index = findPos(subSequence, 0, len-1, seq[i]);
subSequence[index] = seq[i];
}
}
return (len);
}
|
2964490e-332d-4ea0-9c98-b6089d873ce3
| 7
|
private void handleLoginLogoutButtonPressed(ActionEvent e) {
if (loginLogoutButton.getText().equals("Log In")) {
String serverName = serverBox.getValue();
String version = versionBox.getValue();
String userName = userField.getText();
if (userName == null || userName.length() == 0) {
return;
}
String password = passwordField.getText();
if (password == null || password.length() == 0) {
return;
}
String serverUrl = SERVERS.get(serverName);
// Possibly logged into a different account than
// the account being logged into now.
if (application.enterpriseConnection().get() != null) {
// TODO: Add comparison of credentials to avoid needless
// logout. If credentials are the same then simply return.
logout();
}
final LoginWorker loginWorker = new LoginWorker(serverUrl, version, userName, password);
loginWorker.setOnSucceeded(es -> {
LoginWorkerResults loginResults = loginWorker.getValue();
if (loginResults.isSuccess()) {
application.enterpriseConnection().set(loginResults.getEnterpriseConnection());
application.metadataConnection().set(loginResults.getMetadataConnection());
application.apiVersion().set((new Double(version)).doubleValue());
application.userInfo().set(loginResults.getUserInfo());
loginStatus.setFill(Color.GREEN);
loginLogoutButton.setText("Log Out");
}
else {
application.enterpriseConnection().set(null);
application.metadataConnection().set(null);
loginStatus.setFill(Color.RED);
}
application.getLogController().log(loginResults.getLogHandler());
});
new Thread(loginWorker).start();
}
else {
logout();
loginLogoutButton.setText("Log In");
}
}
|
24c2f84e-0430-4122-b485-ba19ca91f40a
| 9
|
private void readAndDecompress() throws IOException {
// Read the length of the compressed block
int ch1 = in.read();
int ch2 = in.read();
int ch3 = in.read();
int ch4 = in.read();
if ((ch1 | ch2 | ch3 | ch4) < 0)
throw new EOFException();
inLength = ((ch1 << 24) + (ch2 << 16) +
(ch3 << 8) + (ch4 << 0));
ch1 = in.read();
ch2 = in.read();
ch3 = in.read();
ch4 = in.read();
if ((ch1 | ch2 | ch3 | ch4) < 0)
throw new EOFException();
outLength = ((ch1 << 24) + (ch2 << 16) +
(ch3 << 8) + (ch4 << 0));
// Make sure we've got enough space to read the block
if ((inBuf == null) || (inLength > inBuf.length)) {
inBuf = new byte[inLength];
}
if ((outBuf == null) || (outLength > outBuf.length)) {
outBuf = new byte[outLength];
}
// Read until we're got the entire compressed buffer.
// read(...) will not necessarily block until all
// requested data has been read, so we loop until
// we're done.
int inOffs = 0;
while (inOffs < inLength) {
int inCount =
in.read(inBuf, inOffs, inLength - inOffs);
if (inCount == -1) {
throw new EOFException();
}
inOffs += inCount;
}
inflater.setInput(inBuf, 0, inLength);
try {
inflater.inflate(outBuf);
}
catch(DataFormatException dfe) {
throw new IOException(
"Data format exception - " +
dfe.getMessage());
}
// Reset the inflator so we can re-use it for the
// next block
inflater.reset();
outOffs = 0;
}
|
70373764-6873-4974-8565-acaf15abd176
| 6
|
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
}
|
f566de80-6ab1-4cce-8e8b-071548630b6d
| 7
|
@Override
public Line localOptimize()
{
for (int i = 0; i < conditions.size();)
{
conditions.set(i, conditions.get(i).localOptimize());
if (conditions.get(i) instanceof ExpressionLiteral)
{
Value conditionValue = ((ExpressionLiteral) conditions.get(i)).getValue();
if (conditionValue instanceof BooleanValue)
{
if (conditionValue == BooleanValue.TRUE)
return blocks.get(i).localOptimize();
else
{
conditions.remove(i);
blocks.remove(i);
continue;
}
}
else
throw new OptimizedException(new SyntaxError("Expected a boolean for if statement condition: " + conditionValue));
}
if (blocks.get(i) != null)
blocks.set(i, (Block) blocks.get(i).localOptimize());
i++;
}
if (elseBlock != null)
elseBlock = (Block) elseBlock.localOptimize();
if (conditions.size() == 0)
return elseBlock;
return this;
}
|
b82f86a4-bfdc-4636-93e6-3bae4af470eb
| 9
|
public synchronized static Integer getValue(Object layout, String key, int type)
{
Integer ret = null;
boolean cont = true;
for (int i = LAYOUTS.size() - 1; i >= 0; i--) {
Object l = LAYOUTS.get(i).get();
if (ret == null && l == layout) {
int[] rect = VALUES_TEMP.get(i).get(key);
if (cont && rect != null && rect[type] != LayoutUtil.NOT_SET) {
ret = rect[type];
} else {
rect = VALUES.get(i).get(key);
ret = (rect != null && rect[type] != LayoutUtil.NOT_SET) ? rect[type] : null;
}
cont = false;
}
if (l == null) {
LAYOUTS.remove(i);
VALUES.remove(i);
VALUES_TEMP.remove(i);
}
}
return ret;
}
|
a6114e04-3e2f-4f03-ab54-c634cc8e6971
| 3
|
@Override
public Move makeAMove() {
// Send make a move request over network then wait
this.send("YOUR-TURN");
String result;
try {
result = this.inStream.readLine();
if (result == null) {
return null;
}
String[] cmdTokens = result.split(" ");
if (cmdTokens[0].equals("PLAY")) {
return new Move(Integer.parseInt(cmdTokens[1]),
Integer.parseInt(cmdTokens[2]), this);
} else {
// TODO some error handling here. perhaps a resend would be
// appropriate?
return this.makeAMove();
}
} catch (IOException ex) {
}
return null;
}
|
0ee7a940-f35f-4f07-939b-8433a7a22027
| 4
|
public void runGroup(GroupSettings settings, boolean printResult, boolean printEmpty)
{
if(settings.warnOnly())
return;
EntityConcentrationMap map = new EntityConcentrationMap(settings, this);
for(World world : Bukkit.getWorlds())
{
if(allowWorldGlobal(world) && settings.allowWorld(world))
map.queueWorld(world);
}
map.build(new EntityRemover(settings, getLogger(), printResult, printEmpty));
}
|
0cf15200-1448-43c3-b47f-67998aa2d0b6
| 0
|
public void setActivity(String activity) {
this.activity = activity;
}
|
7343812a-3896-470a-a4d1-1291724615b1
| 1
|
public static String encodeURIComponent(String s)
{
String result = null;
try
{
result = URLEncoder.encode(s, "UTF-8")
.replaceAll("\\+", "%20")
.replaceAll("\\%21", "!")
.replaceAll("\\%27", "'")
.replaceAll("\\%28", "(")
.replaceAll("\\%29", ")")
.replaceAll("\\%7E", "~");
}
// This exception should never occur.
catch (UnsupportedEncodingException e)
{
result = s;
}
return result;
}
|
b5708745-e895-4f50-a866-c9602840ba9a
| 2
|
public final synchronized BigDecimal readBigDecimal(){
this.inputType = true;
String word="";
BigDecimal big = null;
if(!this.testFullLineT) this.enterLine();
word = nextWord();
if(!eof)big = new BigDecimal(word.trim());
return big;
}
|
fbe7d3c3-d983-4915-a632-d72a7c8c368e
| 1
|
public SignatureVisitor visitExceptionType() {
if (exceptions == null) {
exceptions = new StringBuffer();
} else {
exceptions.append(", ");
}
// startType();
return new TraceSignatureVisitor(exceptions);
}
|
c0136239-9baf-4a2f-91ec-e40ea1351462
| 5
|
public static String Base64EncodedStringFromString(String string) {
byte[] data = string.getBytes();
int length = data.length;
byte[] input = data;
byte[] output = new byte[((length + 2) / 3) * 4];
for (int i = 0; i < length; i += 3) {
int value = 0;
for (int j = i; j < (i + 3); j++) {
value <<= 8;
if (j < length) {
value |= (0xFF & input[j]);
}
}
String kBase64EncodingTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int idx = (i / 3) * 4;
output[idx + 0] = (byte) kBase64EncodingTable.charAt((value >> 18) & 0x3F);
output[idx + 1] = (byte) kBase64EncodingTable.charAt((value >> 12) & 0x3F);
output[idx + 2] = (byte) ((i + 1) < length ? kBase64EncodingTable.charAt((value >> 6) & 0x3F) : '=');
output[idx + 3] = (byte) ((i + 2) < length ? kBase64EncodingTable.charAt((value >> 0) & 0x3F) : '=');
}
return new String(output);
}
|
aa91f38b-2e30-4a15-b536-a478af5592ab
| 0
|
private void printSimpleString(Graphics2D g2d, String s, int width, int XPos, int YPos){
int stringLen = (int)
g2d.getFontMetrics().getStringBounds(s, g2d).getWidth();
int start = width/2 - stringLen/2;
g2d.drawString(s, start + XPos, YPos);
}
|
006ab8b4-dfe6-47e5-af48-630238135276
| 0
|
public int GetTimeDeliverd()
{
return timeDelivered;
}
|
63d804a9-bd68-46a7-9682-d3b613fce680
| 2
|
public static boolean isPlate(int itemID)
{
for (int i=0; i<platebody.length; i++)
if (platebody[i] == itemID)
return true;
return false;
}
|
91831b10-ffb3-4d7e-9b39-b6cb19dc109f
| 1
|
public void print()
{
System.out.println("#nodes:" + this.nodes.size() + " #edges:"+ this.edges.size());
for (Edge oneEdge : this.edges.values())
{
oneEdge.print();
System.out.println("");
}
}
|
7e9cb821-c954-4e1f-97ea-7af8e8476a31
| 5
|
public static String encodeParameters(PostParameter[] httpParams) {
if (null == httpParams) {
return "";
}
StringBuffer buf = new StringBuffer();
for (int j = 0; j < httpParams.length; j++) {
if (httpParams[j].isFile()) {
throw new IllegalArgumentException("parameter [" + httpParams[j].name + "]should be text");
}
if (j != 0) {
buf.append("&");
}
try {
buf.append(URLEncoder.encode(httpParams[j].name, "UTF-8"))
.append("=").append(URLEncoder.encode(httpParams[j].value, "UTF-8"));
} catch (java.io.UnsupportedEncodingException neverHappen) {
}
}
return buf.toString();
}
|
25f41f76-4701-4c0a-a325-0f07e5273f73
| 3
|
@Override
public double[] get2DData(int px, int pz, int sx, int sz)
{
double[] d = f.get2DData(px, pz, sx, sz);
int s = sx * sz;
for (int i = 0; i < s; i++)
{
double n = d[i];
if (n < min)
n = min;
if (n > max)
n = max;
d[i] = n;
}
return d;
}
|
41eca377-54da-424a-bb35-43118a13a996
| 8
|
public static final int getMaxHit(Player player, int weaponId,
int attackStyle, boolean ranging, boolean usingSpec,
double specMultiplier) {
if (!ranging) {
int strengthLvl = player.getSkills().getLevel(Skills.STRENGTH);
double xpStyle = CombatDefinitions
.getXpStyle(weaponId, attackStyle);
double styleBonus = xpStyle == Skills.STRENGTH ? 3
: xpStyle == CombatDefinitions.SHARED ? 1 : 0;
double otherBonus = 1;
if (fullDharokEquipped(player)) {
double hp = player.getHitpoints();
double maxhp = player.getMaxHitpoints();
double d = hp / maxhp;
otherBonus = 2 - d;
}
double effectiveStrength = 8 + strengthLvl
* player.getPrayer().getStrengthMultiplier() + styleBonus;
if (fullVoidEquipped(player, 11665, 11676))
effectiveStrength *= 1.1;
double strengthBonus = player.getCombatDefinitions().getBonuses()[CombatDefinitions.STRENGTH_BONUS];
double baseDamage = 5 + effectiveStrength
* (1 + (strengthBonus / 64));
return (int) (baseDamage * specMultiplier * otherBonus);
} else {
double rangedLvl = player.getSkills().getLevel(Skills.RANGE);
double styleBonus = attackStyle == 0 ? 3 : attackStyle == 1 ? 0 : 1;
double otherBonus = 1;
double effectiveStrenght = (rangedLvl
* player.getPrayer().getRangeMultiplier() * otherBonus)
+ styleBonus;
if (fullVoidEquipped(player, 11664, 11675))
effectiveStrenght += (player.getSkills().getLevelForXp(
Skills.RANGE) / 5) + 1.6;
double strengthBonus = player.getCombatDefinitions().getBonuses()[CombatDefinitions.RANGED_STR_BONUS];
double baseDamage = 5 + (((effectiveStrenght + 8) * (strengthBonus + 64)) / 64);
return (int) (baseDamage * specMultiplier);
}
}
|
f8133f6e-ec7f-442f-9a63-bd71f894cd90
| 2
|
NewsSearchResponse(JSONObject jsonObject) {
super(jsonObject);
if (this.Count > 0) {
JSONArray results = (JSONArray) jsonObject.get("results");
@SuppressWarnings("unchecked") Iterator<JSONObject> iterator = results.iterator();
while (iterator.hasNext()) {
Results.add(new NewsResult(iterator.next()));
}
}
}
|
207c9b00-77a2-4b6a-96da-b8d9e526178c
| 2
|
public static int getMF(String name) {
String s = (String) getCache(60 * 60 * 24 * 365).get("namelist");
if (s == null) {
WakeBackends wb = new WakeBackends();
wb.memSet();
s = (String) WikiUtil.getCache(60 * 60 * 24 * 365).get("namelist");
}
Pattern p_name = Pattern.compile("^.*?" + name.split("[ __]")[0]
+ ",[^,]*,([^,]+),.*$");
Matcher m_name = p_name.matcher(s);
if (m_name.find())
return Integer.parseInt(m_name.group(1));
else
return 100;
}
|
ad68dada-9ed6-4c20-8d47-86fc3590f836
| 3
|
@Override
public void setAccounts(Accounts accounts) {
this.accounts = accounts;
boolean active = accounts != null;
if (accountTypes != null) {
for (AccountType type : accountTypes.getBusinessObjects()) {
JCheckBox checkBox = boxes.get(type);
checkBox.setSelected(selectedAccountTypes.get(type));
checkBox.setEnabled(active);
}
}
accountManagement.setEnabled(active);
addAccount.setEnabled(active);
if (active) {
fireAccountDataChanged();
}
}
|
46581c6c-231e-4cf8-9380-a403297b4b45
| 7
|
private void writeDescriptor()
{
OutputStream resourceOut = null;
XMLStreamWriter xml = null;
String resourceName = PERSISTENCE_FILE;
try
{
final FileObject resource = filer.createResource(
StandardLocation.CLASS_OUTPUT, "", PERSISTENCE_FILE);
resourceName = resource.getName();
resourceOut = resource.openOutputStream();
xml = XMLOutputFactory.newFactory().createXMLStreamWriter(
resourceOut, PERSISTENCE_FILE_ENCODING);
xml.writeStartDocument(PERSISTENCE_FILE_ENCODING, PERSISTENCE_XML_VERSION);
xml.writeCharacters(EOL);
xml.writeComment(PERSISTENCE_FILE_COMMENT);
xml.writeCharacters(EOL);
xml.writeStartElement(PERSISTENCE_ELEMENT);
xml.writeDefaultNamespace(PERSISTENCE_NS_URI);
xml.writeNamespace(XMLSCHEMA_NS_PREFIX, XMLSCHEMA_NS_URI);
xml.writeAttribute(
XMLSCHEMA_NS_URI,
XMLSCHEMA_LOCATION_ATTR,
PERSISTENCE_XMLSCHEMA_LOCATION
);
xml.writeAttribute(
PERSISTENCE_VERSION_ATTR,
PERSISTENCE_VERSION
);
for (PUData unit : units.values())
{
unit.writeXMLStream(xml);
messager.printMessage(Diagnostic.Kind.OTHER,
"Created descriptor for persistence unit " + unit.getName());
}
xml.writeCharacters(EOL);
xml.writeEndElement();
xml.writeCharacters(EOL);
xml.writeEndDocument();
}
catch (IOException ioerr)
{
messager.printMessage(Diagnostic.Kind.ERROR,
"Error writing " + resourceName + ": " + ioerr.getLocalizedMessage());
}
catch (Exception e)
{
messager.printMessage(Diagnostic.Kind.ERROR,
"Error formatting XML for " + resourceName + ": " + e.getLocalizedMessage());
}
finally
{
if (null != xml)
try { xml.close(); }
catch (Exception err)
{
messager.printMessage(Diagnostic.Kind.ERROR,
"Error closing XML output for " + resourceName + ": " + err.getLocalizedMessage());
}
if (null != resourceOut)
try { resourceOut.close(); }
catch (Exception err)
{
messager.printMessage(Diagnostic.Kind.ERROR,
"Error closing file " + resourceName + ": " + err.getLocalizedMessage());
}
}
}
|
54876864-f200-4bf3-843f-e52998dfd86b
| 9
|
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),auto?L("<T-NAME> become(s) filled with a need to tithe!"):L("^S<S-NAME> @x1 for <T-YOUPOSS> need to tithe!^?",prayWord(mob)));
final CMMsg msg3=CMClass.getMsg(mob,target,this,CMMsg.MSK_CAST_MALICIOUS_VERBAL|CMMsg.TYP_MIND|(auto?CMMsg.MASK_ALWAYS:0),null);
if((mob.location().okMessage(mob,msg))&&(mob.location().okMessage(mob,msg3)))
{
mob.location().send(mob,msg);
mob.location().send(mob,msg3);
if((msg.value()<=0)&&(msg3.value()<=0))
maliciousAffect(mob,target,asLevel,0,-1);
}
}
else
return maliciousFizzle(mob,null,L("<S-NAME> @x1 for <T-YOUPOSS> tithing need but there is no answer.",prayWord(mob)));
// return whether it worked
return success;
}
|
b67c0748-2f5c-45da-ad38-2bc5da9055ad
| 4
|
@Override
public boolean execute(CommandSender sender, String[] args)
{
if(sender instanceof ConsoleCommandSender == false)
{
return true;
}
if(args.length != 3)
{
// Ignore, its the console anyway
//sender.sendMessage(RED+"Incorrect syntax: /plot addmember <owner> <member>");
return true;
}
for(String chunk : p.getChunkManager().getOwnedChunks(args[1]))
{
if(p.getChunkManager().removeMember(chunk, args[2]))
{
//sender.sendMessage(GREEN+"Member "+args[2]+" removed from "+chunk);
}
else
{
//sender.sendMessage(RED+"Failed to remove member "+args[2]+" from "+chunk+". Was he a member?");
}
}
return true;
}
|
10bcddf6-0052-4759-82ad-053f2fdda3f3
| 1
|
private void popTurtleStack() {
try {
Turtle lt = (Turtle) turtleStack.pop();
lt.updateBounds(currentTurtle);
currentTurtle = lt;
g.setColor(currentTurtle.getColor());
g.setStroke(currentTurtle.getStroke());
} catch (EmptyStackException e) {
// We just ignore it.
}
}
|
15ca956a-265d-40f1-8b21-db6a1ed769f2
| 2
|
void t2dGenes(VcfEntry ve) {
if ((ve.getId() == null) || ve.getId().isEmpty()) ve.addInfo(T2D_GENES);
}
|
1cb5194c-a1a9-4b41-875c-52ad0517ed6a
| 7
|
public List<File> buildFont( String internalName, FileGarbage garbage ) throws IOException {
File tempDir = File.createTempFile( "fonts", ".tmp" );
tempDir.delete();
tempDir.mkdirs();
garbage.addFile( tempDir, true );
File binDir = new File( "bin" );
File binFile = new File( binDir, "ttf2tfm" );
File encFile = new File( "resources/T1-WGL4.enc" );
//File glyphFile = new File( "resources/glyphlist.rpl" );
File inputFile = new File( tempDir, mSourceFile.getName().replace( ' ', '_' ) );
File vplFile = new File( tempDir, internalName + ".vpl" );
File mapFile = new File( tempDir, internalName + ".map" );
File outFile = new File( tempDir, internalName + ".tfm" );
NativeFiles.copy( mSourceFile, inputFile );
File tempFile = encFile;
encFile = new File( tempDir, encFile.getName() );
NativeFiles.copy( tempFile, encFile );
List<String> cmd = new ArrayList<String>();
cmd.add( binFile.getAbsolutePath() );
cmd.add( inputFile.getName() );
cmd.add( "-p");
cmd.add( encFile.getName() );
// cmd.add( "-R" );
// cmd.add( glyphFile.getAbsolutePath() );
if( mExtend != 1.0 ) {
cmd.add( "-e" );
cmd.add( Double.toString( mExtend ) );
}
if( mSlant != 0.0 ) {
cmd.add( "-s" );
cmd.add( Double.toString( mSlant ) );
}
if( mSmallcaps ) {
cmd.add( "-V" );
}else{
cmd.add( "-v" );
}
cmd.add( vplFile.getName() );
cmd.add( outFile.getName() );
String mapString;
try {
mapString = TranslatorUtil.exec( cmd, binDir, tempDir, true, true );
} catch( InterruptedException ex ) {
InterruptedIOException e = new InterruptedIOException();
e.initCause( ex );
throw e;
}
// Create MAP file.
{
PrintWriter out = new PrintWriter( mapFile );
out.format( "%s %s %s <%s <%s\n",
internalName,
mFontName,
"\" T1Encoding ReEncodeFont \"",
encFile.getName(),
inputFile.getName() );
out.close();
}
File[] files = tempDir.listFiles();
List<File> ret = new ArrayList<File>();
assert files != null;
for( File f : files ) {
if( f.isFile() && !f.isHidden() ) {
ret.add( f );
}
}
return ret;
}
|
9de5762e-d4e5-4efd-92dc-d720a31182d5
| 7
|
public static boolean checkMathAssign(Type p1, Type p2) {
if (p1 == null || p2 == null) {
return false;
}
return p1 == Type.Fixed && p2 == Type.Integer || p1 == Type.Fixed && p2 == Type.Fixed || p1 == Type.Integer && p2 == Type.Integer;
}
|
168c1a96-ae11-47a6-bf8f-a890c45452fa
| 0
|
public static HTTPResponse notFound()
{
return new HTTPResponse(404, "<h1>Not Found</h1>The requested URL was not found.");
}
|
49f875af-1976-4e80-8815-bb6743db990a
| 9
|
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Edge))
return false;
Edge other = (Edge) obj;
if (u == null) {
if (other.u != null)
return false;
} else if (!u.equals(other.u))
return false;
if (v == null) {
if (other.v != null)
return false;
} else if (!v.equals(other.v))
return false;
return true;
}
|
8ebc2fe6-1416-4977-a8b7-c2558fcf7485
| 4
|
/* */ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
/* */ {
/* 14 */ if (((sender instanceof Player)) && ((sender.hasPermission("ghost.noclip:")) || (sender.getName().equalsIgnoreCase("gateklaas"))))
/* */ {
/* 16 */ PlayerListener.toggleGhostMode((Player)sender);
/* */
/* 18 */ if (PlayerListener.getGhostMode((Player)sender))
/* 19 */ sender.sendMessage("Ghost mode on");
/* */ else {
/* 21 */ sender.sendMessage("Ghost mode off");
/* */ }
/* 23 */ return true;
/* */ }
/* */
/* 27 */ sender.sendMessage("You need permission: ghost.noclip");
/* 28 */ return false;
/* */ }
|
0335681b-c702-4852-9209-8b07950a5e6c
| 4
|
public void magnify(){
if(magnifyingLevel == 0.25){
setMagnifyingLevel(0.5);
}else if(magnifyingLevel == 0.5){
setMagnifyingLevel(1);
}else if(magnifyingLevel == 1){
setMagnifyingLevel(1.5);
}else if(magnifyingLevel == 1.5){
setMagnifyingLevel(2.5);
}
}
|
99a9fd65-c2cb-46d0-8689-f4dd33b9a0a4
| 0
|
public Integer getContestId() {
return this.contestId;
}
|
20a0a87f-c756-4119-b84c-c825f1a79542
| 6
|
private String getTagAsString(XMLTag tag) {
String tagStr = "";
if (tag instanceof PITag) {
PITag instruction = (PITag) tag;
if (instruction.getName().equals("easyxml")) {
tagStr += parseEasyXML(instruction.getValue());
}
} else {
tagStr = "<" + tag.getName();
for (String attrName : tag.getAttributes().keySet()) {
tagStr += " " + attrName + "=\"" + tag.getAttribute(attrName) + "\"";
}
tagStr += ">";
if (tag.hasChildren()) {
for (XMLTag child : tag.getChildren()) {
tagStr += getTagAsString(child);
}
} else if (tag.hasValue()) {
tagStr += tag.getValue();
}
tagStr += "</" + tag.getName() + ">";
}
return tagStr;
}
|
e16cf349-65e3-455f-9333-08c3681dd11b
| 3
|
public void fall() {
if(this.getWorld() != null) {
while(canFall() && this.getWorld().liesWithinBoundaries(this)) {
this.setPosition(new Position(this.getPosition().getX(), this.getPosition().getY() - this.getRadius()*0.1)); // fall with a little bit
}
}
}
|
ef41bc05-11dd-4e9c-97d8-b8a5b7337da8
| 4
|
private void editQuantity(Product product) {
String msg;
if (product instanceof WeighableProduct) {
msg = "Enter how many grams of " + product.getProductName()
+ " you want to remove";
} else {
msg = "Enter how many " + product.getProductName()
+ "s you want to remove";
}
String answer;
boolean nothing_entered = false;
do {
answer = JOptionPane.showInputDialog(msg);
if (answer == null | answer == "")
nothing_entered = true;
} while (!validateAlterCartQuantity(answer, product));
if (!nothing_entered) {
int amount = Integer.parseInt(answer);
ShoppingBasket.getBasketInstance().removeProduct(product, amount);
}
}
|
20c76529-d460-426d-9fc7-8876017bd372
| 1
|
final public Iterator<PropertyTree> getChildren() {
if(children==null)
return null;
return children.iterator();
}
|
404804de-67b0-4d60-914a-c8d6025c83ad
| 7
|
@Override
public float getWidth(char code, String name) {
// we don't have first and last chars, so therefore no width array
if (getFirstChar() == -1 || getLastChar() == -1) {
String key = chr2name[code & 0xff];
// use a name if one is provided
if (name != null) {
key = name;
}
if (key != null && name2outline.containsKey(key)) {
if (!name2width.containsKey(key)) {
// glyph has not yet been parsed
// getting the outline will force it to get read
getOutline(key, 0);
}
FlPoint width = name2width.get(key);
if (width != null) {
return width.x / getDefaultWidth();
}
}
return 0;
}
// return the width that has been specified
return super.getWidth(code, name);
}
|
827459d6-65fd-4548-bde0-07598171b941
| 1
|
public void test_printParseShortNameWithLookup() {
Map<String, DateTimeZone> lookup = new LinkedHashMap<String, DateTimeZone>();
lookup.put("GMT", LONDON);
lookup.put("BST", LONDON);
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd HH:mm ").appendTimeZoneShortName(lookup);
DateTimeFormatter f = bld.toFormatter().withLocale(Locale.ENGLISH);
assertEquals(true, f.isPrinter());
assertEquals(true, f.isParser());
DateTime dt1 = new DateTime(2011, 1, 4, 12, 30, 0, LONDON);
assertEquals("2011-01-04 12:30 GMT", f.print(dt1));
DateTime dt2 = new DateTime(2011, 7, 4, 12, 30, 0, LONDON);
assertEquals("2011-07-04 12:30 BST", f.print(dt2));
assertEquals(dt1, f.parseDateTime("2011-01-04 12:30 GMT"));
assertEquals(dt2, f.parseDateTime("2011-07-04 12:30 BST"));
try {
f.parseDateTime("2007-03-04 12:30 EST");
fail();
} catch (IllegalArgumentException e) {
}
}
|
87920b3c-40c1-4872-8591-7984c361c814
| 7
|
protected boolean isCallableMethod(Method m, Class<?> runClass) {
if (!runClass.equals(m.getDeclaringClass()))
return false;
if (!Modifier.isPublic(m.getModifiers()))
return false;
if (m.getParameterTypes().length != 0)
return false;
if (Modifier.isNative(m.getModifiers()))
return false;
if (Modifier.isStatic(m.getModifiers()))
return false;
if (Modifier.isFinal(m.getModifiers()))
return false;
return true;
}
|
a0590418-b232-41a2-a8b5-78c2706e1477
| 3
|
public int Winner() {
Set<Integer> remainingPlayers = new TreeSet<Integer>();
for (Planet p : planets) {
remainingPlayers.add(p.Owner());
}
switch (remainingPlayers.size()) {
case 0:
return 0;
case 1:
return ((Integer) remainingPlayers.toArray()[0]).intValue();
default:
return -1;
}
}
|
9c04ab5b-3341-435b-ac63-f23b2c2ff865
| 0
|
public String displayInfo() {
super.displayInfo();
//The getFood method is an example of encapsulation
return "Bears oh My!Bears are "+look+" fury and\neat a lot. Bears live in the "+location+" and\neats "+getFood();
}
|
6b9f7e27-054b-471d-b82e-f439ec764108
| 3
|
public User getUserByFacebookID(EntityManager em, long facebookID) {
User returnUser = null;
try {
TypedQuery<User> query = em.createQuery(
"from User u where u.facebookID = ?", User.class);
query.setParameter(1, facebookID);
List<User> result = query.getResultList();
if (result.isEmpty()) {
return returnUser;
} else {
if (result.size() > 1) {
System.out
.println("ERROR: We have ["
+ result.size()
+ "] Users that have the FacebookID of ["
+ facebookID
+ "]. I'll return the first one entered into the system");
return result.get(0);
} else {
// We returned 1 and only 1 User from the query
returnUser = result.get(0);
return returnUser;
}
}
} catch (Exception e) {
System.out
.println("Encountered error in getUserByFacebookID function : "
+ e);
return returnUser;
}
}// getPlayerByFacebookID
|
d798354b-c08b-47fd-90a0-4b065ebb0350
| 1
|
public Texture(String fileName)
{
this.m_fileName = fileName;
TextureResource oldResource = s_loadedTextures.get(fileName);
if(oldResource != null)
{
m_resource = oldResource;
m_resource.AddReference();
}
else
{
m_resource = LoadTexture(fileName);
s_loadedTextures.put(fileName, m_resource);
}
}
|
0ad819e5-a755-49fd-b847-f729f57b5dbf
| 7
|
public static void main(String[] args)
{
Item ourCounter = new Item("Team Counter", 150);
try
{
Vector<Thing> things = new Vector<Thing>();
for (int i = 1; i < 5; i++)
{
Thing t = new Thing();
t.setCode(String.valueOf(i));
t.setDescription("Description of " + i);
t.setValue(new BigDecimal(i * i));
things.addElement(t);
}
Person p1 = new Person();
p1.setName("Ken");
p1.setThings(things);
p1.setCounter(ourCounter);
Person p2 = (Person) p1.clone();
p2.setName("Ralph");
Vector<Thing> things2 = p2.getThings();
for (int i = 1; i < 5; i++)
{
Thing t = (Thing) things2.elementAt(i - 1);
t.setCode(String.valueOf(i * 10));
t.setDescription("Description of " + i * 10);
t.setValue(new BigDecimal(i * i * 10));
}
System.out.println("Person 1:" + p1.getName());
System.out.println(p1.getCounter());
for (int i = 0; i < p1.getThings().size(); i++)
{
System.out.println(p1.getThings().elementAt(i).toString());
}
System.out.println("Person 2:" + p2.getName());
System.out.println(p2.getCounter());
for (int i = 0; i < p2.getThings().size(); i++)
{
System.out.println(p2.getThings().elementAt(i).toString());
}
ourCounter.setCount(100);
System.out.println("Person 1:" + p1.getName());
System.out.println(p1.getCounter());
for (int i = 0; i < p1.getThings().size(); i++)
{
System.out.println(p1.getThings().elementAt(i).toString());
}
System.out.println("Person 2:" + p2.getName());
System.out.println(p2.getCounter());
for (int i = 0; i < p2.getThings().size(); i++)
{
System.out.println(p2.getThings().elementAt(i).toString());
}
}
catch (Exception e)
{
// TODO: handle exception
}
}
|
5c4e5864-a891-43c5-994e-857dc0e23a83
| 4
|
public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
this.writer.write(',');
}
this.writer.write(JSONObject.quote(string));
this.writer.write(':');
this.comma = false;
this.mode = 'o';
return this;
} catch (IOException e) {
throw new JSONException(e);
}
}
throw new JSONException("Misplaced key.");
}
|
e80d9903-9721-45a6-ac0b-86648b7817bd
| 9
|
public String getDataVisita(String abrev)
{
String aux="";
String SQL1 = "SELECT * FROM tuta_visitestutors WHERE abrev='"+abrev+"'";
try {
Statement st = client.getMysql().createStatement();
ResultSet rs1 = client.getMysql().getResultSet(SQL1);
while (rs1 != null && rs1.next()) {
int dia= rs1.getInt("dia");
int hora= rs1.getInt("hora");
switch(dia)
{
case (1): aux += "Dilluns";break;
case (2): aux += "Dimarts";break;
case (3): aux += "Dimecres";break;
case (4): aux += "Dijous";break;
case (5): aux += "Divendres";break;
}
aux += " de ";
aux += StringUtils.formatTime(client.getDatesCollection().getHoresClase()[hora-1]);
aux += " a ";
aux += StringUtils.formatTime(client.getDatesCollection().getHoresClase_fi()[hora-1]);
}
if(rs1!=null) {
rs1.close();
st.close();
}
} catch (SQLException ex) {
Logger.getLogger(FitxesUtils.class.getName()).log(Level.SEVERE, null, ex);
}
return aux;
}
|
a161390d-6a07-4911-914b-1f3ad2094fc2
| 8
|
private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
builder.append(chr);
break;
case '\b':
builder.append("\\b");
break;
case '\t':
builder.append("\\t");
break;
case '\n':
builder.append("\\n");
break;
case '\r':
builder.append("\\r");
break;
default:
if (chr < ' ') {
String t = "000" + Integer.toHexString(chr);
builder.append("\\u" + t.substring(t.length() - 4));
} else {
builder.append(chr);
}
break;
}
}
builder.append('"');
return builder.toString();
}
|
b25b90aa-2235-42d6-8840-28566cd0807b
| 8
|
public void putAll( Map<? extends Character, ? extends Float> map ) {
Iterator<? extends Entry<? extends Character,? extends Float>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Character,? extends Float> e = it.next();
this.put( e.getKey(), e.getValue() );
}
}
|
512b0466-2099-4c36-a7b4-967d49385865
| 4
|
@Override
public int hashCode() {
int result = item != null ? item.hashCode() : 0;
result = 31 * result + (item2 != null ? item2.hashCode() : 0);
result = 31 * result + (item3 != null ? item3.hashCode() : 0);
result = 31 * result + (item4 != null ? item4.hashCode() : 0);
return result;
}
|
778cab5a-02d4-472d-b7b5-2a211b4355a6
| 2
|
public PersonListItem(Person person) {
this.person = person;
givenName = person.getGivenName();
int bYear = person.getBirthYear();
int dYear = person.getDeathYear();
asString = givenName + " (" + ((bYear == 0) ? "?" : ""+bYear) + " - " +
((dYear == 0) ? "?" : ""+dYear) + ")";
}
|
57447a7a-fca3-490f-8a7e-3410a6e28788
| 6
|
public DemoLayout(int num) {
num = num < 1 ? 1 : num;
setTitle("DemoLayout application");
setSize(640, 480);
setLocation(100, 50);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
cp = getContentPane();
CardLayout cpl = new CardLayout();
cpl.setHgap(10);
cpl.setVgap(10);
// cp.setBackground(Color.red);
cp.setLayout(cpl);
BorderLayout bjp = new BorderLayout();
jp = new JPanel(bjp);
cp.add(jp, BorderLayout.CENTER);
pc = new JPanel(new GridLayout(4, 4));
////////////////////////////////
final BorderLayout jcp = new BorderLayout();
jp.setLayout(jcp);
/* MouseListener ml = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) jcp.next(jp);
else jcp.previous(jp);
}
};*/
LayoutManager lm = getLayout();
//((GridLayout)jp.getLayout()).setHgap(10);
//((GridLayout)jp.getLayout()).setVgap(10);
System.out.println("Current layout: " + lm.getClass().getCanonicalName());
ab = new JButton[num];
for (int i = 0; i < ab.length; i++) {
ab[i] = new JButton("Button #" + i);
// jp.add(ab[i]);
// ab[i].addMouseListener(ml);
switch (i) {
case 0:
jp.add(ab[i], BorderLayout.NORTH);
break;
case 1:
jp.add(ab[i], BorderLayout.EAST);
break;
case 2:
jp.add(ab[i], BorderLayout.SOUTH);
break;
case 3:
jp.add(ab[i], BorderLayout.WEST);
break;
default:
pc.add(ab[i], BorderLayout.CENTER);
}
}
jp.add(pc, BorderLayout.CENTER);
CreateMenu();
////////////////////////////////
setVisible(true);
}
|
1aab8b2f-94a7-45b1-a2d6-438eaed59783
| 5
|
@EventHandler (priority = EventPriority.NORMAL)
public void getInBed(final PlayerBedEnterEvent evt) {
// super accurate nanotime ?!
Long time = System.nanoTime();
String name = evt.getPlayer().getName();
if (Bukkit.getServer().getOnlinePlayers().length < 2) return;
if (slept.containsKey(name)) {
//check to see if currenttime - slepttime is different by 120m.
long sleptTime = slept.get(name);
long timeDifference = (time - sleptTime);
Integer minutes = (int) (timeDifference / 1000000000.0 / 60);
if (minutes >= 120) {
slept.remove(name);
slept.put(name, time);
for (Player pl : Bukkit.getServer().getOnlinePlayers()) {
pl.sendMessage(evt.getPlayer().getDisplayName() + " slept through the night!");
}
// evt.setCancelled(true);
evt.getPlayer().getWorld().setTime(0);
new BukkitRunnable() {
@Override
public void run() {
evt.getPlayer().teleport(
new Location(evt.getPlayer().getWorld(), evt.getPlayer().getLocation().getX() + 0.5D, evt.getPlayer().getLocation().getY() + 1.0D, evt.getPlayer().getLocation().getZ() + 0.5D),
PlayerTeleportEvent.TeleportCause.PLUGIN);
}
}.runTaskLater(plugin, 6*20L);
} else {
evt.getPlayer().sendMessage(
String.format("%s%sThe bed is comfortable, but it seems you can't fall asleep", ChatColor.BOLD, ChatColor.GRAY));
evt.getPlayer().sendMessage(
String.format("%s%sYou may try again in %d minutes!", ChatColor.ITALIC, ChatColor.DARK_GRAY, 120 - minutes));
// evt.setCancelled(true);
}
} else {
slept.put(name, time);
for (Player pl : Bukkit.getServer().getOnlinePlayers()) {
pl.sendMessage(evt.getPlayer().getDisplayName() + " slept through the night!");
}
// evt.setCancelled(true);
evt.getPlayer().getWorld().setTime(0);
evt.getPlayer().teleport(new Location(evt.getPlayer().getWorld(), evt.getPlayer().getLocation().getX() + 0.5D, evt.getPlayer().getLocation().getY() + 1.0D, evt.getPlayer().getLocation().getZ() + 0.5D));
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.