method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1809b017-d341-4656-9033-8ae4a3387866 | 2 | public static String ConvertValueForIndexing(Object value)
{
if (value instanceof String)
return " " + value.toString().toUpperCase();
else if (value instanceof Date)
{
return value.toString();
}
else
{
return value.toString();
}
} |
07a05dad-1d34-4be5-80fd-a4b41ae68eb3 | 1 | @Override
public void fireEvent(UIEvent e) {
super.fireEvent(e);
if(e instanceof ValueChangeEvent) {
processValueChangeEvent((ValueChangeEvent) e);
}
} |
9d115c99-5745-403d-a3dd-3c6c878cf10d | 6 | public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/*
* name: username, password
* return: [{"status":"", "reason":"", "data":""}]
*
* request: username, password
* response: status (create a session, insert uId into session)
*/
... |
5e75503f-6fcb-429c-a396-3e6a2d7b7a9a | 7 | public static boolean[] intToBoolean(int[] octets) throws SubneterException
{
if (octets.length != 4)
{
throw new SubneterException("Invalid IP adress too many or to less octets");
}
for (int i = 0; i < 4; i++)
{
if (octets[i] < 0 || octets[i] > 255)
... |
b5945c1d-ec41-43de-b7e3-1d369e31a8d1 | 6 | public void update() {
player.update();
player.checkAttack(enemies);
player.checkCoins(coins);
finish.update();
finish.checkGrab(player);
bg.setPosition(tileMap.getx(), 0);
tileMap.setPosition(
GamePanel.WIDTH / 2 - player.getx(),
GamePanel.HEIGHT / 2 - player.gety());
... |
848e00df-1ca0-41c5-9fba-31c9a41cc7ee | 2 | public void test_03() {
System.out.println("\n\nSuffixIndexerNmer: Add test");
String fastqFileName = "tests/short.fastq";
// Create indexer
SuffixIndexerNmer<DnaAndQualitySequence> seqIndexNmer = new SuffixIndexerNmer<DnaAndQualitySequence>(new DnaQualSubsequenceComparator(true), 15);
// Add all sequences ... |
fd760471-1160-4550-a468-75776dd4ab94 | 3 | public void drawBackground(Graphics g) {
// draw the background graphics from the superclass
super.drawBackground(g);
ImageManager im = ImageManager.getSingleton();
Image img;
Position p;
// draw the map as a matrix of tiles with cities on top
for ( int r = 0; r... |
35be6fe8-b4ab-4b7f-8cb6-9c94ec984dc7 | 2 | private void readLimitedInto(HttpURLConnection conn, int limit, ByteArrayOutputStream read) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(getConnectionInputStream(conn)));
String line = null;
while ((line = in.readLine()) != null) {
read.write(line.getBytes());
if (read.s... |
e61e8618-f786-4437-b0f8-5990c2e79fe7 | 4 | public static byte[] mapleDecrypt(byte[] data) {
for (int j = 1; j <= 6; j++) {
byte remember = 0;
byte dataLength = (byte) (data.length & 0xFF);
byte nextRemember;
if (j % 2 == 0) {
for (int i = 0; i < data.length; i++) {
byte cur = data[i];
cur -= 0x48;
cur = ((byte) (~cur & 0xFF));
... |
a7a58c61-1ed5-44e5-9d40-ffed5f659a71 | 6 | public static void save(String filename, double[] input) {
// assumes 44,100 samples per second
// use 16-bit audio, mono, signed PCM, little Endian
AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false);
byte[] data = new byte[2 * input.length];
for (int i = 0; i... |
98421a04-7273-4fdc-a9fd-170cee34224f | 0 | public void setStart(int start) {this.start = start;} |
89acc7e6-9a80-4b3c-b602-cfe3368d5675 | 1 | @Override
public String toString() {
if (sb.length() >= delimiter.length())
sb.setLength(sb.length() - delimiter.length());
return sb.toString();
} |
4d21bd9f-ac97-45f5-8566-854b267e130d | 7 | public static boolean computeCell(boolean[][] world, int col, int row) {
boolean liveCell = getCell(world, col, row);
int neighbours = countNeighbours(world, col, row);
boolean nextCell = false;
if (neighbours < 2)
nextCell = false;
if (liveCell && (neighbours == 2 |... |
22d6d5eb-4d30-4659-b485-2d513018eacf | 1 | public static void awardBonusInternal() {
BigInteger bonusReduction = BigInteger.valueOf(100);
// To be worked out.
System.out.print("Balances of all accounts (int): ");
for (BankAccount account: christmasBank.getAllAccounts())
System.out.print(" " + account.getBalance(... |
ed59b879-6679-415e-98e1-5c846d6ac868 | 7 | public List<List<Integer>> levelOrder(TreeNode root) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
if (root == null) {
return result;
}
ArrayList<TreeNode> levelNode = new ArrayList<TreeNode>();
levelNode.add(root);
while (!levelNode.isEmpty(... |
db1d74de-1f6b-49da-a482-ff66a624e9ed | 7 | @Override
public Boolean doStep() {
this.incrementStepNumber();
this.modelLogging("The step " + this.stepNumber + " is starting.\n" +
"The model is:\n", this.steppingModel);
this.notifyStatus("Step " + this.stepNumber + " started");
// ==> Convert the model into a standard linear model if it ... |
9ef73e1b-4ca7-4bfc-a44c-930919e2b320 | 5 | public Character() {
_level = 1;
_health = 0;
_initiative = 0;
_attributes = new Attributes();
_generator = new NormalSpread();
_race = new Deva();
_class = new Ardent();
_classMap = new Vector<>();
_setting = new DnD4e();
BaseGenerator g ... |
371bd995-47ae-485b-910b-c13b6ae3d9a6 | 6 | public boolean attackEntityAsMob(Entity par1Entity)
{
if (super.attackEntityAsMob(par1Entity))
{
if (par1Entity instanceof EntityLiving)
{
byte var2 = 0;
if (this.worldObj.difficultySetting > 1)
{
if (this.w... |
cb3279b6-c378-48e9-a82f-d5771d8960e4 | 9 | public List<List<Integer>> subsets(int[] S) {
List<List<Integer>> ret = new ArrayList<List<Integer>>();
quickSort(S);
int length = S.length;
int[] index = new int[length];
for (int i = 0; i < length; i++) {
index[i] = 0;
}
int currTurnLength = 0;
int eleHave = 0;
int lastTurnIndex = 0;
while (... |
4c15b69f-d5ef-49d0-bc91-ce736df676cb | 1 | public Object getValueAt(int row, int col)
{
if (col == ENTITY) { // afficher l'entité dans laquelle la propriété est utilisée (Bug #712439).
return getEntityNameOfProperty(row);
} else {
return rows.get(row)[col];
}
} |
c0c12913-9680-4813-a174-00117858d4e2 | 8 | @SuppressWarnings("unchecked")
public static <VertexType extends BaseVertex, EdgeType extends BaseEdge<VertexType>>
boolean isBipartite(BaseGraph<VertexType, EdgeType> graph) {
//Copying to ColorableVertex
ColorableVertex<VertexType>[] CVArray = (ColorableVertex<VertexType>[])Array.newInstance(ColorableVertex.c... |
e4244eda-cb93-4728-9cc8-ba09eb36621a | 0 | @Test
public void eventBusNotNull()
{
assertNotNull( eventBus );
} |
bedd0848-7ccf-4470-95a1-a4a61ff6426d | 3 | public void open() {
JFileChooser FCdialog = new JFileChooser();
int opt = FCdialog.showOpenDialog(this);
if(opt == JFileChooser.APPROVE_OPTION){
this.textPane.setText("");
try {
this.console.setText("<html> Opening file: "+ FCdialog.getSelectedFile().getName());
Scanner scan = new Scanner(new Fi... |
ec3853f5-8840-4cf8-9c95-a43c97f36391 | 4 | private static Enumeration getResources(final ClassLoader loader,
final String name)
{
PrivilegedAction action =
new PrivilegedAction() {
public Object run() {
try {
if (loader != null) {
return ... |
1e1747f2-d43e-449b-94fc-75e320dac0c8 | 6 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting the se... |
5f73ccfa-0076-4871-8f1c-3cb69f5ac695 | 9 | private Statement Statement(ProcedureBuilder pb) throws Exception {
Statement retval = null;
switch (this.Current_Token) {
case TOK_VAR_STRING:
case TOK_VAR_NUMBER:
case TOK_VAR_BOOL:
retval = ParseVariableDeclStatement(pb);
GetNext();... |
cc1e778f-b3b8-43ac-9381-7f635e13f102 | 2 | public boolean validMove(int position, int player){
int[] field = getGameField();
if(field[position] == 0 && this.getTurn() == player){return true;}
else {return false;}
} |
fd62c9df-d7b2-4dc5-85ff-872e9e149d8b | 7 | private SingleTypeFactory(Object typeAdapter, TypeToken<?> exactType, boolean matchRawType,
Class<?> hierarchyType) {
serializer = typeAdapter instanceof JsonSerializer
? (JsonSerializer<?>) typeAdapter
: null;
deserializer = typeAdapter instanceof JsonDeserializer
? (J... |
5b7011b2-e17e-46f0-8bdc-68d27b60f18e | 7 | @Test
public void testImpossibleMove() {
try {
game = RulesParser.parse("./rules/Chess.xml");
Scanner sc = new Scanner(new File("./test/impossibleMoveBoard.txt"));
//
int xSize = 8;
int ySize = 8;
//
int [][] newField = new int[xSize][ySize];
for (int y = ySize - 1; y > -1; --y) {
for ... |
e0f2d7f3-969a-4476-a13a-3ebff5f95414 | 7 | public void printPercentages() {
// -- Percentages --
System.out.println(" == Percentages for individual elements ==");
System.out.println();
// Codon percentages
System.out.println(" -- Percentages for each codon composition --");
System.out.println("| - | -AA | ... |
5fc781f2-c4c7-47e0-b99f-694f74c9f696 | 3 | public void sendGlobalMessage (String sender, String message) {
for (Map.Entry<String, Socket> user : activeSockets.entrySet()) {
if (user.getKey() != sender) {
Socket socket = user.getValue();
try {
PrintWriter out = new PrintWriter(socket.getOutp... |
1c95cd6b-9c00-46ec-991e-364fd84f4a42 | 8 | private static void writeResourceToFile(
String resourceName, File file) throws IOException
{
if (file == null)
{
throw new NullPointerException("Target file may not be null");
}
if (file.exists())
{
throw new IllegalArgumentException(
... |
ed72cb40-2cc2-47dc-8a80-b29782faa7ad | 4 | public static void Test()
{
int option=0;
Scanner Input = new Scanner (System.in);
while(option != 3)
{
System.out.println("Fight the Kobold?");
System.out.println("1) Yes");
System.out.println("2) Save Game");
System.out.println("3) exit");
option = Input.nextInt();
if (option == 1)
{
//figh... |
e40fe7b3-2255-4c3c-a7b5-7eba094b7c7f | 9 | public String generateQueryString() {
QueryString qs = new QueryString("page", Integer.toString(this.getPage()));
qs.add("limit",Integer.toString(this.getLimit()));
if (this.getKeyword() != null) qs.add("keyword", this.getKeyword());
if (this.getCreatedAtMin() != null) qs.add("created_... |
f4ba5e2a-7eeb-4d8d-a23e-62139479e778 | 3 | @Override
public void actionPerformed(ActionEvent e) {
JTable productsTable = App.getInst().getView().getProductsTable();
JTable categoriesTable = App.getInst().getView().getCategoriesTable();
JComboBox<String> cmb = App.getInst().getView().getCountComboBox();
count = Integer.parseInt((String) cmb.getSelect... |
01d99733-de3c-4516-a66c-62cd892f64dd | 4 | private boolean checkUsage(AbstractCommand<P> command, String[] parameters) {
String[] commandParameters = command.getParameters();
int[] limits = new int[2];
for (String parameter : commandParameters) {
limits[1]++;
if (!parameter.matches("\\[.*\\]")) {
limits[0]++;
}
}
return parameters.length ... |
10bdd8dc-15a5-4553-a90c-673e8962182b | 7 | public void create(CmProfesionales cmProfesionales) {
if (cmProfesionales.getPypAdmControlProfesionalesList() == null) {
cmProfesionales.setPypAdmControlProfesionalesList(new ArrayList<PypAdmControlProfesionales>());
}
EntityManager em = null;
try {
em = getEntity... |
6e210bbc-6b2a-4a93-845d-bbd689c8d574 | 4 | public void readScores() {
Person second;
Person first;
Person temp;
if (people.size() > 0) {
for (int i = people.size() - 1; i > 0; i--) {
first = people.get(i);
second = people.get(i - 1);
if (first.getScore() > second.getScore()) {
temp = first;
people.set(i, second);
peopl... |
de36c3f4-3496-487b-9894-ccf8c5c8fd27 | 4 | private void sessionDelete(String cookie_vals){
String[] sTemp = cookie_vals.split("\\^");
String sID = sTemp[0];
int ver = Integer.parseInt(sTemp[1]);
String ipP = sTemp[2].split(":")[0];
int portP = Integer.parseInt(sTemp[2].split(":")[1]);
String ipB = sTemp[3].split(":")[0];
int p... |
f483ee42-3ec9-4b0b-8c38-69ebcb87798d | 8 | final public Expression Expression(int str_type) throws ParseException {
final Variable v;
final String s;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VARIABLE:
v = Variable();
{if (true) return new VariableExpression(v);}
break;
case STRING_END:
case STRIN... |
57f17693-f200-4f37-b44d-b2dc954a02e9 | 9 | public static void main(String[] args)
{
File configPath = new File("AztecConfig.conf");
if ( args.length > 0 )
configPath = new File(args[0]);
if ( !configPath.exists() || !configPath.isFile() || !configPath.canRead() )
{
System.out.println("Unable to open config file: "+configPath.getAbsolutePath());
... |
87a3e719-1797-4c4b-92ba-2d8e8fac7125 | 0 | public byte[] getQ() {
return q;
} |
11938d13-09c0-4ae6-b258-cadfa2293c0e | 4 | public void act()
{
// spawn ships random
if(Greenfoot.getRandomNumber(10000) < 10) {
addObject(new ship1(), Greenfoot.getRandomNumber(900),10);
}
if(Greenfoot.getRandomNumber(10000) < 10) {
addObject(new ship2(), Greenfoot.getRand... |
37524da0-196e-48ca-b60d-74c47cd002a8 | 7 | @Before
public void setUp() throws SQLException {
// Setup a simple connection pool of size 10
source = new PGPoolingDataSource();
source.setDataSourceName("Mock DB Source");
source.setServerName("localhost:5432"); // Test server
source.setDatabaseName("MockDB"); // Test DB
... |
eeffef32-a576-4992-b642-1fc3ea968c04 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + ((recipes == null) ? 0 : recipes.hashCode());
result = prime * result + toolID;
result = prime * result + ((toolName == null) ? 0 : toolName.h... |
50222f3e-b7f9-4141-ab03-788de2ac900c | 6 | public void searchByID (LYNXsys system, String query, int page) { // search student by ID
displayedSearchResults.removeAll(displayedSearchResults);
for (int i = 0; i < system.getUsers().size(); i ++) { // loop through arraylist of students
if (system.getUsers().get(i).getID().equalsIgnoreCase(query)){ // check ... |
686d750d-6349-405d-9c5b-2546c85285c1 | 9 | Space[] won() {
int n = numToWin - 1;
if (lastSpaceMoved == null)
return null;
int[] pos = lastSpaceMoved.getPos();
for (int i = 0, rowInd = pos[0]; i <= n; i++, rowInd = pos[0] - i)
for (int j = 0, colInd = pos[1]; j <= n; j++, colInd = pos[1] - j) {
boolean outOfBounds = rowInd < 0 || colInd < 0
... |
1c2018ee-af9f-4ddf-8e79-bd0b01271942 | 9 | public static ButtonImage getTypeFromInt(int index) {
switch (index) {
case 0:
return EMPTY;
case 1:
return ONE;
case 2:
return TWO;
case 3:
return TREE;
case 4:
return FOUR;
case 5:
return FIVE;
case 6:
return SIX;
case 7:
return SEVEN;
case 8:
return EIGHT;
default:
... |
514477a5-9faf-48f2-9a41-aab375326c49 | 7 | private static void readFromFile(String filename){
BufferedReader br = null;
String line;
if(filename == null){
System.out.println("No file path specified!");
return;
}
File AddFile = new File(filename);
if(!AddFile.exists())
{
System.out.println("File " + filename + " not found!");
return;
... |
7807b5bc-a332-4764-8ef1-50f70588dda1 | 9 | @Override
public void update(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setColor(Color.gray);
g2.fillRect(0,0,getWidth()... |
9d9e6987-0439-476e-99e9-bfc9e4b15cb6 | 0 | public void setPostNote(String postNote) {
this.postNote = postNote;
} |
56c1bbaf-a261-48da-bec8-e368654c8139 | 1 | public void mouseRelease(int x, int y){
if(movingInputTime){
movingInputTime = false;
ArrayList<Integer> times = loop.getTimes();
loop.setNewTime(node.getIndex(), (int) node.getTime());
//times.set(node.getIndex(), (int) node.getTime());
System.out.println(times.size());
}
} |
d0a2dfb0-2180-471f-90b6-811e697f0dd4 | 2 | private void mkCfg () {
for (String qp : qps) {
try {
File h265Cfg = new File("./Cfg/h265/"+seqName+qp+".cfg");
File psvdCfg = new File("./Cfg/psvd/"+seqName+"Residue"+qp+".cfg");
DirMaker.createFile(h265Cfg);
DirMaker.createFile(psvdCf... |
38a50ffa-9604-4323-87de-6817d785c9cb | 8 | private void completeCursorMessage() {
Vector<OSCMessage> messageList = new Vector<OSCMessage>();
OSCMessage frameMessage = new OSCMessage("/tuio/2Dcur");
frameMessage.addArgument("fseq");
frameMessage.addArgument(-1);
OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
aliveMessage.addArgument("... |
dd051eab-f4bd-49a4-93fa-f93c2ad114b9 | 6 | public void saveGraphAs(Graph graph, Component c) {
this.graph = graph;
JFileChooser fileChooser = new JFileChooser();
if (graph instanceof PetriNet) {
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Danes Pet... |
ea4316d0-0019-4670-bccd-71b26d6280f1 | 9 | public int[] search (ASEvaluation ASEval, Instances data)
throws Exception {
double best_merit = -Double.MAX_VALUE;
double temp_merit;
BitSet temp_group, best_group=null;
if (!(ASEval instanceof SubsetEvaluator)) {
throw new Exception(ASEval.getClass().getName()
... |
139f0dad-9bbf-4cfd-a862-1a537d95167d | 4 | @Override
public boolean isVisibleAt(int posX, int posY) {
if((posX/zoom) > originX && (posX/zoom) < (originX + width))
if((posY/zoom) > originY && (posY/zoom) < (originY + height))
return true;
return false;
} |
fc7de137-d50e-4c95-9c4a-66c17d36841e | 7 | private static int subStringForAcharAtAnIndex(String s, String set, List<String> subStrings, char ipChar, int index) {
index = s.indexOf(ipChar, index + 1);
int x = 1;
int l = index - x;
int r = index + x + 1;
while (l >= 0 || r <= s.length()) {
l = l < 0 ? 0 : l;
... |
9cdd86a8-af7e-498b-8f3c-e5ad6e6623cb | 5 | public String longestCommonPrefix(String[] strs) {
if (strs.length == 0) { // important to check when you are done coding
return "";
}
String first = strs[0];
int i = 0;
char tmp;
while (i < first.length()) {
tmp = first.charAt(i);
for (int j = 1; j < strs.length; j++) {
// the first word may ... |
51589040-a37c-4680-b412-2296e4a0a3e0 | 0 | public int getValue(int skill)
{
return skillValues[skill];
} |
328117b2-37ae-4ec9-be49-4d7623177d56 | 4 | public void initResources(Display display) {
if (stockImages == null) {
stockImages = new Image[stockImageLocations.length];
for (int i = 0; i < stockImageLocations.length; ++i) {
Image image = createStockImage(display, stockImageLocations[i]);
if (image == null) {
freeResources();
throw ... |
69b894d1-0a4c-4e02-b327-d999bb05f0e9 | 3 | @Override
public void run(){
byte[] byteTosend = new byte[1*1024];
try {
for (int k = 0; k < 2/*200000*/; k++) {
nioClientMT.publish(null, byteTosend, "#testtag");
}
} catch (IOException e) {
... |
3360bfe1-d19d-438a-ab37-aba3f50f154e | 2 | public Map<Integer, InventoryItem> GrabFloors()
{
Map<Integer, InventoryItem> Items = new HashMap<Integer, InventoryItem>();
for(InventoryItem Item : this.Inventory.values())
{
if (Item.GrabBaseItem().Type.contains("s"))
{
Items.put(Item.ID, Item);
}
}
return Items;
} |
1a7a2ce8-8d54-4267-b12f-eb1b3ac06603 | 3 | @Test
public void testChangeInterfaceOfProperty() throws Exception
{
// connect to database
PersistenceManager pm = new PersistenceManager(driver, database, login, password);
// drop all tables
pm.dropTable(Object.class);
// create test objects
OriginalObject one = new OriginalObject();
one.setValue(1)... |
b51c5fa3-8b38-44c8-9925-80adcca91dfc | 6 | @Override
public void execute(Profile profile, String[] args) {
final int RATE = 10;
try {
Twitter twitter = profile.getTwitter();
TwitterBrain brain = profile.getMind();
brain.updateFriends();
logger.info("total friends count: "
+ ... |
798cd211-a45e-4745-9fc8-46163b5503c3 | 6 | private void processBranches(FileData coverageData, StringBuilder lcov) {
for (Integer lineNumber: coverageData.getBranchData().keySet()) {
List<BranchData> conditions = coverageData.getBranchData().get(lineNumber);
if (conditions != null) {
for (int j = 0; j < conditions... |
8cc142bd-4b1d-49b0-9043-35c792b3946b | 9 | public static boolean addMail(MailItem mail) {
if (!initialised) return false;
Connection connection = null;
PreparedStatement statement = null;
ResultSet result = null;
try {
connection = DriverManager.getConnection(url, username, password);
statement = connection.prepareStatement(INSERT_MESSAGE_COMMAN... |
873538ce-036e-4cd6-91fb-cb9c81bc54e4 | 0 | public Long getId()
{
return Id;
} |
aff3967a-9512-40a4-8ca6-663141bedec2 | 4 | public void genererTableau(String fonction, ArrayList<Photographe> listeP, ArrayList<Historien> listeH) {
String entete[] = {"ID", "Choisir " + fonction};
Photographe p;
Historien h;
jTable1.setToolTipText("Double clique pour choisir un utilisateur");
switch (fonction) {
... |
a0cebda1-8158-45c2-bca1-f5271bb27131 | 3 | public void BeginningThisHell(){ //Initialization of Stage objects massive
Judge judge = new Judge();
for (int itanks = 0; itanks < amountTanks; itanks++)
{
tanks[itanks] = new Tank();
for(int i = 0; i < amountStage; i++)
{
stage[... |
692193c7-b245-42a5-bba1-503728a57283 | 8 | public void viewBoard(Board board) {
int x, y;
String row;
Disc disc;
int[] rowCount = {1,2,3,4,5,6,7,8};
int[] contents = board.getContents();
System.out.println(" A B C D E F G H");
for (y=1; y < BOARD_SIZE+1; y++) {
row = "";
for (x=0; x < BOARD_SIZE+1; x++) {
disc = n... |
a39bd0cd-4f99-41f0-bfde-25554d1b3b00 | 0 | public double getFitness() {
return fitness;
} |
8af4b985-19f4-4050-84c4-b09ce374047c | 6 | @SuppressWarnings({"ToArrayCallWithZeroLengthArrayArgument"})
public void testValueCollectionToArray() {
int element_count = 20;
int[] keys = new int[element_count];
String[] vals = new String[element_count];
TIntObjectMap<String> map = new TIntObjectHashMap<String>();
for (... |
35975e79-bf06-40ef-aff8-0bb28a2c99c8 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Order)) {
return false;
}
Order other = (Order) object;
if ((this.orderid == null && other.orderid != null) || ... |
c3da0fad-1484-49c5-802e-5d8d4391ed2c | 1 | public LocalInfo getReal() {
LocalInfo real = this;
while (real.shadow != null)
real = real.shadow;
return real;
} |
c73e878f-cb05-4931-ad5b-34e57f6cf3d5 | 5 | public static void main(String[] args){
Socket socket;
try {
socket = new Socket("localhost",1457);
//code du client
try
{
Thread.sleep(0);
PrintWriter socketOut = new PrintWriter(socket.getOutputStream(), true);
BufferedReader clavier = new BufferedReader(new InputStreamReader(System.in));
... |
7a1d80f1-2814-40a1-b786-1bd128d03cf6 | 6 | public static void main(String[] args) {
if (args.length < 1) {
System.out.println(usage);
System.exit(1);
}
int lines = 0;
try {
Class<?> c = Class.forName(args[0]);
Method[] methods = c.getMethods();
Constructor[] constructors = c.getConstructors();
if (args.length == 1) {
int ind... |
99af7c7e-960c-4438-b00a-e61bbb37381d | 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... |
654ef734-5701-4e1c-8364-458592bebf6c | 2 | private static boolean isPalindrome(String s) {
char[] chs = s.toCharArray();
int i = 0;
int j = chs.length - 1;
while (i < j) {
if (!(chs[i] == chs[j])) {
return false;
}
i++;
j--;
}
return true;
} |
42c1288b-e2eb-4b7c-a9e3-46d2e41b3d99 | 7 | private void afterQueryProcess(Statement statement, Connection connection, ResultSet result) {
try {
if (result != null) {
result.close();
result = null;
}
} catch (SQLException ex) {
}
try {
if (statement != null) {
... |
d38178e9-de77-43b2-81c0-bdc7343b2f23 | 4 | public void modifyItem(Item item) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbC... |
eee48bc3-6d22-4742-8dce-8160299240de | 2 | public void setName(String name)
throws ClusterException {
if(name == null || name.equals(""))
throw new ClusterException("The file name of the song cannot be null or empty string");
this.name= name;
} |
0677cd84-04be-420c-8c25-6d6bcdc2258d | 6 | public void placeObject(Objects o) {
for (Player p : Server.playerHandler.players){
if(p != null) {
removeAllObjects(o);
globalObjects.add(o);
Client person = (Client)p;
if(person != null){
if(person.heightLevel == o.getObjectHeight() && o.objectTicks == 0)... |
d79cef21-8e01-459d-9c33-3ce382b94d1f | 9 | public boolean destroyItem(MOB mob, Environmental dropThis, boolean quiet, boolean optimize)
{
String msgstr=null;
final int material=(dropThis instanceof Item)?((Item)dropThis).material():-1;
if(!quiet)
switch(material&RawMaterial.MATERIAL_MASK)
{
case RawMaterial.MATERIAL_LIQUID:
msgstr=L("<S-NAME> po... |
da94fcd8-ed83-4ab0-afb8-65d79ccf5f0f | 4 | public static int getMTU() {
Enumeration<NetworkInterface> en = null;
int minMTU = Integer.MAX_VALUE;
try {
en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface ni = en.nextElement();
int mtu = ni.ge... |
465da3d0-366c-4ca6-a817-0d5219fb6ea6 | 0 | public void paint(Graphics g){
super.paint(g);
this.drawFields(g);
//System.out.println("paint activited");
calender = Calendar.getInstance();
this.drawTime(g);
} |
90904314-a41f-469e-9425-3f2b8ac624df | 4 | public static boolean isInt(String str)
{
if (str == null || "".equalsIgnoreCase(str))
{
return false;
}
for (String n : NUMBERS)
{
if (str.equalsIgnoreCase(n))
{
return true;
}
}
return false;
} |
b98167a9-798e-4771-96b2-fd41499d142b | 2 | public static void main(String[] args) {
EntityManager em = new JPAUtil().getEntityManager();
ContaDAO dao = new ContaDAO(em);
em.getTransaction().begin();
List<Conta> lista = dao.listaContaComGerente();
for (Conta conta : lista){
System.out.println(conta.getTitular());
if(conta.getGerente() != null)... |
3d3194c9-7a31-4a54-bc22-7712c659538f | 1 | public CurlConnection(String endpoint, String user,String password, String curlCommand,String curlDrop,
String curlURL, String curlUpdate){
Logger log = Logger.getLogger(this.getClass().getName());
log.setLevel(Level.FINE);
this.setLogger(log);
LogHandler.initLogFileHandler(log, "Connection");
this.curlCo... |
43741f9d-68e3-42f5-b654-6d33f3dea77a | 0 | private void readBlocks(Node parent, Automaton root, Set states,
Document document) {
Map i2b = new java.util.HashMap();
addBlocks(parent, root, states, i2b, document);
} |
2f88648b-7268-487c-baa6-6bd0b80d8184 | 1 | private void doUpdate() {
System.out.print("\n[Performing UPDATE] ... ");
try {
Statement st = conn.createStatement();
st.executeUpdate("UPDATE COFFEES SET PRICE = PRICE + 1");
} catch (SQLException ex) {
System.err.println(ex.getMessage());
}
} |
2d7c4422-b0e5-4952-865a-f4403e775b16 | 7 | public static List qualityList(Enumeration enm)
{
if(enm==null || !enm.hasMoreElements())
return Collections.EMPTY_LIST;
Object list=null;
Object qual=null;
// Assume list will be well ordered and just add nonzero
while(enm.hasMoreElements())
{
... |
1a12e546-2c91-41e9-86e7-2bd62ed9c678 | 8 | public Point[] findKClosestPoints(Point[] points, int k, final Point origin) {
if (points == null || points.length == 0 || points.length < k) {
return points;
}
Point[] result = new Point[k];
PriorityQueue<Point> queue = new PriorityQueue<Point>(k, new Comparator<Point>() {
@Override
public int c... |
0d885a66-ae0e-4f45-a443-37ce6097f021 | 7 | private void download(URL url, File file, int size)
{
System.out.println("Downloading: " + file.getName() + "...");
//minecraft.progressBar.setText(file.getName());
DataInputStream in = null;
DataOutputStream out = null;
try
{
byte[] data = new byte[4096];
in = new DataInputStream(url.openStream(... |
a4a9d64c-a9b0-4e27-ab69-038dbfc3c696 | 7 | private static void writeTrace(final Trace trace, final int traceId,
final JsonGenerator generator) throws IOException
{
generator.writeStartObject();
generator.writeNumberField(JsonTraceCodec.TRACE_ID, traceId);
generator.writeStringField(JsonTraceCodec.TRACE_NAME, trace.... |
76bbae57-e7d9-4c7f-b83c-061a946289ed | 1 | public static void main(String[] args) {
Heap h = Heap.make(S);
for (int i=0; i<N; i++) {
System.out.println("Allocating object " + i
+ " at address " + h.alloc(8));
}
h.dump();
System.out.println("Free space remaining = " + h.freeSpace());
} |
76b04c14-cf87-4d91-821d-808e8101db76 | 2 | public SignatureVisitor visitClassBound() {
if (state != FORMAL) {
throw new IllegalStateException();
}
state = BOUND;
SignatureVisitor v = sv == null ? null : sv.visitClassBound();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
} |
b7363417-0a02-45f4-849c-38a3935e44c2 | 2 | public byte[] getGenotypesScores() {
int numSamples = getVcfFileIterator().getVcfHeader().getSampleNames().size();
// Not compressed? Parse codes
if (!isCompressedGenotypes()) {
byte gt[] = new byte[numSamples];
int idx = 0;
for (VcfGenotype vgt : getVcfGenotypes())
gt[idx++] = (byte) vgt.getGenoty... |
1d2f241d-10e0-46e4-b03b-89a24d32d26e | 7 | private Point searchSpace(Rectangle bounds, int sides, int i, double p)
{
// The bounds of the string
int str_X = bounds.width;
int str_Y = bounds.height;
str_Y = bounds.height;
int x=(int)(p*width);
int l = 0;
while (x > 0 && x< width - str_X)
{
int k = 0;
int y= p_cen.y;
while (y > 0 &&... |
7f23b991-457e-41e6-ac51-208deb33caa4 | 5 | @Override
public FunctionEvaluator getClone() {
TabularFunction clonedT = new TabularFunction();
for (NodeVariable parameter : this.getParameters()) {
clonedT.addParameter(parameter);
}
if (debug >= 2) {
String dmethod = Thread.currentThread().getStackTra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.