method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dbd95f2d-3d49-456e-9df2-532f886f23a8 | 3 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._expLogica_ == child)
{
this._expLogica_ = null;
return;
}
if(this._seV_.remove(child))
{
return;
}
if(this._senaoF_.... |
127a63ef-358e-4819-970c-eccf551544ec | 1 | protected static void setBackground(Path img) throws IOException, InterruptedException {
if (FileUtil.control(img)) {
FileUtil.deleteDirectory(SystemInformation.getBackgroundDirectory());
FileUtil.createDirectory(SystemInformation.getBackgroundDirectory());
FileUtil.scaleIma... |
45aa6d70-9e86-4444-9bcc-7c6300ae784c | 4 | private void btnAcceptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAcceptActionPerformed
String backupPath = txtPath.getText();
File filePath = new File(txtPath.getText().trim());
if (backupPath != null && !"".equals(backupPath.trim()) && filePath.exists()) {
Controller.setProperty(App... |
091dcaa9-14ab-4253-9f47-cd777222a16f | 1 | public void setReminderAhead(long uid, long reminderAhead)
throws SQLException {
Reminder reminder = Reminder.findByApptAndUser(this.getId(), uid);
if (reminder == null)
{
Reminder.create(this.getId(), uid, reminderAhead);
} else
{
reminder.reminderAhead = reminderAhead;
reminder.save();
}
} |
af5aa6dc-18cd-4303-ba39-d86af223296e | 8 | public void initializeComponents() {
setTitle("Barbeiro");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 678, 490);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPane = ne... |
8971f6e6-b68d-4dce-90d9-83639327c2f2 | 8 | private Integer[][] getLogicalMap(CustomizedArena arena,
int robotDiameterInCellNum) {
int rowCount = arena.getRowCount();
int columnCount = arena.getColumnCount();
Integer[][] logicalMap = new Integer[rowCount][columnCount];
//For each obstacle cell at Row i, Col j,
//Mark logicalMap[i ~ (i + robotDiam... |
874d108b-4797-4f54-9d2c-3a6a0f75d836 | 2 | @Override
public boolean parseArg(String[] values) {
if("server".equalsIgnoreCase(values[0])) {
Properties.Common.SIDE = Side.SERVER;
return true;
}
if("client".equalsIgnoreCase(values[0])) {
Properties.Common.SIDE = Side.CLIENT;
return true;
}
return false;
} |
3eacfc18-f533-416e-b970-fc360503ce13 | 3 | public HalfEdge findEdge (Vertex vt, Vertex vh)
{
HalfEdge he = he0;
do
{ if (he.head() == vh && he.tail() == vt)
{ return he;
}
he = he.next;
}
while (he != he0);
return null;
} |
da584bf7-0f0f-43e9-927c-e593660dc28c | 1 | public void setViewEnabled(String view, boolean enabled) {
String value = enabled ? "true" : "false";
rootElement.xpath("view/" + view).attr("value", value);
} |
12928dc9-3c19-4d62-9fe2-d6ae188485ff | 8 | @EventHandler(priority = EventPriority.NORMAL)
public void clickOnSign(PlayerInteractEvent e) {
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;
if (!e.hasBlock()) return;
if (!e.getClickedBlock().hasMetadata("rentals_sign")) return;
e.setCancelled(true);
Player ... |
1f21a445-8483-4e56-bce6-71c215c3be76 | 3 | public static void main(String[] args) throws InterruptedException, ExecutionException {
Future<Long> f = service.submit(new Callable<Long>() {
@Override
public Long call() throws Exception {
long r = 0;
for (int i = 0; i < 10; i++) {
r ++;
Thread.sleep(500);
}
return r;
}
});
... |
ffb22fb3-8203-491e-a8f0-7ab2132ab0bf | 1 | private void bReplaceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bReplaceActionPerformed
try {
App.ge.extractShapes(getGmlTextWrapped());
doClose(RET_REPLACE);
} catch (XMLStreamException ex) {
System.err.println(ex.getMessage());
JO... |
288b9b6a-fb16-4cbc-938e-a89baed96a7f | 4 | public static void addItem(int itemID, int itemX, int itemY, int itemAmount, int itemController, boolean itemStatic) {
for (int i = 0; i <= 5000; i++) { // Phate: Loop through all item spots
if(globalItemID[i] == 0) { // Phate: Found blank item spot
globalItemController[i] = itemController;
globalItemID... |
598b9456-5c06-4a44-a65b-998479b39525 | 9 | public Field findFieldWithAnnotationAttributeAndValue(Class<? extends Annotation> annotationClass,String attributeName, String attributeValue) {
for(Field field : getFields()) {
if(field.isAnnotationPresent(annotationClass)) {
Annotation annotation = field.getAnnotation(annotationClass);
try {
Method ... |
8bd62e0a-350b-49e9-af8d-2d50eff47cd1 | 6 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String se = e.getActionCommand();
if(se.equals("Browse"))
{
JFrame f = new JFrame("Select Location");
JFileChooser fc = new JFileChooser();
f.add(fc);
f.setVisible(true);
fc.setFileSelecti... |
c61b8fef-0720-4094-a2aa-b5dcb5cbf4ab | 8 | private Map<Integer, Double> getSimResources(int userID, int resID) {
Map<Integer, Double> resources = new LinkedHashMap<Integer, Double>();
// get all resources that have been tagged by the user
for (UserData data : this.trainList) {
if (data.getWikiID() != resID) {
if (userID == -1) {
resources.put(... |
11ec44cb-7e00-4d38-a63e-6c6e20a2ffa3 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
313c3340-e714-44d0-84a1-743474c11aa6 | 8 | @Override
/**
* Takes actions based on messages received
*/
public void receive(Message msg) {
super.receive(msg);
Command hdr = (Command) msg.getHeader(Command.HEADER_ID);
switch (hdr.command) {
case 's': // sync state
System.out.format(
"[%s] Received command to sync gameState from %s: %s%n",
... |
e9cf9072-f33c-4144-94a1-6d2300b920e4 | 7 | public ScreenshotGenerator(
final ThreadManager threadManager,
final Component guiComponent,
final File inputFile,
final String outputFilename,
final File outputDirectory,
boolean copyableSource,
final Dimension imageSize,
int quality,
double time
) {
super(threadManager, null, 1.0, 0);
... |
c8519704-6339-4824-b4cb-d478ed7aec7b | 8 | public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 133
// do, line 134
v_1 = cursor;
lab0: do {
// call prelude, line 134
if... |
e2e500a8-36ea-45d7-a291-53db1c84ab29 | 7 | private void checkAndAddMethod(SootMethod method, SootClass baseClass) {
AndroidMethod am = new AndroidMethod(method);
// Do not call system methods
if (am.getClassName().startsWith("android.")
|| am.getClassName().startsWith("java."))
return;
// Skip empty methods
if (method.isConcrete() && isEmpt... |
8a5e2561-6e0c-4574-9e0f-79ea941da6f1 | 3 | @Override
public synchronized boolean addUser(String username, UUID uuid) {
removeUser(username, uuid);
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(OnlineUsers.directory+OnlineUsers.flatfileData, true));
bw.newLine();
bw.append(username+":"+System.currentTimeMillis()+":"+Strin... |
2b5c7d4f-ee44-4b9b-ac98-978519d53db7 | 8 | private CarType carSizeParse(String a) {
if (a.equals(CarType.CONVERTIBLE.toString())) {
return CarType.CONVERTIBLE;
}else
if (a.equals(CarType.COUPE.toString())) {
return CarType.COUPE;
}else
if (a.equals(CarType.HATCHBACK.toString())) {
return CarType.HATCHBACK;
}else
if (a.equals(CarType.LI... |
26ec5f3a-3f30-4dd8-a6fa-d432733139a9 | 5 | public void assignCourses()
{
ArrayDeque<Instructor> theQueue = new ArrayDeque<Instructor>(instructors.values());
while(!theQueue.isEmpty())
{
Instructor instructor = theQueue.poll();
boolean assigned = false;
while(!assigned)
{
... |
2a879efe-bd40-492d-8b78-40c0d93fe24c | 2 | public double[] columnMedians(){
double[] medians = new double[this.numberOfRows];
for(int i=0; i<this.numberOfColumns; i++){
double[] hold = new double[this.numberOfRows];
for(int j=0; j<this.numberOfRows; j++){
hold[i] = this.matrix[j][i];
... |
aa980079-11b6-477c-bba9-687cb0a59b3b | 9 | public void reset(Graphics g) {
check();
g.setColor(Colors.lightgrey);
g.fillRect(scale, scale, length * scale, width * scale);
g.drawImage(field, scale, scale, length * scale, width * scale, board);
for (int x = 0; x < width; x++) {
for (int y = 0; y < length; y++) ... |
2332178c-373e-4fa6-9d01-eb50e6eb5173 | 8 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((created == null) ? 0 : created.hashCode());
result = prime * result
+ ((emagVoucherId == null) ? 0 : emagVoucherId.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prim... |
68ba04e7-2080-4efd-a1cf-c03c9c751c37 | 1 | public void deletePlayerFromMarker(String userName){
try {
cs = con.prepareCall("{call DELETE_PLAYER_FROM_MARKER(?)}");
cs.setString(1, userName);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} |
600d24e2-1f58-4a4d-9183-07edd8cd886b | 9 | public String buildInsertFor (T entity) {
StringBuilder sql = new StringBuilder(insertInstruction);
Object value = null;
for (Field field : columnMappings.keySet()) {
String column = columnMappings.get(field);
int replaceStart = sql.indexOf(":" + column);
int replaceEnd = replaceStart + column.len... |
a64951f8-d1ec-4d81-95f7-f1ee57234f14 | 6 | private void field_codigoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_codigoFocusLost
// TODO add your handling code here:
//if (field_codigo.isEditable()){
if (field_codigo.isEditable() && (lab_modo.getText().equals("Alta"))){
if ((evt.getOppositeComponent()!=... |
34f41105-effe-465f-abdc-8342b6bc4628 | 3 | public int parseAtom() throws IOException {
Element localRoot = IRT.createElement(String.valueOf(Tags.ATOM));
curRootElement.appendChild(localRoot);
curRootElement = localRoot;
int result;
if (curToken.type == Lexer.Type.NUMBER) {
result = Integer.parseInt(curToken.c... |
e08f4a70-d374-4fef-a678-ff75d469afe6 | 4 | public void process(ByteBuffer buffer, Client sockector){
if(sockector.isHandShak()){// 已经握手处理
// 通过复杂的数据帧格式来传递数据
parser(buffer,sockector);
}else{// 进行握手处理
String msg = CoderUtils.decode(buffer);
if(MyStringUtil.isBlank(msg)){
return;
}
log.info("the msg received: \r\n" + msg);
... |
02de81d3-e774-429c-8ec1-0a54b1beb7d7 | 3 | public void WGSignup(String channel, String sender, String login, String hostname) {
Game game;
game = games.get(getServer() + " " + channel);
if(game == null) {
sendMessageWrapper(channel, sender, MSG_NOGAME);
return;
}
if(game.a... |
36589f68-ea7d-4286-acb5-b858f3f80bda | 8 | public static void multAddTransA_reorder( RowD1Matrix64F A , D1Matrix64F B , D1Matrix64F C )
{
if( C.numCols != 1 ) {
throw new MatrixDimensionException("C is not a column vector");
} else if( C.numRows != A.numCols ) {
throw new MatrixDimensionException("C is not the expecte... |
2bd76b04-0f45-4a9e-a98f-07d2384e2e33 | 7 | private ArrayList<MyEdge> followTheVine(MyNode current) {
if (current.getDegree() == 0) {
return null;
}
MyNode first;
MyEdge e = this.outEdges(current).get(0);
if (current.equals(e.getSource())) {
first = e.getTarget();
} else {
first = e.getSource();
}
MyNode next = first;
MyNode previous ... |
64d4ff08-6180-4927-8825-b2e50319235d | 9 | private boolean initLayerFunctions(boolean optimizing, StringBuffer msg) {
if (numLayers < 1) {
msg.append(MessageFormat.format("invalid number of layers: ''{0}'' (should be > 0)", numLayers));
return false;
}
if (layers == null) {
msg.append("no layers define... |
407d0768-bb57-4f07-ae4f-a747e9ae019f | 3 | private ArrayList<ArrayList<Integer>> helper(int[] candidates, int from, int target) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (target == 0) {
result.add(new ArrayList<Integer>());
return result;
}
for (int i = from; i < cand... |
67413dd0-c831-4c06-a024-72df07207405 | 3 | private void Update(){
if(timeForNextFrame <= System.currentTimeMillis()){
// Next frame.
currentFrameNumber++;
// If the animation is reached the end, we restart it by seting current frame to zero. If the animation isn't loop then we set that animation isn't active.
... |
28940d02-0b2e-4698-86e7-f0b2cfe04225 | 5 | public void removeListener (Listener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
synchronized (listenerLock) {
Listener[] listeners = this.listeners;
int n = listeners.length;
Listener[] newListeners = new Listener[n - 1];
for (int i = 0, ii = 0; i <... |
686ee87a-926f-4f54-8731-7fad8ceaad8e | 0 | public void setBumoncode(int bumoncode) {
this.bumoncode = bumoncode;
} |
582429e8-5d54-402a-be87-5da6c4eb10d6 | 2 | @Override
public void mousePressed(MouseEvent arg0) {
if(arg0.getButton() == 2){
if(!middlemouseDown){
middlemouseDown = true;
System.out.println("MMB Down");
PreviousMousePosition[0] = arg0.getX();
PreviousMousePosition[1] = arg0.getY();
}
}
} |
6c6f1421-3a35-46d5-82b5-690c836b595b | 6 | public boolean contains(Vector vector) {
double dx = end.x - start.x;
double dy = end.y - start.y;
if(dx == 0) {
return vector.x == start.x && vector.y >= start.y && vector.y < end.y;
} else if(dy == 0) {
return vector.y == start.y && vector.x >= start.x && vector.x < end.x;
} else {
double a = dy / ... |
6ddffcbf-35ac-4327-9472-ab55a9c879a2 | 2 | public boolean isEmpty(int i, int j){
boolean c =false;
if(!board[i][j].equals("X") || !board[i][j].equals("O")) c= true;
else c = false;
return c;
} |
6a867cba-13e6-41f1-9d2b-52f46216e967 | 3 | public void eventMenuFileOpen() {
int proceed = JOptionPane.YES_OPTION;
JFileChooser chooser;
int result;
File selectedFile;
if ( Data.getInventoryChanged() ) {
proceed = JOptionPane.showConfirmDialog( Data.getView(),
Data.CHANGED_MSG,
... |
1268db0b-1fa1-4de2-add5-be6986dc2370 | 9 | public void onMessage(MessageEvent event) {
String rawcommand = event.getMessage();
String command = rawcommand.toLowerCase();
if (command.startsWith("!presents ") || command.equals("!presents")) {
event.respond("(ノಠ益ಠ)ノ彡┻━┻");
} else if (command.startsWith("!pokemon") || command.equals("!pokemon")) {... |
ec07587c-7f01-43e2-a80e-e118fab578d7 | 8 | public boolean exist(char[][] board, String word) {
if (board == null || word == null || word.length() == 0 || board.length == 0) return false;
if (board[0].length == 0) return false;
boolean[][] visited = new boolean[board.length][board[0].length];
for (int i = 0; i < board.length; i++)... |
4188e3a8-2121-45f0-888c-7914c3340563 | 6 | @Override
public void executeTask() {
try {
m_SendingSocket = new ServerSocket(LISTEN_PORT);
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
ObjectInputStream objIn = null;
System.out.println("Listening for remote messages...");
String message = "NULL";
... |
09807859-cc22-4b67-9845-d03b74a0c19c | 0 | @Override
public String getUser() {
return "hduser";
} |
c7471809-1cdb-4456-a5cd-39b482eea972 | 4 | public boolean equals( Object other ) {
if ( other == null ) {
return ( false );
}
else if ( other == this ) {
return ( true );
}
else if ( other.getClass() != this.getClass() ) {
return ( false );
}
Move otherMove = (Move) other;
return ( this.to == otherMove.to() && ... |
f7ca2667-57f3-4ee2-8ed5-52900b460c0b | 6 | private boolean resize(int newCapacity) {
if (outCapacity >= newCapacity) return true;
byte[] newBuffer = new byte[newCapacity];
System.arraycopy(buffer, 0, newBuffer, 0, Math.min(outBlurbs + ((outBits != 0) ? 1 : 0), newCapacity));
if (newCapacity < outBlurbs + ((outBits != 0) ? 1 : 0))... |
d7408511-571a-45f3-9e0e-aa915a5dc405 | 1 | private static void generateUsecaseHtml(List<Object[]> values) throws IOException {
File htmlOut = new File(getOutputDir(), "index.html");
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(htmlOut, false), "utf-8");
writer.write("<html>\n");
writer.write("<head>\n")... |
6826bfe8-1b02-4f63-81ad-3f3e45f4d4b8 | 9 | public ArrayList<BoardPosition> scoreCloisters(ArrayList<Player> players,
boolean hasGameEnded) {
ArrayList<BoardPosition> removedMeeples = new ArrayList<BoardPosition>();
Iterator<Meeple> iter = meeplePlacement.keySet().iterator();
// For each meeple which is placed we check to see if it is placed on
// a... |
dbde8568-4ced-46c1-a777-6fdee61d8d37 | 8 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB))
{
final MOB mob=(MOB)affected;
if((msg.amISource(mob)||msg.amISource(mob.amFollowing()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
unInv... |
1ed79a01-79d7-48f8-8b8c-e546f10cba24 | 9 | public String getName()
{
String str = "";
if (num < 11)
str += num + " of ";
else if (num == 11)
str += "jack of ";
else if (num == 12)
str += "queen of ";
else if (num == 13)
str += "king of ";
else if (num == 14)
str += "ace of ";
if (suit == HEARTS)
str += "hearts";
else if (suit ... |
ec621b8c-4554-4a2d-a015-33b8f3216403 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.tool() instanceof Weapon)
&&(msg.value()>0)
&&(((Weapon)msg.tool()).weaponClassification()==Weapon.CLASS_THROWN))
... |
0ef15c97-3ae0-4ba5-a7c9-03f5e8ace075 | 4 | public static String reverseString(String s){
if(s == null){
return null;
}
char[] reverseArray = s.toCharArray();
int lastIndex = 0;
for(int i =0;i <= s.length();i++){
if(i == s.length() || reverseArray[i] == ' '){
reverseChar(reverseArray,lastIndex,i-1);
lastIndex = i+1;
}
}
reverseCh... |
d0eb6b46-7e87-463d-b1a5-eb713b7bf853 | 9 | public void mouseClicked(MouseEvent e) {
System.out.println("Mouse clicked (# of clicks: " + e.getClickCount() + ")");
} |
8f1e5ac2-ceb0-4f16-86d4-3241f5e2a605 | 9 | public static boolean isOneEditDistance(String s, String t) {
int m = s.length(), n = t.length();
if (m > n)
return isOneEditDistance(t, s);
if (n - m > 1)
return false;
int i = 0, shift = n - m;
while (i < m && s.charAt(i) == t.charAt(i))
i++;
if (i == m) {
if (shift == 0)
return false; // ... |
1e1b0c33-1e90-4a64-9372-3ed081842b77 | 0 | public JLabel getjLabel8() {
return jLabel8;
} |
66a126ae-4550-4af1-bbc0-3eab6243e4a4 | 6 | public static boolean write(List object, File file) {
ObjectOutputStream output = null;
try {
output = new ObjectOutputStream(new FileOutputStream(file));
} catch (IOException e) {
e.printStackTrace();
return false;
}
int amount = object.size();
try {
output.writeObject(amount);
} catch (IO... |
5c083e1b-2032-42a5-89bd-237f84985dea | 4 | private static boolean isAbundant(int n){
int sum = 1;
for (int i=2;i<=Math.sqrt(n);i++){
if (i==Math.sqrt(n) && n%i == 0) sum+=i;
else if (n%i==0) sum+=i+n/i;
}
return (sum>n);
} |
831e1a74-ed83-4430-91df-e56239cad4ab | 1 | protected byte[] computeByteArray(OSCJavaToByteArrayConverter stream) {
stream.write("#bundle");
computeTimeTagByteArray(stream);
byte[] packetBytes;
for (OSCPacket pkg : packets) {
packetBytes = pkg.getByteArray();
stream.write(packetBytes.length);
stream.write(packetBytes);
}
return stream.toByte... |
c5f81036-a9ea-467b-8251-b1f89a7a82ee | 9 | void setArg(Object[] argList) {
LOGOPP.io.debug("function.setArg");
if (this.args == null && argList == null)
return;
if (this.args != null && argList == null) {
LOGOPP.errorhandler.setRunTime(id, "unmatched number of arguments");
return;
}
if (this.args == null && argList != null) {
LOGOPP.errorh... |
8aa41359-faf5-430e-8d70-fd60ec33f630 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "OAEPparams", scope = EncryptionMethodType.class)
public JAXBElement<byte[]> createEncryptionMethodTypeOAEPparams(byte[] value) {
return new JAXBElement<byte[]>(_EncryptionMethodTypeOAEPparams_QNAME, byte[].class, EncryptionMethodType.c... |
9373fd13-4708-4117-928a-db41d65b0206 | 0 | public static boolean validateCategory(){
boolean isValid=false;
return isValid;
} |
f21d5501-7613-4b98-8288-822274f642a8 | 3 | private void startAllAtStartJobs()
{
for(int i=0; i < schedulVector.capacity() ;i++)
{
//only start the recording if the job is enabled
if(schedulVector.get(i).getJobCount() == 3 && schedulVector.get(i).isJobenabled())
{
// start the stream for recording
//look for the to recording stream
Stre... |
8ada3cd9-9a75-454f-974d-43294f3009d1 | 3 | public void mouseClicked(MouseEvent e)
{
Main.mse.setLocation(e.getX()/Main.pixelScale, e.getY()/Main.pixelScale);
if(Main.isMouseLeft) //left click
{
}
else if(Main.isMouseMiddle) //middle click
{
}
else if(Main.isMouseRight) //right click
{
}
} |
fb3a4034-ae19-4693-9ea4-ad19b5413a4a | 1 | public void setFactorToReference(double factor) {
if(factor > 0) {
this.factorToReference = factor;
}
} |
e4db3a27-3b8c-479e-9948-a0cdd935b8cf | 6 | public void run(){
double time = 0.5;
while(!TheGame.isOver){
double accelerationX=0,accelerationY=0;
if(TheGame.isRun){
for(Rectangle f: Rectangle.moveList){
if (f.isIn(this.getX(),this.getY())){
accelerationX +=f.getAccelerationX(this);
... |
906173ac-0d7a-4ab3-b791-dfe1dfeb4545 | 6 | public void setCurrent(String current) {
if (this.getParent() == null) {
return;
}
String previous = (String) getStateHelper().get(current);
getStateHelper().put(PropertyKeys.current, current);
// Fire an {@link AreaSelectedEvent} if appropriate
if ((previou... |
82b5880d-f71e-4ece-b5ef-7240da97f394 | 7 | static final void method2035(int i, int i_4_) {
anInt3445++;
int i_5_ = Class367_Sub11.logicCycle - FloatBuffer.anInt9751;
if ((i_5_ ^ 0xffffffff) <= -101) {
Class348_Sub40_Sub21.anInt9282 = 1;
Class9.anInt167 = Class318_Sub1_Sub5_Sub2.anInt10163 = -1;
} else {
int i_6_ = (int) Class76.aFloat1287;
... |
93112296-aac5-4e80-a898-ef3790d63010 | 1 | private void spawnEnemy(double deltaTime) {
timeSinceLastSpawn += deltaTime;
if (timeSinceLastSpawn > 2){
Random random = new Random();
Vector2f position = new Vector2f(random.nextInt(700) + 50, random.nextInt(300));
spawnEntity(spawner, position);
timeSin... |
b7e45f2b-b814-4ffd-87a3-3bf5c17c9649 | 1 | @RequestMapping(method = RequestMethod.PUT, value = "{id}")
public void finishTask(@PathVariable("id") Integer id, @RequestParam String action) {
switch (Action.valueOf(action)) {
case FINISH:
stepsService.finishById(id);
break;
}
} |
ebf6b123-5a7a-42a1-a0f8-d7173c5a46a6 | 9 | @Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Edge other = (Edge) obj;
if (end == null) {
if (other.end != null) {
return false;
... |
e066de7a-b920-4492-a827-2e233133f81d | 0 | public void setMiasto(String miasto) {
this.miasto = miasto;
} |
bf1c5536-9e52-41b6-813a-48077e67f2eb | 2 | public void valida(){
String usuario =jTextField1.getText();
String contrasenia=jTextField2.getText();
if(usuario.equalsIgnoreCase("admin") && contrasenia.equalsIgnoreCase("admin")) {
new JOptionPane().showMessageDialog(this,"Bienvenido: "+usuario,"CONFIRMAR",JOptionPane.INFORMATIO... |
09006759-3e36-414b-b497-2df47ada330b | 2 | int maxDiffArray(int[] A) {
int buy = 0;
int sell = 1;
int max = A[sell] - A[buy];
while (sell < A.length) {
max = Math.max(A[sell] - A[buy], max);
if (A[sell] < A[buy])
buy = sell;
sell++;
}
return max;
} |
74c3df6a-0deb-44e9-87d3-a0af66bb1ce9 | 5 | public void waitForPageToLoad() {
// Logger.getInstance().info("waitForPageToLoad started");
WebDriverWait wait = new WebDriverWait(driver, Long.parseLong(getTimeoutForPageLoad()));
try {
wait.until((ExpectedCondition<Boolean>) new ExpectedCondition<Boolean>() {
public Boolean apply(final WebDriver d) {
... |
520b6186-ae91-43a3-ab9f-6187f560619a | 6 | private void heapifyDown(Entry<E> entry) {
Entry<E> currentEntry = entry;
Entry<E> bestEntry = null;
do {
bestEntry = currentEntry;
Entry<E> leftEntry = leftChild(currentEntry);
if (leftEntry != null) {
if (compare(bestEntry, leftEntry) < 0) {
bestEntry = leftEntry;
... |
d9952386-747d-4411-bfa5-2065359cfd2c | 9 | public void remove(E e)
{
Node u = find(e);
if (u == null)
return;
if (size <= 1) min = null;
else if (min != null && e == min.key) //nullpointer
min = getNext(min);
size--;
if (u.left == null && u.right == null)
... |
e0dbbc43-c8bb-414f-bad3-c26cd66e8d9c | 8 | private void method362(int i, int ai[], byte abyte0[], int j, int k, int l,
int i1, int ai1[], int j1) {
int k1 = -(l >> 2);
l = -(l & 3);
for (int l1 = -i; l1 < 0; l1++) {
for (int i2 = k1; i2 < 0; i2++) {
byte byte1 = abyte0[i1++];
if (byte1 != 0)
ai[k++] = ai1[byte1 & 0xff];
else
k+... |
f34f0a35-957f-4b67-841c-423a1eb9970f | 9 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btn_setColorBlob) {
if(btn_setHazard.isSelected()) {
btn_setHazard.setSelected(false);
}
JToggleButton jToggleButton = (JToggleButton)e.getSource();
if (jToggleButton.... |
329564ff-ec9c-45bf-9578-f9d61906edcc | 1 | public void nouvellePiece() {
courante = suivantes[0];
int i;
for (i = 0; i < suivantes.length - 1; i++) {
suivantes[i] = suivantes[i + 1];
}
suivantes[i] = Piece.randPiece(nombrePieces);
int[][] minMax = courante.getForme().minMax();
int randY;
... |
6a10de54-d336-4b83-ba99-5ddad6ff8f83 | 3 | public void Disconnect(int clientID)
{
int idToDelete = 0;
boolean delete = false;
for(IClientObserver observer : this.observers)
{
if(observer.GetObserverID() == clientID)
{
System.out.println("Client : " + Inte... |
ed3c8693-5e1f-4317-a112-67597bed79dc | 3 | public int generate1(){ //Generate per-turn resources
if (resource1==1){
resource1_level=(sgenrate1*small+mgenrate1*med+lgenrate1*large)*Empous.Gov.getStat("taxes")/5
-((Empous.Gov.getStat("freedom")*Empous.Gov.getStat("military")+1)*10
+Empous.Gov.getStat("education")*10
+Empous.Gov.getStat("infras... |
baea6de0-46c5-489f-a894-7a71510d93b4 | 3 | public static void insertion( Individual[] individuals )
{
for(int i = 1; i < individuals.length; i++)
{
int j = i;
while( j>0 && individuals[j].getFitness()<individuals[j - 1].getFitness() )
{
swap( individuals, j, j - 1 );
j--;
}
}
} |
19910952-c5fa-4f98-a695-ddadad5e38b0 | 7 | synchronized boolean lock(int transactionId, int resourceId, ServerImpl serverimpl)
{
if (lockOwner == transactionId) {
System.err.println("Error: Transaction " + transactionId + " tried to lock a resource it already has locked!");
return false;
}
long timeout_time = Globals.TIMEOUT_INTERVAL + System.curre... |
bf0c09bb-a82b-4407-b822-47078c02ee54 | 4 | public Long create(String name) {
boolean isCreated = false;
Long author_id = -1L;
if (DataUtils.isEmpty(name)) {
logger.warn("Contains null fields");
} else
try {
prepSt = prepStatements[CREATE_AUTHOR];
prepSt.setString(1, name.toL... |
c625e4b3-5921-4fb8-b5be-b9379d60ee2a | 5 | public boolean setEditing(boolean editing) {
if (!isChangeable) {
return false;
} else {
for (Component component : getComponents()) {
if (component instanceof JPanel) {
LayoutManager lm = ((JPanel) component).getLayout();
if (lm instanceof CardLayout) {
((CardLayout) lm).show((Container) ... |
c4851896-8e05-4799-ab47-0d6c5ee87c08 | 6 | private Instances removeExtraAttributes(Instances dataset, HashMap<String, Boolean> setting) {
if (!setting.get("Time")) {
dataset.deleteAttributeAt(dataset.attribute("time").index());
}
if (!setting.get("Ball")) {
dataset.deleteAttributeAt(dataset.attribute("ballDis").index());
dataset.deleteAttributeAt... |
2064b8a8-11c9-4763-b531-3b546640f03d | 0 | public void setRecord(Record record) {
this.record = record;
} |
ba7dcc86-87b2-466d-adaa-89d83adc2024 | 7 | public static void resumeSchedule(){
// Set the playPause flag to true
playPause = true;
// Used for loops
int i;
// Timer started again.
slideTimer = new Timer();
// Set the last entities to be display or undisplayed
long delay = lastestTime.getTimeStopped();
// Check to see if the slide has got content.
... |
672a94a5-3217-46a8-9e3f-49eb6cc42c55 | 4 | @Override
public void execute(IContext context) throws Exception {
if(Boolean.parseBoolean(context.getProperties().getProperty("autoindex"))){
File repo = new File((String) context.getProperties().get("file.repository"));
String path = (String) context.getParameter("path");
File currentDir = new File(re... |
5217afb8-30a7-4d94-9dd3-40f1d495ef56 | 1 | public static ApplictionResources getInstance() {
if (instance == null) {
instance = new ApplictionResources();
}
return instance;
} |
272e96ad-f47c-45d4-a6f3-f85aca839c8e | 1 | public void setName( String name ) {
if( name == null )
throw new IllegalArgumentException( "name must not be null" );
this.name = name;
} |
9aa425b6-8bae-4e75-a449-421bda5330c2 | 5 | public void run() {
int maxTime = 60000;
willpower = model.getStat("willpower").getValue();
strenght = model.getStat("strenght").getValue();
critical = model.getStat("critrate").getValue();
alacrity = model.getStat("alacrity").getValue();
power = model.getStat("power").getValue();
forcepower = model.ge... |
42b1aae8-afcb-40f3-b5d3-468ac4699dbf | 8 | @Override
public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp)
{
final java.util.Map<String,String> parms=parseParms(parm);
if(parms.containsKey("DOMAIN"))
return CMProps.getVar(CMProps.Str.MUDDOMAIN);
if(parms.containsKey("EMAILOK"))
return ""+(CMProps.getVar(CMProps.Str.MAILBO... |
ddf15f07-165e-4fdd-b57e-42b1b583a0c6 | 5 | private int getComputerMove() {
//label the winning/losing nodes from the game state
LinkedList<NimVertex> labels = NimAlgorithms.labelNimGraph(gameState);
//determine the desired condition
boolean wantToWin = gameType == GameType.MissionImpossible
? true : gameType == GameType.FairGo ? true : false;
//... |
75425617-f3b3-4295-9317-1d800a090a34 | 8 | public void SetInfo(String info) {
String user, desc, conn, mail, share;
int index = 0;
user = new String();
while (info.charAt(index) != ' ') {
user = user + info.charAt(index);
index++;
}
if (user.equals(_bot.botname()))
return;
index++;
desc = new String();
while (info.charAt(index) != '$... |
11e3357f-a70d-420b-81be-fc4618c0946b | 1 | public static void main(String[] args) {
initLWJGL();
try {
AppGameContainer game = new AppGameContainer(new Game("Pokemons"));
game.setDisplayMode(800, 600, false);
game.setMaximumLogicUpdateInterval(5);
game.setTargetFrameRate(200);
game.start();
} catch (SlickException e) {
e.printStackTra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.