method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7c68597b-4e28-40d6-98fa-455208d63759 | 9 | public void first() {
if (first) {
if (y / 64 + 1 <= 127 && world.tiles[x / 64][y / 64 + 1] instanceof Tree)
down = true;
if (y / 64 - 1 >= 1 && world.tiles[x / 64][y / 64 - 1] instanceof Tree)
up = true;
if (x / 64 + 1 <= 127 && world.tiles[x / 64 + 1][y / 64] instanceof Tree)
right = true;
i... |
9661fb8d-22be-48bd-92b6-79ff010b309e | 9 | private void consumeData(Packet dataPacket) {
Log.i(TAG, "Consuming DATA packet");
// If buffer is full, ignore new packets
if(mRecvData.remainingCapacity() == 0) {
Log.e(TAG,
"Incoming data packet queue is full, ignoring a new data packet");
return;
}
Short lastSeqNum = mLastSeqs.get(dataP... |
a90fab0f-0f36-46a0-91f6-136ebf797554 | 7 | public void load(Boolean FlipVertically, Boolean FlipHorizontally) {
ContainsPixels = true;
if(SIZEY >= SIZEX) {
for(int y = 0; y < SIZEY; y++) {
for (int x = 0; x < SIZEX; x++) {
pixels[x+y*SIZE] = sheet.pixels[(x + this.x) + (y + this.y) * sheet.SIZE];
}
}
} else {
for (int x = 0; x < SI... |
5c167a39-283e-433d-adbe-a324d0995f1b | 8 | private int parseArguements(String[] args, Job job) throws Exception {
////////////////////////////////////////
// 옵션 목록을 구성하고 검증한다.
////////////////////////////////////////
Options options = getOptions();
HelpFormatter formatter = new HelpFormatter();
if (args.length == 0) {
formatter.printHelp("hadoop... |
1ea17908-e0e5-4c50-bbe3-198b06c7412b | 9 | public static Command makeCommand(char[] data, X509Certificate cert) throws UnknownCommandException {
String[] parts = new String(data).split(" ", 2);
String commandName = parts[0];
System.out.println("CommandFactory: parsed command name = " + commandName);
Command command = null;
try {
if (commandName.equ... |
8f72e76b-ea73-4538-8e6a-76368001a0b2 | 7 | public boolean setLabel(Object r, Object value)
{
//Initialize the label methods if they are not all ready set
if(this.setLabelMethods == null)
{
this.setLabelMethods = new ArrayList<String>();
this.initLabelMethods(r);
}
for(String methodName : this.setLabelMethods)
{
try
{
/**
* A... |
93346496-eb99-4dd9-9991-1447895d9089 | 9 | @Override
public void setSelected(Construct.SelectionCause cause, ConstructEditor currentOrNewlySelected, boolean bSelect) {
if(bSelect == true) {
propagateHighlightSelection(this);
update();
text_area.setBackground(new Color(230, 230, 230));
textListener = new TextListener();
text_area.ad... |
4a4091c5-0f79-4a61-bb9c-ba6e80d2dfdc | 8 | @Override
public void handleIn(Packet packet) {
if (packet.isBroadcast()) {
// First if it is a broadcast packet, check if it is a arp request
if (packet.isArpRequest()) {
// answer it with self's interface info
sendArpResponse(packet);
} else {
//... |
01706d1f-2299-4c38-9564-67211d8d0cb4 | 8 | private boolean save() {
if(file == null) return saveAs();
Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(waitCursor);
TableItem[] items = table.getItems();
String[] lines = new String[items.length];
for(int i = 0; i < items.length; i++) {
String[] itemText = new String... |
7acfb49b-aa95-4dc6-87bf-6bbb156161eb | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Variable variable = (Variable) obj;
if (name == null && variable.getName() == null) {
return true;
}
return name.eq... |
21d1cb64-4a59-46c3-b665-50e6babfbe05 | 8 | public static List<String> getCategories()
{
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
List<String> result=new ArrayList<String>();
try{
String sql="SELECT * FROM category";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
... |
2987d1d4-4ae2-430a-8d25-d5308e9c44b6 | 3 | private void dfs(Graph G, int v)
{
marked[v] = true;
for (int w : G.adj(v))
if (!marked[w])
{
color[w] = !color[v];
dfs(G, w);
}
else
{
if (color[w] == color[v])
isBipartite = false;
}
} |
a758f9b9-b613-4a2d-a15b-497f4ac60f06 | 3 | @Test
public void testaaToimiikoLoppuSummanLaskeminen(){
Peli p = laskeTulosruutuja(0,1,2,3,4,5,7,8,9,10,11,12,13,14,15);
int summa = 0;
for (Tulosruutu ruutu : p.annaVuorossaOleva().annaTulosrivi().annaTulosruudut()){
if(ruutu.annaTyyppi().tyyppi!=17&&ruutu.annaTyyppi()... |
ef17d9f6-2565-40db-8395-8760020c422d | 0 | protected void toggleVSync() {
setVSync(!this.vSync);
} |
6382f2c4-1eec-4376-b269-9507d3c05a1e | 2 | public final void modifyMotivation(int toMod)
{
motivation+=toMod;
if(motivation > 100)
{
motivation = 100;
}
else if(motivation < 0)
{
motivation = 0; //sleep all day
}
} |
490da768-9f6b-4df8-8db6-d8687e9a5834 | 5 | private JPanel buildButtons() {
JPanel panel = new JPanel(new BorderLayout());
panel.setMaximumSize(new Dimension(2000,50));
JButton deleteButton = new JButton("Delete");
deleteButton.setFocusable(false);
deleteButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEv... |
3e690343-3898-4593-b6b5-050e637a4c98 | 7 | public boolean execute(Closure closure){
// get the internal thread number
int i = getInternalThreadId();
// 1. mark myself as active
active[i] = true;
// 2. check whether I am the token owner
boolean token_owner = token == i;
// 3. check whether the other thread already entered the selection pro... |
675ce3ee-b978-4779-aa07-35de78996c6b | 6 | private String statusDetailed() {
StringBuilder sb = new StringBuilder();
sb.append("Hosts:\n");
for (Host host : hosts.values())
sb.append("\t" + host.getName() + " on " + host.getSocket() + (host.isRunning() ? "" : "(inactive)") + "\n");
for (Map.Entry<String, Map<String, Service>> entry : services.e... |
c918f34b-6b4a-488f-9ab7-3f1a6245fcb9 | 0 | @Override
public void run() {
clip.play();
} |
dda03edf-1b2a-421a-a13d-bb36a6bad2cf | 5 | public void insert(LUSTree node){
//Make sure there is enough usable space above/below the card
if (game_cards-node.card < game_racksize-node.index-1 || node.card-1 < node.index)
return;
//Check if it can be added to any branches
boolean added = false;
for (LUSTree n: branches){
n.insert_recursiv... |
b6e3a51b-91f7-4c87-b007-1bf2ae5b3a6d | 0 | public String getOutputFormat() {
return this.outputFormat;
} |
7748936a-dc78-4fbc-9524-2507609c0a7c | 6 | private static int daysInMonth(int m, int y) {
if (m == 4 || m == 6 || m == 9 || m == 11)
return 30;
if (m == 2) {
if (y % 4 == 0) // 2000 divisible by 400, only century
return 29;
return 28;
}
return 31;
} |
e6f391ce-e7e6-40c8-99f9-a8bc137da180 | 6 | @Override
public IpInfo getIpValue(String ip) {
logger.info("Calling : " + this.toString() + ", IP: " + ip);
IpInfo ipLookup = new IpInfo();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(getInputStream(ip)));
String inputLine =... |
66161e48-67e6-4bf9-b5a5-da739c9c75c6 | 2 | public final void mapOption(String option, Action a) {
if(optionMap.containsKey(option)) {
System.err.println("[CLC] The option --" + option + " has already been registered.");
} else if(a == null) {
System.err.println("[CLC] The option --" + option + " can not be linked to a null Action.");
} else {
opt... |
a4228d4f-0add-4fa4-87d5-18d8e76626c3 | 5 | public void setEditedBlock(JBlock b) {
if(b==editing) return ;
if(editing!=null)
finnishEdit();
editing=(structBlock)b;
fields.clear();
//fieldsPane.removeAll();
for(String f[]:editing.getFields()){
Field field=new Field(this);
field.na... |
56f9891d-bf34-42c8-8d69-b1c342583cad | 3 | @Override
public void acceptDraggableObject(DraggableObject object)
{
if(object instanceof DraggableObjectFile)
{
DraggableObjectFile fileobj = ((DraggableObjectFile)object);
if(fileobj.file != null)
{
if(fileobj.file.getName().endsWith(".png"))
{
textField.text = fileobj.file.getPath();
... |
4ee334cd-6a85-4999-9298-cc711f409d8d | 2 | public Set<BankAccount> getAccountsSatisfying(Checker<BankAccount> checker) {
Set<BankAccount> result = new HashSet<>();
for (BankAccount account: accounts)
if (checker.check(account))
result.add(account);
return result;
} |
09999fcc-f0b2-4493-bb51-4fbaa180663e | 7 | public Departamento selecDepartamento(String NOME, String CODDEP) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Departamento DEP = null;
try {
conexao = BancoDadosUtil.getConnection();
com... |
76fce118-9b0e-4862-b20a-969f7ea94b2b | 5 | private void handleIfThrowWasDouble() {
if ( !getCanPlayerThrowOneMore() && !getIsPlayerInJail() )
{
setCanPlayerThrowOneMore(true);
}
if ( getIsPlayerInJail() )
{
setIsPlayerInJail(false);
setCanPlayerThrowOneMore(false);
doubleThrowCount = -1;
}
++doubleThrowCount;
... |
c1a590e9-8fad-495d-97f9-7b7cb63237a0 | 1 | private void parseField(String name, String value) throws ParseException{
boolean result = currentParser.parseField(name, value);
logger.info(String.format(Messages.getString("parsing_field"), name, value ));
if (!result){
throw new ParseException(String.format(Messages.getString("unable_to_parse_field"), n... |
99648112-e656-4dd7-bdc4-d310eda82ff5 | 5 | public void draw(double centerDistance) {
GL11.glPushMatrix();
GL11.glTranslated(position.x, position.y, position.z);
GL11.glColor3f(color[0], color[1], color[2]);
// Draw conic section
if (parent != null && drawConic) {
Vector3D r = position.clone().subtract(parent.position); // getRelativePosition();
... |
01069921-60be-40f0-92be-e33e95df8bf7 | 9 | protected void readAttribute(String name, int length, ConstantPool cp,
DataInputStream input, int howMuch) throws IOException {
if ((howMuch & KNOWNATTRIBS) != 0 && name.equals("Code")) {
bytecode = new BytecodeInfo(this);
bytecode.read(cp, input);
} else if (name.equals("Exceptions")) {
int count = inp... |
874c3788-a991-4800-912d-7beb8b4d6c81 | 6 | public boolean handelswareVerkaufen( int auswahl, int menge )
{
if ( auswahl == 0 || menge == 0 )
{
return false; // Abbruch
}
else if ( auswahl == 1 )
{ // Korn verkaufen
if ( this.aktiverSpieler.getKorn() >= menge )
{ // Spieler hat genügend Korn zum Verkaufen
this.aktiverSpieler.saldiereHande... |
d3775bf3-88b7-40fa-a483-bbeb971e2247 | 8 | private void checkOrders( Vector<Orders> orders ){
for( Orders now : orders ){
if(now.urlLoad){
driver.start(now.url);
}
else{
switch( now.type ){
case "click" :
checkClickTarget( now.target, now.name );
break;
case "send" :
checkSendTarget( now.target, now.name, now.text );
... |
dee5d5c0-ec7f-4450-bea8-8e3d276add37 | 6 | @Override
public int read () throws IOException
{
int character = super.read();
if (this.first)
{
while (character != '\n')
character = super.read();
character = super.read();
this.first = false;
}
if (character == -1)
return -1;
if (character == '.')
return '-';
i... |
b126fc85-085a-4add-854b-9cdcb9fe2648 | 6 | public void victory() {
if (nbCellsLeft == nbMines) {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (cells[i][j].getIsAMine()) {
for (GameEventHandler gameEvent : gameEventList) {
gameEvent.buttonUpdate(i, j, ButtonImage.FLAG);
}
}
}
}
for (GameE... |
00f48ada-0512-4f39-a4e8-b8c1a4331ad5 | 1 | @Override
public float contains( int x, int y ) {
if( boundaries.contains( x, y ) ){
return 1;
}
else{
return 0;
}
} |
88660fae-788b-402f-baa5-3130a2aed4dd | 6 | @Override
public void exec(CommandSender sender, String commandName, String[] args, Player player, boolean isPlayer) {
String newJoinMessage = "";
if (!isPlayer) {
sender.sendMessage(ChatColor.RED + "Run this command from ingame.");
return;
}
if (!player.has... |
4ca7d4a6-7173-4e39-8728-c0dd17db30f9 | 1 | public void visitMaxs(final int maxStack, final int maxLocals) {
buf.setLength(0);
buf.append(tab2).append("MAXSTACK = ").append(maxStack).append('\n');
text.add(buf.toString());
buf.setLength(0);
buf.append(tab2).append("MAXLOCALS = ").append(maxLocals).append('\n');
text.add(buf.toString());
if (mv !=... |
b772c576-8a0a-4ad0-b147-e73dfa16487c | 8 | public Coordinate ausDirzuCoo(int dir) { // Diese Methode erstellt aus der Richtung eines Menschen
int x = this.getPosition().getX0(); // die n�chste Position, in die er hingehen w�rde.
int y = this.getPosition().getY0(); // Diese wird dann als Koordinate zur�ckgegeben.
switch(dir) {
case 0:
++y; ... |
0466d4e8-42e3-4253-a81f-5848a9ea4881 | 0 | public static boolean validateProfessor(){
boolean isValid=false;
return isValid;
} |
e02604c5-502c-48d5-a67b-4f1a1132f7a7 | 3 | public TreeNode[] getSelected() {
Set s = new HashSet(selectedNodes.keySet());
Iterator it = s.iterator();
while (it.hasNext()) {
TreeNode n = (TreeNode) it.next();
if (n.getParent() == null && n != getModel().getRoot())
selectedNodes.remove(n);
}
return (TreeNode[]) selectedNodes.keySet().toArray(n... |
ac092ccb-6195-45f0-a539-2ffc6589ccb2 | 4 | public void finjectOutPayload (Circuit c, byte[] info, boolean alice_outputs) {
int i, j, k, line_num, consumed_bytes ;
for (i = k = 0; i < FMT.size(); i++) {
IO io = FMT.elementAt(i);
// Verify it's a relevant i/o object
if (io.isInput()) continue;
if (... |
5b829374-2a83-4ed3-98db-e7ff63e7c1cf | 3 | public final boolean isAlive() {
if(this.getWorld() == null)
return false;
if(!this.getWorld().liesWithinBoundaries(this))
return false;
if(this.getWorld().getLivingProjectile() != this)
return false;
return true;
} |
0df2a837-61ce-4326-a6e5-4710fe0ad59b | 2 | public void parentRelease(){
if(this.subResponse.decrementAndGet() <= 0){
// 获取下一个缓冲区进行传输
ByteBuffer buffer = this.currentBufferQueue.poll();
while(buffer != null){
buffer.clear();
BufferPool.getInstance().releaseBuffer(buffer);// 将用完的缓冲区放回缓冲区池
buffer = this.currentBufferQueue.poll();// 从队列中... |
9cf5015e-713d-4167-88e0-08fe93285178 | 1 | public int getRandomInt(){
int value = (int)(Math.random()*100);
if(value<2){
value = 2;
}
return value;
} |
c68e1b73-94d0-416a-bb98-332ab341f99d | 4 | public String printParkInfo() {
String text="";
if(park == null && getParkBoyList().size() == 0) {
text="目前没有管理任何停车场!" ;
return text;
}
int emptyNum = 0;
int totalNum = 0;
if(park != null) {
text= " 停车场编号:" + park.getCode() +"\n";
text=text+ " 停车场名称:" + park.getParkName... |
ff500251-fdd5-4352-80ff-905ba7db0699 | 9 | @Override
public void actionPerformed(ActionEvent e) {
/**
* ActionListener for Start Button.
*
* Creates MainWindow and closes LoginWindow if username is valid.
* Else, print an error.
*/
if(e.getSource().equals(startButton)) {
//check for... |
73ffa85c-e15c-4a43-872a-c914f3805e7e | 2 | public boolean isLegaelName(String name) {
if (name!=null && !name.equals(""))
return true;
return false;
} |
78a10d05-d26d-4d2f-881f-53d58fbc1a8c | 7 | private static double incbd(double a, double b, double x) throws ArithmeticException {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, z, thresh;
int n;
double big = 4.503599627370496e15;
double biginv = 2.22044604925031308085e-16;
k1 = a;
k2 = b - 1... |
2d234c2d-cbb3-4d82-b782-d1f295b830b9 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Location other = (Location) obj;
if (cityName == null) {
if (other.cit... |
b069ebaf-f39a-41e2-ab45-47f192dde7c1 | 2 | public XAttribute getAttribute( String name ){
for( XAttribute check : attributes ){
if( check.getName().equals( name ))
return check;
}
return null;
} |
943114db-7113-43a2-b715-1321c969586f | 3 | public void setPaintSession(PaintSession paintSession) {
if (this.paintSession != null) {
if (this.paintSession == paintSession) return;
this.paintSession.endSession();
}
this.paintSession = paintSession;
clearStatus();
if (paintSession != null) {
setStatusAction(paintSession.getDisplayName());
pa... |
095511fc-f71f-496b-8d6d-2d4463ed1013 | 6 | public static void runCouchMenu() {
try {
// While the program isn't told to leave the couch menu
while (!startGame && !goToMainMenu && !exit) {
// If the display is not visible (minimised), add much more
// delay
if (!Display.isVisible()) {
Thread.sleep(200);
}
// If the display is r... |
087d3d27-4f2c-4d71-80c0-b82491e047c6 | 5 | public int getObjPaletteValue(int address, TimeStamp time) {
if (address >= 0 && address < 0x40) {
if (objPalette[address] == null)
return (address & 0x1) == 0 ? 0xff : 0x7f;
return objPalette[address].getValueAt(time, (address & 0x1) == 0 ? 0xff : 0x7f);
} else
throw new RuntimeExcept... |
a8f49921-9790-4a10-9551-4a83f2df22f8 | 7 | @Override
protected void execute() {
try {
for(int i; (i = in.read()) != -1;) {
char c = (char) i;
robot.log.printf(TRACE, "received '%s'", c);
if(c == ACTIVE) robot.setCharging(false);
else if(c == INACTIVE) robot.... |
49845afe-b1ac-453a-ba34-8ba05908e8bb | 4 | public boolean accept(File pathName) {
try {
String path = pathName.getCanonicalPath();
if (path.endsWith(".tmx") || path.endsWith(".tsx") || path.endsWith(".tmx.gz")) {
return true;
}
} catch (IOException e) {}
return false;
} |
a90fab56-02da-4e57-9372-9098a2c156b6 | 6 | private static void navegar(String url) {
//primero buscamos el url en los DNS para sacar el ip del
//Servidor Web donde esta ese dominio
String ip = "";
for(Servidor server : servidores){
if( server instanceof ServidorDNS ){
try{
ip = serv... |
c95ad1ea-a38c-4eb9-b2fb-7fdf2304535c | 5 | public InsertStatus insert(ItemStack is, boolean force) {
if (is == null || is.stackSize == 0)
// Inserting null or an empty stack should change nothing
return InsertStatus.SUCCESS;
Iterator<Map.Entry<ICrate, ItemStackStorage>> i = map.entrySet()
.iterator();
for (ItemStackStorage v = null; i.hasNext();... |
6d0da9d4-8ffe-4cf3-856d-994ef0115f52 | 6 | private String formatString(String string) {
char[] characterArray = string.toLowerCase().toCharArray();
String formatted = "";
for (char c : characterArray) {
// Tests numbers 0-9
if (c >= 48 && c <= 57)
formatted += c;
// Tests letters a-z
... |
ef5eb995-a3e9-4e20-bfc5-eae2d3b4a8ad | 3 | public int reset(int orderType) {
bSTQueue = new LinkedUnbndQueue<T>();
if (orderType == INORDER)
inOrder(root);
else if (orderType == PREORDER)
preOrder(root);
else if (orderType == POSTORDER)
postOrder(root);
return size();
} |
bf59bd00-c13b-444f-8b6b-f17f87c458d5 | 4 | public int append(double[] buffer, int start, int len) throws IllegalArgumentException, IOException
{
int bytesRead = 0;
int bytesToRead = 0;
//check start and len
if(start < 0 || len < 0)
throw new IllegalArgumentException("start and len must be positiv values");
//check the buffer size
... |
39c42a91-bf79-4755-bf51-a947a7c3a476 | 5 | private String[][] prepareString(String text) {
String texts[][];
String textSplit[] = text.split("\n");
texts = new String[textSplit.length][2];
for(int i = 0; i < textSplit.length; ++i){
String splitSpace[] = textSplit[i].split(" ");
int maxPerLine = textSplit[i].length() / 2;
int curren... |
7e21ace8-42a2-4c35-aaba-ccda6a88ac00 | 7 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
return true;
}
Player player = (Player)sender;
if (HyperPVP.getGameSessions().containsKey(player.getName())) {
sender.sendMessage(ChatColor.RED + "You are already... |
26ef3c85-105f-4418-b7bc-40eca6ab5739 | 9 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
beans.RHouse rHouse = new beans.RHouse();
boolean isSafeToCommit = true;
boolean isCommitted = false;
Hashtable<String, String> errorM... |
279e5958-39d3-49e1-9bdb-2ae8091dc35b | 6 | public void testMultipleThreads () throws IOException {
final Server server1 = new Server(16384, 8192);
server1.getKryo().register(String[].class);
startEndPoint(server1);
server1.bind(tcpPort, udpPort);
server1.addListener(new Listener() {
public void received (Connection connection, Object object) {
... |
c70e2c75-3e12-4431-96f5-e25a693e4fe4 | 5 | private final void method2824(int i, byte i_4_,
Class348_Sub43 class348_sub43) {
if (((((Class348_Sub16_Sub3) aClass348_Sub16_Sub3_8852).anIntArray8895
[((Class348_Sub43) class348_sub43).anInt7067])
& 0x4) != 0
&& ((((Class348_Sub43) class348_sub43).anInt7087 ^ 0xffffffff)
> -1)) {
int i... |
c407251a-6eba-4edf-9102-befd20a15ea7 | 4 | public boolean changeUser(String receiver) {
try {
for(String user : _remoteObj.getAllUser()) {
if(user.equalsIgnoreCase(receiver)) {
_receiver = receiver;
return true;
}
}
} catch(RemoteException ex) {
if(connect())
return changeUser(receiver);
System.out.println("Cannot get User ... |
5fddc7ef-e5bd-432b-bb89-f33520f18f70 | 6 | private void hireWorker(int workId, int projId, long salary, HttpServletResponse response, RequestContext rc) throws SQLException, IOException {
int requesterId = rc.getId();
if(WorkerManager.isFree(workId) && ProjectManager.ownsProject(projId, requesterId)) {
if(!ProjectManager.isFull(projI... |
59159cc0-2f42-4068-978b-da4f15a8968f | 7 | public void chat(BigInteger K, boolean init) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line;
BigInteger tmp;
if(init) {
// yeah yeah, code duplication... this saves runtime, one if per loop!
... |
b0ef2fbc-8b31-466b-9cd6-315d39727887 | 9 | static public float get(int itemLevel, QualityT quality, EquipT equip, WeaponT weapon, boolean caster) {
float[] data;
if (WeaponT.WAND == weapon) {
data = Wand.data;
} else if (WeaponT.BOW == weapon || WeaponT.GUN == weapon || WeaponT.XBOW == weapon) {
data = Ranged.data... |
e4b06df3-f67a-4b88-bfdf-28e34f3f49cd | 3 | @Override
public Object getValueAt( Object node, int column )
{
System.out.println( "getValueAt: " + node + ", " + column );
MyTreeNode treenode = ( MyTreeNode )node;
switch( column )
{
case 0: return treenode.getName();
case 1: return treenode.getDescription();
case 2: return treenode.getChildren().si... |
877b74c0-b99c-4f77-906a-9c84bede2616 | 1 | public static void printArray(int array[]){
int i;
for (i = 0; i < array.length; i++) {
System.out.print(array[i] + " ");
}
System.out.println();
} |
13df2c81-189e-4901-9598-c70939985dae | 4 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Position other = (Position) obj;
return this.x == other.x && this.y == other.y;
} |
c2881005-d1c8-4df3-8bd6-05255fa14de5 | 6 | public UneDeMesSeries(Serie serie) throws SQLException {
this.serie = serie;
//Deux premier panels
JPanel pnlBaseGauche = new JPanel();
JPanel pnlBaseDroite = new JPanel();
//Premier Layout
this.setLayout(new BorderLayout());
GridBagConstraints gbc1 = new Grid... |
3a8a0bfb-47a7-49e5-8be7-b48ed7c3cd6f | 9 | public static List readWatchableObjects(DataInputStream par0DataInputStream) throws IOException
{
ArrayList var1 = null;
for (byte var2 = par0DataInputStream.readByte(); var2 != 127; var2 = par0DataInputStream.readByte())
{
if (var1 == null)
{
var1 = ... |
3216b547-76cb-453a-a481-a4ee01976a9d | 3 | @SuppressWarnings("deprecation")
public void testCompareTo() {
Partial test1 = createHourMinPartial();
Partial test1a = createHourMinPartial();
assertEquals(0, test1.compareTo(test1a));
assertEquals(0, test1a.compareTo(test1));
assertEquals(0, test1.compareTo(test1));
... |
19596bb6-a424-42ba-96d5-a0f4c80a8427 | 5 | public static boolean isPrimitiveNumberType(Class<?> clazz) {
if (!clazz.isPrimitive()) {
return false;
} else if (clazz != boolean.class && clazz != void.class
&& clazz != char.class) {
return true;
}
return false;
} |
53c4be2d-5fca-40b6-a11c-54e63e05f558 | 1 | public List<SignaturePropertyType> getSignatureProperty() {
if (signatureProperty == null) {
signatureProperty = new ArrayList<SignaturePropertyType>();
}
return this.signatureProperty;
} |
2f014457-a243-48ed-9b58-7240403c5524 | 0 | @Test
public void oneTablespoonEqualThreeTeaspoon(){
ArithmeticQuantity tbs = new ArithmeticQuantity(1, Volume.TABLESPOON);
ArithmeticQuantity tsp = new ArithmeticQuantity(3, Volume.TEASPOON);
//assertEquals(tbs.convert(TEASPOON), tsp);
//assertEquals(tsp.convert(TABLESPOON), tbs);
... |
fb627df6-ba98-4dda-a063-ea77b2e703f6 | 1 | protected void addClasses(final Collection classes) {
final Iterator iter = classes.iterator();
while (iter.hasNext()) {
final String className = (String) iter.next();
this.hierarchy.addClassNamed(className);
}
} |
3106e9c7-445f-4e0d-a7b7-00a44a90c67d | 1 | public static Enumeration getClassesAndPackages(final String packageName) {
final Enumeration enum_ = classpath.listFiles(packageName.replace('.',
'/'));
return new Enumeration() {
public boolean hasMoreElements() {
return enum_.hasMoreElements();
}
public Object nextElement() {
String name = ... |
a1665a0e-3536-4480-9435-735aef8fa191 | 4 | private void board(Story st,PassengersList allPassengers) {
countPermitEnter = 0;
int currentDispatchSize = st.getDispatchStoryContainer().size();
for(Passenger passenger : st.getDispatchStoryContainer().getContainer()) {
passenger.setNotTriedEnter(true);
}
... |
2cb099ed-eb4e-4836-a893-69c3d7555b3c | 0 | public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
} |
26416a3e-989a-41e8-96f2-2ad33eca4c92 | 3 | public void play()
throws JavaLayerException
{
try
{
System.out.println("playing "+fFilename+"...");
InputStream in = null;
if (remote == true) in = getURLInputStream();
else in = getInputStream();
AudioDevice dev = getAudioDevice();
Player player = new Player(in, dev);
player.play();
}
... |
9ab721d1-460c-4582-b806-d39295b6eba6 | 3 | private String getRegExFilterNodeValue(final Document doc) {
Node filterNode = this.getFirstLevelNodeByTag(doc, FILTER_TAG);
if (filterNode == null) {
return null;
}
Node regExFilterNode = this.getNodeByTagInNode(filterNode, REGEX_FILTER_TAG);
if (regExFilterNode == null) {
return null;
}
String val... |
d32515ef-893b-4010-abbb-d2222ff06453 | 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... |
07fdc3b0-af83-4cc1-97cd-99c037109dfe | 5 | public void actionPerformed(ActionEvent ae) {
//
// Process the action command
//
// "ok" - Data entry complete
// "cancel" - Cancel the request
// "help" - Display help for loan accounts
//
try {
switch (ae.getActionCommand()) {
... |
ef679552-4878-4417-8898-59515fd7d5c9 | 9 | public void checkTime() {
// is it pvp on now?
long lowestTimeLeft = 0;
debugMsg("Checking time");
for(World w : Bukkit.getServer().getWorlds()){
if((Boolean) getValue(pvpWorlds,w.getName(),"enabled")) {
debugMsg(w.getName() + " enabled. Checking.");
if((B... |
4b554e0a-1cd1-467a-afc4-53cb7d9a90f9 | 2 | public static void main(String[] args){
char [][] board = new char[9][9];
for(int i = 0; i < 9; ++i){
Arrays.fill(board[i], '.');
}
board[0][0] = '9';
new Sudoku_Solver().solveSudoku(board);
for(int i = 0; i < 9; ++i){
System.out.println(Arrays.to... |
1e9c1df6-85bd-4f8f-95cd-8268acf99941 | 4 | public void delete(String key)
{
if (!isPresent(key)) {
// TODO test this
throw new IllegalArgumentException("key is not present");
}
for (int bucketIndex : getHashBuckets(key)) {
Bucket bucket = new Bucket(bucketIndex);
if(bucket.value >= 1 &... |
b6d703ac-5bb2-487b-84cf-a58c918e4140 | 2 | * @param column The column to use.
* @return The bounds of the specified cell, adjusted for any necessary indent.
*/
public Rectangle getAdjustedCellBounds(Row row, Column column) {
Rectangle bounds = getCellBounds(row, column);
if (mModel.isFirstColumn(column)) {
int indent = mModel.getIndentWidth(row, col... |
f6e730d1-f02b-47a9-a74d-b1485b14dbd7 | 2 | public static boolean pallindrome(String s) {
String s1 = StringDemo.reverseString(s);
char c[] = s.toCharArray();
char c1[] = s1.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] != c1[i]) {
return false;
}
}
return true;
} |
72d8ea0c-e206-4824-82ab-e282fad8e217 | 6 | public void focusLost(FocusEvent e) {
if (e.getSource() == InchesInput) {
CalculateConversionButton.setFocusable(true);
}
else if (e.getSource() == FeetInput) {
CalculateConversionButton.setFocusable(true);
}
else if (e.getSource() == YardsInput) {
CalculateConversionButton.setFocusable(tru... |
4a9940a1-1db7-42d0-9a00-f5878b453511 | 9 | private void getAddedFile(Map<String, String> nowDirFileMap) {
for (Iterator<String> iterator = nowDirFileMap.keySet().iterator(); iterator
.hasNext();) {
String key = iterator.next();
if (null == oldDirFileMap.get(key)) {
oldDirFileMap.put(key, nowDirFileMap.get(key));
TjuFit a = new TjuFit();
... |
9fa63c82-1f89-4c87-8a91-a4bc79752b55 | 1 | public static void main(String[] args) {
try {
_9_LostMessage lm = new _9_LostMessage();
try {
lm.f();
} finally {
lm.dispose();
}
} catch (Exception e) {
System.out.println(e);
}
} |
ce74a0c9-0efc-4e88-82d1-3faddf6eda0f | 4 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("rowset")) {
inAttackers = false;
inItems = false;
}
if (qName.equals("row")) {
if (!inAttackers && !inItems) {
response.add(apiKill);
apiKill = null;
}
}
} |
b6311d33-a114-4e6f-9712-9282b8be4b4a | 4 | public static void cullDiagonals(Object batch[]) {
for (int i : Tile.N_DIAGONAL) if (batch[i] != null) {
if (batch[(i + 7) % 8] == null) batch[i] = null ;
if (batch[(i + 1) % 8] == null) batch[i] = null ;
}
} |
d6ae49e7-4dc6-4770-a3be-9229dba8bd6f | 7 | private Point2D drawSymbol(UGraphic ug, double theta, final Point2D position, LinkDecor decor) {
if (1==1) {
return null;
}
Point2D middle1 = null;
// final double theta = Math.atan2(
// -direction.getX() + position.getX(), direction.getY()
// - position.getY());
if (decor == LinkDecor.SQUARRE) {
mi... |
56e80b4f-3085-4cf7-8856-ada9adaab8d0 | 4 | @Override
public final boolean dispatchKeyEvent(final KeyEvent e) {
/* Prevent accidental commands by requiring CTRL to be held */
if (!e.isControlDown()) {
/* We have not consumed the event */
return false;
}
/* Only register each command ONCE */
if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.