method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c09330e2-51b3-4d0e-bba7-1e180d54c380 | 3 | public static void main(String[] args)
{
final String string = "Hello!";
Random random = new Random();
Terminal terminal = new TestTerminalFactory(args).createTerminal();
terminal.enterPrivateMode();
terminal.clearScreen();
TerminalSize size = terminal.getTerminalSize... |
1236cb4e-20d2-454c-8e5e-9b55ce90497b | 9 | private Integer safetilesincorner(OthelloTile tile){
int ret = 0;
TileDirection ydir = tile.getNeighbor(TileDirection.Up) != null? TileDirection.Up : TileDirection.Down;
TileDirection xdir = tile.getNeighbor(TileDirection.Left) != null? TileDirection.Left : TileDirection.Right;
int ymax = 8;
int ycount = 0;
... |
3507f386-f7a7-410b-9310-7d4e77f2e3df | 9 | public static String applyZip(String in1, int idx1, String in2, int idx2, OperationCombiner func)
{
OperationSerializer.OpIterator iter1 = new OpIterator(in1, idx1);
OperationSerializer.OpIterator iter2 = new OpIterator(in2, idx2);
SmartOpAssembler assem = new SmartOpAssembler();
Operation op1 = new Operation... |
1dc71d05-766f-458d-a546-6780ad5390f2 | 2 | public Builder popularRepository(Repository respository) {
// If we didn't get a repository, do nothing.
if (respository == null) {
return this;
}
if (message.popularRepositoryList == null) {
message.popularRepositoryList = new ArrayList<R... |
afb63bb4-626b-45fa-be88-b01e2e155ff4 | 5 | public boolean evaluateDarkCheck(Chessboard board)
{
//Create copies of the board at its current state so that I'm not modifying the game
Chessboard chessboardCopy = new Chessboard(board);
Tile[][] tileBoardCopy = chessboardCopy.getBoard();
//Get king and king location
Piece darkKing = getDarkKing(tileBoa... |
e94deb72-be5d-44ea-9327-79dd212c96dd | 3 | @Override
public String toString() {
String string = "", string2 = "";
for (Connector c : connectors)
string += c.getName() + "(" + (c.isProvided() ? "P" : "R") + "), ";
for (HardwareSet hws : hardwareSets)
string2 += hws.getName() + " or ";
return getName() + " atomic operations: " + atomicOperations + ... |
d971f7ec-487e-46c6-8c50-25a345d67515 | 8 | private void handleResponse(TaskTrackerHBResponse resp) {
if(resp.getCommand() == TaskTrackerHBResponse.Cmd.SHUT_DOWN) {
shutdown();
} else if(resp.getCommand() == TaskTrackerHBResponse.Cmd.NEW_TASKS) {
List<Task> newTasks = resp.getNewTasks();
TaskManager freeWorker;
for(Task newTask : newTasks ) {... |
dba48684-2cd4-4766-9b3c-c909b386fd7f | 3 | public boolean intersectsY(Rectangular other)
{
if (this.isEmpty() || other.isEmpty())
return false;
else
return !(other.y1 > y2 || other.y2 < y1);
} |
3639093a-039d-4e98-8cb9-c7331cc6e23f | 1 | public void setNametextFonttype(Fonttype fonttype) {
if (fonttype == null) {
this.nametextFontType = UIFontInits.NAME.getType();
} else {
this.nametextFontType = fonttype;
}
somethingChanged();
} |
ddc6b236-05a4-4d18-a4c7-c22902cf6e2e | 5 | private void deliver (Message m) {
int source = m.getSource();
int destination = m.getDestination();
if (destination != -1) {
unicast(m, getDelay());
} else {
int delay;
boolean drop = false;
boolean first = true;
/* Broadcast. */
for (int i = 1; i <= r.n; i++) {
drop = (source == i && Uti... |
32567113-9732-4223-ac19-10608f360bfa | 5 | public ArrayList<Boolean> cantoRealEnvido(boolean envido, boolean envidoEnvido, Contador contador, boolean mentir, Humano jugadorH){
ArrayList<Boolean> respuesta = new ArrayList<Boolean>();
boolean realEnvido = false;
boolean faltaEnvido = false;
if(mentir){
this.faltaEnvido(envido, envidoEnvido, true, jugad... |
f17619bf-3ab7-4b47-af7c-0abc25c7d4db | 9 | private void loadInputData() {
men = new ArrayList<Person>();
women = new ArrayList<Person>();
try {
FileInputStream fstream = new FileInputStream("input-indifference.tsv");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String str... |
67ef2bc1-0883-405c-a940-53d85d16a640 | 5 | public BEValue bdecodeBytes() throws IOException {
int c = getNextIndicator();
int num = c - '0';
if (num < 0 || num > 9)
throw new InvalidBEncodingException("Number expected, not '"
+ (char) c + "'");
indicator = 0;
c = read();
int i = c - '0';
while (i >= 0 && i <= 9) {
// This can overflow!... |
8ebb127c-46d3-49c0-b8db-2059afeee89c | 1 | private void dispatch(HttpServletRequest request,
HttpServletResponse response, String page)
throws IOException, ServletException {
if (isPageToRedirect(page)) {
response.sendRedirect(page);
} else {
RequestDispatcher dispatcher = this.getServletContext().getRequestDisp... |
fcb81b6d-0ce3-4a47-b9d8-2bb09087d990 | 3 | public List<String> createMismatches(String s) {
List<String> mismatchList = new ArrayList();
List<String> helpList;
int stringLength = s.length();
for (int i = 0; i < stringLength; i++) {
Character ch = s.charAt(i);
helpList = changeChar(s, i, ch);
f... |
f09081e8-bc2a-43dd-b39b-c8eb74cc41fb | 3 | public Object[] getAllIdentifier(){
ArrayList<String> ids = new ArrayList<String>();
for (Map.Entry<String, Identifier> entry : hm.entrySet()) {
Identifier id = entry.getValue();
if(!id.getBlock().contains(":") && !ids.contains(id.getNewName(true))){
ids.add(id.getNewName(true));
}
... |
329faa6f-5f67-4c23-a88c-cea4d8b87a93 | 2 | public void verifyText(VerifyEvent e) {
StringBuffer buffer = new StringBuffer(((Text) e.getSource()).getText());
buffer.replace(e.start, e.end, e.text);
String newText = buffer.toString().trim();
if (vermilionCascadeNotebook.getEditor().getText() != null
&& !vermilionCascadeNotebook.getEditor().equals(new... |
c0084fa8-7b38-47b8-933a-668bd284af54 | 7 | public static void menue(Scanner in, Rezeptliste rl, JAXBContext context) throws JAXBException {
int number_recipes = rl.getRezept().size();
System.out.println("Was wollen sie tun:");
System.out.println("Rezept auswaehlen - 1");
System.out.println("Kommentar verfassen - 2");
System.out.println("Beenden - 3");... |
193eaa06-bb81-4213-998e-3ee4ee257d67 | 5 | public Model getBodyModel() {
if (modelIds == null)
return null;
Model models[] = new Model[modelIds.length];
for (int m = 0; m < modelIds.length; m++)
models[m] = Model.getModel(modelIds[m]);
Model model;
if (models.length == 1)
model = models[0];
else
model = new Model(models.length, models);... |
5d457726-7c83-4a78-8efd-f0bcf5b54771 | 0 | private PersonImpl(String name, int age) {
this.name = name;
this.age = age;
} |
139a25af-1398-4efe-85d9-89f31ffdf696 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
606d8dd8-8cbe-47f7-8a7f-9525481add87 | 4 | public void getwords()
{
String line="";
try {
while((line=reader.readLine())!=null)
{
line=line.toLowerCase();
if(!list.contains(line))
{
list.add(line);
}
}
} catch (IOException e) {
e.printStackTrace();
}
try {
reader.close();
} catch (IOException e) {
e.printStack... |
f13ea436-a226-4865-b1cc-d4c302ec26b0 | 6 | public void parseFilesList(PacketFilesList p) {
this.numFilesToSync = 0;
this.pbSync.setValue(0);
DefaultTableModel model = (DefaultTableModel) tblSync.getModel();
int rows = model.getRowCount();
for (int i = rows - 1; i >= 0; i--) {
model.removeRow(i);
}
... |
f7e9f443-9829-46b0-926e-756467955688 | 2 | public static void azzeraPedine(){ // azzera la griglia dopo la fina di una partita (Nuova Partita, Pari)
menuItem2.setEnabled(false);
for (int i=0; i<4; i++)
for (int j=0; j<3; j++){
PedinePC[i][j].setIcon(new ImageIcon("images/Pedine/vuota.png"));
PedineUtente[i][j].setIcon(new ImageIcon("im... |
8c252d33-7ee0-4623-a621-7882d9504174 | 3 | @EventHandler
public void onBankerInteract(PlayerInteractEntityEvent event) {
MainBank mainbank = new MainBank(plugin);
Entity ent = event.getRightClicked();
final Player player = event.getPlayer();
if(NPCData.centralBanker.containsKey(ent)) {
event.setCancelled(true);
IconMenu bankerMenu = new Ico... |
2710a956-55b3-4451-83f9-45ac7df94cf6 | 9 | public List<AlumnoDTO> getAlumnosInscritos(){
List<AlumnoDTO> alumnos = new ArrayList<AlumnoDTO>();
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
String sql = null;
ResourceBundle bundle = null;
String semestre_que_termina = null;
//Leemos los valores del archivo de configur... |
a8b978f2-8744-4298-a6c4-3a16a4e6a93d | 7 | final void renderHermiteArrowHead(int i) {
short colix = getLeadColix(i);
setNeighbors(i);
if (setMads(i, false)) {
try {
doCap0 = true;
doCap1 = false;
if (meshes[i] == null || !meshReady[i])
createMeshCylinder(i, (int) (madBeg * 1.2), (int) (madBeg * 0.6), 0, aspectRatio >> 1);
meshes[i]... |
a6f1b32a-326b-44a4-afb8-bcab3a639a55 | 3 | private void resetObjects()
{
for (int i = 0; i < grid.length; i++)
{
for (int j = 0; j < grid[i].length; j++)
{
if (grid[i][j].getObject() != null)
{
grid[i][j].getObject().setPainted(false);
}
}
}
} |
88cb5f09-6b7e-4c9c-840c-a144c4db1a38 | 4 | public synchronized void gridletResume(int gridletId, int userId, boolean ack)
{
boolean status = false;
// finds the Gridlet in the execution list first
int found = gridletPausedList_.indexOf(gridletId, userId);
if (found >= 0)
{
// removes the Gridlet
... |
f76131a4-ef0f-4e56-8cb9-dfb4129b3ed0 | 5 | public ArrayList<ClusterPoint> getPointsFromGUI(int dimensionCount)
{
ArrayList<ClusterPoint> points = new ArrayList<ClusterPoint>();
boolean someValuesReset = false;
for(int i = 1; i <= getGUIPointCount(dimensionCount); i++) // Line to Check
{
ClusterPoint p = new ClusterPoint();
for(int j = 0; j < dim... |
3b9ab67a-c028-4222-b907-67e1495a0ce2 | 8 | private void processSubtitle(String subtitleFile) throws IOException {
RandomAccessFile raf = new RandomAccessFile(subtitleFile, "r");
int previousEndTime = 0;
int fullPauseTime = 0;
int notZero = 0;
String line = raf.readLine();
String chunkText = "";
while (li... |
618acded-1305-41df-8a9a-324b23ac0fea | 9 | @Override
public void actionPerformed(ActionEvent e) {
{
ArrayList<CAnimation> next = new ArrayList<CAnimation>();
Iterator<CAnimation> i = animations.iterator();
CAnimation iter;
while(i.hasNext()){
CAnimation anim = i.next();
anim.ticks++;
gui.getMasterNode().findChild(anim.item).moveRelati... |
e46e663f-658d-4cb8-b7ac-5b763f1bcabe | 2 | public static byte[] readByteArray(String fileName) throws IOException {
File f = new File(fileName);
if (!(f.exists() && f.canRead())) {
throw new FileNotFoundException(fileName+" is not found");
}
byte[] data = new byte[ (int)f.length() ];
InputStream inStream = n... |
167040a3-d0a0-4eb1-ae42-dfe76bd92f7d | 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... |
7498fa04-7df4-4184-8783-5768f00c2f88 | 0 | protected void setTitle(String _title) {
this.title = _title;
} |
5073bcf0-7af8-4703-9470-2482507ce19a | 7 | public static void main(String[] args) throws Exception {
if (args.length > 2 || args.length < 1) {
System.err.println(HELP_TEXT);
System.exit(-1);
}
ArchiveManager archiveManager = new ArchiveManager();
WikiApp wikiApp = new WikiApp(archiveManager, true);
... |
d87b1a46-602d-4226-a523-b4b7b2c3083d | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
9876bec3-6634-4295-ae06-673262e1aa2d | 2 | @Override
public String getPrice(String seller, String service) {
String price = null;
ResultSet rs;
try {
PreparedStatement statement = connection
.prepareStatement("SELECT * FROM ServicesSellers WHERE username = ?" +
" AND service = ?");
statement.setString(1, seller);
statement.setStrin... |
f87925d1-c6f1-4cbb-8584-32c452ec4895 | 2 | public void save() {
try {
sql.Query.save(this);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
} |
15979865-95fb-41e2-9459-1ad41c3e32d3 | 5 | private void changeAll() {
TableEntryModel.this.fireTableStructureChanged();
TableEntryModel.this.fireTableDataChanged();
needsSuggestions = new ArrayList<>();
int rows = recordNotifier.getRowCount();
for (int i = 0; i < rows; ++i) {
ArrayList<... |
cb59cb44-865b-4943-aeff-3f0c6fbfbb24 | 0 | public boolean containBoy(ParkBoy boy) {
return this.parkBoyList.contains(boy);
} |
079ee298-4678-4aaf-b2a2-015d0fa70637 | 2 | public void replace_key()
{
if( isKeyCurrent() ) remove_key(); // simply, without optimal space saving algorithms
if(searchKey!=null) append_key();
} |
e4e10d2b-6b3a-4f1f-b312-f169d00356eb | 1 | @Override
public String getRequestURI() {
if (requestURI == null) {
return super.getRequestURI();
} else {
return requestURI;
}
} |
6b27b7ef-74bf-4ab5-a692-f003db826182 | 2 | public void previousScene()
{
if (current_scene > 0)
{
current_scene--;
}
else if (current_scene == 0)
{
current_scene = 0;
}
} |
052cb0b4-0690-41a3-b689-fb646af0e935 | 1 | public HashMap<String, GameObjectInformation> getGameInformation() {
HashMap<String, GameObjectInformation> matchInformation = new HashMap<>();
Iterator<Entry<String, GameObject>> it = gameObjects.entrySet().iterator();
while(it.hasNext()){
Entry<String, GameObject> entry = it.next();
matchInformation.put(e... |
d47132b2-dbc9-421f-af9c-d922bdcdee1d | 9 | public static void createTables(){
// Проверяем на необходимость
if(! checkTables()){
SMS.warning("База данных не существует. Далее будет попытка ее создать.");
String name_file = ua.edu.odeku.pet.settings.ConfigureProgramm.getSQL_TABLES_FILE();
if(name_file.endsWith(... |
a8e71fba-1711-46ff-978a-68ce40224374 | 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... |
139fd672-25b7-44ca-8d98-f0b816cb8883 | 7 | public void addLines(List<String> lines) {
final ScrollBar bar = canvas.getVerticalBar();
final boolean atBottom = bar.getSelection() + canvas.getClientArea().height > activeModel.getTotalRows() * lineHeight - 20;
for(String line:lines) {
if(line.matches("\\s*")) {
continue;
}
// Increase width ... |
9bfa943c-d25b-4bb9-a618-6cb6c3aa8d77 | 1 | public Graphics2D graphics() {
if(cg != null)
throw(new RuntimeException("Multiple TexIM Graphics created (" + Thread.currentThread().getName() + ")", cgc));
cgc = new Throwable("Current Graphics created (on " + Thread.currentThread().getName() + ")");
return(cg = back.createGraphics());
} |
b4567d72-f2a2-454e-a59d-a2a0d66a8ce2 | 3 | @Test
public void testECIES() throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchProviderException {
CryptManager.getInstance();
String message = "dfschamlxeadgsfredcaxds";
KeyPair key = CryptManager.getInstance().generateEncryptionKeyPair();
byte[] source = message.getBytes("UTF-8");
Encr... |
e6efde9d-ddcb-4fc2-8f6c-363065665160 | 9 | public void makeAIMove(){
if(m_game.getPlayerTurn() % 2 == 0){
int[] move = ((TicTacToeComputerPlayer) m_playerOne).makeMove();
int x = move[0];
int y = move[1];
boolean temp = true;
while(temp){
if(m_game.checkMove(x, y)){
m_game.move(x, y, m_playerOne.getColour());
temp = false... |
1deed64d-e0b0-45d1-8fb7-09e106ff4407 | 8 | public void move(World world)
{
xSlow = xSlow + xSpeed;
ySlow = ySlow + ySpeed;
while(xSlow >= 100)
{
if(blockRight(world))
{
xSpeed = Math.min(0, xSpeed);
xSlow = 0;
break;
}
else
{
x++;
xSlow -= 100;
}
}
while(ySlow >= 100)
{
if(blockDown(world))
{
... |
cf041e8d-16fc-4957-abcb-7fd332c6189a | 3 | @Override
public boolean equals(Object obj) {
ClassifiableObject co;
try {
co = (ClassifiableObject) obj;
} catch (Exception e) {
LOG.warning("Can't compare diffrent object than ClassifiableObject");
e.printStackTrace();
return false;
}
for (int i = 0; i<this.features.size(); i++) {
if(!this.f... |
dc693c51-4bc5-4cd2-8e7c-5e90ea20be73 | 1 | public void addOnline() throws IOException {
String path = "C:\\Users\\aawor_000\\workspace\\TCPServer\\src\\Status\\Online.txt";
try {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(path, true)));
out.println(currentUser);
out.close();
} catch (IOException e) {
System... |
93135d28-0e08-4705-b828-94ab4aeadb8b | 3 | public AbstractModel getModel(Class<? extends AbstractModel> clazz) {
for (AbstractModel model : registeredModels) {
if (clazz.isInstance(model)) {
return model;
}
}
return null;
} |
c0910207-b45e-4101-8e4b-1b2290d16692 | 1 | public void doMove(String position, int player) {
int pos = getInt(position);
if (gl.validMove(pos, player)) {
JButton update = this.game[pos];
gl.makeMove(pos, player);
makeJButton(update, player);
}
} |
e22a5670-3667-48ce-a448-3aca0b7b4da5 | 4 | public static void main(String[] args) {
//System Swing Look and Feel
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
System.err.println("Error: Impossible to load the system Look and Feel");
System.exit(-1);
}
// Tests.fakePlayers_test();
// Tests... |
f02d8366-a438-4609-a2d3-b6e99311aae0 | 9 | private Element buildBibData( VgerBibData bibData, Document output )
{
Element bibNode;
bibNode = output.createElement( "BibData" );
bibNode.appendChild( makeTextNode( "ReferenceNumber", getBibID(),
output ) );
if ( bibData.getTitle() != null )
bibNode.appe... |
daacf2e6-2125-420b-bcab-a963122626e6 | 9 | public static void run(Bot bot, String channel, String sender, String message) {
//initialize array on first run
if (init == false) {
for (int i = 0; i < 10; i++) links[i] = "*feed me*";
init = true;
}
// command "!submit"
int index = 0;
if (message.matches("^[.!][sS]ubmit(.*)")) {
String[] w... |
58f86946-b3d4-4f1d-838e-56c9596b5a50 | 9 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(affected==null)
return;
if(canBeUninvoked())
{
if(affected instanceof Room)
{
final Room room=(Room)affected;
room.showHappens(CMMsg.MSG_OK_VISUAL, L("Gravity returns to normal..."));
if(invoker!=null)
{
fina... |
ddf1060b-1dd1-4f6d-9bb7-35f1b0e53d33 | 6 | public void ValidateParameters() throws Exception {
ArrayList<String> missingParameters = new ArrayList<String>();
String checkParm = new String();
String missingParametersDisplayMessage = new String();
//Go through the list of mandatory parameters for this implementation of IDQResultsProcessor, and determin... |
c8d58023-b66d-43a6-ab41-ae380d7345ad | 1 | public JSONObject optJSONObject(int index) {
Object o = this.opt(index);
return o instanceof JSONObject ? (JSONObject) o : null;
} |
8408a10f-8e20-4d36-abd4-8fe28f106b53 | 8 | private static void renderTypes(int windowX, int windowY){
Font.render("Typ", windowX + 16, windowY + height - 24 - 50);
for(int i = 0; i < 4; i++){
String texturePath = "/res/skills/";
SkillType type = null;
switch (i) {
case 0:
// PROJECTILE
type = SkillType.PROJECTILE;
texturePath... |
40a63a53-40f9-49bc-9f83-0deff1fba5c2 | 7 | private static int getStringType(String text) {
Expressions expressions = Calculator.expressions;
boolean isFunction = expressions.matchesFunction(text);
if(isFunction) {
return TOKEN_FUNCTION;
}
boolean isNumberLiteral = expressions.matchesNumber(text);
if(isNumberLiteral) {
return TOKEN_NUMBE... |
046fcaaa-960a-439c-a8b5-669367372d3c | 7 | public void Draw(Graphics graphics)
{
Color curcolor;
if(CurrentState == running)
curcolor = Color.BLUE;
else
curcolor = gcolor;
int curx = getLocation().x;
int cury = getLocation().y;
int bottom = cury... |
1ce2538a-8c0b-4430-8db6-564bd28c4978 | 7 | private void findBest() {
if(currentBest == null){
currentBest = population.get(0);
genFound = this.generationCount;
}
for(Chromasome c : population){
if(c.getFitness() > currentBest.getFitness()){
currentBest = c;
generationsUnchanged = -1;
genFound = this.generationCount;
}
if(current... |
e59ee55a-f65f-4d06-bb4b-f6d6331cf85e | 7 | @Override
public boolean equals(Object a){
if (!a.getClass().equals(this.getClass())){
return false;
}
if (((PGM)a).maxNiveauGris!=this.maxNiveauGris || ((PGM)a).hauteur!=this.hauteur ||
((PGM)a).largeur!= this.largeur || ((PGM)a).niveauxGris.size()!= this.niveauxGr... |
01947ad7-1bd8-44ce-b625-9a365e5f030f | 1 | public static Boolean isBlank(String str) {
return str == null || "".equals(str.trim());
} |
bc75b623-0b31-4656-aa39-48d00f0d898a | 3 | public static ArrayList getTotaisOp() throws SQLException, ClassNotFoundException {
ArrayList sts = new ArrayList();
Connection conPol = conMgr.getConnection("PD");
ResultSet rs;
if (conPol == null) {
throw new SQLException("Numero Maximo de Conexoes Atingida!");
}
... |
7107a5ec-c717-4f9f-9501-e9ec3643b116 | 9 | private String getContent(String path) {
path = path.toLowerCase();
if (path.endsWith(".html") || path.endsWith(".htm")
|| path.endsWith("/")) {
return "text/html";
} else if (path.endsWith(".jpg") || path.endsWith(".jpeg")) {
return "image/jpeg";
} else if (path.endsWith(".png")) {
return "image/p... |
804b734b-994e-4efb-94be-8a2f637336d5 | 4 | @Override
public boolean isVisibleAt(int posX, int posY) {
if((posX/zoom) > originX && (posX/zoom) < (originX + width))
if((posY/zoom) > originY && (posY/zoom) < (originY + height))
return true;
return false;
} |
948016ff-91f0-46ae-9ad8-fbd8c873aecc | 2 | @Override
public ByteBuf serialize(O_03_CallInputWithMultipleSupplementaryServices ucpOperation) {
ByteBuf bb = Unpooled.buffer();
Serialization.serializeString(bb, ucpOperation.getRad());
Serialization.serializeString(bb, ucpOperation.getOadc());
Serialization.serializeString(bb, ucpOperation.getAc());
S... |
a926ddb2-99e3-42e0-b6ae-512b621a7f92 | 8 | void tick() {
if (x + xa < 0) {
xa = 3;
Sound.playScoreSound();
MultiPlayerState.p2Score++;
}
if (x + xa > GamePanel.WIDTH - image.getWidth(null)){
xa = -3;
Sound.playScoreSound();
MultiPlayerState.p1Score++;
}
if (y + ya < 0)
ya = 1;
if (y + ya > GamePanel.HEIGHT - image.getHeight(nul... |
7bca4d76-10a2-458a-9853-6ac403c11924 | 1 | private void load() {
int shipFreeSpace = getFreeSpace();
boolean loading = true;
Dispatcher.informShipMoored(name);
try {
lock.lock();
log.info(Dispatcher.informShipAction(name, loading));
if (shipFreeSpace <= port.getLoading()) {
... |
70c35c4c-21b9-4a88-abb5-40a86c0b772a | 3 | private boolean skipHerTurn(GenericNode depart) {
if (depart.getValue().equals("wall")
&& depart.isHerbe()) {
depart.setHerbe(false);
listVarInt.put("i", listVarInt.get("i") + 1);
listVarInt.put("actuel", listVarInt.get("actuel") + 1);
if (listVarI... |
af92948a-47a8-412f-8b74-bb617cdbadb8 | 3 | public void addCharPic(){
ImageCreator charImg = null;
try{
if (player.getType().equalsIgnoreCase("Warrior")){
charImg = new ImageCreator("WarriorMain.jpg");
charImg.setBounds(150, 1, 200, 300);
}
else if (player.getType().equalsIgnoreC... |
c11d8fce-b418-425d-84ee-48d3a20f6a3b | 0 | public static ResultSet _findByArray(String tableName, String field, String value) throws SQLException {
PreparedStatement statement = connect.prepareStatement("select * from `"+tableName+"` where exists (select 1 from `" + getArrayTableName(tableName, field) + "` where `key` = `" + tableName + "`.`id` and `value` = ... |
83d8552f-5380-4350-ad09-9094a7d593ef | 0 | @Override
public void mouseMoved(MouseEvent e) {
} |
c8eef8ec-65f5-4931-bc59-db17b90b5a45 | 8 | *
* @throws ConfigurationChangeException Falls ein Objekt nicht importiert werden konnte.
*/
private void handleObject(CheckedObject checkedObject, ImportObject importObject) throws ConfigurationChangeException {
final SystemObjectProperties property = importObject.getProperties();
if(checkedObject != null) {
... |
ca36bc6b-b797-4bfa-acb4-b89ecf2e2aed | 8 | public void close() {
Exception taskKillException = null;
if (WindowsUtils.thisIsWindows()) {
if (!browserConfigurationOptions.is("honorSystemProxy")) {
restoreSystemProxy();
}
}
if (process == null) return;
if (browserConfigurationOptions.... |
29f5bf41-d889-4f59-9987-8d074911b02f | 9 | public boolean combineLocal() {
StructuredBlock firstInstr = (catchBlock instanceof SequentialBlock) ? catchBlock
.getSubBlocks()[0] : catchBlock;
if (firstInstr instanceof SpecialBlock
&& ((SpecialBlock) firstInstr).type == SpecialBlock.POP
&& ((SpecialBlock) firstInstr).count == 1) {
/* The except... |
4b8bbfab-eaec-4ae5-bfc1-0d1eab5aeb63 | 0 | public void setHouseNumber(String houseNumber) {
addressCompany.setHouseNumber(houseNumber);
} |
26439530-2804-4abf-96b8-eac2fcdd4b86 | 7 | public boolean canBuildCity(int playerIndex, VertexLocation location) {
VertexLocation normVerLoc = location.getNormalizedLocation();
if (!playingCommandsPreconditions(playerIndex)) {
return false;
}
Player player = serverModel.getPlayers().get(playerIndex);
if (player.getWheat() < 2 || player.getOre... |
737758dc-eac6-41d6-ae7d-2d4484de5b03 | 4 | public static double getMaxObservation(ArrayList<Observation>[] list, Vector2d reference){
if(list == null) return 0;
double result = 0;
for(int i=0; i<list.length; i++){
for(int j=0; j<list[i].size(); j++){
double distance = list[i].get(j).position.dist(reference);
if(dis... |
95895cb3-4eb5-4140-94fb-62250cf83342 | 9 | private static void run( File file )
{
nsDetector det = new nsDetector() ;
// Set an observer...
// The Notify() will be called when a matching charset is found.
det.Init( new nsICharsetDetectionObserver()
{
public void Notify( String charset )
{
found = true ;
System... |
640c1c58-3b94-4edf-8e33-601eb1a0828d | 8 | public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BinaryRule)) return false;
final BinaryRule binaryRule = (BinaryRule) o;
if (leftChild != null ? !leftChild.equals(binaryRule.leftChild) : binaryRule.leftChild != null) return false;
if (parent != null ? !pa... |
2cd39c5c-8d40-466d-924c-54a52c893c9c | 8 | public void stateChanged(ChangeEvent e) {
if(e.getSource().getClass()==JSlider.class) {
JSlider source = (JSlider)e.getSource();
if (!source.getValueIsAdjusting()) {
int interval = (int)source.getValue();
if(interval<SimulationPlayer.IN... |
f2bc7558-f586-40f5-af6e-44217938139b | 9 | public int[][] generateMatrix(int n) {
// Start typing your Java solution below
// DO NOT write main() function
if (n < 0) {
return null;
}
if (n == 0) {
return new int[0][0];
}
int curr = 0;// current index of the left upper corner
int counter = 1;
int[][] result = new int[n][n];
while (curr ... |
f7324871-66a1-43b8-8733-b7e5e37f39cd | 5 | public final ProgramContext program() throws RecognitionException {
ProgramContext _localctx = new ProgramContext(_ctx, getState());
enterRule(_localctx, 0, RULE_program);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(22);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Operat... |
e4ea6097-16cc-46ea-90e1-69a6fbaf4a0c | 8 | public void startServer() throws IOException {
System.out.println("channel server started...");
byte[] response = null;
response = getResponse();
try (ServerSocketChannel ssc = ServerSocketChannel.open();
Selector selector = Selector.open()) {
ssc.configureBl... |
b5b0df18-d399-4e57-af76-222b33202f24 | 4 | void onScrollHorizontal (Event event) {
ScrollBar hBar = getHorizontalBar ();
if (hBar == null) return;
int newSelection = hBar.getSelection ();
update ();
if (itemsCount > 0) {
GC gc = new GC (this);
gc.copyArea (
0, 0,
clientArea.width, clientArea.height,
horizontalOffset - newSelection, 0);
gc.d... |
c54c9bb4-2c7a-45eb-9be6-b11145313bdd | 2 | public void printPopulation(){
for(String[] d : this.population){
for(String s : d){
System.out.print(s + ", ");
}
System.out.println();
}
} |
9e3ac29b-8a8f-4f98-8fb1-bf26e7131a78 | 9 | public Path aStar(Node start, Node goal) {
this.h = new StraightLineDistanceHeuristic();
if (!graph.contains(start)) {
// Fail -- start or goal node not in graph
System.out.println("start not in graph");
return null;
}
if (!graph.contains(goal)) {
System.out.println("goal not in graph");
retur... |
c218e5bc-d2f1-4a8c-a3bc-e05701167180 | 5 | protected void execute() throws Exception {
/* Step 1. Compute ALS */
ALSMatrixFactorization als = ALSMatrixFactorization.computeALS(baseFilename, nShards, D, 5);
logger.info("Computed ALS, now random walks");
/* Initialize drunkardmob */
DrunkardMobEngine<Integer, Float> drunk... |
054108ba-6c52-4d54-a41d-3ee8217f1410 | 7 | private void load() {
YamlConfiguration config = new YamlConfiguration();
double x, y, z;
String worldname;
//Check to see if the file exists before trying to load it
if(this.playerData != null && this.playerData.exists()) {
try {
config.load(playerData);
} catch (Exception e) {
Bukkit.getLogge... |
c5321e2e-aac4-461d-b595-9481584a4b25 | 5 | @Override
public void draw() {
if (hidden) {
return;
}
Transformation.pushMatix();
Point p = stage.scratchCoodsToReal(position);
Transformation.translate(Math.round(p.x), Math.round(p.y));
switch (rotationStyle) {
case normal:
Transformation.rotate(rotation);
break;
case leftRight:... |
d2a8e6a3-f537-48a1-aa70-8ac411fd9bb9 | 9 | public Element createComplexElement(String attribute, List<String> childs, String name) {
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("name is empty or null.");
}
if (attribute == null || attribute.isEmpty()) {
throw new IllegalArgumentExcepti... |
e007e00f-b85e-4dbb-b4f2-4605b8234398 | 0 | @Test
public void findHandFromCardSet_whenNoPairExists_returnsHighCardHand() {
Hand hand = findHandFromCardSet(kingQueenNineSixFourThreeTwo());
assertEquals(HandRank.HighCard, hand.handRank);
assertEquals(Rank.King, hand.ranks.get(0));
assertEquals(Rank.Queen, hand.ranks.get(1));
assertEquals(Rank.Nine, hand... |
e2fa1a4f-8904-42f1-aeba-ab45fc0f34e9 | 2 | public void remove() {
EntityManager em = conectar();
try {
AgendaPK agendaPK = new AgendaPK(dataHora, idMedico, idExame, idPaciente);
Agenda agenda = em.find(Agenda.class, agendaPK);
em.getTransaction().begin();
em.remove(agenda);
em.getTrans... |
8054a151-1cf3-49ed-b321-7be43cfa78b0 | 0 | public void setN(int n) {
this.n = n;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.