method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
516825d7-6952-4863-bc03-d2a70326e9fa | 3 | public void delete(Key key) {
Node x = this.root;
while (x != null) {
int cmp = key.compareTo(x.key);
if (cmp < 0)
x = x.left;
else if (cmp > 0)
x = x.right;
// else
// return x.value;
}
} |
4c24859a-9726-4109-8de9-3325dc85d1bd | 9 | public static boolean equalReferencesInArrays(final Object[] array1,
final Object[] array2) {
if (array1 == null) {
return (array2 == null);
}
if (array2 == null) {
return false;
}
if (array1.length != arra... |
b8984593-4e32-47af-8955-c7a825f9658e | 4 | public void rectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys = scaleY(y);
... |
8593186c-ec35-4bfb-bff0-afb40198034e | 2 | public static Vector<Zone> getZones () throws BDException {
Vector<Zone> res = new Vector<Zone>();
String requete = "select * from LesZones";
Statement stmt = null;
ResultSet rs = null;
Connection conn = null;
try {
conn = BDConnexion.getConnexion();
stmt = conn.createStatement();
rs = stmt.execu... |
c1abfcb4-5d94-43dd-b509-49cac525d394 | 6 | @Override
public void eventDispatched(AWTEvent event) {
assert event instanceof KeyEvent : "Shall only listen to KeyEvents, so no other events shall come here";
assert assertEDT(); // REMEMBER THAT THIS IS SINGLE THREADED, so no need for synch.
// ?: Is this one of our synthetic RELEASED events?
... |
ce9205a2-24ee-4837-9b63-f21234bbad85 | 8 | private void revisarSesion(HttpServletRequest request, HttpServletResponse response) throws IOException {
ConexionBD bd = new ConexionBD();
String usuario = request.getParameter("login");
String contrasenia = request.getParameter("contrasenia");
Boolean validacion = true;
Strin... |
33cc5182-6202-4518-84a8-eca2d447a778 | 9 | private SiteConfiguration readSiteConfiguration(File siteFile) {
try {
// Read in the XML for the site configuration
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document xmlDoc = documentBuilder.parse(siteFile);
xml... |
67a2ecdb-a2b3-4202-8d77-6286b42140f2 | 6 | @Override
protected void menuOpciones() {
printBlankSpace();
System.out.println(OPCIONES);
if (terminal.hasNext(OPCIONES_PATTERN)) {
switch (Integer.parseInt(terminal.nextLine())) {
case 1:
askAndConnect();
break;
... |
fd9f0361-e824-4a3d-84e5-c11dc75e3cd9 | 6 | public void redrawMap() {
if (_startNode == null && _endNode == null) {
return;
} else if (_startNode == null) {
_centerLat = _endNode.latitude;
_centerLon = _endNode.longitude;
_scale = DEFAULT_SCALE;
_streetView.clearCache();
_streetView.repaint();
_pathView.repaint();
} else if (_endNode =... |
93daa6e7-be5a-4fb1-831d-dc91b99b6e60 | 9 | public static boolean areTilesConnected(Tile from, Tile to) {
if(to.getImageName().equals("Water") || from.getImageName().equals("Water")){
return false;
}
if(from.getHeight() != to.getHeight()) {
if(from.getHeight() - 1 == to.getHeight()) {
if(!(to.getStructure() instanceof Ramp))
return false;
... |
c03d8a56-3be1-49fb-9e65-d4b38979e9b0 | 2 | public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
new TabsDialog(shell,
workbenchParts("Editor One", "Editor Two", "Editor Three"),
workbenchParts("View One", "View Two", "View Three"), workbenchPartR... |
3b2624ce-17a1-45db-9ee3-0552076a5e38 | 5 | private void fireType(String currentWeapon){
inv.returnItem(this.currentWeapon + "Ammo").use();
if (currentWeapon.equals("MachineGun")){
} else if (currentWeapon.equals("Pistol")){
} else if (currentWeapon.equals("Crowbar")){
} else if (currentWeapon.equals("Revolver")){
} else if (currentWea... |
f9290760-9927-4465-833e-c23dbf72618e | 2 | public void dispose() {
if (Disposable.class.isAssignableFrom(this.type)) {
for (T resource : this.resources) {
((Disposable) resource).dispose();
}
}
} |
82fb612d-b60d-4894-a2b7-7c812e6f0368 | 4 | private boolean checkOutOfBounds(Direction dir, int row, int col) {
if (dir == Direction.LEFT) {
return col < 0;
} else if (dir == Direction.RIGHT) {
return col > COLS - 1;
} else if (dir == Direction.UP) {
return row < 0;
} else if (dir == Direction.DOWN) {
return row > ROWS - 1;
}
return false... |
a8c65a45-2454-4a58-8600-fe7458dd5680 | 6 | public static short rgb64ToGbc(long color) {
long r = color >> 32 & 0xFFFF;
long g = color >> 16 & 0xFFFF;
long b = color & 0xFFFF;
long gbR = (31 * r - 5 * g - b) / 51200;
long gbG = (3 * r + 35 * g - 13 * b) / 51200;
long gbB = (-9 * r - 5 * g + 39 * b) / 51200;
if (gbR... |
ea1f4bf2-535d-498c-a576-44d939859ff2 | 0 | public void buildGUI() {
jProgTitle = new javax.swing.JLabel();
jRoboStatus = new javax.swing.JLabel();
jEnableBtn = new javax.swing.JButton();
joy1Selection = new javax.swing.JComboBox();
joy2Selection = new javax.swing.JComboBox();
jIPField = new javax.swing.JTextField();
... |
152373a4-ff0b-47c5-bfd0-b0e4aed7f1bf | 3 | public static void updateC(String algo) {
if (algo.equalsIgnoreCase("Caesar")) {
c = new Caesar();
}
else if(algo.equalsIgnoreCase("RSA")) {
c = new RSA(1024);
}
else if(algo.equalsIgnoreCase("TEA")) {
c = new TEA();
}
} |
04f1e293-dd35-46e1-a9eb-f1c3fa80b5ed | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Moneda other = (Moneda) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {... |
6de83355-d3d9-4ead-a415-7eda0e9b2f37 | 7 | private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... |
31868e04-07e1-4aef-86aa-7d7778fb2e9c | 4 | public boolean containsSET(){
if(this.getFils().isEmpty())
return false;
if(this instanceof SETNode){
return true;
}else{
for(int i = 0 ; i < this.getFils().size() ; i++){
if(this.getFils().get(i).containsSET())
return true;
}
return false;
}
} |
baba7f86-058c-4c4f-8ef5-92db34c3cc26 | 4 | public static void main(String[] args) {
if (args.length > 1 || (args.length > 0 && args[0].equalsIgnoreCase("-h"))) {
System.out.println(USAGE);
System.exit(1);
}
String bankName;
if (args.length > 0) {
bankName = args[0];
} else {
... |
b17f9dbc-1c6d-4dcd-95f1-91d13b319f31 | 6 | public static void main(String args[]) {
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
UIManager.getLookAndFeelDefa... |
4ae5c552-5500-4013-92e4-2495dd00d966 | 4 | public boolean readBoolean() {
String s = readString();
if (s.equalsIgnoreCase("true")) return true;
if (s.equalsIgnoreCase("false")) return false;
if (s.equals("1")) return true;
if (s.equals("0")) return false;
throw new java.util.InputMisma... |
6d05f3d0-4763-45c1-8dee-b5a8efffa7bc | 1 | public String moveCardOntoAceFromKing(int indexFrom, int indexTo) {
List<Card> from = kingPiles.get(indexFrom);
if (from.size() == 1) {
return wouldMakePileEmpty();
} else {
return moveCardOntoAcePile(from, -1, indexTo);
}
} |
7c26b8ec-6e35-4a76-afba-d1f6e9f2bde1 | 4 | public void handleCreateReservation(ARObject obj,int senderID,int sendTag)
{
// check whether the requested PE is sufficient to handle or not
if ( obj.getNumPE() > super.totalPE_ )
{
super.replyCreateReservation(senderID, sendTag, NOT_FOUND,
GridSimTa... |
441278c6-d014-4355-8f89-dca78aa47df6 | 3 | public static void main(String[] args) throws IOException, ParsingException {
MessageFactory factory = new V1MessageFactory();
P2PMessage m = new VerackMessage(factory);
BaseMessage b = new BaseMessage(m, factory);
BaseMessage c = new BaseMessage(new ByteArrayInputStream(b.getBytes()), Options.getInstance().ge... |
39720fb1-b304-46be-810a-d4af998ff209 | 2 | public static int office2pdf(String srcPath, String tgtPath) {
conn = new SocketOpenOfficeConnection(openOfficeListenerPort);
synchronized (conn) {
try {
File srcFile = new File(srcPath);
File tgtFile = new File(tgtPath);
DefaultDocumentFormatRegistry formatRegistry = new DefaultDocumentFormatRegist... |
7c63277a-6ab9-4d79-9aab-987c00f22683 | 1 | public static List<HardwareAlternative> sortHardwareAlternatives(List<HardwareAlternative> hardwareAlternatives) {
HardwareAlternative[] alternatives = new HardwareAlternative[hardwareAlternatives.size()];
alternatives = hardwareAlternatives.toArray(alternatives);
Arrays.sort(alternatives);
hardwareAlternatives... |
289adc98-020a-4788-9049-b9bd99dd67ad | 3 | public void drawBlocks(Graphics g) {
for (int i = 0; i < YARD_ROW; i++) {
for (int j = 0; j < YARD_COL; j++) {
if (blocks[i][j] == true) {
new Block(i, j, Color.BLUE).draw(g);
}
}
}
} |
02859b2b-fb6e-4f33-87f0-e14b2bb45160 | 8 | public void mostrarPorVentana(String mensaje, String id) {
StringBuffer mensajefinal = new StringBuffer();
int posicionempiezaformato = 0;
// buscamos la posicion a partir de la cual empieza el formato
while (posicionempiezaformato < mensaje.length()
&& mensaje.charAt(posicionempiezaformato) != '#') {
posi... |
9f92e961-dc90-4910-894a-10c9ea608942 | 1 | public void close() {
while (isShowing()) {
pop();
}
} |
608f8d18-e472-43ed-ad80-c59cd76bbb19 | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.GREEN);
G.fillArc((int)(X-1)-viewX, (int)(Y-1)-viewY, 2, 2, 0, 360);
}
} |
1a062b2c-bdb9-4ef8-aac9-990cce8bb2a2 | 4 | @Override
public void actionPerformed(ActionEvent e) {
try {
if (Utils.checkEnteredTextForLetters(motherLangTextField.getText()) &&
Utils.checkEnteredTextForLetters(translationTextField.getText())) {
String motherLangWord = motherLangTextField.getText();
... |
b3d6bf58-7971-4d06-9316-c4172536a38b | 2 | public void volcarDatos(ArrayList<Libros> rows){
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
while(model.getRowCount()>0)model.removeRow(0);
for(Libros row : rows){
Object[] fila = {
row.getNombrelibro(),
row.getAutorlibro... |
e0be9a2a-9097-40b5-ae3f-6c67b848b881 | 5 | public int compare(Object o1, Object o2) {
DataPointVector v1 = (DataPointVector) o1;
DataPointVector v2 = (DataPointVector) o2;
double val1 = -1;
double val2 = -1;
if (component == DataPointComponent.X) {
val1 = v1.getMeanX();
val2 = v2.getMeanX();
}
else if (component == DataPointComponen... |
4558ed5f-881f-460c-ae50-bc6a673727fc | 3 | public void render() {
if(Display.wasResized()) {
WIDTH = Display.getWidth();
HEIGHT = Display.getHeight();
if(currentScreen != null) {
currentScreen.setSize(WIDTH, HEIGHT);
}
}
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
if(currentScreen != null) {
currentScreen.ren... |
31207d1b-b895-40f4-9787-4547af058aba | 7 | protected void onAmpersand() {
onSplit();
for (int i = position + 1; i < text.length(); i++) {
char c = text.charAt(i);
if (c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '#') {
continue;
}
if (c == ';') {
position = i;
lastSplit = i;
return;
... |
44f120c6-4740-4b6d-a639-649fe703a034 | 1 | public void begin(int port) throws IOException {
serverSocket = new ServerSocket(port);
while (true) {
System.out.println("Waiting for clients to connect on port " + port + "...");
new ProtocolThread(serverSocket.accept()).start();
//Thread.start() calls Thread.run()
... |
7686b81a-c014-42d9-8d99-35922b2148b9 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED
+ "Must execute this command as a player.");
return false;
... |
7646bbe4-29f7-4070-9152-a6853ab15a4d | 8 | private static ArrayList<Cell> checkForNeighbors(int x, int y)
{
ArrayList<Cell> res = new ArrayList<Cell>();
// UP DOWN LEFT RIGHT
// UP
if (!((y - 1) <= -1))
{
if (!maze[x][y - 1].isVisited())
{
res.add(maze[x][y - 1]);
}
}
// DOWN
if (!((y + 1) >= GRID_HEIGHT))
{
if (!maze[x][y ... |
8ab02f57-2843-44ee-9be2-70d956769052 | 8 | private List<Correction> removeOverlaps(List<Correction> corrections,
Map<Correction, Double> percentages) {
if (corrections.size() <= 1) {
return corrections;
}
logger.info("Removing overlaps between corrections...");
boolean updates = false;
List<Correction> correctionsCopy = new ArrayList<Corr... |
1bc502dd-4b82-41dd-b942-6fb978a061fc | 2 | public void send(byte[] bytes) {
DatagramPacket message;
try {
message = new DatagramPacket(
bytes,
bytes.length,
remoteAddress,
remotePort);
socket.send(message);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} |
9c205ab4-6b55-4d25-8992-1ba16f69d920 | 3 | private boolean compareTimeStamp(int ts1, int rk1, int ts2, int rk2) {
if (ts1 > ts2) {
return true;
} else if (ts1 == ts2) {
if (rk1 > rk2) {
return true;
}
}
return false;
} |
1a811e9b-a742-4af2-8155-46469cf0cddb | 9 | private ZuseBinaryFloatingPoint24Bit multiplicator(ZuseBinaryFloatingPoint24Bit A, ZuseBinaryFloatingPoint24Bit B, boolean[] s) {
boolean[] Af = A.getExp().getCopiedBoolArr();
boolean[] Ag = B.getExp().getCopiedBoolArr();
boolean[] Bf = A.getMan().getCopiedBoolArr();
boolean[] Bg = B.getMan().getCopiedBoolArr()... |
3807471b-e07a-4d83-a503-3445029387e2 | 9 | public Set<Node> iterDFS(Node firstNode, double d, DFSNode root){
// initialise required collections
HashSet<Node> articulationPoints = new HashSet<Node>();
Stack<DFSNode> stack = new Stack<DFSNode>();
// init all nodes (depth = +inf, visited = false)
for(Node n : nodes.values()){
n.visit(false);
n.setD... |
300e6d34-9e7c-42b2-bab8-562fc77f6f03 | 2 | public void enumerateCoordinates(Tile topTile){
Tile currentJTile = topTile;
for(int j = 0; j < dimension; j++){
Tile currentKTile = currentJTile;
for(int k = 0; k < dimension; k++){
currentKTile.coords = new Coordinate(j, k);
currentKTile = currentKTile.rightDown;
}
currentJTile = currentJTil... |
ca75d709-f7e6-4dc4-999b-ff0509834753 | 3 | public Direction getAdjacentTileDirection(Tile from, Tile to) {
if(from.getLocation().getColumn() > to.getLocation().getColumn())
return Direction.WEST;
if(from.getLocation().getColumn() < to.getLocation().getColumn())
return Direction.EAST;
if(from.getLocation().getRow() > to.getLocation().getRow())
ret... |
532838da-0a80-43a2-8286-1475e2a5b67d | 6 | public static void main(String args[]) throws IOException
{
int publicTestcaseNum = 11;
int privateTestcaseNum = 0;
int publicPass = 0;
for (int i = 1; i <= publicTestcaseNum; ++i)
{
try
{
if (testPublic(i) == PASS)
{
++publicPass;
}
else
{
System.out.println("failed:" + ... |
9fd7431e-c2ee-44d7-b33d-b91ac2102752 | 3 | @Override
public void onPlayerUnownedBreak(ChunkyPlayerDestroyEvent event) {
try {
if (!Permissions.PLAYER_BUILD_ANYWHERE.hasPerm(event.getChunkyPlayer().getPlayer())) return;
} catch (ChunkyPlayerOfflineException e) {
return;
}
if (event.getAccessLevel().equa... |
f07f4e0a-765d-4de4-acf8-429f3030ebef | 6 | private Object findNextItem(Object component, String classname, Object item) {
if (item == null) { // first item
return get(component, ":comp");
}
else if ("tree" == classname) { // next tree node
Object next = get(item, ":comp");
if ((next == null) || !getBoolean(item, "expanded", true)) { // no subnode... |
e9eb2daa-c8f6-4910-ba8f-e17dba6e1f88 | 4 | public void run() {
while (true) {
try {
String message = messages.take();
Iterator<Socket> iter = sockets.iterator();
while (iter.hasNext()) {
Socket socket = iter.next();
try {
OutputStream out = socket.getOutputStream();
PrintWriter writer = new PrintWriter(out);
writer... |
6d95e79e-4537-4734-bd66-dbf9bdfbbf5b | 7 | public double calcObersumme()
{
double hoehe, erg;
erg = 0.0;
for(double i=intervalLeft; i<=intervalRight-dx+(dx/4); i+=dx)
{
int j1, j2;
j1 = 0;
while(points.get(j1).getX()<=i && j1 < points.size()-1)
{
j1++;
}
j2 = j1;
while(points.get(j2).getX()<=i+dx && j2 <... |
7f9c8cee-af08-41c8-b3e9-17397ae06d4b | 8 | public int handStrength( Hand hand ) {
int retInt = 0;
if (hand.isPair())
retInt = 1;
else if (hand.isTwoPair())
retInt = 2;
else if (hand.isTrip())
retInt = 3;
else if (hand.isStraight())
retInt = 4;
else if (hand.isFlush())
r... |
af800e7d-de49-452f-ae67-4ec50c64d838 | 3 | public void setBoard(){
m_Pieces[3][3]= WHITE_PIECE;
m_Pieces[4][4]= WHITE_PIECE;
m_Pieces[3][4]= BLACK_PIECE;
m_Pieces[4][3]= BLACK_PIECE;
for(int x=0;x<WIDTH;x++){
for(int y=0;y<HEIGHT;y++){
if(m_Pieces[x][y]... |
2812aef4-0fda-4b1b-a523-e2bad24a7db2 | 9 | public static String moveToAlgebra(String move){
int start = 0, end = 0;
char a = move.charAt(0), b = move.charAt(1), c = move.charAt(2), d = move.charAt(3);
String algebraicMove = "";
if (Character.isDigit(d)){
start = (a - 48) * 8 + (b - 48);
end = (c - 48) * 8 + (d - 48);
} else if (d == 'P'... |
72190f1c-7fa1-414d-83f0-1396f3fcb489 | 2 | public void toggleDirection()
{
if (getDirection() == direction.RIGHT)
{
setDirection(direction.LEFT);
//System.out.println("toggleDirection Right");
}
else if (getDirection() == direction.LEFT)
{
setDirection(direction.RIGHT);
... |
6b3e0a94-df65-4ed5-8704-e0cf724b0f46 | 3 | public void setMoveable(List<Token> moveableTokens){
for(List<Token> row : tokens){
for(Token token : row){
token.setUnmoveable();
}
}
for(Token moveableToken : moveableTokens){
tokens.get(moveableToken.yPos()).get(moveableToken.xPos()).setMoveable();
}
} |
8b7f44fb-63a9-412c-b5fc-a6dfc5d4490b | 1 | private static void ShowArray(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print(Integer.toString(array[i]));
System.out.print(" ");
}
System.out.println();
} |
720ecf3e-6d7d-443f-b059-c0c394b5ba1c | 9 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int i = ... |
78339897-c540-4398-b80c-90a018e3625d | 6 | public static PlayerData getPlayerData(Player player)
{
PlayerData playerdata = PlayerData.userinfo.get(player);
if (playerdata == null)
{
Iterator<Entry<Player, PlayerData>> it = userinfo.entrySet().iterator();
while (it.hasNext())
{
Entr... |
398fdbcd-c6d1-4f70-a29d-b668e1d1eeda | 9 | private static String constructRomanNumeral(int digit, String one, String five, String ten) {
switch (digit) {
case 1: return one;
case 2: return one + one;
case 3: return one + one + one;
case 4: return one + five;
case 5: return five;
cas... |
9f8b633b-195d-4158-9a19-5d319e9a5471 | 4 | public static void main(String[] args)
{
if (args.length < 2) {
System.out.println("run with args <addr> <port>");
System.exit(-121);
}
String addr = args[0];
int port = 0;
try {
port = Integer.parseInt(args[1]);
} catch (NumberFor... |
3c57b6e7-87dc-4d16-8c8d-e96004c27036 | 0 | public void start(){ thread.start(); } |
cd900e90-6fec-4360-8d96-7a3b4ee4e971 | 3 | public void setHand(ArrayList<Card> hand) {
int i = 0;
while (i < hand.size()) {
((CardComponent)this.getSubComponent(i)).linkCard(hand.get(i));
this.getSubComponent(i).setColor(this.getTrueColor(), false);
i++;
}
while (i < this.getNumSubComponents()... |
e1e38e73-3710-48cc-af14-02611e795a51 | 4 | @Override
public void askSettings(JFrame parent)
{
String bar = JOptionPane.showInputDialog(null, AutoAppro.messages.getString("bar2auto_bar_title"),
AutoAppro.messages.getString("bar2auto_bar_content"), JOptionPane.QUESTION_MESSAGE);
if (bar == null)
return;
this.bar = bar;
MyPreferences.set(this.getN... |
a3610a29-a3ed-4cb3-ac5b-046db28c1d41 | 3 | public Player(TileMap tileMap, int x, int y) {
super(tileMap);
setPos(x, y);
sWidth = sHeight = 30;
width = height = 20;
moveSpeed = 0.3;
maxSpeed = 1.6;
stopSpeed = 0.4;
fallSpeed = 0.15;
maxFallSpeed = 4.0;
jumpStart = -4.8;
stopJ... |
ad4fd9e5-f04f-4824-8967-c787bbb83a75 | 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... |
2be9bf92-e516-4099-999f-1b808cf0e780 | 3 | protected void handleMouseClick(MouseEvent paramMouseEvent)
{
if ((GameApplet.appletContext != null) && (this.url_target != null) && (this.frame != null)) {
GameApplet.appletContext.showDocument(this.url_target, this.frame);
return;
}
Debug.println("Unable to use " + GameApplet.appletContext... |
860bcdf4-c189-4c19-88c4-bee4c09d2240 | 8 | static String convertSimpleAnchorTag(String wikiString)
{
String currentString = wikiString;
aPattern = Pattern.compile(" (\\+\\+\\S+)([\\. ,:;])");
boolean stillTrying = true;
while (stillTrying)
{
aMatcher = aPattern.matcher(currentString);
if (aMatcher.find())
{
// th... |
31791b9a-21c4-45ee-8481-7c895de2ba8a | 2 | protected Map<Integer, String> getTitleMatches(String query) throws JmdbException {
log.debug("Getting possible IMDB title matches");
Map<Integer, String> matches = null;
String requestURL;
String resp;
int imdbId;
String imdbTitle;
try {
requestURL =... |
23bf2acb-ab2f-4846-becc-02af88157dfb | 7 | protected static char esc(String a, Int i) {
char c = a.charAt(i.get());
if (c != '\\')
return c;
if (i.get() >= a.length())
return '\\'; /* not special at end */
i.incr();
c = a.charAt(i.get());
switch (c) {
// 'd' not useful here
case 'n':
return ('\n');
case 'r':
return ('\r');
case '... |
1fd352bb-ce57-49bc-962f-6e7498418959 | 8 | public void drawLine(double x1, double y1, double x2, double y2) {
if (x1 > maxX) {
maxX = x1;
}
if (x2 > maxX) {
maxX = x2;
}
if (x1 < minX) {
minX = x1;
}
if (x2 < minX) {
minX = x2;
}
if (y1 > maxY... |
78d6e594-5935-4431-befb-40bf23c25589 | 4 | @Override
public void run() {
try {
if (page.isSavingNotRequired())
report("saving not required", 1);
else
report("saving required", 0);
if (recurse)
//note: this iterator does not require locking because of CopyOnWriteArrayList implementation
for (AbstractPage child: page.childPages)
job... |
4aba900b-755a-4c5d-aa7f-58192d64e00f | 8 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PieDataset)) {
return false;
}
PieDataset that = (PieDataset) obj;
int count = getItemCount();
if (that.getItemCount() != count) {
... |
fb1c3eba-4f8f-4b19-85a6-1082e0a72cad | 2 | @Override
public void caseANegateExp(ANegateExp node)
{
inANegateExp(node);
if(node.getExp() != null)
{
node.getExp().apply(this);
}
if(node.getExl() != null)
{
node.getExl().apply(this);
}
outANegateExp(node);
} |
926a5f69-9809-484f-8456-514d207b57be | 5 | public double tan(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a += 360;
}
//return
if(a <= 90){
return tan[a];
}else if(a <= 180){
return -tan[a - 90];
}else if(a <= 270){
return tan[a - 180];
}else{
return -sin[a - 270];
}
} |
c4d33362-173b-41f7-99c7-9f292afb60ca | 7 | public void putPotentialObject(PlaceableGameObject object, List<GameObject> ob){
System.out.println("debug: in putPotentialObject()");
isLeftClick = true;
PlaceableGameObject newOb = object;
newOb.setX(newOb.getX() - newOb.getWidth()/2);
newOb.setY(newOb.getY() - newOb.getHeight()/2);
newOb.isReal = fa... |
e2507120-c76f-4b64-9765-24c281989c5b | 4 | public List<String> getSubNodes(String node) {
if(node == null)
throw new NullPointerException();
node = node.concat(".");
List<String> subNodes = new ArrayList<String>();
for(String subNode : config.keySet())
if(subNode.startsWith(node) && !subNode.substring(node.length()).isEmpty())
subNodes.add(sub... |
54237834-7289-40be-89e7-60d065d7ce16 | 3 | public void chainMethodIdentifier(Identifier chainIdent) {
String name = chainIdent.getName();
String typeSig = chainIdent.getType();
for (Iterator i = methodIdents.iterator(); i.hasNext();) {
Identifier ident = (Identifier) i.next();
if (ident.getName().equals(name) && ident.getType().equals(typeSig))
... |
0913c23a-823a-4783-be17-b01be8b579fc | 3 | public byte DecodeWithMatchByte(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, byte matchByte) throws IOException
{
int symbol = 1;
do
{
int matchBit = matchByte >> 7 & 0x1;
matchByte = (byte)(matchByte << 1);
int bit = rangeDecoder.DecodeBit(m_Decoders... |
bdf2992e-d249-4d66-bdd1-c0671ddad21f | 4 | @Override
public void download() throws IOException {
String diretorioDestino = diretorioRoot + "/" + diretorioRelativo;
URL link = new URL(URL);
// para funcionar em servidores não-locais, é preciso habilitar os cookies para a sessão
CookieHandler.setDefault(new CookieManager(null, ... |
b330fba7-f942-4e5c-a0e9-e729deb0016d | 2 | public void setHeading(double heading) {
if (heading >= 360)
heading -= 360;
if (heading < 0)
heading += 360;
this.heading = heading;
} |
141261e1-c62a-4cbf-8fdd-e80c705cfb35 | 2 | public EnvironnementPacMan(int nbAgent,int taille_envi, int taille_case, int taille_vus,
int d) {
super(taille_envi, taille_case, taille_vus, d);
this.nbAgent = nbAgent;
dijkstra = new Integer[taille_envi][taille_envi];
for(int j=0;j<taille_envi;j++){
for(int i=0;i<taille_envi;i++){
dijkstra[i][j]=-1;... |
076a9cf6-1db4-4ecc-b58b-b36dbb6fd5a8 | 5 | private boolean stayInBounds() {
if(mem.side.compareTo("l") == 0) {
if((mem.getPlayMode().compareTo("play_on") != 0) && (mem.getPlayMode().compareTo("kick_off_l") != 0)) {
return false;
}
else
return true;
}
else {
if((mem.getPlayMode().compareTo("play_on") != 0) && (mem.getPlayMode().compareT... |
8dd7a496-119e-44bd-8922-1a3eb782eb92 | 8 | private void fall(Level var1, int var2, int var3, int var4) {
int var11 = var2;
int var5 = var3;
int var6 = var4;
while(true) {
int var8 = var5 - 1;
int var10;
LiquidType var12;
if(!((var10 = var1.getTile(var11, var8, var6)) == 0?true:((var12 = blocks[var10].... |
053d2dd5-b531-4cf8-9a83-141948fbccd8 | 9 | @Override
public void caseADeclSeDefinicaoComando(ADeclSeDefinicaoComando node)
{
inADeclSeDefinicaoComando(node);
if(node.getPontoVirgula() != null)
{
node.getPontoVirgula().apply(this);
}
if(node.getFimSe() != null)
{
node.getFimSe().appl... |
fcc166a0-aeea-4b00-a0ab-e9ec7b8b6b81 | 5 | public static List<String> split(String input) {
List<String> returnString = new ArrayList<String>();
String listAdd = "";
for(int i = 0; i < input.length(); i++) {
if(input.charAt(i) != ' ')
if(!isOperator(input.charAt(i)) || validate(i, listAdd, input.charAt(i)))
listAdd += input.charAt(i);
else ... |
a1157dd1-2abd-4b9e-95fa-e8060de73a9e | 9 | public synchronized Long joinRelations(String key, Long id1, RelationOsm relation1, Long id2, RelationOsm relation2){
List <Long> ids = new ArrayList<Long>();
List <String> types = new ArrayList<String>();
List <String> roles = new ArrayList<String>();
List <String> shapes = new ArrayList<String>();
int pos... |
2907a0cc-9d4a-4400-9cd3-383703d6fc4e | 5 | @Override
public void run()
{
log.info("working");
if(rx.method().equals("POST") && Helpers.authorize(rx))
{
String raw_post = rx.body();
OrderStatusRequest osr;
try
{
osr = Main.g.fromJson(raw_post, OrderStatusRequest.class);
if(osr != null && osr.uw() != null)
{
tx.st... |
606a0d06-f8e0-4eb5-b757-276de7fc4b6d | 8 | public static String pos_Finder(String position)
{
String num_pos = null;
int rank = Integer.parseInt(position.substring(1));
//rank--;
String file = position.substring(0,1).toLowerCase();
switch(file)
{
case "a": num_pos = "0";
break;
case "b": num_pos = "1";
break;
case "c": num_pos = "2";
br... |
76e4908d-3748-4917-84a5-ca0cd5fbbe67 | 3 | public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
JSONObject jo = new JSONObject();
if (properties != null && !properties.isEmpty()) {
Enumeration enumProperties = properties.propertyNames();
while(enumProperties.hasMoreElements()) {
... |
4f9b5feb-5855-4653-aee7-e4f472f91326 | 8 | @Test
public void testSolveMAze( ) {
MyMaze testMaze = new MyMaze();
//TestOne
//EdgeCase where the maze is not solvable 0 rows and 0 columns
testMaze.generateMaze( 0, 0 );
if ( testMaze.solveMaze().size() > 0 ) {
fail( "The solution should be empty due to 0 rows and 0 columns!" );
}
//TestTwo
//... |
a9fc96fa-bedd-4e6d-b1c0-933f60ba9ccd | 5 | int getSpacing(int i){
int sp = 0;
if (items.length > 2)
sp = 70;
else if (items.length == 2 && i == 0)
sp = 120;
else if (items.length == 2 && i == 1)
sp = 80;
return sp;
} |
83cf56e8-9765-4433-a247-96c3da40e416 | 4 | private boolean deplacement(int deplacement) {
boolean colision = false;
Vecteur<Integer> temp = new Vecteur();
if (deplacement != 0) {
Forme tempForme = new Forme(courante.getForme());
for (int i = 0; i < tempForme.getPoints().length; i++) {
temp.setValu... |
bb084a42-3715-486e-9279-a37ead8994e5 | 5 | @Override
public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args)
{
if(commandSender instanceof ConsoleCommandSender)
{
commandSender.sendMessage(StringUtilities.formatError("I'm sorry but this is a player only command!"));
return true;
}
if(... |
7ed5f5a4-29cb-4827-9457-01a8b3c0ed66 | 9 | public void addPiece(int choice, boolean white)
{
if(choice==1)
pieceOnTile = new Rabble(x+width/4, y+height/4, width/2, height/2, white);
if(choice==2)
pieceOnTile = new Spearman(x+width/4, y+height/4, width/2, height/2, white);
if(choice==3)
pieceOnTile = new Crossbowman(x+width/4, y+height/4, width/2... |
937b1a78-4c1a-428b-af34-050ff8846421 | 0 | public void setMatricule(String matricule) {
this.matricule = matricule;
} |
1fc3a87f-55b6-428b-9c22-953830e886ec | 7 | public void changeOwner(Player newOwner) {
Player oldOwner = this.owner;
setOwner(newOwner);
if (oldOwner.hasSettlement(this)) {
oldOwner.removeSettlement(this);
}
if (!newOwner.hasSettlement(this)) {
newOwner.addSettlement(this);
}
List<... |
f2842f0b-bd50-4641-9696-05d09da234bb | 2 | private static int getXOnSide(int x, ForgeDirection side) {
switch (side) {
case EAST:
return x + 1;
case WEST:
return x - 1;
default:
return x;
}
} |
39e42dfc-0e2b-4888-879a-a9ce6c82d641 | 9 | public static void main(String[] args) {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", BROKER_URL);
Connection connection = null;
try {
Topic senderTopic = new ActiveMQTopic(System.getProperty("topicName"));
connection... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.