method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3bf39db7-3427-446f-8a73-06f0a4dab686 | 4 | @Test
public void testList() {
ExecutorService threadPool = Executors.newSingleThreadExecutor();
List<String> _list = new ArrayList<>();
_list.add("1");
_list.add("22");
_list.add("33");
list = _list;
// list = Collections.synchronizedList(_list);
// list = Collections.unmodifiableList(_list);
th... |
8b653177-cf11-4650-85b7-9343a60e6ffa | 0 | public void mouseMoved(MouseEvent e)
{
String str = "x: " + e.getX() + ",y: " + e.getY();
System.out.println(str);
} |
280045ef-f9e4-48d5-ac0b-d698c8140d23 | 0 | public List<ResType> getDeclaredTypes() {
return this.types;
} |
e1ffa9bb-a524-4ab1-bbb5-89fdfe777210 | 1 | public void removeTelefones(Telefone t){
if(telefones.contains(t)){
telefones.remove(t);
}
} |
114812af-2355-463d-b518-e7b6cf0cab3c | 5 | public static void print(KeyValueTable<?,?> table) {
for (KeyValue<?, ?> index : table.getKeyValues())
System.out.print("[" + index.key + " : " + index.value + "]\n");
System.out.print("\n");
} |
1154cd76-4183-4ca1-8a5e-518207520114 | 4 | public void addToAC(int value)
{
value += getACValue();
//if overflow
if(value > 999)
{
//set carry flag
if(AC.getCarry() == 0)
{
AC.setCarry(1);
}
value = -999 + (value - 999);
}
//if under... |
0643905f-8275-4f56-bdf0-51bf29f70dba | 1 | @Override
public void writeTo(WordWriter out)
throws IOException {
if(realInstruction != null)
realInstruction.writeTo(out);
} |
13ed64bf-3bd7-4e80-8102-b54628a4e3ef | 0 | Destination(String whereTo) {
label = whereTo;
} |
9b2dee73-a268-4f5e-b593-7a16553ec32a | 4 | public boolean equals(Object obj)
{
if(obj == this)
return true; ... |
f3851bf9-c78a-4b78-ab9e-1db778349a59 | 9 | public boolean isStillMaintained(Environmental thang, ShopKeeper SK, Item I)
{
if((I==null)||(I.amDestroyed()))
return false;
if(SK!=null)
return SK.getShop().doIHaveThisInStock(I.Name(),null);
if(thang instanceof Area)
{
final Room R=CMLib.map().roomLocation(I);
if(R==null)
return false;
re... |
db8e3a7b-32a9-49de-abb1-939d8355dedb | 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://down... |
92a70905-6a9d-4f2c-a4cb-71c6ba42877d | 1 | public void notifyPropertyChangeListeners(String property, int oldVal, int newVal) {
PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldVal, newVal);
for(PropertyChangeListener listener:listeners) {
listener.propertyChange(event);
}
} |
8cc5217b-e36a-41e0-88ef-0e8be95c0b0b | 1 | public JTextField getFontStyleTextField()
{
if (fontStyleTextField == null)
{
fontStyleTextField = new JTextField();
fontStyleTextField.addFocusListener(
new TextFieldFocusHandlerForTextSelection(fontStyleTextField));
fontStyleTextField.addKeyListe... |
b28d219a-38f9-4c35-afb6-dc2490620b12 | 2 | public void doPost2(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
String userName=(String)session.getAttribute("USERNAME");
String picid = request.getQueryString();
PrintWriter out = response.g... |
43ce05cb-efb2-4754-b60b-caff0f0cd62a | 8 | public void pushUpPhi() {
Block left = null;
Block right = null;
if (thenPre != null && elsePre != null) {
left = thenPre;
right = elsePre;
} else if (loopBack != null && normalPre != null) {
left = normalPre;
right = loopBack;
}
for (Iterator<SSAInstruction> iter = instructions.iterator(); iter... |
f5930c2b-4a3b-438e-8ceb-1f4ced8c4513 | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
f9024505-c606-4baf-a927-167d24e7e08e | 2 | @Override
public void salvar(Atividade atividade) {
AtividadeDAO atd= new AtividadeJPADAO();
try{
atd.beginTransaction();
System.out.println(atividade.toString());
atd.save(atividade);
}catch(Exception e){
e.printStackTrace();
try{
atd.rollback();
}catch(Exception e2){
e2.printStackTrac... |
31cbfead-20f7-4af0-b128-b23d2cffd515 | 1 | private static String executeDescTableCommand(DataBaseManager dbManager, Command command) {
List<String> args = command.getArgs();
String tableName = args.get(0);
String msg = "";
try {
List<String> result = dbManager.describeTable(tableName);
msg = getResultSetA... |
8e84f581-224d-4c24-8578-e6831116d1a7 | 6 | public static void displayActivePlayerExpeditions(Player player) {
List<String> lines = new ArrayList<String>();
int rowCount = 0;
List<List<String>> cardsStrings = new ArrayList<List<String>>();
for (ExpeditionCardStack expeditionCardStack : player.getExpeditions()) {
List<String> expeditionStrings = build... |
4ce54f58-ad20-4930-bab2-444e3738e2c0 | 0 | public void setPercent(double percent) {
this.percent = percent;
} |
ae23bccb-cc6d-4222-91bf-d0af2442b48f | 5 | private void solve_sub_problem(double A_i, int yi, double C_yi, int active_i, double[] alpha_new) {
int r;
assert active_i <= B.length; // no padding
double[] D = copyOf(B, active_i);
// clone(D, B, active_i);
if (yi < active_i) D[yi] += A_i * C_yi;
// qsort(D, active_... |
adc29d82-c78e-4900-aaab-5b9c537c3560 | 9 | private void respondToMouseClick(int x, int y, int button) {
actionPainter.clearActions();
if (x < leftMargin || x > rightMargin ||
y < topMargin || y > bottomMargin) {
System.out.println("Click outside boundaries: " + x + ", " + y);
} else {
x = x - leftMargin;
y = y - topMargin;
int xSquare = x ... |
24197ec2-30d1-43cb-9421-85cb953217ae | 1 | public synchronized List<Long> getNodesIds(int pos){
if (nodes.size()>pos)
return nodes.get(pos);
else
return null;
} |
169d5f84-e03f-477c-a884-edafb051dc04 | 1 | public void leaveParty() {
if (leave != null)
leave.click();
} |
06863e33-3e11-4c12-b340-fac0c3181232 | 7 | public void scheduleBlockUpdate(int par1, int par2, int par3, int par4, int par5)
{
NextTickListEntry var6 = new NextTickListEntry(par1, par2, par3, par4);
byte var7 = 8;
if (this.scheduledUpdatesAreImmediate)
{
if (this.checkChunksExist(var6.xCoord - var7, var6.yCoord -... |
89c6dfcc-966c-4de3-ab11-10b9f2e63cfe | 9 | public void drawGame(Graphics2D a) {
a.translate(200,0); //shifts game 200 pixels to make room for UI
a.translate(400,400); //shifts anchor point to the center in orderfor accurate transformation
a.scale(scaler,scaler); //applies zoom(scaler)
a.translate((offsetx),(offsety)); // applies ... |
2143e48e-01dc-4839-8776-6113c8ef6903 | 5 | public static void main(String[] args)throws IOException
{
File directory = new File("/home/garth/Desktop/stock_pre_2000"); //directory of stock price files
File[] files = directory.listFiles();
List<String> allMatches = new ArrayList<String>();
for(... |
643263ea-089a-4a49-b21a-85e56d8430c9 | 8 | private String getJavaDataType(String dataType) {
if ("int".equals(dataType)) {
return "Integer";
}
if ("varchar".equals(dataType)
|| "longtext".equals(dataType)
|| "char".equals(dataType)
|| "text".equals(dataType)
) {
... |
de2423fe-b38b-447e-8870-45743ad826dc | 0 | public void glSetup3D() {
initGL();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluPerspective(perspectiveFoV, this.window.getAspectRatio(), perspectiveZNear, perspectiveZFar);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11... |
32b91d7f-a53e-4cc0-ae84-3dc65dc693cd | 0 | public static void main(String[] args) {
w = new Worker();
} |
6390c602-2de5-452d-9319-b26cdaa11d11 | 6 | final public List<Superiority> superiority() throws ParseException {
Token fRule;
Token sign;
List<String> sRules;
fRule = jj_consume_token(STRING);
if (jj_2_63(7)) {
sign = jj_consume_token(GREATER);
} else if (jj_2_64(7)) {
sign = jj_consume_token(LESSER);
} else {
jj_consume_toke... |
c9e7c69c-13cb-47cb-9136-d9ad6be1dc79 | 0 | @Override
public boolean supportsAttributes() {return false;} |
6aa155a4-51bc-4682-8e25-89509e2f9e0c | 3 | public static String urlEncode(final String text) throws Exception {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
for (int b : toUTF8Bytes(text)) {
if (b < 0) {
b = 256 + b;
}
if (UNRESERVED_CHARS.get(b)) {
buffer.write... |
45bcf5c7-beeb-4273-9f9d-978506b13479 | 7 | @Override
public Point getNextLocation(int ix, int iy, int fx, int fy) {
double theta = orbit.getTheta(ix, iy);
double dTheta = orbit.getTheta(fx, fy) - theta;
if (Math.abs(dTheta) > Math.PI) {
dTheta = (Math.PI*2 - Math.abs(dTheta))* ProjUtils.getSign(dTheta)*(-1);
}
... |
6b080aa3-88cc-4797-8489-81d87bfb1d0e | 2 | public double[] columnStandardDeviations(){
double[] standardDeviations = new double[this.numberOfColumns];
for(int i=0; i<this.numberOfColumns; i++){
double[] hold = new double[this.numberOfRows];
for(int j=0; j<this.numberOfRows; j++){
hold[i... |
66e92298-77a2-4dfd-b172-2ef59278ba76 | 3 | public double [] readChunkDouble(DataChunk chunk, String name) {
Variable v = nc.findVariable(name);
if( v == null )
{
LOG.error("FILE varible "+name+" failure");
return null;
}
try {
return (double [] )v.read(chunk.getStart(), chunk.getChunkSize()).copyTo1DJavaArray();
} catch (IOException... |
0b0ae90f-f118-4498-bf38-ab6570d4aa0f | 7 | public Object getValueAt(int row, int col) {
// Hop h = (Hop) data.get(row);
try {
switch (col) {
case 0 :
return data.get(row).getName();
case 1 :
return data.get(row).getType();
case 2 :
return new Double(data.get(row).getAlpha());
case 3 :
return SBStringUtils.format(data.g... |
03473305-6dd2-4194-9761-e937419b0d13 | 1 | public long read3bytes() throws IOException {
long b0 = read();
long b1 = read();
long b2 = read();
if (le)
return b0 | (b1 << 8) | (b2 << 16);
else
return b2 | (b1 << 8) | (b0 << 16);
} |
f75ad381-ea7c-46bc-b412-8f4c5ba3927b | 3 | public int getValE(String edgeID, String attr){
increaseAccess();
Edge e = edgeMap.get(edgeID);
if (e != null){
Object val = e.getAttr(attr);
if(val != null && val instanceof Integer){
return (Integer)val;
}
}
return Integer.MAX_VALUE;
} |
b781dccd-185f-406c-b885-5a0b84b94fe5 | 4 | private boolean isIgnoreUrl(HttpServletRequest request){
boolean isIgnoreUrl = false;
String path = request.getContextPath();
String uri = request.getRequestURI();
String basePath = request.getScheme() + "://" + request.getServerName() + ":"
+ request.getServerPort() + pa... |
d0828824-514d-4024-89c9-626f53797600 | 5 | ChunkStateSet next( Pair p, ChunkState state, short v )
{
ChunkStateSet repl = this;
if ( !p.contains(v) )
{
if ( !containsState(state) )
{
repl = new ChunkStateSet( backup );
repl.add( state );
}
}
// contains version v
else if ( backup != Version.NO_BACKUP )
{
if ( !isBackup() )
... |
b41eeb14-da20-4bcd-ba8d-e375f02bf226 | 7 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Move other = (Move) obj;
if (x1 != other.x1) {
return false;
}
if (x2 != other.x2) {
return false;
}
... |
5bd9e368-251a-4ea3-a9d2-6d02051ef683 | 5 | public static void main(String[] args) throws IOException{
String entry = "";
Controller theControl = new Controller();
while(!entry.equals("exit")){
entry = "";
System.out.println("Would you like to record new audio (r), play back a track? (p), generate accompaniment for a track (g) or listen ... |
feb919fa-6c2b-4275-bf1f-73b3810f2103 | 3 | void start(){
ServerSocket server = null;
// Try to establish a server
try {
server = new ServerSocket(port);
} catch (IOException e) {
System.err.println("Could not listen on port: " + port);
System.exit(-1);
}
// If we get a connecti... |
2e723f41-c146-4372-83e8-e61d666ada22 | 8 | public static int getLevenshteinDistance2 (String s, String t) {
if (s == null || t == null)
{
throw new IllegalArgumentException("Strings must not be null");
}
/*
The difference between this impl. and the previous is that, rather
than creating and retaining a matrix of siz... |
33c97a22-9c58-48d8-a66f-e8cbdfe0d24c | 1 | @Override
synchronized public void addClock() {
if (this.clock.containsKey(this.hostName)) {
this.clock.put(this.hostName, this.clock.get(this.hostName) + 1);
}
} |
ad683f68-5165-479a-9ad9-96964191aa85 | 5 | private void autoLoadMethod(){
Set<Class<?>> classes = ClassScanner.getClasses("com.candy.autocode.properties.method");
for(Class clazz : classes){
if(clazz.isAnnotationPresent(PropertyMethod.class)){
PropertyMethod propertyMethodAnnotation = (PropertyMethod)clazz.getAnnotati... |
909d6d93-b3a4-45aa-a6d4-990809c89542 | 3 | private void movePlayer(){
if (this.playerMoveCounter == 0){
if ((this.player.getSavedDir() != -1) && (this.player.checkCell(this.player.getSavedDir()))){
this.player.move(this.player.getSavedDir(), false);
this.player.setSavedDir(-1);
}
else
this.player.move(this.player.getFacing(), false);
}
... |
a9997ddf-de5b-468b-99c3-be27c7991417 | 7 | public void tick(){
localEntity.tick();
for(int i = 0; i < globalEntity.length; i++){
if(globalEntity[i] != null)
globalEntity[i].tick();
}
worlds.get(currentWorld).tick();
if(Keyboard.isKeyDown(Keyboard.KEY_J)){
nm.startClientManager();
try {
nm.getClientManager().connect("localhost", nm.... |
a7ef7485-81e5-414d-8101-f1158c26aa55 | 8 | public InetAddressComboBoxModel()
throws java.net.SocketException {
super();
this.list = new ArrayList<InetAddress>( 2 );
InetAddress localhost = null;
try {
localhost = InetAddress.getLocalHost();
} catch( java.net.UnknownHostException e ) {
System.out.println( "[Warning] No localhost found." );
... |
ea6bfdd6-61da-4f7a-af23-a7d625789582 | 2 | public void printCurrentLevel() {
Tile[][] array = zombieLevel.getLayout();
for(int y = 0; y < array.length; y++)
{
for(int x = 0; x < array[y].length; x++)
System.out.print(array[x][y].getChar());
System.out.print("\n");
}
} |
a11c4de5-d6ee-4da8-8d6a-022cbe684e37 | 3 | public static void putBytesIntoBlock(byte[] block, byte[] data) {
int bSize = block.length;
int dSize = data.length;
int i = 0;
while (i<dSize && i<bSize) {
block[bSize-i-1] = data[dSize-i-1];
i++;
}
while (i<bSize) {
block[bSize-i-1] = (byte)0x00;
i++;
}
} |
c6867505-ad56-4f6e-b3f0-b747983f88ac | 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://down... |
89ce1eb8-5281-43fe-baa5-dafd1bc67133 | 1 | public void uimsg(String msg, Object... args) {
if(msg == "log") {
makeurgent(1);
}
super.uimsg(msg, args);
} |
3803a7ed-4540-4c98-963b-8cc4c487c5ce | 0 | public MediaTag(Property prop, PropertyTree parent) {
super(prop, parent);
} |
69f35f0a-688b-44e8-bdea-6cc3eeca4156 | 6 | private String getdayOfWeekString(int dayOfWeek) {
switch(dayOfWeek) {
case 1: return "Sonntag";
case 2: return "Montag";
case 3: return "Dienstag";
case 4: return "Mittwoch";
case 5: return "Donnerstag";
case 6: return "Freitag";
... |
07d5b077-8ac9-4eac-a409-e4238c8891e2 | 2 | @Override
public void mouseDragged(MouseEvent e) {
drawMapComponent.getTimer().purge();
drawMapComponent.getTimer().cancel();
if (pressedKeyCode == 17) // press ctrl key
{
newPosition = e.getPoint();
drawMapComponent.drawRectangle((int) oldPosition.getX(), (int) oldPositi... |
e2995ef3-5677-4283-ab85-479b87615754 | 5 | private boolean inputQuit(String token) {
String cutstring = "\n";
String replacestring = "";
String newStdInString;
if (token.contains(cutstring) == true) { // if cutstring is
// include due
newStdInString = token.replace(cutstring, replacestring);
if (newStdInString.equals("exit") || newStdInString.e... |
07d68f87-d6b1-438b-b8b6-ee855eb33ba0 | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String odid = request.getParameter("odid");
String oid = request.... |
f4e3d42e-abe1-499c-8fe2-7b3de930bf16 | 9 | protected void deleteLine() {
boolean isDelete = false;
for ( int y = 0; y < GRID_Y; y++ ) {
int count = 0;
for ( int x = 0; x < GRID_X; x++ ) {
// ブロックがある列を数える
if (_grid[ y ][ x ] == 1)
count++;
}
// そろった行が見つかった
if ( count == GRID_X ) {
// その行を消去
for ( int x =... |
3aeedd19-c60e-4ddb-8ecb-50d4707b7462 | 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://down... |
53b1987f-f4a8-42c6-b369-c554b6406251 | 0 | public <T2> Query<T2> selectMany(Selector<T, Iterable<T2>> selector)
{
Iterable<T2> rs = new FromIterable<T2>(this._source, selector);
return new Query<T2>(rs);
} |
d27b89e8-6f2a-4e2b-a446-606b372aead0 | 1 | public static void main(String[] args) {
// OCRService service = new OCRApiService();
OCRService ocrService = new OCRServiceMock();
String result = ocrService.convertToText("en", "C:/test.jpg");
FoodService foodService = new FoodServiceMock();
Set<FoodObject> foodObjectSet = foodService.getFoodList(result);... |
cb956a0c-8c2d-41fe-b06a-9a811e70a57b | 1 | public void appendRow(Row newRow) {
if (this.records == null) {
this.records = new ArrayList<>();
}
this.records.add(newRow);
} |
e91cbd6c-bd89-48c9-9ec1-70859e4bb292 | 0 | public void setKillstreak(int killstreak) {
this.killstreak = killstreak;
getPlayer().sendPluginMessage(The5zigMod.getInstance(), "5ZIG", ("/s/killstreak=" + killstreak).getBytes());
} |
598d2ea2-78fb-4a0d-bd61-abad1d5821c2 | 2 | private void screeningFormBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_screeningFormBTNActionPerformed
if (Desktop.isDesktopSupported()){
try{
File myPDFFile = new File("H:/Semester 2/Object Orientated Programming/Team C OOP Project/Questionaire.pdf");
... |
62fb11f2-728d-4bef-b0e2-27095590b03b | 8 | /* */ public void start()
/* */ {
/* 67 */ if (this.applet != null) {
/* 68 */ this.applet.start();
/* 69 */ return;
/* */ }
/* 71 */ if (this.gameUpdaterStarted) return;
/* */
/* 73 */ Object localObject = new Thread()
/* */ {
/* */ public void ru... |
f61291a5-e08a-4ac9-a254-4b414cec0f1c | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Stock)) {
return false;
}
Stock other = (Stock) object;
if ((this.id == null && other.id != null) || (this.id !... |
99110bb3-18f0-4e49-b667-47e18425fdec | 7 | private JPanel createInputPanel() {
JPanel inputPanel = new SpacedPanel(new Dimension(5, 5));
inputPanel.setLayout(new BoxLayout(inputPanel, BoxLayout.Y_AXIS));
// Retrieve information for top of model
Event e = model.peek();
String name = e == null ? "Enter event name..... |
b373f8b9-452b-4c60-9f31-4d2bf534dc63 | 7 | public Time asTime()
{
try {
if (isNull()) {
return null;
} else if (isTime()) {
return (Time) value;
}
Calendar cal = Calendar.getInstance();
if (isTimestamp()) {
cal.setTime((Timestamp) value);
return new Time(cal.getTime().getTime());
} else if (isUtilDate()) {
cal.setTime... |
fc911c26-07ab-4ff9-a95f-9ccde2356ddf | 7 | private static final <E> void sortImpl(final Entry<E>[] source,
final Entry<E>[] target,
final int recursionDepth,
final int fromIndex,
final int to... |
c6ae69b9-cee5-4731-81e3-e763252a0a46 | 2 | public boolean update(int id, int newQuantity) {
Iterator<CartItem> iter = cart.iterator();
while (iter.hasNext()) {
CartItem item = iter.next();
if (item.getId() == id) {
// id found, increase qtyOrdered
item.setQuantityOrdered(newQuantity);
return true... |
0b146218-61f7-47a1-a2b2-29520e9cb476 | 2 | private void sendMessage(String message) {
if (message.isEmpty() || !connected) {
return;
}
packetFactory.sendMessage("/m/" + username + ";" + message);
} |
0b46e0f8-5530-4605-90dc-c51e2df1c3f9 | 5 | public FileChain(String path, boolean singleNode, File... node) throws FileException {
super(path);
this.singleNode = singleNode;
if (singleNode) {
if (node.length != 1) {
throw FileException.NODE_AND_NODEARY_MISMATCH;
}
pNodes = null;
... |
a3830307-39fd-4e74-91b0-71aa2423324a | 1 | public void test_constructor() {
try {
new PreciseDurationField(null, 10);
fail();
} catch (IllegalArgumentException ex) {}
} |
b3fa531f-4e7b-479e-9329-ced98dd49068 | 9 | private void blockEvent(Block block, Player player, boolean place) {
// if the event is not place it it break
String eventType;
boolean payBreak;
if (place) {
eventType = "place";
payBreak = false;
} else {
eventType = "break";
payBreak = true;
}
if ((!main.getServer().getScheduler().isQueu... |
5f177c4d-030d-4ef4-a4d1-23fa8c1ba994 | 2 | public Matrix transpose() {
Matrix A = new Matrix(N, M);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
A.data[j][i] = this.data[i][j];
return A;
} |
1d882c3e-147e-4d0f-a417-af7261807781 | 1 | private void paintCell(PaintEvent event, int xCoordinate, int yCoordinate) {
if (game.cellAlive(xCoordinate, yCoordinate)) {
event.gc.fillRectangle(xCoordinate * cellSize, yCoordinate * cellSize, cellSize, cellSize);
}
} |
3c62a60a-1764-4c09-a83d-cfd28a39b5b6 | 5 | public void updateTables() {
sql.initialise();
try {
sql.standardQuery("ALTER TABLE BungeePlayers DROP COLUMN Broadcast");
} catch (SQLException e) {
}
try {
sql.standardQuery("ALTER TABLE BungeePlayers DROP COLUMN SendRank");
} catch (SQLException e) {
}
try {
sql.standardQuery("ALTE... |
d38af340-89cd-4f11-9554-045b3520b9bb | 4 | private void asetaKilpi(Pelihahmo h){
if (tila.getKilpi(h) && h.getKilpienergia()>0){
if (eiLiianLahellaLaitaa(h) && eiLiianLahellaToista(h)){
h.setSuojakilpi(true);
h.paivitaMinMax();
}
} else {
h.setSuojakilpi(false);
h.pa... |
b286e8db-3ed0-44fd-8f29-c73b5c1bb6c9 | 2 | @Override
public void caseAAndOp(AAndOp node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(And");
inAAndOp(node);
if(node.getAnd() != null)
{
node.getAnd().apply(this);
}
outAAndOp(node);
} |
130fdc7b-fd3c-470e-8e12-263fd9c6eb5d | 8 | public boolean helper(TreeNode left, TreeNode right)
{
if(left == null && right == null) // both of them null
{
return true;
}
if((left == null && right != null)||(left!= null && right == null)) // one of them is null
{
return false;
}
... |
e9d0c9de-126c-4070-972a-541ab860d65e | 9 | public static Stack<Point> getPath(Point home, Point size, ArrayList<Point> dirts, ArrayList<Point> bumps)
{
State cur = new State(home, null,new HashSet<Point>(dirts),new HashSet<Point>(bumps));
//Shearch for the path.
Queue<State> frontier = new LinkedList<State>();
HashSet<State> visited = new HashSet<St... |
1d6efef9-8648-44e2-a067-21a8d510640a | 5 | final void H(int i, int i_204_, int i_205_) {
anInt5547++;
for (int i_206_ = 0; anInt5557 > i_206_; i_206_++) {
if ((i ^ 0xffffffff) != -1)
anIntArray5543[i_206_] += i;
if (i_204_ != 0)
anIntArray5593[i_206_] += i_204_;
if (i_205_ != 0)
anIntArray5644[i_206_] += i_205_;
}
aBoolean5527 = false;
... |
3d832ef3-581a-4a8c-9cf9-6f93c4abdea6 | 6 | private void initFruitProbs()
{
for(int i = 0; i < length; i++)
for(int j = 0; j <= numfruits; j++)
for(int k = 0; k <= numfruits * length; k++)
fruitproblist[i][j][k] = -1.0;
for(int i = 0; i < length; i++)
{
for(int k = 1; k <= numfruits * length; k++)
fruitproblist[i][0][k] = 0.0;
for(i... |
9ad6ea4a-a2c6-44b4-bda7-57d6ba581dc1 | 9 | public boolean isAnagramOfPalindrom(String text){
boolean result = false;
HashMap<Character, Integer> characterMap = new HashMap<Character, Integer>();
for(char c : text.toCharArray()){
Integer val = characterMap.get(c);
if (val==null) {
characterMap.put(c, 1);
}else{
characterMap.put(c, va... |
52c8991f-f85f-4004-93da-708cb551c8a4 | 5 | public void reverse() throws IOException {
StringTokenizer stringTokenizer = null;
int num = Integer.parseInt(fileReader.nextLine());
int i = 1;
while (i <= num && fileReader.hasNext()) {
stringTokenizer = new StringTokenizer(fileReader.nextLine());
int numberOfTo... |
9caa284d-3ded-4908-9aa0-ef3037b14d19 | 2 | public String toString() {
final StringBuilder output = new StringBuilder("");
//output.append("Current shape to build:\n" + shape.toString());
for (int row = 1; row < board.length-1; row++) {
for (int col = 1; col < board[row].length-1; col++) {
output.append(board[row][col].blockValue());
}
output.... |
f07f138d-8216-4dc9-8a92-4e6046b40fd3 | 3 | public void useFuel(int amount) {
if((amount <= fuelLevel) && (amount > 0) && !infinite) {
fuelLevel -= amount;
}
} |
39117bda-b086-4890-94a1-b1bae11e87e5 | 5 | final public Exp.PrimaryExp PrefixExp() throws ParseException {
Token n;
Exp e;
Exp.PrimaryExp p;
long i = LineInfo();
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case NAME:
n = jj_consume_token(NAME);
p = Exp.nameprefix(n.image);
L(p, i); {
if (true)
return p;
}
break;
case 75:
... |
2bcfe474-084b-45a5-be77-19625bd038f9 | 0 | public void setMsgID(String msgID) {
this.msgID = msgID;
} |
0402b26e-0df1-4ad1-926b-cbd12f049877 | 3 | @Override
public void run() {
try {
boolean done = false;
while (!done) {
byte[] buf = new byte[256];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
socket.receive(packet);
String msg = new String(packet... |
04e3987d-3c00-4a41-864f-9c3c0b6c94f1 | 7 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null && line.length() != 0) {
String[] info = line.trim().split(" ");
int n = In... |
06169114-7803-4057-83fe-d315ae467f49 | 0 | @Before
public void init(){
bubbleSort = new SortBubble();
} |
c3daa7bc-c167-4c5f-9b47-5b0a67a6cb4a | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
if (!Main.Data.IsStaff())
{
return;
}
int UserId = Main.DecodeInt();
Player pClient = Environment.ClientManager.GetClient(UserId);
if(pClient == null) return;
if((pClient.F... |
910a8e5e-3344-4d78-ba8b-90eb089a9c21 | 6 | void drawTo(int x2, int y2) {
if (draw_ox == -1) {
draw_ox = x2;
draw_oy = y2;
}
// need to draw a line from x1,y1 to x2,y2
if (draw_ox == x2 && draw_oy == y2) {
dpixels[x2 + rect.width * y2] = 1;
} else if (CircuitElm.abs(y2 - draw_oy) > Circu... |
69be529a-9511-4a9c-8a4d-72230d357311 | 4 | public int modflags() {
return ((modshift ? 1 : 0) | (modctrl ? 2 : 0) | (modmeta ? 4 : 0) | (modsuper ? 8
: 0));
} |
7cc47c8c-d673-4e68-82e6-55dab5b172b6 | 6 | public void draw(Graphics2D g){
spriteElapsed = (System.nanoTime() - spriteTimer) / 1000000;
if (type == 1 ){
g.drawImage(extraLifeImage,x,y,null);
}
if (type == 2){
g.drawImage(shotGunImage,x,y,null);
}
if (type == 3){
g.drawImage(machineGunImage,x,y,null);
}
if (type == 4){
g.drawImage(... |
2346bec6-98bc-41c9-be31-0bb6db376809 | 0 | public Resolver(Dealer deal, Player play){
decideWinner(deal, play);//This method decides the winner when the class is constructed
} |
f6a5e360-7748-45f0-8d42-f897e4150ce6 | 1 | public void testWithFieldAdded5() {
Partial test = createHourMinPartial();
try {
test.withFieldAdded(DurationFieldType.days(), 6);
fail();
} catch (IllegalArgumentException ex) {}
check(test, 10, 20);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.