method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fe684274-00f2-473b-821a-adf8877a88b7 | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = in.readLine();
int n = Integer.parseInt(line);
int dates[];
ArrayList<laptop> lista = new ArrayList<laptop>();
for (int i = 0; i < n; i++) {
dates = atoi(in.... |
2f761c8e-dc03-4603-a374-4e9abdedcc63 | 4 | private void processLsCommand() {
if (processClasses.isEmpty()) {
System.out.println("No migratable program ");
} else {
System.out.println("All migratable programs:");
System.out.println("-------------------------------");
Iterator<Class<? extends Migrata... |
8e76d2f0-67b9-49f3-93d0-d5ee3313c217 | 0 | public void setDeadZone(int index, float zone) {
deadZones[index] = zone;
} |
5f6f8b4c-794d-4d80-8212-4be08a11b9c6 | 6 | @EventHandler
public void GiantStrength(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.Strength.... |
c1f0d46f-2fc0-45a3-a5d9-24d09c094c74 | 9 | public void processDamagedCells(final StyledTextConsumer consumer) {
final int startRow = 0;
final int endRow = myHeight;
final int startCol = 0;
final int endCol = myWidth;
myLock.lock();
try {
for (int row = startRow; row < endRow; row++) {
... |
1b02c05a-bed0-48f5-8e9a-ecacf67e405e | 3 | private boolean charIsAlpha() throws EOSReachedException
{
char c = this.getChar();
return (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
} |
bcf2935b-f76a-4fa4-9848-82450a7897ac | 2 | public static boolean toBoolean(int value) {
boolean result;
if (value == TessAPI.TRUE) {
result = true;
} else if (value == TessAPI.FALSE) {
result = false;
} else {
throw new IllegalArgumentException("Invlid boolean value. Expected " +
... |
a7c9b43b-a2ac-44c5-8855-ae822671aff6 | 6 | public void setPosition()
{
setLocation(x,y);
setImage(bondImage);
if (speed > maxSpeed)
{
speed = maxSpeed;
}
else if (movement)
{
speed++;
}
else
{
speed = 0;
}
if (x<0)
{
... |
d0f39f74-6932-4415-9d78-00ac66a8a2ea | 6 | public void redoSquares() {
for (int y = 0; y < squares.length; y++) {
for (int x = 0; x < squares[y].length; x++) {
/*for (int a = 0; a < squares[y][x].length; a++) {
squares[y][x][a] = null;
}*/
sqSizes[y][x] = 0;
}
}
int start = sliceStart * squareSize;
int end = (sliceStart + sliceWi... |
74b7f4ba-94a1-4026-bb52-be96a3daeb48 | 5 | public void changeImg(String s){
if(s.equals("dead"))
curImg = dead;
else if(s.equals("left"))
curImg = left[0];
else if(s.equals("right"))
curImg = right[0];
else if(s.equals("leftHarmed"))
curImg = leftHarmed;
else if(s.equals("rightHarmed"))
curImg = rightHarmed;
} |
edee1c1c-c881-4471-b598-bece6863cdb7 | 8 | @Override
public void init()
{
super.init();
lc = getByteAt( 0 );
fc = getByteAt( 1 );
rowIndex = ByteTools.readShort( getByteAt( 2 ), getByteAt( 3 ) );
int pos = 4;
for( int i = 0; i < ((lc - fc) + 1); i++ )
{
try
{
int type = getByteAt( pos++ );
switch( type )
{
case 0: // em... |
a359cc47-c434-40b0-b811-3e2759f2d8fe | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result + radius;
return result;
} |
72542569-25d9-4ed3-a6f1-c66143c62a72 | 0 | @Column(name = "percent")
@Id
public double getPercent() {
return percent;
} |
3e4870b1-4dee-4a97-afaa-78864e67a52c | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EmployeeUser that = (EmployeeUser) o;
return id == that.id && !(employee != null ? !employee.equals(that.employee) : that.employee != null) && !(passwo... |
5274fbb3-f863-483c-8d39-9e00b3af024c | 1 | public boolean editShipInBounds(Ship ship)
{
if(myTurnEditing)
return mySea.shipInBounds(ship);
else
return theirSea.shipInBounds(ship);
} |
e5f0a6e0-b303-4e17-98ff-8b93317a6dda | 3 | private static int binarySearch(int[] A, int target, int l, int r) {
while (l <= r) {
int mid = l + (r - l) / 2;
if (target > A[mid]) {
l = mid + 1;
} else if (target == A[mid]) {
return mid;
} else {
r = mid - 1;
}
}
return -1;
} |
1c2632c1-2c28-4586-a00f-03c3227b2665 | 9 | public synchronized boolean mergeIntoMemberList(Process process) {
int index = process.getGlobalList().indexOf(getAlteredNode());
MemberNode matchingNode = index == -1 ? null : process.getGlobalList().get(index);
if (checkIsIntructionJoinVariant()) {
if (matchingNode == null
&&
/* && checkHasJoinA... |
d7a86542-2a20-449a-92b0-28c71a415d8b | 4 | @Override
public Void doInBackground() throws IOException {
if (taskOption == TaskOptions.EXPORT) {
if (!exportStory()) {
// Show popup to user that exporting failed
JOptionPane.showMessageDialog(
Main.this,
... |
21ae68f5-adf3-48a1-85fc-bad3828c49cd | 0 | public final void SetStream(InputStream stream)
{
Stream = stream;
} |
5539ddfa-f677-4f27-af33-a369d7bc8811 | 7 | static Object js_createAdpter(Context cx, Scriptable scope, Object[] args)
{
int N = args.length;
if (N == 0) {
throw ScriptRuntime.typeError0("msg.adapter.zero.args");
}
Class superClass = null;
Class[] intfs = new Class[N - 1];
int interfaceCount = 0;
... |
5715a53d-faf3-4f0c-a41d-02abf773e745 | 4 | public void run() {
Thread thisThread = Thread.currentThread();
while (running) {
try {
if (reset > -1) {
clearScreenAndReset(reset);
}
offscreenGraphics.setPaintMode();
nextpoints(alg);
Thread.sleep(100);
long diff = (System.currentTimeMillis() - lastRunTime);
if (diff > 5000... |
8f66586c-8094-427b-80a4-3d2be5a7167b | 3 | boolean isAttackPlaceHorizontallyLeftNotHarming(int position, char[] boardElements, int dimension, int leftPosition) {
while (leftPosition > 0) {
if (isPossibleToPlaceLeft(position, dimension, leftPosition)
&& isBoardElementAnotherFigure(boardElements[position - leftPosition])) {... |
3257051d-944c-4493-a5f4-77bd64be4b4d | 1 | @Override
public void show () {
shapeRenderer = new ShapeRenderer();
renderer = new Box2DDebugRenderer();
playerSprite = Util.createSquareSprite(Pixels.toMeters(Gdx.graphics.getWidth() / 8), Pixels.toMeters(Gdx.graphics.getHeight() / 8), Color.BLUE);
playerSprite.setPosition(-playerSprite.getWidth() / 2 - 5... |
a0965b7c-768a-4341-b3b5-5bf3abbd4c96 | 9 | @Override
public boolean equals(final Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
final InnerDataSubscription that = (InnerDataSubscription)o;
if(_aspect != null ? !_aspect.equals(that._aspect) : that._aspect != null) return false;
if(_attributeGroup != ... |
b0915886-f6be-4f66-ab23-d30279542c00 | 3 | public static void writeEvent(PrintWriter pw, CalendarEvent evt) {
pw.println("BEGIN:VCALENDAR");
pw.println("CALSCALE:GREGORIAN");
pw.println("VERSION:2.0");
pw.println("METHOD:PUBLISH");
pw.println("BEGIN:VEVENT");
pw.printf("UID: %s%n", evt.getUuid());
Calendar c = Calendar.getInstance();
pw.printf("... |
d7d398ea-953f-445c-945e-87bb7815b321 | 0 | public int getSize() {
return size;
} |
e5aaebd2-4632-4889-9605-6a24332f24bf | 4 | @Override
protected Result unhandledKeyboardEvent(Key key) {
if(getSelectedIndex() == -1)
return Result.DO_NOTHING;
if(key.getKind() == Key.Kind.Enter || key.getCharacter() == ' ') {
if(itemStatus.get(getSelectedIndex()) == true)
itemStatus.set(getSel... |
aefd369f-5c1f-428e-b857-54fb37a3efbb | 6 | static double getDaysInYearFromBasis( int basis, long date0, long date1 )
{
double r = 0;
switch( basis )
{
case 0: // 30/360
case 2: // actual/360
case 4: // 30/360 (EURO)
r = 360;
break;
case 1: // actual/actual
GregorianCalendar fromDate = (GregorianCalendar) DateConverter.... |
21e4be69-444a-4cf7-9073-f2440d351409 | 4 | public static void main(String... args) {
ByteBuffer byteBuffer = ByteBuffer.allocate(10);
byteBuffer.put((byte) 3);
//此处如果不flip的话,那么取出来的就是0.
byteBuffer.flip();
System.out.println(byteBuffer.get());
byteBuffer.clear();
for (int i = 0; i < 10; i++) {
... |
e6fb3e89-274b-43f0-80fa-86f62d4d8297 | 9 | private Shape mPolygonShapeParser(Shape shape){
// Obtenemos las coordenadas de cada punto del shape
for (int x = 0; x < shape.getPoligons().size(); x++){
Coordinate[] coor = shape.getCoordenadas(x);
// Miramos por cada punto si existe un nodo, si no lo creamos
for (int y = 0 ; y < coor.length; y++){
... |
488c41ee-f1e2-4232-b81f-06cb97b45ad5 | 9 | public static boolean loadTreeNetworkTest(){
//!!! TEST WILL FAIL IF EQUALS COMPARES TREE IDs!!!
int portTemp=TaskClientNetDriver.SERVER_PORT;
InetAddress tempAddress=TaskClientNetDriver.SERVER_ADDRESS;
TaskClientNetDriver.SERVER_PORT=TEST_PORT;
try {TaskClientNetDriver.SERVER_AD... |
e81d7605-7164-4feb-a755-258daba75c94 | 9 | private static <T> void printDFSStack(List<Node<T>> adjList) {
Stack<Node<?>> stk = new Stack<>();
for (Node<T> node:adjList) {
Map<Node<?>, Integer> track = new HashMap<>();
System.out.print(node + "->");
track.put(node, 2);
// if (track.get(node) == null) {
// track.put(node, 1);
stk.push... |
385304ed-d938-4f8c-99cd-e4862b55a751 | 5 | static boolean isBoardElementAnotherFigure(char boardElement) {
return !isBoardElementEmpty(boardElement)
&& (boardElement == BISHOP.getFigure()
|| boardElement == ROOK.getFigure()
|| boardElement == KING.getFigure()
|| boardElement == KNIGHT.getFi... |
ccfcb1b2-30cc-4fec-9e6c-896e14a3ebb6 | 8 | private InitialCondition makeInitialCondition(Parameters p) {
if (p.getIC().equals("ProducerCheater")) {
// One cheater in a 5x5 block of cooperators, with the rest
// of the space empty
return new ProducerCheater(p);
} else if (p.getIC().equals("ProducerCheaterClump")) {
// A 3x3 block of cheaters ... |
be892cd6-75a2-450e-939b-13f969f4b6ad | 3 | public Dimension getPreferredSize(JComponent c) {
String tipText = ((JToolTip)c).getTipText();
if (tipText == null)
return new Dimension(0,0);
textArea = new JTextArea(tipText );
rendererPane.removeAll();
rendererPane.add(textArea );
textArea.setWrapStyleWord(true);
int width = ((MultiLineToolTip)c).ge... |
39059df5-b28a-466c-aa7e-febade0e43fc | 4 | private void clearReferences(DatabaseUpdater updater, MergeMapping mapping)
throws UpdateException {
if (mapping.isManyToMany()) {
String query = "DELETE FROM "+DB.ESCAPE+"" + mapping.getMappingTable() + ""+DB.ESCAPE+" WHERE "+DB.ESCAPE+""
+ mapping.getColumnFrom() + ""+DB.E... |
b5c31e5d-1353-4215-95cd-89e854a7e978 | 8 | public void mousePressed(MouseEvent event)
{
if(end == false){
//x = z;
z = getCardPressed(event.getX(), event.getY());
//top.setText("" + z + "");
//Integer i = new Integer(z);
//if(i != -1 && z != x) count++;
//if(cardSelect =... |
e2b387f1-2fec-4a75-8611-a9de4df3f3ef | 9 | void menu() {
Integer option;
String s;
boolean exit = false;
while (!exit) {
UI.printHeader();
System.out.println("Selecciona una acción a continuación:");
System.out.println("1) Ver conexiones establecidas");
System.out.println("2) Establecer una conexión");
System.out.println("3) Eliminar una... |
9e82acdd-6c7c-41f8-b116-8702e10a6b32 | 5 | public static Tile getTileConnectedToEntity(Entity e, int location){
if (map != null) {
switch (location) {
case UP:
return map.getTile(e.getX(),e.getY()-e.getHeight());
case DOWN:
return map.getTile(e.getX(),e.getY());
case LEFT:
return map.getTile(e.getX()-e.getWidth(),e.getY()-1);
case... |
35afc323-3b02-48a3-8ca2-73bb5a86d09a | 0 | public BodypartIconPanel(BodyPart bodypart) {
super();
this.bodypart = bodypart;
} |
064de05c-bf14-4f3b-8157-ede596c83f3e | 1 | public Timestamp getNoteUpdateTime(int noteId) throws SQLException {
NoteDatabaseManager dm = new NoteDatabaseManager();
String s_noteId = Integer.toString(noteId);
String sql = "select update_time from note where note_id = "
+ s_noteId + ";";
ResultSet rs = dm.sqlQuery(sql);
Timestamp noteUpdateTime =... |
25aff3e2-04fb-4519-9a29-ad550236d0de | 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... |
4781e571-c204-4572-ba79-3c1aac1416e5 | 1 | public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar(UnrestrictedGrammar.class);
if (g == null)
return;
BruteParsePane bpp = new BruteParsePane(environment, g, null);
environment.add(bpp, "Brute Parser", new CriticalTag() {
});
environment.setActive(bpp);
} |
b849d730-550f-4efd-955c-d5962d8ad750 | 7 | @Override
public BurstMap parse(final String s) {
final Map<String,Object> mp = new LinkedHashMap<String,Object>();
if((s!=null)&&(s.length()>0)&&(!s.equalsIgnoreCase(origHeader))) {
final String[] flds = sepPattern.split(s,-1); // do allow trailing nulls
if(null!=flds) {
if((flds.length>0)||(flds[0].tri... |
75458106-8d4e-4386-9976-efb0c48884cf | 0 | public GregorianCalendar getHora() {
return hora;
} |
c65db9a5-4d31-4611-af03-e8a31f4e2817 | 8 | public void printBoard()
{
System.out.println("________________");
for (int row = BOARD_SIZE; row >= 1; row--) {
for (int col = 1; col <= BOARD_SIZE; col++) {
ChessPiece piece = getPiece(row, col);
String print = "x";
if (piece instanceof K... |
6b4f27bc-16e4-471a-a312-ceeba3ec91a0 | 7 | public synchronized void playLoop(String file) {
if (Bootstrap.MUTE) {
game.log.jukebox("Game is muted, no sound played");
} else {
String type = null;
if (file.endsWith(".wav")) type = "wav";
else if (file.endsWith(".ogg")) type = "ogg";
if (type == "ogg") {
try {
OggClip ogg = new OggClip(... |
edc42346-548f-489c-932d-32096736b217 | 0 | public Vertex getPath() {
return path;
} |
84bfcb0b-4a92-41fc-a74f-2cf2ed729cc1 | 5 | private Direction convertToDirection(String direction) {
switch (direction) {
case "north":
return Direction.NORTH;
case "south":
return Direction.SOUTH;
case "west":
return Direction.WEST;
case "east":
return Direction.EAST;
case "up":
return Direction.UP;
default:
return Direction.DOWN... |
f69ebb2e-c0b5-4f51-aed6-bb71074a147b | 9 | private final void method3087(BufferedStream buffer, int i, int i_3_) {
if (i_3_ != 1) {
if ((i_3_ ^ 0xffffffff) == -3) {
buffer.readUnsignedByte();
} else if ((i_3_ ^ 0xffffffff) == -4) {
anInt3157 = buffer.readInt();
anInt3166 = buffer.readInt();
anInt3150 = buffer.readInt();
} else if ((i_... |
e67639cb-7cb5-489c-825e-62ac24ca7b9d | 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... |
eda50c1d-0ae1-493a-94ab-68dfd026c653 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idUsuario != null ? idUsuario.hashCode() : 0);
return hash;
} |
f00cb8fa-166c-4c9a-8b9a-c0bcdebc409c | 0 | protected void buildAttributes(Node node, StringBuffer buf) {
// Iterator it = node.getAttributeKeys();
// if (it != null) {
// while (it.hasNext()) {
// String key = (String) it.next();
// Object value = node.getAttribute(key);
// buf.append(" ").append(key).append("=\"").append(escapeXMLAttribute(value.t... |
b0dc65b9-ad1d-49ed-8d35-3e79c3f24d7d | 9 | private void spinner_x1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinner_x1StateChanged
if(hitbox_index_selected!=-1 || click_target_flag)
{
click_target_flag=true;
if(hitbox_index_selected!=-1)
{
int i=0;
for(Node hitboxes_node=current_fr... |
1762c46b-2f72-4730-aec8-0ff751dd2ccf | 5 | @Override
public AnnotationVisitor visitParameterAnnotation(final int parameter,
final String desc, final boolean visible) {
if (!ClassReader.ANNOTATIONS) {
return null;
}
ByteVector bv = new ByteVector();
if ("Ljava/lang/Synthetic;".equals(desc)) {
... |
9ea89e46-8619-4137-9e1c-15e40fc025ec | 4 | boolean isChromosomeMissing(Marker marker) {
// Missing chromosome in marker?
if (marker.getChromosome() == null) return true;
// Missing chromosome in genome?
String chrName = marker.getChromosomeName();
Chromosome chr = genome.getChromosome(chrName);
if (chr == null) return true;
// Chromosome length ... |
bdfa1951-1449-4ce6-8dec-3a11f6bbea67 | 3 | public static boolean cobreTodas(Coluna col, Solucao sol){
int x = 0;
ArrayList<Integer> cobertura = col.getCobertura();
for(Integer entradateste : cobertura){
if(!(sol.getLinhasCobertas().contains(entradateste))){
sol.getLinhasCobertas().add(entradateste);
... |
254b889c-987e-4359-ac98-00882cb38d6b | 4 | static Elements filterOut(Collection<Element> elements, Collection<Element> outs) {
Elements output = new Elements();
for (Element el : elements) {
boolean found = false;
for (Element out : outs) {
if (el.equals(out)) {
found = true;
... |
867d63d1-e605-4b2f-be8d-98e13a0f9e23 | 5 | @Override
public Path shortestPath(Vertex a, Vertex b) {
Hashtable<Vertex,Color> color=new Hashtable<Vertex,Color>(graph.getVertices().size()*2);
Hashtable<Vertex,Vertex> tree=new Hashtable<Vertex,Vertex>(graph.getVertices().size()*2);
Hashtable<Vertex,Integer> distance=new Hashtable<Vertex,... |
6e939a01-6aa1-438e-9ad7-c3205ea2b415 | 2 | public Checker(int team){
this.team = team;
if(team == 1) {
setImage(new GreenfootImage("Mario.png"));
} else if (team == 2) {
setImage(new GreenfootImage("Wario.png"));
}
} |
81f9c57d-4556-46d7-8c29-10778d6a3cf2 | 6 | public void createAndListenSocket() {
try {
socket = new DatagramSocket(9876);
byte[] incomingData = new byte[1024 * 1000 * 50];
System.out.println("Inicio del servidor");
while (true) {
DatagramPacket incomingPacket = new DatagramPacket(incomingDa... |
888168f4-731c-4372-9fdd-ad76b3201bb5 | 0 | public static void infoBox(String infoMessage, String location)
{
JOptionPane.showMessageDialog(null, infoMessage, "InfoBox: " + location, JOptionPane.INFORMATION_MESSAGE);
} |
11fdb94a-92d2-4b61-a9ec-27a94f4738d2 | 7 | DefaultPopupMenu(AtomisticView v) {
super("Default");
this.view = v;
JMenuItem mi = new JMenuItem(view.getActionMap().get(AtomisticView.PASTE));
String s = MDView.getInternationalText("Paste");
if (s != null)
mi.setText(s);
add(mi);
addSeparator();
mi = new JMenuItem(view.getActionMap().get("Model... |
5be68aea-b65c-46b0-a327-565a8675da16 | 4 | private JLabel getLabel(Point point) {
JLabel label = null;
JLabel[] searchLabel;
if (whitesTurn) {
searchLabel = whites;
} else {
searchLabel = blacks;
}
for (JLabel l : searchLabel) {
if (l.getBounds().x == point.x && l.getBounds().y == point.y) {
label = l;
}
}
return label;
} |
c5bd2ee4-0fb2-4733-bc23-d4acc4df2070 | 3 | private void receive_id() throws Exception {
status_moves++;
int field_id = readMailbox(BrickGame.bluetooth_mailboxSystem, false, -1);
if (field_id < 1 || field_id > 2) {
return;
}
if (field_id == 2) {
updatePosition();
FieldGame.setField(2, pos_x, pos_y, id);
System.out.println(name + ": receive ... |
f9c75968-eb5c-4c9c-849b-d884e0b2d1b8 | 2 | private void jMsgSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMsgSActionPerformed
jTable1.getColumnModel().getColumn(0).setCellRenderer(new CustomCellRender_Message());
jTable1.setModel(modele2);
jTable1.setAutoCreateRowSorter(true);
Color c = new Color... |
20be5862-f3ca-41e3-a9e2-496ad9c0fcdf | 5 | public void connect() {
ScheduledExecutorService spinner = Executors.newScheduledThreadPool(2);
Map<String, ScheduledFuture<?>> futures = new HashMap<>();
final Socket socket;
IO.Options opts = new IO.Options();
opts.forceNew = true;
try {
socket = IO.socket... |
0ab577d3-a531-48df-9499-3320acaa8441 | 8 | @Override
public void reservarLibroAUnSocio(String codigoLibro, String codigoSocio) throws BibliotecaError{
if (codigoLibro == null || codigoLibro.equals("")){
System.out.println("Codigo Libro invalido");
throw new BibliotecaError("Codigo Libro invalido");
}
if (codi... |
c7dcf1a4-79ba-4608-87f8-de8e804738ef | 3 | public Object invokeMethod(Reference ref, boolean isVirtual,
Object cls, Object[] params) throws InterpreterException,
InvocationTargetException {
if (cls == null && ref.getClazz().equals(classSig)) {
String clazzName = ref.getClazz();
clazzName = clazzName.substring(1, ref.getClazz().length() - 1)
... |
73ed1a0f-8fe9-4238-b638-79f109bd43bb | 9 | private static boolean deleteDirectory(String dir) {
if (!dir.endsWith(File.separator)) {
dir = dir + File.separator;
}
File dirFile = new File(dir);
if (!dirFile.exists() || !dirFile.isDirectory()) {
return false;
}
boolean flag = true;
File[] files = dirFile.listFiles();
for (int i = 0; i < file... |
48e96eab-818d-4acc-8b75-dccf9e5b5846 | 2 | public void close() {
synchronized (soc) {
if (!run)
return;
run = false;
try {
out.close();
in.close();
soc.close();
} catch(IOException e) {
System.err.println("ajclient.close: failed to close the connection");
}
}
} |
0bef4edd-df75-4604-9b60-89dae93514ab | 0 | public void destroy() {
hoistedNode = null;
} |
8ab44196-42dd-4f72-88ee-a54048524434 | 9 | public static void wbml_backgroundrefresh(osd_bitmap bitmap, int trasp) {
int page;
int xscroll = (bg_ram[0x7c0] >> 1) + ((bg_ram[0x7c1] & 1) << 7) - 256 + 5;
int yscroll = -bg_ram[0x7ba];
for (page = 0; page < 4; page++) {
//const unsigned char *source = bg_ram + (bg_ram[0... |
f692103c-6f24-4872-9e96-32afbdb0fc43 | 5 | public void displayLCS()
{
System.out.println("Length of Longest Common Sequence is "+
length[seq1.length-1][seq2.length-1]);
LinkedList<Integer> list = new LinkedList<Integer>();
int row = seq1.length-1, col = seq2.length - 1, temp = -1, index = -1;
whil... |
e052856c-4bb8-44be-b7dd-b3a5607a51c1 | 3 | public int isActivatedBy (Trigger trigger)
{
if (trigger == null)
return -1;
for (int i = 0; i < triggers.length; i++)
{
if (triggers[i] == trigger)
return i;
}
return -1;
} |
c0e6a3c9-75ed-45e8-a167-ace579362a09 | 4 | @Test
public void doTest() {
fillIn();
for (BigInteger b : trian) {
for (BigInteger p : trian) {
if (trian.contains(p.subtract(b).abs()) && trian.contains(p.add(b))) {
System.out.println(p + " " + b + " " + p.subtract(b).abs());
}
... |
bac35338-bb5f-4d94-9951-e41459ac8769 | 1 | public synchronized void adicionar()
{
try
{
new AreaFormacaoView(this);
}
catch (Exception e)
{
}
} |
52a6ccc4-9828-475e-a33c-9c3e859981ea | 7 | public static Packet read(ByteBuffer buffer) {
byte packetId = buffer.get();
if (packetId == ID_HELLO_PACKET)
return new HelloPacket(buffer);
if (packetId == ID_WORLD_UPDATE_PACKET)
return new WorldUpdatesPacket(buffer);
if (packetId == ID_WINDOW_PACKET)
... |
3f27378a-9ef8-4f3f-ad0a-d4cb11dec9dc | 2 | public static boolean fullName(String name){
String[] temp = name.split(" ");
if(name(temp[0])&&name(temp[1]))
return true;
return false;
} |
6b158d63-5b29-46fe-9755-b61397271314 | 0 | @Test
public void returnListOfStrings_whenCallPermuteAsStrings() {
List<Character> chars = new ArrayList<Character>(Arrays.asList('a', 'b', 'c'));
String expected = "[abc, acb, bac, bca, cba, cab]";
String actual = permutation.permuteAsStrings(chars).toString();
assertEquals(expected... |
1f685d32-c00c-49aa-a79c-b3be8004b7b7 | 5 | public String buscarGrupoEstudioPorCurso(String curso) {
ArrayList<GrupoEstudio> geResult= new ArrayList<GrupoEstudio>();
ArrayList<GrupoEstudio> dbGE = tablaGrupoEstudio();
String result="";
try{
for (int i = 0; i < dbGE.size() ; i++){
if(dbGE.get(i).getCurso().equal... |
c4e47494-fd89-4ab7-bc33-4f7522e7da40 | 0 | public ServerInfo(String ipAddress, int port, long maxClients) {
this.ipAddress = ipAddress;
this.port = port;
this.maxClients = maxClients;
} |
1cc695aa-4208-4bbc-86fe-f9f917a2983d | 6 | public JButton createButton(final int index, String text) {
JButton b = new JButton();
b.setText(text);
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
switch (index) {
case 0:
... |
f2e5187c-ed97-418a-b625-7219034e3181 | 5 | final synchronized void method2817(int[] is, int i, int i_67_) {
try {
anInt8898++;
if (aClass204_8944.method1491()) {
int i_68_ = (anInt8921 * ((MidiFile) aClass204_8944).anInt2683
/ Class22.anInt339);
do {
long l = aLong8959 + (long) i_67_ * (long) i_68_;
if (aLong8957 + -l >= 0L) {... |
15d606f3-3c23-455e-adae-38ef9c01b4f9 | 9 | public final void stmtList() throws RecognitionException
{
AST ast1 = null, ast2 = null;
try {
// CPP.g:300:3: ( stmt stmtList | )
int alt18 = 2;
alt18 = this.dfa18.predict(this.input);
switch (alt18)
{
cas... |
effd2bdf-7559-4fa0-ad72-2077f44fd5d5 | 7 | private static void percDown( int[] a, int i, int n ){
int child;
int tmp;
for (tmp = a[i] ; leftchild( i ) < n; i = child ) {
child = leftchild(i);
if (child<=n-1 && a[child] < a[child+1]) {
child++;
if (tmp < a[child]) {
int l = a[i];
a[i... |
4fadaeb7-6825-4880-8fb2-c566b3e89ead | 8 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Connection con = null;
PreparedStatement ps = null;
String[] unameperms = request.getParameter("uname").split(";");
String uname = unameperms[0];
String perms = unameperms[1];
String enab... |
1ac0bcae-dcdf-42f9-9e60-e08efe5b3b9b | 8 | @Test
public void testStreamSkipReadMixSmallerDelegateThrows() throws IOException {
LimitedInputStream stream = streamUsingSmallStreamThrows;
int limit = HALF_LIMIT;
long total = 0;
do {
int count = (int)(Math.random() * 10);
if (total + count == limit) {
count++;
}
boolean underflow = total + ... |
5730719f-aa5c-47fa-b647-02e664dcb2ac | 6 | public void sendQueues() {
LinkedList<Bid> bidQueue = getBidQueue();
LinkedList<SeismicRequest> seismicQueue = getSeismicQueue();
LinkedList<Drill> drillQueue = getDrillQueue();
if (!bidQueue.isEmpty()) {
for (Bid bid : bidQueue) {
((ServerMessages) socket).sendBidQueue(bid.toSocket());
}
}
if (!... |
96cf6137-04ec-4f39-9a8b-6b0b27e4e0ac | 0 | @Override
public void setComplete(boolean complete) {
this.complete = complete;
} |
2a20cc54-6986-40bd-a812-6db80bec896e | 3 | private void shutdownHook()
{
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
{
@Override
public void run()
{
if (FilePlayer.getSaver() != null && !FilePlayer.getSaver().isDone())
try
{
FilePlayer.getSaver().get();
} catch (Int... |
35ac7148-59f5-40e9-9509-0d114a3e25a5 | 7 | public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output,Reporter reporter)
throws IOException {
String line = value.toString();
String[] words = line.split(",");
int flag = 1;
for(int j=0;j<rule[rule_no].length-1 && flag==1;j++)
... |
adfb3131-cbcb-4099-b7b6-62cd3b9ef517 | 4 | @Test
public void testFindAllFromCache() throws Exception {
IUserPersistence users = dbs.getDatabase1().users();
User u1 = users.create("bryand", System.currentTimeMillis(), 5, System.currentTimeMillis() + 10, System.currentTimeMillis() + 20, "this is a relatively long string", new byte[]{5, 4, 3, 2, 1}, 1.2d... |
59b7ffa6-3e38-42a6-81a3-27493f4d47db | 4 | public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
s... |
4c0b97f7-1f31-4164-97d5-efe02fa71a54 | 1 | public static void main(String[] args) {
String json = "{\"name\":\"sergii\",\"age\":\"25\"}";
ObjectMapper objectMapper = new ObjectMapper();
Map<String,String> map = new HashMap<String,String>();
try{
map = objectMapper.readValue(json, new TypeReference<HashMap<String, String>>() {
... |
12454df0-920e-4f2a-8550-52c22806fcac | 3 | public void rowOpenStateChanged(Row row, boolean open) {
if (row.hasChildren() && mRows.contains(row)) {
if (open) {
addChildren(row);
} else {
removeRows(row.getChildren().toArray(new Row[0]));
}
}
} |
e98deb60-2cb9-43e0-bde6-1571c75fec83 | 9 | public static LegacyOCPMessage decodeBuffer(final ByteBuffer buffer)
throws OCPException {
if (buffer.limit() < OCP_MIN_LENGTH) {
// Too short to possibly be a valid message
throw new OCPException();
}
Class<? extends LegacyOCPMessage> implementation;
... |
760126d9-ae19-46ff-ba95-1245662bae1a | 5 | private void makeLabels() {
List<JPanel> labels = new ArrayList<JPanel>();
RollingStock r = theTrain.firstCarriage();
if (r == null) {
this.labelList = labels;
} else
while (r != null) {
JPanel tmpPanel = new JPanel();
tmpPanel.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, ... |
e663c87a-b733-4c19-b891-b6a217b4db43 | 6 | public static int[] maximumSubArray(int[] input) {
// Check for invalid input
if (input == null || input.length == 0) {
throw new IllegalArgumentException("invalid input array");
}
// If input lenght is 1 then we simply return the same array
if (input.length == 1) {
return input;
}
// Initialise th... |
54e0b752-01bb-4b5c-a495-7220598c94a7 | 1 | public void show() {
for(RadioButton rb : btns)
rb.show();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.