method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5f4a16d1-d9b2-49b4-b81a-a3646db4f77b | 9 | @Override
public void populateChunk(RealChunk chunk, Random random, int chunkX, int chunkZ) {
World world = noise.getWorld();
// cover the ground
int y = groundLevel + 1;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
// only plant in the right place
Material surface = chunk.g... |
c76066e0-b472-4cf1-a2fc-3cfd5f2ce4a1 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Restart other = (Restart) obj;
if (!Objects.equals(this.name1, other.name1)) {
return false;
... |
92141ac2-4b94-40ff-8007-46815b4e5ce0 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} |
de5cee7c-4a1b-4f1c-ab71-11da4e39da4c | 1 | private void setPoints(TreeNode node, int depth, int thisDepth,
int[] width, int[] widthSofar) {
// Scale points along ([0,1], [0,1]).
float x = (float) (widthSofar[thisDepth] + 1)
/ (float) (width[thisDepth] + 1);
float y = (float) (thisDepth + 1) / (float) (depth + 2);
nodeToPoint.put(node, new Point2D... |
0cab4a2e-3a7c-4ff8-afbd-206720086cd1 | 1 | public void run() {
MatrixChecker mc = new MatrixChecker();
int[] a = new int[]{1,2,3};
int[] b = new int[]{1,2,1};
System.out.println("is "+a+" sym? " + mc.isSymmetrical(a));
System.out.println("is "+b+" sym? " + mc.isSymmetrical(b));
a = new int[]{1,2,2,3};
b =... |
0f08a973-c581-4d41-81f5-320190243621 | 3 | public TileMap loadNextMap() {
TileMap map = null;
currentMap++;
while (map == null) {
try {
if (currentMap > 1) currentMap = 1;
map = loadMap("assets/maps/map" + currentMap + ".txt");
}
catch (IOException ex) {
map... |
9234687b-671c-4e17-be1f-edf3dd69fe6b | 2 | private String validateResponseCode(Number number) {
int rcode = number.intValue();
if (rcode >= 200 && rcode <= 299) {
return null;
}
return "Unexpected HTTP response";
} |
bbb92fc5-595f-49a1-b8ca-211b32ea9acb | 5 | @Override
public void removeItem(int index, int amount) {
for (int slot = 0; slot < getCapacity(); slot ++) {
if (getItems()[slot] == null) {
continue;
}
if (getItems()[slot].getIndex() == index) {
if (getItems()[slot].getAmount() > amount && ItemDefinition.getDefinitions()[index].isStackable()) {
... |
0de4b597-af19-40cb-acb6-8238a7baa925 | 4 | public Node<T> getPredecessor(Node<T> node) {
if (node.getLeft() != null) {
node = node.getLeft();
while (node.getRight() != null)
node = node.getRight();
return node;
}
Node<T> temp = node.getParent();
while (temp != null && node == temp.getLeft()) {
node = temp;
t... |
e6152746-1787-4bee-bdd6-93cdca6aa161 | 0 | public FilterSequence(SoundFilter[] filters) {
this.filters = filters;
} |
7518f51e-6f5d-4e31-90d1-ffb69d9291af | 6 | private void showFile(File file){
BufferedReader infile = null; // declare buffered stream
// get file name from the text field
String inLine;
jtfFile.setText(file.getName());
try {
// create a buffered stream
infile = new BufferedReader(new FileReader(file));
// read a line
inLine = ... |
20516dbc-40e1-4e3f-9ebf-d4ebe0758584 | 6 | @EventHandler
public void EndermanSpeed(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("Enderman.Spe... |
76b9d7cc-d600-436d-8f68-b40b0df33580 | 3 | public static List<FavoritesTag> constructTag(Response res) throws WeiboException {
try {
JSONArray list = res.asJSONObject().getJSONArray("tags");
int size = list.length();
List<FavoritesTag> tags = new ArrayList<FavoritesTag>(size);
for (int i = 0; i < size; i++) {
tags.add(new FavoritesTag(list.get... |
c5e52095-4315-48b0-8702-7f5bbad30a41 | 1 | @Override
public void add_first_index_child(Sentence_tree child){
Sentence_tree[] new_children = new Sentence_tree[this.children.length + 1];
for(int i = 0; i < this.children.length; i++){
new_children[i + 1] = this.children[i];
}
new_children[0] = child;
child.parent = this;
this.children = new_childre... |
1330fcf7-90a6-45fb-88b7-ec463829df92 | 1 | public String getIP() {
String ipAddress = "";
try {
// return socket.getInetAddress().toString();
InetAddress IP = InetAddress.getLocalHost();
ipAddress = IP.getHostAddress();
} catch (UnknownHostException ex) {
Logger.getLogger(Client.cla... |
8ed61578-e01c-49f4-9ece-9988d3e0a66f | 6 | public static void STARTUP_SAMPLE_CONTENTS() {
{ Object OLD_$MODULE$_000 = Stella.$MODULE$.get();
Object OLD_$CONTEXT$_000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/STELLA/XML-OBJECTS/SAMPLE", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.se... |
1eeaf7d5-235c-47c8-9bbd-76b023eeabe5 | 5 | @POST
@Consumes(MediaType.LIBROS_API_RESENA)
@Produces(MediaType.LIBROS_API_RESENA)
public Resena createResena(@PathParam("idlibro") String idlibro,
Resena resena) {
String username = security.getUserPrincipal().getName();
Connection conn = null;
Statement stmt = null;
try {
conn = ds.getConnection();
... |
9494da88-1871-4d8f-bb18-1e2bd938dfa0 | 3 | @Override
public boolean wipeTable(String table) {
//Connection connection = null;
Statement statement = null;
String query = null;
try {
if (!this.checkTable(table)) {
this.writeError("Error wiping table: \"" + table + "\" does not exist.", true);
return false;
}
//connection = open();
//t... |
7ffc2a8a-e56e-4d12-9001-b675ccc6e7c1 | 4 | private void parseValue(String line, int lineNum) {
// skip a comment line
if (line.startsWith(COMMENT)) {
return;
}
String[] sp = line.split("\\s+"); // split the fields based on a space
int len = 0; // length of a string
int index = 0; // the i... |
597fad57-714c-417b-975a-47f88db0fbe3 | 6 | private boolean _jspx_meth_c_forEach_1(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_forEach_1 = (org.apache.taglibs.stand... |
d21ba2fe-4b5e-4502-8deb-edd0a04a1a37 | 2 | public void doAll() {
ListSelectionModel model = editingGrammarView.getSelectionModel();
while (need.length != 0) {
model.clearSelection();
for (int i = 0; i < need.length; i++)
model.addSelectionInterval(need[i], need[i]);
convertSelected();
}
mainLabel.setText("All productions completed.");
edi... |
2290eb57-9555-43c7-9108-37c70d9c988e | 1 | public void update(double delta) {
components.removeAll(componentsToRemove);
componentsToRemove.clear();
Iterator<EntityComponent> it = components.iterator();
while (it.hasNext()) {
it.next().update(delta);
}
} |
8ff79b85-6a84-41cd-9f98-b944fd0dbd29 | 2 | public int size() {
int size = 0;
switch (_Type) {
case STRING:
size = TMS.size();
break;
case INTEGER:
size = TMI.size();
break;
default:
break;
}
return size;
} |
dc374778-4f9f-43e4-8f59-34b97fbbb3c9 | 4 | public Discount(double minimum, double value, DiscountType typeFlag){
if(minimum < 0) throw new IllegalArgumentException("Minimum purchase amount required cannot be negative.");
if(value <= 0) throw new IllegalArgumentException("Discount value cannot be 0 or below.");
if(value >= 1 && typeFlag == Discount.Discoun... |
87253942-bc32-410c-8685-66e196e7dbcb | 8 | public void discardCards(int numberOfPlayer, List<card> discard)
{
/* discardCards
* discardCards makes it so then cards that are discarded from the hand are placed into the discard pile
* @param (int numberOfPlayer) An int 1-4, which is respective to the players number
* @param (List<card> discard) contain... |
7c8628cf-3753-4d4c-9f46-fb48390619bc | 5 | private boolean jj_3R_13() {
if (jj_scan_token(SET_LITERAL_VARIABLE)) return true;
if (jj_3R_18()) return true;
if (jj_scan_token(ASSIGN)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3_65()) {
jj_scanpos = xsp;
if (jj_3_66()) return true;
}
return false;
} |
b4edad0f-3cfa-4d11-ad17-ce5e426e81f2 | 3 | static byte[] toBase64(byte[] buf, int start, int length){
byte[] tmp=new byte[length*2];
int i,j,k;
int foo=(length/3)*3+start;
i=0;
for(j=start; j<foo; j+=3){
k=(buf[j]>>>2)&0x3f;
tmp[i++]=b64[k];
k=(buf[j]&0x03)<<4|(buf[j+1]>>>4)&0x0f;
tmp[i++]=b64[k];
k=(buf[j... |
8cbbfff4-668a-4185-93c5-e569b2c7d1bc | 7 | public static Type canonicalize(Type type) {
if (type instanceof Class) {
Class<?> c = (Class<?>) type;
return c.isArray() ? new GenericArrayTypeImpl(canonicalize(c.getComponentType())) : c;
} else if (type instanceof ParameterizedType) {
ParameterizedType p = (ParameterizedType) type;
... |
6523d1db-a6a4-496e-a647-53e62d80ffb9 | 1 | public int send(int clientId, String message) throws CouldNotSendPacketException {
synchronized(CONNECTION_LOCK) {
Packet packet = Packet.createApplicationPacket(clientId, message);
//if the client isn't connected then throw an exception
if(!clients.containsKey(clientId)) {
logger.fine("Could not send m... |
58106f4d-4ee6-431c-932e-43de2cd483b5 | 0 | private BrowserType(String name) {
this.name = name;
} |
53da9c15-8798-46de-a2a6-86cab436cd3d | 4 | private void analyseMinAddressableUnit(String line) throws AssemblerException {
if (line.trim().length() == 0)
return;
if(foundMinAdrUnit)
throw new AssemblerException("MinAddressableUnit error: Minimum addressable unit already specified.");
foundMinAdrUnit = true;
line = line.trim();
boolean legi... |
29b216fc-60fc-4bd6-b431-d3db1861eff1 | 8 | @Override
public void createHardLink(String source, String destination) throws PathNotFoundException, SourceAlreadyExistsException, AccessDeniedException, UnsupportedFeatureException {
if (hardlinks)
{
if (innerFs.pathExists(source))
throw new SourceAlreadyExistsException();
if (!innerFs.pathExists(d... |
9f912247-7408-4ec0-aad7-c9c38124bf5d | 6 | private void plankSwitchWait() {
int logID = Planker.logID;
int plankID = Planker.plankID;
int plankPrice = Planker.plankPrice;
switch (plankSet) {
case 0:
while (plankSet == 0) {
Time.sleep(100);
}
case 1:
logID = 1511;
plankID = 960;
plankPrice = 100;
break;
case 2:
logID = 152... |
7fe71bb1-a9e8-4391-940e-7cf972ed052d | 7 | public boolean incluir(int pos, ContaCorrente conta)
{
if (pos <= capacidade - 1 && pos >= 0)
{
if (this.aContas[pos] != null)
{
for (int i=this.capacidade-2; i > pos - 1; i --)
this.aContas[i+1] = this.aContas[i];
this.aCon... |
0eb89d74-9ed9-4740-96df-04c682bdd085 | 4 | public static String toPureHtml(WebPage wp){
final StringBuffer result = new StringBuffer();
try {
final URL linkUrl = new URL(wp.getUrl());
final HttpURLConnection httpConnection = (java.net.HttpURLConnection) linkUrl.openConnection();
httpConnection.connect();
final java.io.InputStream urlStream = htt... |
8dfc6962-1070-4dcb-adbc-c7e9f6ac96b0 | 6 | @Override
public String executeCommands (Object object){
String gameStatus = Game.PLAYING;
do {
try{
this.display();
String command = this.getCommand();
switch (command) {
case "O":
// ... |
37fdcf1f-d995-46ce-8fad-6ac73a081786 | 6 | public void nouvellePartie() {
int vainqueur = -1;
this.joueurCourant = 0;
while ((vainqueur == -1) && !plateau.estPlein()) {
boolean coupValide = true;
do {
interfacep4.affichageJoueur(
joueurs[this.joueurCourant].obtenirNom(),
joueurs[this.joueurCourant].obtenirCouleur());
} while (!co... |
d64af21b-d9d2-4c52-bd23-352e1c7ebfaf | 6 | private void setTransform(int row, int col, Rectangle2D box) {
Texture texture = SpriteList.get(frame).getTexture();
transform.clear();
transform.textureOffsets = new Vector4f();
transform.color = new Vector4f(1f, 1f, 1f, opacity);
switch(row) {
case 0:
transform.y = box.getY() - (frameSize / 3);
t... |
3a00a18d-ca69-469c-a1ab-00f85fe1e777 | 9 | public void populateURL()
{
String c_url;
int i;
//Storing the urls parsed in this vector.. stop when length >=crawlDepth*maxURLCount
Iterator it;
//URL of string has been populated initially..
//Set initial crawled count to URLs crawled via the google API
syn... |
41c0045c-d6c1-4f96-86f3-d32cfb2bcb5c | 6 | @Override
public void mouseReleased(MouseEvent event) {
//Handle tile clicks.
if (event.getSource() instanceof Tile) {
Tile sourceTile = (Tile)event.getSource();
if(match.isInProgress() &&
//Make sure the mouse was released while still on the tile,
//by checking the event's positi... |
d2730706-f447-43a3-88b3-ba0a299448c8 | 3 | @Override
public synchronized void fire(Event event) {
for (EventListener<? extends Event> listener : listeners) {
if (listener.canHandle(event)) {
listener.handleGeneric(event);
}
}
} |
fa011407-10a4-4a54-8ee2-e0eb52a9e20b | 9 | public void paint(Graphics2D g, float vx0, float vy0, float vx1, float vy1) {
if (!isActive()) {
g.drawImage(backgroundImage, 0, (int) vy1 - backgroundImage.getHeight(), null);
return;
}
viewportMinX = vx0 + viewBorderX;
viewportMaxX = vx1... |
4dfa781b-686f-4c94-a2a3-ee6dfda57f2d | 4 | public void setLocals(final LocalDebugInfo[] locals) {
if (locals == null) {
for (int i = 0; i < attrs.length; i++) {
if (this.locals == attrs[i]) {
final Attribute[] a = attrs;
attrs = new Attribute[a.length - 1];
System.arraycopy(a, 0, attrs, 0, i);
System.arraycopy(a, i + 1, attrs, i, at... |
3167b7b5-44ef-4ca9-9ba9-098d7ef212ac | 2 | public Vector2D pursuit(SpriteV2 spriteV2){
Vector2D toTarget = spriteV2.getPosition().minus(parent.getPosition());
double relativeHeading = parent.heading.dotProduct(spriteV2.heading);
if( (toTarget.dotProduct(parent.heading) > 0) && (relativeHeading < -0.95) ){
return seek(spriteV2.position);
}else{
... |
962a800b-da98-4dfd-a5a9-59ef0ac77698 | 8 | protected void createContents() {
shlSatellitedemo = new Shell();
shlSatellitedemo.setSize(607, 435);
shlSatellitedemo.setText("SatelliteDemo");
shlSatellitedemo.setLayout(new GridLayout(1, false));
Composite topComposite = new Composite(shlSatellitedemo, SWT.NONE);
GridLayout gl_topComposite = new GridL... |
4b010106-6985-4416-a42f-c838724a2d46 | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(in.readLine());
int n = Integer.parseInt(st.nextToken());
k = Integer.parseInt(st.nextToken());
... |
b2000653-468d-48ef-ba2c-43481de0d68c | 5 | public static void createWindow(int width, int height, String title, boolean fullscreen)
{
Display.setTitle(title);
try
{
if(fullscreen)
Display.setFullscreen(true);
else
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
Keyboard.create();
Mouse.create();
}
... |
66113c76-4905-4514-b879-93966ca80379 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
9e0bdce4-c463-4044-a6ac-8dec74df7ebc | 0 | public int getAmount() {
return this.duplicates.size();
} |
14d4eec3-8d49-498c-8236-02af45e9f93f | 0 | public Transition getTransitionForProduction(Production production) {
String lhs = production.getLHS();
String rhs = production.getRHS();
Transition transition = new PDATransition(INTERMEDIATE_STATE,
INTERMEDIATE_STATE, "", lhs, rhs);
return transition;
} |
4df81d55-320b-4089-9fd8-efd31fa9d00e | 8 | public void setOptions(String[] options) throws Exception {
String tmpStr;
String[] spec;
String classname;
tmpStr = Utils.getOption('W', options);
if (tmpStr.length() > 0) {
spec = Utils.splitOptions(tmpStr);
if (spec.length == 0)
throw new IllegalArgumentException... |
fdcf4734-47ff-4112-911c-5760eb9e12eb | 3 | private boolean runCommand(String cmd) {
try {
String[] bashCmd = {
"/bin/sh",
"-c",
cmd};
Process p = Runtime.getRuntime().exec(bashCmd);
BufferedReader reader = new BufferedReader(new InputStreamReader(
p.getInputStream()));
String line = reader.readLine();
while (line != null) {
... |
5fc83334-be34-4b57-976e-77b769fac42b | 8 | public void load() {
try {
BufferedReader reader = new BufferedReader(new FileReader(path));
String line;
while ((line=reader.readLine()) != null) {
if (line.startsWith("rendermode")) optRendermode = line.split(" ")[1];
else if (line.startsWith("platform")) optPlatform = line.split(" ")[1];
else ... |
c9060e5b-b294-485f-8f9f-4c05899be423 | 1 | public void mousedown(MouseEvent ev, Coord c, int button) {
setmods(ev);
lcc = mc = c;
if (mousegrab == null)
root.mousedown(c, button);
else
mousegrab.mousedown(wdgxlate(c, mousegrab), button);
} |
eb3e1fc6-8fd6-43b1-95b8-3e667c40e1f5 | 8 | private void gameInfo()
{
// If there is draw
if (p1.getPoints() == p2.getPoints())
{
System.out.println("DRAW");
}
// If both of players FIRED UP
else if (p1.getPoints() > Game.GOAL
&& p2.getPoints() > Game.GOAL)
{
Syst... |
1bb746d0-69a9-4d78-a54e-b423d9263049 | 3 | @Override
public void actionPerformed(ActionEvent ae) {
try {
String op = ae.getActionCommand();
switch(op){
case "Salvar":
execSalvarXml();
break;
case "Cancelar":
... |
f3866a01-aaed-4aba-9ad2-0a2ba56cf8d0 | 8 | public void newTab(boolean isPublic, String name, boolean selfOpened)
{
try
{
boolean exist = false;
boolean ownName = false;
if (name.equals(cc.getMyName()))
{
cc.addPublicMessage("Error: Unable to open private chat with yourself!");
tabbedPane.setSelectedIndex(0);
ownName = true;
}
... |
44d9d4da-3315-43de-87a1-aa69d45eb6b6 | 4 | private void loadNextReader() throws InvalidCommandException {
if (!processQueue.isEmpty()) {
try {
if (reader != null)
reader.close();
} catch (IOException e) {
}
try {
logger.trace("Obtaining next reader");
... |
35a382c6-87f9-4188-8b96-0bbe46b63ef3 | 2 | public Result execute(Command command) {
Set<AccountDTO> accountDTOget = (Set<AccountDTO>) command.getCommandSource();
Set<MessageStatuss> messageStatuss = new HashSet<MessageStatuss>();
List<Account> accountId = new ArrayList<Account>();
for (Iterator<AccountDTO> it = accountDTOget.iter... |
20b7b99f-69f3-40cc-bfda-4cf68268d2ba | 3 | protected void applyActiveChanges() {
boolean changed = false;
for (int i = 0; i < changes.size(); i++) {
if (changes.get(i).isActivation()) {
changes.get(i).apply(courseModel);
changes.remove(i);
changeSelected.remove(i);
i--;
changed = true;
}
}
if (changed)
finishModification();
... |
ec34bdb2-92df-41a1-8441-302be59549b0 | 8 | private void splitOrderbys(String orderby){
if(orderby != null && orderby.length() > 0){
orderby = orderby.trim();
String[] orderbys = orderby.split(",");
for(String order : orderbys){
order = order.trim();
String[] orders = order.split(" ");
String trend = orders[orders.length - 1];
boolean ... |
63663e7d-287c-45b6-944a-2d037db26309 | 8 | public String readLine() {
try {
if (readeru != null) {
final StringBuffer rv = new StringBuffer(8192);
int temp = readeru.read();
/* remember a line can terminate with any of the following: \r, \n, or \r\n */
if (stripTheLineSeparator && temp == '\n') {
temp = readeru.read();
... |
bea23452-c91e-47b3-839a-9fa75dfe2106 | 3 | public double subirEstacion() {
if (frecuencia){
fm = fm + 0.2;
if (fm >107.9) {
fm = 89.7;
}
return fm;
} else {
am = am + 10;
if (am > 1610){
am = 530;
... |
04d51e85-c418-480b-9728-d53a81c52faf | 7 | @Override
public Concurso inserir(IEntidade entidade) throws SQLException {
if (entidade instanceof Concurso) {
Concurso concurso = (Concurso) entidade;
Connection connection = ConnectionFactory.getConnection();
String sql = " INSERT INTO concurso ( ";
sql ... |
9db59ed6-e4f5-49b6-ae26-8e1334fd698b | 9 | private No insere(No h, Chave chave, Valor valor, int ht) {
int j;
Entrada t = new Entrada(chave, valor, null);
// no externo
if (ht == 0) {
for (j = 0; j < h.numFilhos; j++) {
if (menor(chave, h.filhos[j].chave)) break;
}
}
// no... |
d5d1d44e-05c8-4089-a24a-025452f25c3a | 6 | public void run() {
Object arr[] = {this, target};
try {
// wait untill destroy after war launch
sleep(delayFromStart * War.TIME_INTERVAL);
synchronized (destructor) {
try {
for (WarEventListener l : allListeners) {
l.addedLauncherToDestroy(destructor.getDestructo... |
57569ed7-370f-437b-89e0-daaa87b30838 | 8 | @Override
public void paint(Graphics window) {
window.setColor(Color.WHITE);
window.fillRect(0, 0, 230, 370);
window.setColor(Color.BLACK);
window.drawRect(0,0,230,173);
window.drawLine(115,0,115,173);
window.drawRect(39,58,38,58); //Spot for armor
if(equipped[0]!=null){window.drawIm... |
75434b9a-3478-41eb-a145-c2885922fc00 | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
9674d4bd-0b67-4361-9f9f-93b6a8bbe99f | 5 | @Override
public double getYRotation()
{
double lowest = 9001;
double highest = 0;
int y = 0;
if (getRotationAngle() == 90)
y = 20;
if (getRotationAngle() == 270)
y = -20;
for (Block block : blockArray)
{
if (block.getYValue() > highest)
highest = block.getYValue();
if (block.getYValue()... |
7a757128-7fc1-4f69-b6f1-fa48b930f1e2 | 8 | public SpellCheckerSuggestion[] findSuggestions(String word){
boolean notSorted = true;
SpellCheckerSuggestion temp;
SpellCheckerSuggestion[] suggestions = new SpellCheckerSuggestion[10];
int index = bsCheck(word).getIndex();
// If word is at the beginning of a dictionary
... |
42835e72-c62d-433b-9ea9-c4fda3e39386 | 5 | public void tick() throws Exception
{
if(isSolid == true)
{
if(Main.Character.getBoundsBottom(Main.Frame.getWidth(), Main.Frame.getHeight()).intersects(getBounds()))
{
Main.Character.setVelY(0);
Main.Character.canMoveDown = false;
}
else if(Main.Character.getBoundsTop(Main.Frame.getWidth(),... |
f854c96a-659e-45e1-b422-27974316774e | 4 | protected final void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
final HttpSession session = request.getSession(true);
final String idString = request.getParameter("id");
if (idString == null) {
this.getServletContext().getRequestDispatch... |
57c9b367-bd23-425e-b5e8-21e3fb724437 | 9 | final public boolean imc_startup( boolean force,
String loginName,
String host,
String email,
String web,
String hub,
int port,
String passclient,
String passsrvr,
List<CMChannel> imc2Channels)
{
if( imc_active != IA... |
b6147bd4-ac0f-4f88-8dde-c9f9225e143e | 6 | private CommandResponse doPost(String jsonObject, HttpURLConnection connection, Class<?> responseType){
CommandResponse result = null;
int responseCode;
String responseMessage = "";
Map<String, List<String>> responseHeaders;
try {
connection.setRequestMethod("POST");
connection.setDoInput(true);
co... |
39756775-1f2e-4a7a-9f35-7919f98c80ff | 5 | public static <GInput, GOutput, GValue> Field<GInput, GValue> navigatedField(final Converter<? super GInput, ? extends GOutput> converter,
final Field<? super GOutput, GValue> field) throws NullPointerException {
if (converter == null) throw new NullPointerException("converter = null");
if (field == null) throw n... |
7f76ba69-e050-442a-9817-26b60783da1d | 1 | public static void main(String[] args) throws IOException {
Files.walkFileTree(Paths.get("/home/xander/"), new SimpleFileVisitor<Path>(){
public FileVisitResult visitFile(Path p, BasicFileAttributes attributes) {
if (p.getFileName().toString().equals("a.out")) {
S... |
a14063be-2cdc-4ebe-ba8d-9332503b88c6 | 0 | public void setSkill1(SkillsMain skill12) {
this.skill1 = skill12;
} |
e45fedb8-f0c7-40b8-a996-b79fd7b86f2d | 6 | private void removeRender(Member e) {
switch (e.getType().toLowerCase()) {
case "decoration":
remove(RenderLayer.DECORATION, e);
break;
case "item":
remove(RenderLayer.DECORATION, e);
break;
case "zone":
remove(RenderLayer.DECORATION, e);
break;
case "container":
remove(RenderLayer.DECORA... |
2801b571-5eb0-4d2b-a022-03242c4e89db | 9 | public static int minDistance(String word1, String word2) {
if (word1 == null || word2 == null) {
return 0;
}
int length1 = word1.length();
int length2 = word2.length();
if (length1 == 0) {
return length2;
}
if (length2 == 0) {
... |
c76bde70-2a0c-4eb6-a641-98ab655f4ca3 | 0 | public static void main(String[] args) {
SingletonClass singleton = SingletonClass.getInstance();
System.out.println(singleton);
} |
77cf5371-ab91-40d2-a789-6408003e85ff | 5 | protected void execute() {
if (m_timer == null){
if (Robot.driveTrain.getRightCurrent() < 20 && Robot.driveTrain.getLeftCurrent() < 20){
Robot.driveTrain.voltageDrive(-7, -7);
}else{
if(Timer.getFPGATimestamp()-m_startTime > 0.8){
... |
5133f759-f533-4f82-b64e-898ffb8244ab | 7 | private Entry parseText(String content, Date theDate) {
ArrayList<String> tempTopics = new ArrayList<>();
ArrayList<Scripture> tempScriptures = new ArrayList<>();
//parse the topics out of the file
for (Topic compareTopic : topicsList) {
String topic = compareTopic.g... |
5703a1e5-0a5f-4f18-8528-50a49a3fbce9 | 1 | private static boolean isComment(String row) {
return row == null || row.startsWith(COMMENT_TOKEN);
} |
193c31ff-9359-4f24-a556-a24dea90dc79 | 9 | @Override
protected double doSolve() {
double min = getMin();
double max = getMax();
// [x1, x2] is the bracketing interval in each iteration
// x3 is the midpoint of [x1, x2]
// x is the new root approximation and an endpoint of the new interval
double x1 = min;
... |
973f30a4-59a2-4311-ae16-7e313469b38d | 3 | public int size() {
if (!beforeFirst) {
throw new RuntimeException("next already called; to get remaining item count use itemsLeft");
}
if ((candidates == null) || (candidates.isEmpty())) {
return 0;
}
return candidates.size();
} |
c5111924-bf41-47a9-92ac-7d6e4ad7223f | 0 | public void setaddress(String address)
{
this.address = address;
} |
ae8e8ded-7650-46da-927b-689647193964 | 0 | public void setFileFilterExclude(String fileFilterExclude) {
this.fileFilterExclude = fileFilterExclude;
} |
585d7539-3f0d-4fe0-919b-e7cfdb5c9347 | 3 | private void handleCommand(String command) {
if (command.equals("end")) {
close(false);
} else if (command.equals("restart")) {
close(true);
} else if (command.startsWith("ban")) {
bot.getRoom().Users.banUser(command.substring(4), "Banned");
bot.bootUser(bot.getRoom().Users
.getByName(com... |
0a2a27de-19e5-47d8-bbb8-6532c4b38e51 | 5 | public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Invalid input file.");
}
LinkedList<String> input = new LinkedList<String>();
int numResults = Integer.parseInt(inputScanne... |
63f22638-3b2e-44cd-b62e-908f2e18fe12 | 1 | private void disableCheckBoxMenuItems(JCheckBoxMenuItem... items) {
for (JCheckBoxMenuItem checkBoxMenuItem : items) {
checkBoxMenuItem.setState(false);
}
} |
b0deab34-eca0-4cbe-b85a-d1b9234ef789 | 3 | public Pair<Livraison, PlageHoraire> rechercheLivraisonParNoeud(Noeud noeudAdr){
if(this.testItineraireCharger()){
for(PlageHoraire ph : this.plagesHoraire){
Livraison liv = ph.rechercheLivraison(noeudAdr);
if(liv != null){
return new Pair<Livraison, PlageHoraire>(liv, ph);
}
}
}
return nul... |
03c85eba-4020-4b97-875e-a3c830bf7a2a | 3 | public void init(LinesGame linesGame) {
_linesGame = linesGame;
_random = new Random();
initSettings();
_lineDirections = new ArrayList<Point>();
_lineDirections.add(new Point(1, 0));
_lineDirections.add(new Point(0, 1));
_lineDirections.add(new Point(1, 1));
_lineDirections.add(new Point(1, -1));... |
f9c940c3-4cc4-4bab-86a0-7783f4473f20 | 0 | public AbstractHash(final int num) { this.num = num; } |
0e09fc4c-5109-4797-bb75-7f0daaf0f339 | 1 | public void init()
{
//Sprites
SpriteLoader loader = new SpriteLoader();
BufferedImage spriteGrid = loader.load("/sprite.png");
BufferedImage damageGrid = loader.load("/damage.png");
BufferedImage cursorGrid = loader.load("/cursor.png");
BufferedImage tileG... |
99e0ec7e-8439-4bf6-9016-b3b50e933eda | 9 | public static void main(String[] args) {
int n = 1000; // number of nodes per graph
int f1 = 2; // number of features for the first graph
int f2 = 3; // numer of features for the se... |
5dd26c46-9353-466d-8b3f-1076b2260b01 | 2 | public static void repaintGrid() {
if (game != null) {
game.gameGrid.repaintGrid();
game.holdGrid.repaintGrid();
for (int i = 0; i < QUEUE_SIZE; ++i) {
game.inQueueGrid[i].repaintGrid();
}
}
MainFrame.getThis().repaint();
MainFrame.getThis().revalidate();
} |
59664e8d-78fb-403e-b8f1-f4fa7166d8fd | 3 | public String readFile() {
if (!file.exists()) {
JOptionPane.showMessageDialog(responsibleWindow, "Savefile: " + file.getName() + " did not exist.");
return "";
}
String fileContent = "";
try {
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
fileContent += scanner.nextLin... |
0847bf48-2a70-42fc-abe0-979e4e2adbe7 | 3 | public static void main(String[] args)
{
HashMap map = new HashMap();
for (int i = 0; i < args.length; i++)
{
if ( map.get(args[i]) == null)
{
map.put(args[i],new Integer(1));
}
else{
int int1 = ((Integer)map.get(args[i])).intValue();
int1 = int1 + 1;
map.put(args[i], n... |
0ca750b2-c5f8-4934-b9a3-db94e2e0c119 | 4 | @Override
public void update(float dt) {
if (heroOnPlatform) {
if (wordMatchFound) {
currentState = PlatformState.OK;
} else {
currentState = PlatformState.WRONG;
}
heroOnPlatform = false;
wordMatchFound = false;
} else
// System.out.println(currentState);
if (currentState != PlatformStat... |
e821f0f1-a6b3-4a3e-bed3-6506ea694552 | 0 | public RegistrationServlet() {
super();
// TODO Auto-generated constructor stub
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.