method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cbb4145e-c497-48dc-850a-8e981662b8f0 | 0 | public void setOrgName(String orgName) {
this.orgName = orgName;
} |
6b19bebb-79c6-4bbd-8b72-f37c8de68a70 | 1 | private void setDefaultSelect(String player, AbstractButton button) {
if (controller.getClientName().equals(player)) {
button.setSelected(true);
votedOutPlayer = controller.getClientName();
}
} |
605df4de-e970-42e5-b733-0899df42c3cd | 9 | protected AbstractParserFactory makeParserFactory() throws MaltChainedException {
Class<?> clazz = (Class<?>)manager.getOptionValue("singlemalt", "parsing_algorithm");
try {
Class<?>[] params = new Class<?>[1];
params[0] = org.maltparser.parser.Algorithm.class;
Object[] arguments = new Object[params.lengt... |
57873954-86c9-41f0-ba48-30b1b8f626cc | 0 | public void setRealName(String realname){ this.RealName = realname; } |
b8d5543d-aa70-4d0c-8e7d-066289070607 | 8 | public final void run() {
anInt2710++;
for (;;) {
int i;
synchronized (this) {
for (;;) {
if (anIOException2704 != null)
return;
if ((anInt2713 ^ 0xffffffff) > (anInt2705 ^ 0xffffffff))
i = -anInt2705 + bufferSize - -anInt2713;
else
i = anInt2713 - anInt2705;
if ((i ^ 0xff... |
bbf45989-4c04-494a-8030-215f2413e4b7 | 5 | public void ajutarTabla() {
table_ticket.setDefaultRenderer(Object.class, new TableCellRenderer() {
private final DefaultTableCellRenderer DEFAULT_RENDERER = new DefaultTableCellRenderer();
@Override
public Component getTableCellRendererComponent(JTable table, Object value, ... |
19a977ae-3b3e-47d4-931a-b3951e735656 | 4 | public void newwidget(int id, String type, Coord c, int parent,
Object... args) throws InterruptedException {
WidgetFactory f;
if (type.indexOf('/') >= 0) {
int ver = -1, p;
if ((p = type.indexOf(':')) > 0) {
ver = Integer.parseInt(type.substring(p + 1));
type = type.substring(0, p);
}
Resour... |
16a6f458-80ea-42e4-b364-43004e19dc51 | 8 | public static String encode(String value) {
String encoded = null;
try {
encoded = URLEncoder.encode(value, "UTF-8");
} catch (UnsupportedEncodingException ignore) {
}
StringBuffer buf = new StringBuffer(encoded.length());
char focus;
for (int i = 0; i... |
58bf9e28-69f9-4d5a-b611-b824a1c651c7 | 7 | public void validateModule() {
if (name == null) {
throw new KurentoModuleCreatorException("Name is mandatory at least in one of the files");
}
if (kurentoVersion == null) {
if (AUTO_IMPORTED_MODULES.contains(name)) {
kurentoVersion = version;
} else {
throw new KurentoMo... |
65b9cb39-3893-451c-998a-397d09e88b87 | 5 | public void handleReload(Player[] players) {
for (Player p : players) {
xAuthPlayer xp = getPlayer(p.getName());
boolean mustLogin = false;
if (xp.isRegistered()) {
if (!checkSession(xp)) {
mustLogin = true;
plugin.getAuthClass(xp).offline(p.getName());
} else {
xp.setStatus(Status.Au... |
add36c3f-662e-48ba-abd8-b2310dcdcf21 | 6 | private String removeExtraSpaces(String str){
int i,j;
StringBuilder sb = new StringBuilder(str);
for(i = 0; i < sb.length(); i++){
if(Character.isSpaceChar(sb.charAt(i))){
j = i + 1;
while(j < sb.length() && Character.isSpaceChar(sb.charAt(j)))... |
e51ca646-a0f1-482a-b7e7-85cd12668ec2 | 5 | private void setLastDirectionWrong() {
String oppositeDirection;
switch(knowledge.get(knowledge.size()-1).getValue("direction")) {
case "forward":
oppositeDirection = "backward";
break;
case "backward":
oppositeDirection = "forward";
break;
case "stay":
oppositeDirection = "forward";
... |
48845ab7-cfd5-4481-8f5d-3b809b3eb998 | 4 | private void delete(File file) throws IOException {
if (file.isDirectory()) {
// directory is empty, then delete it
if (file.list().length == 0) {
file.delete();
System.out.println("Directory is deleted : "
+ file.getAbsolutePath());
} else {
// list all the directory contents
Stri... |
2bd3d1d8-5819-49ff-856b-7fe878fe663e | 2 | public static SongLogger getInstance()
throws LogException {
if(SongLogger.log == null) {
synchronized (SongLogger.class) {
if(SongLogger.log == null) {
SongLogger.instance= new SongLogger();
}
}
}
return SongLogger.instance;
} |
73bd8aa4-7784-4b1d-8ecf-b1b6d6221acb | 4 | @Override
public void use(Mob source, World world) {
int dir = source.dir;
Vector2i pos = Vector2d.toVector2i(source.getPos());
//TODO: fix this shit.
if (dir == Mob.dirUp) {
world.getTile(pos.getX() >> 4, (pos.getY() >> 4) - 1).getHurt(source, source.getStats().getDamag... |
7527331a-bf62-475e-a5d0-6a77bbe2a76e | 2 | private void BTNdemitirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BTNdemitirActionPerformed
int CodFuncionario = Integer.parseInt(this.CodFuncionario);
Usuario usuario = new Usuario();
UsuarioBO usuarioBO = new UsuarioBO();
try {
usuarioBO.demitirFu... |
9d9bb64d-9f23-4474-a266-65fa7772dd16 | 5 | public static void init() {
cards = new Deck<GreenCard>();
File f = new File(GREEN_CARD_FILE);
FileReader r;
BufferedReader reader;
try {
r = new FileReader(f);
reader = new BufferedReader(r);
while (true) {
String line = reader.readLine();
if (line == null || line.equals("")) {
break;
... |
15b0d744-2f21-4d5c-9d73-b363a72b9d30 | 6 | public boolean readPrefs()
{
boolean Result = false;
try {
FileInputStream fstream = new FileInputStream("peppref.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String currentLine;
String[] iddpair;
while (... |
14971d8a-0a7b-4a4c-8f4a-17e51ad880b7 | 3 | private void goRoom(Command command)
{
if(!command.hasSecondWord()) {
// if there is no second word, we don't know where to go...
System.out.println("Go where?");
return;
}
Room.Direction dir = Room.Direction.parse(command.getSecondWord());
... |
93873b75-e228-4cbd-bd34-b25f2f515358 | 0 | @Basic
@Column(name = "item_unit_price")
public double getItemUnitPrice() {
return itemUnitPrice;
} |
9a1a6515-b7d6-4b70-ba6e-4a07ed02a1f7 | 8 | public static void main(String[] args) throws IOException {
final Socket socket = new Socket(Config.HOST, Config.PORT);
final ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
final ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
final Bloc... |
fdc42b79-55fc-43ee-a2a2-540a6fb662f6 | 8 | public void loadRepositoryFromGraphXML(String graphXML) {
//System.out.println(graphXML);
try {
Document document = builder.parse(new InputSource(new StringReader(graphXML)));
// GraphData
NodeList graphroots = document.getElementsByTagName("GraphData");
... |
c4f75b1f-e024-4e1b-a864-12fa1f3f2313 | 3 | private Node indentTreeParser(String[] lines)
{
//By default, let's make tab as four spaces
String tabTemplate = " ";
Node last = null;
for(String line : lines)
{
line.replaceAll("\t",tabTemplate);
line.replace('(',' ');
line.replace(')... |
dd77b025-066e-4fac-a9d3-8e0cdc07fecb | 0 | public int getLengthDesert() {
return lengthDesert;
} |
b50e0645-b7ee-48de-8591-475c23108223 | 5 | public void mousePressed(MouseEvent me) {
//((ChartEntry)chart.entryList.get(idx)).setShowFlag(true);
if (idx != -1) {
// chart.showDomainVals(idx);
}
//System.out.println("IDX___________ " + idx);
chart.updateAll();
if (SwingUtilit... |
e47e47c2-0199-4a86-aa48-beae7182f2cd | 6 | private void checkDoorTiles(){
ArrayList<Map> maps = engine.getWorld().getMaps();
Map currentMap = engine.getWorld().getCurrentMap();
for(Tile tile : currentMap.getDoorTiles()){
// Cast tile to doorTile
DoorTile d1 = (DoorTile)tile;
if(engine.getPlayer().getBounds().intersects(d1.getBounds()) ... |
5151a0e5-3cf0-4c7e-b012-e601f7bd8e36 | 8 | public void openGoal(){
/* I.S. G dalam keadaan tertutup.
* F.S. Mengecek apakah pemain berhasil meletakkan PathCard di sebelah GoalCard yang berisi RockCard pada Board B.
* Jika berhasil, maka G dalam keadaan terbuka.
* Jika tidak, maka G tetap dalam keadaan tertutup. */
boolean[][] check... |
28b6914d-498e-4538-ac11-6424d6027ecd | 0 | public void setSequence(int value) {
this._sequence = value;
} |
e58c8dde-fd03-41f9-933f-67b5e25d4a9d | 4 | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Class getColumnClass(int col)
{
switch (col)
{
case 0:
return Boolean.class;
case 1:
return String.class;
case 2:
case 3:
return Double.class;
}
return null;
} |
591a0603-c26a-41e0-8442-4b1af3437ab7 | 1 | private void firePeerChoked() {
for (PeerActivityListener listener : this.listeners) {
listener.handlePeerChoked(this);
}
} |
71a532c3-3d4d-43c8-bc68-b382e1216040 | 8 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof KeyedObjects)) {
return false;
}
KeyedObjects that = (KeyedObjects) obj;
int count = getItemCount();
if (count != that.getItemCount())... |
0ad07e18-27e7-4ae2-8658-09ee39856cb3 | 1 | public boolean isEmpty() {
if (size() == 0) {
return true;
}
return false;
} |
f0eadc4b-7a93-4041-abce-7c127fb87bb5 | 6 | public static ListaPaquete buscarPaquetesPorStatus(String status)
{
Document doc;
String statusPaquete;
Long identificador;
String ipOrigen, ipDestino;
Date fechaEnvio, fechaLlegada = null;
Element root,child;
... |
eddc9541-b84e-4f63-9ce6-919bf30bda13 | 6 | private final void mergeVectors() throws IOException {
TermVectorsWriter termVectorsWriter =
new TermVectorsWriter(directory, segment, fieldInfos);
try {
int idx = 0;
for (final IndexReader reader : readers) {
final SegmentReader matchingSegmentReader = matchingSegmentReaders[idx++];... |
d1c87ad6-eebc-419c-a3b3-236ca12857de | 9 | private void stopTag()
{
String tag = this.p.getLastTag();
if (0 == "page".compareTo(tag))
{
if (true == this.foundTitle)
{
try {
this.outXmlFd.write("\n </page>");
this.outTxtFd.write("\n");
} ... |
6434a873-f594-4adc-a384-5f67ba0fb8e8 | 2 | public ArrayList<String> traerListado(int codEdif){
conn = Conector.conectorBd();
String sql = "select distinct d.n_dpto as numeroDepto, l.pago as monto, l.fecha from lavanderia l, departamento d, edificio e where l.coddepto=d.id_dpto and d.codedi=e.cod_ed and e.cod_ed\n" +
"="+codEdif+"";
... |
492e7f50-9aec-4108-8085-9dc6fea37e1f | 1 | private void initFontshadowMenu(Color bg) {
this.fontshadowPanel = new JPanel();
this.fontshadowPanel.setBackground(bg);
this.fontshadowPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
this.fontshadowPanel.add(new Numberfield(this.skin.getShadowIntensity(), 3, bg, strFontsha... |
d20c8cd5-d986-4964-86dc-468e3607d88c | 7 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Player other = (Player) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(... |
6039ed35-5def-42c3-a1c5-87848bb60862 | 5 | public static String say(int x) {
if (x > 99 || x < 0) {
return "value out of bounds";
}
final Map<Integer, String> ones = new HashMap<Integer, String>();
final Map<Integer, String> tens = new HashMap<Integer, String>();
final Map<Integer, String> specials = new HashMap<Integer, String>();
ones.put(0, ... |
bdbac07a-07a6-4b46-aad3-276d88eb07c9 | 2 | @Override
public boolean equals(Object obj) {
String objString = null;
String ourString = null;
// if obj is not effectively one of us ...
if (! this.getClass().isInstance(obj)) {
throw new ClassCastException ();
}
// get the strings
objString = ((StrungDocumentInfo)obj).getString();
ourString... |
eb18b306-2a83-487b-b097-8403ea7fe5b8 | 8 | public HttpHandler findHandler(Class handlerClass,
String uri,
String[] vhosts)
{
uri = URI.stripPath(uri);
if (vhosts==null || vhosts.length==0)
vhosts=__noVirtualHost;
for (int h=0; h<vhosts.length ... |
5a946e52-dd60-4a41-90bf-24560fb0be28 | 4 | @Test
public void testSetQueueTimeoutDisconnectIndividual() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSetQueueTimeoutDisconnectIndividual -----");
String client_hash = "";
String client_hash2 = "";
try {
server2.setUseMessageQueues(true);
} catch (TimeoutE... |
fac1edaa-9a9a-4bf0-9f50-5d7adeb45b56 | 3 | private void parse_authType( String line,
String keyword,
String[] split,
int lineNumber,
boolean strictMode )
throws ParseException {
// Line has the format:
// "AuthType" <Type>
if( split.length != 2 ) {
throw new ParseException( "Invalid '"+keyword+"' declaration at line " + lineNumbe... |
851ce8e5-699b-449c-9873-af5ab1fe251c | 0 | public void addAll(IntArrayBag addend)
{
ensureCapacity(manyItems + addend.manyItems);
System.arraycopy(addend.data, 0, data, manyItems, addend.manyItems);
manyItems += addend.manyItems;
} |
e959fb6b-d50f-4347-940b-86ba3c00e66e | 5 | public static int findWordStart(String line, int pos, String noWordSep)
{
char ch = line.charAt(pos - 1);
if(noWordSep == null)
noWordSep = "";
boolean selectNoLetter = (!Character.isLetterOrDigit(ch)
&& noWordSep.indexOf(ch) == -1);
int wordStart = 0;
for(int i = pos - 1; i >= 0; i--)
{
ch = li... |
b50479d3-2592-401b-a053-e49f5472195f | 7 | private ArrayList<SensorMsg> linearInterpolation(SensorMsg start, SensorMsg end) {
ArrayList<SensorMsg> data = new ArrayList<>();
int start_num = start.getNumber();
int start_temp = start.getTemperature();
int start_light = start.getLight();
long start_date = start.getTime();
int end_num = end.getNumb... |
35e33097-6d01-4294-b22f-8760a8d9b5d8 | 5 | public void createLoot(){
int randomNumber = (int) (Math.random()*100);
if(randomNumber < 30){
Inventory.add(Item.get(ItemObject.smallManaPotion), loot);
}
if(randomNumber >=30 && randomNumber < 60){
for(int i = 0; i <= (int) (Math.random()*3); i++){
Inventory.add(Item.get(ItemObject.smallHealth... |
d40aae35-3724-4414-a87d-ab6f036de77d | 8 | public void moveRandom(JLabel[] player2) {
// makes the "AI" move in a random direction
try {
Thread.sleep(200);
} catch (InterruptedException ie) {
}
int numOfMoves = (int) (Math.random() * 13 + 1); // Can move up to 13
// places
if (Math.random() < 0.5)
for (int x = 0; x < numOfMove... |
3632cea5-82d7-4be9-a586-310040ec9056 | 3 | @Override
public Plugin loadPlugin(File file) throws InvalidPluginException, UnknownDependencyException {
Validate.notNull(file, "File cannot be null");
if (!file.exists()) {
throw new InvalidPluginException(new FileNotFoundException(file.getPath() + " does not exist"));
... |
836125ad-d247-4d5e-9cfc-d40a9be02ed0 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new ja... |
c9d093cb-2dbf-49a5-9e5f-c5ca7be04ff8 | 0 | public String getHexInfoHash() {
return this.hex_info_hash;
} |
b0c26356-2f4b-46a6-be38-88d14899c83a | 5 | public void render(Screen screen) {
int xOffset = 5;
int yOffset = 312;
if (open) {
Font.defaultFont().draw(screen, currentMessage + "-", xOffset, yOffset);
for (int i = 0; i < messages.size(); i++) {
Font.defaultFont().draw(screen, messages.get(i), xOffset, (yOffset -= 8));
}
} else {
for (int ... |
dd63ae8e-59e2-4b04-9998-375972fd91ee | 6 | @Override
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
// draw background
g.drawImage(backgroundImage, 0, 0, (float) gc.getWidth(), (float) gc.getHeight(), 0, 0, backgroundImage.getWidth(),
backgroundImage.getHeight());
// draw selection
g.setColor(SELEC_COL... |
19915eee-04da-4cfe-b6b4-279f583e99a2 | 4 | @Override
public T dequeue() {
if(isEmpty())
throw new NoSuchElementException("Queue Underflow: Queue is empty");
T value = elements[front];
elements[front] = null;
count--;
front++;
if(front == elements.length)
front = 0;
if(count > 0 ... |
73bde720-5d26-4a1a-be5c-d614b9789f93 | 6 | public void setCommandButtonVisibility(CommandButton btn, boolean visible) {
if (btn == null) {
throw new IllegalArgumentException();
}
switch (btn) {
case SWITCH:
this.buttonComSwitchVisible = visible;
break;
case LOCK:
... |
50a8ae6c-adc3-4399-83c5-5f122b99c428 | 7 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
8aab59e2-2e87-4071-b656-5643f0be4e51 | 7 | public static Method getMostSpecificMethod(Method method, Class<?> targetClass) {
Method specificMethod = null;
if (method != null && isOverridable(method, targetClass) &&
targetClass != null && !targetClass.equals(method.getDeclaringClass())) {
try {
specificMethod = ReflectionUtils.findMethod(targetCla... |
52b41d7a-b030-4598-8ebb-61c7425ade32 | 2 | public DebugWindow(){
win=Boolean.valueOf(GosLink.prps("window"));
if (win==true){
String imagePath = "smokin.png";
InputStream imgStream = DebugWindow.class.getResourceAsStream(imagePath);
try{BufferedImage myImg = ImageIO.read(imgStream);
setIconImage(myImg);
}catch (Exception e){e.printStackTrace(... |
03d98ff1-9f2b-4578-b8b4-cb8b614fe45a | 2 | private int sendAnAttempt(String gameid, Answer lastAnswer) {
Combination<Colors> combi = generateCombination(lastAnswer);
System.out.println("Je tente " + combi.toString());
Answer answer = getAnswer(gameid, combi);
if (!answer.target_found) {
if (answer.more_attempts) {
return sendAnAtt... |
80cf82b8-4228-4b34-abb6-e2b5d8a877c6 | 2 | public void run() {
for (int i = 0; i < 5; i++) {
// yields control to another thread every 5 iterations
if ((i % 5) == 0) {
System.out.println(Thread.currentThread().getName() + "yielding control...");
/* causes the currently executing thread object to t... |
5b5cf8d4-dd8e-4bac-9e54-193cd116bc57 | 8 | public void validaCampos(JComboBox usuario, String dataAgendamento, JComboBox cliente, String solicitante, JComboBox tipoAtendimento,
JComboBox origem, JComboBox prioridade, String problemaInformado) {
if (usuario.getSelectedItem() == null) {
JOptionPane.showMessageDialog(null, "Usuário ... |
7863bf0f-bbd1-4d6a-9d46-c5256a7985fb | 1 | public HTTPServer() throws Exception
{
sock = new ServerSocket();
sock.bind(null);
if (!sock.isBound())
throw new Exception("Invalid HTTP server port");
port = sock.getLocalPort();
} |
1aef1b0c-ba56-4d75-b833-3d7075627e29 | 9 | public static Constructor<?> findHandleArgsConstructor(Class<?> c)
{
for (Constructor<?> con : c.getDeclaredConstructors())
{
if (con.getParameterTypes().length == 0)
continue;
boolean match = true;
for (Class<?> paramClass : con.getParameterTypes())
if (!HGHandle.... |
ab0c647c-fb9b-4002-abb6-52c8f2cf214a | 8 | private void tymeacLoops () {
/*
* Tymeac server setup. we're not timing the Tymeac setup-time here.
*/
// passed args when starting server
String[] in = {"-threads", // use threads override (default currently 4)
"" + parallelism, // this many threads
"-no", /... |
7c207077-34bb-4afd-8c6a-e1cc5a3112b6 | 7 | public boolean addTag(String name, String appId, String userId)
{
//Tag validation and parameters checking
if(!validateTag(name))
return false;
if(appId == null || appId.equals(""))
return false;
if(userId == null || userId.equals(""))
return false;
try
{
String query = "SELECT ID F... |
5369e426-4c4a-4489-aae3-dfc48e842792 | 0 | public void setStartTime (String sT)
{
startTime = sT;
} |
d13b3086-0f3f-4f0e-a65e-397b75d8d8ed | 0 | public Spieler getAktuellerSpieler() {
return this.aktuellerSpieler;
} |
0b2b72c1-b2f3-44c5-842b-681901839e90 | 0 | public void setEnergy(int energy) {
this.energy = energy;
} |
eebf99d1-63c4-4856-937b-982761507245 | 3 | public void sortArray() {
this.arrayAccess = 0;
this.comparisions = 0;
int arrLength = this.array.length;
/**
* Pass the array times it's length.
*/
for (int i = 0; i < arrLength; i++) {
/**
* Pass the array from the "i"th position to... |
a6923a52-f4cc-43a9-8e2c-72ed68a8b030 | 1 | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
RegisterForm rf = (RegisterForm) form;
String name = rf.getUserName();
String pass1 = rf.getPassword1();
String pass2 = rf.getPassword2();
if(pass1.equals(pass2))
{
return ... |
2637f017-a09a-4598-9aa2-ad8559417b5c | 8 | public boolean isAnimal(Entity e){
if(e instanceof Cow || e instanceof Chicken || e instanceof Sheep || e instanceof Horse
|| e instanceof Wolf || e instanceof Ocelot ||e instanceof Pig || e instanceof Mushroom){
return true;
}else{
return false;
}
} |
d8bf5042-8ae8-4716-b446-4f8925602cef | 9 | @Override
protected void animateFrontLED() {
if (frontCurrent == frontTarget) {
frontTarget = random.nextInt(11);
frontDirection = frontCurrent < frontTarget;
}
int rearLeftInd = (10 - frontCurrent) * 3;
int rearRightInd = (11 + frontCurrent) * 3;
fr... |
40eac172-32ae-4675-91ae-f8eebc5d1152 | 1 | public Arvollinen lueLuku()
throws IllegalStateException, IllegalArgumentException {
int aloituspaikka = paikka;
if (!lukeminenVoidaanAloittaa()) {
throw new IllegalStateException();
}
siirryLuvunLoppuun();
Arvollinen l... |
4bd72229-0313-4d91-82de-59ab58b55dd4 | 4 | public boolean hasEmptySpaceFor(ItemStack item) {
for (ItemStack is : i.getContents()) {
// empty space
if (is == null)
return true;
// partial empty
if (is.isSimilar(item) && is.getAmount() < is.getMaxStackSize())
return true;
}
return false;
} |
dcdfd454-1458-47a0-8857-2de3a2b53f0d | 5 | public ArrayList<String> split(String string){
String[] array;
array = string.replaceAll("\\+", " + ").replaceAll("\\-", " - ")
.replaceAll("\\*", " * ").replaceAll("\\/", " / ")
.replaceAll("\\(", " ( ").replaceAll("\\)", " ) ")
.replaceAll(" ", " ").trim().split(" ");
ArrayList<String> string... |
0385b8c2-d26b-408b-923f-de68447e11a7 | 5 | public int maxProfit(int[] prices) {
int n = prices.length;
if (n ==0){
return 0;
}
int []result = new int[n];
int min = prices[0];
result[0] = 0;
for (int i=1;i<n;i++){
if (prices[i] >= min){
result[i] = prices[i] - min;
... |
1f5ffc12-991c-4bf1-af4b-76881d167fb0 | 7 | public void analizadorSintactico() {
// System.out.println("!! Entro a analizadorSintactico");
generaLista();
tok = this.lista.iterator();
errores = new <String>ArrayList();
aux=(Tokens2)tok.next();
if(!aux.getTipo().equals(Nodo.tipoToken.EOF)){
if (aux.getToke... |
0c085a3b-3394-4768-a775-651c2dc4797a | 3 | @Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(HelloWorld.class);
classes.add(MeetingResource.class);
classes.add(VoteResource.class);
return classes;
} |
84c064d1-3dc5-4b4c-a9cf-b69d4257558c | 8 | void restore() throws ScriptException {
if (statementLength > 1) {
String saveName = parameterAsString(2);
switch (statement[1].tok) {
case Token.orientation:
float timeSeconds = (statementLength > 3 ? floatParameter(3) : 0);
viewer.restoreOrientation(saveName, timeSeconds);
return;
case Token... |
f0b5acc9-0704-4ef0-8b06-7a152970af97 | 5 | public boolean hasPlayer(String player) {
String query = "SELECT * FROM nosecandy WHERE playername='" + player + "';";
ResultSet result = null;
result = this.sqlite.query(query);
try {
if (result != null && result.next()) {
String name = result.getString("playername");
if (name.equals(player)) {
... |
c3c32494-631f-4cbb-9f31-9534110d261d | 0 | @BeforeMethod
public void setUpMethod() throws Exception {
} |
e92de7ab-b04e-4f3b-bd3c-58619535f967 | 8 | public void update(LineEvent event) {
if (Debug.DEBUG) {
if (event.getType().equals(LineEvent.Type.STOP)) {
Debug.println("Record: Stop");
} else if (event.getType().equals(LineEvent.Type.START)) {
Debug.println("Record: Start");
} else if (event.getType().equals(LineEvent.Type.OPEN)) {
Debug.pri... |
99efd178-aa22-4cb5-986f-072b6ce4108d | 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... |
8021779c-0608-4209-a045-d0772bc0c925 | 8 | public static void main(String[] args) {
initCommandLine();
CommandLine.parse(args);
if (CommandLine.hasOption("-silence"))
UI.setVerboseLevel(UI.VerboseLevel.SILENCE);
if (CommandLine.getOperatorName() == null) {
if (CommandLine.hasOption("-v"))
printVersion();
} else if (CommandLine.getOpera... |
b2863e1e-f102-4d4f-9911-7478d07739b1 | 6 | @Override
protected void heapHeapify(int nodeIndex) {
int leftIndex = getLeftChildIndex(nodeIndex);
int rightIndex = getRightChildIndex(nodeIndex);
if (rightIndex >= capacity) {
return;
}
/*
To compare nodes with their natural ordering cast them into ... |
46c39449-bfed-4a56-b2b7-8271675f2ea9 | 2 | public static double[][] clone( double[][] mat )
{
int m = mat.length;
int n = mat[0].length;
double[][] res = new double[m][];
for ( int i = 0; i < m; ++i )
{
res[i] = new double[n];
for ( int j = 0; j < n; ++j )
res[i][j] = mat[i][j];
}
return(res);
} |
16f6db69-5cbb-45d1-9379-95f9faa0e9ee | 9 | public void sprintChecks(){
if(HUD.sprint == 2){
//if not moving but pressing sprint refill stamina
if(xDirection == 0 && yDirection == 0){
if(HUD.sprintTime < 500){
//while the sprint time is less than 500 add one
HUD.sprintTime += 1;
}else if(HUD.sprintTime > 500){
... |
31b6f862-751f-4af7-82f4-425374409d17 | 1 | public void draw(Graphics2D g) {
g.setColor(color1);
g.fillOval((int) (x - r), (int) (y - r), 2 * r, 2 * r);
if (GamePanel.player.getGunType() == 4) {
g.setColor(color2);
g.fillOval((int) (x - r), (int) (y - r), 2 * r, 2 * r);
g.setColor(color2.darker());
g.drawOval((int) (x - r), (int) (y - r), 2 * ... |
d3f4d9d9-6aa7-48eb-a6a2-6c78c74cd88d | 6 | @Override
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src == MainFrame.this.mntmDashboard) MainFrame.this
.navigateTo(MainFrame.this.getDashboardPanel());
else if (src == MainFrame.this.mntmProducts) MainFrame.this
.navigateTo(MainFrame.this.getProductsPanel());
... |
ad83dcf8-6e54-467c-934e-798b4e0e85cc | 1 | public void createDirectory(String path) {
File file = new File(path);
if(!file.exists()) {
file.mkdirs();
}
} |
1bca7268-6199-4e75-88e5-387d74318715 | 2 | public void updateStockInfo() {
int usedStocks = 0;
for (StorageUnit su : stock.getStorageUnits()) {
if (su.getTrays().size() > 0) {
usedStocks++;
}
}
int percent = 100 - (usedStocks * 100 / Math
.max(1, stock.getCapacity()));
String stockInfo = "Name: " + stock.getName() + "<br>";
stockInfo... |
2fbc76e2-5527-4299-9d83-82a573854fbf | 4 | public void loadMasterPartsList(String directory, String fileName) throws IOException{
String[] partNames = new String[1];
String[] temp;
FileReader fr = new FileReader(directory+fileName);
BufferedReader br = new BufferedReader(fr);
//init based on number of parts in file
int numOfParts = Integer.parse... |
5aad1473-b455-47f4-9416-56c775d8244b | 3 | @Override
public void update(Sondage obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("update Sondage set question=?, choixa=?, choixb=?, choixc=? where id=? ;");
pst.setString(1, obj.getQuestion());
pst.setString(2, obj.getChoixA()... |
b1b9d2cb-eb71-47b1-80c3-6f4d1a53ea04 | 3 | private Player spawnBoss() {
int count = players.size();
if (count <= 5) {
bossclass = gethclass("1");
bosslevel = 1;
} else if (count <= 10) {
bossclass = gethclass("2");
bosslevel = 2;
} else if (count <= 15) {
bossclass = gethclass("3");
bosslevel = 3;
} else {
bossclass = gethclass("4... |
dd6b4672-1a60-48d6-8516-be5b45d74d04 | 6 | public void fireSessionDestroyed(IoSession session) {
SocketAddress serviceAddress = session.getServiceAddress();
boolean lastSession = false;
synchronized (managedSessions) {
// Get the session set.
Set<IoSession> sessions = managedSessions.get(serviceAddress);
... |
433124b7-a230-4aec-a15f-131ebd7bd20c | 8 | @Override
public void simpleUpdate(float tpf) {
Vector3f camDir = cam.getDirection().clone().multLocal(2f);
Vector3f camLeft = cam.getLeft().clone().multLocal(2f);
camDir.y = 0f;
camLeft.y = 0f;
walkDirection.set(0, 0, 0);
if (izquierda) {
walkDirection.... |
aae83cf3-0481-4157-8b44-850290a709d1 | 9 | private static Stalk_Color_Above_Ring loadStalkColorAbove(String stalk_color_above)
{
if(stalk_color_above.equals("n"))
{
return Stalk_Color_Above_Ring.brown;
}
else if(stalk_color_above.equals("b"))
{
return Stalk_Color_Above_Ring.buff;
}
else if(stalk_color_above.equals("c"))
{
return Stalk... |
e704587c-569e-479f-b0a6-5d6575ea1b4f | 3 | @Override
public void mousePressed(MouseEvent e) {
mx = e.getX();
my = e.getY();
if(e.getButton() == MouseEvent.BUTTON1) { // Left button pressed
if(!main.hasAbilitySelected()) {
isButtonPressed = true;
selectStartX = mx;
selectStartY = my;
setBackground(Color.gray);
}
} else if(e.getButt... |
16003767-2519-4c92-aacf-f963f53ac5f4 | 0 | public int getPoints() {
return points;
} |
053acaf0-5f1f-4f72-86e9-0d992bc4a023 | 0 | public String getProvincia() {
return provincia;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.