method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
09ff9571-3880-4b69-9ea5-0958ccd5e136 | 8 | void appendButtonsToReport(boolean submit) {
Style style1 = null;
String s = null;
if (submit && !"true".equalsIgnoreCase(System.getProperty("mw.cd.mode"))) {
style1 = page.addStyle(null, null);
JButton button = new JButton(page.uploadReportAction);
s = Modeler.getInternationalText("Submit");
button.... |
4c22fb4f-9353-4d7c-a360-6a085665ffb3 | 7 | private void addMethods(CtClass proxy, Method[] ms)
throws CannotCompileException, NotFoundException
{
CtMethod wmethod;
for (int i = 0; i < ms.length; ++i) {
Method m = ms[i];
int mod = m.getModifiers();
if (m.getDeclaringClass() != Object.class
... |
c43f74be-f5e6-43ae-83e8-8d598c9977ca | 4 | public void saveTrace(String filename) {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
for (AgentState s : state){
if (s instanceof BacktrackingAgentState){
BacktrackingAgentState b = (BacktrackingAgentState)s;
int touch = (b.isHasTouched()) ? 1 : 0;
double sona... |
117ccf70-89e5-402a-8759-ef468f74fdfa | 2 | public static String getMD5(File file) {
DigestInputStream stream = null;
try
{
stream = new DigestInputStream(new FileInputStream(file), MessageDigest.getInstance("MD5"));
byte[] buffer = new byte[65536];
int read;
read = stream.read(buffer);
while (read >= 1)
read = ... |
4d95717a-d007-4b75-ae10-ad07fb9a9a9d | 6 | public static void checkPoints(Form form) {
if (form.getStart().x > form.getEnd().x
&& form.getStart().y > form.getEnd().y) {
Point temp = form.getStart();
form.setStart(form.getEnd());
form.setEnd(temp);
} else if (form.getStart().x < form.getEnd().x
... |
44713ead-f4c3-4bf7-aa51-26d45f8e1149 | 7 | private void addWrappedCall(ClassFile cf, CodeBuilder b, Method m) {
// Special behavior for equals method
boolean isEqualsMethod = false;
if (m.getName().equals("equals") && m.getReturnType().equals(boolean.class)) {
Class[] paramTypes = m.getParameterTypes();
isEqualsMe... |
c51cae95-3629-4304-a30d-c9026640ceb8 | 3 | @Test
public void rnfTest() {
userInput.add("hello");
userInput.add("daniel");
userInput.add("can you help me with cooking");
userInput.add("apple");
userInput.add("yes");
runMainActivityWithTestInput(userInput);
assertTrue(nlgResults.get(2).contains("what") || nlgResults.get(2).contains("What")
&& n... |
10486415-c337-4104-934c-575e7b66befe | 0 | public HashOperationException(Exception e, String name){
super(e, name);
} |
ad842f28-3cdf-4f03-a471-ca5d683a1db5 | 2 | private static void initGuiConfig(JSONObject json, Gui gui) throws BadConfig {
JSONObject guiConfig = toJSONObject("gui-config", json.get("gui-config"), false);
try {
if (guiConfig == null) {
gui.setConfigLocation(null, null);
return;
}
gui.setConfigSize(toInteger("width", guiConfig.get("width"), f... |
9609b6ae-8022-4e4e-8202-688080c31caf | 4 | public void playSound(Location location)
{
for (String sound : sounds)
{
Packet62NamedSoundEffect soundPacket = new Packet62NamedSoundEffect(sound,
location.getX(), location.getY(), location.getZ(), volume, pitch);
if (soundPacket != null)
{
for (Player player : location.getWorld().getPlayers... |
66d55fe3-193f-476b-9a31-5d88555db37f | 6 | public void loadOrdersWithDate(Date date)
{
orderlistWithDate.clear();
availableItems.clear();
itemlistReserved.clear();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int h = 0;
for (int j = -1; h < 2; j++)
{
if (j == ... |
47b6c273-c547-4c11-b8bf-5264bf19232e | 9 | @Test
public void testReporProduto() {
try {
Assert.assertEquals(10, facade.getQuantidadeProduto(1));
Assert.assertTrue(facade.buscarProduto(1).equals(this.p1));
} catch (FacadeException e) {
Assert.fail(e.getMessage());
}
try {
facade.reporProduto(1, 5);
Assert.assertEquals(15, facade.getQuanti... |
7b56a84d-329d-4f31-bb5a-a32f7dfdc77c | 0 | public void setPassword(String password) {
this.password = password;
} |
04531351-250d-47de-b355-0cb618efa11d | 7 | private void requestClose(boolean withSaving) {
if (withSaving) {
if (showConfirmDialog(this, res.get("i.confirm-save"), "", YES_NO_OPTION) != YES_OPTION) {
return;
}
ConnectorMap m = new ConnectorMap();
for (Object o : listModel.toArray()) {
... |
1c1f087a-a43c-4378-9b3d-9291e1c1b767 | 7 | private static Type decodeType(int dataType) throws IOException {
Type result;
switch (dataType) {
case 0: result = Type.U8 ; break;
case 1: result = Type.STRING; break;
case 2: result = Type.U16 ; break;
case 3: result = Type.U32 ; break;
case 4: result = Type.X8 ; break;
cas... |
604253fe-8567-46cc-a891-10bc4236c55d | 7 | public CompleteDownloadView(){
super();
this.mangaNameTF = new JTextField();
this.mangaUrlTF = new JTextField();
this.pathTF = new JTextField();
this.pathFC = new JFileChooser();
this.pathFC.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
this.startBT = new JButton("Start");
this.stopBT = new JB... |
6f839764-8469-4efa-a806-10dd20946be4 | 6 | public void manageCollision(Sprite sprite1, Sprite sprite2, int countFaced) {
if (oldSprite1 == null || (oldSprite1 != sprite2 || oldSprite2 != sprite1)) {
ElementField first, second;
first = Buffer.findElement(sprite1);
second = Buffer.findElement(sprite2);
TYPE ... |
fe52b167-f16d-45c3-8e0b-c256c1fa407e | 0 | public String getName() {
return name;
} |
0c22b746-713b-4e7b-9c85-6c13de87635d | 2 | public static int getHeadingDifference(int heading1, int heading2){
int result = heading1 - heading2;
if(result < -180)
return 360 + result;
if(result > 180)
return 0 - (360 - result);
return result;
} |
131e65cc-8542-4ec1-9df6-d61bf727da0e | 2 | private void renderProgressBar(Screen screen) {
int lClear = linesCleared;
if (lClear < 0) {
lClear = 0;
}
int offset = HEIGHT/GOAL_LINES * lClear;
if (offset > HEIGHT) {
offset = HEIGHT;
}
screen.renderBlank(getX(), getY()+offset, WIDTH-PROGRESS_BAR_WIDTH, HEIGHT-of... |
a813b936-e747-41fb-9525-20856b3b38cb | 6 | public String toString() {
try {
// Invoke the static toString() method of the player class
Method displayNameField = playerClass.getMethod("getType", (Class[]) null);
Player player = (Player) playerClass.newInstance();
return (String) displayNameField.invoke(player, (Object[]) null);
}... |
d5b87075-431d-4fca-bf16-e493cdaf4b81 | 6 | public String viewErros(TablaTrans tabla) {
String result = "";
int estado_actual = 0;
for (int i = 0; i < listaToken.size(); i++) {
estado_actual = Math.abs(estado_actual); // estado anterior
estado_actual = tabla.getEstadoSiguiente(estado_actual, listaToken.get(i).getVa... |
222b07b7-72c5-4baa-bdbe-de08158f15f7 | 2 | public void addElement(ValueType value) {
if (amount == 0) {
SetElement<ValueType> current = new SetElement<>(value);
head = current;
tail = current;
amount++;
} else {
if (!exist(value)) {
SetElement<ValueType> current = new Se... |
35b44719-d196-4cd2-8b26-7fa23736a1cf | 2 | public static void acceptTeleportRequest( BSPlayer player ) {
if ( pendingTeleportsTPA.containsKey( player ) ) {
BSPlayer target = pendingTeleportsTPA.get( player );
target.sendMessage( Messages.TELEPORTED_TO_PLAYER.replace( "{player}", player.getDisplayingName() ) );
player.... |
4975f2bc-1d58-4cb5-a7fb-a0d60228d799 | 0 | public int GetSequence()
{
return sequence;
} |
c45ff7da-939a-4c51-a881-2eb0ef188ce8 | 1 | protected void stateChange(AutomataStateEvent event) {
if (event.isMove())
invalidate();
else
invalidateBounds();
} |
f43945fc-8d24-4fb6-ae72-1a396cb7d73d | 6 | public static void main(String [] args) {
display.CreateDisplay.frame();
// Model model = new Model("Glass");
// model.createModel();
while(!Display.isCloseRequested()) {
switch(state){
case Main_Menu:
Menu.startup();
Menu.loop();
Menu.stop();
break;
case ThreeDeeTest:
... |
bec2809f-93fc-4f0f-ac0c-59e0b9a1c004 | 3 | @Override
public void keyPressedHandler(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_1) {
newWindow("A New Frame");
} else if (e.getKeyCode() == KeyEvent.VK_2) {
newDialog("A New Dialog");
} else if (e.getKeyCode() == KeyEvent.VK_3) {
newCombatVisualize... |
a7814f7a-bb2c-4e17-b34e-271e52ca54b7 | 4 | private String consumeSubQuery() {
StringBuilder sq = new StringBuilder();
while (!tq.isEmpty()) {
if (tq.matches("("))
sq.append("(").append(tq.chompBalanced('(', ')')).append(")");
else if (tq.matches("["))
sq.append("[").append(tq.chompBalanced(... |
de659487-c139-4f74-a603-96791e2daaf6 | 1 | private void inOrderRec(Position<T> node) throws InvalidPositionException {
if (node != null) {
BTPosition<T> BTnode = checkPosition(node);
inOrderRec(BTnode.getLeft());
System.out.print(node.element() + " ");
inOrderRec(BTnode.getRight());
}
} |
d131f2cb-a44e-49da-823f-403b299a0fb9 | 1 | public void input()
{
level.input();
if(Input.getKey(Input.KEY_1))
System.exit(0);
// if(Input.getKeyDown(Input.KEY_R))
// {
// AudioUtil.playMidi(playlist.get(track));
// }
} |
ba4df203-a316-4435-9d94-9d37249045fc | 2 | @Test
public void test() {
Comment fetchedComment = (Comment) MongoHelper.fetch(comment, "comments");
if(fetchedComment == null)
TestHelper.failed("comment not found");
fetchedComment.setText("Edited Text");
if(!MongoHelper.save(fetchedComment, "comments")... |
7102b706-5140-4a2a-89d1-48781b0a4131 | 8 | public Map<String, String> ReadMsg(int msg_id) {
Map<String, String> map = null;
String query = String.format("select msg.msg_id as msg_id, u.user_id as user_id," + " aut.username as username, message_subject, message_text" + " from %1$sprivmsgs_to msgto" + " left join %1$susers aut on msgto.author_id =... |
87b7e6e3-28bc-4565-8d0c-169c774f094f | 6 | @Override
public void onMessageReceived(Message message) {
LOG.info(message.toString());
switch (message.getType()) {
case ASK_FOR_LOCATION:
String droneId = new String(message.getPayload());
if (droneId.equals(this.drone5937.getId())) {
if(this.drone5937DispatcherThread != null){
this.dro... |
1188c028-0084-477e-b6f1-2b75040c4fdc | 7 | protected void addMissing(Instances data, int level,
boolean predictorMissing, boolean classMissing) {
int classIndex = data.classIndex();
Random random = new Random(1);
for (int i = 0; i < data.numInstances(); i++) {
Instance current = data.instance(i);
for (int j = 0; j < data.numAt... |
268daf4c-b5a1-453c-8d93-a0c857537315 | 4 | public boolean debugCheckAssertOnly() {
if ( ! (status == 'O' || status == 'F' || status == 'P') ) {
return incoherenceOuTrucBizarre();
}
if ( ligneDeCaisses.caisse(numeroMem) != this ) {
return incoherenceOuTrucBizarre();
}
return true;
} |
53c2d23e-c264-49d8-844b-e0f8c1f8a35e | 0 | public SelectionDrawer getDrawer() {
return drawer;
} |
95d52807-acff-4c83-bd9d-c6bca36d3400 | 7 | public boolean validateString(String validationString, String valueName, String printName, int maxLength, boolean isRequired,
boolean isEmail, boolean isName) {
//muuttuja, joka lähetetään, validoinnin onnistuessa tai epäonnistuessa
boolean success = true;
//virheviesti
String virhe;
//jos ... |
dc995135-e234-4356-84a8-89a98e1bd7df | 5 | public Integer[] getLineWinningMove(Integer[] move, String type, int i,
String line) {
int j;
if(checkLineNeedWinning(line)) {
j = line.indexOf(" ");
} else {
return move;
}
if(type.equals("row")) {
... |
7a47ae83-ac98-457e-894e-a8a7da25e298 | 9 | private void updateThisPlayerMovement(PacketBuilder packet) {
/*
* Check if the player is teleporting.
*/
if (player.isTeleporting() || player.isMapRegionChanging()) {
/*
* They are, so an update is required.
*/
packet.putBits(1, 1);
/*
* This value indicates the player teleported.
*... |
a7b5bdf8-44ab-459c-9107-9937ffbb67f9 | 3 | public void mouseReleased(MouseEvent e) {
if (e.isControlDown() || e.isAltDown()) {
// eyedropper mode, similar to Alt-Click in PhotoShop and Corel Paint.
updatePalettes(e);
} else if (e.isMetaDown()) {
// right-click
updateCell(e);... |
bd0f8c80-f443-40f4-a518-391d8fc8e644 | 8 | @Override
public void spring(MOB target)
{
if((target!=invoker())&&(target.location()!=null))
{
if((!invoker().mayIFight(target))
||(isLocalExempt(target))
||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
||(target==invoker())
||(doesSaveVsTraps(target)))
target.location().sho... |
a9e6b21f-7362-421e-88ae-276407dbe992 | 4 | public boolean getMapVal(int i, int j)
{
if (i < 0) i = 0;
if (i >= 480) i = 479;
if (j < 0) j = 0;
if (j >= 640) j = 639;
return Map[i][j];
} |
671e2e5f-353e-46ab-a15a-466bff631c83 | 8 | public DataItem searchItem(String key) {
Node posNode = root;
while (true) {
if (posNode == null) {
break;
}
int itemPos;
System.out.println("================node :" + posNode.getCount());
for (itemPos = 0; itemPos < posNode.... |
dc47c375-2797-49aa-94cd-3fc86877a710 | 3 | public static boolean lockInstance(final String lockFile) {
try {
final File file = new File(lockFile);
final RandomAccessFile randomAccessFile = new RandomAccessFile(
file, "rw");
final FileLock fileLock = randomAccessFile.getChannel().tryLock();
if (fileLock != null) {
Runtime.getRuntime().addS... |
7ed3a1d3-696e-463c-976e-202703585344 | 5 | public void downImage(final String imgUrl, final String folderPath,
final String fileName) {
System.out.println("开始下载图片:" + imgUrl);
File destDir = new File(folderPath);
if (!destDir.exists()) {
destDir.mkdirs();
}
pool.execute(new Runnable() {
@Override
public void run() {
HttpClient client ... |
07a6b88b-061c-4a75-9980-0012c173925c | 9 | public static boolean maybeStraight(List<Card> sourceCards, HandCombinationSink handCombinationSink) {
final Holder<Hand> bestHandHolder = new Holder<Hand>();
CardCombinator.iterate(sourceCards, new CardCombinationCallback() {
@Override
public boolean process(List<Card> cards) {... |
0863c57e-10fe-46c4-bd77-47c5f1a099ff | 3 | protected byte[] getHeader() {
byte[] header = new byte[MINIMUM_PAGE_SIZE + numLVs];
header[0] = (byte)'O';
header[1] = (byte)'g';
header[2] = (byte)'g';
header[3] = (byte)'S';
header[4] = 0; // Version
byte flags = 0;
if(isContinue) {
flags ... |
2f3dc691-f629-4944-a152-66b7839f3375 | 1 | public void cancelMove() {
if(canCancelMove())
willCancelMove = true;
} |
364f19ea-c9a4-4a0b-b0b4-74aa7c6a9029 | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((amount == null) ? 0 : amount.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((facility == null) ? 0 : facility.hashCode());
result = pr... |
9bec2f5e-8f9c-4cb9-aa95-bd44f1ebe273 | 1 | public void doPost(HttpServletRequest req,
HttpServletResponse res)
throws IOException, ServletException {
//first goal is to be able to receive and process
//a well formatted XML move piggybacked on a POST
//this gives me a raw stream to payload of Post reque... |
3c63dcc7-38f8-4a87-bb13-595ebc934cf2 | 4 | protected void onDisconnect()
{
int tries = 0;
while (tries < 1000 && !isConnected())
{
try
{
connect(ServerName, ServerPort, ServerPassword);
} catch (Exception e)
{
this.log("Connection attempt " + tries + " failed.");
tries++;
if (tries >= 1000000)
System.exit(0);
}
} // ... |
c7772fc9-3a5d-42ec-b752-daa668cf1e56 | 8 | public Content deprecatedTagOutput(Doc doc) {
ContentBuilder result = new ContentBuilder();
Tag[] deprs = doc.tags("deprecated");
if (doc instanceof ClassDoc) {
if (Util.isDeprecated((ProgramElementDoc) doc)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel... |
566db292-6d5d-41fa-9221-bbeb386bed44 | 2 | @Override
public void onDeath() {
if (Math.random() <= 0.35) // 35% prob. spawning ghost
{
boolean left = Math.random() < 0.5;
Game.world.addEntity(new Ghost(left ? 0 : Game.world.width, Game.world.height / 2), false);
}
super.onDeath();
} |
021bb972-191f-43d8-8806-815ae7bbcbd5 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (rolidRol != null ? rolidRol.hashCode() : 0);
return hash;
} |
8ed13ade-99b3-4012-88cf-02359f198596 | 9 | public void levelBuilder(){
if(Game.building){
if(input.mousePressed){
if(!input.isKeyDown(KeyEvent.VK_SHIFT)){
Tile t = new Tile((input.mouseX)/32, (input.mouseY-this.insets.top)/32, TileType.BRICK);
tiles.add(t);
t.Init(gh);
}else{
ArrayList<Tile> toRemove = new ArrayList<Tile>();
f... |
985d0629-0706-4f28-9687-f01558fea969 | 3 | public boolean gridValid(char[][] board, int start_row, int start_column) {
int[] countPerNumber = new int[9];
clearCounts(countPerNumber);
for (int i = start_row; i < start_row + 3; i++) {
for (int j = start_column; j < start_column + 3; j++) {
if (board[i][j] != '.') {
int curInt = (int) board[i][j]... |
62a3685c-1bc6-41f3-b9c6-2cf0f597ecd1 | 8 | @Override
public ServerModel buildCity(BuildCityRequest request, CookieParams cookie) throws InvalidMovesRequest, ClientModelException {
if(request == null) {
throw new InvalidMovesRequest("Error: invalid build city request");
}
ServerModel serverGameModel = serverModels.get(cookie.getGameID());
//ex... |
7691dc83-b680-4dcb-afef-5b3ca5ac834d | 0 | @Test
public void testBook() throws Exception {
//Create query arguments. TicketQueryArgs is used for external client with human readable parameters.
TicketQueryArgs query = new TicketQueryArgs();
query.setDate(LocalDate.now());
query.setDepartureStation("北京南");
query.setDestinationStation("南京南");
query.se... |
00ddf9dc-4c56-4b8f-827a-13e064e6e7b5 | 9 | private void generateCallArgArray(Node node, Node argChild, boolean directCall)
{
int argCount = 0;
for (Node child = argChild; child != null; child = child.getNext()) {
++argCount;
}
// load array object to set arguments
if (argCount == 1 && itsOneArgArray >= 0) ... |
8044c961-be9c-436c-81af-3fabcb63c526 | 6 | public static int getPlatform()
{
String osName = System.getProperty("os.name").toLowerCase();
if(osName.contains("win")) return 2;
if(osName.contains("mac")) return 3;
if(osName.contains("solaris")) return 1;
if(osName.contains("sunos")) return 1;
if(osName.contains... |
edc6dc95-ec1d-42fb-a8b2-d98d031fc113 | 0 | public void setAlstromeria(int alstromeria) {
this.alstromeria = alstromeria;
} |
ef6f2fe0-546d-402e-91c6-c0d38d640350 | 9 | public static boolean cambiarLetrasOrden(char[] pActual, char[] pNueva) throws Exception {
char [] abecedario = "abcdefghijklmnopqrstuvwxyz".toCharArray();
int [] comprobarPActual = new int[abecedario.length];
int [] comprobarPNueva = new int[abecedario.length];
int contador = 0;
... |
e72d9640-8567-4970-86d0-523e00113128 | 4 | @Override
public boolean checkGrammarTree(GrammarTree grammarTree,
SyntaxAnalyser syntaxAnalyser) throws GrammarCheckException {
syntaxAnalyser.setOperionName("slice");
GrammarTree tree = grammarTree.getSubNode(0);
if (tree == null
|| (tree.getSiblingAmount() != 1 && tree.getSiblingAmount() != 3)) {
G... |
d5b86076-d753-4dde-b70e-5475b56f70bc | 1 | public int compareTo(final ComparableNumber o) {
if (number.getClass().equals(o.getNumber().getClass())) {
return ((Comparable) number).compareTo((Comparable) o.getNumber());
} else {
return new Double(number.doubleValue()).compareTo(o.getNumber().doubleValue());
}
} |
fe5dad8a-50a4-4526-8793-3aa9c92c43c6 | 7 | private static void readFromFile(String filename) throws IOException {
BufferedReader br = null;
String line;
if(filename == null){
System.out.println("No file path specified!");
return;
}
File AddFile = new File(filename);
if(!AddFile.exists())
{
System.out.println("File " + filename + " not fou... |
53a9b24d-3a49-4bbf-a511-ee00221bdf2e | 7 | public void createMapping(Class<?> aClass) throws ClassValidationException {
CSVEntity annotation = aClass.getAnnotation(CSVEntity.class);
if (annotation == null) {
logger.severe("Class " + aClass.getName() + " is not annotated with " + CSVEntity.class.getName() + " annotation");
return;
}
if (!classMap... |
9990120f-6f76-48e0-9c7c-ee16c02ad995 | 7 | public void renderBackground() {
for(int c = 0; c < 25; c++) {
if(c == 0) {
batch.draw(groundTiles[0], c * 32, 0);
}
else {
batch.draw(groundTiles[1], c * 32, 0);
}
}
for(int r = 1; r < 4; r++) {
for(int c = 0; c < 25; c++) {
batch.draw(backgroundLight, c * 32, r * 32);
}
}
for(i... |
ba83769a-52bf-49fe-963a-985c1378616f | 0 | @MethodAnnotation
public void doNothing()
{
} |
da2ca8ef-d04e-4b87-858d-291e652620be | 9 | private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed
if (lab_modo.getText().equals("Alta")){
if (camposCompletos()){
ocultar_Msj();
insertar();
menuDisponible(true);
... |
fb9c16b6-b049-4a42-86d6-554b5aad0621 | 8 | public String saveOrder() throws Exception {
String ret = "";
orderSQL = "INSERT INTO ORDERS(BUYER_NAME,";
orderSQL += " SHIPPING_ADRESS, SHIPPING_ZIPCODE, SHIPPING_CITY)";
orderSQL += " VALUES(?,?,?,?)";
try {
// load the driver and get a connection
Cla... |
7bac9e4a-8fe7-4be7-b690-eb395c9d3d61 | 8 | public void imprimeArbol(Nodo E){
if(E==null) return;
ArrayDeque<Nodo> currentlevel,nextlevel;
currentlevel=new ArrayDeque<Nodo>();
nextlevel=new ArrayDeque<Nodo>();
currentlevel.add(E);
while(!currentlevel.isEmpty()){
Nodo currNode=currentlevel.poll();
if(currNode!=null){
for(int i=0;i<curr... |
8da102af-817f-465a-871a-88fc33900d23 | 8 | public static void main(String[] args) {
CommandLineParser parser = new DefaultParser();
Options options = new Options();
final Logger logger = LoggerFactory.getLogger(Application.class);
logger.info("Application for generating web-pages");
options.addOption("m", "metrics", fal... |
03e1373f-ae45-47e7-8641-37d101687279 | 0 | public BigInteger getNumberOfTransactions() {
return numberOfTransactions;
} |
130367c1-697a-41a7-a5ef-25b196e6b7b8 | 2 | static byte[] getImage(OP code) {
int retID=code.resID;
ClassFile cf=(ClassFile)cf_orig.clone();
// set return type
int otsize=cf.tsize;
cf.tsize=retID_patchback;
cf.write((byte)retID);
cf.tsize=otsize;
String retName;
if ((retID<8))
retName=OP.specialTypes[20+retID].getName... |
e79d56c3-f37d-425c-b551-a39d568196e5 | 5 | @Test
public void addBookingTest() {
Student s = null;
try {
s = familyService.findStudent(3);
} catch (InstanceNotFoundException e) {
assertTrue("Student not found", false);
}
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
Calendar cb = Calendar.getInstance();
try {
cb.setTime(sdf.p... |
fd55fb12-1d62-4de7-82d4-60b968a6729c | 8 | private void placeNewOrderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_placeNewOrderButtonActionPerformed
// TODO add your handling code here:
// When place order button is pushed
// Check if subtotal and totals have been changed
if (!"£0.00".equals(... |
fe5eadf8-b227-4b80-b605-7078912fe4d6 | 6 | static List<UnixTimeInterval> parseIntervals(Map<String, Object> params) {
List<UnixTimeInterval> intervals = new ArrayList<UnixTimeInterval>();
Integer intervalIndex = null;
Boolean isStart = null;
UnixTimeInterval interval = null;
for(String key : params.keySet()) {
intervalIndex = null;
interval =... |
33b24b2f-6759-4df9-a8b4-24e3f1d64e91 | 5 | private void updateEnemies() {
for (int i = 0; i < enemyList.size(); i++) {
enemyList.get(i).update();
if (enemyList.get(i).isArrived() || enemyList.get(i).isDestroyed()) {
if (enemyList.get(i).isDestroyed()) {
GameInstance.credits += enemyList.get(i).... |
02909c1f-f545-473c-8a24-05c9705be323 | 8 | protected void runLoop2() {
int numKeys = 0;
try {
log.info("going into selector");
numKeys = selector.select();
log.info("coming out with keys="+numKeys);
} catch (IOException e) {
log.log(Level.WARNING, "Having trouble with a channel", e);
}
Set<SelectionKey> keySet = selector.selectedKeys();
... |
6be2894a-a1c4-406c-b5df-c6516e6524fc | 5 | public Result combine(EvaluationCtx context, List parameters,
List policyElements) {
boolean atLeastOne = false;
AbstractPolicy selectedPolicy = null;
Iterator it = policyElements.iterator();
while (it.hasNext()) {
AbstractPolicy policy =
... |
a9722eff-3810-4b65-8047-267fbe3f6b6b | 1 | private void installApplication_androidButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_installApplication_androidButtonActionPerformed
if (selectedDevice != null)
new InstallApplicationMenu(logger, debug, adbController, settings, parser, selectedDevice).setVisible(true);
... |
85ad5055-1dfd-4273-bd35-371ee55ee7b3 | 1 | public void deleteElement(String value) {
int codeValue = Math.abs(value.hashCode() % length);
if (exists(value)) {
hashTable[codeValue].deleteElement(value);
}
} |
6bd00cbb-3c50-43e7-b78a-66682542bb6e | 2 | private static boolean unitTestParseAssemble (
String test_url
) {
MuteableURL m_url = new MuteableURL(test_url);
String result = m_url.getURLString();
System.out.println("TEST URL: " + test_url);
System.out.println(" RESULT: " + result);
if (test_url == null) {
System.out.println("INVALID TEST: NULL")... |
ca1678a1-f835-47c4-86db-c952fd151a4f | 5 | private final void waitForButton(
@SuppressWarnings("hiding") final String text) {
try {
synchronized (Button.class) {
if (this.master.isInterrupted()) {
return;
}
revalidate(true, true);
this.pressed = null;
if (Thread.currentThread() != this.master) {
this.master.interrupt();
... |
dcb863fc-9a9b-466d-ac9a-0d6b8d762d19 | 5 | public static Res cResultHelper(String expr) {
// the helper function return number of true combination
// as well as the number of false combination
// do some string parsing
int n = expr.length() / 2 + 1; // number of bit
Res[][] s = new Res[n][n];
// initialize the table
for ( int d = 0 ;... |
9f83e4b8-3f31-4b5f-9622-347d695e756e | 5 | private void remove(int i) {
if (i == 1) {
firstElement = firstElement.getNextElement();
} else if (i > 1) {
Element tmpf = firstElement;
Element tmps = firstElement.getNextElement();
Element tmpt = firstElement.getNextElement().getNextElement();
... |
8ec3d758-68f4-4466-a7cd-31556bfc5b3d | 3 | public void act(){
if (show){
if (counter >= 2){
counter = 0;
trans -= 30;
if (trans >= 0){
bg.setTransparency (trans);
}
else{
m.removeObject (this);
}
... |
e70a0462-e9b3-4a0a-ad16-a5149bc9bbf3 | 6 | public int varianceLookback( int optInTimePeriod,
double optInNbDev )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 5;
else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) )
return -1;
if( optInNbDev == (-4e+37) )
optInNbD... |
5a0789d1-dd5e-4b11-a4fe-a9e765b3f069 | 8 | protected int partition(int attIdx, int[] index, int l, int r) {
double pivot = m_Instances.instance(index[(l + r) / 2]).value(attIdx);
int help;
while (l < r) {
while ((m_Instances.instance(index[l]).value(attIdx) < pivot) && (l < r)) {
l++;
}
while ((m_Instances.instance(in... |
6e976dbe-a90a-4844-9bd7-c2365d95eed4 | 4 | public void refresh() {
for (int iteration = 0; iteration < panes.size(); iteration++) {
final Pane pane = panes.get(iteration);
pane.refresh();
//need to fix issue with small panes (index out of range)
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (pane.buffer[x][y] !=... |
0cfa532f-71a2-4ff0-9f93-e967f3bcfd05 | 8 | public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
// System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime... |
a940469b-ec81-48e8-8327-0c25c7c749db | 6 | public void moveHuman(final Direction dir,
final ActionListener terrifyHumanCallback,
final ActionListener healHumanCallback)
{
if (maze.hasDoorAt(dir, location))
{
location = new Location(location, dir);
invader.pickupStrategy(maze.getStrategy(location));
maze.visit(location);
... |
6f348caf-3f81-442f-87d8-9d6f06e54e4d | 1 | public void draw(Graphics g, boolean filled) {
g.setColor(myColor);
if (filled) {
g.fillOval(getUpperLeftX(), getUpperLeftY(), getWidth(), getHeight());
} else {
g.drawOval(getUpperLeftX(), getUpperLeftY(), getWidth(), getHeight());
}
} |
7e2a0bfb-826a-4191-8e64-0c2b27e1b1b3 | 2 | public Node getNode(String idRef) throws IDrefNotInSentenceException {
if (terminals.containsKey(idRef))
return terminals.get(idRef);
else if (nonterminals.containsKey(idRef))
return nonterminals.get(idRef);
else throw new IDrefNotInSentenceException("idRef: " + idRef + " not in Sentence: " + getId());
} |
1cd73cf1-d5cf-48de-a222-cfbfe5bfcb4f | 9 | @Override
public void displayAllStates(List<GameState> AllStates){
final String newline = "<br>";
String output = "<html>";
for(GameState gameState: AllStates){
int[] PlayerRoles = gameState.AllPlayers();
for(int i = 0; i < PlayerRoles.length; i++){
output += "(" + (i+1) + " " + RunFileGame.getPlayerNa... |
0016de3e-ec23-432d-9d51-7a67f0dfad6e | 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();
... |
87fd2fd9-83f9-4cfe-8c8b-ca5635ccda74 | 6 | static void client_server_closes() {
final TCPClientLoop client_loop = new TCPClientLoop();
client_loop.start();
Callback.TCPClient client = new Callback.TCPClient() {
public void onConnect (TCPClientLoop l, SocketChannel sc) {
assert(l == client_loop);
byte [... |
24d4c41b-354f-4650-b1c9-c3496a4e6237 | 0 | public int getValue() {
return value; //You may need to change this
} |
27991298-8af8-434a-a234-116b1cd1df28 | 0 | public IrcMessage(IrcClient client, MessageTypes type, String rawmessage)
{
this.Client = client;
this.Type = type;
this.RawMessage = rawmessage;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.