method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
93ada1cf-9495-422e-91e4-3e9ee893754b | 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... |
4fd9113e-d0ca-4985-b008-12e7c28367f5 | 9 | public Area getArea(int absLeft, int absTop, int offset) {
if (isOverElement(absLeft, absTop)) {
if (absLeft < (m_left + 10)) {
// left border
if (absTop < (m_top + offset)) {
// top left corner
return Area.CORNER_TOP_LEFT;
... |
3bdff9ce-5e8f-4306-b85d-c7752fec69e2 | 4 | public static int[] bilinear(int[] pixs, int iw, int ih, int ow, int oh, float p) {
int[] opix = new int[ow * oh];
for (int i = 0; i < oh-1; i++) {
float dy = i/p;
int iy = (int)dy;
if(iy>ih-2)iy = ih-2;
float d_y = dy-iy;
for (int j = 0; j < ow-1; j++) {
int g;
float dx = j/p;
int i... |
2c2ee426-b874-45c5-acce-63d2afe3aafb | 8 | static void next_move(int posr, int posc, String[] board) {
char[][] chars = new char[board.length][board[0].length()];
for (int i = 0; i < board.length; i++) {
chars[i] = board[i].toCharArray();
}
String ret = null;
if (chars[posr][posc] == 'd') {
ret = ... |
28e34e28-eefa-43ea-b8e8-24cd3166aaf0 | 4 | private boolean vertical(int row, int column)
{
Color currentColor = boardArray[row][column].getColor();
if (row > GameConstants.NUM_ROWS - GameConstants.SEQ_LENGTH)
{
return false;
}
for (int i = 1; i < GameConstants.SEQ_LENGTH; i++)
{
if (boardArray[row + i][column].getColor() != currentColor)
... |
cce65b2e-3df5-426c-81e3-630a94850833 | 5 | public static void main(String[] args) throws Exception {
String[] args1 = new String[1];
args1[0] = SITOOLS_MAIN_CLASS;
args = args1;
if (args.length != 1) {
System.err.println("Sitools Main class is not set");
System.exit(1);
}
Class[]... |
653b2015-c30e-4767-a444-3a12d88deca4 | 2 | public void test_02() {
Random rand = new Random(20121221);
GenotypeVector gv = new GenotypeVector(1000);
// Create random codes
int codes[] = new int[gv.size()];
for (int i = 0; i < gv.size(); i++) {
int code = rand.nextInt(4);
codes[i] = code;
gv.set(i, code);
}
// Check that codes are stored... |
7052d8ba-cd34-4a35-b4a5-9a38d20e2494 | 4 | private ArrayList<AntBrain> declareWinner() {
ArrayList<AntBrain> winningBrains = new ArrayList(); // ALEX: Again wasn't compiling due to error, reinitialised as ArrayList seemed to fix
int highestScore = 0;
String winnerString = "Winners:\n";
//need to do this separately to just findin... |
816aae58-077c-4748-96bf-5b78d6e40416 | 5 | @SuppressWarnings("unchecked")
public static void printMap(Map map, int depth)
{
final Iterator i = map.keySet().iterator();
Object key = null;
for (int k = 0; k < depth; k++)
System.out.print(" ");
System.out.println("Dictionary:");
while (i.hasNext() && (key =... |
5bd1b6cc-9e05-4022-b775-674a62061464 | 1 | public Integer getStat() throws Exception {
try {
return dir.list().length;
}
catch (Exception e) {
return 0;
}
} |
cf048207-2934-4e27-9756-55f05d8b4c6c | 0 | @RequestMapping("/form")
public String form(User user, BindingResult result, Model model) {
return "users/form";
} |
e85237a5-89f6-4559-9661-eec452b453bf | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
41463378-6795-4aad-bc3e-b4b81ed90680 | 2 | @Override
public TexInfo getTexInfo(int metadata){
switch(metadata){
default:
case 0:
return normal;
case 1:
return open;
}
} |
275d7f00-884c-4c34-b63b-df00c2ecef2c | 8 | private synchronized void parseMessage(Message2 m)
{
if(m.isRequest()) {
switch(state)
{
case IN_CS: // if they are going in the same direction send ack, else queue the request
if(direction == m.getDirection())
sendAckTo(m.sender());
else
pending[m.sender()] = true;
break;
... |
c1987360-7d5f-4e10-89aa-821ac74e93ad | 3 | public String convertImg(String srcUrl,String width,String height,String IP_PORT,String apiKey){
String name = upLoad(srcUrl, IP_PORT, apiKey);
String ext = getFileHouzhui(name);
String id = name.replace(ext,"");
String destination = "http://"+IP_PORT+"/cms/api/convertImage?id="+id+"&e... |
956e613f-68a5-4727-8227-5331258b63b2 | 6 | public boolean CheckFunctionProtoType(String name, TypeInfo ret_type, ArrayList type_infos) {
for (Object o : protos) {
FunctionInfo fpinfo = (FunctionInfo) o;
if (fpinfo._name.equals(name)) {
if (fpinfo._ret_value == ret_type) {
if (type_infos.size() ... |
2b83ab7e-c208-40fc-963b-36a3c560ef03 | 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... |
7d54f02a-9b9a-4bbe-a5eb-86da8a42eb39 | 6 | public void insertTag(Tag tag, int index) {
if (type != Type.TAG_List && type != Type.TAG_Compound)
throw new RuntimeException();
Tag[] subtags = (Tag[]) value;
if (subtags.length > 0)
if (type == Type.TAG_List && tag.getType() != getListType())
throw new IllegalArgumentException();
if (index > subtag... |
fdca50ef-fd52-4434-81eb-2c68edcf6b21 | 7 | protected static void run(Parameters p) throws IOException {
AbstractPointDistribution dist = new ZeroOriginDistribution(p);
FixationTimeWriter ftw = new FixationTimeWriter(p);
IteratedSimulationWriter isw;
if (!p.getOutput().equalsIgnoreCase("MINIMAL"))
isw = new IteratedSimulationWriter(p);
else
... |
48e856c3-c63c-41d5-9123-5e6b7e9b8cd8 | 9 | public MyCell getCell(int x, int y){
if(cycle){
if(x<0 || x >= columns) x = (x % columns + columns) % columns;
if(y<0 || y >= rows) y = (y % rows + rows) % rows;
}else if(x<0 || x>= columns || y < 0 || y >= rows) return null;
return matrix[y][x];
} |
4e17282b-9a43-49c3-a7b3-f2f7bb285942 | 2 | public void setSelectedFontFamily(String name)
{
String[] names = getFontFamilies();
for (int i = 0; i < names.length; i++)
{
if (names[i].toLowerCase().equals(name.toLowerCase()))
{
getFontFamilyList().setSelectedIndex(i);
break;
... |
d191e6c1-9b47-4a6a-8965-71eb25083e9a | 5 | public static void main(String[] args) throws ParseException {
System.out.println("-----------RE-IMPLEMENTATION----------");
CurrentDate CurrDate = new CurrentDate();
Date date = CurrDate.input();
//Date date = CurrDate.system();
System.out.println("Date: "+date);
Calen... |
874dda55-86be-43e0-a1cf-56edf4c6e145 | 9 | @SuppressWarnings("deprecation")
public void convertBook(Player player) {
// PUT THIS INTO EVERY METHOD
PluginDescriptionFile pdfFile = plugin.getDescription();
String cmdFormat = "[" + pdfFile.getName() + "] ";
// --------------------------
// This function will check if the player
// holds a book, and t... |
215de1c8-07df-4012-b2b7-28c23b617b2c | 9 | MapPanel(Map map){
requestFocus();
setBackground(Color.BLACK);
this.map=map;
this.map.setPanel(this);
setPreferredSize(new Dimension(img[0].getWidth(),img[0].getHeight()));
g2d[0] = img[0].createGraphics();
g2d[1] = img[1].createGraphics();
addKeyListener(new KeyAdapter() {
@Override
public void keyP... |
4828734d-8e35-4c0d-b487-b35c02863ce2 | 4 | public static Command processTags(String[] args, Command.Commands type) {
String outFile = args[args.length - 1];
String inFile = outFile;
if (args.length % 2 == 1 ) {
inFile = args[args.length - 2];
}
System.out.println("Source file: " + inFile);
System.out.... |
c800abc2-bdda-4c96-99a8-457085827366 | 0 | public static void main(String[] args) {
Collection<Integer> collection = new ArrayList<Integer>(Arrays.asList(
1, 2, 3, 4, 5));
Integer[] moreInts = { 6, 7, 8, 9, 10 };
collection.addAll(Arrays.asList(moreInts));
// Runs significantly faster, but you can't
// construct a Collection this way:
C... |
08bb3b5c-0ec2-4594-971c-3a09f04e27e6 | 6 | @Override
public void paint(Graphics g) {
Graphics graph = io.getGraphics();
for (int x = 0; x < array.length; x++)
for (int y = 0; y < array[x].length; y++) {
if (array[x][y] == 0.0)
continue;
// graph.setColor(array[x][y].getColor());
Color c = moduleColor[x][y];
if (c == null) {
int... |
c97d305d-d232-40bc-ac6d-14b2f9ad6357 | 2 | public boolean checkUser(String user, String password){
Statement st;
ResultSet rs;
String query;
try {
st = conn.createStatement();
query="SELECT * from people WHERE name='"+user+"' AND password='"+password+"'";
rs = st.executeQuery(query);
if (rs.next()){
return true;
}
else{
retu... |
f45ddaf7-0ed6-4034-801e-d05d993bd3d0 | 0 | public Mc_IrcBotCommands(AprilonIrc plugin){ Parent = plugin; } |
7a675236-00b9-4872-85ca-86bfb7be840d | 6 | public int getComboBox6 () {
if (jComboBox6.getSelectedIndex() == 0) return 10;
else if (jComboBox6.getSelectedIndex() == 1) return 50;
else if (jComboBox6.getSelectedIndex() == 2) return 100;
else if (jComboBox6.getSelectedIndex() == 3) return 250;
else if (jComboBox6.getSelec... |
e094822e-d0a5-4757-b6ab-de74b8439988 | 1 | @Override
public int calculatePreferredWidth(TreeRow row) {
int width = TextDrawing.getPreferredSize(getFont(row), getText(row)).width;
StdImage icon = getIcon(row);
if (icon != null) {
width += icon.getWidth() + ICON_GAP;
}
return HMARGIN + width + HMARGIN;
} |
a668f7e2-dc5b-4ca8-9eff-892faab1a0f4 | 5 | private void readChunkUnzip(Inflater inflater, byte[] buffer, int offset, int length) throws IOException {
assert (buffer != this.buffer);
try {
do {
int read = inflater.inflate(buffer, offset, length);
if (read <= 0) {
if (inflater.finishe... |
cd3b6144-86c6-4e00-a0a7-313509d62193 | 2 | protected void fireReceiveData(ReceiveDataEvent evt) {
//..here receive all calls from server
try {
Object object = SerializeUtils.deserializeFromBytes(evt.getData());
if (!(object instanceof IRemoteCallObject)) {
throw new IllegalArgumentException("Data isn't instanceof IRemoteCallObject");... |
36a79685-5dab-4385-9c9f-ac974c030bd2 | 0 | @Basic
@Column(name = "customer_id")
public Integer getCustomerId() {
return customerId;
} |
f65cfdf0-3294-4136-877a-d3470685309b | 5 | private void analyseOperandFormat(String line) throws AssemblerException {
line = line.trim();
String[] mnemFormatSplit = line.split("\\s+");
ArrayList<String> mnemFormatList = new ArrayList<String>();
for (String formatTerm : mnemFormatSplit) {
formatTerm = formatTerm.replaceAll("^,+", "");
formatTer... |
34837b3b-3af1-4df4-8005-22ea64985baa | 6 | @Override
public void execute(String args)
{
String userToKick = args.split(" ")[1];
String reason;
try
{
@SuppressWarnings("unused")
String ignored = args.split(" ")[2];
reason = args.replace(args.split(" ")[1], "");
reason = reason.replace(args.split(" ")[0], "");
}
catch (Index... |
c72282ca-79ff-48ae-b812-a44d3d39458a | 2 | public int getCellRowNum(String sheetName,String colName,String cellValue){
for(int i=2;i<=getRowCount(sheetName);i++){
if(getCellData(sheetName,colName , i).equalsIgnoreCase(cellValue)){
return i;
}
}
return -1;
} |
d955fcb9-afef-4278-9c41-58201a20c1d2 | 5 | public boolean isArrayType(String group, String key) {
int type = getType(group, key);
switch (type) {
case Registry.TYPE_STRING_ARRAY:
case Registry.TYPE_OBJECT_ARRAY:
case Registry.TYPE_BYTE_ARRAY:
case Registry.TYPE_CHAR_ARRAY:
case Registry.TYPE_INT_ARRAY:
return true;
default:... |
ef6089dc-5d70-4603-bbc6-79398800e274 | 3 | private static void renderEditSkill(int windowX, int windowY){
renderElements(windowX, windowY);
renderTypes(windowX, windowY);
renderEffects(windowX, windowY);
//Bottom Buttons
for(int i = 0; i < 2; i++){
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0.5f, 0.5f, 0.5f);
GL11.glBegin(GL11.G... |
7aa92424-095c-4780-9186-85157f0d40b3 | 1 | public void makeDeclaration(Set done) {
if (instr != null)
instr.makeDeclaration(done);
super.makeDeclaration(done);
} |
51bf787f-3d48-4094-b6cf-2d233b6823c8 | 5 | public boolean checkNumber(BigInteger number) {
if (getDigits(number).equals(getDigits(number.multiply(new BigInteger("2")))) &&
getDigits(number.multiply(new BigInteger("3"))).equals(getDigits(number.multiply(new BigInteger("4")))) &&
getDigits(number.multiply(new BigInteger("5"... |
21efc6f7-0e40-4307-a65a-ab000053919c | 7 | private void packtiles(Collection<Tile> tiles, Coord tsz) {
int min = -1, minw = -1, minh = -1;
int nt = tiles.size();
for (int i = 1; i <= nt; i++) {
int w = Tex.nextp2(tsz.x * i);
int h;
if ((nt % i) == 0)
h = nt / i;
else
h = (nt / i) + 1;
h = Tex.nextp2(tsz.y * h);
int a =... |
4a3e1ec1-a387-4c43-ae0a-b7ecefca446c | 0 | @Override
public void endDocument () {} |
ddf8f675-66c9-47ce-a783-6474f0f8cbf9 | 9 | private static String[][] unify(String sen1, String sen2, String[][] currentSub){
//System.out.println("Unifying " + sen1 + " and " + sen2);
if(currentSub[0][0] != null && currentSub[0][0].equals("failure")){
return currentSub;
}
else if(sen1.equals(sen2)){
return currentSub;
}
else if(isVariable(sen1... |
333820db-af02-4580-9f6c-358c0b610670 | 0 | public void setDepartment(String department) {
this.department = department;
setDirty();
} |
2b1d416f-3096-4ad9-b937-303c19529c97 | 8 | public void messageReceived(MessageEvent event) {
if (event.getId() == 2 && isMe(event.getSender())) {
if (event.getMessage().contains("Hey well done"))
Paint.Caught++;
if (event.getMessage().contains("Go on"))
Paint.Attempts++;
}
if (event.getId() == 0 && event.getMessage().contains("The rat manage... |
945fddca-bab5-46db-a9bb-9152b80f6b44 | 9 | public boolean isLegalMove(double newBearing) {
// because 0 and 360 are the same, this makes things a little easier
if (newBearing == 360) newBearing = 0;
// make sure it's in bounds
if (newBearing < -2 || newBearing > 360) {
System.err.println("ERROR! " + newBearing + " is not a legal bearing");
retu... |
957635dc-f16b-4534-9dcf-befd07cb9265 | 7 | private SuggestEngineResult executeUmlCommand() throws IOException {
systemFactory.init(startLine);
while (hasNext()) {
final String s = next();
if (StartUtils.isArobaseEndDiagram(s)) {
return SuggestEngineResult.SYNTAX_OK;
}
final SuggestEngineResult check = checkAndCorrect(s);
if (check.getStat... |
743dc474-7789-44f9-845f-f5c8d13dd81c | 7 | public String multiply(String num1, String num2) {
int[] result = new int[num1.length() + num2.length()-1];
for(int i=num1.length()-1; i>=0; i--){
for(int j=num2.length()-1; j>=0; j--){
result[i+j] += (num1.charAt(i)-'0') * (num2.charAt(j)-'0');
}
}
String num = "";
for(int i=result.leng... |
c7e60a0a-0611-458f-93bc-e240ad0babf0 | 3 | private String getLeftStringResult(String step, int pos, char value) {
String result = "";
pos--; // the initial position is already taken care of
for (; pos >= 0; pos--) {
if (step.charAt(pos) != '0' && step.charAt(pos) != '1') {
break;
}
result += value;
}
return result;
} |
2ff91154-56c2-432f-b553-9e7bcac946b3 | 1 | public void testMinus_int() {
Months test2 = Months.months(2);
Months result = test2.minus(3);
assertEquals(2, test2.getMonths());
assertEquals(-1, result.getMonths());
assertEquals(1, Months.ONE.minus(0).getMonths());
try {
Months.MIN_VALUE.... |
628ccead-b132-4433-a93d-77de833c11be | 2 | public OptParam(Param p) {
parameter = p;
double min = p.getLower();
double max = p.getUpper();
// Compute the parameter mean.
// double[] val_f = p.getVal_f();
double[] val = Util.getVals(p);
mean = 0.0;
for (int i = 0; i <... |
cca2ac8f-e6e1-41fe-8dd7-bd5541dc7757 | 3 | public LinkedList<ImageIcon> getSavedImages(SolrDocumentList docs) {
LinkedList<ImageIcon> pictures = null;
// long time=0;
pictures = new LinkedList<ImageIcon>();
for (SolrDocument doc : docs) {
String pictureURL = (String) doc.getFieldValue(PICTURE_URL);
// long tic = System.currentTimeMi... |
98dd5cc8-d141-47b5-8e9c-f4519020a34a | 3 | int getContentWidth (int columnIndex) {
int width = textWidths [columnIndex] + 2 * MARGIN_TEXT;
if (columnIndex == 0) {
width += parent.col0ImageWidth;
if (parent.col0ImageWidth > 0) width += CTable.MARGIN_IMAGE;
} else {
Image image = getImage (columnIndex, false);
if (image != null) {
width += image.get... |
c3c14e6b-adec-4fbb-a7c5-422350712c9f | 2 | public static void setUtilizationThreshold(int value) {
if (value >= 0 && value <= 100) {
utilization_threshold = value;
}
} |
2893dae3-78ba-42e1-a020-e2e087be7cba | 5 | public static String getPassword(final String prompt) {
try {
// password holder
final StringBuffer password = new StringBuffer();
final PasswordHidingThread maskingthread = new PasswordHidingThread(prompt);
final Thread thread = new Thread(maskingthread);
... |
c7093e73-0889-427d-80a9-3a9c70104b3a | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
d1f7a613-19c6-4dd7-82c5-c2d364d9fcf5 | 7 | private Map<Integer, IMappedPage[]> testAndGetSharedMap(IMappedPageFactory pageFactory, int threadNum, int pageNumLimit) {
// init shared map
Map<Integer, IMappedPage[]> sharedMap = new ConcurrentHashMap<Integer, IMappedPage[]>();
for(int i = 0; i < threadNum; i++) {
IMappedPage[] pageArray = new IMappedPag... |
f72a73c4-b3bd-4b50-a6e0-0934ba9c93d6 | 3 | private void loadProperties(){
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream("config/config.properties");
prop.load(input);
Tele_Sync = (prop.getProperty("Sync"));
Tele_Sync_start = (prop.getProperty("Sync_Start"));
Tele_Sync_end = (prop.get... |
ae2c9023-eee3-4233-a8d4-4d13f211fc5b | 1 | public List<LocationDTO> getLocationDTO() {
if (locationDTO == null) {
locationDTO = new ArrayList<LocationDTO>();
}
return this.locationDTO;
} |
fe45391e-284f-4551-866b-b37aa0559dbd | 6 | public void drawShortestPath(Graphics g)
{
TreeMap<Vertex, Vertex> previousPoint =
Dijkstra.getShortestPaths(vertices.endA, vertices.endB, vertices.getVertices().toLinkedList());
if (previousPoint == null) return;
TreeMap<Vertex, Vertex> shortestPath = new TreeMap(... |
03354e63-b4d9-4234-9ddd-5b97acc43bdd | 0 | private static void output() throws FileNotFoundException, IOException {
OutputStream out = new FileOutputStream("/tmp/file_out.txt");
out.write(1);
out.close();
} |
d79c8500-380e-408a-bea7-9fc0c7d5ff8d | 3 | private boolean movementButtonIsPressed(Input input) {
return input.isKeyDown(Input.KEY_UP) || input.isKeyDown(Input.KEY_DOWN) || input.isKeyDown(Input.KEY_LEFT) || input.isKeyDown(Input.KEY_RIGHT);
} |
20487786-32d5-40cb-984c-2892496a618e | 6 | public static Pearson getPearsonFor(int userId1, int userId2, Map<Integer, Map<Integer, Pearson>> pearsons) {
if (userId1 < userId2 && pearsons.containsKey(userId1)) {
Map<Integer, Pearson> map = pearsons.get(userId1);
if (map.containsKey(userId2)) {
return map.get(userId2);
}
} else if (userId1 > user... |
aea8c4e3-4494-4381-a09d-daf379c90115 | 1 | public int attackSpecial(Character opponent){
int damage;
System.out.println(_name+" swings at you with his suspenders!");
damage = suspenders(opponent);
if ( damage < 0 )
damage = 0;
opponent.lowerHP( damage );
return damage;} |
4a555374-945c-43eb-bb81-6505e2e6285e | 1 | public SplashScreen(URL filename) {
// Get Image
MediaTracker mt = new MediaTracker(this);
image = Toolkit.getDefaultToolkit().getImage(filename);
mt.addImage(image,0);
try {
mt.waitForID(0);
} catch(InterruptedException ie){}
// Set size of image
setSize(image.getWidth(null),image.getHeight(null));... |
c8f53c60-a60d-4994-9133-7c611e696c4f | 3 | @Override
public <T> List<String> config(Class<T> clazz) throws NoConfigException {
if (this.configed) {
if (null == this.config) {
throw new NoConfigException("Actually Not Configed yet OR Config missing.");
} else {
return this.config.get(clazz);
... |
e35660d0-97f3-4842-a123-787e6ec9a55e | 0 | public Process deQueue() // Remove from the head.
{
Process temp = peek(); // temp stores head
head = head.next;
return temp;
} |
2826055e-97f3-4159-909b-43b6fc353273 | 7 | private void checkCompleteTask(String input) throws IOException {
Task mostRecentTask = new Task();
ArrayList<Task> tasksToBeCompleted = new ArrayList<Task>();
tasksToBeCompleted = searchForTask(input);
if (tasksToBeCompleted.size() == 0) {
UIHandler.getInstance().printToDisplayRed(MESSAGE_NO_ENTRY);
} e... |
ce244b9d-c9ba-402f-9dd6-dfdcfb30445e | 2 | public void collectAll(Iterable<? extends Player> allPlayers) {
for(Player p : allPlayers) {
this.collect(p);
}
} |
258d2bd5-8c3a-478e-a0b4-63bc01a47384 | 5 | public void run() {
try {
while (true) { // Loop forever
// If this server thread is paired
if (this.pairedServerThread != null) {
while ((inputLine = this.inFromClient.readLine()) != null) { // Read line
System.out.println("Server sending: " + inputLine);
this.paired... |
0e0207df-d6ab-4baa-bd7b-6e615fc190c0 | 5 | public String readTextFile(String fileName) {
String returnValue = "";
FileReader file = null;
String line = "";
try {
file = new FileReader(fileName);
BufferedReader reader = new BufferedReader(file);
while ((line = reader.readLine()) != null) {
... |
12ffa38f-d3d3-4b29-81d7-ffb3eefdd95c | 5 | public mxRectangle getBoundsForCells(Object[] cells, boolean includeEdges,
boolean includeDescendants, boolean boundingBox)
{
mxRectangle result = null;
if (cells != null && cells.length > 0)
{
for (int i = 0; i < cells.length; i++)
{
mxRectangle tmp = getCellBounds(cells[i], includeEdges,
in... |
1a5c0a9e-1db6-4201-a5f6-5503a68a3ba8 | 6 | private void layoutVertical(int top, int bottom, int left, int right) {
int topY = paddingTop;
int width = right - left;
int childRight = width - paddingRight;
int availableWidth = width - paddingLeft - paddingRight;
for (int i = 0; i < getChildCount(); i++) {
View ... |
a616fe2b-6a2f-4c99-bd80-8421120f2718 | 9 | public static void run(String title, int width, int height, Consumer<ApplicationContext> applicationCode) {
Objects.requireNonNull(title);
if (width < 0 || height < 0) {
throw new IllegalArgumentException("invalid size");
}
Objects.requireNonNull(applicationCode);
final BufferedImage buff... |
3347bf89-ccbc-4c47-8e32-2cb09aa5a618 | 7 | protected void fitLogistic(Instances insts, int cl1, int cl2,
int numFolds, Random random)
throws Exception {
// Create header of instances object
FastVector atts = new FastVector(2);
atts.addElement(new Attribute("pred"));
FastVector attVals = new FastVector(2);
attVals.ad... |
eb210bb9-155b-448a-b08c-deb72d741894 | 4 | void setReturnType(String desc) throws CompileError {
int i = desc.indexOf(')');
if (i < 0)
badMethod();
char c = desc.charAt(++i);
int dim = 0;
while (c == '[') {
++dim;
c = desc.charAt(++i);
}
arrayDim = dim;
if (c =... |
3775f2b9-12b8-4ac8-a61a-6df1d8e72309 | 7 | public Main( ) {
/**
* Add action listeners for buttons
*/
// Get available actions
// and add listeners for these action buttons
for( int i = 0 ; i < actionButtons.length ; ++i ) {
final Action action = actionFactory.get(i) ;
JButton button = new JButton( ... |
ed953c60-1781-4489-95c2-a9cd9a89f2f5 | 0 | public void setId(Integer id) {
this.id = id;
} |
278b6b16-66aa-41e2-99ae-41f7c2291480 | 8 | public ResumeDownloadView(){
this.mangaUrlTF = new JTextField();
this.chapterTF = new JTextField();
this.pathTF = new JTextField();
this.pathFC = new JFileChooser();
this.pathFC.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
this.startBT = new JButton("Start");
this.stopBT = new JButton("Stop");
... |
b8149669-2e36-4c8c-9b20-1198561992dc | 2 | public LocalInfo findLocal(String name) {
Enumeration enum_ = allLocals.elements();
while (enum_.hasMoreElements()) {
LocalInfo li = (LocalInfo) enum_.nextElement();
if (li.getName().equals(name))
return li;
}
return null;
} |
92c34dca-707e-4f6a-97ef-e6e886eda99a | 2 | @Override
public int compareTo(WeightedEdge that)
{
if (this.weight < that.weight)
return -1;
if (this.weight > that.weight)
return +1;
else
return 0;
} |
2a1cd1df-0403-4878-8970-57a27e5e1f7a | 5 | public String buscarGrupoEstudioPorEstado(String estado) {
ArrayList<GrupoEstudio> geResult= new ArrayList<GrupoEstudio>();
ArrayList<GrupoEstudio> dbGE = tablaGrupoEstudio();
String result="";
try{
for (int i = 0; i < dbGE.size() ; i++){
if(dbGE.get(i).getEstado().eq... |
848ab47f-c471-4dce-a175-ef80a99ab1ff | 9 | public int compare(Key o1, Key o2) {
if ((o1.getParentPath() == null && o2.getParentPath() != null) ||
(o1.getParentPath() != null && o2.getParentPath() == null)) {
throw new RuntimeException(CAN_T_COMPARE_KEYS_FROM_DIFFERENT_DIMENSIONS);
}
if (o1.getParentPath() == null && o2.getParentPath() == null) {
... |
883fb61c-8183-4713-a9a5-b469e88a2873 | 7 | public static ArrayList<ArrayList<Position>> isTherePolygon(List<Position> pos, Polygon p, double GIVENAPROX)
{
ArrayList<ArrayList<Position>> result = new ArrayList<ArrayList<Position>>();
//TODO (fix) Revoir la proportion
//For each point in the list
for(int i = 0; i < pos.size(); i++)
{
//List of point... |
aadf316b-f86d-4fad-b116-2c22b4a9bdcf | 6 | @Override
public boolean initDecrypt(String password) {
if (password == null || password.length() < 1) {
Application.getController().displayError(
Application.getResourceBundle().getString("password_not_null_title"),
Application.getResourceBundle().getString("password_not_null_message"));
return fal... |
c807be62-7a3b-4c14-b35b-879d241f6929 | 8 | public void printGrammar(Grammar grammar) {
int emptyRules = 0, injections = 0;
for (Production p : grammar.productions) {
if (p.reachable) {
if (p.isEmpty()) {
++emptyRules;
} else if (p.isInjection()) {
++injections;
}
}
}
monitor.println("Empty production rules: " + emptyRules)... |
a47cf998-89fb-4db1-b32a-fbee404fc448 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
b14d1f98-32e2-4e41-8122-f0af5f280816 | 0 | private int left(int i) {
i += 1;
return 2 * i - 1;
} |
ac2bfb28-e6f7-4724-a4a1-31cd543e4c43 | 1 | protected String getResponseFromJSON(WebPage entry) throws ParseException {
String[] p = entry.getContent().split("\",");
return ( p[2].split("\"").length > 1 ) ? "Asi incorrect syntax nebo co." : p[0].split("\"")[1] + " = " + p[1].split("\"")[1];
} |
e1bbce16-8603-45dc-9f16-024f988f30fd | 8 | final void method1140(Stream stream, Class81 class81) {
int i = stream.readUByte();
anIntArray2040[0] = i >> 4;
anIntArray2040[1] = i & 0xf;
if (i != 0) {
anIntArray2042[0] = stream.readUShort();
anIntArray2042[1] = stream.readUShort();
int j = stream.... |
09329046-dac3-4dcd-ab70-ee4de21d118c | 2 | private void commit() {
for (ClassNode c : classes) {
for (MethodNode m : c.methods()) {
m.releaseGraph();
m.editor().commit();
}
c.editor.commit();
c.info.commit();
}
} |
93b8bad8-4b77-4976-9eed-965ab9d8d43f | 0 | public void setTicketUrl(String ticketUrl) {
this.ticketUrl = ticketUrl;
} |
66fc8f5d-98f5-45b7-9234-d56daa2f624f | 4 | public void closeQuery(){
try {
currentResult.close();
} catch (SQLException e){
if( debug ) System.out.println("Error in DataBaseConnection.closeQuery(): "+e.getMessage());
}
try {
ps.close();
} catch (SQLException e){
if( debug ) System.out.println("Error in DataBaseConnection.closeQuery(): "+e.... |
eae8c3cc-49e3-4ee1-9344-0133905b6e5a | 9 | public static void main(String args[] ) throws Exception {
/*
* Read input from stdin and provide input before running
*/
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
char[] palindrom = line.toCharArray();
boolea... |
203e78bd-a0ea-491d-b83b-d2c9e95cf665 | 7 | public static Complex laguerre(Complex estx, Complex[] pcoeff, int m){
double eps = 1e-7; // estimated fractional round-off error
int mr = 8; // number of fractional values in Adam's method of breaking a limit cycle
int mt = 1000; // number of st... |
2bc6bbd5-cfcb-45d3-944a-cce7590e8069 | 1 | private String getFormat(MainClass mainClass, ChannelType ch, World w, Player p, String message) {
String channel = mainClass.channelPrefixes.get(ch);
String world = mainClass.defaultWorldPrefix;
File file = new File("plugins/Nostalgia/Chat.yml");
FileConfiguration f = YamlConfiguration.loadConfiguration(file);... |
fd3ec0c7-208a-48a6-8672-7fbaf0d54bb2 | 2 | public void closeModal()
{
assert overlayStack.size() > 0;
assert window.getGlassPane() == overlayStack.peek().getOverlayPanel();
if(overlayStack.size() > 0)
{
overlayStack.pop().getOverlayPanel().setVisible(false);
if(overlayStack.size() > 0)
{
window.setGlassPane(overlayStack.... |
3474e096-c933-42f1-90aa-72e54f45422c | 3 | @Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0 || JsfUtil.isDummySelectItem(component, value)) {
return null;
}
return this.ejbFacade.find(getKey(value));
} |
c3bc8cbc-99aa-41a8-bb40-7c8a12940c09 | 5 | public Map(String name, String author, String version, String url, String logo, String image, String compatible, String mcversion, String mapname, String info, int idx)
throws NoSuchAlgorithmException, IOException {
index = idx;
this.name = name;
this.author = author;
this.ve... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.