method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0c6fdb87-a4ca-48ec-88ff-be3417c4f1a8 | 6 | public static String parseComment (XmlTree t)
throws XmlReaderException
{ StringBuffer s=new StringBuffer();
Enumeration e=t.getContent();
while (e.hasMoreElements())
{ XmlTree tree=(XmlTree)e.nextElement();
XmlTag tag=tree.getTag();
if (tag.name().equals("P"))
{ if (!tree.haschildren()) s.append("\n"... |
7a86a74c-858f-459a-8657-67988fae6203 | 9 | @Override
public final void animate() {
int var1;
int var2;
float var3;
int var5;
int var6;
int var7;
int var8;
int var9;
for (var1 = 0; var1 < 16; ++var1) {
for (var2 = 0; var2 < 16; ++var2) {
var3 = 0F;
... |
e9048373-914d-4439-9b52-3341b819e8fb | 0 | @Before
public void setUp() {
} |
dffa0675-b6e2-4774-b6a8-b32cbfd33ff8 | 7 | public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
if (par1World.getBlockMaterial(par3, par4, par5) != Material.water)
{
return false;
}
int i = par2Random.nextInt(numberOfBlocks - 2) + 2;
int j = 1;
for (int k = ... |
006ceb3a-0daf-45ab-9ff3-093118394f66 | 2 | public void setMainClass(String mainClass) {
if ((mainClass == null) || (mainClass.length() == 0)) throw new IllegalArgumentException("Main class cannot be null or empty");
this.mainClass = mainClass;
} |
641219a9-6150-4b40-a2f3-5a7d0a6a4ccc | 4 | private boolean isEnpassant(Piece gonnaMovePiece, Position gonnaMovePos) {
if (gonnaMovePiece.unicode == "\u2659"|| gonnaMovePiece.unicode == "\u265F") {
if (isEmptyPlace(gonnaMovePos) && gonnaMovePiece.attackAblePosList.contains(gonnaMovePos)) {
return true;
}
}
return false;
} |
73c40f83-2cfe-4c03-8946-a429002497df | 2 | private void AbajoM() {
//Abajo
Punto temp = vibora.get(0);// La antigua Cabeza
Punto p = new Punto();
p.x = temp.x;
p.y = temp.y + 1;
if (validacion(p)) {
List<Punto> nueva = new ArrayList<Punto>();
nueva.add(p);
nueva.addAll(vibora);
if (!esComida(p))
nueva.remove(nueva.size() - 1);
... |
16903c19-813b-4067-909d-a9a12a8c3695 | 1 | public void init(){
for (int i = 0; i < 1000 ; i++) {
Particle p = new Particle();
p.life = 0.05F;
p.fade = (float) (Math.random()/100 + 0.03F);
p.x = 40;
p.y = 40;
particles.add(p);
}
} |
42f3b7c2-c945-447a-93a8-2b09302121d2 | 0 | public void setAreaC(CompanyType area1) {
AreaC = area1;
} |
9851851a-7a58-46d9-bc9d-dcfb1c8b2eab | 6 | private static Map<String, List<Double>> parseFile(String filename, int idLine, int id) {
String stationLabel;
Map<String, List<Double>> stationMap = new HashMap<String, List<Double>>();
String regex = "\"([^\"]*)\".*\",([\\d\\.]+),([\\d\\.]+)";
Pattern pattern = Pattern.compile(regex);
Matcher m;
... |
82d61dfa-483c-4db6-b80f-48df97ceaa56 | 6 | public final WaiprParser.handler_return handler() throws RecognitionException {
WaiprParser.handler_return retval = new WaiprParser.handler_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token ID24=null;
Token char_literal25=null;
Token char_literal27=null;
Token char_literal28=null;
... |
cab04670-f115-4987-82bb-8b1ad6dd3979 | 4 | public static void sort2(Tuple[] arr) {
int R = 256;
int[] count = new int[R + 1];
Tuple[] aux = new Tuple[arr.length];
//Compute frequency counts
for (Tuple t : arr) {
count[t.value + 1] += 1;
}
//Transform counts to indices
for (int i = 0; i... |
9971f1dd-246a-4f70-803e-38053816cf96 | 1 | public void showArmorHUD(boolean s) {
if (armorHUD != null) {
armorHUD.shouldRender = s;
}
} |
1e84ee45-374e-41c2-9737-8557a715e93f | 9 | @Override
public int hashCode() {
int hash = 3;
hash = 37 * hash + (this.rootElement != null ? this.rootElement.hashCode() : 0);
hash = 37 * hash + (this.documentUrl != null ? this.documentUrl.hashCode() : 0);
hash = 37 * hash + (this.documentName != null ? this.documentName.hashCode... |
8349eead-fda8-4774-831f-85624999f617 | 0 | public static void main(String[] args) {
print("a string");
print(3.14);
} |
85b42d93-755c-45df-ab04-836096d7f2ee | 4 | public List<List<Integer>> subsetsWithDup(int[] num) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
int number = 1 << num.length;
Arrays.sort(num);
for (int i = 0; i < number; i++) {
List<Integer> list = new ArrayList<Integer>();
for (int j = 0; j... |
bea34395-357e-4078-ac1d-362c6162bc9b | 1 | public Duck(HuntField field) {
this.alive = true;
this.type = 'D';
this.field = field;
synchronized (field) {
this.position = new Position(random.nextInt(field.getXLength()), random.nextInt(field.getYLength()));
while (field.isOccupied(position)) {
... |
7771e34d-ed44-4ebd-9d07-e560e023bf12 | 1 | protected Label readLabel(int offset, Label[] labels) {
if (labels[offset] == null) {
labels[offset] = new Label();
}
return labels[offset];
} |
2e642716-7737-469c-b9f7-fff1a4acba84 | 9 | protected boolean isRailValid(World world, int x, int y, int z, int meta) {
boolean valid = true;
if (!world.isSideSolid(x, y - 1, z, ForgeDirection.UP))
valid = false;
if (meta == 2 && !world.isSideSolid(x + 1, y, z, ForgeDirection.UP))
valid = false;
else if (me... |
a3ca3e06-fd03-446c-becd-5ce562e352d7 | 0 | @Override
public void send(String command, Object params) throws Exception {
checkInitiate();
final IRemoteCallObject rco = new RemoteCallObject();
synchronized (rco) {
rco.setCallObjectId(getNextCallId());
rco.setMetaDataObject(new RemoteCallObjectMetaData(command, RemoteCallObjectType.Messa... |
22e5e87c-b6ec-4422-a44b-1d9cea3ff1ad | 5 | private boolean isDataBetter(float[][][] tech, int id, int i) {
float[] technicals = TECHNICAL_PRICE_DATA.get(dbSet.get(id)).get(
tech[id][i][0]);
if (technicals == null)
return true;
int ok_old = 0;
for (float f : technicals)
if (f == f)
ok_old++;
int ok_new = 0;
for (float f : tech[id][i])... |
c12c9946-901a-486b-bba2-065271bc1ffe | 7 | public static String getTag(BufferedReader reader, String line, String tag) throws TheAppException {
line = line.substring(line.indexOf(tag));
StringBuilder builder = new StringBuilder();
while (line != null && (line.indexOf(">")) == -1) {
builder.append(line);
line = get... |
75098c45-b751-4273-bb53-6de3d3a06e94 | 5 | public void addChar(char ch) {
ch = normalize(ch);
char lastchar = grams_.charAt(grams_.length() - 1);
if (lastchar == ' ') {
grams_ = new StringBuffer(" ");
capitalword_ = false;
if (ch==' ') return;
} else if (grams_.length() >= N_GRAM) {
... |
e1979cba-3229-45b4-861e-ed10657d62e8 | 3 | private void parseXml(final String filePath){
DocumentBuilderFactory docBldFct = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder docBld = docBldFct.newDocumentBuilder();
Document doc = docBld.parse(filePath);
traceDom(doc);
} catch (ParserConfigurationException e1) {
// TODO Auto-generated... |
813c3678-5113-45d4-924f-75a0701c6743 | 7 | void drawParticipant (Graphics g){
g.drawImage(img,x,y, null); // draw player
switch(stance){
case forward:
if (shift%2 == 1){
img = imgForward;
g.drawImage(img, x, y, null); // draw player
}
else {
img = imgForward0;
g.drawImage(img, x, y, null); // draw player
... |
977a98cf-9a6b-406b-bdbb-8e2be002adad | 0 | @Override
public void setUser(final User user) {
this.user = user;
} |
57ea4920-47c3-4f11-8cd6-0921c61c80e0 | 2 | @Override
public void endTurn() {
if (cooldown > 0) {
cooldown--;
if (cooldown == 0) {
tile = startingPosition;
tile.addBomber(this);
}
//other end-of-turn actions not possible if still dead.
}
} |
74414c0d-1fa7-408c-9f12-7065c0b205fc | 4 | public static boolean isAllLowerCase(String cs) {
if (cs == null || isEmpty(cs)) {
return false;
}
int sz = cs.length();
for (int i = 0; i < sz; i++) {
if (Character.isLowerCase(cs.charAt(i)) == false) {
return false;
}
}
return true;
} |
3b0020f4-08f8-4407-b344-0cbdd1318021 | 1 | public String toString(){
StringBuilder builder = new StringBuilder(Integer.toString(itemId));
for(int i = 0; i < userIds.length; i++){
builder.append("(").append(userIds[i]).append(",").append(ratings[i]).append(")");
}
return builder.toString();
} |
e6ffd7fa-42cf-4751-a55d-799f5cb1a02f | 5 | public static int silog2(int v) {
while (true) {
if (v == 0) return 0;
if (v > 0) {
int l = 0;
while (v != 0) {
l++;
v >>= 1;
}
return l + 1;
}
if (v == -1) ret... |
79875fb1-3a7a-4401-b368-e8b92e7a3eb5 | 8 | @Override
public double unsafe_get(int row, int col) {
if( row != 0 && col != 0 )
throw new IllegalArgumentException("Row or column must be zero since this is a vector");
int w = Math.max(row,col);
if( w == 0 ) {
return a1;
} else if( w == 1 ) {
... |
cd8d06d2-a3de-4367-9163-bcc5a53f6744 | 7 | @Override
public void update(GameContainer c, StateBasedGame sbg, int delta)
throws SlickException {
time.update(delta);
character.update(c,delta);
Input input = c.getInput();
updateCharacterMovement(input,delta);
for(Monster monsters : monster){
monsters.update(c);
if(monsters.CheckMonInters... |
5e368827-1147-4a5f-99f2-76f59c13b12b | 6 | public static void fetchAllCategories() {
Thread thread = new Thread() {
@Override
public void run() {
super.run();
String updateString = "";
int fetched_cat = 0;
int fetched_chan = 0;
int size_cat = categor... |
fcb49d9e-53b8-4c54-be8a-ccacb08be48f | 7 | private Entry<K,V> getPrecedingEntry(K key) {
Entry<K,V> p = root;
if (p==null)
return null;
while (true) {
int cmp = compare(key, p.key);
if (cmp > 0) {
if (p.right != null)
p = p.right;
else
... |
1bbaf5af-90e9-4bde-a95a-b954d4ba5b56 | 8 | public boolean saveCommandHistory(String history)
{
try
{
if ((history == null) || (this.alMyCommandHistory.contains(history.trim())))
{
return true;
}
if (this.alMyCommandHistory.size() < 10)
{
if ((history != null) && (history.length() > 150))
{
... |
71c8aa52-9411-4bad-9591-02a1f43ba0eb | 1 | private static boolean isNamePart(int c) {
return c != ';' && c != '<';
} |
284540b5-1b83-4f1a-87cd-230e7c5acec8 | 5 | public CheckResultMessage check9(int day) {
int r = get(27, 5);
int c = get(28, 5);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r + 3 + day, c, 6).compareTo(
getValue(r + 2 + day, c + 3, 6))) {
return ... |
f72a6f6c-dcbd-41e0-b521-f1dda938d623 | 9 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (ativo ? 1231 : 1237);
result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((idioma == null) ? 0 ... |
006d55c5-0a48-408c-a896-53d4d3f9cee2 | 3 | public static void main(String[] args) {
ArrayList<Integer> arrayListCopy; // copy of the unsorted array
ArrayList<Integer> unsortedArrayList; // array to hold unsorted random numbers
int itemCount = 10; // desired count of items in lists
int maxNumber = 20; // upper bound of random numb... |
4f713ddc-f929-44bf-b01b-f87df51cf865 | 7 | public void editExhibit(String name, String newName, String description, int[] location, ArrayList<MuseumItem> museumItemList) {
ArrayList<String> updatedlist = new ArrayList<String>();
List<Exhibit> list = ExhibitDAO.find();
for(Exhibit e: list) {
if(e.getExhibitName().equals(name))... |
0febc272-de0e-4144-814e-405181e8067f | 7 | public static void main(String[] args) throws Exception {
weka.core.logging.Logger.log(weka.core.logging.Logger.Level.INFO, "Logging started");
LookAndFeel.setLookAndFeel();
try {
// uncomment to disable the memory management:
//m_Memory.setEnabled(false);
m_Viewer = new ArffVie... |
8975c96f-0f96-4980-b4a9-ad7babaae183 | 8 | public static void myPage(String id, Vector<Reserve> pre, Vector<Reserve> current) throws SQLException, NamingException, Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
DataSource ds = getDataSource();
java.util.Date checkOut;
java.util.Date currentDay = new java.util... |
da2f7403-e16f-4351-ad6c-de7bc3c3092c | 6 | public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int ... |
49f3b1a5-1bf2-4e40-930f-bc040c331327 | 0 | public Account() {
} |
8b06ce7d-bd8d-4cf2-bc72-833baaa9097e | 1 | private void tick() {
if (activeComponent != null)
activeComponent.tick(gameControl);
} |
4a2ef6ba-1abd-42d6-8f83-092f9e0160d9 | 1 | public PreparedStatementCallback<?> getAction() {
return action;
} |
372d40a3-ab5a-467c-a48a-2786e00ebffb | 9 | @Test
public void testMarkReset()
throws IOException
{
for (int i = 0; i < samples.length; i++)
{
ByteArrayInputStream sample = samples[i];
RepeatableByteSource source = new ByteInputStream(sample, BUFFER_SIZE);
source.mark(0);
int pos = SIZES[i];
if (BUFFER_SIZE - 2 < pos)
pos = BUFFER_SIZE -... |
0c72720d-a406-489d-8747-7027af83e55e | 2 | public void run() {
String msg, response;
ChatServerProtocol protocol = new ChatServerProtocol(this);
try {
// petla czytajaca linnie od klienta i przekazujaca odpowiedz do klienta
while ((msg = in.readLine()) != null) {
response = protocol.process(msg);
... |
e911d03c-76f2-4565-9849-d5b9ce45af22 | 8 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String username = txtUser.getText();
String password = jPasswordField1.getText();
// JDBC driver name and database URL
final String JDBC_DRIVER = "com.mysql.jdbc.Drive... |
cdbd4dec-b75f-4bde-b89a-925f05e9fb16 | 4 | protected String formatLatitude(double latitudeInDegrees) {
double latitude = ((latitudeInDegrees + 180.0) % 360.0) - 180.0;
if (Math.abs(latitude) < 1.0 / 120.0) {
return "0°";
}
if (latitude > 90.0) {
latitude = 180.0 - latitude;
}
if (latitude <... |
e5261702-43c0-4189-9282-e401d4513deb | 7 | public final void dumpDecoding(PrintStream port) {
int rangeStart = -1; // local code (if >= 0)
int delta = 0;
for (int i = 0; i <= 0x100; i++) {
char unicode = i <= 0xFF ? codes[i] : 0;
if (rangeStart >= 0 && (unicode == 0 || unicode - i != delta)) {
dump... |
954e3a9a-a81a-4ac0-989e-47188dfcff10 | 4 | private void initLogging(int consoleLevel, int fileLevel,
boolean exitIfFileFails) {
Level consoleLogLevel = LogFormatter.getLogLevel(consoleLevel);
Level fileLogLevel = LogFormatter.getLogLevel(fileLevel);
Level logLevel = consoleLogLevel.intValue() < fileLogLevel.intValue()
? consoleLogLevel :... |
0862de6b-4d41-4351-a7e0-fc6dcde5f961 | 4 | public int movesLeft() {
if(whoWon() != null){
return 0;
}
int moveCount = 0;
for (int x = 0; x < getRowSize(); x++) {
for (int y = 0; y < getColumnSize(); y++) {
moveCount += getMoveAt(x, y) == null ? 1 : 0;
}
}
return ... |
2e010fed-238a-4868-93f2-fd497c384e54 | 3 | private void clickedConfirm()
{
this.setEnabled(false);
Language lang1 = (Language) boxLang1.getSelectedItem();
Language lang2 = (Language) boxLang2.getSelectedItem();
if ((lang1.getID().equals(lang2.getID()))
|| txtName.getText().length() == 0
|| txtDescription.getText().length() == 0 )
{
this.s... |
43aa73d3-6603-4bf0-a6f6-6ecccb6a5764 | 8 | * @param var2 The second list
* @return result The sum of var1 and var2
*/
static LinkedList<Integer> add(LinkedList<Integer>var1, LinkedList<Integer>var2){
LinkedList<Integer> result = new LinkedList<Integer>(); //The sum of var1 and var2
Iterator<Integer> itr1 = var1.iterator();
Iterator<Integer> itr2 ... |
3851744c-9c20-45a4-993f-6f61f85194ca | 5 | public static int loadTexture(BufferedImage image, boolean flip){
int[] pixels = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_P... |
9d690802-a3e8-47f9-9e17-06a12d2e4354 | 5 | private FreeTimeContainer getBestContainer(Task toPlan, ArrayList<FreeTimeContainer> possibilities) throws PlanningException {
FreeTimeContainer best = null;
Duration longestDuration = null;
int index = -1;
if (possibilities != null && possibilities.size() > 0) {
index = getFirstPlannableContainerIndex(toPl... |
bf89d578-7396-4520-8da0-1f8d71757763 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
16d0cf42-64eb-4405-abf4-c11dbba66f60 | 1 | public void makeSelection() {
if(!list.getSelectedValue().startsWith("-1")) {
selection = list.getSelectedValue();
dispose();
}
} |
233276dd-de04-4101-9258-fd1376d4032f | 2 | private void startUpLogicalQueue(GameTime gameTime) {
// Iterate and call the start ups of any logical children which are
// waited to be added to the GameLayer
for (ILogical logicalObject : logicalQueue.getAllWaiting()) {
logicalObject.startUp(gameTime);
}
// Get the list of objects which wanted to be re... |
46917e0d-0ffc-4787-94bd-0584ae556d98 | 9 | @Override
public double evaluate(int[][] board) {
int r = 0;
int n = board.length;
int m = board[0].length;
int x = 0, y = 0;
boolean snakeFinished = false;
while (y != m) {
if(snakeFinished) {
r = Math.max(r, board[x][y]);
}
... |
313e240e-5e24-47cd-a2e1-4a3e7247c0ac | 4 | @Override
public void visitStoreExpr(ClassNode c, MethodNode m, StoreExpr expr) {
MemberRef field;
if(expr.target() instanceof FieldExpr) {
field = ((FieldExpr) expr.target()).field();
} else if(expr.target() instanceof StaticFieldExpr) {
field = ((StaticFieldExpr) expr.target()).field();
} else {
ret... |
4c5a01fc-c096-431a-935d-335f010be194 | 3 | public boolean isSyncCurrentPosition(int syncmode) throws BitstreamException
{
int read = readBytes(syncbuf, 0, 4);
int headerstring = ((syncbuf[0] << 24) & 0xFF000000) | ((syncbuf[1] << 16) & 0x00FF0000) | ((syncbuf[2] << 8) & 0x0000FF00) | ((syncbuf[3] << 0) & 0x000000FF);
try
{
source.unread(syncbuf, 0,... |
b837fceb-0d42-4c0b-b294-0eb954253f53 | 7 | public boolean isSymmetric(TreeNode root) {
boolean res = false;
L= new ArrayList();
R= new ArrayList();
if( root.left==null && root.right==null){
res = true;
}else if( root.left == null || root.right == null){
res = false;
}else{
this.inorder(root.left);
this.inord... |
0abd5b69-5a94-4775-b89e-9cc48c61f127 | 8 | private void updateBackgroundText() {
// Setup the semitransparent background timeText
backgroundTimeText.setTextOrigin(VPos.BASELINE);
backgroundTimeText.setTextAlignment(TextAlignment.RIGHT);
backgroundSecondText.setTextOrigin(VPos.BASELINE);
backgroundSecondText.setTextAlignm... |
8d937e6f-3d63-45bf-a23a-06c64a5982d3 | 3 | private static void createDB() {
Logger.log("Creating new database.");
Connection connection = null;
Statement statement = null;
try {
Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:"+Settings.DB_PATH);
statement = connection.createStatement();... |
c2a58591-867b-4714-afb5-4379e802561a | 8 | private boolean isSimpleTypeWrapper() {
if (typeName.equals("java.lang.Byte")) {
return true;
}
if (typeName.equals("java.lang.Short")) {
return true;
}
if (typeName.equals("java.lang.Integer")) {
return true;
}
if (typeName.equ... |
30acf512-bfa9-49a4-827c-d57ed38e8164 | 6 | public void paintComponent(Graphics g) {
super.paintComponent(g);
Rectangle area = g.getClip().getBounds();
g.setColor(Color.WHITE);
g.fillRect(area.x, area.y, area.width, area.height);
if (owner.cellSize > 3) {
g.setColor(new Color(0.2F, 0.2F, 0.2F, 1.0F));
for (int x = area.x; x < area.... |
0fed1487-9bfe-4b07-a89b-35008ff93394 | 7 | public Symbol parse() throws java.lang.Exception
{
/* the current action code */
int act;
/* the Symbol/stack element returned by a reduce */
Symbol lhs_sym = null;
/* information about production being reduced with */
short handle_size, lhs_sym_num;
/* set up direct ref... |
59b9ca44-552a-499e-8433-6cb35ed30a8f | 2 | public double computeLogLikelihood(ArrayList<Integer> data, double parameter) {
double sum = 0;
for (Integer i : data) {
if (i == 1) {
sum += Math.log(parameter);
}
else {
sum += Math.log(1 - parameter);
}
}
return sum;
} |
cd0ed2b0-f387-488c-a10b-06cecdf24fa7 | 6 | protected void prepareBackup() {
// start broadcast informing the players about the backup
String startBackupMessage = pSystem.getStringProperty(STRING_START_BACKUP_MESSAGE);
if (startBackupMessage != null && !startBackupMessage.trim().isEmpty()) {
System.out.println(startBackupMess... |
74451e80-54af-4c22-a824-a0d14ce5902a | 1 | private static void sort(String alg, Comparable[] a)
{
String c = (alg.split("[.]"))[0];
String m = (alg.split("[.]"))[1];
try
{
Class.forName(c).getMethod(m, Comparable[].class)
.invoke(null, (Object) a);
System.out.println("Sort method : " + alg);
// SortHelper.show(a);
assert SortHelper.isS... |
4e74248c-cbfb-47d4-93a0-51f3046f9bea | 1 | private List<String> shuffle(List<String> list) {
List<String> listCopy = Lists.newArrayList(list);
Random rnd = new Random();
List<String> res = Lists.newArrayList();
while (!listCopy.isEmpty()) {
int index = rnd.nextInt(listCopy.size());
res.add(listCopy.remove(index));
}... |
c3fe26ec-91e5-4824-abf3-2476102e36d5 | 2 | private void recalculateWordsInUse()
{
// Traverse the bitset until a used word is found
int i;
for (i = wordsInUse - 1; i >= 0; i--)
if (words[i] != 0)
break;
wordsInUse = i + 1; // The new logical size
} |
2613d5c8-85ca-4002-9082-6fa4ed3e09c1 | 2 | public Object clone()
{
if (!sizeIsSticky)
trimToSize();
try
{
BitSet result = (BitSet) super.clone();
result.words = words.clone();
result.checkInvariants();
return result;
}
catch (CloneNotSupportedExcepti... |
95b55195-1d34-48fc-a8de-02476d9d2aec | 1 | public int depth() {
EvalContext p = this;
int depth = 0;
while(p!=null) {
depth++;
p = p.parent;
}
return depth;
} |
c94e3a51-ecad-43ac-a4fd-d451d293f148 | 2 | private int leechers() {
int count = 0;
for (TrackedPeer peer : this.peers.values()) {
if (!peer.isCompleted()) {
count++;
}
}
return count;
} |
c2132287-cf9c-4a94-b555-a99873d4ecf9 | 6 | Function parseLines(final List<String> lines) throws AssemblerSyntaxException {
resetCurrentLine();
for (final String line : lines) {
incCurrentLine();
if (StringUtils.isBlank(line)) {
continue;
}
final List<Token> tokens = scanner.parse(... |
aa555d5c-b6f2-41e7-b394-889bbb73fc2d | 5 | public void paint(Graphics paramGraphics)
{
if ((!this.Stopped) && (this.CurrentImage != null))
{
deliverImagePaintedEvent();
if ((this.CurrentImageReady) || (this.ProgressiveDraw)) {
paramGraphics.drawImage(this.CurrentImage, 0, 0, this);
return;
}
if (this.PreviousI... |
9e87f61c-d336-43a5-ab33-b06c0d786759 | 7 | private static void watcher() {
try {
WatchService watchService = FileSystems.getDefault().newWatchService();
Path dir = Paths.get("/home/xander/test/");
//registration for file/directory
//registration is done on the object being watched. In this case the Path cl... |
a339bd0e-bfe7-4e09-afad-cb2081e5449d | 6 | public String login() {
dbData(name);
if ((name.toUpperCase().equals(dbName.toUpperCase()) && password.equals(dbPassword))) {
FacesContext.getCurrentInstance().getExternalContext()
.getSessionMap().put("email", name);
FacesContext.getCurrentInstance().getExter... |
2cbab81a-ce4f-4346-9b08-17c89607b45e | 1 | public boolean isEmpty ( ){
if(myCount>0){
return false;
}else{
return true;
}
} |
6d8f1b28-1aeb-4679-9a98-1360e726aa1f | 8 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : "";
if((mob.isAttributeSet(MOB.Attrib.NOBATTLESPAM) && (parm.length()==0))||(parm.equalsIgnoreCase("ON")))
{
mob.setAttribute(MOB... |
e7b44d1b-e4fb-4144-8f80-323e1d4ae9ad | 6 | @Override
public boolean equals (final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass () != obj.getClass ()) {
return false;
}
final Cell other = (Cell) obj;
... |
cbe03f77-9f77-4adc-b3d0-f83ef633219b | 7 | public ParseConfig(BufferedReader configFile) throws IOException {
String line;
while ((line = configFile.readLine()) != null) {
line = line.trim();
String[] tokens = line.split("\\s"); //split on whitespace
if (tokens.length < 2)
continue;
if (line.charAt(0) == COMMENT)
continue;
if... |
5328392c-f8e8-44cd-bfe5-8c6c681121dc | 7 | @Override
public boolean equals( Object o ) {
if ( o == null )
return false;
if ( o.getClass( ) != this.getClass( ) )
return false;
@SuppressWarnings( "unchecked" )
Range<T> oRange = (com.claygregory.common.data.Range<T> ) o;
return
( this.getLowerBound( ) == null && oRange.getLowerBound( ) == nu... |
d211a808-7ae1-4784-aeb9-46a6ff174301 | 8 | public void RightInteract(PlayerInteractEvent event) {
Player p = event.getPlayer();
if ((event.hasBlock()) && ((event.getClickedBlock().getState() instanceof Sign)) && (!p.isSneaking())) {
Sign s = (Sign) event.getClickedBlock().getState();
String[] line = s.getLines();
if (line[0].equalsIgnoreCase("[xpSh... |
b884dcf4-122b-4c0c-9cdf-68974e809044 | 2 | public static LigneCommandeClient SelectLigneCommandeClientById(int id) throws SQLException {
String query = null;
LigneCommandeClient commande = new LigneCommandeClient();
ResultSet resultat;
try {
query = "SELECT * from LIGNE_COMMANDE_CLIENT where ID_LIGNE=? ";
... |
51470429-221f-4b2d-bf53-b2b75f4f56a5 | 4 | protected boolean decodeFrame() throws JavaLayerException {
try {
AudioDevice out = audio;
if (out == null) {
return false;
}
Header h = bitstream.readFrame();
if (h == null) {
return false;
}
/... |
65b05e49-18b8-47d1-bffc-26aafdce471d | 9 | @Override
public void messageReceived( ChannelHandlerContext ctx, MessageEvent e )
throws Exception
{
HttpRequest request = (HttpRequest) e.getMessage();
if ( request.getMethod() != GET )
{
sendError( ctx, METHOD_NOT_ALLOWED );
return;
}
f... |
b1a64cab-25b5-4e99-a90e-6cea0c50fcd5 | 3 | @Override
public void deserialize(Buffer buf) {
int limit = buf.readUShort();
effects = new FightDispellableEffectExtendedInformations[limit];
for (int i = 0; i < limit; i++) {
effects[i] = new FightDispellableEffectExtendedInformations();
effects[i].deserialize(buf);... |
1a2fc48c-47bc-4ed7-8f3f-cfb2ef8a3fd5 | 8 | public boolean input(Instance instance) throws Exception {
if (getInputFormat() == null) {
throw new IllegalStateException("No input instance format defined");
}
if (m_NewBatch) {
resetQueue();
m_NewBatch = false;
}
Instance inst = (Instance) instance.copy();
//compute norm of... |
cbd0ebd7-2ed4-4f21-843b-69e3e69b24e9 | 9 | public void changeRoom(Room nextRoom)
{
String imagePath = nextRoom.getRoomImagePath();
String charImagePath;
String itemImagePath;
//remove all from the mainpanel
mainpanel.removeAll();
mainpanel.setLayout(null);
//draw the characters if exi... |
74bed0a9-e21c-426d-99e5-dd2af359fcb3 | 2 | public void ecrireFichier(String path, String text) {
// PrintWriter ecri;
FileWriter writer = null;
try {
/* ecri = new PrintWriter(new FileWriter(path));
ecri.print(text);
ecri.flush();
ecri.close();
*/
writer = new FileWriter(path, true);
writer.write(text,0,text.length());
write... |
bfa9ed61-877e-4fec-b09f-1ae366951422 | 7 | private void initialize() {
if (initialized) {
return;
}
if (this.cacheManager == null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("使用默认的EHCache CacheManager");
}
InputStream is = null;
if (StringUtils.isNotEmpty(configLocation)) {
configLocation = StringUtils.replaceOnce(configLocation... |
f982ece4-c719-4e01-826c-4eb42a138b7c | 9 | private boolean advanceRepeatGroups() throws IOException {
for (PhrasePositions[] rg: rptGroups) {
if (hasMultiTermRpts) {
// more involved, some may not collide
int incr;
for (int i=0; i<rg.length; i+=incr) {
incr = 1;
PhrasePositions pp = rg[i];
int k;
... |
04abcf7b-ca48-40d0-87a0-1b5801b8a159 | 1 | public JTextField getFontSizeTextField()
{
if (fontSizeTextField == null)
{
fontSizeTextField = new JTextField();
fontSizeTextField.addFocusListener(
new TextFieldFocusHandlerForTextSelection(fontSizeTextField));
fontSizeTextField.addKeyListener(
... |
704a8b51-91b4-4eb0-9c9f-0df2ce63c716 | 5 | @Override
public void mouseClicked(MouseEvent e) {
if (e.getSource() instanceof PhotoPanel) {
PhotoPanel photoPanel = (PhotoPanel) e.getSource();
Image image = photoPanel.getIcon().getImage();
float scale;
BufferedImage bi;
if(image.getWidth(null) > Constants.MAX_PICTURE_WIDTH){
scale = Co... |
d8637f8b-46ef-4083-b965-2cc18a0db7d4 | 9 | private void button(){
numInd = Integer.parseInt(jTextField1.getText());
probMut = Double.parseDouble(jTextField4.getText());
enfriamiento = Double.parseDouble(jTextField8.getText());
endogamia = Double.parseDouble(jTextField9.getText());
numGen = Long.parseLong(jTextField2.getText());
rep... |
b8160406-e665-44d6-b479-e98d64f51e62 | 9 | public void click(Point p) {
for (Map.Entry<String, IButton> entry : buttons.entrySet())
if (entry.getValue().isClicked(p.x, p.y)) {
if (entry.getKey().equals("Game")) {
try {
MegaControlerSingleton.getInstance().getStateView().setState(new Game());
} catch (IOException e1) {
e1.printStac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.