method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0a83384d-b84b-4951-b696-ea4b22ac5476 | 4 | public String findShortestPath(int id,String source,String target,
boolean reverse_cost ) {
String rTable = "road_profile_"+id;
StringBuffer sb = new StringBuffer();
JSONObject jobj = new JSONObject();
JSONObject jstat = new JSONObject();
JSONArray jfeats = new JSONArray();
int sCode ... |
f9aa576d-f9b2-44f8-90a8-0a8ee6d369d7 | 6 | public boolean isAllCall() {
for(Player player : playerList) {
if((player.getState().equals(Player.States.WAIT))
|| (player.getActionChip() != state.getBetChip() && !player.getState().equals(Player.States.FOLD) && !player.getState().equals(Player.States.ALL_IN) && !player.getState().equals(Player.States.L... |
b6fb4931-e8d4-47f8-9c32-b6ca060cc055 | 4 | @Override public String toString(){
StringWriter aux = new StringWriter();
if (logType == LogType.EXCEPTION | logType == LogType.LEVEL_TIME_MESSAGE){
aux.write(separator);
aux.write("[" + level + "] - [" + time + "] --- " + message + "\n");
}
else if (logType == LogType.MESSAGE){
aux.write(message);... |
1fe82a5f-6e3f-4c69-8a52-63f3cea753dd | 2 | public static void main(String [] args){
Zegana.initalize(args);
if(quit)
return;
while(genCount != end){
genCount++;
simulate();
populate();
}
} |
4f2cec2e-e942-4603-ba6f-b7201e5860e4 | 6 | public String NumbersCalculation(int i) {
String s=String.valueOf(i);
if (i==10)
s="0.";
if(checkCalculatorSequence(position -1) && position >0) {
if (isANumber(calculatorSequence.get(position - 1))){
if (i==10)
s=".";
s... |
662cc8fb-0205-4c13-ac30-e409f12eb27c | 3 | public void addScore(boolean onBeat, int bpm) {
if (lastScore < 1000 * 60 / bpm / 1.5f) {
lastScore = 0;
return;
}
if (onBeat) {
int scaleX = Level.getScaledX(level.getXPosition(), x);
int width = Level.getScaledX(level.getXPosition(), x + 1) - scaleX;
float scale = 1.0f / Constants.TILE_WIDTH * w... |
a53a7632-29ff-40a9-acee-470277150d6e | 3 | public static String readFastaFile(String path)
{
Scanner sc;
try
{
sc = new Scanner(new File(path));
} catch (Exception e)
{
sc = new Scanner("");
}
String sequence;
StringBuilder sb = new StringBuilder();
if (sc.hasNextLine())
{
sc.nextLine();
}
wh... |
38fe313f-f89a-441b-80a1-04bd7174a965 | 5 | public static double[] LineEquation (int x1, int y1, int x2, int y2)
{
double[] arr = new double[7];
// Cramer's Rule to solve system of equation ( 2 x 2 )
if (x1 - x2 != 0)
{
// y = ax + b
arr[0] = (double)(y1 - y2) / (double)(x1 - x2);
arr[1] = (double)(x1*y2 - y1*x2) / (dou... |
2bd02244-0aa8-49c0-9fc3-a81a1a0b19c7 | 6 | public String[] query(String table, int ID, String nameID) {
String[] result = null;
try {
String stm = null;
stm = "select * from " + table + " WHERE " + nameID + " = " + ID + " order by " +nameID;
con = DriverManager.getConnection(url, user, password);
pst = con.prepareStatement(stm);
rs = pst.exec... |
4b91c0ac-8bb3-48af-b61f-0ca855332f87 | 0 | @Override
public void keyTyped(KeyEvent e)
{
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
e6ac5089-9b9d-4598-95c9-2f470e0ed3f8 | 3 | public void checkLRBounds() {
if (getX() > 400)
setX(400);
if (getX() < -15)
setX(-15);
if (getY() < 10)
setY(10);
} |
66880d34-8125-4857-812a-49e1d8ef98f7 | 1 | public static List<Element> intArrToList(int[] arr) {
List<Element> elements = new ArrayList<Element>();
for(int i = 0; i < arr.length; i++){
Element elem = new Element(i, arr[i]);
elements.add(elem);
}
return elements;
} |
dae9143d-02cb-49c8-aa6b-2ec168d4e4ef | 7 | final boolean method954(int i, byte i_23_, int i_24_, r var_r) {
anInt1630++;
r_Sub2 var_r_Sub2 = (r_Sub2) var_r;
i_24_ += 1 + ((r_Sub2) var_r_Sub2).anInt10484;
if (i_23_ != 88)
aClass232ArrayArray1623 = null;
i += 1 + ((r_Sub2) var_r_Sub2).anInt10489;
int i_25_ = i_24_ * ((Class104) this).anInt1624 + i;
in... |
3bfd4660-27a7-4f6c-89c3-f1bd6f88c0f4 | 0 | public Collection<BookingEntity> getBookings() {
return bookings;
} |
7c5b2f11-57a6-40ad-bf36-2c09bc6a28dc | 6 | public static int binarySearch(int[] array, int k) {
if(array==null || array.length==0) {
return -1;
}
int start = 0;
int end = array.length-1;
while(start <= end) {
// Attention: This is wrong way
// it fails if the sum of low and high
// is greater than the maximum positive
// int val... |
fa5633ba-dcb6-4e43-b633-737af09bcd83 | 6 | public Categorie recalculerDerniereReponse(Reponse ancienneReponse) {
if (ancienneReponse.equals(getDerniereReponse())) {
derniereReponse = null;
for (Sujet sujet : getSujets()) {
if (getDerniereReponse() == null || sujet.getDerniereReponse().getTempsMillis() > getDernier... |
b40d17d8-1c2f-4816-b054-a4631b996da4 | 4 | public List<OpenChatRoomDTO> getOpenChatRooms() {
List<OpenChatRoomDTO> openchatroomDTOs = new ArrayList<OpenChatRoomDTO>();
List<Openchatroom> openchatrooms = new OpenchatroomDAO().readAll();
int participantsCounter = 0;
String currentPerformer = null;
for (Openchatroom openchatroom : openchatrooms) {
if ... |
3519dd0e-3a96-4829-8cf2-e9abe54758dd | 0 | public int length() {
return this.map.size();
} |
4315693b-d4f9-4c21-8197-933dda3ece8d | 3 | public static void paintFocus(Graphics2D g, Shape shape, int pixelSize) {
Color focusColor = getFocusRingColor();
Color[] focusArray = new Color[] {
new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 235),
new Color(focusColor.getRed(), focusColor... |
9f88f96f-812f-4c8e-89dd-f853c6aad5d0 | 0 | public OpenFileFormat getDefaultOpenFileFormat() {
return defaultOpenFileFormat;
} |
3a6dc0cd-44e5-4c1e-a587-4bc28cdf8419 | 6 | public String readAndVerifyMessage() {
byte[] message = null;
byte[] signature = null;
byte[] pubKeyEnc = null;
try {
// die Datei wird geoeffnet und die Daten gelesen
DataInputStream is = new DataInputStream(new FileInputStream(
fileName));
... |
bfbaaee7-1216-4def-a875-5e184ef38272 | 7 | @Override
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == start) {
menu.dispose();
Game peli = new Game(setting.getDifficulty());
peli.run();
peli.gameStart();
}else if (ae.getSource() == contin) {
Game peli ... |
39882e39-3832-483d-8016-ac7168c3cb7d | 1 | public void visitFormalTypeParameter(final String name) {
declaration.append(seenFormalParameter ? ", " : "<").append(name);
seenFormalParameter = true;
seenInterfaceBound = false;
} |
b9d3ce9e-68a5-4f8e-b20b-b6f4bbdf7882 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
b42b4e4d-2704-45be-aaa9-eb0c529a35fc | 8 | private static final void packObjectSpawns() {
Logger.log("ObjectSpawns", "Packing object spawns...");
if (!new File("data/map/packedSpawns").mkdir())
throw new RuntimeException(
"Couldn't create packedSpawns directory.");
try {
BufferedReader in = new BufferedReader(new FileReader(
"data/map/unpa... |
b3e0ca42-6e3d-4ce1-b827-9884f9fd99b1 | 6 | public Admin(JPanel adminpanel, JPanel userpanel, JTextField[] userdata, JSlider months, JLabel[] errMess) {
this.errMess = errMess;
for (int i = 0; i < this.errMess.length; i++) {
this.errMess[i].setText("");
}
this.adminpanel = adminpanel;
this.adminpanel.removeAll... |
af4483f2-555b-4c6c-8207-801fe0688dea | 0 | protected RegularExpression getExpression() {
return environment.getExpression();
} |
10ffd609-0528-45c1-9118-48c41f92e127 | 7 | private void prepareSignatures(
final Map<String, ByteClass> byteClasses,
final Multimap<String, String> rdepends,
final BiMap<String, String> nameMaps,
final BiMap<Signature, Signature> signa... |
2c6de1b4-d176-4415-a605-b94016df7b01 | 6 | public void update() {
// 重力で下向きに加速度がかかる
vy += Map.GRAVITY;
// x方向の当たり判定
// 移動先座標を求める
double newX = x + vx;
// 移動先座標で衝突するタイルの位置を取得
// x方向だけ考えるのでy座標は変化しないと仮定
Point tile = map.getTileCollision(this, newX, y);
if (tile == null) {
// 衝突するタ... |
a68749df-10dc-4742-8b37-b37e28ed71c2 | 4 | public String getDatosAdmin(String clave, beansAdministrador admin){
if(clave.trim().equals("nombre"))
return admin.getNombre();
if(clave.trim().equals("nick"))
return admin.getNick();
if(clave.trim().equals("edad"))
return Integer.toString(admin.getEdad());
if(clave.trim().equals("codigo"))
return ... |
e06790f4-4712-48ba-87f1-8a3de9904430 | 0 | public int getNumUnpinnedBuffers() {
return replacer.getNumUnpinnedBuffers();
} // end getNumUnpinnedBuffers() |
c1b7ae42-eaaa-410a-bd0b-104e9d24bd1b | 5 | public void playerHit(Player player, int id){
player.setHealth(player.getHealth()-20);
if(player.getHealth() == 0){
player.setDead(true);
String str = "";
List<Integer> shooters = player.getShooters();
shooters.remove(new Integer(id));
for(Integer i : shooters)
str += " " + i;
netw... |
922b5f63-c471-47ff-bc01-41d831872159 | 3 | public boolean login() {
boolean flag = false;
String sql = "SELECT * FROM db99527iu6w4ye96.users where username = '"+ username+"'";
System.out.println(sql);
Connection conn = (Connection) SQLconnect.getConnection();
try {
Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的Statement对象
R... |
bc74249d-6316-44e9-83e3-fc9f0381a1a4 | 7 | private void staticHandle(QueueEntry queueEntry, AisVesselTarget vesselTarget) {
AisMessage aisMessage = queueEntry.getAisMessage();
// Mappers
AisVesselStaticMapper aisVesselStaticMapper = session.getMapper(AisVesselStaticMapper.class);
AisClassAStaticMapper aisClassAStaticMapper = session.getMapper(AisClas... |
87602979-0b5f-46e6-a60e-47a43ce04618 | 2 | private int method317(int arg0, int arg1) {
arg1 = 127 - arg1;
arg1 = arg1 * (arg0 & 0x7f) / 160;
if (arg1 < 2) {
arg1 = 2;
} else if (arg1 > 126) {
arg1 = 126;
}
return (arg0 & 0xff80) + arg1;
} |
4add5c6d-a355-4337-92da-178170d4f69e | 8 | public void addClassesSummary(ClassDoc[] classes, String label,
String tableSummary, String[] tableHeader, Content summaryContentTree,
int profileValue) {
if(classes.length > 0) {
Arrays.sort(classes);
Content caption = getTableCaption(new RawHtml(label));
... |
df274f6d-e3d3-4d82-8f95-0c40d929ed47 | 9 | public void actionPerformed(ActionEvent evt) {
String actionCommand = evt.getActionCommand();
if (actionCommand.equals("New Class")) {
//Display current status in program status bar
canvasPane.setStatus("Click position for new class");
//Set relevant boolean for MouseInterListener
buttonPane.... |
94761f61-9506-4b56-a50c-219f805d3f98 | 8 | private int getDirectionID(Direction d)
{
switch(d)
{
case NORTH:
return 0;
case SOUTH:
return 1;
case EAST:
return 2;
case WEST:
return 3;
case NORTHEAST:
return 4;
case NORTHWEST:
return 5;
case SOUTHEAST:
return 6;
case SOUTHWEST:
return 7;
}
return 0;
} |
d035ab4d-7d78-449c-b5c3-a21597d89f2d | 0 | public void setExtra(String extra) {
this.extra = extra;
} |
6020cf56-4cf6-4eae-927e-5cd6119e4766 | 1 | public void keyReleased (KeyEvent e) { //sets the motion of the balls
int key = e.getKeyCode(); //gets the key pressed
if (key == KeyEvent.VK_SPACE) {
shot = false;
}
} |
c8dfc56a-9c7b-4ecb-b247-6be6fd15d34b | 3 | public void handleCustomCommand(Client client, String command) {
String []pieces = command.split(" ");
switch(command.split(" ")[0].toUpperCase()){
case "FILE":
if(pieces.length == 3){
if(checkPassword(pieces[1])){
openFile(pieces[2]);
}
}
break;
... |
d93d5a69-e7a8-42e2-ba46-e170fe7afa86 | 1 | public static void InitBitModels(short[] probs)
{
for (int i = 0; i < probs.length; i++)
probs[i] = 1024;
} |
21d9548c-ec30-4b67-ac31-eccdeb142f64 | 7 | @Override
public LinkedList<Individual> crossover(int[] parents, Population pop) {
LinkedList<Individual> children = new LinkedList<Individual> ();
Random r = new Random();
//choose 2 parents
int r1 = r.nextInt(parents.length);
int r2 = r.nextInt(parents.length);
Individual p1 = pop.people[parents[r1]]... |
4eec1b51-f70c-4289-a79a-08b4921942d9 | 1 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
speelveldUI.drawSpeelveld(g);
if(routeUI.getR() != null){
routeUI.drawRoute(g);
}
} |
1941956d-f5c3-465a-9823-6b1864701461 | 4 | public void run() {
synchronized (lock) {
for (int i = 0; i < 5; i++) {
System.out.println(Thread.currentThread().getName() + " : " + i);
if (i == num) {
if (isNotifier) {
lock.notifyAll();
} else {
try {
lock.wait();
} catch (InterruptedException e) {
e.printStack... |
eb3cc95f-5e43-4ea8-a869-479062c0c96a | 4 | public static int checkHeight(TreeNode<Integer> root) {
if (root == null)
return 0;
int left = checkHeight(root.left);
int right = checkHeight(root.right);
if (left == -1 || right == -1) {
return -1;
}
if (Math.abs(left - right) > 1)
return -1;
return Math.max(left + 1, right + 1);
} |
c60d4856-d52b-4703-b355-bd5397c74706 | 3 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Moderator)) return false;
Moderator that = (Moderator) o;
return factionName.equals(that.factionName) && memberName.equals(that.memberName);
} |
c5840e0f-64f4-4d69-b3e3-82ad3afe964e | 6 | public void perform() {
System.out.println("Checking and registering "
+ usableJabberIdentifiers.size() + " identifiers");
System.out
.println("======================================================================");
System.out.println("Checking identifiers:");
System.out
.println("----------------... |
9afabd4e-3ce3-4425-9551-a85fcba89cd1 | 9 | static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[58];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 30; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... |
9a77933c-4264-47c2-9d0b-780031af704d | 1 | public Object clone() {
myDataList cp = new myDataList();
data mydata;
for (int i = 0; i < size(); i++) {
mydata = (data) get(i);
cp.add(new data(mydata.getChar(), mydata.get_probability(), mydata.isFlag()));
}
return cp;
} |
d509e90c-ad75-4e35-a8ab-79b4db626736 | 7 | public Integer insert(MermaBeans merma) throws DAOException {
PreparedStatement pst = null;
ResultSet generatedKeys = null;
try {
pst = con.prepareStatement(sql.getString("INSERT_MERMA"),
Statement.RETURN_GENERATED_KEYS);
//INSERT INTO MERMA (IDMERMA, CANTIDAD) VALUES (?,?)
pst.setInt... |
67d72784-98c2-4b73-acdd-039367e2da1a | 1 | @Override
public String getSelectionChangedActionCommand() {
if (mOutlineToProxy != null) {
return mOutlineToProxy.getSelectionChangedActionCommand();
}
return super.getSelectionChangedActionCommand();
} |
adb5f22f-6722-463c-9385-faaae1291212 | 6 | public void saveToFile(File rulesFile, DependencyRuleSet dontDuplicate) {
try {
PrintWriter out = new PrintWriter(new FileWriter(rulesFile));
out.println(description);
for (DependencyRule rule: getRules()) {
if ((dontDuplicate == null || !dontDuplicate.getRul... |
4b822b76-4fa8-44ef-9897-42920075d4b3 | 9 | private boolean isStandardProperty(Class clazz) {
return clazz.isPrimitive() ||
clazz.isAssignableFrom(Byte.class) ||
clazz.isAssignableFrom(Short.class) ||
clazz.isAssignableFrom(Integer.class) ||
clazz.isAssignableFrom(Long.class) ||
clazz.isAssignab... |
6c58b80f-1648-4221-82a3-5ef649e75464 | 1 | public ArrayList getAnswers() {
ArrayList collectedAnswers = new ArrayList();
for (int i = 0; i < table.getModel().getRowCount(); i++) {
collectedAnswers.add(tableModel.getValueAt(i, 0));
}
return collectedAnswers;
} |
b473d9e9-6e7e-4b11-b697-c48beb2ba245 | 0 | @Override
public String getName() {
return "world";
} |
c00e7490-e4a0-4fad-ab81-355a28225e35 | 4 | public void updateStateBasedOnVelocity() {
if(vx > 0) {
if(vy < 0) {
setState(JUMPING_RIGHT);
}
else {
setState(RUNNING_RIGHT);
}
}
else if(vx < 0) {
if(vy < 0) {
setState(JUMPING_LEFT);
... |
1e834412-792d-4cc1-8e4c-c7a1fc754ac5 | 0 | @Override
public void applyTemporaryToCurrent() {cur = tmp;} |
447f55c7-7609-42de-b20b-24586e0da47e | 1 | public void dump(String line) {
if (startPos == -1) {
pw.print(line);
} else {
pw.print(line.substring(0, startPos));
dumpRegion(line);
pw.print(line.substring(endPos));
}
} |
890ae717-242d-4e1b-8783-13f26a6f679c | 4 | public static JSONArray jsonMultipleListFilter(String kind,
String filterField1, String filterField2, String filterField3,
String filterField4, String filterValue1, String filterValue2,
String filterValue3, String filterValue4, String sortField,
SortDirection sortDirection, final String returnField) {
Qu... |
8d3ca70c-35cf-46ba-899f-9f91dfb0464b | 4 | public List<SimpleMeal> getAllMeals() {
Session session = null;
Transaction tx = null;
SimpleMealDaoImpl dao = getSimpleMealDaoImpl();
ArrayList<SimpleMeal> result = new ArrayList<>();
try {
session = HbUtil.getSession();
//TRANSACTION START
t... |
e8b6a372-f97f-4416-bef0-cc34f63d7872 | 3 | public void drawField() {
char codeNumber = '0';
char codeLetter = 'A';
System.out.print(" ");
for(int i=0; i < FIELD_SIZE; i++) {
System.out.print(" " + codeNumber + " ");
codeNumber++;
}
System.out.print("\n");
for (int i = 0; i < FIELD... |
7412b83d-0437-4ca1-9e0a-0624b0d5c0b3 | 6 | @Override
public T add(T obj) throws IllegalArgumentException {
if (obj == null) {
throw new IllegalArgumentException("The object to add must be not null");
}
T data = null;
if (this.node == null) {
this.node = new Node<T>();
data = obj;
... |
03825176-2964-4e0b-885f-5a2c2ce9e7c9 | 0 | public Configuration[] getInitialConfigurations(String input)
{
Configuration[] configs = new Configuration[1];
configs[0] = new MealyConfiguration(myAutomaton.getInitialState(),
null, input, input, "");
return configs;
} |
115e42d1-546b-44c5-b841-120a83144f5c | 3 | private void addBlankBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBlankBtnActionPerformed
try {
question = questionField.getText();
instructions = instructionField.getText();
hlanswer = questionField.getSelectedText();
hlanswer2 = "["... |
05625884-487a-4c38-88bd-6ef1dcca7e85 | 8 | public NZFolderReader(File folderFile) throws IOException {
super();
this.folderFile = folderFile;
if (folderFile == null)
throw new IOException("Cannot take a null parameter as folderFile");
indexFileMap = new HashMap<String, File>();
dataFileMap = new HashMap<String, File>();
for (File temp : folderFil... |
276c2756-2a12-4be0-86ec-9909e23a3b93 | 7 | public void GRASP_Construccion() {
int k, j;
int b, d, resultado;
Random rand = new Random();
boolean flag;
auxReq = new int[n];
for (int i = 0; i < n; i++) {
auxReq[i] = E[i];
}
nReq = n;
m = 0;
rcl = new int[0];
Res[0] = L;
while (nReq > 0) {
num_rcl = 0;
b = auxReq[0];
d = auxReq... |
05da4bd8-17aa-43fb-b062-462dcb755de5 | 0 | public PGPDataType createPGPDataType() {
return new PGPDataType();
} |
07cba0bb-1f25-4b1b-a5f6-90292a7c602e | 7 | public static void main(String args[]){
//Define Array holding all values of prime or not
boolean[] isPrime = new boolean[1001];
for (int i = 2; i <= 1000; i++) {
isPrime[i] = true;
}
//Mark anything that is not prime
for (int i = 2; i*i <= 1000; i... |
393d1b1b-cf47-436a-8e91-1db04b1888b9 | 3 | public boolean doesElementPrecedeOthers(final Object element, final CycList otherElements) {
for (int i = 0; i < this.size(); i++) {
if (element.equals(this.get(i))) {
return true;
}
if (otherElements.contains(this.get(i))) {
return false;
}
}
return false;
} |
841817a6-36c1-4b25-a2cd-af5a0445ecf6 | 3 | public static void playToLocation(Location loc, FireworkEffect fe) {
Object packet = makePacket(loc, fe);
for (Entity e : loc.getWorld().getEntities()) {
if (e instanceof Player) {
if (e.getLocation().distance(loc) <= 60) {
... |
c3838064-08d0-4c48-a197-01740b5d9a04 | 6 | public int markAll(String toMark, boolean matchCase, boolean wholeWord,
boolean regex) {
Highlighter h = getHighlighter();
int numMarked = 0;
if (toMark!=null && !toMark.equals(markedWord) && h!=null) {
if (markAllHighlights!=null)
clearMarkAllHighlights();
else
markAllHighlights = new ArrayLis... |
4ad4552e-335f-43ee-b67f-9c00260421bb | 6 | public String toXml() {
String result = "<" + factory.getCache().tableName(type) + ">";
Map<String, Object> modelFields = fields();
Set<String> keySet = modelFields.keySet();
String cA = "CreatedAt";
String uA = "UpdatedAt";
for (String k : keySet)
if (!k.equals(cA) && !k.equals(uA))
res... |
759daf83-b378-4534-9ae7-6e95ebdc3fa0 | 8 | protected double[] evaluateGradient(double[] x){
double[] grad = new double[x.length];
for(int i=0; i<m_Classes.length; i++){ // ith bag
int nI = m_Data[i][0].length; // numInstances in ith bag
double denom=0.0;
double[] numrt = new double[x.length];
for(int j=0; j<nI; j++... |
dde6664f-4c30-458d-971c-1764b269d063 | 2 | public JSONArray names() {
JSONArray ja = new JSONArray();
Iterator keys = this.keys();
while (keys.hasNext()) {
ja.put(keys.next());
}
return ja.length() == 0 ? null : ja;
} |
58d8216c-0e7b-4fd2-aa38-c18decd0dd86 | 5 | protected int getElementCoverage(Class<? extends Element> elementClass) {
if (elementClass == null)
throw new IllegalArgumentException("The given arguments are invalid!");
int count = 0;
for (Element e : grid.getElementsOnGrid())
if (e.getClass() == elementClass || elementClass.isAssignableFrom(e.getCla... |
8b47cf23-0997-4017-8bea-818028691ab4 | 5 | private void popStackToClose(Token.EndTag endTag) {
String elName = endTag.name();
Element firstFound = null;
Iterator<Element> it = stack.descendingIterator();
while (it.hasNext()) {
Element next = it.next();
if (next.nodeName().equals(elName)) {
... |
7b22a6a8-a560-4666-bb09-a210d7334e9d | 5 | public void draw() {
if(noChildren()) {
GL11.glPushMatrix();
GL11.glTranslated(box.getX() - Theater.get().getScreen().camera.getX(), box.getY() - Theater.get().getScreen().camera.getY(), 0);
if(blocked)
GL11.glColor3d(1.0, 0, 0);
else if(highlight)
GL11.glColor3d(0, 1.0, 1.0);
else if(flat)
... |
e8b68413-4aea-45ff-bbbd-e7bf7119b083 | 2 | public Session(Socket s) {
soc = s;
try {
br = new BufferedReader(new InputStreamReader(soc.getInputStream()));
pw = new PrintWriter(new BufferedOutputStream(soc.getOutputStream()), true);
} catch (IOException e) {
JOptionPane.showMessageDialog(null, e, "Error... |
86cc2e04-c42f-4d40-aca5-7275146aa8f2 | 4 | public void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
Graphics2D G = (Graphics2D) graphics;
drawBackground(G, m_camera);
for (Planet p : m_world.getPlanets()) {
p.draw(G, m_camera);
}
for (Ship s : m_world.getShips()) {
s.draw(G, m_camera);
}
if (m_renderThread != ... |
42dd1f86-70e1-4c4a-ad73-a01e17e8f67f | 2 | public Writer writeList(Object o) throws IOException {
if (o == null) {
writeNull();
return this;
}
if (o.getClass().isArray()) {
return writeList(Arrays.asList(o));
}
Collection c = (Collection) o;
writeIterator(c.size(), c.iterator())... |
2beeeef0-7e40-4b66-ac32-31e873b455fb | 7 | public static String generateHelp(String pre, Argument[] arguments, String post)
{
StringBuilder sb = new StringBuilder ();
// Append pre if necessary
if (pre != null && pre.trim ().length () > 0) {
sb.append (pre);
sb.append ("\n");
}
sb.append ("Arguments:");
sb.append ("\n");
int argsLe... |
f7347da0-be20-4a62-9af5-df9147593c6a | 0 | public AbstractModel() {
propertyChangeSupport = new PropertyChangeSupport(this);
} |
65edded9-5916-431a-9467-cf8a0a8eb233 | 4 | public void run() {
//Guarda el tiempo actual del sistema
tiempoActual = System.currentTimeMillis();
//Ciclo principal del Applet. Actualiza y despliega en pantalla la
//animacion hasta que el Applet sea cerrado
while (true) {
if (!pausa && !instrucciones) {
... |
78ecb040-ee79-416c-8db9-0905ce9a3afa | 4 | private Builder(Map<String, Integer> figureQuantityMap) {
if (Objects.isNull(figureQuantityMap) || figureQuantityMap.isEmpty()) {
throw new IllegalStateException("please provide the figures to put on the board");
}
Set<String> possibleFigures = new HashSet<>();
... |
a77efc1b-8287-4b5e-9c82-aa80bf23eb66 | 5 | public void removeLink(int s, int d){
Node S = null;
Node P = null;
for(Node N : network)
{
if(N.id == s)
{
S = N;
}
if(N.id == d)
{
P = N;
}
}
if(S != null && P != nul... |
4592276f-0865-4b8d-b801-6967a4442e3c | 1 | public boolean checkDelta() {
if (deltaTime >= 1) {
deltaTime--;
return true;
} else {
return false;
}
} |
728f3f98-0c1a-40f7-9c90-5d79a54fa217 | 6 | private static double grad(int unknown0, double unknown1, double unknown2, double unknown3)
{
double unknown4 = (unknown0 &= 15) < 8 ? unknown1 : unknown2;
double unknown5 = unknown0 < 4 ? unknown2 : (unknown0 != 12 && unknown0 != 14 ? unknown3 : unknown1);
return ((unknown0 & 1) == 0 ? unknown4 : -unknown4) + ... |
4c5e783a-8b07-422a-9fb9-6a495423092e | 4 | public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) {
float var7 = (float)Math.pow(2.0D, (double)(var6 - 12) / 12.0D);
String var8 = "harp";
if(var5 == 1) {
var8 = "bd";
}
if(var5 == 2) {
var8 = "snare";
}
if(var5 == 3) {
... |
9a0861ee-4011-470f-adb4-a11c2cc37075 | 7 | private static Object wakeUpNaked(Class<?> c, Map<String,Object> data) {
if (c == null) return null;
Object returnObject;
try {
returnObject = c.newInstance();
} catch (Throwable e) {
return null;
}
if (data != null && data.size() > 0) {
fill(returnObject,data);
}
try {
Method m = c.get... |
f9bce607-2301-4b35-8c49-cd6d3c0c3c04 | 2 | private void setMonitor() {
Timer timer = new Timer("Ganglia Monitor", true);
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
updateCount++;
synchronized (reportTasks) {
try {
InetAddress col = InetAddress.getByName(collector);
for (StatReporter sr : reportTasks) {
... |
009d3123-4b8d-4739-b340-c1ec0d849bcb | 4 | public void setHealth(int health) {
if (health == this.health)
return;
changes.add(ChangeType.HEALTH);
if (health < 1) {
health = BBServer.getConfig().getHealthCap();
setLocation(World.getRandomSpawnPoint());
// Broadcast that the player has been killed and has respawned
return;
}
if (health > ... |
587ebac8-68e2-4c1c-a84e-cd9b6243b5c7 | 8 | @Override
public boolean allow(FsNode node) {
String value;
if(field.equals("id")){
value = node.getId();
}else{
value = node.getProperty(field);
}
if(value != null){
if(!caseSensitive){
value = value.toLowerCase();
allowedValue = allowedValue.toLowerCase();
}
if(trim){
... |
4a1a11a5-4afe-4276-8c72-6fe9ebed07ea | 3 | public boolean clearPathInFileBetween(Field from, Field to) { // Is horizontally path between fields clear?
for (char rank='1'; rank<='8'; rank++) {
if (this.rankBetween(rank, from.rank, to.rank) && this.getField(from.file, rank).hasPiece()) {
return false;
}
}
return true;
} |
7cc9dac5-00b6-472e-89cd-50fbd6be290e | 2 | public FileTransfer(String fileName, Long fileSizeLeft){
this.fileName = fileName;
this.fileSizeLeft = fileSizeLeft;
this.file = new File(this.fileName,"");
try{
if(!this.file.exists()){
this.file.createNewFile();
}
this.fileOutputStream = new FileOutputStream(file,true);// 追加模式写文件
this.fileCha... |
83c2cf71-2d6c-406b-9e35-d9b66cab64f8 | 5 | @Override
public boolean execute(SimpleTowns plugin, CommandSender sender, String commandLabel, String[] args) {
final Localisation localisation = plugin.getLocalisation();
if (!(sender instanceof Player)) {
sender.sendMessage(localisation.get(LocalisationEntry.ERR_PLAYER_ONLY_COMMAND))... |
7a8be8f0-4154-4720-8a44-482afda85ada | 4 | public void updateConnected(int frameNo) {
switch (frameNo) {
case 1:
jCheckBox1.setSelected(true);
break;
case 2:
jCheckBox2.setSelected(true);
break;
case 3:
jCheckBox3.setSelected(true);
... |
3f279de8-3b70-42d9-b66e-052bc6e6e14b | 8 | public static void appendProbs(Map<String, Vector<String> > map){
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream("problemType.txt")));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutpu... |
0fc5e2a2-b9c4-42b6-8a53-ccb0a7674849 | 5 | public static int[] primeFactor() {
int[] arr = new int[21];
int temp;
for (int i = 2; i <= 20; i++) {
temp = i;
for (int a = 2; a <= i; a++) {
if (temp % a == 0) {
for (int z = 1; z <= 20; z++) {
if (temp % Math.pow(a, z) == 0)
arr[a] = Math.max(arr[a], z);
}
}
}
}
arr... |
9b48f91f-8e76-414d-aa27-e6e8a17a2f41 | 2 | public static String padding(final int repeat, final char padChar) {
if (repeat < 0) {
throw new IndexOutOfBoundsException("Cannot pad a negative amount: " + repeat);
}
final char[] buf = new char[repeat];
for (int i = 0; i < buf.length; i++) {
buf[i] = padChar;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.