method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9999b33d-3c0c-44c6-9782-b5f48d1080cb | 7 | public ArrayList<Sag> sogCPR(String CPR, boolean ui90d) {
if (ui90d) {
ArrayList<Sag> sager_p = new ArrayList<>();
SimpleDateFormat formatter = new SimpleDateFormat("MM");
int currentMonth = Integer.valueOf(formatter.format(new java.util.Date()));
for (Sag s : sag... |
bbe59818-90f4-4ae6-94ad-3f754b142fb9 | 0 | public Academic() {
super();
setGradeTitle(new ArrayList<String>());
setTechnicalTitles(new ArrayList<String>());
setCertTitles(new ArrayList<String>());
setPostGradeTitles(new ArrayList<String>());
setDoctorateTitles(new ArrayList<String>());
setEspTitles(new ArrayList<String>());
gradelevel = "";
} |
017c628a-8361-45f6-a920-ef92236e1ffb | 1 | public static <T> String listToString(T[] lst, String ...format_str) {
StringBuffer sbuf = new StringBuffer();
//String format = params==null ? "[,]" : params[0];
String format = getSingleDefault(format_str, "[,]");
assert format.length() == 3;
sbuf.append(format.charAt(... |
8acaa9d5-ed47-4b76-ade1-f7b15b8073e0 | 8 | public static boolean isMiddleButton(MouseEvent e, Boolean ctrlDown, Boolean shiftDown, Boolean altDown)
{
return (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == 0 &&
(e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) != 0 &&
(e.getModifiersEx() & MouseEvent.BUTTON3_D... |
e85a2d26-a043-47cd-baae-5f664730c16c | 7 | public static void main(String[] args) {
Thread gameLogic = new Thread(new UpdateThread());
gameLogic.start();
try {
datagramSocket = new DatagramSocket(1337);
System.out.println("Sever online on Port 1337");
} catch (SocketException e) {
System.err.... |
9a88e09f-30d5-4327-b6ab-031f64c5c95d | 8 | @Override public String getColumnName(int col) {
switch( col) {
case 0: return "Perm ID";
case 1: return "Client ID";
case 2: return "Order ID";
case 3: return "Account";
case 4: return "Action";
case 5: return "Quantity";
case 6: return "Contract";
case 7: return "Status";
defaul... |
ce1af289-a522-42f0-a1e0-725703455e59 | 5 | private boolean isDanger(){
int vzdalenost = 300;
boolean isGrenade = false;
int grenade_x, grenade_y;
for (int i=0;i<grenades.size();i++)
{
// Výpočet vzdalenost X,Y souradnice
int pomx = Math.abs(x - grenades.get(i).getX());
int pomy... |
a661000a-65fd-4f22-9a90-76b3d360e990 | 7 | public void loadUtilizatori() {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(ClassLoader
.getSystemResourceAsStream("Utilizatori.xml"));
admins = new ArrayList<Administrator... |
7d7288a7-fc54-4cd2-a269-95b47c5a0e23 | 0 | static void relocate(Bird bird) {
bird.move();
} |
b7bf5977-be71-4651-a9de-049536581147 | 4 | public void addListener (Listener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
synchronized (listenerLock) {
Listener[] listeners = this.listeners;
int n = listeners.length;
for (int i = 0; i < n; i++)
if (listener == listeners[i]) return;
Listene... |
4aac09c8-b670-47ce-b3a0-f5ad3bc6c6c3 | 6 | public byte[] sign() throws Exception{
byte[] sig=signature.sign();
/*
System.err.print("sign["+sig.length+"] ");
for(int i=0; i<sig.length;i++){
System.err.print(Integer.toHexString(sig[i]&0xff)+":");
}
System.err.println("");
*/
// sig is in ASN.1
// SEQUENCE::={ r INTEGER, s INTEGER }
int len=0... |
be76204c-2fea-4363-9cf9-34466abf8b9e | 2 | public static AbstractInsnNode previousRealInsn(AbstractInsnNode n) {
while (n != null && n.getOpcode() == -1) {
n = n.getPrevious();
}
return n;
} |
eee02764-ab2e-4d1a-9411-b5d4379e02ca | 9 | public ConfigWindow()
{
this.setTitle("SliceAndDaid - " + CraftConfig.VERSION);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTabbedPane tabbedPane = new JTabbedPane();
this.configSettingsPanel = new JPanel();
this.configSettingsPanel.setLayout(new BoxLayout(this.configSe... |
773b1ca8-f8b0-463b-ab50-51671c49959c | 8 | public void paint(Graphics g) {
// loop through all the tiles in the map rendering them
// based on whether they block or not
for (int x = 0; x < HEIGHT; x++) {
for (int y = 0; y < WIDTH; y++) {
// so if the cell is blocks, draw a light grey block
// ... |
81c59eaa-6263-4d9d-9e2d-d020e392b253 | 4 | public static void main(String[] args) {
// Working with if, else if, and else statements
int number = 18;
if (number == 0 || number == 15) {
System.out.println("The number variable is equal to 0 or 15");
} else if (number > 20 && number < 50) {
System.out.println("The number variable is between 20 and ... |
67609c13-3db8-408c-888f-002d48bd63c1 | 1 | @Override
public String toString () {
String s = "";
for (River r: rivers) {
s += r.toString() + "\n";
}
return s;
} |
3eb48f0c-6e3b-4466-8cf8-45000d669c35 | 3 | public String alterBaseInfo() {
memberId = (String) session.get("memberId");
if (memberId.charAt(0) == 'f') {
Member member = memberService.getFamilyMembers(memberId).get(0);
memberService.deleteMember(memberId);
for (int i = 0; i < name.length; i++) {
memberService.addMember(new Member(memberId, me... |
112d71f1-0705-481c-a361-6516224750ad | 5 | public static boolean tableContainsColumn(String tableName,
String columnName) {
try {
if (conn == null || conn.isClosed())
open();
statement = conn.createStatement();
ResultSet rs = statement.executeQuery("SELECT `" + columnName
+ "` FROM `" + tableName + "` LIMIT 1");
if (rs == null) {
... |
f78828d4-2e2e-430b-b9ad-5ae9994cb044 | 1 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
writer.print(getOperatorString());
if ((Options.outputStyle & Options.GNU_SPACING) != 0)
writer.print(" ");
subExpressions[0].dumpExpression(writer, 700);
} |
cc340189-3759-480e-9f3e-476b8d8c0f85 | 7 | protected void close() {
try {
Packet fin = Packet.getFinPacket(address);
send(fin.pack());
// wait until the router acknowledges our closing attempt
while (!gotFIN) {
if (socket.isClosed()) {
// to prevent a race condition:
if (!gotFIN) {
throw new IOException("Socket closed before w... |
9a3f4e38-dee0-45f5-81d4-599be32bd580 | 4 | private void performAction(Player actingPlayer, Action action) {
action.performAction(actingPlayer);
gameHistory += actingPlayer + " successfully completed " + actionString(action);
if(action.targetedPlayers() != null && action.targetedPlayers().size() == 1){
gameHistory += " against " + action.targetedPlayers... |
7e363487-3691-4058-8c12-438c054c95f4 | 2 | public void close()
{
if (myFileName == null)
return;
try
{
myInFile.close();
}
catch (IOException e)
{
System.err.println("Error closing " + myFileName + "\n");
myErrorFlags |= CLOSEERROR;
}
} |
4c60e1b9-1b78-4ccc-a9d8-30bec0cf4809 | 0 | @Override
public String toString()
{
return String.format( "and(%s, %s)", this.a, this.b );
} |
33a99801-48d1-4195-97ec-bd23975aec1d | 5 | static int[] getLocalIP() {
try {
InetAddress addr = InetAddress.getLocalHost();
byte[] ip = addr.getAddress();
if( ip == null || ip.length != 4 ) {
return null;
}
int[] ret = new int[4];
for( int cnt = 0;cnt<4;cnt++) {
ret[cnt] = (int)ip[cnt];
if( ret[cnt] < 0 ) {
... |
738f6347-f3a2-4744-a8a2-c66263df80fa | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost, msg))
return false;
if(msg.amITarget(this)&&(msg.tool() instanceof Item))
{
final Item newitem=(Item)msg.tool();
if((newitem.container()==this)&&(newitem.owner() !=null))
{
if((!CMSecuri... |
079e4d82-3f8f-483f-8184-af2ea0256853 | 7 | @Override
public final void start() {
master
.createBuffers(bufferSize.width, bufferSize.height,
bufferOptions);
isRunning = true;
if (mustBeAnWebApplet) {
mainThread = new Thread("main") {
@Override
public void run() {
if (VERBOSE)
System.out.println("Starting main thread...");
... |
6101fcfd-5f17-4941-bfc4-92474fac1204 | 0 | @Override
public void send(long connectionId, String message, Object userData) throws Exception {
logger.info(getName() + " send message: " + message + "<idconnection=" + connectionId + ">");
remoteServerCall.send(connectionId, message, userData);
} |
b30ec390-bf99-40ff-8fb3-4f8921d39afd | 1 | public static boolean isRunning() {
return task != null && !task.isDone();
} |
e2eaab15-15d2-4a48-bcbe-1b6f29248748 | 1 | @Test
public void testGetCouriers()throws Exception{
List<Courier> couriers = connection.getCouriers();
//total Couriers returned
assertEquals("It should return total couriers", 8, couriers.size());
//check first courier
Assert.assertEquals("First courier slug", firstCourier... |
98d68dc6-a1d5-4dcc-9d2d-b9a5eb37933a | 8 | public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
if (headA == null || headB == null) {
return null;
}
boolean aFlag = false, bFlag = false;
ListNode a = headA, b = headB;
for(;;){
if(a.val == b.val){
return a;
... |
f078c82b-8730-4e0c-8222-3b86955261c9 | 6 | @Override
protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
super.paintComponent(g2);
if (settings != null) {
if (settings.originalImage() != null && settings.originalDimension() != null &&
settings.viewRatio() != nul... |
87cbc91a-0f09-4b33-b3e3-b4348cc065f2 | 4 | public MyPanel(Clock clock){
myTime = new MyTime();
this.clock = clock;
font = new Font(fontStyle, fontKind, fontSize);
super.setBackground(bgColor);
popup = new JPopupMenu();
JMenu mn = new JMenu("menu");
editor = new JEditorPane();
editor.setContentType("text/html");
editor.setEditable(... |
fe8c154b-6114-41d1-aa75-41be4383cd38 | 2 | public Board()
{
// Fill board with white and black Checkers
for (int i = 1; i <= axisLength; i += 2)
{
board.put(new Cordinate(1, i), new Figure(CheckerType.WHITE));
board.put(new Cordinate(3, i), new Figure(CheckerType.WHITE));
board.put(new Cordinate(8,... |
9143062a-e0a4-4d67-9242-40569d9e657e | 5 | public void visitIntInsn(final int opcode, final int operand) {
// Label currentBlock = this.currentBlock;
if (currentBlock != null) {
if (compute == FRAMES) {
currentBlock.frame.execute(opcode, operand, null, null);
} else if (opcode != Opcodes.NEWARRAY) {
// updates current and max stack sizes only ... |
2241a767-1271-4d35-af6b-75d63cac1ea7 | 3 | public String toString() {
StringBuffer m = new StringBuffer();
m.append("#");
m.append(sym);
if (value != null) {
m.append(" (");
m.append(value.toString());
m.append(")");
}
if (left >= 0) {
m.append(" @");
m.append(left);
if... |
6ce9e379-154a-45e4-888b-4b7992758e71 | 1 | @Test
public void testLastChangedUpdate() throws IOException {
System.out.println("LastChangedUpdate");
try {
modifyElement(); // Ändere eine Datei
NoteEntity e = service.readNoteEntity(UUID.fromString(MODIFY_TESTFILE_UUID));
long beforeChange = e.getLastSavedOn(... |
13b8da86-2ec4-41f8-9403-e3a9b68ed674 | 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 ContactType)) {
return false;
}
ContactType other = (ContactType) object;
if ((this.contactTypeID == null && ot... |
0f0bc182-fa07-48e5-97aa-60930cc873bc | 8 | public void update() {
player.update();
tileMap.update();
if(tileMap.isVictory()){
victoryActions();
}
else if (player.isDead()) {
gameStateControl.setPaused(gameStateControl.getGameState());
gameStateControl.setGameState(LevelType.DEATH);
... |
36c45431-8373-4153-b5d7-2d08eb8597e0 | 5 | public void compTurn() {
int choice = -1;
boolean getChoice = true;
pause(1);
System.out.println("\n------------------------------");
System.out.println("COMPUTER'S TURN");
System.out.println("------------------------------");
pause(1);
int winMove = bestColumn(_pieceC);
int bestBlock = bestColumn(_pi... |
376844ac-c162-4d2d-9929-de02bfe75f6c | 6 | public void export() {
BufferedWriter out;
try {
/**out=new BufferedWriter(new FileWriter(SEED+"-"+year+".txt"));
out.write("Civilizations---------------------------------------------------\n");
ArrayList<Civilization> all=new ArrayList<Civilization>();
for (Civilization c:CIVS)
all.add(c);
for (... |
8824cdfb-d925-4b3e-bc7c-090d5086aa41 | 5 | public static Matrix collateArray(Matrix[] matrices) {
int columnCount = matrices[0].columnCount;
int rowCount = matrices[0].rowCount;
double[][] elements = new double[rowCount][columnCount * matrices.length];
int columnsFilled = 0;
for (int i = 0; i < matrices.length; i++) {
... |
bb9c7391-5bc8-4106-a2c8-666994c59a92 | 7 | public void update(){
if(alunoTurma != null){
Aluno a = this.alunoTurma.getAluno();
if(a != null){
this.lblMatricula.setText(a.getMatricula());
this.lblNomeAluno.setText(a.getPessoa().getNome());
}
lblMedia.setText((alunoTurma.getMe... |
1e7fd2fe-5d65-467b-808f-c2cbbe2f67ef | 5 | @Override
public int Skip(int currentPlayerIndex, int playerSize)
{
int index = 0;
int actualPlayers = playerSize -1;
if(actualPlayers == 1)
{
index = currentPlayerIndex;
}
else if(currentPlayerIndex == actualPlayers-2 && actualPlayers > 3... |
e92ecb04-f4fc-46d3-9639-46bf89df4f61 | 5 | private Class<?> doLoadClass(String name) throws ClassNotFoundException {
// 1) Try the root class loader
try {
if (this.rootClassLoader != null) {
return this.rootClassLoader.loadClass(name);
}
}
catch (Exception ex) {
}
// 2) Try to find locally
try {
findPackage(name);
Class<?> cls = ... |
95cd09cd-591e-4fe5-8e80-0357216244ff | 1 | public int getRoot(int n) {
int root = id[n];
while(root != id[root]) {
root = id[root];
}
return root;
} |
8a5fa177-442a-4178-aaf7-21c8c904fe48 | 4 | @Override
public void brickHitted(DestructionEvent e, DestructibleBrick dBrick) {
if (dBrick.hadrness() == 0) {
boolean found = false;
for (int i = 0; i < gameView().gameFieldView().dBricksView().size() && !found; i++) {
if (gameView().gameFieldVie... |
6101f21e-ef44-4fd6-8cb6-7e0e5aeef473 | 4 | public static void addSelectedTray(Tray tray) {
if (tray == null
|| StorageUnitDisplayPanel.selectedTrays.contains(tray)) return;
if (!StorageUnitDisplayPanel.isSelectable(tray)) return;
if (StorageUnitDisplayPanel.selectedTrays.add(tray)) StorageUnitDisplayPanel
.triggerTraySelectionChanged();
} |
31fa4cdc-3aaf-40d6-b5ee-099eb2f13124 | 7 | private static File getAppDir(String par0Str) {
String s = System.getProperty("user.home", ".");
File file;
switch (EnumOSMappingHelper.enumOSMappingArray[getOS().ordinal()]) {
case 1:
case 2:
file = new File(s, (new StringBuilder()).append('.')
... |
6c4f194b-4f77-4f9a-8d28-20919c058d1c | 0 | public void preprocessShould_ignoreCases() throws Exception{
String path = System.getProperty("user.dir") + "/src/testDict";
Dictionary dictionary = new Dictionary(path);
dictionary.trie = this.trie;
ArgumentCaptor<String> wordCaptor = ArgumentCaptor.forClass(String.class);
dicti... |
f75a91e4-9e59-4404-a33b-4db545ccf1d4 | 0 | public void setCreativeMaterialList(final List<CreativeMaterial> creativeMaterialList) {
this.creativeMaterialList = creativeMaterialList;
} |
28704bea-7502-4c69-bf15-7b1e0e814a9e | 1 | public void setText(String text){
if (!this.text.equals(text)){
this.text = text;
recreateMesh();
}
} |
7d3f1102-14f3-4887-a247-dd36c566f994 | 7 | @Override
public Set<java.util.Map.Entry<K, V>> entrySet() {
return new Set<java.util.Map.Entry<K, V>>() {
@Override
public boolean add(java.util.Map.Entry<K, V> e) {
throw new UnsupportedOperationException();
}
@Override
public boolean addAll(
Collection<? extends java.util.Map.Entry<K, V>... |
3db1e5c0-0dc4-4306-9fe6-a119e37d3902 | 4 | public void close() {
ServerLogger.info(DataServer.class, "Closing data server for device ["
+ device.getSerialNumber() + "]", null);
for (CaptureThread thread : captureThreads) {
thread.cancel();
}
for (CaptureThread thread : captureThreads) {
try {
thread.join();
} catch (InterruptedException... |
b0bab98f-db00-40d9-84f1-5d138884d780 | 8 | public Connection[] shortestPath(Point from, Point to) throws RuntimeException{
//Reset values
xMin = 70000; xMax = 0; yMin = 70000; yMax = 0;
//Create Dijkstra
DijkstraSP dijk = new DijkstraSP(g, from.getID());
//If there is no path between points
if(!dijk.hasPathTo(to.getID())) throw new Runti... |
855c4b12-0fb2-4e4b-a6cd-ba055248631d | 7 | public CycList readCons()
throws IOException {
int size = readInt();
if (trace == API_TRACE_DETAILED) {
debugNote("readCons.size: " + size);
}
CycList cycList = new CycList();
//for (int i = 0; i < (size - 1); i++) {
for (int i = 0; i < size; i++) {
Object consObject = r... |
36477824-6ee7-4894-abbd-cae5125c6df1 | 0 | public double getManagedIntencity() {
return managedIntencity;
} |
bf75fe0b-68f1-4fac-b40f-5975e23878a6 | 0 | public void updateKnowledge() {
} |
c9eb3146-44db-4a06-bbee-8318c390f668 | 8 | public static void main(String[] args) {
simple_test();
Random gen = new Random();
for (int times = 0; times < 1000; ++times) {
List<Integer> A = new ArrayList<Integer>();
if (args.length > 2) {
for (int i = 1; i < args.length; ++i) {
A.add(Integer.valueOf(args[i]));
}
} else {
int n;
... |
65f69fdb-e214-4324-815b-db063412efbb | 8 | @Override
public List<GeoRef> execute(List<GeoRef> points){
List<GeoRef> xSorted = (List<GeoRef>)((ArrayList<GeoRef>) points).clone();
//Sorting
Collections.sort(xSorted, new Comparator<GeoRef>() {
@Override
public int compare(GeoRef p1, GeoRef p2){
... |
7db51de1-ed0a-486b-ae0b-4d00b1b79dd8 | 1 | @EventHandler(priority = EventPriority.MONITOR)
public void onBuyTransaction(TransactionEvent event) {
if (event.getTransactionType() != BUY) {
return;
}
String firstLine = BUY_TRANSACTION_FIRST_LINE
.replace("%client", event.getClient().getName())
... |
add780a7-b403-401f-8576-7581d3082426 | 5 | public XmlWriter endEntity() throws IOException {
if (this.stack.empty()) {
throw new InvalidObjectException("Called endEntity too many times. ");
}
String name = this.stack.pop();
if (name != null) {
if (this.empty) {
writeAttributes();
... |
b48c41c1-a362-4044-b935-507384cef042 | 7 | 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... |
5dba4081-a9f2-428e-8d77-66826b18455b | 9 | public static void compareSocInflPeople(int cutoff){
try {
Connection db = dbConnect();
Connection dbGen = dbGenDataConnect();
Statement getNumPeople = db.createStatement();
ResultSet numPeopleQ = getNumPeople.executeQuery(
"SELECT COUNT(*) AS num FROM "+EpiSimUtil.conCountTbl+" WHERE tally >= "+cuto... |
1028d5fb-5557-4975-819e-00b51eab107b | 3 | public Cliente Abrir(int id) throws ErroValidacaoException, Exception{
try{
PreparedStatement comando = conexao.
getConexao().prepareStatement("SELECT * FROM clientes WHERE "
+ "id = ? ");
comando.setInt(1, id);
ResultSet consulta... |
02a30d76-9541-4901-aedc-2cd3b9ae1a93 | 6 | private void run() {
isRunning = true;
int frames = 0;
long frameCounter = 0;
game.init();
double lastTime = Time.getTime();
double unprocessedTime = 0;
while (isRunning) {
boolean render = false;
double startTime = Time.getTime();
double passedTime = startTime - lastTime;
lastTime = star... |
83be2285-5e9d-4357-ae38-eea0b493afe7 | 5 | public static void LoadPluginAtSelectFiles(File[] files){
String[] regex={".+\\.yml",".+\\.smp"};
for(File f:files){
for(String regexs:regex){
if(f.getName().matches(regexs)){
try {
List<String> l=FileUtils.readLines(f,"UTF-8");
... |
609e35b1-0c2b-41ae-a4b0-dcb697a022a5 | 5 | boolean findDuplicates(String str){
boolean isDup=false;
char[] ch = null;
int s[] = null;
ArrayList<Integer> list=new ArrayList<Integer>();
HashMap<String,Integer> map=new HashMap<String,Integer>();
for(int i=0;i<str.length();i++){
ch[i]=str.charAt(i);
}
for(int i=0;i<str.length();i++){
s[i... |
83672a74-cc0c-4d2a-b98b-9c09e3f5e23f | 9 | public void startElement(String uri, String localName,String qName,
Attributes attributes) throws SAXException {
// System.out.println("Start Element :" + qName);
if(searchElement)
{
if(qName.equalsIgnoreCase(elementName)){
dataFound = true;
throw new BreakSaxException("Data found");
}
}
... |
d6b244ee-6100-4bac-9302-5869cd303482 | 6 | private void determineInitialState(TetrisStateBuffer in) {
Entry<Short, StateBuffer> firstEntry = in.getMap().entrySet().iterator().next();
State firstState = firstEntry.getValue().getStates().iterator().next();
// Determine initial Board state
curGb.restore(firstState);
Util.runToNextInputFrame();... |
b2e8b2dc-338e-49d9-a1f9-7faae72c2157 | 8 | public void testIndianCapital() {
((FileOption) spec().getOption(MapGeneratorOptions.IMPORT_FILE)).setValue(null);
Game g = new ServerGame(spec());
g.setNationOptions(new NationOptions(spec(), Advantages.SELECTABLE));
MapGenerator gen = new SimpleMapGenerator(new Random(1), spec());
... |
690b91ca-eaa2-4e8f-94c3-0864889df126 | 9 | public void createQuiz(User user){
// set user to user controller
this.userC.setUser(user);
// initialise quiz model
QuizModel quizM = new QuizModel();
// initialise quiz game model
QuizGameModel qgameM = new QuizGameModel();
boolean duplacateName = true;
// while quiz name is not unique
while(dupla... |
7f73323b-a584-4408-8a59-f9d2aee2778c | 6 | public void initilize(){
//This sets h and w to be a square based on the smaller value
if (h != w){
if (h > w)
h = w;
else if (h < w)
w = h;
}
//Initialize the layer images so they are retrieved once (not for every cell)
Grid grid = request.operator.getGrid();
rocksMGS = new Image[grid.getNum... |
43279848-611c-4f5d-9d16-61a904eba06b | 8 | public void selectSecondaryCannon() {
Room target_room = target_room_info.getValue().neighbor;
if (bound_pyro.getSecondaryAmmo(PyroSecondaryCannon.MEGA_MISSILE) > 0) {
for (Robot robot : target_room.getRobots()) {
if (robot.getShields() >= MEGA_MISSILE_MIN_SHIELDS) {
bound_pyro.switchSec... |
8c92a432-1152-444a-b3ca-3389cefe3c95 | 4 | private short[] findY2(short t1Index, short t2Index, short t3Index, short t4Index){
int numTries = 0;
short stopBefore = mod(t1Index - 1);
short pathT4Index = path[t4Index];
for(short t5Index = mod(t3Index + 2); t5Index != stopBefore && numTries < LIMIT; t5Index = mod(t5Index + 1)){
// visualizer.highlightLo... |
56c1dc0e-df15-4786-b211-9da77d7cb4cb | 1 | public int peek(){
if(top!=null) return top.val;
return -1;
} |
150330a7-a077-4d9b-9dd5-aba61922bef4 | 5 | private static float[][] diamondStep(float[][] map, int xSide, int ySide, float randomRange){
float center = 0.0f;
int xHalfSide = xSide/2;
int yHalfSide = ySide/2;
for(int x=0; x<map.length-1;x+=xSide){
for(int y=0;y<map[0].length-1;y+=ySide){
if(map[x+xHalfSide][y+yHalfSide] == 0.0f){
center... |
99deac8e-c468-48dc-a681-db6c57392268 | 4 | protected boolean isOnMap(int x,int y){
boolean b = false;
if (x>=0 && x<this.width && y >= 0 && y < this.height) b = true;
return b;
} |
6b366ba9-9285-4e9e-b0fc-8be63f8da721 | 1 | public String getOptionsText() {
String tmp = "";
for (ComboboxItem i : comboItems) {
tmp += i.getValue() + " ";
}
return tmp;
} |
a99e4b2b-9474-441c-b20c-33517a951831 | 2 | public void save(String binaryFile) {
fieldByName = null; // This one is not serializable (and we don't really need it anyway)
if (verbose) Timer.showStdErr("Saving to file '" + binaryFile + "'");
Gpr.toFileSerialize(binaryFile, this);
if (verbose) Timer.showStdErr("Done.");
} |
e30ab4e0-5016-4367-9c7d-e142e7ed2ac3 | 7 | @Override
public List<T> next() {
if (!hasNext())
throw new NoSuchElementException();
if (arr[1] == 0) {
for (int i = 0; i < arr.length; i++)
arr[i] = i;
} else {
int k = arr.length, n = source.size(), i = k - 1;
for (; i > 0 && arr[i] == n - k + i; i--)
;
arr[i++]++;
for (; i < k; a... |
bbe779bd-e4df-4371-9ccd-35774b210ab2 | 0 | protected void setCenter() {
Dimension screen = this.getToolkit().getScreenSize();
Dimension login = this.getSize();
this.setLocation((screen.width - login.width) / 2,
(screen.height - login.height) / 2);
} |
8a105372-3eca-4987-958b-484c361bd55b | 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... |
de17b8ed-8279-4ebf-930f-d7b3666e7c85 | 5 | public static void parseMods(File f) {
try {
JAXBContext jaxb = JAXBContext.newInstance(Mod.class);
Unmarshaller unmarshaller = jaxb.createUnmarshaller();
System.out.print("Parsing mods...");
mod = (Mod) unmarshaller.unmarshal(f);
System.out.println("... |
6ae83c3a-2dbf-49b8-9057-19e2e809fe17 | 9 | public static Context string_getStellaContextSlowly(String self) {
{ Context context = null;
{ Context cxt = null;
Cons iter000 = Stella.$ROOT_MODULE$.childContexts.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
cxt = ((Context)(iter000.value));
if... |
de8a9398-d2b5-454f-bbe7-5ece39555f35 | 4 | public boolean addState(State s) {
if (s.rngState == -1)
throw new IllegalArgumentException("Tried to add state "+s+" without rngState.");
if(!stateMap.containsKey(s.stepCount))
stateMap.put(s.stepCount, useList ? new SubMapList() : new SubMapMap());
SubMap subMap = stateMap.get(s.stepCount);
... |
91f99007-0428-4a9c-93fe-e488495a8ae2 | 6 | public boolean push(E item) {
if(item == null) {
return false;
}
synchronized(lock) {
if(stack.size()>=capacity) {
System.out.println("Reach maximum capacity...");
return false;
}
// Insert item into stack
stack.push(item);
// Prepare max stack
if(maxStack.isEmpty()) {
... |
9ef09a68-63d1-4e43-aa00-16aef1eeaf6d | 6 | public boolean isLit(int x, int y, int z) {
return !(x >= 0 && y >= 0 && z >= 0 && x < width && y < height
&& z < length) || y >= blockers[x + z * width];
} |
96cc763d-b69b-4580-a3be-aeaa60222641 | 9 | void setExampleWidgetState () {
super.setExampleWidgetState ();
boolean isSeparator = (label1.getStyle () & SWT.SEPARATOR) != 0;
wrapButton.setSelection (!isSeparator && (label1.getStyle () & SWT.WRAP) != 0);
leftButton.setSelection (!isSeparator && (label1.getStyle () & SWT.LEFT) != 0);
centerButton.setSelec... |
d41ca014-e9ca-4ca7-ba79-35fe5c46f7a0 | 4 | @Override
public Operation update(Operation src) throws TransferServiceException {
Transfer transfer = findByOperationId(src.getId());
Operation result = null;
try {
if (src.getOperationType() == OperationType.transferTo) {
result = operationService.update(src);
... |
00107291-384f-4908-9bb2-63e34755a42a | 7 | private static boolean levenshteinOK(String a, String b, int aOffset, int bOffset, int max)
{
if (aOffset < 0) return (bOffset <= max);
if (bOffset < 0) return (aOffset <= max);
if (a.charAt(aOffset) == b.charAt(bOffset))
return levenshteinOK(a, b, aOffset - 1, bOffset - 1, max);
if (max == 0) return false;... |
cf4440a5-7c58-4f2f-bd8b-dc3e525dd555 | 5 | public static void main(String[] args) {
String start, end; //Starting and ending four letter word
Scanner scan = new Scanner(System.in);
boolean flag = true;//boolean for User Response Menu
//Import four.txt into a HashSet using newDictionary method below
HashSet<String> dictionary = null;
try {
dic... |
57ec34fc-92e2-40d9-90a8-ae8ebc6eb276 | 2 | public static void main(String[] args) {
List<Class> myClasses=new ArrayList();
myClasses.add(ClientModelUnitTest.class);
myClasses.add(PollerTest.class);
myClasses.add(ClientCommunicatorTest.class);
myClasses.add(PlayerTest.class);
myClasses.add(ServerProxyTest.class);
myClasses.add(Tra... |
4723d4ff-3b96-476c-8fc7-72da3705848c | 2 | public String procuraCampo(String cod_escola) {
Collection<Campo> campos = this.getCampo().values();
Iterator<Campo> camps = campos.iterator();
Campo camp = null;
while (camps.hasNext()) {
camp = camps.next();
if (camp.getCod_Escola().equals(cod_escola)) {
... |
1746152e-5fb4-4058-aa5a-55a6613a6e11 | 4 | public Skin(Path resHackerScript, Path authuiTmp, Path uifiletextTmp, Path basebrdTmp) {
if (!FileUtil.control(uifiletextTmp) || (resHackerScript == null) || !FileUtil.control(authuiTmp) || !FileUtil.control(basebrdTmp)) {
IllegalArgumentException iae = new IllegalArgumentException("One or more path... |
9f5dd819-c287-4f1e-b381-f478c0a519e8 | 3 | private void parse_addType( String line,
String keyword,
String[] split,
int lineNumber,
boolean strictMode )
throws ParseException {
// Line has the format:
// "AddType" <MIMEType> <FileExtension>
if( split.length != 3 ) {
throw new ParseException( "Invalid '"+keyword+"' declaration at line ... |
605fcfe6-eca1-472d-889b-bcbe339e4de7 | 7 | @Override
public double unsafe_get(int row, int col) {
if( row != 0 && col != 0 )
throw new IllegalArgumentException("Row or column must be zero since this is a vector");
int w = Math.max(row,col);
if( w == 0 ) {
return a1;
} else if( w == 1 ) {
... |
c5fe3692-6291-42d6-911b-4e0441aa57e3 | 0 | public synchronized void increment() {
c++;
} |
56076a66-d074-474b-930c-6d7ac80ee619 | 4 | public void update(long delta){
if (rightPressed && checkBeatOutOfBounds() != 1){
beat.move((int)delta);
}
if (leftPressed && checkBeatOutOfBounds() != 0){
beat.move(-(int)delta);
}
ball.move((int)delta);
resolveBallCollision();
checkWinCas... |
1c6c0dd0-19a2-4851-a5b7-4608a24b3994 | 7 | public static void experimentEcoli1(String[] args) {
final String ID = args[0];
ExecutorService exec = Executors.newFixedThreadPool(Runtime
.getRuntime().availableProcessors());
System.out.println("Start with "
+ Runtime.getRuntime().availableProcessors() + " threads");
try {
// test with following ... |
66341c17-7a8e-41dc-90d5-cfaabb6f2ce9 | 1 | private Fraction parseNumerals(String item){
// create variables
int num, denom;
// create Scanner
Scanner s2 = new Scanner(item);
s2.useDelimiter("/");
// get 1st integer
num = s2.nextInt();
// check for 2nd integer & return Fraction
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.