method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a5702fbb-764f-4a46-8816-cfc5e48d5b53 | 8 | private Map<String, SMSThread> buildSMSThreadMap(String response) {
Map<String, SMSThread> result = new HashMap<String, SMSThread>();
String jsonResponse = ParsingUtil.removeUninterestingParts(response,
FilterResponse.JSON_BEGIN, FilterResponse.JSON_END, false);
try {
JSONObject json = new JSONObject(jsonR... |
11da9f6c-2640-4c5d-a208-7e334a6c8a5e | 9 | @Override
public void actionPerformed(ActionEvent ae) {
try {
String op = ae.getActionCommand();
switch(op){
case "Editar CRLV":
editarCrlv();
break;
case "Adicionar CRLV":
... |
ffa384fe-3533-4e1d-929a-3533c019f4a0 | 7 | private boolean evaluateBackgroundClause(String str) {
if (str.toLowerCase().startsWith("color")) {
Color c = parseRGBColor(str.substring(5).trim());
if (c == null)
return false;
view.setBackground(c);
view.setFillMode(new FillMode.ColorFill(c));
}
else if (str.toLowerCase().startsWith("image")) {... |
9475f0dc-5c9d-4bbc-9df8-68ded7620e57 | 6 | public Section map() {
if (original.getRepository() == null || original.getRepository().toString().isEmpty()) {
logger.error("Cannot perform mapping procedure on section " + original.toString() +
"! No repository for terminologies specified!");
}
try {
original.resolve... |
f383cdbc-842b-494b-b349-fcfe7945bae2 | 6 | public static void main(String[] args) {
// Example of creating a set and partitioning it:
System.out.println("Starting by creating a partitioned set of 4 elements:");
PartitionListElement<String> list = new PartitionListElement<String>();
list.add("one");
list.add("two");
list.add("three");
list.add("... |
d381b993-b105-4e00-9229-2a88843adf79 | 0 | @Override
public void draw(Graphics g) {
super.draw(g);
Rectangle masse = getAbsoluteRect();
//draw eyes
g.setColor(Color.WHITE);
g.fillOval((int)(masse.getX() + masse.getWidth() * 0.2), (int)(masse.getY() + masse.getHeight() * 0.4), (int)(masse.getWidth() / 6), (int)(masse.getHeight() / 6));
g.fillO... |
30358f80-e4fa-42b3-8a25-05ead4f06715 | 3 | public boolean unfollowUser(String followingUser, String id){
String userToUnfollow= _users.get(followingUser).getUserById(id);
User userFound= _users.get(userToUnfollow);
if ((userFound != null) && (userFound.checkIfCanRemoveFollowingUser(followingUser, id))){
return ((_users.get(followingUser).unfollowUser(u... |
84472899-6a4c-4f94-a2a1-d45950ceb3a1 | 0 | public boolean isAlive() {
return this.getHealth() <= 0;
} |
89c88655-1047-4bf3-84f3-515d933c2318 | 9 | public int maximalRectangle(char[][] matrix) {
int row = matrix.length;
if(row == 0)
return 0;
int col = matrix[0].length;
int[][] m = new int[row][col];
for(int i = 0; i < row; ++i){
for(int j = 0; j < col; ++j){
if(matrix[i][j] == '1'){
if(j == 0)
m[i][j] = 1;
else
m[i]... |
54bc48be-174b-4818-865d-dcced5145fa8 | 9 | public final NiklausParser.parameters_return parameters() throws RecognitionException {
NiklausParser.parameters_return retval = new NiklausParser.parameters_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token IDENTIFIER61=null;
Token COMMA62=null;
To... |
0ef7eb76-c0e9-41c3-b2b2-16b6c7913e68 | 8 | public void getMenu(int menuIndex){
if (this.isAlive()){
switch (menuIndex){
case WELCOME_MENU:
getMenu(welcome());
break;
case BANKING_MENU:
getMenu(banking());
break;
case DEPOSIT_MENU:
getMenu(deposit());
break;
case WITHDRAW_MENU:
getMenu(withdraw());... |
e338507a-64a1-491a-9c55-d6a7d6798e5b | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
8cc712b0-f074-48df-931b-e505f7d73136 | 6 | public static boolean doBootstrapperUpdate(Stack<String> updateQueue, JSONObject versionsConfig) {
Logger.info("Updater.doBootstrapperUpdate", "Starting update...");
//Show progress
GlobalDialogs.showProgressDialog();
GlobalDialogs.setProgressCaption("Cleaning...");
... |
9bd2f50a-b6d2-4405-8f07-47fa3d841fb0 | 0 | public static Reminder create(long apptId, long userId, long reminderAhead) throws SQLException {
Map<String, String> values = new HashMap<String, String>();
values.put("appointmentId", String.valueOf(apptId));
values.put("userId", String.valueOf(userId));
values.put("reminderAhead", String.valueOf(reminderAhea... |
aa503708-f343-4429-83da-6684ca70d65d | 6 | private void drawCoordinateStroke(int x0, int y0, int x1, int y1)
{
for(int x = x0; x <= x1; x++)
{
for(int y = y0; y <= y1; y++)
{
if(x < width && x > 0 && y < height && y > 0)
{
image.setRGB(x, y, Color.black.getRGB());
... |
63847670-f5f8-49a3-b761-773b925de38d | 6 | public int checkSidwaysUp(int originLetter, int originNum, int newLetter, int newNum, Board b)
{
valid = 0;
int diagnalUpLetter = originLetter;
int diagnalUpNumber = originNum;
if(originLetter > newLetter) //diagnal up left
{
int diagnalLeftValid = 0;
for(int counter = 0; counter < ((originLetter-ne... |
d2239459-f43f-425e-818e-1af15e1e513c | 7 | public Node insertItem(int key) {
Node node = new Node(key);
if (isEmpty())
root = node;
else {
Node current = this.root;
while (true)
if (current.getKey() > key && current.getLeft() != null)
current = current.getLeft();
else if (current.getKey() <= key && current.getRight() != null)
cu... |
82fcf283-9796-4cc0-bbf4-9364f01f6cec | 8 | public void update1(float time){//@override Entity
Vector2 tempForce;
LinkedList<MyPoint> temp = new LinkedList<MyPoint>();
for (Link l : neighbors){
tempForce = Vector2.vecSubt(l.other.getPos(), this.pos);
if (tempForce.length() > l.len * breakLength){
temp.add(l.other);
}
}
for (MyPoint p : tem... |
97103492-1fa1-4773-8f7b-98ff733d6fad | 7 | public static int[] maxProduct(int[] A) {
int[] output = new int[2];
int[] min = new int[2];
Arrays.fill(output, Integer.MIN_VALUE);
Arrays.fill(min, 0);
for (int i = 0; i < A.length; i++) {
if (A[i] <= 0) {
if (A[i] < min[1]) {
min[0] = min[1];
min[1] = A[i];
} else if (A[i] < min[... |
9c833367-26a4-4fd0-a3e5-ed61aec549ba | 5 | public Card returnAndRemove(Card data) throws Exception {
Node<Card> currNode;
Node<Card> prevNode;
Card returnCard = null;
if (head == null) {
throw new ListEmptyException();
} else {
// find the node with the data in it
// adjust the links so the Node is removed from the chain of Nodes
currNode ... |
cb363f92-f805-42ab-b465-4026d1afa0cd | 3 | public static int[] toIntA(byte[] data) {
if (data == null || data.length % 4 != 0) return null;
// ----------
int[] ints = new int[data.length / 4];
for (int i = 0; i < ints.length; i++)
ints[i] = toInt( new byte[] {
data[(i*4)],
data[(i*4)+1],
data[(... |
3266e6c5-5d14-4f2a-bf07-fe7058f45b06 | 9 | @Override
public void run() {
try {
// Eclipse doesn't support System.console()
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
ConfigManager config = NetBase.theNetBase().config();
String server = config.getProperty("net.server.ip");
if ( server == null ) {
Sys... |
31180777-dc34-44e4-8591-0a29ed794a14 | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
374c9df1-7a5b-4264-970b-41f38dcd8af6 | 5 | private static <E extends Comparable<E>> void heapifyDown(E[] heap, int index, int startIndex, int endIndex) {
int leftChildIndex = index * 2 + 1 - startIndex;
int rightChildIndex = index * 2 + 2 - startIndex;
int swapIndex = index;
// if left child exists and greater than current node
if (leftChildIndex <... |
9a12ee3f-4863-414b-a6f7-6f5d53d94008 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Level))
return false;
Level other = (Level) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
... |
7f26f3f4-c174-4d8b-94b7-7bbfa6b8b8c1 | 9 | private ReturnValue Helper(TreeNode p)
{
if (p == null)
return new ReturnValue(Integer.MIN_VALUE,Integer.MIN_VALUE);
if (p.left == null && p.right == null)
return new ReturnValue(p.val,p.val);
ReturnValue l = Helper(p.left);
ReturnValue r = Helper(p.right);
... |
11327305-57b5-46eb-bd34-9cc05237d1f5 | 4 | public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
if (isSelected)
{
renderButton.setForeground(table.getSelectionForeground());
renderButton.setBackground(table.getSelectionBackground());
}
else
{
renderButton.... |
d6afa235-2ff9-48d8-a741-b8d771bb7bfe | 1 | public void doWork(long time, TimeUnit unit) throws Exception {
if (!lock.acquire(time, unit)) {
throw new IllegalStateException(clientName + " could not acquire the lock");
}
try {
System.out.println(clientName + " has the lock");
resource.use();
} fi... |
69c32269-8784-47f4-a986-5f5485c320e6 | 1 | * @throws IOException if a data communication error occurs
* @throws UnknownHostException if cyc server host not found on the network
*/
public boolean isOpenCyc()
throws UnknownHostException, IOException {
boolean answer;
try {
answer = converseBoolean("(cyc-opencyc-feature)");
} c... |
b44afbd4-bc77-4d1f-902f-c09d38e27b98 | 3 | public void deleteElement(ValueType value) throws NotExistException {
ListElement<ValueType> previous = head;
ListElement<ValueType> current = head.getNext();
if (exist(value)) {
while (current != tail.getNext()) {
if (current.getValue() == value) {
... |
6262043b-a80c-447f-b7f4-fcb0372cf031 | 8 | @Override
public void run() {
try {
final BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
final PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
// display welcome screen
out.println(Util.buildWel... |
0225ba75-c499-4035-9eab-5d515c606f84 | 3 | @Override
public FileContent read(String fileName) throws FileNotFoundException,
IOException, RemoteException {
FileContent data = new FileContent(fileName);
ReadWriteLock lock = null;
if (!fileReadWriteLock.containsKey(fileName)) {
lock = new ReentrantReadWriteLock();
fileReadWriteLock.put(fileName, lo... |
bf556591-8013-48ae-851e-e03fce816a22 | 8 | public static void main(String[] args) throws IOException {
long inicio = System.currentTimeMillis();
StringBuilder out = new StringBuilder();
BufferedReader in;
File archivo = new File("entrada");
if (archivo.exists())
in = new BufferedReader(new FileReader(archivo));
else
in = new BufferedReader(new... |
6689e0d0-3699-483b-81df-5a7a8d685905 | 1 | int[] generateNormalDistSlots(int size, int avg, int stdDev){
int[] slot = new int[size];
for(int i=0; i<slot.length; i++){
slot[i] = (int) n.Normal(avg, stdDev);
} return slot;
} |
e46032f6-4067-450a-b0c5-e9c88ca80167 | 4 | private void getData(Graphics2D graphics) {
int i = 1, slen;
data = new ArrayList<String>();
if (scores.count() == 0)
slen = 5;
else
slen = Math.max(5, scores.getHighest().getFormattedScore().length());
header = String.format("Place%" + (slen - 4) + "sScor... |
e7fb978c-4ef8-4855-9b90-5cfa105a976d | 1 | public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} |
6faa347a-7caa-4cf9-af17-4c68676c0eea | 0 | public PostProcessingFileWriter(File file) throws IOException {
super(file);
} |
a354b8e7-9a59-4aa6-b6f1-a014cff09d44 | 0 | public void automataStateChange(AutomataStateEvent e) {
transformNeedsReform = true;
repaint();
} |
6881f4c1-ec48-4045-85ed-b8d269f2af03 | 7 | @Override
public void showHelp(CommandSender sender) {
sender.sendMessage(colour1 + "=== " + colour2 + getCommandName() + colour1 + " ===");
sender.sendMessage(colour1 + "Usage: " + colour2 + getCommandUsage());
sender.sendMessage(colour1 + "Desc: " + colour2 + getCommandDesc());
sen... |
67caee3e-22f9-42f9-99c5-3d64c6c22ead | 3 | private void deleteFileServerSide() {
try {
client.connect("ftp.asite.com");
client.login("username", "password");
// Set a string with the file you want to delete
String filename = "/coomons/footer.jsp";
// Delete file
boolean exist = cl... |
5459de55-90f5-4f83-b484-7b8bfd504520 | 4 | public int loopLevel(final Block block) {
if (loopEdgeModCount != edgeModCount) {
buildLoopTree();
}
if ((block == srcBlock) || (block.blockType() != Block.NON_HEADER)) {
final LoopNode loop = (LoopNode) loopTree.getNode(block);
Assert.isTrue(loop != null, "no loop for " + block);
return loop.level;
... |
945e19aa-c7cd-4baf-b919-e98ef3159959 | 2 | /* */ public String getParameter(String name) {
/* 206 */ String custom = (String)this.customParameters.get(name);
/* 207 */ if (custom != null) return custom; try
/* */ {
/* 209 */ return super.getParameter(name);
/* */ } catch (Exception e) {
/* 211 */ this.customParameters.p... |
99f23660-6b2f-43bf-b735-fc62080f9027 | 3 | public static String formatIntoMessage(String topic, String subscription, String message){
StringBuilder sb= new StringBuilder("MESSAGE");
sb.append(StompFrame.endlineChar);
if (!topic.equals(""))
sb.append("destination:/topic/").append(topic).append(StompFrame.endlineChar);
if (!subscription.equals(""))
... |
24b358ad-738a-410e-a244-ba57dc163aa3 | 4 | public static void ImportDataBookCopies(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
... |
06366553-930c-418c-a191-be5059fb21cb | 2 | private static String getContentAsString(ContentStream stream)
throws IOException {
// from Jeff Potts guide
InputStream in2 = stream.getStream();
StringBuffer sbuf = null;
sbuf = new StringBuffer(in2.available());
int count;
byte[] buf2 = new byte[100];
... |
f114f89c-fdcd-492e-bd07-e80ec1fe38c1 | 9 | private void senaoEspecial() {
String senaoEsp = "";
if (comparaLexema(Tag.SENAO)) {
senaoEsp = "_L" + label + ":";
ex.codigoInt(senaoEsp);
consomeToken();
if (comparaLexema('{')) {
consomeToken();
boolean c = true;
while (c) {
c = comeco();
}
if (numeroErro == 0) {
... |
39d5e06d-9373-4f2f-a263-485b7c817f0d | 1 | private void lock( )
{
try
{
SwingUtilities.invokeAndWait(
new Runnable()
{
public void run( )
{
mainFrame.setLock(true);
}
});
}
catch( Exception exc )
{
FastICAApp.exceptionDialog(exc);
}
} |
dead13da-a09a-4b65-b187-c731ca145168 | 1 | private Double[] doFragmentation(double aMin, double aMax, int points){
Double[] array = new Double[points];
double eps = 0;
for (int i = 0; i < points; i++) {
eps = aMin + 1.0 * i * (aMax - aMin) / (points - 1);
array[i] = eps;
}
return array;
} |
90ead730-5fd5-4e93-aa64-366eb010c274 | 2 | public Connection abrirConexao() {
try {
// Carregando o JDBC Driver padrão
String driver = "com.mysql.jdbc.Driver"; //classe driver JDBC
// String banco = "db_sistema"; //nome do banco
// String host = "127.0.0.1"; //maquina onde está o banco
// ... |
6bb89d96-5e2f-43e8-8865-94b21f2be4dd | 2 | public Record getRecord(Integer id) {
Record record = null;
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = conn.prepareStatement("SELECT * FROM RECORD WHERE id = ?;");
pStmt.setInt(1, id);
rs = pStmt.executeQuery();
while (rs.next()) {
record = new Record();
... |
deb40cda-d138-435c-bfe0-ebd0138e4dda | 5 | @Override
public List<Match> findAll() {
List<Match> listM = new ArrayList<Match>();
Statement st = null;
ResultSet rs = null;
try {
st = this.connect().createStatement();
rs = st.executeQuery("select * from Matches");
System.out.println("recherche... |
e5430eb4-ee50-41e9-915e-848ea9a1aee1 | 1 | public static CollectionPerson getInstanceCollectionPerson() {
if (collectionPerson == null) {
collectionPerson = new CollectionPerson();
}
return collectionPerson;
} |
6f59a48d-b672-4728-bcb5-9a3167df9f9d | 8 | public String toString() {
String ret = "";
if(passes) {
ret = "passes";
} else {
if(callOnFirstRound) {
if(callIndex != dealerIndex) {
ret = "orders up the dealer";
} else {
ret = "picks up";
}
} else {
ret += "declares ";
if(this.trump.startsWith("S")) {
ret += "... |
6fdb9f84-088e-4db5-ae57-3fff9f65a40d | 5 | private void startMetrics()
{
try
{
Metrics metrics = new Metrics(this);
Metrics.Graph componentLineGraph = metrics.createGraph("Components Used");
for (final Component c : Component.values())
{
String name = c.getFancyName();
// Line graph comparing component usage together
compon... |
7f292702-a54c-4534-a3a8-11d2a1eff19b | 0 | protected SchlangenKopf(Rectangle masse, IntHolder unit, Color color) {
super(masse, unit, color);
direction = DIRECTION_START;
} |
f6376a2a-a999-4937-9636-ecca50b9199d | 1 | public void visit_if_icmple(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
1ac19823-a194-48e7-873c-3c736fc39bb7 | 9 | public Object getDataForDataSection(DataSection dataSection)
{
if (DATA_SECTION_GENERAL == dataSection.getDataSectionName())
{
return characterData.getCharacterDataData();
}
else if (DATA_SECTION_SKILLS == dataSection.getDataSectionName())
{
return cha... |
58c461b4-d6ff-4627-9b15-fdc17e8345a7 | 4 | @Override
public ElementType next() {
// if not initialized, initialize it first
if (this.currentElementItr == null) {
if (this.currentListItr.hasNext()) { // have lists
this.currentElementItr = this.currentListItr.next()
.i... |
ae88f91c-9045-4d52-b80c-00f8a6e1ceed | 7 | public static void main(String args[]) throws UnknownHostException, IOException {
/* 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 fee... |
ff93a6a0-b4b9-43ef-af1a-20c33a70862a | 2 | @Override
public int matches( ByteBuffer sequenceA, int indexA, ByteBuffer sequenceB, int indexB, int count )
{
for (int i = 0; i < count; i++)
{
if (sequenceA.get(indexA + i) != sequenceB.get(indexB + i))
{
return i;
}
}
return count;
} |
bc57fff9-b4c8-48f9-8a2f-1cdcc63f2cd6 | 3 | @Override
public void run() {
super.run();
mUi.updateProgressState("Parser started", 0);
try
{
if (mInputDictionary != null)
addWordsFromInputStream(mInputDictionary, true, mTotalDictionaryChars, LOOKING_FOR_WORD_START);
addWordsFromInputStream(mInput, (mInputDictionary == null), mTotalChars, LOOK... |
67606367-2b69-491b-a0dc-c7d88b4621fa | 1 | private void printCommands(Player playerSender){
if(playerSender.hasPermission("sd")){
String pluginVersion = plugin.getDescription().getVersion();
String pluginName = plugin.getDescription().getName();
playerSender.sendMessage(ChatColor.YELLOW + "|---------- " + pluginName + " v" + pluginVersion + " ... |
9e63d73e-6c31-4f08-a4bb-f9abfb5f341e | 9 | private void flaggedMinesCheck() throws IllegalStateException {
if (flaggedMines < 0)
throw new IllegalStateException("The number of flagged mines is below 0.");
if (flaggedMines > mineCount)
throw new IllegalStateException("The number of flagged mines is above the maximum, "+min... |
b7112bfa-3742-47a0-8976-54be459b6ede | 0 | public JMenuItem getExportDataMenuItem() {
return exportDataMenuItem;
} |
b8e0c7a7-34ed-4fda-84df-95a6b3c40539 | 1 | public String toString() {
if (top == 0) {
return "";
} else {
return new String(data, 0, top);
}
} |
3b4b4b53-188f-457c-9680-7fa98657cfa6 | 6 | public void doGuess( String letter ) {
if ( ! isReady()
|| ! letter.matches( "[A-Z]|[a-z]" ))
return;
if (usedLetters.contains( letter )) {
onRedundantLetter.execute( letter );
return;
}
boolean isGoodGuess = guessLetterAndReveal( letter );
boolean isComplete = ! getWordFormatted().... |
923f6e2c-f456-4afd-b5dc-59bf632f6380 | 3 | public void checkButtonsEnabled(){
topDecreaseButton.setEnabled(topSpinner.nextButton.isEnabled());
topIncreaseButton.setEnabled(topSpinner.prevButton.isEnabled());
bottomDecreaseButton.setEnabled(bottomSpinner.prevButton.isEnabled());
bottomIncreaseButton.setEnabled(bottomSpinn... |
6c46c6b7-8786-4358-8472-8f3d2cf8a8ce | 2 | private boolean validateCutTimes()
{
for(VideoSectionPanel panel : results)
{
if (!panel.validateTimes())
{
//warning window
JOptionPane.showMessageDialog(frame,
panel.errorMessage(),
"Warning - wrong tim... |
9a834b48-cff3-4a20-9a73-0d72b56563a8 | 3 | @Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return "Name";
case 1:
return "Size";
case 2:
return "Modified";
default:
return "";
}
} |
0a1ffbf6-61ac-40a4-bf9b-df3ec73c0c33 | 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... |
e6d4c654-82e2-4b51-b9cb-65abae72a63a | 8 | public static MaxSegments valueOf(byte id) {
if (id == UNSPECIFIED.id)
return UNSPECIFIED;
if (id == UP_TO_2.id)
return UP_TO_2;
if (id == UP_TO_4.id)
return UP_TO_4;
if (id == UP_TO_8.id)
return UP_TO_8;
if (id == UP_TO_16.id)
... |
962f4dfd-2e0f-4a23-8dfb-a998cfc0485b | 4 | @Override
public List<PastMeeting> getPastMeetingList(Contact contact) {
if(contactExists(contact)) {
Iterator meetingIterator = allMeetings.iterator();
Meeting nextMeeting;
//Calendar nextCal;
List<PastMeeting> returnList = new ArrayList<>();
whil... |
e8a72e8c-eec6-47d7-ad1a-41d0e0dd097b | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args){
if(commandLabel.compareToIgnoreCase("portalboots") == 0){
if(sender.hasPermission("portalgel.portalboots")){
if(args.length == 1){
if(args[0].compareToIgnoreCa... |
671c396b-384f-42b1-a3b5-018a0517cb51 | 1 | public void close(){
try {
file.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
087b3cba-1edc-4c55-9d4c-5cf40e9a8601 | 4 | public Question randomQuestion() {
int rndQuestion = random.nextInt(QUESTION_COUNT);
int rndExc = random.nextInt(excDatas.length);
ExcData excData = excDatas[rndExc];
switch (rndQuestion) {
case 0:
return new ByDescription(excData);
case 1:
... |
7501d59c-ede5-4e65-9345-8c4c11ba7b8b | 1 | public void visitMultiANewArrayInsn(final String desc, final int dims) {
buf.setLength(0);
buf.append(tab2).append("MULTIANEWARRAY ");
appendDescriptor(FIELD_DESCRIPTOR, desc);
buf.append(' ').append(dims).append('\n');
text.add(buf.toString());
if (mv != null) {
mv.visitMultiANewArrayInsn(desc, dims);
... |
f0a80b98-5483-4d9e-9dee-b838f5b0c958 | 3 | public void printPicture() {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(new Printable()
{
public int print(Graphics graphics, PageFormat pf, int pageIndex) throws PrinterException
{
if (pageIndex > 0) {
return 1;
}
Graphics2D g2d = ... |
1dbe0c2a-0ded-4dea-b5c7-21df8ef7fc42 | 3 | public void playersInWorldMessage(World world, Player player){
if (plugin.getPlayersInWorld(world, player) != "" && world != null){
List<Player> players = world.getPlayers();
if (players.size() == 1){
player.sendMessage(ChatColor.GOLD + "You're the only user in this world!");
}else{
player.se... |
07081f8f-eca6-49fd-a1b5-e2f1638d93e5 | 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... |
5d917d7b-e497-45db-8c32-ff8f3bb4860c | 1 | public void closePopUp() {
Parent parentRoot = ((Stage) stage.getOwner()).getScene().getRoot();
if (parentRoot instanceof StackPane) {
((StackPane) parentRoot).getChildren().remove(mask);
}
stage.close();
} |
815c2dbf-3f06-4994-9bf4-c94e687ac50e | 9 | public Object eval(CallStack callstack, Interpreter interpreter) throws EvalError {
publishLineNumber();
int numChild = jjtGetNumChildren();
// Order of body and condition is swapped for do / while
final SimpleNode condExp;
final SimpleNode body;
if (isDoStatement) {
condExp = (SimpleNode) jjtGetChild(... |
ea3910b3-e24d-4807-ba4c-1249030e7f62 | 5 | private boolean isLegalPosition(Position p) {
if ((p != null) && (p.row >= 0) && (p.row < TicTacToeBoard.SIZE)
&& (p.col >= 0) && (p.col < TicTacToeBoard.SIZE)) {
return true;
} else {
return false;
}
} |
4c8b6e09-c46f-4216-83fe-003a98787794 | 7 | PERangeList difference(PERange rangeb) {
PERangeList difference = new PERangeList();
int s = (this.begin < rangeb.begin) ? this.begin : rangeb.begin;
int e = (this.end < rangeb.begin) ? this.end : rangeb.begin - 1;
if (s <= e) {
difference.add(new PERange(s, e));
}
s = (this.begin <= rangeb.end) ? ran... |
5c9e2a7d-c740-4e83-a33c-6cd0c1d158e0 | 4 | public int[][] getVisual(){
int[][] visual = new int[shape.length][shape[0].length];
for (int i = 0; i<shape.length; i++){
for (int j = 0; j<shape[0].length; j++){
if (shape[i][j] != 0){
visual [i][j] = shape[i][j] != STRENGTH_MANA ? visualCode : -1;
}
}
}
return visual;
} |
6ece5fb9-6c58-4f18-849d-a82db39ffd0b | 7 | public int moveRight(boolean findChange) {
int total = 0;
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 3; x++) {
if (next.grid[x][y] != 0 && next.grid[x][y] == next.grid[x+1][y]) {
next.grid[x+1][y] *= 2;
next.grid[x][y] = 0;
... |
3d6d6e0c-6ad0-4d44-ae5f-20ed37b68897 | 1 | static int hanoiMoves(int discs){
if(discs == 1){
return 1;
}
return hanoiMoves(discs-1) + 1 + hanoiMoves(discs-1);
} |
9c0f0e93-75b2-4d09-abc5-088cd6633642 | 1 | protected void togglePassword(boolean enabled){
if(enabled){
passwordChkbox.setSelected(true);
serv_pswd.setEnabled(true);
} else {
passwordChkbox.setSelected(false);
serv_pswd.setEnabled(false);
}
} |
dd6d8e5c-7eb1-4e3b-a91d-d4e8329cecf0 | 7 | @Override
public synchronized Fingerprint add(Fingerprint fprint) {
Connection conn = db.getConnection();
Vector<PreparedStatement> vps = new Vector<PreparedStatement>();
ResultSet rs = null;
try {
conn.setAutoCommit(false);
Measurement m = (Measurement)fprint.getMeasurement();
int measurementId =... |
fa27cdac-3d8b-4fc2-ae14-1d213aec2e52 | 9 | private void hbCreateDecodeTables(int[] limit, int[] base,
int[] perm, char[] length,
int minLen, int maxLen, int alphaSize) {
int pp, i, j, vec;
pp = 0;
for (i = minLen; i <= maxLen; i++) {
for (j = 0; j < alphaSize; j++) {
if (length[j] == i) {
perm[pp] = j;
pp++;
}
... |
bcd34835-9dcc-413a-b9ee-453bca42f717 | 6 | @Override public int decode(
byte[] data, int offset, DecodeState ds, CerealDecoder context
) throws InvalidEncoding, ResourceNotFound {
long propDecodeResult = NumberEncoding.readUnsignedBase128(data, offset);
long props = NumberEncoding.base128Value(propDecodeResult);
offset += NumberEncoding.base128S... |
0f02b6d8-a883-4a02-9404-9dbf81044f0e | 6 | public JGImage toDisplayCompatible(int thresh,JGColor bg_col,
boolean fast, boolean bitmask) {
Color bgcol = new Color(bg_col.r,bg_col.g,bg_col.b);
int bgcol_rgb = (bgcol.getRed()<<16) | (bgcol.getGreen()<<8)
| bgcol.getBlue();
JGPoint size = getSize();
int [] buffer = getPixels();
// render image to b... |
25e2e742-a1ff-438a-856e-f8667561e819 | 7 | public void markInputOutput(){
int markIn;
int stu = 0;
int dist = 0;
int pass = 0;
int fail = 0;
int inval = 0;
do {
System.out.print("Input a mark: ");
String str = System.console().readLine();
markIn = Integer.parseInt(str);
stu++;
if (markIn >= 70 && markIn <= 100){... |
3953761f-7a15-4329-bc6e-8939e5403e98 | 2 | public static ImageContentEnumeration fromValue(String v) {
for (ImageContentEnumeration c: ImageContentEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
7e3bbce8-59ba-490e-b8cc-1b279af42d0a | 4 | public Object readValue() throws IOException, JSONException {
int c = this.skipWSRead();
switch(c) {
case -1:
return JSONReader.EOF;
case JSON.BEGIN_ARRAY:
return this.readArray();
case JSON.BEGIN_OBJECT:
return this.readObject();
case JSON.QUOTE_CHAR:
return this.... |
dd2f3a4d-6556-47ef-93e7-81f4f46c28bc | 6 | public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... |
e9bddc12-8427-47c6-84d4-fc54b3a97957 | 3 | public static int dajUkupanBrojRazlicitihGostiju()
{
Session session = HibernateUtil.getSessionFactory().openSession();
Query q = session.createQuery("from " + Boravak.class.getName());
List<Boravak> sviBoravci = (List<Boravak>)q.list();
session.close();
List<Long> gostIds = new ArrayList();
for(Bor... |
f4892e93-0adf-4151-a103-dd4e27205115 | 4 | public void swapPaint(int var1) {
if(var1 > 0) {
var1 = 1;
}
if(var1 < 0) {
var1 = -1;
}
for(this.selected -= var1; this.selected < 0; this.selected += this.slots.length) {
;
}
while(this.selected >= this.slots.length) {
this.selected -= t... |
24b3e95a-b0bc-4b32-a3c5-f747aa008b5e | 8 | public static int firstMissingPositive(int[] A) {
if (null == A || 0 == A.length) return 1;
int n = A.length;
for (int i = 0; i < n; i++) {
int elem = A[i];
while (elem > 0 && elem < n + 1 && elem != A[elem - 1]) {
A[i] = A[elem - 1];
A[elem - 1] = elem;
... |
4b8d13f1-620c-42c3-a7e4-872d017888be | 7 | public void loadCenter(FileSystem fs, Path path, Configuration conf){
SequenceFile.Reader reader ;
try {
//initializae centers with number of empty vector
for(int i =0 ;i<Constant.K;i++) {
Map<Integer, Float> centerVect = new HashMap<Integer, Float>();
centers.add(centerVect);
}
reader = new ... |
9c814acf-d482-440c-af0c-5ef97c5549eb | 6 | public boolean equals(
Object obj)
{
if ((obj == null) || !(obj instanceof SecretKeySpec))
{
return false;
}
SecretKeySpec spec = (SecretKeySpec)obj;
if (!this.algorithm.equalsIgnoreCase(spec.algorithm))
{
return false;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.