method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9b05d0c7-5415-4585-af6b-c7ebe385a8d7 | 4 | @Override
public boolean equals(final Object item)
{
if (this == item)
{
return true;
}
if (!(item instanceof Item))
{
return false;
}
final Item that = (Item) item;
/* @formatter:off */
return this.name == that.getName() ||
(null != this.name && this.na... |
5ee45366-bfda-4aff-b587-280a1a0e572c | 8 | public ConsultaPerfil() {
initComponents();
CargarComboBox();
web.setVisible(false);
panel.setVisible(false);
// setLocationRelativeTo(null);
//super combo box
c_perfiles.getEditor().getEditorComponent().addKeyListener... |
45471993-d47a-46c0-be73-2b0d4ae636f0 | 9 | final boolean method793(int i) {
anInt1403++;
if (((NpcDefinition) this).anIntArray1377 == null) {
if ((((NpcDefinition) this).anInt1343 ^ 0xffffffff) == 0
&& (((NpcDefinition) this).anInt1364 ^ 0xffffffff) == 0
&& ((NpcDefinition) this).anInt1327 == -1)
return false;
return true;
}
for (int i_0_ = ... |
9934d7e0-bb7e-47ff-aec7-cec3e962dc4b | 3 | public void paivitaTuote(Tuote t) throws DAOPoikkeus{
Connection yhteys = avaaYhteys();
String muokkaaPizzaQuery = "UPDATE Tuote SET nimi=?, numero=?, hinta=?, aktiivinen=?,tuoteryhmaID=? WHERE TuoteID = ?";
String poistaTayte ="DELETE FROM TuotteenTayte WHERE tuoteID=?";
String lisaaTaytteet = "INSERT IN... |
f9d462dc-38cd-4c20-a70a-855a53301191 | 3 | private void closeConnection() {
logger.finer("Closing server connection");
synchronized(CONNECTION_LOCK) {
if(receivePacketThread != null)
receivePacketThread.stopReceiving();
if(timeoutThread != null)
timeoutThread.stopCheckingForTimeouts();
if(socket != null)
socket.close();
resetParamete... |
ad1d7e7b-84b9-4f0c-a293-0a93953cbfa2 | 0 | public void addChunk(Chunk C)
{
chunksLock.writeLock().lock();
try {
chunks.add(C);
} finally {
chunksLock.writeLock().unlock();
}
} |
c51f58db-8fd5-4229-a88f-fe9bc310a39f | 8 | static protected boolean isWhiteSpace(char ch) {
return (ch == ct || ch == lf || ch == tb ||
ch == fd || ch == cr || ch == nl ||
ch == zs || ch == zl || ch == zp);
} |
f27a0631-e987-40af-a3c6-ecf56ce51f22 | 2 | protected String makeResponseToken(WebSocketRequest requestInfo, byte[] token)throws NoSuchAlgorithmException {
MessageDigest md5digest = MessageDigest.getInstance("MD5");
for(Integer i = 0; i < 2; ++i){
byte[] asByte = new byte[4];
long key = (i == 0) ? requestInfo.getKey1().intValue() : requestInfo.getKey2(... |
c93b73a2-68cf-4aca-9bfd-4727185be22b | 2 | public int getTotalNum() {
int num = 0;
for(ParkBoy boy : this.parkBoyList) {
num += boy.getTotalNum();
}
if(this.park != null) {
num += this.park.getTotalNum();
}
return num;
} |
e9b1c696-d09b-4b75-9197-453592a8c609 | 3 | public String findVappLink(String apiUrl, String vAppName) throws Exception {
String response = doGet(apiUrl + Utils.VAPPS_QUERY_SUFFIX);
Document doc = RestClient.stringToXmlDocument(response);
NodeList list = doc.getElementsByTagName(Constants.VAPP_RECORD);
String element = new String();
for(int i=0; i ... |
ca35d11a-2e62-4d8f-a123-3c5a61eecc8f | 2 | private boolean toBoolean(final Properties azotProperties, final String key, final boolean defaultValue) {
boolean flag = defaultValue;
if (azotProperties.getProperty(key) != null) {
try {
flag = Boolean.parseBoolean(azotProperties.getProperty(key));
} catch (Exception e) {
e.printStackTrace();
}
... |
5e209623-6557-4c9a-902d-72dae9a82bf4 | 6 | public int[] canMove() {
int[] movable = new int[] { 0, 0, 0, 0 };
if (this.nodesState[0] > dimension
&& this.nodesState[0] <= dimension * dimension)
movable[0] = 1; // 空白格可向上移
if (this.nodesState[0] >= 1
&& this.nodesState[0] <= dimension * (dimension - 1))
movable[1] = 1; // 空白格可向下移
if (this.nod... |
33c19e44-c1b8-4f83-899b-0e4761ee9987 | 1 | public Member merge(Member detachedInstance) {
log.debug("merging Member instance");
try {
Member result = (Member) getSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
} |
5989dcad-3dab-4ca3-8027-07cd52545898 | 9 | @Override
public void mutateStackForInfixTranslation(Stack<Token> operatorStack, StringBuilder output) {
Token before;
while (!operatorStack.isEmpty() && (before = operatorStack.peek()) != null && (before instanceof OperatorToken || before instanceof FunctionToken)) {
if (before instanceof FunctionToken) {
... |
f6b63272-6b6f-4b75-ad7d-ccb00d56564f | 6 | private static Object getNextMatchPosRegExImpl(String regEx,
CharSequence searchIn, boolean goForward,
boolean matchCase, boolean wholeWord,
String replaceStr) {
if (wholeWord) {
regEx = "\\b" + regEx + "\\b";
}
// Make a pattern that takes into account whether or not to match case.
in... |
5fe24843-7909-4c29-9a3c-de01e5a66423 | 4 | private List<Node> closestNodesNotFailed(String status)
{
List<Node> closestNodes = new ArrayList<>(this.config.k());
int remainingSpaces = this.config.k();
for (Map.Entry<Node, String> e : this.nodes.entrySet())
{
if (!FAILED.equals(e.getValue()))
{
... |
0b168b84-3885-454c-8aa1-ee3e1a5df1d3 | 0 | @BeforeClass
public static void setUpClass() {
} |
f5658d1b-d39a-420a-9c40-6a6cabb401fc | 0 | public void add(Item item) {
Node<Item> oldfirst = first;
first = new Node<Item>();
first.item = item;
first.next = oldfirst;
N++;
} |
5894a06e-5d93-4eb2-829a-8fde51ba4043 | 5 | public String toString() {
E el;
// Search for maximum element length
// int maxlen = 0;
// int ellen;
//
// for (int i = 0; i < array.getSize(); i++) {
// el = array.getElement(i);
// if (el != null) {
// ellen = el.toString().length();... |
f375f529-0c46-4bf4-b69b-ca31f793fc5b | 7 | static void testConnection(String url, String query, int maxconn) {
if (url == null || url.length() == 0 || query == null
|| query.length() == 0 || maxconn <= 0) {
testError();
}
SimpleConnectionPool pool = null;
Connection con = null;
try {
pool = SimpleConnectionPool.getInstance(maxconn);
log.i... |
36803e2f-6617-4a0b-ac6a-e58e5d89ab85 | 7 | public void mouseReleased(MouseEvent evt) {
//Fill in pixels in between and connect the first to the last
int N = selectionBorder.size();
if (N == 0 || (state != SELECTING && state != DRAGGING))
return;
if (state == SELECTING) {
for (int n = 0; n < N; n++) {
int startx = selectionBorder.get(n).x... |
99dee289-8ca1-40a7-88ba-a4c32a783ef0 | 2 | private static void initializeLogger() {
try {
FileHandler fh = new FileHandler(client.Main.class.getName()
+ ".log");
fh.setFormatter(new SimpleFormatter());
log.addHandler(fh);
} catch (SecurityException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) ... |
9047b8a0-3f72-414b-bb46-7f04ec17f70e | 8 | public void action() {
ACLMessage msg = receive(MessageTemplate.MatchSender(controller));
if (msg == null) { block(); return; }
if (msg.getPerformative() == ACLMessage.REQUEST){
try {
ContentElement content = getContentManager().extractContent(msg);
Concept concept = ((Acti... |
d09c08ec-cf09-4576-835b-67f52ba81d90 | 5 | public void loadFile(String filename){
String path = "data/" + filename;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(path), "Shift_JIS"));
String line;
while ((line = br.readLine()) != null) {
... |
f753a3dd-1a9f-4a7c-aa24-d5e348ded5b2 | 7 | @Override
public void run() {
for(;;) {
// Se o socke esta fechado então terminar Thread.
if(socket.isClosed()) return;
try {
mensagemRecebida = (Mensagem) entrada.readObject();
switch(mensagemRecebida.getTipoMensagem()) {
... |
0b7801a1-8778-4af8-806e-da693e8a5adb | 6 | private void unmountFoldersOnLinux() {
if (!getType().equalsIgnoreCase("smb")
&& !getType().equalsIgnoreCase("nfs")) {
// TODO: find better way to throw errors without needing to add
// throw declarations everywhere.
throw new RuntimeException("Nope, invalid mount type " + getType()
+ " on server ["... |
24441d9f-a712-4bc6-b3ff-d269ee67ce10 | 3 | @Override
public void deserialize(Buffer buf) {
senderName = buf.readString();
content = buf.readString();
timestamp = buf.readInt();
if (timestamp < 0)
throw new RuntimeException("Forbidden value on timestamp = " + timestamp + ", it doesn't respect the following conditio... |
2fcef0fd-8270-45cd-b7c6-cd25fe8a1f0b | 7 | public void pushSelection(Selectable s, boolean asRoot) {
if (asRoot) navStack.clear() ;
if (s != null) {
selected = s ;
if (s.subject().inWorld()) UI.camera.lockOn(s.subject()) ;
final InfoPanel panel = s.createPanel(UI) ;
final int SI = navStack.indexOf(selected) ;
Se... |
9034fb07-5c7f-49ba-af23-17418ec9c0e9 | 8 | public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption("mean-prec", options);
if (tmpStr.length() > 0)
setMeanPrec(Integer.parseInt(tmpStr));
else
setMeanPrec(getDefaultMeanPrec());
tmpStr = Utils.getOption("stddev-prec", options);
... |
ed223835-2972-4b44-bda0-8206fabde8ea | 9 | final void method401(int i, int j, int k, int l, int i1) {
if (composite == null) {
return;
}
if (!super.aBoolean2894) {
Animation animation = super.animation != -1 && super.animationDelay == 0 ? Class66.animationForID(super.animation) : null;
Animation animat... |
813a5d78-36d5-4026-b1f5-1dfa2f6e033d | 2 | private StdImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, Hashtable<?, ?> properties) {
super(cm, raster, isRasterPremultiplied, properties);
clear();
} |
a42db717-b2cc-4b0c-8e3d-95a8b3430033 | 6 | @EventHandler
public void BlazeJump(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.getBlazeConfig().getDouble("Blaze.Jump.DodgeCha... |
8abe8ff3-8250-4077-84d2-7cce6b7df5d6 | 1 | public void deleteMarker(int index)
{
for(int i=index;i<markers-1;i++)
{
marker[i]=marker[i+1];
}
marker[markers-1]=null;
markers--;
} |
5cba5251-7a58-48e1-9fa7-4c143e8cbc60 | 9 | public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
if(root == null){
return result;
}
List<Integer> first = new ArrayList<Integer>();
first.add(root.val);
result.add(first);
Linked... |
765fa876-1794-44c5-ba9d-e95a283c9593 | 2 | static void printList(final PrintWriter pw, final List l) {
for (int i = 0; i < l.size(); ++i) {
Object o = l.get(i);
if (o instanceof List) {
printList(pw, (List) o);
} else {
pw.print(o.toString());
}
}
} |
3993bdf3-3cce-4919-a85b-b3c7f4f92053 | 2 | public boolean gayp() {
if (gay == -1)
gay = detectgay() ? 1 : 0;
return (gay == 1);
} |
5fda8935-3dca-4dd7-8920-08d80264672d | 0 | public String getId() {
return id;
} |
fa695519-a34a-4bcc-980f-380df88f60fc | 4 | @Override
public boolean setChartOption( String op, String val )
{
boolean bHandled = false;
if( op.equalsIgnoreCase( "SmoothedLine" ) )
{
fSmoothedLine = val.equals( "true" );
bHandled = true;
}
else if( op.equalsIgnoreCase( "ThreeDBubbles" ) )
{
f3dBubbles = val.equals( "true" );
bHandled = ... |
b35bf6b2-016e-4e37-9fc6-af65825e3c94 | 7 | public static Rule_dirSubannotation parse(ParserContext context)
{
context.push("dirSubannotation");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList... |
a6cdbc9f-f2a7-4d3d-941d-012650f24ae5 | 5 | public void contextDestroyed(ServletContextEvent sce) {
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
Object[] params = new Object[1];
params[0] = tccl;
// Walk up the tree of classloaders, finding all the available
// LogFactory classes and releasing any o... |
924964ef-ed90-48db-b25f-7731b97ca362 | 7 | public void arrayMakeRequirements() {
String temp;
int areaHours=0;
for (int i = 0; i < arrayCourseRefined.size(); i++) {
RequirementsStruct maker = new RequirementsStruct();
maker.requirementName = parse17(arrayCourseRefined.get(i).get(0), i);
maker.ID = i;
... |
cc555c76-bab2-4ea9-8871-e79a3463f0df | 9 | public void test_loop() {
// loop round at least one 400 year cycle, including before 1970
LocalDate date = LocalDate.of(1960, 1, 5); // Tuseday of week 1 1960
int year = 1960;
int wby = 1960;
int weekLen = 52;
int week = 1;
while (date.getYear() < 2400) {
DayOfWeek loopDow = date.get... |
9dc697ad-a236-4ffb-8bba-12add06a5729 | 4 | public void implementFather() {
if(parents.size() == 0)
return;
else {
for(int i = 0; i < parents.size(); ++i) {
if(parents.get(i) != null)
parents.get(i).implementFather();
}
for(int i = 0; i < parents.size(); ++i)
attributes.addAll(parents.get(i).attributes);
}
} |
51323a69-6cbb-4356-9268-cf0fba3dc2d8 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost, msg))
return false;
if((msg.tool()==this)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.value()>0)
&&(msg.target() !=null)
&&(msg.target() instanceof MOB)
&&(weaponClassification()==Weapon.C... |
5eca334b-18ff-4170-a6eb-7e70da1b3f95 | 5 | public static AbstractForme creerForme(String chaineForme) {
DecodeurChaineForme decodeur = new DecodeurChaineForme(chaineForme);
IDLogger enregistreur = IDLogger.getInstance();
AbstractForme forme = null;
switch(decodeur.getTypeForme()) {
case CHAINE_CARRE :
forme = new Carre(decodeur.getNumeroSequen... |
36f8c0df-8973-4348-9a24-1585038460d6 | 6 | @Override
public void init(int l, int h) {
if(!(l%2 == 1 && h%2 == 1))
throw new PreConditionError("l and h must be odd");
if(!(l>0 && h>0))
throw new PreConditionError("l and h must be positive");
super.init(l,h);
if(!(super.getNombreColonnes()==l))
throw new PostConditionError("getNombreColonnes(ini... |
426c8d18-b8dc-48de-afab-c22f5f1ababa | 7 | public void setupWindow(JComponent component)
{
frame = new JFrame();
frame.add(component);
//frame.setUndecorated(slateSettings.getUndecorated());
frame.setUndecorated(true);
frame.setResizable(false);
// Shift to external display
//if (slateSettings.getExternalDisplay())
//{
//Dimension screen... |
289da2b7-87b3-416e-9ffc-3e03d7beb79a | 6 | public void Process(int id){
switch(id){
case 1003:InsertDelayedOperationList(3);
break;
case 1004:InsertDelayedOperationList(4);
break;
case 1005:InsertDelayedOperationList(5);
break;
case 1006:InsertDelayedOperationList(6);
break;
case 1007:InsertDelayedOperationList(7);
break;
... |
1d3b963c-a1d0-41ac-92be-edaf5a4827fa | 2 | public static void addItemTester(Item item){
if(item != null){
if(ItemStorageInventory.create().addItem(item)){
System.out.println("add "+ item.toString() + " successfully\n");
}else{
System.out.println("add "+ item.toString() + " failed\n");
}
}else
System.out.println("add item " + " faile... |
e4142c8d-e1ee-4ada-8e55-2617afe10daf | 1 | public String readString(String tag){
String s = "";
if(!data.containsKey(tag)){
System.out.println("The tag "+ tag + " did not exist.");
return s;
}
s = (String)data.get(tag);
return s;
} |
122aa418-ac1b-477a-84ac-b61b588df168 | 0 | @Override
public SkillsMain[] getSkillNames() {
return Constants.paladinSkillSkills;
} |
e59ae5ac-e5f3-469b-a226-30604d23c722 | 9 | public boolean next() throws IOException {
if (ia == null) {
return false;
}
try {
long crcValue = ia.readLong("crcvalue");
System.out.println("crcvalue: "+crcValue);
byte[] bytes = readTxnBytes(ia);
... |
05a64a82-d97c-4408-8383-b4fdf678e3c1 | 1 | @Test
public void testFindNodes() throws Exception
{
NodeList nodes = _xpath.findNodes("//p");
Assert.assertEquals(2, nodes.getLength());
for(int i=0; i<nodes.getLength(); i++)
{
Assert.assertEquals("p", nodes.item(i).getNodeName());
}
} |
37f11724-d6d2-4057-b9c3-66bbfc77f3c9 | 5 | private static void parseJstatMetrics(String wholeJstatText, Task task) {
String[] lines = wholeJstatText.split("\\n");
if(lines.length < 5)
return;
String dateStrSec;
if(!lines[0].trim().startsWith("NGCMN"))
return;
String[] gccapacity = lines[1].trim().split("\\s+");
if(gccapacity.length != ... |
b6f896e0-76a3-4837-a683-32b77b0df889 | 6 | public boolean take(int slot,int amount,String title){
//如果能成功拿走就返回true 否则返回false
//这个位置的物品的名字 如果不包含title 那么也会返回false
ItemStack item = inv.getItem(slot);
if((item==null)||(item.getType()==Material.AIR))return false;
if(!item.getItemMeta().hasDisplayName()) return false;
i... |
581dfb12-70c4-461c-a030-1c9f11885d2e | 9 | public void update() {
time++;
// if time % 60 == 0 / = 1 second
if (time % (random.nextInt(50) + 60) == 0) {
xa = (random.nextInt(3) - 1) * speed; // speed=5 => -1, 0, 1 ;
// speed=0.5 => -0.5, 0, 0.5
ya = (random.nextInt(3) - 1) * speed;
if (random.nextInt(4) == 0) {
xa = 0;
ya = 0... |
ba3aaa3a-8d2c-4863-a0c4-5645dd783ffe | 9 | static String getQuadrant(String v, String h) {
int hor = Integer.valueOf(h);
int vert = 1;
if (v.equals("a")){
vert = 1;
}
else if (v.equals("b"))
vert = 2;
if (v.equals("c"))
vert = 3;
if (v.equals("d"))
vert = 4;
if (v.equals("e"))
vert = 5;
if (v.equals("f"))
vert = 6;
if (v.e... |
da5eac4a-9afe-4b0f-a1f2-6b78ffca24f7 | 4 | public void itemGiver(Chest chest) {
chest.getInventory().clear();
Inventory inv = chest.getInventory();
List<String> items = this.pl.getConfig().getStringList("configurations." + this.pl.ChosenConfiguration + ".items");
for (String item : items){
ItemStack newItem = parseItem(item);
if (newItem != null)... |
12e73aca-1a4a-4d56-932c-a7c523859195 | 1 | public void createPlaylist(BEPlaylist aPlaylist) throws Exception {
try {
ds.createPlaylist(aPlaylist);
} catch (SQLException ex) {
throw new Exception("Could not create playlist" + aPlaylist.getName());
}
} |
df1956c7-8190-4d05-8719-a20025cf7606 | 2 | public KingedChecker(int team){
super(team);
if(team == 1) {
setImage(new GreenfootImage("Crowned-Mario.png"));
} else if(team == 2) {
setImage(new GreenfootImage("Crowned-Wario.png"));
}
} |
1e999d2a-30bb-4fa4-8885-69ef7a1ffb89 | 3 | public void selectNext() {
selectedIndex++;
if(selectedItem != null)
selectedItem.deselect();
if(selectedIndex >= listItems.size()) {
boolean selectionRolloverHandled = handleSelectionRollover(SelectionRolloverDirection.Bottom);
if(selectionRolloverHandled)
return;
else
selectedIndex = 0;
... |
9881c9ca-b3af-4489-b0e1-d6e4b5b852f0 | 4 | public void randomize() {
try {
if (sql.getConnection() == null) {
sql.connect();
}
sql.getVals();
// mathGame.sql.close();
} catch (Exception e) {
System.out.println("Get vals from DB failed");
e.printStackTrace();
}
System.out.println("\n\n\n\n*******GAMETYPE=="+gameType+"**********\n... |
efb98bba-c766-4099-9d0e-2c9f025859c1 | 6 | public void render(Graphics g){
g.setColor(Color.BLACK);
g.setFont(JudokaComponent.bigFont);
JudokaComponent.drawTextBox(75, 50, 500, 35, g);
JudokaComponent.drawTextBox(75, 150, 500, 35, g);
g.drawString("Player1 Character Name", 80, 40);
g.drawString("Player2 Character Name", 80, 140);
g.setColor(new Co... |
45422110-09b7-4a52-abad-39e48d6d74f5 | 0 | default void isNull(String str) {
System.out.println("Interface Null Check");
} |
4352c645-7fff-447f-8383-cb3fafed31f1 | 6 | public boolean gameCouldFinish() {
boolean allNullWord = true;
boolean weAreAlone = true;
for (Player p : playersList) {
if (p.isActive() && !p.isLastResponseWrong) allNullWord = false;
if (p.isActive() && p != localPlayer) weAreAlone = false;
}
return allNullWord || weAreAlone;
} |
7a6b7ead-e224-4df2-b3e7-fcf185a63bbd | 7 | public String longestPalindrome(String s) {
boolean[][] table = new boolean[s.length()][s.length()];
int max = 1;
int index = 0;
for (int i = 0; i < s.length(); i++) {
table[i][i] = true;
}
for (int i = 0; i < s.length() - 1; i++) {
if (s.charAt(i) == s.charAt(i + 1)) {
table[i][i + 1] = true;
... |
94eb931c-85e3-40f4-9efb-91536da23a52 | 1 | public String getString(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof String) {
return (String) object;
}
throw new JSONException("JSONArray[" + index + "] not a string.");
} |
f96b9958-f9ea-4a22-8ede-44c65c8c9e1f | 5 | public WarriorsJourneyServer()
{
log.log(Level.FINE,"=== Warriors Journey Server Loading... ===");
config = new Config();
clientThreads = new WarriorsJourneyClient[Config.MAX_CONNECTIONS];
log.log(Level.FINE,"=== Loading Handlers ===");
mysqlData = new MysqlHandler();
log.log(Level... |
7d294a53-5937-4e9f-be68-d31074e4cde2 | 3 | static Throwable getThrowableCandidate(Object[] argArray) {
if (argArray == null || argArray.length == 0) {
return null;
}
final Object lastEntry = argArray[argArray.length - 1];
if (lastEntry instanceof Throwable) {
return (Throwable) lastEntry;
}
... |
50dab67b-7856-4a4e-8183-7aaf4a74e298 | 6 | protected FSDirectory(File path, LockFactory lockFactory) throws IOException {
path = getCanonicalPath(path);
// new ctors use always NativeFSLockFactory as default:
if (lockFactory == null) {
lockFactory = new NativeFSLockFactory();
}
directory = path;
if (directory.exists() && !director... |
d10aadaa-34b4-4d38-bc8b-08013dc20df7 | 4 | public static java.awt.Color getColorForPlayer(Player p) {
switch ( p ) {
case RED : return java.awt.Color.RED;
case BLUE : return java.awt.Color.CYAN;
case YELLOW : return java.awt.Color.YELLOW;
case GREEN : return java.awt.Color.GREEN;
}
return java.awt.Color.WHITE;
} |
374044e6-7ec0-46f4-b7ba-2eded389d554 | 2 | public int price(PointT finish) {
if (this.x == finish.x || this.y == finish.y) {
return 10;
} else {
return 14;
}
} |
218c3717-1f6d-43fd-863f-5264c8a250a0 | 3 | private void setLoggingLevel() {
final String name = Main.configurationFile.getConfig().getString("logLevel", "INFO");
Level level = MessageLevel.parse(name);
if (level == null) level = Level.INFO;
// Only set the parent handler lower if necessary, otherwise leave it alone for other con... |
0403b5c9-e6ab-48b6-9f13-4ec42116bf1a | 5 | private void searchMCVersions()
{
File file = new File(mineord, "versions");
if (file.exists())
{
File[] li = file.listFiles();
for (int i=0; i<li.length; i++)
{
File jarfile = new File(li[i], li[i].getName()+".jar");
File jsonfile = new File(li[i], li[i].getName()+".json");
if(jarfile.ex... |
0ade70a3-1707-444d-8afa-ae22fa1c76d0 | 4 | @Override
public boolean equals(Object o) {
if (!(o instanceof MoveAction)) { return false; }
MoveAction other = (MoveAction)o;
return (other.model == this.model) &&
(other.start.equals(start)) &&
(other.actor.equals(actor)) &&
(other.end.equals(end));
} |
8426d8df-e75d-4038-92b4-add887afd5bd | 1 | public static OptionsDialog getInstance()
{
if (instance==null)
{
instance=new OptionsDialog();
}
return instance;
} |
40ee28c3-5c38-4059-8826-cf13e11ab0d9 | 7 | private BufferedImage HorizontalFiltering(BufferedImage bufImage, int iOutW) {
int dwInW = bufImage.getWidth();
int dwInH = bufImage.getHeight();
int value = 0;
BufferedImage pbOut = new BufferedImage(iOutW, dwInH,
BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < ... |
bc44f525-60d0-4c3b-965a-0db47893c7e7 | 5 | private static boolean isDelimiter(char c){
return c == ' ' || c == '\t' ||
c == '\n' || c == '\r' ||
c == '{' || c == '}';
} |
a10c3517-bc5c-4ec4-a67a-e4d7072c02c9 | 5 | public static void main(String[] args) {
int a[] = new int[101];
int i = 0;
int j = 0;
for (i = 1; i < 101; i++) {
a[i] = 1;
}
for (i = 2; i < 101; i++) {
if (a[i] != 0) {
for (j = i + i; j < 101; j++) {
System.out.println(i+"---"+j);
if (j % i == 0) {
a[j] = 0;
j = j +... |
68b582b1-5a1d-4743-a09b-ffe7f82cdfb7 | 6 | public void merge(int A[], int m, int B[], int n) {
int a = n;
int b = 0;
int c = 0;
for (int i = m; i > 0; i--) {
A[i + n - 1] = A[i - 1];
}
while (a < m + n && b < n) {
if (A[a] < B[b]) {
A[c] = A[a];
a++;
} else {
A[c] = B[b];
b++;
}
c++;
}
while (c < m + n) {
if ... |
7f86fdac-f388-4cb6-b926-21b1ad5e7802 | 0 | public static void intro() {
GUI.log("Welcome to Corlanthia. To start, simply type a command into the input box below. For a list of available " +
"commands, type \"help\".\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +
"\n\n" +
"You wake up in a daze, there is a lump on your head and y... |
b2c5a267-ed30-422f-a8d0-9919e5fdf020 | 0 | public double getDiag(){
return diag=Math.sqrt(this.getHig()*this.getHig())+Math.sqrt(rad*rad);
} |
89a5e4bd-3125-4bc4-a29e-a65aeb536c71 | 4 | public Path getRevisionInfo(long timestamp)
{
// Get the revision in question
DbConnection db = DbConnection.getInstance();
RevisionInfo revision = db.getSpecificRevision(file, timestamp);
Path pathToTempFile = null;
PrintWriter output = null;
// Figure out the extension. However, we only add the period (... |
82f0a4d8-92c0-4552-8af5-f2a905ea0543 | 7 | public void setForecast(Iterator<Element>tempit,WeatherInfo tempweather){
Element tempelementRoot,tempElement;
/**tempit2: 每一个weather块<br>tempit3:day块和night块*/
Iterator<Element>tempit2,tempit3;
String temp;
int i=0,j;
while(tempit.hasNext()){
tempelementRoot=(Element)tempit.next();
tempit2=tempelement... |
434ccc56-6003-4dfd-a8a0-ab80c7c69a5e | 3 | public ResultMap singleSelect(final String sql){
ResultMap result = new ResultMap();
Statement stmt;
try {
stmt = this.connetion.createStatement();
ResultSet rs = stmt.executeQuery(sql);
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
while (rs.next()) {
... |
2ec56f15-2dbe-4114-be93-829a6ea917e1 | 1 | public static void main(String[] args) {
try {
JConecta dialog = new JConecta();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
} |
ad6669c3-6461-41fa-8bee-307010b48327 | 3 | private void filter () {
displayedElements.clear();
if (filter != null)
for (int i = 0; i < source.getSize(); i++)
if (filter.accept (source.getElementAt (i)))
displayedElements.add (i);
fireContentsChanged (this, 0, getSize() - 1);
} |
47a22d8e-103f-431c-95ed-ded5be9cb10c | 9 | public static List<HueBridge> searchUPnP(int timeout, BridgeDiscoveryCallback callback) throws IOException {
// Send out SSDP discovery broadcast
String ssdpBroadcast = "M-SEARCH * HTTP/1.1\nHOST: 239.255.255.250:1900\nMAN: ssdp:discover\nMX: 8\nST:SsdpSearch:all";
DatagramSocket upnpSock = new DatagramSocket();
... |
245d249b-1298-490f-b432-65f7628ea1ed | 6 | public void procBtnRAZ() {
int compsSize = m_enregistreurDeComp.getCompetences().size();
if (!optEmploi.isSelected()
|| cmbReg.getSelectedIndex() != 0
|| jckbprox.isSelected()
|| !"0".equals(txtSalesp.getText())
|| cmbComp.getSelectedIndex(... |
2e4db602-0153-4c60-b5bc-8d69e7b8930b | 9 | private double getPreFlopDiscardOdds(int holeCardA, int holeCardB, int discardCard) throws IOException {
long wins = 0;
long gameCount = 0;
int[] cardsToRemove = {holeCardA, holeCardB, discardCard};
Integer[] newCards = getNewCards(cardsToRemove, ints);
int[] newCardsArray = new int[49];
for (int z = 0; ... |
c9cb7440-c4ad-4faa-b2a8-5060f2ad2f31 | 8 | private boolean r_perfective_gerund() {
int among_var;
int v_1;
// (, line 71
// [, line 72
ket = cursor;
// substring, line 72
among_var = find_among_b(a_0, 9);
if (among_var ... |
768c4023-392e-410f-9471-9303f8f721f8 | 4 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
assert rowIndex >= 0 && rowIndex < this.files.length;
IFile file = this.files[rowIndex];
switch (columnIndex) {
case 0:
return file.getName();
case 1:
return file.siz... |
ae4ab7b1-2e18-43b3-a7ac-1998fef1b777 | 3 | public void kasvataKulmaa(){
if (liikkuuko){
kulma = kulma + KULMAN_KASVATUS_VAKIO;
//pidä kulma nollan ja kaksipiin välillä
if (kulma > 2*Math.PI){
kulma -= 2*Math.PI;
} else if (kulma < 0) {
kulma += 2*Math.PI;
}
... |
4fd01f7f-1b25-4092-88b4-9dc4cb42c53f | 9 | boolean test (Instantiation inst)
{
if (prefix == '!')
{
if (model.getProcedural().whyNotTrace)
model.output (toStringFirstLine (null));
Vector<String> tokens = new Vector<String>();
for (int i=0 ; i<specials.size() ; i++)
{
String special = specials.elementAt(i);
if (Symbol.get(special).is... |
2fe2abf5-fbfd-4760-93ff-ed380061fb2e | 8 | public void renderMob(int xp, int yp, int dir, Sprite sprite){
for(int y = 0; y < sprite.size; y++){
int ya = y + yp;
int ys = y;
for(int x = 0; x < sprite.size; x++){
int xa = x + xp;
int xs = x;
if(xa < 0 || xa >= width || ya < 0 || ya >= height) continue;
int col = sprite.pixels[xs + y... |
925daea6-bdd8-45b5-b065-733fb61efb09 | 3 | private boolean isCommonName(String p){
short i = 0;
for(Player s : this){
if(s.getName().startsWith(p)){
i++;
}
}
if(i > 1){
return true;
}
return false;
} |
ced79d27-5d89-46ae-9b0b-25c4e1de6501 | 9 | public void endElement( String uri, String localName, String qName ) {
// recognized text is always content of an element
// when the element closes, no more text should be expected
isStackReadyForText = false;
// pop stack and add to 'parent' element, which is next on the stack
// important to pop stack fi... |
1eeaa63d-e916-4d1e-a651-e70937694bf4 | 8 | protected boolean testMatrixMajor(Matrix A, Matrix B) {
boolean ret = false;
Matrix tmpC;
int i = -1;
int j = -1;
int r = A.getRowDimension();
int c = A.getColumnDimension();
if((r == B.getRowDimension())&&(c == B.getColumnDimension())) {
tmpC = A.minus(B);
ret = false;
for(i = 0; (i<r)&&(!ret... |
2c4b91de-0542-41d8-b58b-e3bbd73a2dbc | 0 | public DoublyLinkedNode getSucc() {
return succ;
} |
16525c65-75c9-464b-9b0e-c1818cf5d662 | 2 | @Override
public int compareTo(InterpenetrationPoint o) {
return signedDistance == o.signedDistance ? 0
: signedDistance < o.signedDistance ? -1 : 1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.