method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
672a7c4c-2884-4be4-bb28-bde601b77300 | 3 | public List<Disciplina> pesquisaDisciplinasDoProfessor(String matriculaProf)
throws ProfessorInexistenteException {
List<Disciplina> disciplinasDoProfessor = new ArrayList<Disciplina>();
boolean flag = false;
for (Professor prof : this.professores) {
if (prof.getMatricula().equals(matriculaProf)) {
di... |
969ad2a9-07ed-40d3-aa34-dd03818961c3 | 6 | public String decipher(String typed, String[] switches) throws Exception {
initializeMap();
String[] switchArr;
String outputStr = null;
for (String switchStr : switches) {
//Split each of the switchStr for ":"
switchArr = switchStr.split(":");
//Throw an exception if the length is > 2, as we... |
cbe6cd55-4de8-46a4-ade6-00a45f803531 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point other = (Point) obj;
if (x == null) {
if (other.x != null)
return false;
} else if (!x.equals(other.x))
return false;
if (y =... |
4a7b9372-43b3-4b18-ac3c-0b175d1ff9e8 | 2 | public void clear() {
if ( ! this.isNewOption() )
this.popupSauvegarde () ;
AnalyseModule mod;
for (Iterator<Entry<String, AnalyseModule>> e = Main.modules.entrySet().iterator(); e.hasNext();) {
mod = e.next().getValue();
mod.clear();
}
this.... |
fad5f56f-5599-4c48-b827-81a276b5b46e | 1 | public boolean EliminarPropiedad(Propiedad p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} |
f2b651fc-9b6c-4414-9400-9320f71dd690 | 1 | public void setMinBill(double minBill) {
if(minBill < 0) {
throw new IllegalArgumentException(
"error: bill minimum must be greater than or equal to zero");
}
this.minBill = minBill;
} |
07b3cd43-ac52-40d7-99d3-d1cd60ab031c | 5 | void onKeyPressed(Key key)
{
if(currentlyInFocus != null) {
Interactable.Result result = currentlyInFocus.keyboardInteraction(key);
if(result.isNextInteractable()) {
Interactable nextItem = contentPane.nextFocus(currentlyInFocus);
if(nextItem == null)... |
2e89dda5-d39b-4483-8219-84e9ee99bf16 | 4 | public Combo_Box_View_Specific_Group() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
//MAIN FRAME
super("Team J's Scheduler | View Specific Group");
setBounds(50,50,500,300);
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout... |
a72f946f-1620-4348-9ee8-6acb650c0ed5 | 7 | Stmt stmt() throws IOException {
Expr x;
Stmt s1, s2;
Stmt savedStmt;
switch (look.tag) {
case ';':
move();
return Stmt.Null;
case Tag.IF:
//System.out.println("找到if语句");
match(Tag.IF);
//System.out.println("准备匹配左括号");
match('(');
x = bool();
//System.out.println("准备匹配右括号");
match... |
7c92813f-6f74-476d-8bb4-494310cc666a | 0 | public void setIndividuals(List<Chromo<T>> individuals) {
this.individuals = individuals.stream()
.map(chromo -> new Chromo<>(chromo.getGenes(), chromo.getFitness()))
.collect(Collectors.toList());
} |
71990d47-cfdf-4c5d-9020-d95bd94f50a6 | 4 | void add(String trId, String seq, int lineNum) {
// Repeated transcript Id? => Check that Protein is the same
if ((proteinByTrId.get(trId) != null) && (!proteinByTrId.get(trId).equals(seq))) //
System.err.println("ERROR: Different protein for the same transcript ID. This should never happen!!!"//
+ "\n\tLi... |
59f42c45-d862-4a05-b786-497be9cb96b9 | 0 | public FileType(MediaProperty fileProp) {
this.fileProperty = fileProp;
} |
eb34b42e-4195-4474-8c62-fab28b176cb6 | 3 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 3) {
sender.sendMessage(ChatColor.RED + "/" + plugin.setPortal + " (Name) (type) (Dest)");
return;
... |
eed13ca2-edd3-4cc1-80e5-0f854bfcc608 | 2 | protected void update(final Object arg, final int n) {
if (arg instanceof Throwable) {
((Throwable) arg).printStackTrace();
} else {
if (n % 100 == 0) {
System.err.println(n + " " + arg);
}
}
} |
29eaebb5-afe3-4148-90d5-bed280b93bf8 | 7 | private void move(){
//Nothing to operate
if(onOperating.isEmpty()){
//No floors is waiting
if(onWaiting.isEmpty()){
status = 0;
idle();
}
//Floors are waiting
else{
rearrange();
}
... |
0f435bca-2a8e-40f6-92e6-d32ac945448c | 5 | public static String readFile(String fileName) throws IOException {
StringBuilder sb = new StringBuilder();
File file = new File(fileName);
if (!file.exists()) {
throw new RuntimeException("this file is not exist");
}
if (!file.isFile()) {
throw new Runti... |
ae78ea47-b320-43b1-8839-269ec330f9ec | 0 | public void crossPoint(SplashWindow splashWindow) {
} |
6bc4a0c5-1af1-43fd-a4ef-faddd2a98bd9 | 9 | private void scrollAndAnimateBy(int increment) {
if(loadingDone && (scrollerTimer == null || !scrollerTimer.isRunning())) {
int index = avatarIndex + increment;
if(index < 0)
index = 0;
else if(index >= avatars.size())
index = avatars.size() - ... |
3c9efee6-cb27-4992-a71d-b19cf39cf2d6 | 5 | public void allSchedules() {
if (autoWorldSaveTime > 0) {
autoWorldSave();
}
if (autoMsgTime > 0) {
autoMsg();
}
if (permGroupsRefreshTime > 0) {
playerGroups();
}
if (onlinePlayersLogTime > 0) {
onlinePlayersLog();
}
if (restartTime > 0) {
stopServer();
stopServerMessage5();
stop... |
f87edf9e-e216-4c11-b019-7ad876f2b822 | 0 | public String getText()
{
return message;
} |
42e236d9-be9e-4fe0-ad32-b7b33a1960ef | 8 | public void setTile(int id, int x, int y) {
if (x + y * width < 0 || x + y * width >= tiles.length)
return;
switch (id) {
case 0:
case 0xFFFFFF:
tiles[x + y * width] = 0;
break;
case 1:
case 0xFF:
tiles[x + y * width] = 1;
break;
case 2:
case 0xAA:
tiles[x + y * width] = 2;
break;
... |
4cfdb1ba-1495-4f96-a7fa-a962f1668815 | 2 | public boolean hasPlayer(int x, int y)
{
if (pX == x && pY == y)
{
return true;
}
return false;
} |
3912514f-cd56-428f-8ecd-0983f69aa8ff | 0 | public int getCap() {
return cap;
} |
11486fea-cc9c-498b-a284-21dd9224595d | 4 | private void makeSandRandom() {
for (int i = 0; i < mapWidth; i++) {
for (int k = 0; k < mapHeight; k++) {
if (map[i][k] == Tile.sand) {
boolean generateTile = new Random().nextBoolean();
if (generateTile)
map[i][k] = Tile.sand2;
}
}
}
} |
075126fe-4f30-438e-b399-71018b1cecfd | 3 | public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... |
a0598bfd-01b0-4be2-a34b-f7d77e327fd5 | 3 | private ArrayList<File> searchTileFiles() {
File dir = new File("assets/maps");
String find = ".map";
File[] files = dir.listFiles();
ArrayList<File> matches = new ArrayList<File> ();
if (files != null) {
for (int i = 0; i < files.length; i++) {
... |
ac45d14f-a046-4490-b7d1-0fa2952bc3b9 | 4 | private void acao105() throws SemanticError {
try {
List<Identificador> listaIds = analisandoRegistro ?
listaIdsCamposRegistroTemp : listaIdsVariaveis;
for (Identificador id : listaIds){
IdentificadorVariavel idVar = completarIdVariavel(id);
if(analisandoRegistro)
listaIdsCamposRegist... |
28377aae-1c5b-4b3c-a62d-9366ecf5c336 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolea... |
1759ebc5-01dc-448a-8cd0-a9da93b935c9 | 5 | @Override
public void actionPerformed(ActionEvent event) {
//if start button is pressed - start quiz
if(event.getActionCommand().equals("Start")){
askAllTheQuestions();
}
//if answer-button is pressed - serve answer to view
else if(event.getActionCommand().equals("Answer")){
String answer = view.getAns... |
8e5b27bd-37ec-44d7-95fc-8966a443800c | 9 | @Override
public boolean MoveRight() {
undodata.addLast(dataClone());
undoscore.addLast(scoreClone());
initFlag();
win = false;
noMoreMoves = false;
boolean flag = true;
int count = 0;
while (flag == true)
{
flag = false;
for(int i=0; i<N; i++)
{
for(int j=N-2; j>-1; j--)
{
if (... |
f1715926-26bf-4dfa-b130-07b10075de45 | 2 | public static int getTotalQuiz() {
int totalQuiz = 0;
try {
String statement = new String("SELECT COUNT(qid) FROM " + DBTable);
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
ResultSet rs = stmt.executeQuery();
if (rs.next())
totalQuiz = rs.getInt("COUNT(qid)");
rs.close()... |
18b92509-3a29-4f35-a1c0-f1facead6c1a | 0 | @Override
public void rotate(int angle) {
base = DimensionalTrasform.rotateX(angle, base);
setColoredExes();
base = DimensionalTrasform.rotateY(angle, base);
setColoredExes();
base = DimensionalTrasform.rotateZ(angle, base);
setColoredExes();
} |
9128207e-3a42-4578-845f-7bed9b69cc19 | 7 | public static void main(String[] args) throws IOException {
//create a listening server, that sends all connected clients IPADDR : MESSAGE
String serverstring="";
for (int i=0; i<args.length; i++)
if (args[i].equals("-server"))
{
serverstring = args[i+1];
}
Client main = new Client(servers... |
dcd01b1d-029c-4d8a-bac7-d0a850d44c76 | 6 | public long maxProductOfConsecutiveDigits(String number, int nDigits){
long product =1;
long maxProduct = 1;
int count = 0;
int maxDigits = number.length();
for (int i=0; i<nDigits;i++){
if (i<maxDigits){
String str = number.substring(i,i+1);
if (!"".equalsIgnoreCase(str)){
int digit = Inte... |
f1b84f0b-4885-4acd-993b-11bb00da4e20 | 2 | public void registerPlayer (Player p, Color c) {
if ( c == Color.white ){
white_player = p;
} else if ( c == Color.black ){
black_player = p;
}
} |
25c90b7d-045a-438f-81a8-78882dc7312c | 6 | public void run() {
try {
setupConnections();
while (true) {
System.out.println("[SERVER] Wait for messages...");
// Send message to server
ObjectMessage msg = (ObjectMessage) m_receiver.receive();
if (msg.getObject() instanceof Join) {
Join m = (Join) msg.getObject();
System.out.pri... |
cd846e6b-917c-4051-a956-c077934744ba | 0 | private Node createNoteElement(Document doc, Note note) {
// Start the creation of the transition.
Element ne = createElement(doc, NOTE_NAME, null, null);
// Encode the from state.
ne.appendChild(createElement(doc, NOTE_TEXT_NAME, null, ""
+ note.getText()));
// Encode the to state.
ne.appendChild(creat... |
efea5547-0a28-47f7-88da-8ec3c54e0352 | 3 | @Test
public void WhenUpdatingAndLocalhostDecreasedHisPath_ExpectLevelsAdded() throws UnknownHostException {
int refMax = Integer.MAX_VALUE;
RoutingTable localRT = new RoutingTable();
localhost_.setHostPath("000000");
localRT.setLocalhost(localhost_);
Host localHost0 = new P... |
38799ed0-7a44-4f12-8f55-f0c45ccf1dcd | 8 | public List<com.github.mule.google.wrapper.CalendarRequest> _findCalendars(CalendarRequest calendarRequest, boolean firstOnly) {
List<com.github.mule.google.wrapper.CalendarRequest> list = new ArrayList<com.github.mule.google.wrapper.CalendarRequest>(0);
String pageToken = null;
do {
CalendarList calendarList ... |
e3bc6356-89c6-427c-8a2c-23b727ab1aa9 | 2 | public void save() throws SQLException
{
if (number == -1)
number = GetRecords.create().addRecord(this);
else if (updated)
{
GetRecords.create().updateRecord(this);
updated = false;
}
} |
ce30432f-2139-419a-b895-2680cf4ef1ea | 4 | @Override
public boolean hesapBilgiGuncelle(String kullaniciAdi, Kisi kisi) {
int sonuc = JOptionPane.showConfirmDialog(null, kullaniciAdi +
" isimli çalışan bilgilerini değiştirmek istediğinize emin misiniz?",
"Çalışan Güncelle", JOptionPane.YES_NO_OPTION, JOptionPane.QUEST... |
1cbb6483-19b7-4a36-986a-61766acd2ba4 | 4 | @Override
protected void menuOpciones() {
System.out.println(OPCIONES);
if (terminal.hasNext(OPCIONES_PATTERN)) {
switch (Integer.parseInt(terminal.nextLine())) {
case 1:
askAndConnect();
break;
case 2:
... |
920c6832-b944-4900-845c-b5a77bb12f9c | 0 | public ArrayList<IMessage> getHistory() {
return history;
} |
d9f0e5d4-fa73-4b7d-a22d-f5d56e003f7c | 4 | public boolean execute(CommandSender sender, String[] args) {
String groupName = args[0];
GroupManager groupManager = Citadel.getGroupManager();
Faction group = groupManager.getGroup(groupName);
if(group == null){
sendMessage(sender, ChatColor.RED, "Group doesn't exist");
return true;
}
String playerN... |
feb80c60-e04b-4b76-b997-99781fa51e3e | 1 | public static String[] sortStringArray(String[] array) {
if (SpringObjectUtils.isEmpty(array)) {
return new String[0];
}
Arrays.sort(array);
return array;
} |
f85a6541-2ec8-44b7-b3e7-508b7dbbb759 | 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 fe... |
f36988f5-c327-4bc1-9c5b-cdd3e9268ca7 | 2 | public WigItem next() {
// return next Wig item in list
if (wigItemIndex < wigItemList.size())
return (wigItemList.get(wigItemIndex++));
// attempt to get next leaf item data block
else {
int nHits = getHitRegion(selectionRegion, isContained);
i... |
b1b59345-4f3f-42f1-999a-45675524776a | 7 | ResultSetReference getResult(Connection conn, Parameter p) throws SQLException {
if (!p.has(1)) {
throw new UsageException(getUsage());
}
final String p1 = p.at(1);
final String p2 = p.at(2);
final String p3 = p.at(3);
final String p4 = p.at(4);
final ... |
dd95ece4-8f7b-429a-911b-c5a66ba66e8c | 1 | @Override
public void afterPropertiesSet() throws Exception {
client = CuratorFrameworkFactory.newClient("localhost:2181", new ExponentialBackoffRetry(1000, 3));
client.start();
babyduncanPathCache = new PathChildrenCache(client, "/babyduncan", true);
try {
babyduncanPath... |
7d266d03-b653-4d63-865f-537d16a6c004 | 7 | @Override
public void layout() {
Container parent = getParent();
for (GUIElement child : parent.getChildren()) {
List<Anchor> anchorList = constraints.get(child);
if (anchorList == null)
continue;
Rectangle rect = new Rectangle(child.getPreferredSize());
for (Anchor anchor : anchorList) {
i... |
a01d9c93-75b8-4ae1-a26b-2f50d3b5a217 | 1 | public void fillInGenSet(Set in, Set gen) {
if (instr != null)
instr.fillInGenSet(in, gen);
} |
052ce6cd-9121-4038-a072-37456919de1e | 1 | private Set<String> getUserName() {
HashSet<String> returnset = new HashSet<String>();
Iterator<Session> iterator = chatroomUsers.iterator();
while (iterator.hasNext()) {
returnset.add(iterator.next().getUserProperties().get("username").toString());
}
System.out.print... |
f26c45f7-9625-47c9-b7f7-67327e23efcc | 5 | public String[] readDomains() {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(filePath));
ArrayList<String> domainList = new ArrayList<>();
while (true) {
String line = reader.readLine();
if (line == nul... |
261555f6-f6d6-41dc-8b26-5a01750bb8d1 | 1 | @Test(expected = NotValidDateException.class)
public void forbiddenBookingTest() throws NotValidDateException {
try {
Student testSt1 = familyService.findStudent(1);
DiningHall d1 = new DiningHall(2, BigDecimal.valueOf(4.00),
DiningHall.Type.MADRUGADORES);
SimpleDateFormat sdf = new SimpleDateFormat(D... |
05f0cdeb-eaa2-4c7c-9ceb-14cdcdc5d49e | 6 | public Chunk loadChunk(World var1, int var2, int var3) throws IOException {
File var4 = this.chunkFileForXZ(var2, var3);
if(var4 != null && var4.exists()) {
try {
FileInputStream var5 = new FileInputStream(var4);
NBTTagCompound var6 = CompressedStreamTools.loadGzippedCompoun... |
dc0e35ba-ecb3-476f-81df-05fe083662eb | 1 | public boolean isVerbose() {
if(verbose == null) buildGUI();
return verbose.isSelected();
} |
19fcfd68-812e-46fa-aea7-998a4379964f | 5 | private Object lookupItem(String pattern) {
Object selectedItem = model.getSelectedItem();
// only search for a different item if the currently selected does not match
if (selectedItem != null
&& startsWithIgnoreCase(selectedItem.toString(), pattern)) {
return selectedItem;
} else {
// iterate over al... |
063efb1d-a72f-44c4-a00d-c4933aeb5ea4 | 7 | public static void tanHide(final Client c, final int buttonId) {
for (final tanningData t : tanningData.values()) {
if (buttonId == t.getButtonId(buttonId)) {
int amount = c.getItems().getItemCount(t.getHideId());
if (amount > t.getAmount(buttonId)) {
amount = t.getAmount(buttonId);
}
int pric... |
0345417d-7c96-4e03-8050-9fb4e6b27cf0 | 7 | private int createGraphFromTree(ListenableGraph<Tree, DefaultEdge> graph, Tree tree,
Tree parent, int parentXOffset, int parentYOffset) {
graph.addVertex(tree);
if (parent != null) {
graph.addEdge(parent, tree);
}
if (tree.getLeft() == nu... |
ee3f1750-bf1d-48ab-9eac-88536e166da7 | 4 | private void drawField(GameField field, Graphics2D g) {
for (int x = 0; x<3; x++){
for (int y = 0; y<3; y++){
if(field.getSlot(x, y) == FieldSlot.CIRCLE)
drawOval(x, y, width, hight, g);
else if(field.getSlot(x, y) == FieldSlot.CROSS)
drawCross(x, y, width, hight, g);
}
}
} |
75725872-1bda-43e5-a153-841cc51903b8 | 2 | private void resaveParamsShowHotel(SessionRequestContent request) {
String validHotelStatus = request.getParameter(JSP_HOTEL_VALID_STATUS);
if(validHotelStatus != null) {
request.setSessionAttribute(JSP_HOTEL_VALID_STATUS, validHotelStatus);
}
String invalidHotelStat... |
5cca50da-6caa-4792-abd7-444196e0855f | 6 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Url other = (Url) obj;
if (link == null) {
... |
2db5a8a4-bc82-474a-81fd-704b287f8e14 | 7 | private String mapLocal(String localPath) {
if (localFoldersInfo == null || localFolders.size() == 0)
return localPath; // nothing to do
File f = new File(localPath);
if (f.exists())
return localPath; // it's fine
String testedPath;
for (... |
8601f166-4ef5-4752-89a0-bd586d3c9a14 | 4 | @Override
protected void process(int bits[])
{
double signal = -1.0;
for ( int i = 0 ; i < bits.length ; i++ )
{
int bit = bits[i];
if ( bit == 1 )
signal *= -1;
int j = i * SignalPlot.DIVISIONS;
in... |
46ae57c4-449c-4878-875d-6d5d33596f5e | 1 | public String getNoteAuthor(int noteId) throws SQLException {
NoteDatabaseManager dm = new NoteDatabaseManager();
String s_noteId = Integer.toString(noteId);
String sql = "select note_author from note where note_id = "
+ s_noteId + ";";
ResultSet rs = dm.sqlQuery(sql);
String noteAuthor = null;
while (r... |
4c60b5ef-37bb-4a6f-ad4a-e69c65a39b6d | 7 | @Override
protected Area getParentArea()
{
if((parentArea!=null)&&(parentArea.get()!=null))
return parentArea.get();
Area A=super.getParentArea();
if(A!=null)
return A;
int x=Name().indexOf('_');
if(x<0)
x=Name().indexOf(' ');
if(x<0)
return null;
final Area parentA = CMLib.map().getArea(Na... |
c6bfd3d3-d9a3-4756-b732-1c923bfa9def | 2 | public static void maximize(Image image) {
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
double val = Math.max(
image.getPixel(x, y, RED),
Math.max(image.getPixel(x, y, GREEN),
image.getPixel(x, y, BLUE)));
image.setPixel(x, y, RED, val);
... |
49cb4875-9835-41b1-82d6-819d77dd1e85 | 7 | private static void deal(ArrayList<String> keywords, String keyword,String subjectOne,String subjectTwo) {
// TODO Auto-generated method stub
if(null == keyword || "".equals(keyword))
finalDo(subjectOne, subjectTwo, keyword);
String[] temp = keyword.split("、");
StringBuilder sb = new StringBuilder();
bo... |
fe6604c2-9716-43b9-bd3a-482e2b47b8a1 | 0 | public boolean getLooping() {
return looping;
} |
413f74e3-19a3-4dd6-b6a3-8ea2b54d4e56 | 5 | public boolean connect(NioSocketConnector connector, SocketAddress address,
boolean useSsl) {
if (session != null && session.isConnected()) {
throw new IllegalStateException(
"Already connected. Disconnect first.");
}
try {
IoFilter LOGGIN... |
08ff6d31-a05e-4630-b256-473cebbd8c23 | 5 | public static boolean updateFlight(Flight newFlight, Flight oldFlight){
boolean result = false;
PreparedStatement pstmt;
try {
pstmt = con.prepareStatement("Update flight set flightnumber = ?, airportfrom = ?, airportdestination = ?, pilot = ?, copilot = ?, `date` = ?, plane = ?, re... |
5649a76e-38ce-40b1-bc03-bd1426aae43c | 5 | public Region getRegionAt(int x, int y) {
List<Region> candidates = new LinkedList<Region>();
for (ContentIterator it = this.iterator(null); it.hasNext(); ) {
ContentObject region = it.next();
if (region.getCoords() != null) {
Polygon coords = region.getCoords();
if (coords.isPointInside(x, y)) {
... |
a6d0246d-5b79-465e-b44b-a09cdbec3445 | 2 | @Override
public void undo(Board board) {
if (this.out != Counter.EMPTY) {
board = this.moveUpCells(board, this.getCol()); // if the column is full I move the counters one up to put the first counter out of the "printed board" in and make disappear the first counter
board.setPosition(getCol(), board.getHeight(... |
baf70871-03d9-4185-83c0-8d92486d2c6d | 6 | public TibMsgIterator(byte[] data) throws TibException
{
_msg = new TibMsg();
_formatter = new DecimalFormat();
_formatter.setMaximumFractionDigits(17);
_msg.UnPack(data);
_field = new TibField();
_lastStatus = _field.First(_msg);
... |
867570ba-4d4f-4e73-b988-cd4c1d013c6a | 6 | public static Calendar getCalendarFromCellWithPrecision( Cell cell, int roundingCalendarField )
{
Calendar tmp = getCalendarFromCell( cell );
GregorianCalendar newCalendar = new GregorianCalendar();
newCalendar.set( Calendar.YEAR, tmp.get( Calendar.YEAR ) );
newCalendar.set( Calendar.MONTH, tmp.get( Calendar.M... |
d991bfc2-a033-45f3-84e8-fa18efd8bef9 | 5 | public boolean isPrime(double n)
{
if (n <= 1)
{
return false;
}
if (n == 2)
{
return true;
}
if (n % 2 == 0)
{
return false;
}
for (int i = 3; i <= squareRoot(n) + 1; i = i + 2)
{
if (n % i == 0)
{
return false;
}
}
return true;
} |
f5270837-c473-48e1-be31-e640903c86b2 | 8 | public List<List<Integer>> verticalOrder(TreeNode root) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
if (root == null) return result;
Map<Integer, ArrayList<Integer>> map = new HashMap<Integer, ArrayList<Integer>>();
Queue<TreeNode> queue = new LinkedList<TreeN... |
94a1cec7-7e0c-4ebe-bb71-c6cf1a6ef145 | 6 | public FSList getChapters() {
// try reading it from disk
String readpath = "/springfield/lisa/data/linkedtv/"+mediaResourceId+"/chapters.xml";
System.out.println("READPATH="+readpath);
String body = readFile(readpath);
if (body==null) {
Response response = HttpHelper.sendRequest("GET", MAGGIE+"&id="+med... |
037978be-9a2c-423b-b4bc-b2aefaeaf493 | 8 | private boolean r_Step_1c() {
int v_1;
// (, line 51
// [, line 52
ket = cursor;
// or, line 52
lab0: do {
v_1 = limit - cursor;
lab1: do {
... |
014237fc-a661-498b-8f9c-6ec5d8dccd6d | 5 | @Override
public void update(int tick) {
if (state == 2 || state == 1) {
alpha += speed;
} else if (alpha > 0.3f + speed) {
alpha -= speed;
}
if (alpha > 1) alpha = 1;
if (alpha < 0.3f) alpha = 0.3f;
} |
243ea7ea-5fbf-4703-8375-358884e4f7df | 9 | public static List<String> depthFirstSearch(Graph graph, String startName, String goalName)
{
if(!graph.getVertices().containsKey(startName) || !graph.getVertices().containsKey(goalName))
throw new UnsupportedOperationException();
//CLEAR GRAPH
for(Vertex v : graph.getVertices().values()){
v.setCameFr... |
ae658c42-44d2-4b71-92d5-c1ed6e888dc7 | 9 | public PaymentDates readPaymentDates(XMLStreamReader2 streamReader) throws XMLStreamException {
Integer paymentFrequencyPeriodMultiplier = null;
PeriodEnum paymentFrequencyPeriod = null;
PayRelativeToEnum payRelativeTo = null;
Offset paymentDaysOffset = null;
BusinessDayAdjustments paymentDatesAdjus... |
6596a146-5d8c-4827-b3e7-846836819a84 | 9 | public void change(int x, int y, char f){
Point position = new Point(x, y);
if(f==Constants.ROBOT) {
if(getPoint(x,y)==Constants.DIAMOND)
nDiam--;
if(getPoint(x,y)==Constants.ROCK){
if(x > robotPos.x){
if(((x+1) <= Xmax) && getPoint(x+1,y)==Constants.EMPTY)
map.put(new Point(x... |
7e62a90b-8956-4601-88c2-d9764a922f57 | 3 | public ArrayList<BigDecimal> getStringAsBigDecimalList(String name)
{
List<String> value_list = strings_map.get(name);
ArrayList<BigDecimal> result = new ArrayList<BigDecimal>();
if(value_list == null)
{
return result;
}
for(String val:value_list)
{
try
{
res... |
cc2409d1-349a-4f62-be18-ca638bc1695b | 6 | public void keyReleased(KeyEvent keyEvent){
if(keyEvent.getKeyCode()== KeyEvent.VK_K)
{
if(bNivel1){
bSelecc = !bSelecc;
bNivel1 = !bNivel1;
}
}
if(keyEvent.getKeyCode() == KeyEvent.VK_P)
{
if(bNivel1){
... |
6b572735-eae4-498d-a07b-719875ad679e | 1 | public void unitUpdate(Unit unit) //can optimize calls later so that it isn't called multiple times for no reason.
{
//display info
unit.updateActions();
line1 = "Team: " + unit.getTEAM() + " Coordinates: (" + unit.getX() + ", " + unit.getY() + ") " + (unit.hasMoved() ? "[Can't Move]... |
21e947a3-7bc0-4d26-a2a1-bb2629730694 | 9 | public static int size(Object object) {
if (object == null) {
return 0;
}
int total = 0;
if (object instanceof Map) {
total = ((Map) object).size();
} else if (object instanceof Collection) {
total = ((Collection) object).size();
} els... |
ae051b67-896f-4a00-86c1-28bf7914adae | 2 | @Test
public void WhenUnionOtherNotHavingLevelSpecified_ExpectNothing()
throws UnknownHostException {
localhost_.setHostPath("00");
int level = localhost_.getHostPath().length();
RoutingTable table = new RoutingTable();
table.setLocalhost(localhost_);
Host host0 ... |
a2f8631d-9fce-4621-ab08-cc1ed1553486 | 9 | public HTTPURLRequestOperation operationWithURLRequest(URLRequest request, HTTPCompletion completion) {
HTTPURLRequestOperation operation = null;
for (String className : this.registeredOperationClassNames) {
try {
Class<?> cl = Class.forName("com.javanetworking."+className)... |
c9895dd0-ede3-4025-8c27-e67e0bce9465 | 8 | public void displayTree()
{
Stack globalStack = new Stack();
globalStack.push(root);
int emptyLeaf = 32;
boolean isRowEmpty = false;
System.out.println("****......................................................****");
while(isRowEmpty==false)
{
Stack localStack = new Stack();
isRowEmpty = true;
... |
4db4043c-a6bc-47ba-a35a-cbd4fe947ba5 | 3 | public int countIncludedChar(CharSequence charseq, char searchedChar){
if(charseq == null){
System.out.println("�L��Ȓl���͂��Ă�������");
}
String testedStr = charseq.toString();
int count = 0;
for(int i=0; i<testedStr.length(); i++){
if(testedStr.charAt(i) == searchedChar){
count++;
}
}
... |
763ae06a-ff98-4b2b-a57b-6de913ab0f9c | 8 | private static boolean isActionMethod(Method m) throws ActionAnnotationConfigException{
Action action = m.getAnnotation(Action.class);
if(action == null)
return false;
//action configuration is wrong
if(!action.value().matches("(\\/\\w+)+(\\/\\$\\w+)*")){
throw new ActionAnnotationConfigException(m + "'s ... |
b6fa13d3-723e-4948-b035-b382926a97f1 | 8 | private Celda buscarCeldaConInfo(Integer aBuscar){
//Se obtiene el balde y se busca si el elemento se encuentra dentro de él.
int baldeABuscar = tecnica.h(aBuscar);
int posicionABuscar = posicionElementoEnBalde(baldeABuscar,aBuscar);
//Referencia al elemento que se va a devolver.
Celda celdaSalida = null;... |
1fa667cb-ad67-4dbd-8020-fc9e90ee9bdf | 2 | public double[] getBestParamDataArray() {
double[] bestParamValues = new double[paramValues.length];
int index = 0;
for (int i = 0; i < bestParamData.length; i++) {
double[] values = bestParamData[i].getCalibrationData();
for (int j = 0; j < values.len... |
7acc5561-8bc0-44ad-bcf3-7d12906b1e67 | 9 | private String generatePassword() {
int n, v;
Random generator = new Random();
StringBuffer password = new StringBuffer();
int max = Integer.parseInt(pswLength.getText());
for (int i=0; i<max; i++) {
n = generator.nextInt(3); // uppercase
v = generator.... |
5e6736f9-16b2-46c6-84ac-5398b0c1a151 | 6 | public static boolean runSlotGuardDemonsP(StandardObject self, StorageSlot slot, Stella_Object oldvalue, Stella_Object newvalue) {
if (Stella.$ALL_SLOTS_GUARD_DEMONS$ != null) {
{ Demon demon = null;
Cons iter000 = Stella.$ALL_SLOTS_GUARD_DEMONS$.theConsList;
for (;!(iter000 == Stella.NIL); i... |
714a1f41-eea4-42c2-962a-ce253f3e8a6d | 4 | private void resetOffsets () {
int minOffset = 0;
for (Read read : layoutMap.values()) {
if (read.getOffset() < minOffset) {
minOffset = read.getOffset();
}
}
if (minOffset != 0) {
for (Read read : layoutMap.values()) {
read.setOffset(read.getOffset() - minOffset);
}
}
} |
dc895ec8-e403-4a58-aeba-655ee23eb09f | 0 | public void prepareSpecificMenu(){
Dimension panelSize = new Dimension(game.getWindowSize().width/3-20, game.getWindowSize().height-20);
this.menuWrapper.setLayout(null);
menuPanel.setLayout(new GridLayout(3, 1));
bodypartPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
upgradePanel.setLayout(new FlowL... |
8529dd1a-3ba9-4770-abc8-f78b45d1f910 | 3 | @Override
public int sizeOf( Object v )
{
if (v == null)
{
return Compress.NULL_SIZE;
}
int size = Compress.NULL_SIZE;
try
{
for (int i = 0; i < fields.length; i++)
{
size += reflects[i].sizeOf( fields[i].get( ... |
7ba23788-5e3b-42d9-9202-cea8174197cb | 8 | public static void main(String[] args) {
Method[] ms = LongStream.class.getMethods();
Arrays.sort(ms, (a, b) -> a.getName().compareTo(b.getName()));
for (Method m : ms) {
if (m.getParameters().length == 1 && !Modifier.isStatic(m.getModifiers())) {
System.out.println("... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.