method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e037363b-c654-4fe8-954b-138bf55c6749 | 1 | public void printReaction(){
System.out.printf(""+molReactants.get(0).toStringf()+" + "+molReactants.get(1).toStringf()+" --> ");
System.out.printf(""+molProducts.get(0).toStringf());
for(int i=1; i< molProducts.size(); i++){
System.out.printf(" + "+molProducts.get(i).toStringf());
}
... |
f133b3cc-388b-4884-a0ec-555347e484cd | 5 | public void setArea(BackgroundColor c, int start, int end) {
int color = c.ordinal();
if (start < 0 || start >= 60 || end < 0 || end >= 60)
return;
for (int i = start; i < end; i++)
m_hasColor[color][i] = true;
repaint();
} |
b2d84a4a-bd9a-4e50-a17e-af7ad816891b | 7 | public boolean compare(Predicate.Op op, Field val) {
IntField iVal = (IntField) val;
switch (op) {
case EQUALS:
return value == iVal.value;
case NOT_EQUALS:
return value != iVal.value;
case GREATER_THAN:
return value > iVal.value;
c... |
555d8bf2-e325-4e84-82d1-6e6851efc5cb | 4 | private void setAction()
{
loginButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
String username = inputUser.getText();
String password = inputPass.getText();
User user = null;
if(username.length()!=0 && password.length()!=0)
{
... |
fc19cefd-217c-4ea4-a7ea-4ab4e7c8c483 | 0 | @Override
public int multiply(int a, int b) {
return a * b;
} |
f5338fea-74a8-43b2-ba64-051b98107e1f | 7 | public ListNode reverseBetween(ListNode head, int m, int n) {
if (head == null || head.next == null || m >= n) {
return head;
}
ListNode dummy = new ListNode(0);
dummy.next = head;
int curPos = 0;
ListNode pre = dummy;
while (curPos < m - 1 && pre != null) { // find m-1
pre = pre.next;
curPos++;
... |
c2cfdc2b-fb06-45e5-b2ad-f0dc7a0acb59 | 8 | @Override
public void onEnable() {
getConfig().options().copyDefaults(true);
saveConfig();
allDeaths = getConfig().getDouble("dropSkulls.allDeaths", 0);
killedByPlayer = getConfig().getDouble("dropSkulls.killedByPlayer", 1);
placeInKillerInv = getConfig().getBoolean("dropSku... |
5ecb5bbf-6ae8-44f3-9c32-8374dabd456f | 4 | public FileIO(String directory, String fi, boolean app){
log = new Logger();
s = System.getProperty("file.separator");
File dir = new File(directory);
if (!dir.exists()){
dir.mkdirs();
}
// get the path to the file
file = new File(dir... |
8c4c6f68-7c71-460c-860b-1057df417982 | 9 | private String getToken(boolean quoted) {
// Trim leading white spaces
while ((i1 < i2) && (Character.isWhitespace(chars[i1]))) {
i1++;
}
// Trim trailing white spaces
while ((i2 > i1) && (Character.isWhitespace(chars[i2 - 1]))) {
i2--;
}
/... |
f7d7c971-5b42-46fb-a0d8-892b6a98c349 | 3 | public void click(final MenuItem CLICKED_ITEM) {
List<Transition> transitions = new ArrayList<>(items.size() * 2);
for (Parent node : items.keySet()) {
if (items.get(node).equals(CLICKED_ITEM)) {
// Add enlarge transition to selected item
ScaleTransition enlar... |
a004c0ea-3720-4350-9781-accf81854b1e | 3 | @Override
public GameState doAction(GameState state, Card card, int time) {
if(time == Time.DAY)
{
//Do nothing
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
state = temp.doAction(state, card, time);
}
else if(time == Time.NIGHT)
{
state = freedSlaveNightAction(stat... |
2dd7f85d-dff3-4d0f-8a21-1beb0f6ba6bc | 9 | protected void moveToNewLocation(int flag, double supp, double conf,
double dsupp, double dconf, double accuracy, int numCRs) {
switch (flag) {
case 0: // Increase support (north)
moveLocDataForIncSupp();
break;
case 1: // Increase support and confidence (north-east)
moveLocDataFo... |
98de0b98-fe6d-4e7c-bf5b-54cb42d3c901 | 9 | public boolean stoppingStrategy(int[] bowl, int round) {
int choicesLeft, cutoff = 0;
boolean pickFlag = false;
choice++;
choicelist[choice] = bowl.clone();
if (round == 0) {
choicesLeft = nplayers - index - choice;
if((choice + 1) > Math.round((nplayers - index) / Math.E))
pickFlag = true;
} ... |
99d6990b-7a7b-4d7b-a8c0-421b961ed5f5 | 0 | @Override
public void onReceiveStart(long totalBytes) {
System.out.print(totalBytes);
} |
9e89cd00-2090-4c1d-836b-2bbca8c65df3 | 1 | private static int search1(Cards[] hands, Cards board, int numhands, int[] wins, int[] ties, Cards remaining) {
int total = 0;
for (Card card1 : remaining) {
board.add(card1);
total = rankHands(hands, board, numhands, wins, ties, total);
board.remove(card1);
}... |
6d3a3be8-8e7c-4755-beba-6c43b8a23ae4 | 2 | private void btnExportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportActionPerformed
String input = Utils.showFileChooser("Opslaan", "Tijdlijst");
if (!input.isEmpty()) {
boolean inverted = Utils.promptQuestion("Wilt u de tabel omgedraaid of precies zoals hierbov... |
171ae673-b685-4a44-8912-d3bc4b21fa0c | 9 | @Override
public void onMeasure(int width, int height) {
super.onMeasure(width, height);
int totalWidth = 0;
int totalHeight = 0;
if (children.size() == 0) {
totalHeight = 10; // TODO This is so bad, but if onMeasure is called before children are added...what can we do?
... |
a7f39ce2-8800-4b55-9ea5-d42dbb7fec57 | 8 | @Override
public void update() {
// If player wishes to skip screen
if(Keybind.CONFIRM.clicked()) {
// Remove current screen
splashImages.poll();
// Stop any sound effects playing
// Restart screen if a new one exists
if(!splashImages.isEmpty()) {
timer = 5f;
Camera.get().addScreenEffect... |
28fec0bd-5d08-4112-bbb0-1b0854d65671 | 8 | public void combine(String IP_PORT,String apiKey){
DBService dbService = new DBService();
HashMap data = null;
if(link.contains("dgtle")){
PageDgtle pageDgtle = new PageDgtle();
data = pageDgtle.getInfo(this.link);
}
if(link.contains("huxiu")){
... |
1f7a62c8-0983-4089-b8ec-bd3c375167f5 | 5 | public boolean removeCompletely(String name) {
Connection conn = null;
PreparedStatement ps = null;
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("DELETE FROM " + Constants.SQLTable + " WHERE username = ? LIMIT 1");
ps.setString(1, name);
ps.ex... |
6fe46e2b-bbe4-4386-919f-56d85f59ff86 | 2 | public static void main(String[] args)
{
String[][] cartoons =
{
{ "Flintstones", "Fred", "Wilma", "Pebbles", "Dino" },
{ "Rubbles", "Barney", "Betty", "Bam Bam" },
{ "Jetsons", "George", "Jane", "Elroy", "Judy",
"Rosie", "Astro" },
{ "Scooby Doo Gang", "Scooby Doo", "Shaggy", "Vel... |
f31d1c8f-367b-4980-86a2-c2ad06600a4b | 0 | @Override
public String getGoTo() {
return null;//goToList;
} |
a090d621-a921-48f4-8b1f-6a7646368902 | 3 | public void createFSFolders(int currentLevel, String currentPath) {
if (currentLevel > this.levels) {
return;
}
for (int i = 0; i < this.foldersPerLevel; i++) {
try {
String folderName = "l" + currentLevel + "-c" + (i + 1);
FileUtils.forceMkdir(new File(currentPath + folderName));
String newP... |
643634db-2f86-4268-b2fa-696550c8fd2f | 5 | private void fetchingEmails() {
/* Ab Java 7: try-with-resources mit automat. close benutzen! */
try {
/* Socket erzeugen --> Verbindungsaufbau mit dem Server */
clientSocket = new Socket(user.getServerAdress(), user.getPort());
/* Socket-Basisstreams durch spezielle Streams filtern */
outToServer = n... |
4e026f5c-1831-4ca1-8e06-e489764773e4 | 4 | public String readString(int sz) throws IOException {
if (sz == 0) return null;
byte[] buf = new byte[sz];
int i = 0;
for (; i<sz; i++) {
int b = read();
if (b == 0) break;
buf[i] = (byte)b;
}
if (i == 0) return null;
return new String(buf, 0, i);
} |
6a45eea3-14cf-4ec6-9124-5779237d4b26 | 0 | public void setUserId(String userId) {
this.userId = userId;
} |
362740f4-3f40-4cda-8850-ed9ac6433544 | 9 | final public ASTN_Recipient N_Recipient() throws ParseException {
/*@bgen(jjtree) N_Recipient */
ASTN_Recipient jjtn000 = new ASTN_Recipient(JJTN_RECIPIENT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
N_PluginExp();
jjtree.closeNodeScope(jjtn000, true);
... |
be1fdc8c-bbb3-442e-af75-fc27daaab987 | 9 | @SuppressWarnings("unchecked")
public static void unzip(String zipFileName, String extPlace) throws Exception {
try {
(new File(extPlace)).mkdirs();
File f = new File(zipFileName);
ZipFile zipFile = new ZipFile(zipFileName);
if((!f.exists()) && (f.length() <= 0)) {
throw new Exception(... |
3f667f74-e18c-4193-81f6-3c00e800db65 | 0 | public Sprite(int[] pixels, int width, int height) {
this.pixels = pixels;
this.width = width;
this.height = height;
} |
5d16a783-dca7-4571-8f16-e28dbc252e4f | 3 | public void addCSV(String absolutePath, int readMode) {
String s = "";
RosterDB newDB = readCSV (absolutePath);
for (Roster r: newDB.getRosters()) {
if (rosterExists (r) && (readMode == READ_MODE_ADD)) {
s += "Ignoriere doppelten Fahrtenleiter " + r.getGivenName() + " " + r.getFamilyName() + "\n";
... |
fb2bb0fa-0968-4f4b-81eb-7398b9f1191c | 8 | private void buildBoard() {
int rows = polymino.boardRows();
int cols = polymino.boardCols();
if (board == null) {
board = new int[rows][cols];
}
for (int row = 0; row < rows; ++row) {
for (int col = 0; col < cols; ++col) {
if (polymino.getBoard()[row][col]) {
// wall
board[row][col] = -2;... |
a4323aab-85b9-426e-95e5-ead34163545b | 4 | public void attachHost(GridSimCore entity, PacketScheduler sched)
{
String msg = super.get_name() + ".attachHost(): Error - ";
if (entity == null)
{
System.out.println(msg + "the entity is null.");
return;
}
if (sched == null)
{
Sy... |
db54bf3c-a05a-45aa-a926-c1571df2888e | 7 | public int largestRectangleArea(int[] height) {
int maxRect = 0;
int[] moreHeight = new int[height.length+1];
for(int i=0; i<height.length; i++)
moreHeight[i] = height[i];
Stack<Integer> stack = new Stack<Integer>();
for(int i=0; i<moreHeight.length; i++){
if(!stack.isEmpty() && moreHeight[i] < mo... |
3574927d-23fd-4c9f-b30c-3f9b0fe6eb82 | 3 | private void resize() {
width = getWidth();
height = getHeight();
if (width > 0 && height > 0) {
background.setCache(false);
flap.setCache(false);
background.setFitWidth(width);
background.setFitHeight(height);
flap.setFitWidth(widt... |
356117d9-f71c-4bba-a895-27ff406621f9 | 9 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() == cancelButton)
closeWindow();
else if (e.getSource() == okButton)
{
String name = (String) comboBoxUnitName.getSelectedItem();
double azimuth = Utility.stringToDouble(textFieldAzimuth.getText());
double elevation = Utility.stringTo... |
89d7d51f-9cc0-4737-b4de-f2c9fc8c3609 | 5 | @Override
public MapConnector<String, Double> forceSynchronization() throws Exception {
try (Connection con = getConnectorInfo().getConnection()) {
forceClear();
int n = 0;
StringBuilder values = new StringBuilder();
String stm;
for (String s : get... |
500c8063-f068-4915-87ac-ee792e055df5 | 9 | private List<Subset> generateNeighborhood(BitSet S, int numNeighborhood)
throws Exception{
int counter = 0;
List<Subset> neighborhood = new ArrayList<Subset>();
int numAttribs = (m_classIndex == -1) ? m_numAttribs : m_numAttribs - 1;
if(numNeighborhood >= numAttribs){
for (int i = 0; i < m_nu... |
2d103700-d9b3-43af-8466-6d0d4b99a76a | 2 | public static String getHash(String text) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.reset();
m.update(text.getBytes());
byte[] digest = m.digest();
BigInteger bigInt = new BigInteger(1, digest);
String hashtext = bigInt.toString(16);
// If needed, insert zeros to get 32 chars
... |
3b47de86-400f-4ecb-b418-5401345c1a9f | 4 | public static final void compress(final File zippedFile,
final IOHandler ioHandler, final File... files) {
try {
if (!zippedFile.exists()) {
// create file write zip header
final OutputStream out = ioHandler.openOut(zippedFile);
final ZipOutputStream zipOut = new ZipOutputStream(out);
zipOut.clo... |
ac06e086-7d0c-494e-b3f9-ed8409ef63c4 | 8 | public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAcce... |
ca4b9914-ca5c-4d46-9f4e-402c286e65f4 | 0 | public String getPrenom() {
return prenom;
} |
652d3432-7ded-4647-aa9b-5a0f3c37295a | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.lightGray);
int deg = r.nextInt(360);
G.fillArc((int)(X-1)-viewX, (int)(Y-1)-viewY, 2, 2, deg, 15);
deg = r.nextInt(360)... |
fe37923a-328f-434b-a11f-34c1a41138df | 2 | public User verifyUser(User user){
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sqlStatement = "SELECT * FROM users WHERE juser='" + ... |
a5695d1c-71d4-4ec4-9114-cdc7720a7f27 | 3 | @Override
public void saveDefaultStudy(Study study) {
if(study == null) {
// If unsetting study, delete file
File f = new File("./studies/.defaultstudy");
f.delete();
return;
}
PrintWriter out = null;
try {
// Write... |
9df9878f-e570-4d1d-ad66-0a874d5ab472 | 3 | public List<Contact> getListOfTelephoneBookRecord() {
System.out.println("Telephone book: ");
List listOfContacts = new ArrayList();
try {
byte[] resp = getResponsesFromEFandSelectDF(DatabaseOfEF.EF_ADN);
for (int i = 1; i <= Converter.getSizes(resp)[2]; i++) {
... |
5173a822-dcbd-43f5-841c-146dccd03885 | 5 | public Object createObjectInstance(String name) throws Exception {
if (!loaded_component_classes.containsKey(name)) {
Logger.getLogger(GameScriptManager.class.getName()).log(Level.SEVERE, "Class not loaded: {0}.", name);
throw new JMException("Class not loaded: " + name);
}
Object ret = null;
try {
... |
cc6f2a06-59d7-49bb-8d9e-e0a21d50e395 | 6 | static final void method1418(int i, int j, int k, boolean flag) {
if (!flag) {
anInt4310 = -73;
}
if (i != 1002) {
if (i == 1001) {
Class142_Sub6.method1255(k, j, 0x7fffffff, 11);
return;
}
if (i != 1011) {
... |
a71b21d7-1ded-464d-bfa8-96c6828f0c11 | 5 | private void manageClients() {
manage = new Thread("Manage") {
public void run() {
while (running) {
sendToAll("/i/server");
sendStatus();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
for (int i = 0; i < clients.size(); i++) {
... |
5a7c8b2d-ac18-4e02-850b-ff21822d3b1d | 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 Site)) {
return false;
}
Site other = (Site) object;
if ((this.id == null && other.id != null) || (this.id != n... |
2331587e-7e57-4014-b724-2418d47555c6 | 7 | public static String max(String v1,String v2){
if(v1 != null && v2 == null){
return v1;
}
if(v2 != null && v1 == null){
return v2;
}
if(v1 == null && v2 == null){
return null;
}
ListItem v1c = parseVersion(v1);
ListItem ... |
7b413cfb-4137-4018-a7d1-250414c4c871 | 1 | public void addList(String... items) {
String collector = "(list ";
for (String item : items)
collector += item + " ";
collector += ")";
arguments.add(collector);
} |
3ecdfa9f-70e7-4b23-b515-00473156863c | 0 | @Test
public void validationIntegerWithIntegerPositiveTest() {
view.getNumberOfPointsTextField().setText("1");
view.getNumberOfPointsTextField().getFocusListeners()[0].focusLost(focusEvent);
assertTrue(view.getDrawButton().isEnabled());
} |
b07992c9-5147-46aa-9f19-fc75d66db2b8 | 9 | @Override
public void channelCommand(MessageEvent<PircBotX> event) throws IllegalAccessException, SQLException, InstantiationException {
super.channelCommand(event);
if(Permissions.isModerator(user,event, true)){
if(args[1].equalsIgnoreCase("add")){
try {
... |
dd38e9b9-6e04-4fde-9c41-78396a16adca | 0 | @Override
public void setLogWriter(PrintWriter arg0) throws SQLException {
} |
8f66d0c1-24d1-464a-adb1-014d18615bfd | 1 | public void run(){
try{
File file = new File("Sound.wav");
AudioInputStream ais = AudioSystem.getAudioInputStream(file);
Clip soundClip = AudioSystem.getClip();
soundClip.open(ais);
soundClip.start();
long millisecs = soundClip.getMicrosecondLength()/1000;
Thread.sleep(millisecs);
}
c... |
91d0e0e8-1d1c-44ca-9fd0-98858aebc32f | 9 | public static DiagramComponent createOpenFromBoundaryCells(
final TextGrid grid,
final CellSet boundaryCells,
final int cellWidth,
final int cellHeight,
boolean allRound) {
if(boundaryCells.getType(grid) != CellSet.TYPE_OPEN) throw new IllegalArgumentException("This shape is closed and cannot be han... |
6f3c2149-f2d2-47c4-bdf7-8c3ebed99d11 | 0 | public String getCode() {
return code;
} |
774ebf64-ff2a-4f7e-a94a-a4d5ba6f6ffd | 5 | private static double[] getResistPoints(int lineNumber, double[] highPrices) {
double[] rPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 0;
for(int j=-25;j<=0;j++){
if((i+j>=0) && (i+j<lineNumber-1) && highPrices[i+j]>price){
... |
638832f5-600c-43ac-9244-e51c668ab8ed | 0 | public Element getElement(int key) {
return this.elements.get(key);
} |
7f353ae2-fa89-4a42-9642-5b56d907d8c4 | 8 | private static char getNrMinesBBCase(char[][] m, int r, int c) {
int n = 0;
if (m[r - 1][c] == MINE) {
n++;
}
if (m[r - 1][c + 1] == MINE) {
n++;
}
if (m[r][c + 1] == MINE) {
n++;
}
if (m[r + 1][c + 1] == MINE) {
... |
42debc50-3f18-4f2e-9512-00cac178fe0e | 9 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in,
"ISO-8859-1"));
String line = "";
StringBuilder out = new StringBuilder();
OutputStreamWriter cout = new OutputStreamWriter(System.out,
"ISO-8859-1");
d: do {
line = b... |
08f57cef-f7d6-47f6-8e2e-5056528bf606 | 0 | public CheckReport(File file) throws Exception {
this.file = file;
fileName = file.getName();
version = checkVersion(file);
} |
3fd1dde1-180c-4a19-8d0a-7fcbf47120a7 | 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... |
9db34a7e-5065-4599-a4a4-5d3a6f6a62a3 | 4 | public void sort(SortData[] paramArrayOfSortData, boolean paramBoolean)
{
int i = 1;
while (i != 0)
{
i = 0;
for (int j = 0; j < paramArrayOfSortData.length - 1; j++)
{
SortData localSortData1;
SortData localSortData2;
if (paramBoolean)
{
localS... |
a08fd2af-75c5-48d4-be89-7d14acc5996c | 9 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
PrintWriter out = response.getWriter();
String action = request.getParameter("action");
String zone = request.getParameter("zone");
if(action==null){
out.... |
df71089b-a117-4762-88e7-9c759317f50a | 7 | void scoreRandTestThreshold(int maxLen, int minLen, Random rand, int threshold, int overlapChanges) {
// First sequence
int len1 = rand.nextInt(maxLen) + minLen;
String seq1 = randSeq(len1, rand);
if( verbose ) System.out.println("\nseq1:\t" + seq1);
// Second sequence
int over = rand.nextInt(len1 - minLen... |
547ba84a-ffac-4bcd-b2e4-782dc5de0a64 | 8 | @Override
public void exec(CommandSender sender, String commandName, String[] args, Player player, boolean isPlayer) {
String broadcastMessage = "";
String broadcastStaffTag = "";
String broadcastRegularTag = "";
if (!isPlayer) {
sender.sendMessage(ChatColor.RED + "Run t... |
a877d216-2cb3-4658-a540-ff3da7fc1027 | 7 | public static Vector localSearch(Vector v) {
int tests = 0;
// Incrementally optimize this vector
v = v.clone(); // don't modify the original
double bestLength = v.length();
Vector bestVector = v.clone();
int[] increments = new int[] { -1, 2, -1 };
boolean improved = true;
while (impr... |
a5ab4033-07f8-4e1a-8834-62eef03ec0c3 | 8 | private static void setNull(PreparedStatement ps, int paramIndex) throws SQLException {
boolean useSetObject = false;
int sqlType = Types.NULL;
try {
DatabaseMetaData metaData = ps.getConnection().getMetaData();
String databaseProductName = metaData.getDatabaseProductName();
String jdbcDriverName = metaD... |
de05b17a-1bdd-4130-8209-5e868cce426a | 1 | public void setCenter(LatLng center) {
if (center == null)
throw new IllegalArgumentException("Window's center may not be null.");
this.center = center;
} |
97bf0f8e-b4a2-44d5-9090-f848fb96bb15 | 7 | private List<Player> getPlayersInChat(List<Player> list, String chat){
List<Player> newPlayerList = new ArrayList<Player>();
for (Player playeren : list){
if (plugin.playerChat.containsKey(playeren)){
if (plugin.playerChat.get(playeren).equals(chat)){
newPlayerList.add(playeren);
}
}else{
... |
03d61f78-a007-44ec-8597-07025153948d | 5 | public Integer[] getLineSurvivalMove(Integer[] move, String type, int i,
String line) {
int j;
if(checkLineNeedSurvival(line)) {
j = line.indexOf(" ");
} else {
return move;
}
if(type.equals("row")) {
... |
8f76879a-68ff-47cb-a085-4808e826fd5c | 4 | public void save() {
if (changed) {
/* Copy old File */
File source = new File(file.getPath());
String filePath = file.getPath();
File temp = new File(filePath.substring(0, filePath.length() - 4) + "_old.yml");
if (temp.exists())
temp.delete();
source.renameTo(temp);
/* Save */
FileConf... |
04ab8697-42e7-4527-b229-17e2eab22484 | 5 | @Override
public void run() {
Graphics g = bstrategy.getDrawGraphics();
if(bstrategy.contentsLost() == false){
Insets insets = frame1.getInsets();
g.translate(insets.left, insets.top);
if(spkey == true){
speed = speed - 0.25;
}else{
speed = speed + 0.25;
}
if(speed < -6) speed... |
f4dc77ca-2c58-4be3-9235-2ee99caec441 | 7 | public void actualiza() {
//Determina el tiempo que ha transcurrido desde que el Applet inicio su ejecución
long tiempoTranscurrido = System.currentTimeMillis() - tiempoActual;
//Guarda el tiempo actual
tiempoActual += tiempoTranscurrido;
//Actualiza la a... |
112d4e15-0614-4882-af62-3cf879853ba7 | 4 | @Override
public Label predict(Instance instance) {
// TODO Auto-generated method stub
double sumOdd = 0;
double sumEven = 0;
for (Integer index: instance.getFeatureVector().getVector().keySet()) {
if (index % 2 == 0) {
sumOdd += instance.getFeatureVector().get(index);
}
else if (index % 2 == 1) {... |
2059c406-3f52-4572-b610-4b21e11d5688 | 7 | private void setUp() {
File tmpUser = null;
File tmpMusic = null;
try{
tmpUser = new File("res/users.data");
tmpMusic = new File("res/musics.data");
this.setuserFileOut(new FileOutputStream(tmpUser));
this.setUserFileIn(new FileInputStream(tmpUser));
this.setMusicFileOut(new FileOutputStream(tmpMus... |
b5570bac-58b2-45c8-b61c-6a374dc86b89 | 0 | public int getAno() {
return ano;
} |
a0f0c807-90ea-4583-8aec-0a0dac09c6dd | 3 | @SuppressWarnings("static-access")
private void ROUND10() {
enemises.clear();
System.out.println("Round10!!!!!!");
for (int i = 0; i < level.getWidth(); i++) {
for (int j = 0; j < level.getHeight(); j++) {
if ((level.getPixel(i, j) & 0x0000FF) == 2) {
... |
b9002431-d5e7-4556-b9b9-12d9a0a161b3 | 8 | public void render() {
// Get the loaded materials and initialise necessary variables
Material[] materials = coinMesh.materials;
Material material;
Triangle drawTriangle;
int currentMaterial = -1;
int triangle = 0;
// For each triangle in the object
for (triangle = 0; triangle < coinMesh.triangles.len... |
71f22af4-830e-4a7d-976b-13af42a5c448 | 2 | private void sendData(APDU apdu, byte[] buffer, short len) {
apdu.setOutgoing();
if (len > (short)254) {
apdu.setOutgoingLength((short)254);
apdu.sendBytesLong(buffer, remainingDataOffset, (short)254);
remainingDataOffset += 254;
remainingDataLength = (shor... |
62b73d1b-fb1a-42a2-8514-303e44140110 | 7 | public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
try {
T version = (T) start.get().newVersion;
final Method method = version.getClass().getMethod(methodName, _class);
return new Adapter.Setter<V>() {
public void call(V value) {
try {
Trans... |
cf1d3617-078d-4f5b-bb74-9e105193c312 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WithListAnnotated withList = (WithListAnnotated) o;
if (list != null ? !list.equals(withList.list) : withList.list != null) return false;
retu... |
75c1ff40-246b-4b60-afc9-dc84b995082c | 7 | public void update(){
if (remainingTime == 0) {
this.frame.getPanPara().getButPause().setVisible(false);
this.frame.getPanPara().getButGeneration().setVisible(true);
this.frame.getPanPara().getTfStep().setEnabled(true);
this.frame.getPanPara().getTfStepNumber().se... |
8fd4cb0c-a671-49b0-b205-47f6a87ee07b | 1 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
try {
String data = "{\"data\": [\"id\", \"nombre\", \"primer apellido\", \"segundo apellido\", \"email\"]}";
return data;
} catch (Exception e) {
throw ne... |
88da8f75-8ea8-45aa-8f2d-95e076634d54 | 8 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
logger.info("detail servlet doGet:" + request.getRemoteAddr());
userLogInTest(request, response);
String option = "bogus";
String key = "0";
Enumeration<String> paramz = req... |
f0602ae1-3647-4d3f-b80d-cf361dc19bd0 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
9b3e9bd3-38c8-4210-a2e2-5ebd7cdf7f3d | 3 | public void addItemsToOrderCombobox() {
orderComboboxItems.clear();
String item = "";
if (driver.getPersonDB().getCustomerList().size() > 0) {
for (Order order : driver.getOrderDB().getCustomerOrderList()) {
if (order.getPerson() == person) {
item = "ID:\t" + order.getId() + " \t " + "Date: " + order.... |
be90df9d-f1a0-4902-a98e-04e27d1b9972 | 7 | public boolean isBoxInFrustum(float F0, float F1, float F2, float F3, float F4, float F5) {
final float frustum00F0 = frustum[0][0] * F0;
final float frustum01F1 = frustum[0][1] * F1;
final float frustum02F2 = frustum[0][2] * F2;
return !(frustum00F0 + frustum01F1 + frustum02F2 + frustum... |
6a554143-a03a-47ce-a3f9-1bd12b76448a | 9 | public void paint(java.awt.Graphics g) {
super.paint(g);
int fillX = 0;
int fillY = 0;
int w = getWidth();
int h = getHeight();
FontInfo fi = getFontInfo();
int round = ((fi.decoration & FontInfo.ROUND) != 0) ? 1 : 0;
if((fi.decoration & FontInfo.SHADOW) != 0){
g.setColor(fi.... |
4313e83c-647f-49c5-b96e-5bb61d0e2cf2 | 5 | public static boolean binarySearch(ArrayList<Integer> s, int x)
{
//For later
ArrayList<Integer> sub = new ArrayList<Integer>();
//corner cases
if (s.size() == 0)
{
return false;
}
else
{
//If its equal to the middle then return true
int middle = s.size()/2;
if(s.get(middle) == x)
{
... |
9a03dcc2-1b97-4402-adca-391a8729f1c8 | 1 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int testCases = in.nextInt();
while (testCases > 0) {
System.out.println(totalChoc(in.nextInt(), in.nextInt(), in.nextInt()));
testCases--;
}
} |
a1e6e0b5-d705-4563-8eb8-6de828967f45 | 1 | private String stringHashMap()
{
String str = "";
for(Equivalence equ : equivs.values())
{
str = str + equ + ln;
}
return str.trim();
} |
c0b2aea7-043a-427e-aa13-a73a009d5b41 | 4 | @Override
public void putAll(Map<? extends String, ? extends String> m)
{
Set<? extends String> nuKeys = m.keySet();
for (String s : nuKeys)
{
String value = m.get(s);
put(s, value);
}
} |
85cc01a7-b490-41b2-b490-103f453ad913 | 9 | String value(ResourceBundle bundle, K key) {
// Build name
String name = key.name();
String fallback = name;
if (key instanceof Message) {
String[] args = ((Message) key).args();
if ((args != null) && (args.length > 0)) { // anonym index
... |
32912183-6db8-4fbb-a6d9-a7643550eec7 | 7 | public ClassNode[] getInheritors(MethodID id) {
ClassNode c = getClass(id.owner);
List<ClassNode> inheritors = new LinkedList<ClassNode>();
classLoop: for (ClassNode c2 : getClasses().values()) {
ClassNode[] inherited = (c.access & ACC_INTERFACE) == 0 ? getHierarchy(c2)
: getInterfaces(c2);
int index ... |
34f86ffe-a2b3-4e9c-aa46-3f016fcc2fa9 | 0 | public void setPassword(String password) {
this.password = password;
} |
ac42655a-76cd-41c2-a3bd-54805e5d1398 | 2 | @Override
public Boolean existsOne(String strTabla, int id) throws Exception {
int result = 0;
Statement oStatement;
try {
oStatement = (Statement) oConexionMySQL.createStatement();
String strSQL = "SELECT count(*) FROM " + strTabla + " WHERE 1=1";
ResultS... |
63d61690-11b8-4105-8c0c-f5fda4d1b26a | 1 | public void stopListeningForCheaters() {
try {
cheaterSub.remove();
} catch (Exception e) {
// do nothing
}
cheaterSub = null;
} |
52ae6366-085d-42b9-af6e-cb927a9b2945 | 4 | public static void main(String[] args) throws Exception {
DatabaseManager.getSingleton().addDatabase(DatabaseConnection.create("127.0.0.1", "lolserver", "lollol", "server"), "info");
DatabaseConnection c = DatabaseManager.getSingleton().getConnection("info");
BufferedReader br = new BufferedReader(new FileReader(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.