method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9f076b66-7e29-4808-b6ee-ab120883f14c | 8 | private void checkDisplayMenu() {
if(!latexMethod) {
if(renderer != null) {
final String name = renderer.getClass().getName();
if(displayMenu.containsKey(name)) {
displayMenu.get(name).setSelected(true);
}
}
if(strategy != null) {
final String name = strat... |
77a724b2-eb0e-4c93-8700-908ba90f43cf | 2 | public static boolean containsIgnoreCase(List<String> strings, String str) {
for(String string : strings) {
if(string.equalsIgnoreCase(str)) {
return true;
}
}
return false;
} |
c5286358-4e78-4851-9d2a-55da82d8b6e5 | 7 | public static Cons expandXmlTagCase(Symbol item, Cons clauses) {
{ Cons outputClauses = Stella.NIL;
Stella_Object key = null;
{ Cons clause = null;
Cons iter000 = clauses;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
clause = ((Cons)(iter000.value));
ke... |
d6ba7065-cf28-4d8f-9f4a-3e0a64da0e97 | 7 | private void parseRow( int rowNumber ) throws Exception
{
Element rawRow = (Element) _rawRows.item( rowNumber );
int columnCount = getColumnCount();
_currentRow = new String[ columnCount ];
for ( int i = 0; i < columnCount; i++ )
{
... |
07ebf63d-1ec0-4f10-9541-f790152956cf | 6 | public static void main(String args[]) {
// Set Nimbus look and feel
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
... |
4c20d056-f3e6-45cb-9ab3-0603e39b69df | 2 | public boolean hasSameDef(final Instruction a, final Instruction b) {
return map.containsKey(a) && map.containsKey(b)
&& (map.get(a) == map.get(b));
} |
afaa82f5-b696-415f-910e-5a350eb20087 | 8 | public void readNumber()
{
try {
// System.out.println(MAXLENGTH);
System.out.print("Enter a number : ");
String num = input.readLine();
number = Double.parseDouble(num);
dotPosition = num.indexOf(".");
// System.out.println(dotPosition);
if(dotPosition == -1){
sReal = n... |
7af8fa09-bf08-48ca-93a3-513211029b67 | 0 | public void initialize() {
MAP = new HashMap();
} |
9664493b-8e1a-408e-9997-00e25f081842 | 2 | public void fillRandomly() {
for (int i = 0; i < rows; i++)
for (int j = 0; j < columns; j++) {
int r = (int)(256*Math.random());
int g = (int)(256*Math.random());
int b = (int)(256*Math.random());
grid[i][j] = new Color(r,g,b);
}
forceRedraw... |
d8b21575-f9c0-421d-9f0f-deeeacb3478d | 8 | @Test
public void test() {
for (int bytesPerFrame = 1; bytesPerFrame < 128; bytesPerFrame++) {
WholeFrameEndOfFileAction action = WholeFrameEndOfFileAction.create(bytesPerFrame);
for (int requestedFrames = 0; requestedFrames < 5 * bytesPerFrame; requestedFrames += bytesPerFrame) {
for (int actualFrames... |
e29871b5-5ec3-42de-ad69-7845f8d06d34 | 2 | @Override
public void Write(IOClient player, Server server) {
PacketPrepareEvent event = new PacketPrepareEvent(player, this, server);
server.getEventSystem().callEvent(event);
if (event.isCancelled())
return;
try {
player.WriteData(new byte[] { ID });
} catch (IOException e) {
// TODO Auto-generate... |
b9fc6248-e521-4b61-8545-942e238517ed | 0 | @Override
public void remove() {
this.armorItem = (HeadArmor) ItemFactory.create().buyItem(Constants.BASIC_HEAD_ARMOR);
} |
10eaf5d7-6945-48de-ba20-a68eaa7ba8a8 | 4 | public boolean SetRun(boolean run) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetRun() BEGIN");
}
m_running = run;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetRun() END");
}
return true;
} |
a96c333a-1ff2-452a-8887-a82f3bd28861 | 1 | public void notifyUpdate(int a) {
reset();
if (a == -1) {
hata.setText("Ürun Güncellenemedi!");
hata.setForeground(Color.RED);
} else {
hata.setText("Ürün Başarıyla Güncellendi!");
}
} |
6397ae46-65c7-4b1a-b03f-f4d2605c14f0 | 9 | @Override
public void companyShow() {
// TODO Auto-generated method stub
appListener.getCompany();
companyTable = new JTable(companymodel) {
private static final long serialVersionUID = 1L;
/**
*
* @param row row number
* @par... |
4f49bb34-77f5-4b52-af28-f8e46371ab0d | 9 | public static void ItemonObject(Client c, int objectID, int objectX, int objectY, int itemId) {
// c.getItems().checkForItem(itemId);
if (!c.getItems().playerHasItem(itemId, 1))
return;
switch(objectID) {
case 2783:
c.getSmithingInt().showSmithInterface(itemId);
break;
case 8151:
case 8389:
... |
88fdbfec-63e2-4b25-8cf4-7de4eebcc301 | 5 | final public CycList orForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException {
CycList sentences = null;
CycList val = new CycList();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OR_CONSTANT:
jj_consume_token(OR_CONSTANT);
break;
case OR_GUID_CON... |
52b49c94-9d49-4bac-95da-0e5991081e6d | 4 | @SuppressWarnings("deprecation")
public void restoreInv(Player rPlayer) {
rPlayer.getInventory().clear();
rPlayer.getInventory().setBoots(feet);
rPlayer.getInventory().setHelmet(helmet);
rPlayer.getInventory().setChestplate(chest);
rPlayer.getInventory().setLeggings(legs);
for (ItemStack item : contents) {... |
a4f2b7dd-74d2-41d1-aa7c-4a3ca566ce9c | 7 | private ArrayList<ArrayList<Integer>> createGen() {
ArrayList<ArrayList<Integer>> nextGen = new ArrayList<ArrayList<Integer>>();
double fitSum = getFitSum();
for (int i = 0; i < currGen.size(); i++) {
nextGen.add(new ArrayList<Integer>());
int parentOne = getIndividual(f... |
6e8c0e40-62ec-45c7-99e9-fa3f7300b8e4 | 8 | @EventHandler
public void onDeath(PlayerDeathEvent e){
Player player = e.getEntity();
if(player.getKiller() != null){
Player killer = player.getKiller();
if(killer.getItemInHand().getTypeId() == Item.STICK.id){
if(killer.getItemInHand().getItemMeta().hasDisplayName()){
if(killer.getItemInHand().getI... |
c7ded328-92f7-4023-a222-d4ce8c22d9b5 | 5 | private void editMealGoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editMealGoButtonActionPerformed
if (editMealNameTextField.getText().length() > 0
&& editMealCaloriesTextField.getText().length() > 0
&& editMealProteinTextField.getText().length() > 0)... |
8d5796fd-47e8-48ec-bda0-f9013587f445 | 0 | public Set<K> keySet() {
return this.map.keySet();
} |
a498da61-d8c6-44dc-af9c-8e15ffb0a7b3 | 7 | public M rotate(int deg) {
int rot = (deg + 45) / 90 % 4;
M m = rot % 2 == 0 ? new M(width, height) : new M(height, width);
for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) {
switch (rot) {
case 0: m.item(x, y, item(x, y)); break;
case 1: m.item(y, m.height-x-1, item(x, y)); break;
cas... |
8c3acecf-283c-4582-9c65-986a801fd914 | 8 | public addBottleGUI(Cellar c) {
//set up frame
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame = this;
myCellar = c;
setBounds(100, 100, 300, 450);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLay... |
12696deb-1a10-4d44-94a4-bb1cbb5033aa | 8 | private void jMenuItemFileLoadMatrixActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemFileLoadMatrixActionPerformed
NamedInputStream selectedInputStream = null;
try {
logger.info("Loading scoring matrix...");
selectedInputStream = FileChooserFactory.getF... |
398df877-9229-4cf3-ade1-1b46473557ad | 4 | public static int calcPhysics(double playerGuess) {
/*BEGIN
GET input
CHECK input
CALC minuteTime (t) Formula: t = (vf - vi) / a
ASSIGN (t) to var = correctTime
COMPARE correctTime to input
RETURN Boolean value; var = answer
END*/
int resul... |
d1ff7a16-4943-4718-b65c-de2da8a78bdc | 2 | public static String Primes(int n)
{
String result = "";
for (int i = 0; i <= n; i++)
if (IsPrime(i))
result += i + " ";
return result;
} |
e48d2f05-1ae2-4109-ae12-2a21d84b1c72 | 9 | public HashMap parse_vorbis_comment(RandomAccessFile fh, PageInfo.PageParser pp, long offset, long payload_len) throws IOException {
HashMap tags = new HashMap();
long last_byte = offset + payload_len;
// skip vendor string in format: [LEN][VENDOR_STRING] -> 4 = LEN = 32bit int
offset += 4 + raf2le32(fh, offse... |
cdb2d61f-2466-48ba-89ae-871d4364fea9 | 2 | private boolean boardDimensionsWrong() throws IOException {
Scanner scanner = new Scanner(filePath);
int firstRowLength = scanner.nextLine().length();
while (scanner.hasNextLine()) {
if (!(firstRowLength == scanner.nextLine().length())) {
scanner.close();
... |
6248285f-fca1-4624-8b8d-837cbb956730 | 8 | public static String replaceFirst(String str, String thisStr, String withThisStr)
{
if ((str == null) || (thisStr == null) || (withThisStr == null) || (str.length() == 0) || (thisStr.length() == 0))
return str;
for (int i = str.length() - 1; i >= 0; i--)
{
if (str.charAt(i) == thisStr.charAt(0))
{
i... |
87722721-01bb-4547-bb16-08f8681d5b84 | 7 | private String verificarResultadoLotoPorJogo(List<String> jogoSorteado, Bilhete bilhete) {
StringBuffer sb = new StringBuffer(" : Dezenas Acertadas ");
List<String> dezenasApostadas = bilhete.getJogo();
int numeroDeAcertos = 0;
for(String dezenaApostada : dezenasApostadas){
if(dezenaSorteadas(dezenaApost... |
b130d110-1482-4173-baf2-f8e4bac141f8 | 1 | public void setUrl(String url) throws NullURLException {
if (url == null) {
throw new NullURLException("Link of image is null");
}
this.url = url;
} |
c64481cf-f298-4eb7-a465-30e3a0389d55 | 8 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if(msg.target()==this)
{
if(msg.targetMinor()==CMMsg.TYP_WEAR)
{
// the order that these things are checked in should
// be holy, and etched in stone.
if(behaviors != null)
{
for(final Behavior B : behaviors... |
477ca2ed-3066-4538-bbb0-4ce1f2112dc1 | 3 | public static List<Operation> getOperations(String filePath) throws Exception {
readFile(filePath);
List<Operation> operations = new ArrayList<Operation>();
for(int i = 0; i<instructionString.size(); i++) {
String s = instructionString.get(i);
if (s.contains(";")) {
String[] tmp = s.split(";");
for(... |
5616a056-a411-4563-8753-c28928fcdde9 | 3 | private static Object load(String name)
{
//String nomFichier;
FileInputStream f = null;
ObjectInputStream in = null;
Object resultat;
try
{
f = new FileInputStream(name);
System.out.println("test1");
}
catch(FileNotFoundExcep... |
33518d54-bec3-4d69-9c4e-4b751904e6cc | 3 | public void testCompareTo() {
YearMonthDay test1 = new YearMonthDay(2005, 6, 2);
YearMonthDay test1a = new YearMonthDay(2005, 6, 2);
assertEquals(0, test1.compareTo(test1a));
assertEquals(0, test1a.compareTo(test1));
assertEquals(0, test1.compareTo(test1));
assertEquals(0... |
c13cc103-0583-4c89-ad1e-c0e7db3fc311 | 9 | @Override
public int fireChatEvent(HashMap eventDescription) {
if (eventDescription.get("$event").equals("376")) {
// We are connected, check the notify
//
checkNotify();
return EVENT_DONE;
}
lag.setLag();
if (eventDescription.get("$event").equals("303")) {
String parms = (String) eventDescrip... |
2c06d6b4-3578-4f75-944d-4703885b5277 | 4 | public void set(String counterName, long[] countersValue) {
if(counterName.equals("Reduce input groups")) {
Reduce_input_groups = countersValue;
}
else if(counterName.equals("Combine output records")) {
Combine_output_records = countersValue;
}
else if(counterName.equals("Map input records")) {
Map_i... |
7ef4ae3d-2ee0-4128-a5c5-63a75d0d1cde | 4 | public List<TileType> getRelatedTileTypes(TileType tileType) {
List<TileType> relatedTileTypes = new ArrayList<TileType>();
for (TileType t : tileTypes) {
for (String s : tileType.getTags()) {
if (!s.equals("COMMON") && t.getTags().contains(s)) {
relatedTi... |
d337f452-d42f-4569-87aa-fd148739d3ce | 2 | public static ArrayList<Medicine> listMedicines() {
String query = "SELECT * FROM medicine";
DBA dba = Helper.getDBA();
ArrayList<Medicine> medicines = new ArrayList<>();
try {
ResultSet rs = dba.executeQuery(String.format(query));
while (rs.next()) {
... |
4c31b639-24b0-4561-8cdd-716115b653a9 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(affected==null)
return true;
if(!(affected instanceof MOB))
return true;
if((msg.target()==affected)
&&(msg.source()!=affected)
&&(CMath.bset(msg.targetMajor(),CMMs... |
99290d47-f3ad-4e66-939b-23025caeee6e | 0 | public MyCellRenderer() {
setOpaque(true);
} |
0f0c0a2a-5e25-47e3-8d3a-8dd4f61e9adc | 2 | public void render2(Graphics g)
{
if(cSelect != null)
{
cSelect.getInventory().render(g);
if(Game.inGrid(cSelect.getX(), cSelect.getY()))
{
g.setColor(Color.BLUE);
g.fillRect(Game.MAPOFFX + (cSelect.getX() - Game.xOff) * Game.TILESI... |
6622a739-2a1f-48e5-a45a-c80089328532 | 5 | private void load_file( String file ) {
file = file.trim();
for(int i=0; i < base_urls.length; i++ ) {
URL u = null;
try {
String path = base_urls[i].getPath();
int idx = path.lastIndexOf( '/' );
if ( idx >= 0 ) {
path = path.substring( 0, idx );
}
u = new URL( base_u... |
9a27eabc-597d-4e69-abf9-1e5fd2e6a957 | 5 | private void EnterPINActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EnterPINActionPerformed
JLabel jPassword = new JLabel("Enter your PIN: ");
JTextField password = new JPasswordField();
Object[] ob = {jPassword, password};
int result = JOptionPane.showConfirmDialog(t... |
3a947973-5ae9-44f7-be49-3973dcad67ab | 7 | protected void addHeadLiterals(Rule rule, List<Literal> literals, String postfix) throws RuleException {
try {
if (literals == null || literals.size() == 0) return;
if ("".equals(postfix)) {
for (Literal literal : literals) {
rule.addHeadLiteral(literal);
}
} else {
for (Literal literal : li... |
6aafd393-9bc4-4174-9157-e74911b1f88b | 2 | public void start() {
initGL(800,600);
init();
while (true) {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
render();
Display.update();
Display.sync(100);
if (Display.isCloseRequested()) {
Display.destroy();
System.exit(0);
}
}
} |
dafc7428-d5ff-4a3f-b567-7aa87cbf68c5 | 4 | public int getType(int y, int x) {
if(x >=0 && y >=0 && x < mapXRows && y < mapYRows){
int rc = map[y][x];
int r = rc / numTilesAcross;
int c = rc % numTilesAcross;
return tiles[r][c].getType();
}
return -1;
} |
44024275-d13a-4215-9562-453e0b5854f6 | 3 | public LongOpt(String name, int has_arg, StringBuffer flag, int val)
throws IllegalArgumentException {
// Validate has_arg
if ((has_arg != NO_ARGUMENT) && (has_arg != REQUIRED_ARGUMENT)
&& (has_arg != OPTIONAL_ARGUMENT)) {
Object[] msgArgs = { new Integer(has_arg).toString() };
throw new IllegalArgumen... |
eaf86950-4db7-4382-b9fa-a77e92b2ff65 | 4 | public void writeTofile(String content, File file){
System.out.println("write to file: " + content);
BufferedWriter writer = null;
try{
writer = new BufferedWriter(new FileWriter(file));
writer.write(content);
writer.newLine();
}catch(FileNotFoundException ex){
ex.printStackTrace();
}catch(IOExcep... |
f1eb6e79-0b8c-4166-afcd-98c27c9c9c83 | 7 | private void showState(ViewState viewState) {
switch (viewState) {
case Init:
statusLabel.setText("Init...");
changeBgColor(COLOR_INIT, false);
break;
case Connecting:
statusLabel.setText("Connecting...");
if... |
4d37f913-fc77-4779-92ef-e4a2ac519152 | 7 | @Override
public void migrate() throws Exception {
try {
String newLine = "";
while ((newLine = reader.readLine()) != null) {
if (newLine.trim().length() == 0) {
continue;
} else if (newLine.startsWith(META_PREFIX)) {
... |
aae6def4-5d14-4fbc-a186-f979370dd8e5 | 8 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == bt_open1) {
//Do something
//IJ.log("pushed open1");
this.watchpath = IJ.getDirectory(""); ;
setWatchpath(this.watchpath);
directory.setText(this.watchpath);
}
if (e.getSource() == bt_open2) {
//Do something
//IJ.log("pushed op... |
ca0d3339-ddd6-42a9-a809-f5aa2ffc6ea9 | 1 | @Override
public void actionPerformed(ActionEvent e)
{
if ("new".equals(e.getActionCommand()))
{
Main.openCardTypeSelection();
}
else
{
Main.openFileSelection();
}
} |
4459ad55-c59c-45eb-bc65-4e0db47dea0b | 2 | public void loadCommands(HashMap<String, Rank> commands) {
File file = new File(data, "bot.settings");
Line[] lines = readFile(file);
for (Line line : lines) {
if (line.startsWith("command:")) {
Line[] data = line.substring(8).split(":");
commands.put(data[0].toString(), Rank.parseLine(data[1]));
}
... |
e640b61f-919b-436d-a96a-8714734d4be0 | 1 | public static Version ofWebapp(ServletContext context)
{
try
{
return fromUrl(context.getResource(MANIFEST_PATH));
}
catch(MalformedURLException murle)
{
throw new RuntimeException(murle);
}
} |
d7da0fc3-5448-4e03-91b9-210d77dbeb88 | 4 | private static void selectActionEnterCombat(String charClass, String[] mob, Scanner scan, Random gen, Character player) { // Parameters: The character's class
if (charClass == "Mage") {
System.out.println("The leader of the " + mob[1] + " turns round and looks at you,\n\nDo you either:\n1) Engage in combat with a ... |
e0a82053-02c8-497a-9cbc-b96014367aa8 | 4 | private void saveDesignToNewFile() {
JFileChooser fc = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter(
"Simu Files", "smu");
fc.setFileFilter(filter);
fc.setSelectedFile(file);
int returnVal = fc.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
... |
1cd4bbfb-8096-4b92-a587-baac4191672c | 7 | public static PersonDetails patternMatch(Multipart mp) throws ResponseException{
//System.out.println("Inside()");
String[] name=new String[2];
String nameLocation=null;
BufferedReader br = null;
PersonDetails personD=new PersonDetails();
ArrayList... |
93018033-4025-4be5-a4f9-09e3b16ab9c8 | 0 | @ManyToOne
@JsonIgnore
public Event getEvent() {
return event;
} |
d33ed02f-483c-4c07-af0a-2fd177307fba | 7 | public int longestValidParentheses(String s) {
Stack<Character> sc = new Stack<Character>();
Stack<Integer> si = new Stack<Integer>();
int i=0,max=0;
for(i=0;i<s.length();i++){
char c = s.charAt(i);
if(si.isEmpty()||c=='('){
si.push(i);
... |
6cd31c68-f5c5-4fe9-9d1b-bb04afdd4588 | 3 | public boolean collide_dynamic() {
for(int i = 0; i < Fenetre._list_walkers.size(); i++) {
//Ici on verifie que le rectangle de l'objet dans lequel on est collide avec un des objets de la liste static
if (Fenetre._list_walkers.get(i).getSolid() && _r.intersects(Fenetre._list_walkers.get(i).getRect())) {
Fen... |
d962fafa-28eb-4abd-be77-223b827cafc1 | 2 | public void testToStandardSeconds_years() {
Period test = Period.years(1);
try {
test.toStandardSeconds();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.years(-1);
try {
test.toStandardSeconds();
fail(... |
e7050eea-e110-46fe-9324-cb2ffc0a5ba3 | 2 | public void addInstance(Instance inst)
{
data.add(inst);
if(inst.type == InstanceType.Train)
trainCount++;
else if(inst.type == InstanceType.Test)
testCount++;
else
quizCount++;
} |
fa5b8a69-00be-4b09-9122-1541cb861d3f | 5 | @Override
public void run() {
long previousTime = System.nanoTime();
while(!stopThread) {
final long nanoTime = System.nanoTime();
final long elapsedTime = nanoTime - previousTime;
previousTime = nanoTime;
if (!paused) {
fireUpdateEvent(elapsedTime);
totalTime += elapsedTime;
... |
78fd36d3-c931-4074-ad6b-6cc773c22e28 | 1 | protected boolean modified(long lastModified) {
long since = getRequest().getDateHeader("If-Modified-Since");
if (since < (lastModified / 1000 * 1000)) {
getResponse().setDateHeader("Last-Modified", lastModified);
return true;
} else {
getResponse().setStatus(... |
bfdce427-6595-41a0-8b0d-aecdb8bf586d | 8 | public void bjTie()
{
int selected = bjGameOverPane.showConfirmDialog(null, "It was a tie! Play again?", "Game over!", JOptionPane.OK_OPTION);
if(selected == JOptionPane.OK_OPTION)
{
ArrayList temp, temp1;
temp = blackJackOb.getPlayerCards();
temp1 = blackJackOb.getDealerCards();
for(int i = 0; i < temp... |
1d4fafe0-e054-4bbc-9ae3-e9b35cbaa886 | 1 | private boolean isHalfSize() {
if (queueSize < (personArray.length /2)) {
return true;
}
else {
return false;
}
} |
3b4a0089-71d2-4d41-bf8d-d8fbc5bd082e | 5 | private final void extendBounds(double[] location) {
if (minLimit == null) {
minLimit = new double[dimensions];
System.arraycopy(location, 0, minLimit, 0, dimensions);
maxLimit = new double[dimensions];
System.arraycopy(location, 0, maxLimit, 0, dimensions);
return;
}
for (int i = 0; i < dimensions... |
84e2a447-d792-4b70-bb85-b161454a3ee8 | 0 | public manufacturer(String id){
super(id);
} |
1bfaec71-1c4e-43e4-8578-8941d8596723 | 3 | @Test
public void testTeamCityProperties() {
MavenProperties properties = new MavenProperties("~/.m2/settings.xml");
try {
properties.fetchProperties();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
... |
587d35fa-76d7-45a4-a379-9b5ba1bf807c | 7 | public static void createMap(Connection cCon) throws SQLException{
DatabaseMetaData md = cCon.getMetaData();
Statement state = cCon.createStatement();
ResultSet tables = md.getTables(null, null, "%", null);
while (tables.next()) {
ResultSet getColumns = md.getColumns(null, null, tables.getString("TABLE_NAME"... |
f59b8826-17b1-4f35-9c86-c66788f92f74 | 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... |
63320dfb-7aca-46a7-8e90-af5fccd8091f | 6 | public Iterator iterator() {
// /#ifdef JDK12
cleanUp();
// /#endif
return new Iterator() {
private int bucket = 0;
private int known = modCount;
private Bucket nextBucket;
private Object nextVal;
{
internalNext();
}
private void internalNext() {
while (true) {
while (nextBu... |
09c0325d-6a79-47df-a61f-8ed0172bd875 | 1 | public List<Cultivo> ObtenerCultivo(String consulta){
List<Cultivo> lista=new ArrayList<Cultivo>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
fb097c9a-67eb-4fd4-a107-22437856d221 | 3 | public static RenderType byteToRenderType(byte b)
{
switch(b)
{
case 0:
return RenderType.SOLID;
case 1:
return RenderType.TEX;
case 2:
return RenderType.ANIM;
}
return null;
} |
6027ac76-38e6-4442-8f8a-91e5b7a0b2fd | 4 | @RequestMapping(value = "/addResult", method = RequestMethod.POST)
public @ResponseBody
String getTestResult(@RequestParam int id) {
Map<String, String> answers = new TreeMap<String, String>();
if (answerService.getAnswerById(id).getIsCorrect()) {
answers.put("green", answerService.getAnswerById(id).getAnswer(... |
0adc78ee-594e-4ce1-9fd2-32d8d4192c35 | 7 | @Override
public void recursiveDropMOB(final MOB mob, final Room room, final Item thisContainer, boolean bodyFlag)
{
// caller is responsible for recovering any env
// stat changes!
if(CMLib.flags().isHidden(thisContainer))
thisContainer.basePhyStats().setDisposition(thisContainer.basePhyStats().disposition... |
2fea5644-1d6e-41f8-bc91-8013178a4a1c | 4 | private void searchCard(){
Card c;
int index;
System.out.println("Enter the index of the card:");
index = sc.nextInt();
sc.nextLine();
c = this.deck.searchCard(index);
if(c != null){
if(c instanceof EnergyCard){
this.showEnergyCard(c);
}else if(c instanceof TrainerCard){
this.showTr... |
67347a98-0d94-4d67-b02f-e5b67082803f | 2 | public void setMessage(String m, int id){
map.addObject (this, 512, 500);
if (id == 1){
color = warningColor;
} else if(id == 2){
color = startColor;
}
message = m;
trans = 500;
show = true;
bg.setTransparency (255);
r... |
4c1acead-80f7-4f48-b0d8-f572c62f3dc0 | 3 | @Override
public final Product findProduct(String prodID){
Product productFound = null;
for(int i = 0; i < products.length; i++){
if (prodID.equals(products[i].getProdID())){
productFound = products[i];
break;
}
}
if(productFoun... |
addbcae7-4fa6-431f-82f0-a47b98aca1eb | 6 | @Override
public void processPacket(Client c, int packetType, int packetSize) {
int itemId = c.getInStream().readSignedWordA();
if (!c.getItems().playerHasItem(itemId,1))
return;
switch (itemId) {
case 11694:
c.getItems().deleteItem(itemId,1);
c.getItems().addItem(11690,1);
c.getItems().add... |
3254228b-1851-4604-9bbf-235f8896a26b | 7 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
JSONObject jb = new JSONObject();
String userId = request.getParameter("userId");
String dateTimeInMillis = request.getParameter("dateTimeInMillis");
dat... |
0d7eeeaf-1d1d-4810-999a-88fef5e8ad6f | 3 | * @param show Boolean that specifies the visible state to be assigned.
*/
public void cellsToggled(Object[] cells, boolean show)
{
if (cells != null && cells.length > 0)
{
model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
model.setVisible(cells[i], show);
}
}
fi... |
5e9b1195-399c-4d4c-929f-7a90399aa9f0 | 8 | @Override
public void statusUpdate(SchedulerDriver driver, TaskStatus status) {
TaskID taskId = status.getTaskId();
LOGGER.log(Level.INFO, "Status update: task {0} is in state {1}", new Object[]{taskId, status.getState()});
if (!results.containsKey(taskId)) {
throw new IllegalSt... |
97fda7ea-b7a6-4d6e-8b17-4b6fdb56dbb7 | 1 | protected JComponent initTable()
{
myTable = new JTable(new AbstractTableModel()
{
public final String[] COLUMN_NAMES = new String[]{"#", "Description"};
public Object getValueAt(int r, int c)
{
if(c == 0)
... |
bc09f5d3-dc27-4649-b8d9-3ef26e0e2f11 | 1 | public JSONObject toJson() {
JSONObject rtn = new JSONObject();
try
{
rtn.put("id", this.getId());
rtn.put("name", this.name);
rtn.put("capacity", this.capacity);
} catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return rtn;
} |
88d104f6-34ba-4fe8-9e0a-30aa6fd7ec56 | 6 | private boolean r_other_suffix() {
int among_var;
int v_1;
int v_2;
// setlimit, line 55
v_1 = limit - cursor;
// tomark, line 55
if (cursor < I_p1)
{
return fa... |
196c51f7-febb-4afd-a0eb-3f175c3e309d | 1 | public void playLoop() {
try {
new Thread() {
public void run() {
clip.loop(Clip.LOOP_CONTINUOUSLY);
}
}.start();
} catch (Throwable e) {
e.printStackTrace();
}
} |
400ad2ee-463d-4a22-be71-597246a1cd1a | 5 | public void register(Object owner, Object toRegister, Class<?>... classes)
{
if (toRegister instanceof ArgumentReader)
{
readers.register(owner, (ArgumentReader)toRegister, classes);
}
if (toRegister instanceof DefaultValue)
{
defaults.register(owner,... |
c753e9df-60f2-4541-bccd-3ba1fe5ad471 | 4 | BiomeChunk getChunk(int x, int z)
{
if (x < px || x >= px + sx)
return null;
if (z < pz || z >= pz + sz)
return null;
return chunks[x - px][z - pz];
} |
3f42cbd6-f4d9-421b-8c7b-377f4881ee5c | 5 | static void MergeSort(int[] A, int p, int r) {
if (p < r) {
if((r-p)>11){
int q = p + ((r-p)>>1); // Get the medium element by shifting
MergeSort(A, p, q);
MergeSort(A, q+1, r);
Merge(A, p, q, r);
} else { // Insertion sort
for(int i=p, j=i; i<r; j=++i) {
int ai = A[i+1];
... |
f86216da-3a5e-4ea4-a7b6-039dc889a5a0 | 7 | Score getScores(int[] sweets){
Score optimal = null;
for(int i=0; i<sweets.length; i++){
if(sweets[i]!=0){
int[] newSweets = new int[sweets.length];
for(int j=0; j<sweets.length; j++){
if(Math.abs(i-j)==1) newSweets[j] = sweets[j]*2; else n... |
59b50007-0ede-4487-bc2f-a4e3ad23ed6a | 5 | public static double binomialProb(double p, int n, int k) {
if (p < 0.0D || p > 1.0D) throw new IllegalArgumentException("\np must lie between 0 and 1");
if (k < 0 || n < 0) throw new IllegalArgumentException("\nn and k must be greater than or equal to zero");
if (k > n) throw new IllegalArgumentException("\nk is... |
4dbcde00-cc1d-48a2-90f8-809fda6b912a | 7 | void hsvToRgb() {
// no saturation means it's just a shade of grey
if (saturation == 0) {
rgb = (value << 16) | (value << 8) | value;
}
float f = (hue) / 60.f;
f = f - (float) Math.floor(f);
float s = saturation / 255.f;
int m = (int) (value * (1 - s));
int n = (int) (value * (1 - s * f));
int k ... |
b70ccc09-1e23-419f-baab-40a47b78551e | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
Aircraft other = (Aircraft) obj;
if (aircraftRegistration == null) {
if (other.getRegistration() != null)
return false;
} else if (!aircraftRegistration.equals(other.getRegistration()))
... |
0c673456-f9a0-48af-b80e-787f2483954d | 6 | public void run ()
{
L.clear();
L.addElement("..");
if (Path.getText().equals("")) Path.setText(".");
try
{
FTP ftp = new FTP(getServer());
ftp.open(getUser(), Password.getText());
String path = Path.getText();
FtpDir = path;
if (path.endsWith(Separator)) path = path + ".";
Enumeration e = ... |
247f2b20-3c05-4f25-ba95-c91607a135c4 | 9 | protected Class findClassDirectly(String name) throws ClassNotFoundException {
//First look at jars that have had Classes from the Same Package
String packName = getPackageName(name);
HashSet set = (HashSet) packageCache.get(packName);
if (set == null) set = new HashSet();
if (!set.isEmp... |
bb482aa0-35b7-4219-9f7b-7e030f1e650b | 2 | public void teeSiirto() {
etsiSiirrot();
Siirto paras = this.keko.suurin();
int x = paras.getX();
int kierrot = paras.getKierrot();
this.putoava.putoa();
if (kierrot > 0) {
for (int i = 0; i < kierrot; i++) {
this.putoava.kierra();
... |
39fe8c92-1720-400b-9ad6-3b6d448970fa | 1 | @Override
public void setData(Map<String, String> testData) {
setName(testData.get("name"));
try {
cathegory.selectOption(testData.get("cathegory"));
pocket.selectOption(testData.get("pocket"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.