method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3fd70327-b5a5-4ad8-99d1-31e2770e92be | 8 | private static String getCombatLevelColor(int mine, int theirs) {
int k = mine - theirs;
if (k < -9) {
return "@red@";
}
if (k < -6) {
return "@or3@";
}
if (k < -3) {
return "@or2@";
}
if (k < 0) {
return "@o... |
e1ac6457-e041-4478-a8c0-b3d3d89a2309 | 9 | int laskeRivit(Muodostelma muod) {
int rivit = 0;
int korkeinY = 19;
int matalinY = 0;
for (int i = 0; i < 4; i++) {
Palikka p = muod.getPalikat().get(i);
int x = p.getX();
int y = p.getY();
if (y < korkeinY){
korkeinY = y;
... |
27d1957c-8a20-4a8d-8cb6-e199af10be4a | 5 | public boolean crossedWall(double x, double dx, double y, double dy){
if (x1 == x2){
return inSection(x, x1, x2, y, y1, y2) && (x-x1)*(x1-x-dx)>0;
}
if ( y1 == y2) {
return inSection(x, x1, x2, y, y1, y2) && (y-y1)*(y1-y-dy)>0;
}
double k = (y1 - y2)/(x1 -... |
7e3ed45d-9db4-48fc-aa05-552bc226e3dd | 3 | public void assignRandomGroups() throws SQLException
{
int x = 4;
int MaxGroups = 4;
int currentGroup = 1;
ArrayList<Team> temp = listAll();
Collections.shuffle(temp);
ArrayList<ArrayList<Team>> Groups = new ArrayList();
for (int i = 0; i < x; i++)
{
... |
65f444e5-0ddb-406a-b664-c56a64ad4adf | 4 | public boolean isSameTree(TreeNode p, TreeNode q) {
if(null == p && null == q) return true;
if(null == p || null == q) return false;
return travelAndCompare(p, q);
} |
bec44a38-8ff6-45de-b2f8-e6fd6c4a1c83 | 4 | @Override
public void run() {
int count = 60;
for(int i = 0; i < count; i++){
File file = new File(path);
if(file.canExecute()){
try {
Desktop.getDesktop().open(file);
i = count;
} catch (IOException e) {
e.printStackTrace();
}
}
try {
Thread.sleep(2000);
} c... |
a5ecd34b-1b6e-4b51-aab7-526f66923a40 | 8 | @Override
protected void eatCombinationThree() {
int magenta = 0;
int yellow = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant pl = it.next();
if (pl.getType() == Plant.MAGENTA_PLANT && magenta < 1) {
it.remove();
magenta++;
}
if (pl.getType() == Plant.YELLOW_PLANT... |
747ba11f-c96e-47b2-a447-b571d9a0a8a3 | 7 | private boolean isCommit(CommentInfo commentInfo) {
String text = commentInfo.getContent();
String author = commentInfo.getAuthor();
if (text == null)
return false;
if(text.contains("Committed to CVS HEAD"))
return true;
if((text.contains("Committed") || text.contains("committed")) && text.contai... |
1af3f71a-5744-419a-a7a5-79aefc129aa1 | 1 | public void deleteField(FieldTracking field) {
if (this.fields != null) {
this.fields.remove(field);
}
} |
ce715cca-c2c6-4e0f-9ac2-4ec2308de949 | 6 | private void f(String name){
File dir;
File[] dirList;
if (name.equalsIgnoreCase("") || name.equalsIgnoreCase("."))
{
dir = new File(".");
String s_dir = dir.getAbsolutePath();
dir = new File(s_dir);
}
else
dir = new File(name);
if (!dir.exists())
System.out.println(... |
4ed45dba-27ab-4f4c-988e-e118743f6d2e | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
9d6bf852-4732-4833-a882-6bc3af26ede5 | 2 | private boolean checkInclineDownWinn(char cellValue){
for (int i = 0; i < WIN_NUMBER_OF_CELLS ; i++){
if( field[i][i] != cellValue) return false;
}
return true;
} |
90ec5753-bf3a-4089-b0da-d214271a5c7c | 3 | @Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
//Do nothing
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
states = temp.allActions(state, card, time);
}... |
ba16f145-5ce2-40bf-b456-15d7ce6701bf | 5 | public Hashtable<Object, mxICellOverlay[]> updateCellOverlays(Object cell)
{
Hashtable<Object, mxICellOverlay[]> result = new Hashtable<Object, mxICellOverlay[]>();
mxICellOverlay[] c = overlays.remove(cell);
mxCellState state = getGraph().getView().getState(cell);
if (c != null)
{
if (state != null)
... |
f3812e9a-b3fe-4fc3-81b8-d92e823f5703 | 4 | private Boolean osuvatkoRaajat(double[] axybxy1, double[] axybxy2) {
Boolean ekaOsuuTokaan = osuukoKarkiVarteen(axybxy1[2], axybxy1[3],
axybxy2);
Boolean tokaOsuuEkaan = osuukoKarkiVarteen(axybxy2[2], axybxy2[3],
axybxy1);
if (ekaOsuuTokaan){
... |
767e97fd-13c0-4e77-950a-457ce0ad457e | 7 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
switch (columnIndex) {
case 0:
return deltaSnapshot.getDeltaSqlStatementSnapshots()
.get(rowIndex).getSqlStatement().getSqlText();
case 1:
return deltaSnapshot.... |
ce9837b5-6524-4f5b-a691-4ec0d47c7eca | 2 | @Override
public void handleEmptyEventQueue() {
// TODO Auto-generated method stub
super.handleEmptyEventQueue();
if (exec1xTraffic) {
TrafficExportImport.changeReabilityModel();
TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt");
//Tr... |
97ae16f6-7ce1-4d23-9500-5681a44b8977 | 1 | public void enqueue(Locale Locations) throws Exception {
// Check for overflow.
if (backPtr < CAPACITY - 1) {
backPtr = backPtr + 1;
arr[backPtr] = Locations;
} else {
throw new Exception();
}
} |
9d94cb26-9f3a-4be5-b905-b4343e576539 | 9 | private boolean existImpl(char[][] board, String word, int idx, int x, int y, Set<List<Integer>> set) {
if (idx == word.length()) {
return true;
}
boolean find = false;
int[][] neighbours = {
{x - 1, y},
{x + 1, y},
{x, y - 1},
... |
171903b7-aa51-422f-984b-f4758446819b | 1 | public void showSplashAndHide() {
showSplash();
try {
Thread.sleep(duration);
} catch (Exception e) {
}
setVisible(false);
} |
0d27ec03-7194-4ec4-afb9-ad5fdec5ff2a | 9 | @Override
public boolean isAllowAutoMapType(Class<?> clazz) {
return clazz.isPrimitive() || ClassHelper.wrapperToPrimitive(clazz) != null || clazz.equals(String.class)
|| clazz.isEnum() || clazz.equals(BigDecimal.class) || clazz.equals(Number.class)
|| clazz.equals(BigDecimal.class) || Date.class.isAssignabl... |
072f2356-80b0-444b-b9ba-cd55c2d3e965 | 3 | public ClassFolder()
{
try
{
file= new File( "." );
path = file.getCanonicalPath();
path = path.concat("\\classFile");
file = new File(path);
//checks if the folder exists and if it is a directory and then creates a new folder... |
0b7c898e-5e0e-4a97-ab19-b2141a5d0db7 | 2 | public void set(String s) {
String line = "";
boolean toChangeLine = false;
for(int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if(c == '\n') {
lines.addLast(line);
line = "";
}
else {
... |
97c8f42b-a059-492f-a4ab-840d2697afb9 | 6 | @Override
public boolean execute(WorldChannels plugin, CommandSender sender,
Command command, String label, String[] args) {
final Map<Flag, String> info = new EnumMap<Flag, String>(Flag.class);
info.put(Flag.TAG, WorldChannels.TAG);
if(!(sender instanceof Player)) {
... |
9ee70d09-69ad-46ba-bf6e-c539e0e25213 | 3 | protected PlanPlan(JSONObject object, Object array, int length) throws JSONException, FatalError {
super("Plan");
if (array != null && array instanceof JSONArray) {
JSONArray arr = (JSONArray) array;
manager = new PlanManager(arr.length());
for (int i = 0; i < arr.length(); i++) {
manager.add(Pl... |
99143432-db06-4711-8444-f7f87b7c6812 | 4 | @Override
public void run() {
while (gameRunning) {
if (map != null) {
map.moveCharas();
}
for (Container drawable : drawList) {
drawable.repaint();
}
sendActions();
recieveUpdate();
executeUpdate();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-g... |
de7ce797-ff8a-4bf5-aafa-dd903c532ddf | 9 | private void btn_okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_okActionPerformed
// Initialisation des variables.
String message="";
String email=null;
String ville=null;
String nomEntreprise = (String)jComboBox2.getSelectedItem();
String domain... |
e14a2973-701a-4065-ab1f-d0f2a5327f37 | 5 | @Override
public void parse() {
storeLineNumber();
if (peekTypeMatches("RETURN"))
statement = new ReturnStatement();
else if (peekTypeMatches("ID"))
statement = new IdStatement();
else if (peekTypeMatches("IF"))
statement = new IfStatement();
else if (peekTypeMatches("WHILE"))
... |
0f3047fd-a9f8-4f74-b6fd-ef0bb57b83f9 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(tickID==Tickable.TICKID_ELECTRONICS)
{
if(activated() && owner() instanceof MOB)
{
final MOB mob=(MOB)owner();
final List<Software> software=getSoftware();
final CMMsg msg2=CMClas... |
e8c522bf-e5f9-4671-82e0-71332d3137f0 | 9 | public static List<String> getSpectrumNameByName(String name, String match) throws SQLException {
LOGGER.info("name "+ name);
LOGGER.info("match "+ match);
List<String> result = new ArrayList<>();
StringBuilder sql = new StringBuilder("select NAME, ID from SPECTRUM");
if (name != null && !"".equ... |
53a2045e-b2de-4b26-91b2-f71061c06660 | 7 | public static void caesar_shift(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i), xChar = ch;
if (ch >= 65 && ch <= 90) {
xChar = (char) (ch == 90 ? 65 : ch + 1);
} else if (ch >= 97 && ch... |
6f8e2b6b-ea98-47f8-a488-5b2eb3b575bf | 5 | private static void CreatedTask(jpvmTaskId client, jpvmBuffer req) {
int count = -1;
jpvmTaskId child = null;
int orderNum = -1;
try {
count = req.upkint();
if(count==1) {
child = req.upktid();
orderNum = req.upkint();
}
}
catch (jpvmException jpe) {
perror("CreatedTask, bad report from... |
06ab1928-6721-4e98-be66-10bec7137ecc | 7 | @Override
Double computeNdcg(ArrayList<String> goldRanking,ArrayList<String> myRanking, int at) {
ArrayList<Double> myRankingRelevance = new ArrayList<Double> ();
//add relevance values to myRanking
int size = goldRanking.size();
boolean flag = false;
for (String title : myRanking){
for (int i=0; i... |
6c768f04-da32-4555-bd09-5f20eb038c7a | 8 | public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.ge... |
68679a1a-1f33-4c79-a49c-1f38e5b4ab43 | 1 | public static void connection(String configfile)
{
ConfigGetDb getconfig = new ConfigGetDb(configfile);
String driver = getconfig.driver;
String url = getconfig.url;
String uesr = getconfig.user;
String password = getconfig.password;
try
{
Class.forName(driver);
conn = DriverManager... |
b1ccbf3c-2e56-407f-9fa2-dd475b23d48a | 9 | private static void readTileMap(DataBuffer buffer, int x, int y)
{
/*for (int pL = 0; pL < 4; pL++)
{
for (int pX = 0; pX < 64; pX++)
{
for (int pY = 0; pY < 64; pY++)
{
collisionMaps[pL].adjacency[pX][pY] &= ~0x1000000;
}
}
}*/
for (int pL = 0; pL < 4; pL++)
{
for (int pX = 0... |
ef6f7f7f-105e-4247-a9e7-99c24166b0d3 | 7 | 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... |
2bd85cb5-173a-4b36-8cc9-e58aa178e78a | 9 | public void SetWindowVisible() {
Object[] possibleValues = new Object[NUMOFCHARTS];
possibleValues[BARCHART] = "Bar Chart";
possibleValues[PIECHART] = "Pie Chart";
possibleValues[LINECHART] = "Line Chart";
possibleValues[RINGCHART] = "Ring Chart";
possibleValues[AREACHART] = "Area Chart";
possibleVa... |
1a35198d-c513-48a4-adb2-742ae452c9a5 | 5 | public static String format(final String code, final Object... args) {
if (args.length == 0) {
return code + '\r';
}
StringBuilder builder = new StringBuilder(code);
int num = args.length;
for (int i = 0; i < num - 1; i++) {
builder.append(' ').append(ar... |
56dfdbe0-1b2b-4d2d-8d10-910daa86557c | 7 | public static void main(String[] args)throws IOException
{
String fileName="/home/garth/Desktop/stock/GE.csv";
try {
int lineNumber = findNumDays(fileName);
String line = new String();
String[] stringArray =new String[7];
... |
199f9a0d-73fc-4a00-9fe4-a74bbf03e624 | 4 | @Override
public String toString() {
DecimalFormat Coord = new DecimalFormat("#0.00");
String output = "";
output += identifier + "\n" + "Pos bef : ";
for (int i = 0; i < dimensions; i++) {
output += Coord.format(beforePosition.getCoord(i)) + " ";
}
output += "\n" + "Pos aft : ";
for (int i = 0; i <... |
1110263e-818d-4def-924b-5612f47b7b5c | 2 | public static boolean zmq_bind(SocketBase s_, final String addr_) {
if (s_ == null || !s_.check_tag ()) {
throw new IllegalStateException();
}
return s_.bind(addr_);
} |
66733fb1-1a84-4fb6-b5d4-bb635063a4ba | 7 | public void primeTime() {
float prop_nourriture = 0.02f;
int valeurEnergieNourriture = 20;
ZoneGraphique zone = new ZoneGraphique("Loft Story Sfeir Servais-Laval", tailleLoft, tailleLoft);
Loft loft = new Loft(tailleLoft,zone, prop_nourriture);
zone.ajouterObjet(loft);
Neuneu nouveauNeuneu = new Neuneu();
... |
23f64599-ffcd-413d-90a3-44c3e70edadc | 8 | static float getAngle(float x, float y) {
if(x >= 0 && y >= 0) return (float) atan(y/x);
if(x < 0 && y >= 0) return (float) (pi - atan(-y/x));
if(x < 0 && y < 0) return (float) (pi + atan(y/x));
if(x >= 0 && y < 0) return (float) (2*pi - atan(-y/x));
return 0;
} |
8a52a331-b98a-4e24-b8ba-fc0e926dadd5 | 4 | @Override
public ViewFactory getViewFactory() {
if (factory == null) {
factory = new HTMLFactory() {
@Override
public View create(Element elem) {
AttributeSet attrs = elem.getAttributes();
Object elementName = att... |
1b06cc6f-8d2e-4d70-a135-b91148513c15 | 4 | public int userID(String login, String pwd)
{
int r = -1;
Statement st = null;
ResultSet result = null;
try
{
st = cnx();
if(st == null) return -1;
result = (ResultSet) st.executeQuery("SELECT id FROM t_users WHERE (name='"+login+"' AND password='"+pwd+"')");
if(result.last() && result.getRow... |
afc78094-2adf-4bdb-8af6-095323f43099 | 3 | public static void savePlayersNames(Game game, String player1Name, String player2Name) {
if (game == null
|| player1Name == null
|| player2Name == null) {
throw new IllegalArgumentException("savePlayersNames - parameter value is null");
}
Player player1 = g... |
d5af3277-bb12-441c-957c-022ae96a7001 | 3 | public void stop() {
this.stop = true;
try {
this.connection.close();
logger.info("BitTorrent tracker closed.");
} catch (IOException ioe) {
logger.error("Could not stop the tracker: " +
ioe.getMessage() + "!");
}
if (this.collector != null && this.collector.isAlive()) {
this.collector.inter... |
69646b8a-2e25-4418-9fa1-0d833e679d78 | 6 | protected static boolean isRecursive(Class type, String connectionName) {
if (type.isAssignableFrom(Model.class))
throw new IllegalArgumentException(EXC_NOTAMODEL);
Method[] getters = getDeclaredGetters(type);
for (Method m : getters)
if (m.isAnnotationPresent(Connection.class)) {
Connection c ... |
92130557-17ca-49b9-b6d6-bd19b395716d | 9 | public void open() {
Main.shell.setEnabled(false);
shell.open();
shell.layout();
newName.setVisible(btnAdd.getSelection());
replaceCombo.setVisible(btnReplace.getSelection());
if (!ShipIO.isNull(Main.dataPath) && (ShipIO.playerBlueprintNames == null || ShipIO.playerBlueprintNames.size() == 0)) {
ShipI... |
e22f46ed-26ed-4a0b-8de8-e4eabf03b103 | 8 | public static void main(String[] args) {
try {
JsonFactory jfactory = new JsonFactory();
/*** read from file ***/
JsonParser jParser = jfactory.createJsonParser(new File("D:\\Java SE\\src\\json\\jackson_streaming_api_to_read_and_write_json\\file.json"));
// lo... |
44020c1d-2854-43f6-b0a0-832dd4e305c4 | 3 | @Override
public boolean handleRightClick(Point clickPoint) {
Point mapPoint = new Point(
placeableManager.panelToMapX(clickPoint.x),
placeableManager.panelToMapY(clickPoint.y));
if (currentState == State.Placed) {
if (isInside(mapPoint)) {
... |
28c9140a-f477-4bba-a740-437ab58e0a1f | 9 | public static boolean isDirectPath(Statement stat, Statement endstat) {
Set<Statement> setStat = stat.getNeighboursSet(Statement.STATEDGE_DIRECT_ALL, Statement.DIRECTION_FORWARD);
if (setStat.isEmpty()) {
Statement parent = stat.getParent();
if (parent == null) {
return false;
}
... |
52a7dc1c-22ff-4c81-a629-28680afd463b | 0 | public void onAccount(IAccount account) throws JFException {
// アカウント情報が更新された際に呼ばれます。
// LOGGER.trace("onAccount : " + account.getAccountId());
} |
9601f415-047c-4a11-b51b-534546adfe58 | 8 | public GlobalSettings(){
try{
settingsFile = new File(plugin.getDataFolder()+File.separator+"settings"+File.separator+"Settings.yml");
settingsFile.getParentFile().mkdirs();
config = YamlConfiguration.loadConfiguration(settingsFile);
config.options().copyDefaults(true);
if(!config.contains("Port"))... |
dca38d76-3bde-4921-9758-04c3f6f2092b | 1 | @Override
public void serialEvent(SerialPortEvent evt) {
try {
int available = inputStream.available();
byte[] received = new byte[available];
inputStream.read(received, 0, available);
notifyListeners(received);
}
... |
693df6af-f4f3-4b0c-bd5a-383b8966f346 | 0 | public Block getBlock(int x, int y) {
return new Block(blockSheet[x][y]);
} |
c8a1f8b0-9a68-4088-b682-e192674d32ca | 0 | public int getFemalesCount() {
return getGenderCount(Gender.FEMALE);
} |
febb96b6-3a93-48e9-98e8-f280b220fecf | 7 | public static void main( String[] args ) throws IOException,InterruptedException{
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
CLList Categories = new CLList();
Categories.add("spouse");
Categories.add("job");
Categories.add("number of kids");
Categories.add("salary");
Cat... |
ccf7846d-da8c-4d8b-8b79-72466d57556e | 3 | @Test
public void testProteinPercentage() {
MealRepartition mr = new MealRepartition();
try {
mr.setProteinPercentage(0.11);
fail("A BadProteinPercentageException should have been thrown.");
} catch (BadProteinPercentageException e) {}
try {
mr.setProteinPercentage(0.16);
fail("A BadProteinPercenta... |
b866c0e7-4cc4-4727-9dc8-c90119a833bf | 4 | @Override
public void set(int x, int y, E _val) {
if (x < 0 || y < 0 || x >= w || y >= h)
throw new ArrayIndexOutOfBoundsException();
backing.set(x0 + x, y0 + y, _val);
} |
d9496156-3bd1-421e-8bb9-24af72d6d6a6 | 3 | @Override
public synchronized void envoyerMessage (Message message) throws RemoteException {
//test si pseudo absent hashmap, on ajoute
String pseudo = message.getPseudo();
if(!tableau.containsKey(pseudo)) {
tableau.put(pseudo, new ArrayList<Message>());
}
//on p... |
532be894-46b8-4e05-af2d-f16a5f8eb32a | 3 | @Override
public void move(Excel start, Excel finish) {
for(int i=0;i<allex.size();i++)
{
if (start.getX() == allex.get(i).getX() && start.getY() == allex.get(i).getY())
{
allex.remove(i);
allex.add(i, finish);
setColoredExes();
break;
}
}
dragg(start, finish);
} |
dbbe7d1b-7fb9-4cc1-9140-3bb39bdb8f32 | 9 | @Override
public void run() {
HttpRequestData data = parentRequest.getRequestData();
String prefix = data.getEncryptionLevel().getURIPrefix();
String type = data.getRequestType().getTypeString();
URLConnection connection = null;
try {
String surl = prefix + parent... |
818d9c97-5010-4aae-b43b-e0916e5cd7bd | 6 | @Override
public void doAction (String o)
{
Global.notewindow(this, "messagedialog");
if (Global.resourceString("Close").equals(o))
{
doclose();
}
else if (Global.resourceString("Answer").equals(o))
{
String User = UserChoice.getSelectedItem();
if (User != null && !Answer.getText().equals(""))
... |
455821f1-2b89-45a9-ba8e-29b65b983b55 | 4 | void disposeExampleWidgets () {
/* store the state of the Browser if applicable */
if (browser != null) {
String url = browser.getUrl();
if (url.length() > 0 && !url.equals("about:blank")) { //$NON-NLS-1$
lastUrl = url;
} else {
String text = browser.getText();
if (text.length() > 0) {
las... |
f4d0eb2b-d168-4216-b94b-6d8040610ac8 | 6 | public boolean isSameTree(TreeNode p, TreeNode q) {
if (p == null && q == null){
return true;
}
else if (p == null || q == null){
return false;
}
else {
if (p.val == q.val){
//nodes number are equal and left child is the same as... |
addbfbc1-ab51-49d7-9fd6-aac7c242c165 | 5 | public void stateChanged(ChangeEvent e) {
if (dontUpdate == true) {
return;
}
Object o = e.getSource();
if (myRecipe != null) {
if (o == postBoilText) {
try {
NumberFormat format = NumberFormat.getInstance(Locale.getDefault());
Number number = format.parse(postBoilText.toString().trim... |
074d3015-d304-4824-a0cf-94b3c0190c69 | 1 | public BasketDao getBasketDao() {
if (basketDao == null) {
basketDao = new BasketDaoImp();
}
return basketDao;
} |
e93db7f3-1784-4543-95ac-1d97a49000b7 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
d1e16148-d081-4b27-8912-9a44dfb1fd47 | 2 | public Tileset(byte[] buf) {
int[] off = new int[1];
off[0] = 0;
fl = Utils.ub(buf[off[0]++]);
int flnum = 0;
if (Config.showFlavors)
flnum = Utils.uint16d(buf, off[0]);
off[0] += 2;
flavprob = Utils.uint16d(buf, off[0]);
off[0] += 2;
fln = new String[flnum];
flv = new int[flnum];
f... |
62cdff62-488a-494e-ba34-e4ce5b09d537 | 2 | public boolean set(int i, T pData) {
if (i >= this.length)
return false;
Node<T> ele = _head;
for (int x = 0; x < i; x++)
ele = ele.getNext();
ele.setData(pData);
return true;
} |
be1eb6de-bd59-4132-8030-c2677d4c7456 | 5 | public void setUpNodes(){
Random rnd = new Random();
nodes = new PathNode[rnd.nextInt(3) + 1];
for(int i=0; i<nodes.length; i++){
int num = rnd.nextInt(4);
int randX = topLeftX + rnd.nextInt(width);
int randY = topLeftY + rnd.nextInt(height);
// random point on top side
if(num == 0)
node... |
cbe39e58-f479-42d8-af99-45320aa6f45a | 3 | public Recording find(String id, int type){
try {
Recording recording = new Recording();
Statement st = conn.createStatement();
String query = "SELECT * FROM recordings WHERE id = '" + id + "' AND filetype = '" + type + "'";
ResultSet res = st.executeQuery(query);
if(res.next()){
... |
ac83b918-23fc-4c16-ae8b-80c64b422201 | 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... |
e88b8674-86d6-47c5-8e54-59246452ed73 | 9 | @Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
affectedLimbNameSet();
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((amputations[Race.BODY_LEG]<0)&&(mob.getWearPositions(Wearable.WORN_LEGS)==0))
{
... |
de5f1b29-261b-4e07-9a7e-728f33c553c3 | 2 | private synchronized void closePrintWriters(){
for (Socket socket: getSockets()){
try {
socket.close();
} catch (Exception e){
e.printStackTrace();
}
}
} |
82fb5436-638d-4495-95d2-226de57d8dda | 2 | public void clearElement()
{
MCDObjet obj;
obj = getMCDObjet ( Constantes.MCDENTITE1 );
if (obj != null)
obj.delLink(this);
obj = getMCDObjet( Constantes.MCDENTITE2 );
if (obj != null)
obj.delLink(this);
} |
c1ff31cc-788a-4eb6-aaf2-ee3b3b034ea6 | 7 | @Override
public boolean onCommand(final CommandSender sender,final Command command,final String label,final String[] args) {
if (args.length == 0) {
return false;
}
final OfflinePlayer player = this.plugin.getServer().getOfflinePlayer(args[0]);
if (player == null) {
... |
af30de4f-3f21-4641-84c1-baef550174d7 | 6 | @Override
public boolean placeResearvation(int rowNum, Column column, Passenger passenger) throws UnsupportedOperationException {
if (!isInitialized) {
throw new NullPointerException("Passenger List has not been initialized");
}
if (rowNum < 0 || rowNum > passengerList.size()) {... |
543e1377-c8e1-46d5-822c-0225af002ce7 | 2 | @Override
public void handleEmptyEventQueue() {
// TODO Auto-generated method stub
super.handleEmptyEventQueue();
if (exec1xTraffic) {
TrafficExportImport.changeReabilityModel();
TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt");
//Tr... |
8647316d-830c-48f1-9f44-55519c2f8997 | 7 | public static void startupIdlTranslate() {
if (Stella.currentStartupTimePhaseP(1)) {
Module.defineModuleFromStringifiedSource("/IDL-THEORY", "(:CASE-SENSITIVE? TRUE :USES () :LISP-PACKAGE \"IDL\")");
Module.defineModuleFromStringifiedSource("/IDL-THEORY/IDL-USER-THEORY", "(:CASE-SENSITIVE? TRUE :USES ()... |
bc0d8c06-d2c2-4573-9fa2-0a0e1b42a583 | 1 | public static LinkedList<Tuple<String, LinkedList<Triple<String,String,String>>>> relation_sort(Hashtable<String, LinkedList<Triple<String,String,String>>> relations){
Set<String> key_set = relations.keySet();
LinkedList<Tuple<String, LinkedList<Triple<String,String,String>>>> result = new LinkedList<Tuple<String, ... |
3ad2b05f-5a64-4ce6-9799-a6f3232704e0 | 8 | public PatternReplacerImpl(Map<AttributeKey, Object> attributes) {
super(attributes);
if (attributes.get(AttributeKey.FROM_PATTERN) == null) {
throw new FileRenamerException("The " + AttributeKey.FROM_PATTERN + " can't be found");
}
if (attributes.get(AttributeKey.TO_PATTERN)... |
b449bf59-5adc-4b63-b984-52f1454301ac | 3 | public Router(final String addr) {
new Thread() {
@Override
public void run() {
Context ctx = ZMQ.context(1);
Socket router = ctx.socket(ZMQ.ROUTER);
LOGGER.info("Binding reply socket to " + addr);
router.bind(addr);
while (!Thread.currentThread().isInterrupted... |
f6e660f6-680c-4e2b-a95a-178fb692154a | 9 | public static QuestionFraction decode(String str) throws DecodeException {
QuestionFraction res = null;
if (str.substring(0,17).compareTo("#QuestionFraction") == 0) {
res = new QuestionFraction();
int i = 17;
if (str.charAt(i) == '<') {
while (str.charAt(i) != '>') {
i++;
}
ArrayList<Integ... |
8ab2ebf1-879d-4c5b-80ba-c5e15abc14d3 | 8 | @Override
public void createPossibleMoves() {
possibleMoves = new ArrayList<Square>();
int dy = ny;
Square ahead = game.getSquare(x, y + dy);
if (ahead != null && ahead.getPiece() == null) {
possibleMoves.add(ahead);
}
Square aheadLeft = game.getSquare(x - 1, y + dy);
if ((aheadLeft != null) && (ahead... |
7a920dd6-97fc-4881-bf2d-ebb83a308deb | 8 | static final void method828(byte i, int i_13_, int i_14_) {
if (i != 38)
method828((byte) 63, 119, 33);
anInt1467++;
if (Class21.aHa326 != null) {
int i_15_ = Class31.anInt425;
int i_16_ = Class250.anInt3225;
Class239_Sub8.method1752(-1, i_13_, i_14_);
if (ByteBuffer.anInt7207 == 0) {
Anim... |
036d58af-7749-46b3-8758-2902ec975f16 | 1 | public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (bodyBlock == oldBlock)
bodyBlock = newBlock;
else
return false;
return true;
} |
bc5a4bc8-bb67-4155-a8b7-c6b0683b76d1 | 0 | @Override
public void receive(Map myCustomEvent) {
logger.info(new Date() + ": [x] Received '" + myCustomEvent + "'");
} |
5f7bf2d0-6c6f-41cc-ae5d-b96bdfdac41c | 2 | public boolean checkAntBrainSyntax(String antBrainFile) throws Exception {
BufferedReader br = new BufferedReader(new FileReader(antBrainFile));
String currLine;
int lineNumber = 0;
// process each line in ant brain file
while ((currLine = br.readLine()) != null) {
... |
6c3985ab-7a37-4d61-8b0b-969f0961ce85 | 7 | @Override
public void caseAIntArrHexp(AIntArrHexp node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(NewInt[ " + node + "]");
inAIntArrHexp(node);
if(node.getNew() != null)
{
node.getNew().apply(this);
}
... |
294e0996-9665-4ab4-b6a6-f3f07c744692 | 8 | void dump(Buffer buf){
buf.putInt(flags);
if((flags&SSH_FILEXFER_ATTR_SIZE)!=0){ buf.putLong(size); }
if((flags&SSH_FILEXFER_ATTR_UIDGID)!=0){
buf.putInt(uid); buf.putInt(gid);
}
if((flags&SSH_FILEXFER_ATTR_PERMISSIONS)!=0){
buf.putInt(permissions);
}
if((flags&SSH_FILEXFER_ATTR... |
39955e18-8183-44f0-9e40-621e59dc47b1 | 9 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(true);
//add request bean
beans.RLogin rLogin = new beans.RLogin();
request.setAttribute("rLogin", ... |
bfbcce06-0106-460a-ba5a-75e39912653b | 6 | @AfterGroups({ "Insertion", "Search" })
@Test(groups = "BST")
public void testBSTDeletion() throws KeyNotFoundException,
EmptyCollectionException {
Reporter.log("[ ** BST Deletion ** ]\n");
Integer count = 0;
timeKeeper = System.currentTimeMillis();
for (Integer i = -seed; i < 0; i++) {
try {
Re... |
af113fe0-f3a7-4d7a-a673-e281ba504165 | 3 | public synchronized MessageBlock resent(final int offset, final int length) {
MessageBlockDef mbd = new MessageBlockDef(offset, length);
// removes old instance (all which are contained)
HashSet<MessageBlockDef> rm = new HashSet<MessageBlockDef>();
for (MessageBlockDef mbds : sentBlocks) {
if (mbds.offset >=... |
95f93f13-1429-4c6c-88aa-d8c5295faf42 | 8 | public void run() {
long delay;
long start;
int random;
for (int i = 0; i < laneAry.size(); i++)
{
laneAry.get(i).start();
}
for (int i = 0; i < this.val.customersnum; i++) {
start = System.currentTimeMillis();
random = this.generator.nextInt(this.val.cartsizemax) + 1;
delay = random * 20;
... |
aa252d30-b83e-484c-a73b-23dd476e5e42 | 5 | void updateTime(long nanoSecs, UpdateType updateType) {
// Initialise the any variables to their starting values
if (previousGameTime == 0) {
previousGameTime = nanoSecs;
}
// Work out the elapsed time since the previous update
elapsedGameTimeNano = nanoSecs - previousGameTime;
elapsedGameTimeMilli = el... |
0463c753-6f85-4cfb-b85e-dbc55f02ba47 | 5 | private void rewind() {
try {
if (scriptEnded || programHalted) {
gui.enableSingleStep();
gui.enableFastForward();
}
scriptEnded = false;
programHalted = false;
int oldAnimationMode = animationMode;
setAnima... |
be5ac74b-8013-48fa-8127-22a2938601a3 | 6 | @Override
public void execute(CommandSender sender, String gateName, List<String> args) {
this.sender = sender;
for (DataGate thisGate : plugin.getGates()) {
if (!thisGate.hasTarget()) {
boolean hasSource = false;
for (DataGate sourceGate : plugin.getGates()) {
if (sourceGate.getTarget() !=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.