method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b521e681-054a-44a6-84a1-c63e4ceff5d2 | 6 | private void cboInstructionsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboInstructionsItemStateChanged
// TODO add your handling code here:
int instructionMethodValue = cboInstructions.getSelectedIndex();
if (instructionMethodValue == 0) {
txtAreaInstr... |
eab08fc0-b022-4b6d-bd7a-ca469a11a26b | 9 | private boolean stopConditionsProcessor(StopConditions stopCondition) {
boolean any = (stopCondition == StopConditions.ANY);
// EXCEEDED_LIMIT_TRANSMISSION
if (stopCondition == StopConditions.EXCEEDED_LIMIT_TRANSMISSION || any) {
if (receivedPackageCount >= settings.getPacketsQuantit... |
99511cd2-4ebd-49e3-aa85-9e81ccbb41a8 | 7 | * @param dependOn the index number of pathway this one depends on, -1 if no dependency
* @return
*/
private ArrayList<Queue> pathwayQueues(LayoutInfo[] layouts,int[] dependOn){
ArrayList<Queue> queues = new ArrayList<Queue>();//each queue is for a disconnected group of pathways
int n=layou... |
3472e5af-20d7-48c8-af09-c7bff5993483 | 0 | public int GetPassengerQuantity()
{
return passengersOnBoard;
} |
3e0b9a73-bcf0-452c-9c5a-7b3205b61691 | 1 | public void moveBall() {
for (int i = 0; i < SPEED; i++) {
ball.move(dx, dy);
collisionCheck();
}
} |
56197018-d73c-4442-adb9-dcf1ff7f7771 | 6 | final void method2629(int i, r var_r, int i_12_, int i_13_) {
anInt4114++;
r_Sub1 var_r_Sub1 = (r_Sub1) var_r;
i_13_ += 1 + ((r_Sub1) var_r_Sub1).anInt10468;
i += i_12_ + ((r_Sub1) var_r_Sub1).anInt10474;
int i_14_ = i * ((Class330) this).anInt4113 + i_13_;
int i_15_ = 0;
int i_16_ = ((r_Sub1) var_r_Sub1).anInt1... |
08c9b56d-ee16-4901-a208-6b312edfabe8 | 0 | public static void setWrap(boolean isSelected, JCellule[][] grid, JLabel lblGeneration, JButton btnProchaineGeneration) {
ControllerGrille.grid.setWrap(isSelected);
synchroniser(grid, lblGeneration, btnProchaineGeneration);
} |
2bc23195-2385-4516-aff1-bf3f6fa2a20e | 5 | private void load(boolean inverse) {
if(inverse) {
for(int y = 0; y < SIZE; y++) {
for(int x = 0; x < SIZE; x++) {
pixels[x + y * SIZE] = sheet.pixels[(this.x - x + 15) + (y+this.y) * sheet.SIZE];
}
}
} else {
for(int y = 0; y < SIZE; y++) {
for(int x = 0; x < SIZE; x++) {
pixels[x + ... |
e89a1c6b-024f-43ac-b5d2-220073ab1075 | 9 | public void fortify() {
Countries c = map.getCountries();
// there are no troops to fortify
if (c.getTroops(c.getAttacker()) == 1) {
return;
}
// get amount of fortifiers
boolean stop = false;
int fortification;
do {
String fortification_String;
do {
fortification_String = JOptionPane.sho... |
e53067e8-6eb2-4ab7-969d-43ff1db27ace | 4 | protected static Ptg calcNPER( Ptg[] operands )
{
if( operands.length < 3 )
{
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
debugOperands( operands, "calcNPER" );
double rate = operands[0].getDoubleVal();
double pmt = operands[1].getDoubleVal();
double pv = operands[2].getDoubleVal... |
bb51a963-8733-4b3e-b760-a624801e5803 | 2 | public static final List<Integer> parseSecTypes(String types_) {
List<Integer> result = new ArrayList<Integer>();
String[] types = types_.split(",");
for (int i = 0; i < types.length; i++) {
int typeNum = secTypeNum(types[i]);
if (typeNum != secTypeInvalid)
result.add(typeNum);
}
... |
fcfb138c-3a83-4236-824f-1ef73637b099 | 9 | private int[] getAvailable(Date s, Date e)
{
boolean[] busy = new boolean[N];
Arrays.fill(busy, false);
int i;
for (String start : cal.keySet())
{
for (CalEntry ce : cal.get(start))
{
if (ce.overlaps(s, e))
{
for (i = 0; i < ce.participants.length; i++)
{
busy[ce.participants... |
2609d42a-739d-4f41-8fa8-3a7c919b1407 | 8 | public String get(String user, String password, String urlOption,
String searchString, Boolean isFirst) {
String response = null;
DefaultHttpClient httpClient = new DefaultHttpClient();
try {
String url = urlOption + URLEncoder.encode(searchString, UTF_8);
if... |
504d67fe-7743-4677-8a8a-36cc9c4b9c3a | 3 | void attackPlaceDiagonallyBelowRight(int position, char[] boardElements, int dimension, int attackPlacesOnTheRight) {
int positionRightBelow = 1;
while (attackPlacesOnTheRight > 0) {
if (isPossibleToPlaceDiagRightBelow(boardElements.length, position, dimension, positionRightBelow)
... |
b80db6b0-90cb-4828-b69a-d39dbb5acc77 | 3 | public void Login(RequestPacket request, DBCollection coll, User user) {
try {
// Use cursor to find query -> password
DBCursor cursor = coll.find(new BasicDBObject("user_name", request.getUser_name()));
if(cursor.hasNext()) {
BasicDBObject ob = (BasicDBObject) cursor.next();
// Check that user_p... |
7a11236a-8065-4330-9247-ce9569d03c79 | 4 | @Override
public String getName() {
String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
String ret = null;
try {
ret = (String)super.invokeMethod(methodName, new Object[0], new Class<?>[0]);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
... |
234fd916-3c73-4a92-8765-b249bd5ac839 | 4 | public HTSMsg rcv() throws IOException{
byte[] lenBytes = new byte[4];
while (is.available() < 4) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
}
is.read(lenBytes, 0, 4);
long len = HTSMsg.deserializeS64(lenBytes, 4);
byte[] msg = new byte[(int)len];
while (is.available() < l... |
6d32b6f6-1906-44bc-9fbf-cfb7f13f4c21 | 6 | @EventHandler(priority = EventPriority.MONITOR)
void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory().getTitle().equals(name)) {
event.setCancelled(true);
int slot = event.getRawSlot();
if (slot >= 0 && slot < size && optionNames[slot] != null) {
Plugin plugin = this.plugin;
Op... |
13347bd3-0be6-412c-90d5-d5be5031052f | 5 | private void itemAction(int slot, String act) {
if (slot < 0)
slot = 0;
if (slot > 15)
slot = 15;
Coord c = new Coord(0, 0);
if (UI.instance.equip.equed != null)
if (UI.instance.equip.equed.get(slot) != null) {
if (act.equals("itemact")... |
4263b11b-955d-41d8-9c6b-ae60377724d9 | 6 | @Override
public boolean activate() {
return (!Bank.isOpen()
&& (
!Inventory.contains(Settings.itemOneID)
|| (!Inventory.contains(Settings.itemTwoID) && !Settings.usingHerb)
)
&& !Widgets.get(13, 0).isOnScreen()
&& !validate(Constants.WAITFOR_WIDGET)
&& !validate(Constants.FLASK_WIDGET)
);
} |
9175d199-b27c-450e-8549-c682e95e5a67 | 5 | public static void makeHtmlReport(MyArrayList<Employee> list){
File f = new File("html" + File.separator + "report.html");
try(FileWriter fw = new FileWriter(f);
BufferedWriter bw = new BufferedWriter(fw)){
bw.write("<!Doctype html>");
bw.newLine();
bw.write("<html>");
bw.newLine();
bw.write("<h... |
8d2e3acb-5c27-4192-9724-505f1dcdd8e0 | 8 | public String[] check(String passage) {
// No misspelled words for an empty string.
if ((passage == null) || (passage.length() == 0)) {
return null;
}
ArrayList errorList = new ArrayList();
// Tokenize the passage using spaces and punctionation.
StringTokenizer st = new StringTokenizer(passage, ... |
aecc096f-376e-442c-b521-85b387e3d887 | 4 | public void deconnect() {
InNode in = (a instanceof InNode ? (InNode) a : (InNode) b);
OutNode out = (a instanceof InNode ? (OutNode) b : (OutNode) a);
if (in != null) {
in.deconnect(out);
in = null;
}
if (out != null) {
out.deconnect(in);
out = null;
}
} |
d2de1b33-856f-48fb-95ea-51dec34f1612 | 2 | public boolean isReverseOf(Edge o) {
if (o.start == this.end && o.end == this.start) {
return true;
}
return false;
} |
9695efe8-0b35-46bf-959f-c9745da97ad6 | 2 | @Override
public void layoutContainer(Container container) {
final int offsetX = 0;
final int offsetY = 0;
final int boxWidth = (container.getWidth() - offsetX * 2) / numBoxes;
final int boxHeight = (container.getHeight() - offsetY * 2) / numBoxes;
for(Component comp : container.getComponents()) {
... |
7ebef366-d457-46c1-962b-e5c63a990aa7 | 0 | public Integer getIdSintomas() {
return idSintomas;
} |
7ef50a83-b4a0-49bc-a9a2-e60e68c84d4f | 6 | @RequestMapping(value="/players/nearby", method=RequestMethod.GET)
public @ResponseBody List<Player> getNearbyPlayers(String id){
System.out.println("in nearby yo");
Player requestingPlayer = playerService.getPlayerById(id);
List<Player> players = playerService.getAllAlive();
System.out.println("Players size... |
bf6253b3-9500-418d-bf64-83724bc646ee | 8 | public void setPlayerInArea(Player p, Location newPos) {
double x = newPos.getX();
double y = newPos.getY();
double z = newPos.getZ();
boolean f = false;
Location min = minPoint.getLocation();
Location max = maxPoint.getLocation();
if(x < min.getX()) {
... |
5670b0c6-5620-49cf-93da-09d76a2917dd | 5 | public CropImage2() {
initComponents();
fc = new JFileChooser();
addB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int returnVal = fc.showOpenDialog(CropImage2.this);
if (returnVal == ... |
1d144c21-0183-46c2-854b-6632cb97b225 | 1 | @Override
protected int[] orderArray() {
for (int i = 1; i < len(); i++) {
bubbleDown(i);
}
return array;
} |
2653b49f-5226-4df6-b184-400579fa83a6 | 5 | public int hamming() {
int compare = 1;
if (!hammed) {
for (int i = 0; i < tiles.length; i++) {
for (int j = 0; j < tiles[i].length; j++) {
if (tiles[i][j] != 0) {
if (tiles[i][j] != compare) {
hamming++;
}
}
compare++;
}
}
hammed = true;
return hamming;
}
r... |
135542e3-1c91-4204-b74f-85c8f0d94c51 | 5 | public static final String stringFromBytes(byte abyte0[], int offset, int length) {
char ac[] = new char[length];
int k = 0;
for (int l = 0; l < length; l++) {
int i1 = abyte0[offset + l] & 0xff;
if (i1 != 0) {
if (i1 >= 128 && i1 < 160) {
... |
0a00c5bd-13c2-4f24-ad24-0489dc79f8f1 | 0 | public void setUserInfo(String userInfo) {
this.userInfo = userInfo;
this.authority = assembleAuthority(this.host, this.port, this.userInfo, null);
} |
19cee541-d980-4674-9406-b6bc7993a350 | 9 | public List<BoardDataBean> getArticleList(int start, int end, String id)
throws Exception {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
List<BoardDataBean> articleList = null;
String sql = "";
try {
conn = getConnection();
/*추천지수 불러오는sql*/
sql = "update board set... |
d43ebfea-2f8f-46d9-9b24-4a82388b62bd | 5 | @Override
public void vieraile(TormaysReunaanViesti viesti) {
if (tormaysLaskuri > 0) {
return;
}
switch (viesti.getReuna()) {
case YLA:
case ALA:
viestit.kasitteleValittomastiViesti(new AlustaNopeusViesti());
viestit.kasitt... |
91d1237e-3331-4f88-8a9c-bc49df7d243d | 5 | private static BufferedImage mergeNearestWhitePoints(BufferedImage img) {
Graphics2D g = img.createGraphics();
g.setColor(Color.WHITE);
for (int k = 0; k < 20; k++) {
for (int i = 0; i < img.getWidth() - 1; i++) {
for (int j = 0; j < img.getHeight() - 1; j++) {
if (img.getRGB(i, j) == -1) {
Vec... |
c2095371-1db7-453b-b1e6-f4a5de6f68ec | 2 | public void setURLStream (String connstr){
try {
URLStream = new URL(connstr).openStream();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
};
} |
65250009-c395-424f-bcd6-0750af42cc9e | 9 | protected LinkedNode<K,V> getInner(Object o, int h, int segment) {
long recid = segmentRecids[segment];
for(int level=3;level>=0;level--){
long[][] dir = engine.get(recid, DIR_SERIALIZER);
if(dir == null) return null;
int slot = (h>>>(level*7 )) & 0x7F;
as... |
a320e0c0-fa4b-404e-8beb-a9f279d17db0 | 8 | public MpimParseInput(Proxy proxy) throws ConnectionClosedException
{
//assert(parse != null && proxy != null);
assert(proxy != null);
String inicial ="<stream>";
String end = "</stream>";
String tmp;
int i;
body = null;
accounts = proxy;
try{
byte data[] = new byte[accounts.getConnection().so... |
aeae4da5-c958-4a14-89aa-2de5f68fe183 | 1 | private String readString(byte[] remainingData, int stringIdx) throws IOException {
int strLen = readUInt16(remainingData, stringIdx);
if (strLen == 0)
return "";
stringIdx += 2;
byte[] str = new byte[strLen * 2];
System.arraycopy(remainingData, stringIdx, str, 0, strLen * 2);
return new String(remaining... |
5bce878b-68a8-451e-8412-a6f2ee2c115c | 3 | public boolean equals(Object o){
if (! (o instanceof ASection )) return false;
if ( (start.getOffset() == ((ASection)o).getStartOffset())
&& (end.getOffset() == ((ASection)o).getEndOffset())
) return true;
return false;
} |
2f52d864-e840-4dcb-a66c-8ea6ee10df99 | 0 | @Override
public AbstractPlay getBest() {
ArrayList<AbstractPlay> bestPlays = getBestPlays();
return bestPlays.get(rnd.nextInt(bestPlays.size()));
} |
d506bc27-461d-402a-9839-65063914dffd | 3 | private boolean checkSpace() {
// TODO Auto-generated method stub
for (int i = 0; i < clientObj.length; i++) {
if(clientObj[i]!=null)
count++;
}
if(count<5){
return true;
}
else{
return false;
}
} |
beffae75-3255-4bb6-bc6c-55a6001134a3 | 6 | final Interface2 method3739(int i, Buffer buffer, boolean bool, int i_35_,
int i_36_) {
try {
if (i != 8448)
((OpenGlToolkit) this).aClass64_Sub3_7844 = null;
anInt7605++;
if (aBoolean7873 && (!bool || aBoolean7869))
return new Class135_Sub1(this, i_35_, buffer, i_36_, bool);
return new Cla... |
8cbe4213-50ca-4488-8028-b0246d3e4e33 | 6 | public static void printTurn() {
for (MyAnt ant : MyBot.myAnts) {
int dir = ant.getDirection();
String direction = "";
if (dir < 4) {
switch (dir) {
case 0:
direction = "E";
break;
case 1:
direction = "S";
break;
case 2:
direction = "W";
break;
case 3:
... |
c384cdc0-1ad8-4400-81b0-d14efc9a8900 | 7 | @SuppressWarnings("resource")
public Class<?>[] getClassesFromThisJar(Object object)
{
final List<Class<?>> classes = new ArrayList<Class<?>>();
ClassLoader classLoader = null;
URI uri = null;
try
{
uri = object.getClass().getProtectionDomain().getCodeSource().ge... |
53998375-37ff-41cb-9e49-2c5502e18f50 | 4 | public static void figureOutMapIn(PrintStream w, Object... comps) {
for (Object c : comps) {
ComponentAccess cp = new ComponentAccess(c);
w.println("// Input mapping to " + objName(cp));
for (Access fin : cp.inputs()) {
Role role = fin.getField().getAnnotation... |
d5fb430e-f497-4691-88ea-e33822646b32 | 6 | public static void main(String[] args) {
// Declare named constants.
final double MIN_FAHRENHEIT = -459.67;
// Declare the variables.
double fahrenheit;
double convertedDegrees;
int tempScale;
String tempScaleStr="";
// Creating the Scanner object
Scanner keyboard = new Scanner(Syste... |
26cb32f4-4c84-40d3-9739-a395c33548b8 | 0 | public void setTime(int time)
{
this.time = time;
notifyListeners();
} |
4d100c6e-4209-4c40-89c8-369cc7a9c1e0 | 0 | LiteralDecoder()
{
} |
064f6c92-1da7-4ac1-9c26-e2a06c51bdb1 | 7 | public void reHash(){
int nuevaCapacidad=(int) (capacidad+(INCREMENTO*capacidad));
if(esPrimo(nuevaCapacidad)){
capacidad=nuevaCapacidad;
}
else{
boolean bool=false;
int proximoPrimo=0;
for(int i=nuevaCapacidad+1;i<Integer.MAX_VALUE && !bool;i++){
if(esPrimo(i)){
proximoPrimo=i;
bool=t... |
6e901d2e-ee2a-4052-91f4-c06bfab3b34f | 8 | private List<TileButton> getNeighbours(int x, int y) {
List<TileButton> neighbours = new ArrayList<TileButton>();
for(int j = y - 1; j <= y + 1; j++) {
for(int i = x - 1; i <= x + 1; i++) {
if(j == y && i == x) {
continue;
} else if(j < 0 || i < 0 || !(j < this.mineFieldGrid.getHeight())
||... |
9ca935b7-11e1-489d-b0e4-a8f528236dfb | 4 | @Override
public void initStatesList(GameContainer gc) throws SlickException {
input = gc.getInput();
try {
loadedResources = new Loader();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
loadedMapResources = new MapLoader();
} catch (IOException e) {
... |
77450bc9-de98-444f-ba57-0fc4a3eae0b8 | 0 | public static RoundManager getInstance()
{
return instance;
} |
12c59239-64c3-4168-989e-19c9711b931e | 9 | public Gphelper() {
initComponents();
boolean bOk;
String errText = "";
SystemCommand cmd = new SystemCommand();
gpgCommand = "gpg2";
cmd.setCommand(gpgCommand + " --batch --version");
bOk = cmd.run();
if (bOk == false) {
gpgCommand = "gpg";
... |
8a804aa6-2a7e-4932-a80c-8c24d0876ee2 | 5 | DeviceImpl (USB bus, File f, int a)
throws IOException, SecurityException
{
super (null, bus, a);
usb = bus;
path = f.getPath ();
// should only fail if the device unplugged before
// we opened it, or permissions were bogus, or ...
if ((fd = openNative (path)) < 0) {
String message;
message =... |
6fc1f303-b73f-4680-81b6-7ebb744fef5e | 4 | public void onQuit(IRCUserInfo user, String msg) {
String nick = user.getNick();
String username = user.getUsername();
String host = user.getHost();
if (msg.length() > 0)
msg = "("+ msg +")";
String line = "* Quit: "+ nick +" ("+ username +"@"+ host +") quits "+ msg;
int iTabsAmount = main... |
1ab55691-4e2f-41c1-b75d-528ea3ddf0af | 9 | private void setHandles() {
if (handleArc == null)
handleArc = new Polygon();
else handleArc.reset();
float x0 = rect.x + rect.arcwidth * 0.5f;
handleArc.addPoint(Math.round(x0 - 4), Math.round(rect.y - 14));
handleArc.addPoint(Math.round(x0), Math.round(rect.y - 18));
handleArc.addPoint(Math.round(x0 + ... |
adedd46c-21d7-4365-b5aa-a88cfe11ae71 | 3 | protected static void writeUIFile(UIFileTextVO uifile, Path destination) throws IOException {
assert (uifile != null) && (destination != null);
Charset charset = Charset.defaultCharset();
OpenOption[] options = new OpenOption[] { StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenO... |
5c7aa636-fb6a-4eb1-b5fb-d20de58a379f | 2 | @EventHandler
public void GrenadeEvent(ProjectileHitEvent event) { //Grenade
if (event.getEntity().getType() == EntityType.SNOWBALL) {
Snowball sb = (Snowball) event.getEntity();
if (sb.getShooter() instanceof Player) {
// createExplosion(X, Y, Z, Power (F), Fire (tr... |
58cab041-7e85-4d3d-a494-e85804441959 | 1 | public void setTextureCoords(Vector3f[] texs) {
ta = texs[0];
tb = texs[1];
tc = texs[2];
if (this.isQuad()) {
td = texs[3];
}
} |
b6c5bf62-cdda-4670-92d6-5c3ab50dfd02 | 3 | public String toString() {
StringBuffer buf = new StringBuffer("@");
buf.append(getTypeName());
if (members != null) {
buf.append("(");
Iterator mit = members.keySet().iterator();
while (mit.hasNext()) {
String name = (String)mit.next();
... |
caf774ee-c4be-48e6-84a1-0f3749f6b330 | 9 | public Object getAttribute(String name)
throws AttributeNotFoundException, MBeanException,
ReflectionException {
// Validate the input parameters
if (name == null)
throw new RuntimeOperationsException
(new IllegalArgumentException("Attribute name is null")... |
f2347db9-4fa6-48d7-9ece-fd825239b62f | 8 | private void loadDefinition(Buffer stream) {
do {
int attribute = stream.getUnsignedByte();
if (attribute == 0)
return;
else if (attribute == 1) {
rgbColour = stream.get3Bytes();
rgbToHls(rgbColour);
} else if (attribute == 2)
textureId = stream.getUnsignedByte();
else if (attribute == ... |
2d4e68cb-5951-4682-9e09-a79a7168ff46 | 0 | public AbstractController() {
registeredViews = new ArrayList<>();
registeredModels = new ArrayList<>();
} |
0c5ab693-42d0-40bc-8eb0-0760b1c139ea | 1 | public void printLines(int indent, String line) {
if (startPos == -1) {
pw.print(line);
} else {
pw.print(line.substring(0, startPos));
printRegion(indent + startPos, line);
pw.print(line.substring(endPos));
}
} |
94d68924-35e2-4fcc-97a8-63ab57b2f38d | 1 | @Override
public void dragFrame(JComponent f, int newX, int newY) {
//System.out.println("dragFrame");
// Prevent dragging of the frame above the visible area. To the left is ok though.
if (newY < 0) {newY = 0;}
super.dragFrame(f,newX,newY);
updateDesktopSize(false);
} |
1844e3e4-9492-48cc-b3c2-40522bb31da6 | 7 | public String toString() {
if (m_Instances == null) {
return "Naive Bayes (simple): No model built yet.";
}
try {
StringBuffer text = new StringBuffer("Naive Bayes (simple)");
int attIndex;
for (int i = 0; i < m_Instances.numClasses(); i++) {
text.append("\n\nClass " + m_Ins... |
84b4ba8c-aceb-4388-accd-c9dcb61560ad | 5 | public void tick() {
up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
space = keys[KeyEvent.VK_SPACE];
hitbox = keys[KeyEvent.VK_H] && keys[Key... |
1b163dca-3380-430b-bb4b-513989b71f4e | 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 fe... |
1673c5e0-2004-4dba-b113-3b4ca6c89e4e | 0 | public Modele getPlateau2() {
return plateau2;
} |
39b920e7-4653-43b9-becb-d8d6e6642d87 | 4 | public Node Get(int index) {
if (index > length - 1) {
System.out.println("out of bounds");
return null;
} else {
Node node = new Node();
node = head;
if (index == 0)
return node;
for (int i = 1; i <= index; i++) {
node = node.getNext();
if (i == index) {
return node;
}
}
... |
15ee0058-dd71-4bc8-8a6e-9661693756c9 | 9 | static void openFile (File file){
//Opens the file using ImageJ libraries.
Kappa.imageStack = new ImagePlus(file.getPath());
//Splits the image into the R, G, and B channels, but only if the image is in RGB color
if (Kappa.imageStack.getType() == ImagePlus.COLOR_RGB)
Kappa.imageStackLayers = ChannelSplitter... |
e4b6d9b9-8756-4a18-8d18-1cfc42bcefd3 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Aplicativo)) {
return false;
}
Aplicativo other = (Aplicativo) object;
if ((this.codaplicativo == null && other... |
3fe00303-339c-4df2-bba1-7190de57d9a6 | 5 | public void toggleFullscreen( int screen, boolean fullscreen )
{
GraphicsEnvironment ge = GraphicsEnvironment
.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
if( screen > -1 && screen < gs.length )
{
setUndecorated(fullscreen);
... |
938a5fd3-ec73-410c-80c6-bc1ecf2e7bf1 | 0 | public ArrayListStorage() {
internalStorage = new ArrayList<String>();
} |
99cd264b-b64d-4bea-8451-7e3be9a7342b | 1 | @Override
public void use(Player player, Direction direction) throws InvalidActionException {
if (hasPlayersPositionAnActiveLightGrenade(player))
throw new InvalidActionException("The current location already contains an active LightGrenade!");
useItemOnPlayersPosition(player);
activate();
} |
e9839452-5d87-4b07-a2f5-9335770a7056 | 0 | public int getPosition() {
return position;
} |
a3ea55e3-c491-4831-8da5-94422f4779e1 | 0 | @Basic
@Column(name = "FUN_CLAVE")
public Integer getFunClave() {
return funClave;
} |
f0186e77-a892-41c9-a782-b760abf38e12 | 7 | public void readFile(String fileName) throws IOException, NumberFormatException{
FileInputStream in = new FileInputStream(fileName);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
int src,dest,weigh,lc=0;
String line;
String[] strLine;
while(true){
line=br.readLine();
if(line==n... |
0b0cdf56-7e91-4048-aeb3-94313c4923c5 | 4 | public boolean displayGrid(Grid grid) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: displayGrid() BEGIN");
}
getDrawing().setGrid(grid, m_gameControl);
if (test || m_test) {
System.out.println("GameWindow :: displayGrid() END");
}
retur... |
8e2b4b7f-4d40-4176-a87e-633057d4afa5 | 9 | private void setupMatrix()
{
int cost = -1;
int del, sub, ins;
matrix = new int[compOne.length()+1][compTwo.length()+1];
for (int i = 0; i <= compOne.length(); i++)
{
matrix[i][0] = i;
}
for (int i = 0; i <= compTwo.length(); i++)
{
matrix[0][i] = i;
}
for (int i = 1; i <= compOne.length(); i++)
{
fo... |
301e6c9e-1313-40e5-93e3-56f3029c3187 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... |
85e8a06f-1d67-4972-b9fb-f8bba2d7dd1a | 2 | public static int convertObjectToInt(Object value) {
if (value != null) {
if (value instanceof Integer) {
return ((Integer) value).intValue();
} else {
return Integer.valueOf(value.toString()).intValue();
}
} else {
throw new NullPointerException("Property value was null so it couldn't be conver... |
f250e7c8-a29e-477f-b8dd-505bf1f59fc7 | 6 | private static void recoverExplosionEvent(EntityExplodeEvent event) {
final int HealDelay = Main.getInstance().getConfig().getInt("variable.HealDelay");
final int FullHealTime = Main.getInstance().getConfig().getInt("variable.FullHealTime");
final boolean AllowTNTChainReaction = Main.getInstance... |
d4099ca8-36d3-49dd-8102-8f8eff558a59 | 5 | public boolean prefixFreeAux(Node node,boolean checked){
boolean check=false;
boolean end=false;
if (node==null) return true;
if (!node.name.isEmpty()) { //Eliminate root node.
check=node.isUsed();
if (check && checked) {
return false; //Non prefix Free.
}
else {
checked=check|check... |
f545b450-b1b5-410d-8af4-442329a166df | 3 | @Override
public List<Loja> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Loja> lojas = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYNO... |
a2530449-a828-461a-884d-0394ac0a99d1 | 1 | private Node getNodeAt(int givenPosition){
Node currentNode=firstNode;
for(int count=1;count<givenPosition;count++){
currentNode=currentNode.getNext();
}
return currentNode;
} |
4548050d-45d2-4ae0-bcde-8e22a965c937 | 7 | private static boolean levenshteinDelOK(String a, String b, int aOffset, int bOffset, int max, int delA, int delB)
{
if (aOffset < 0) return (bOffset - delB <= max - delA);
if (bOffset < 0) return (aOffset - delA <= max - delB);
if (a.charAt(aOffset) == b.charAt(bOffset))
return levenshteinDelOK(a, b, aOffset... |
ea276677-d710-4b9a-9cb2-3049f006cea4 | 3 | private void setPermissions(PermissionAttachment attachment, Map<String, Boolean> permissions) {
try {
Field p = PermissionAttachment.class.getDeclaredField("permissions");
p.setAccessible(true);
@SuppressWarnings("unchecked")
Map<String, Boolean> map = (Map<Strin... |
1da75a9e-0c1e-4bf0-b8a1-9058ddb2c24d | 5 | public void setCampus(Campus campus) {
if (campus != this.campus) {
Campus vorigeCampus = this.campus;
this.campus = campus;
if (vorigeCampus != null && vorigeCampus.getManager() == this) {
vorigeCampus.setManager(null);
}
if (campus != null && campus.getManager() != this) {
campus.setManager(t... |
1295ece5-1ddf-49cc-804a-45c7362f4e04 | 9 | float[][] getCameraVectorsNormal(int resX, int resY){ //returns resX*resY nprmalized camera vectors
float vectors[][]=new float[resX*resY][3];//first vector index, second the components of the vector
float[] vect2=rotateYVector(dir);
vect2[1]=0;
vect2=normalize(vect2);
float[] ve... |
ecf94c56-dc60-474c-bc0c-0a5b1abde55e | 2 | @Override
public boolean onKeyDown(int key) {
if(key == Keyboard.KEY_C || key == Keyboard.KEY_ESCAPE) {
Application.get().getHumanView().popScreen();
return true;
}
return true;
} |
b4af7b17-49eb-4922-a3a9-9847fc055dbb | 8 | private boolean readFeed()
{
try
{
// Set header values intial to the empty string
String title = "";
String link = "";
// First create a new XMLInputFactory
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
// Setup... |
dff0b6dd-38e2-40ae-97f0-5185318f54cc | 6 | @Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
switch( keyCode ) {
case KeyEvent.VK_UP:
keyUp = true;
break;
case KeyEvent.VK_DOWN:
keyDown = true;
break;
case KeyEvent.V... |
b1304be3-716c-48ee-aa01-5ab19ffb40fa | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
2e04c5be-0524-495e-96f9-4799327c3c7f | 9 | public boolean scrubFile() {
try {
this.outputFile = new File(outputFileName);
this.inputReader = new BufferedReader(new FileReader(this.path + inputFileName));
this.outputWritter = new BufferedWriter(new FileWriter(this.path + outputFile));
while (this.inputReader.ready()) {
String sLine = th... |
846c3f1b-0cf0-416f-b885-45b8fcf3165b | 2 | private int getMinIndex() {
int minIdx = 0;
for (int i = 0; i < size(); i++) {
if (comparator.compare(queue.get(i).getKey(), queue.get(minIdx)
.getKey()) < 0) {
minIdx = i;
}
}
return minIdx;
} |
3cb59a7c-0dec-4596-8e64-40e0d9dcd74a | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Author other = (Author) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fa... |
6da647d9-24d6-4463-b96d-68d366dcd434 | 8 | void recursiveSort(boolean sortLeaves) {
if (isLeaf && !sortLeaves)
return;
boolean change = false;
// Use modified bubble sort for almost-sorted lists.
do {
change = false;
for (int i = 0; i < contents.size() - 1; i++)
change |= swap(i);
if (!change)
break;
change = false;
for (int i ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.