method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e1f34b9d-ea8f-4fc1-b0a0-6c8d57c4689c | 9 | public static void addScore(int difficulty, String name, long time) {
String[] names;
long[] times;
switch (difficulty) {
case Grid.DIFFICULTY_EASY:
names = instance.easyName;
times = instance.easyTime;
break;
case Grid.DIFF... |
2fc6abef-4c15-43a4-8822-9e80e5fcef48 | 8 | @Override
public void run()
{
RUBTConstants.main_log.info("Starting RUBTClient UserInput Listener");
System.out.println("Welcome to RUBTClient");
System.out.println("Terminate program by typing quit");
System.out.println("To get current status, type status.");
while (this.keepRunning) {
//sleep when read... |
034b6fc5-a1ab-45f1-9f80-21b421110578 | 4 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if ("vertex".equals(qName)) {
vertexFrom++;
vertexTo = -1;
currentCost = -1;
}
if ("edge".equals(qName) && vertexTo >= 0 && curre... |
b899947e-3eda-4948-8dd9-61907821d6f5 | 5 | private void paintMap(final Graphics2D g2) {
// For the scrolling we need to draw an additional row on the top of the window.
int k = 0;
if (mainGame.getLevel().getTopIndex() > 0)
k = 1;
for (int i = mainGame.getLevel().getTopIndex() - k; i <= mainGame
.getLevel().getBottomIndex(); i++) {... |
ed2be2b5-a86c-47bf-b1f2-1649c508d16f | 9 | @Override
public void run()
{
try
{
List< String > modulesToLoad = ModulAnalyzer.getActualItemsForConsole(this.basepath);
// read and service request on client
context.getLogger().info("ServerHandler startet service, " + Thread.currentThread());
PrintWriter out = new... |
e3d1453b-1bad-4532-a9a9-30e521db6994 | 8 | public Double traverse(GraphNode2<T> source, GraphNode2<T> sink) {
// if the graph is empty do nothing
if (source == null) { return null; }
if (sink == source) { return 0.0; }
// initialization
frontLine.clear();
finalized.clear();
// vis... |
b725cb5c-dea3-4e26-9f82-faef7c4000a6 | 7 | private ConexionServidor() {
setLayout(new GridLayout(4,2));
add(new JLabel("Usuario:"));
usuarioFld = new JTextField(10);
usuarioFld.addKeyListener(this);
add(usuarioFld);
add(new JLabel("Password:"));
passwordFld = new JPasswordField(10);
passwordFld.addKeyListener(this);
add(passwordFld);
add(... |
595cd7e2-960a-45ae-998e-ec83a70b9828 | 3 | public void run() {
try {
if (socket.isConnected()) {
if (authenticate()) {
sendMessage("Access Granted");
access();
} else {
sendMessage("Access Denied");
}
}
} catch (IOException e1) {
System.out.println("User gave up at login...");
}
} |
73487ead-59c0-43c5-854a-8c77df43ee30 | 0 | public Attributes get(int index) {
RangeCheck(index);
return attributeLists[index];
} |
5a516d29-fd42-4207-8caf-70d4ad78393a | 3 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) {
if (plugin.perms().has(sender, "activitystats.view.self")) {
if (sender instanceof Player) {
return reportActivity(sender, (Player)sender);
} else {
plugin.msg(sender,... |
260f1ccd-daa7-49f5-b1cb-d36d8c978c2b | 0 | public boolean isFixedOrientation() {
return fixedOrientation;
} |
fc8f2fad-6f0a-44db-9977-b1d5a6fb0cb8 | 6 | @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage(plugin.prefix + "You have to be a player to use this command");
return true;
}
Player player = (Player)sen... |
3f3fced3-0437-4bc6-a097-44d7e2f89c9c | 7 | public StatusPanel(){
p1.setLayout(f);
p1.add(l1);
p1.add(l12);
p1.add(l13);
this.setLayout(new GridLayout(0, 1));
this.add(p1);
this.add(new JSeparator());
p2.setLayout(f);
p2.add(l2);
p2.add(l22);
p2.add(l23);
this.add(p2)... |
371854dd-9e7f-4144-ae94-6e7293f1e095 | 6 | public void paint(Graphics g) {
super.paint(g);
if(!win) {
for(int y = 0; y < Maze.gridSize; y++) {
for(int x = 0; x < Maze.gridSize; x++) {
String tile = m.getMap(x, y);
if(tile.equals("s") && !playerSet) { // Puts the player on the start tile at the beginning
setPlayer(x, y);
}
g... |
bcaec337-b7f9-41fc-944d-ba6d8f9a4516 | 2 | public static boolean check_repeat_symbol(Symbol_table symbol_table, String name) {
for (int i = 0; i < symbol_table.symbol_name.size(); i++) {
if (symbol_table.symbol_name.get(i).toString().equals(name)) {
return false;
}
}
return true;
} |
3d12a05e-1d0a-495e-8610-86a644c0a277 | 7 | private String toDecimalString()
{
final int estimatedViewLength = Math.max(21, factor + 3);
final char[] buff = new char[estimatedViewLength];
int bufPos = estimatedViewLength;
long abase = Math.abs(base);
int wfactor = factor;
do
{
final long r = abase % 10;
buff[--bufPos] = (char) ('0' + r);
abase ... |
c7c5e7a6-c6ef-4fd4-b822-6d9c04dabcd0 | 7 | public ArrayList<String> getBroadcastAddr() {
ArrayList<String> listOfBroadcasts = new ArrayList<String>();
try {
Enumeration<NetworkInterface> dev = NetworkInterface.getNetworkInterfaces();
while (dev.hasMoreElements()) {
NetworkInterface ni = dev.nextElement();... |
13df3567-3eb9-4496-ba17-1433cd8b35d1 | 6 | @Test
public void testNull() {
OrderLinkedRedBlackTree<Integer> tree = new OrderLinkedRedBlackTree<Integer>();
try {
tree.insert(null);
Assert.fail();
} catch (NullPointerException e) {
}
try {
tree.getPredecessor(null);
Assert.fail();
} catch (NullPointerException e) ... |
172b2531-215f-43be-a3ba-66d6b7fb0c94 | 3 | public static ArrayList<bConsulta> getListaProdAssistec(String dt1) throws SQLException, ClassNotFoundException {
ArrayList<bConsulta> sts = new ArrayList<bConsulta>();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Maximo de Cone... |
cbc8a479-7bf9-4c3a-bf51-6102c08d58d7 | 7 | @Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
case 1:
return Integer.class;
case 2:
case 3:
case 4:
case 5:
return String.class;
default:
throw new IllegalArgumentException("Unknown column " + columnIndex);
}
} |
b677c6d9-5edd-4be6-ad18-41686268a52e | 5 | public void removePlayerFromPlayersFile(String player){
customConfigurationFile = new File(plugin.getDataFolder(), "players.yml");
customConfig = YamlConfiguration.loadConfiguration(customConfigurationFile);
InputStream defConfigStream = plugin.getResource("players.yml");
if (defConfigStream != null) {
... |
ab0caad4-8e52-475e-8bb2-32b5e81b82fa | 6 | public static void main(String[] arg) throws InterruptedException {
int interval= Integer.parseInt(arg[0]);
MAX_PARALLEL= Integer.parseInt(arg[1]);
List<String> addrList = new ArrayList<String>(Arrays.asList(addr));
ArrayList<String> list=new ArrayList<String>();
//for(int k=0... |
542a4e04-c4a4-4cc3-8149-d4449cd0380a | 3 | public boolean hasGlitter(int x, int y)
{
if (!isValidPosition(x,y)) return false;
if (isUnknown(x,y)) return false;
if (w[x][y].contains(GLITTER))
return true;
else
return false;
} |
54643dbc-4cfa-4c5c-a006-22cfb46767a2 | 3 | protected static List<CCTriangle> getTriangles(final List<String> td
, final List<CCNode> nodes, final CCModel model) {
ArrayList<CCTriangle> triangles = new ArrayList<>();
CCTriangle triangle = null;
for (String s : td) {
if (!s.split("\\s")[0].matches("[0-9]+")) {
... |
18f26c4a-a240-4a41-bfa9-b278d8d1f444 | 2 | @Override
public int hashCode() {
int hash = 31;
hash += this.produto != null ? this.produto.hashCode() : 0;
hash += this.usuario != null ? this.usuario.hashCode() : 0;
return hash;
} |
308e8c19-8a3f-4a3f-9935-9ad74359384d | 3 | private void txtMember_Father_NameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMember_Father_NameKeyPressed
if (evt.getKeyCode() == 40) {
jCheckBox1.grabFocus();
} else if (evt.getKeyCode() == 39) {
txtMother_Name.grabFocus();
} else if (evt.getKeyCode() == 38) {
txt... |
0b62e45e-0f15-4569-ab5b-3912ffd241ae | 0 | public void fileModified(int arg0, String arg1, String arg2) {
// IGNORE
} |
4fee5c91-1f5c-4edb-967a-11ff55c03d5b | 2 | public String rootFilename(String filename, Serializable structure) {
int lastIndex = filename.lastIndexOf('.');
if (lastIndex == -1)
return filename;
String smallname = filename.substring(0, lastIndex);
if (filename.equals(proposeFilename(smallname, structure)))
return smallname;
return filename;
} |
021ab04f-fbf5-4d69-850e-4f804496b9c6 | 3 | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("usage: java Blur imagefile [iterations]");
System.out.println(" imagefile is an image in TIFF format.");
System.out.println(" interations is the number of blurring iterations" +
" (defa... |
6faeb2c4-055e-4305-8c28-cfeca6c0dab9 | 9 | public void checkCard(Card c, int selectedCardRow, int selectedCardCol){
Card otherActive;
//printArray(cards);
for(int j = 0; j < A1Constants.NUMBER_OF_COLS; j++){
otherActive = cards[currentRow[j]][j];
if(otherActive.isActive()){ //only compare cards if they are both active
... |
3a6a6afe-ee9a-430a-8db5-9dc6d98c5711 | 3 | public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Paintimator frame;
try {
frame = new Paintimator();
frame.setVisible(true);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
} catch (Unsupported... |
26776521-2e85-4453-9af7-07edef964324 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Endereco other = (Endereco) obj;
if (!Objects.equals(this.idEndereco, other.idEndereco)) {
re... |
402e616d-6262-4d58-b6a8-d02b2e9c3a85 | 5 | public static Map<Integer, Integer> factorization(int number) {
final Map<Integer, Integer> result = new HashMap<Integer, Integer>();
for (int i = 2; i <= number; i++) {
if (!Primes.isPrime(i)) {
continue;
}
int prime = i;
if (prime <= number) {
int tmp = number;
int count = 0;
while (tm... |
231c1db6-8e38-4dd4-a03c-732c5d231448 | 0 | public char readChar() {
char[] toReturn = new char[1];
buffer.getChars(tapeHead, tapeHead + 1, toReturn, 0);
return toReturn[0];
} |
222bd826-59c1-4839-8ebc-4413df6a25ed | 8 | private void ExecuteAssincronousCommand(String CommandText, File WorkingDirectory) {
try {
done = false;
ExternalProcessResultList.clear();
jLDBSniffer.setText("Detector Started");
ExternalProcess = Runtime.getRuntime().exec(CommandText, null, WorkingDirectory);
... |
35bd36cd-fbc6-4367-b6ec-fecc906d67b1 | 8 | private void onBoundaries(int tmpX, int tmpY){
// check whichBoundary it is
switch (moveStyleBoundaries){
case START:
moveTo((int)thisSpawnPos.x,(int)thisSpawnPos.y);
break;
case RANDOM_WHITHIN_AREA:
int newX,newY;
... |
22b30d28-bd81-47de-bbbc-5e5235ad04de | 5 | public void run()
{
boolean incr = true;
while(true)
{
if(incr)
{
if(a.nFontSize < 30)
a.nFontSize++;
else
incr = false;
}
else
{
if(a.nFontSize > 12)
a.nFontSize--;
else
incr = true;
}
a.repaint();
try
... |
eec069bb-b6ef-4b01-b636-0116fe741d9e | 9 | private void buildMovementPlan() {
// Find an unexplored location to move to.
// Note that this method tries to find the closest position based on a
// heuristic (turn cost and Manhattan distance).
final Vector2 unexplored = findUnexploredPosition();
// All unexplored locations ... |
4513c773-d1cd-400a-933b-7ea9fae27815 | 2 | public static Filter isAssignableTo( Class<?> superclassOrInterface )
{
if ( superclassOrInterface == null )
{
throw new IllegalArgumentException( "Parameter 'superclassOrInterface' must be not null" );
}
return new IsAssignableTo( superclassOrInterface );
} |
05bf7830-3892-4e2e-ae1c-86a4172994ca | 7 | public void testPurge5() {
Table<Integer> table=new Table<>(3, 10, 0);
for(int i=1; i <= 100; i++)
table.add(i, i);
System.out.println("table = " + table);
table.removeMany(false, 0);
table.purge(10);
for(int i=1; i <= 10; i++)
assert table._get(i... |
d5cdb5e8-7fa2-4ad0-927e-cff73367fe27 | 3 | public Map<String, Integer> getTermCounts() {
if (termCounts == null) {
Counter count = new Counter();
for (Sentence sentence : this.sentences) {
for (String term : sentence.terms)
{
count.add(term);
}
}
termCounts = count.toHashMap();
}
return termCounts;
} |
46fc2283-8203-4d0e-96c6-858491ee6286 | 3 | public PdfManipulator(OutputStream os, InputStream in, float[] rect) throws IOException {
this.pdfreader = new PdfReader(in);
this.originSize = pdfreader.getPageSize(1);
if (rect == null || rect.length != 2) {
document = new Document(PageSize.A4, 36f, 36f, 36f, 36f);
} else {
this.rectangle = new Rectangl... |
86cca917-96af-40f5-ba5d-0530dd6cfe80 | 7 | public void update() {
for(int i = 0; i < mobs.size(); i++) {
Mob m = mobs.get(i);
if(m instanceof REnemy || m instanceof FEnemy) {
if(m.getX() <= 0) {
removeMob(m);
clearMobs();
Game.state = State.END;
}
}
if(m instanceof Projectile) {
if(m.getX() >= Game.WIDTH) {
removeMo... |
a18792f4-d49f-4736-8f0a-0a4b334ea8a5 | 5 | public LinkedHashMap<String,Integer> getListMap() {
Map<String,Integer> mostWords = new TreeMap<String,Integer>();
Iterator<?> k = resultlist.iterator();
while(k.hasNext()) {
Map<String,Integer> temp3 = ((IResultSet) k.next()).getCustomWordCount();
Iterator<String>h = temp3.keySet().iterator();
... |
1403538b-626f-4fe8-8af9-e6001f1adf4b | 5 | public String getProspectsByKeywords(String keywords)
throws EntityNotFoundException {
String queryString = null;
try {
queryString = URLDecoder.decode(keywords.toLowerCase(), UTF8);
} catch (UnsupportedEncodingException e) {
// This should never happen...
e.printStackTrace();
... |
6002a230-a174-4bda-8887-25527d01bd66 | 9 | @Override
public <T> T toTypedValue(String stringValue, Class<T> type) {
if (stringValue==null || stringValue.equalsIgnoreCase("null")) {
return null;
}
try {
try {
//with string constructor
Constructor<T> constructor=type.getConstructo... |
a45a2200-cd84-465c-b428-59d20c5c59ff | 9 | public static void bspatch (File oldFile, File newFile, File diffFile)
throws IOException {
int oldpos, newpos;
DataInputStream diffIn = new DataInputStream (new FileInputStream(diffFile));
// headerMagic at header offset 0 (length 8 bytes)
long headerMagic = diffIn.readLong();
// ctrlBlockLen after ... |
1f565a3d-9421-48e5-9552-7d077d183a94 | 2 | public static boolean isPrimitiveArray(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isArray() && clazz.getComponentType().isPrimitive());
} |
c68c20a8-62e5-4b39-9657-0c4f6fd75403 | 5 | public static void insertionSort(Comparable []data){
for(int index=1;index<data.length;index++){
Comparable key = data[index];
int position = 0;
//升序排列
// while( position>0 && data[position-1].compareTo(key)>0){
// data[position] = data[pos... |
f59a4303-99d4-4c7e-819f-21f2513b17b4 | 5 | private void exportShape(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportShape
// TODO add your handling code here:
JFileChooser filechooser = new JFileChooser();
ShapeFileFilter shapeFilter = new ShapeFileFilter();
filechooser.addChoosableFileFilter(shapeFilter);
int di... |
cd495289-de4d-44b2-b18a-346c023cb7a4 | 5 | public static Tile[][] getWorld(World w, int ws) {
Tile[][] tile = new Tile[ws][ws];
int[] index = new int[ws * ws];
RL.map1_0.getRGB(0, 0, RL.map1_0.getWidth(), RL.map1_0.getHeight(), index, 0, RL.map1_0.getWidth());
for (int i = 0; i < ws; i++) {
for (int j = 0; j < ws; j++) {
if (index[i + j * w... |
eeedec33-f7b3-480e-b34a-826052ad63e3 | 8 | private void jButton26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton26ActionPerformed
// TODO add your handling code here:
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null,
"Yakin?", "Konfirmasi", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION... |
649050b0-e50f-4d2e-a248-045bedccd834 | 5 | public boolean actionRest(Actor actor, Boardable place) {
//
// Transfer any incidental groceries-
if (place == actor.mind.home()) for (Service food : ALL_FOOD_TYPES) {
actor.gear.transfer(food, (Employment) place) ;
}
//
// If you're resting at home, deposit any taxes due-
if (place... |
d5655644-0c51-46a5-858f-011486925281 | 1 | public static void main(String[] args) {
try {
AESEncryptor encryptor = new AESEncryptor("TheSupaSecretKey");
ManagerSettingsRemote settings = new ManagerSettingsRemote();
// settings.setProperty("localDirectory", "/home/alkise/Pictures");
// settings.setProperty("h... |
218b19a2-921d-4e2a-81bb-88098615de22 | 4 | @Override
public int compareTo(Individual o) {
if (o == null) {
throw new NullPointerException("o can't be null");
}
if (this == o) {
return 0;
}
if (this.getEvaluation() > o.getEvaluation()) {
return 1;
} else if (this.getEvaluati... |
f2c74660-49bd-4e42-b596-83c7aaf793a9 | 8 | private boolean validMovesExist(){
List<Integer> diceOptions = diceRoll;
//Check bar
Location barOfPlayerInTurn = getBarOfPlayerInTurn();
int barCount = getCount(barOfPlayerInTurn);
if(barCount > 0){
for(int j = 0; j < diceOptions.size(); j++){
Location to = getToLocationFromBar(diceOptions.get(j)... |
d12ec7dc-6754-4c90-a8b6-ef2bcb1776dd | 7 | @SuppressWarnings("unchecked")
protected static <Type> Class<?> getClass(Type type) {
if (type instanceof Class) {
return (Class<?>) type;
} else if (type instanceof ParameterizedType) {
return getClass(((ParameterizedType) type).getRawType());
} else if (type instanceof GenericArrayType) {
Type compone... |
d54ca0bb-46ed-409f-8380-5feb772859c9 | 7 | public final TLParser.idList_return idList() throws RecognitionException {
TLParser.idList_return retval = new TLParser.idList_return();
retval.start = input.LT(1);
Object root_0 = null;
Token Identifier96=null;
Token char_literal97=null;
Token Identifier98=null;
... |
d37c3e2f-87a8-43b9-9517-dccfe7daf6e0 | 9 | private void populateRelations() {
RelationsDao relationsDao = new RelationsDao();
List<Object[]> list = relationsDao.findRelations();
DefaultTableModel tableModel = new DefaultTableModel() {
@Override
public Class getColumnClass(int col) {
switch (col) {... |
bf86230f-a28b-4515-be86-f6b506bde5af | 5 | public void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(2);
return;
}
Graphics g = bs.getDrawGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, getWidth(), getHeight());
for (int i = 0; i < getLevel().bricks.length; i++) {
for (int j = 0; j < ge... |
0def13d8-e38d-42aa-b651-7af29564749b | 9 | public static void main( String [ ] args )
{
TreapTree<Integer> t = new TreapTree<>( );
final int NUMS = 40000;
final int GAP = 307;
System.out.println( "Checking... (no bad output means success)" );
for( int i = GAP; i != 0; i = ( i + GAP ) % NUMS )
t.insert( i );
System.out.p... |
2617189f-94e1-4a28-b49c-5757624a4400 | 4 | public int removeElement(int[] A, int elem) {
if (A == null || A.length == 0)
return 0;
int step = 0;
for (int i = 0; i < A.length; i++) {
if(A[i] == elem)
step ++ ;
else
A[i -step] = A[i];
}
return A.l... |
7f2a03ce-a576-4939-bfef-d7eb8c971769 | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
e1b9a9a9-7344-4780-bb12-d92c43f7a0eb | 2 | private void locationClicked() {
World<T> world = parentFrame.getWorld();
Location loc = display.getCurrentLocation();
if (loc != null && !world.locationClicked(loc))
editLocation();
parentFrame.repaint();
} |
8ad5bd88-257d-409c-8c47-36b1dd6f1a13 | 6 | public boolean toggleBookmark(int line) throws BadLocationException {
if (!isBookmarkingEnabled() || getBookmarkIcon()==null) {
return false;
}
GutterIconInfo[] icons = getTrackingIcons(line);
if (icons.length==0) {
int offs = textArea.getLineStartOffset(line);
addOffsetTrackingIcon(offs, bookmarkIco... |
9011ee10-1951-46af-94fe-899f21075cbb | 6 | private void placePiece(Command command) {
Piece piece = null;
String pieceType = command.getPiece();
String pieceColor = command.getPossiblePieceColor();
String pieceCode = command.getPossiblePieceCode();
String colorCode = command.getPossibleColorCode();
if (pieceType... |
3133df74-2e26-412a-8f19-7631bd172990 | 5 | public static byte[] decode(String encoded) {
ByteBuffer buf = ByteBuffer.allocate((encoded.length() / 4 + 1) * 3);
int concat = 0;
int count = 0;
for (char c : encoded.toCharArray()) {
int current = getValue(c);
if (current == -1)
continue;
concat = (concat << 6) | current;
count += 6;
if (c... |
8aae096b-8459-4e40-b2e9-6a731e96310b | 9 | private void findKHitMiss (int instNum) {
int i, j;
int cl;
double ww;
double temp_diff = 0.0;
Instance thisInst = m_trainInstances.instance(instNum);
for (i = 0; i < m_numInstances; i++) {
if (i != instNum) {
Instance cmpInst = m_trainInstances.instance(i);
temp_diff = di... |
05d15105-8386-45cc-8356-51bdefba5f38 | 5 | public void selectKit(Player p, String kit) {
data.addPlayer(p, kit);
Inventory inv = p.getInventory();
clearInventory(p);
if (kit.equalsIgnoreCase("Archer")) {
ItemStack bow = new ItemStack(Material.BOW);
bow.addEnchantment(Enchantment.ARROW_DAMAGE, 2);
bow.addUnsafeEnchantment(Enchantment.KNOC... |
f6c2ca9d-6a5b-4e54-b44c-0b963f4679c6 | 9 | public void updateBordersDoor(int x,int y,ArrayList<Door> array)
{
int norte=1;
int sur=1;
int este=1;
int oeste=1;
int i=0;
while(i<array.size())
{
if(array.get(i).getDireccion().equals(Directions.NORTE))
{
if(array.get(i).isOpen())
norte=2;
else
norte=5;
}
else if(ar... |
f5ba003c-e612-415f-8d68-bbd6e3c717ec | 8 | protected String getGlobalCompilerFlags() {
final StringBuilder builder = new StringBuilder();
if (globalOverrideCompilerFlags == null
|| globalOverrideCompilerFlags.isEmpty()) {
if (parent != null)
builder.append(parent.getGlobalCompilerFlags());
else
builder.append(config.cflags());
} else {
... |
8af0c228-8cbc-459e-9543-7facd882b88b | 4 | @Override
public void end() throws IOException {
if (!isActive())
return;
log.info("Closing connection from {}", socket);
if (!socket.isClosed())
socket.close();
if (target != null && !target.isClosed())
target.close();
getServer().unregisterConnection(this);
this.terminated = true;
log.i... |
2c1f5062-4c80-4813-a657-aef6f05dcb34 | 8 | private void initSize()
{
setAutoResizeMode(AUTO_RESIZE_OFF);
for (int i = 0; i < getColumnCount(); i++)
{
TableColumn col = getColumnModel().getColumn(i);
int size = 0;
switch (i)
{
case 0:
size = 45;
break;
case 1:
size = 20;
break;
case 2:
size = 50;
break... |
8160f666-c504-4f83-81be-027270912f06 | 6 | @Override
public HashMap<String, String>[] call() throws Exception {
if (call.equals("search"))
return search();
else if (call.equals("top"))
return top();
else if (call.equals("playlist"))
return (getPlaylist());
else if (call.equals("album"))
return (getAlbum());
else if (call.equals("userSo... |
44b0a4ab-8523-496d-8934-aea03c15e000 | 9 | static public int getSolution() throws IOException {
int[][] grid = getGrid();
Stack<Integer> stack = new Stack<>();
int cur_i = SIZE - 1, cur_j = SIZE - 1;
stack.push(grid[cur_i][cur_j]);
for (int i = SIZE - 1; i >= 0; i--) {
for (int j = SIZE - 1; j >= 0; j--) {
int sumRight = -1;
int sumDown = -... |
d44c4f8e-8de8-496d-abdb-f65d0ee9447e | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Person)) return false;
Person person = (Person) o;
if (age != person.age) return false;
if (name != null ? !name.equals(person.name) : person.name != null) return false;
retu... |
9c55d66f-5569-49ed-9975-b27ff4e4ff15 | 9 | public boolean loadTimer() {
boolean test = false;
if (test || m_test) {
System.out.println("Loader :: loadTimer() BEGIN");
}
m_valid = false;
m_hashString = "";
m_timerInfo = new int[TIMER_INFO_SIZE];
try {
setFile(getTim... |
2bea348c-3976-4df4-b9d6-aa9d0c4afa2e | 5 | private void CreateDataTable()
{
try
{
_queryHandler.Create_Wide_Protocol_Tables();
for (API api : _apiInfo.API)
{
_queryHandler.InsertAPI(api);
//Insert Opcode Data
for (OpcodeInformation opc : api.API_Opcodes)
{
_queryHandler.InsertOpcode(opc, Integer.parseInt(api.API_ID)... |
be94c539-4c35-4881-921a-3d4621845857 | 5 | private void drawFlames() {
drawingFlames = true;
try {
long startTime = System.currentTimeMillis();
int currentLoop = 0;
int interval = 20;
while (currentlyDrawingFlames) {
flameCycle++;
calcFlamesPosition();
calcFlamesPosition();
doFlamesDrawing();
if (++currentLoop > 10) {
lo... |
fbbb6460-12ac-4452-8942-abf513a891b6 | 7 | private PDFObject findPage(PDFObject pagedict, int start, int getPage,
Map<String,PDFObject> resources) throws IOException {
PDFObject rsrcObj = pagedict.getDictRef("Resources");
if (rsrcObj != null) {
resources.putAll(rsrcObj.getDictionary());
}
PDFObject typeOb... |
fc2d1bba-7267-4243-aec4-e302ea6915ff | 5 | protected OgexCameraObject toCamera( DataStructure ds, Map<BaseStructure, Object> index ) {
OgexCameraObject result = (OgexCameraObject)index.get(ds);
if( result != null ) {
return result;
}
result = new OgexCameraObject();
index.put(ds, result);
for(... |
bbcfefe3-040e-4d18-b358-e2b2771369e3 | 5 | public static byte[] decodeLines (String s) {
char[] buf = new char[s.length()];
int p = 0;
for (int ip = 0; ip < s.length(); ip++) {
char c = s.charAt(ip);
if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {
buf[p++] = c;
}
}
... |
8e270850-f52d-4266-ba6c-20c0ba2c9f42 | 4 | public static int bruteForceBackup(String pattern, String docs) {
int i, N = docs.length();
int j, M = pattern.length();
for (i = 0, j = 0; i < N && j < M; i++)
if (docs.charAt(i + j) == pattern.charAt(j)) j++;
else { i -= j; j = 0; }
if (j == M) return i - M;
else return N;
} |
68912205-d2da-4582-a757-452392163dbb | 7 | public void valueChanged(ListSelectionEvent arg0){
locked = true;
int index = getSelectedIndex();
if (index != -1){
romaji.setText(((Word) wlist.get(reverseIndex(index))).getRomaji());
kana.setText(((Word) wlist.get(reverseIndex(index))).getKana());
kanji.setText(((Word) wlist.get(reverseIndex(index))).g... |
728135c8-9410-4115-86b9-c96a667a5efe | 1 | public List<ReferenceType> getReference() {
if (reference == null) {
reference = new ArrayList<ReferenceType>();
}
return this.reference;
} |
df85e655-3856-431e-bce9-752b2766d6a4 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(msg.amITarget(this))
{
switch(msg.targetMinor())
{
case CMMsg.TYP_PUT:
if(CMSecurity.isAllowed(msg.source(), msg.source().location(), CMSecurity.SecFlag.CMDITEMS))... |
5de16fcf-185e-4d17-bde3-9f08baf510be | 9 | public ChatServer () throws IOException {
server = new Server() {
protected Connection newConnection () {
// By providing our own connection implementation, we can store per
// connection state without a connection ID to state look up.
return new ChatConnection();
}
};
// For consistency, the c... |
55f9101a-af19-4954-a62d-d0394dddc9cb | 1 | public void setDefault() {
properties = new Properties();
String name;
try {
name = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
name = "User";
}
System.out.println("name: " + name);
properties.put("name", name);
properties.put("port", new Integer(Constan... |
c4207162-35de-4d73-9ceb-9eef9ea5a8e6 | 7 | public void doGet(HttpServletRequest request, HttpServletResponse response) {
response.setContentType("application/rss+xml");
final CommunityDAO dao = CommunityDAO.get();
final String baseURL = System.getProperty(EmbeddedServer.Setting.RSS_BASE_URL.getKey());
if (baseURL == null) {
logger.warning("No bas... |
75dc0921-f0d7-4c37-b83e-9321e3c65768 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Board other = (Board) obj;
if (tokens == null) {
if (other.tokens != null)
return false;
} else if (!tokens.equals(other.tokens))
ret... |
273965a8-edb1-4086-a42f-a819173150f0 | 3 | public static void main(String[] args) throws IOException
{
if(args.length != 2)
{
System.out.println("Usage: FindString <string> <filename>");
System.exit(1);
}
RandomAccessFile in = new RandomAccessFile(args[1],"r");
String s = null;
int i, loc = 0;
for(i=1;(s = in.readLine... |
181df002-6995-4208-87f5-959dc828460f | 6 | @Override
public QueryResult updateQuery(Query q) {
Statement st = null;
if(!q.isParsed()) {
q.parse();
}
try {
st = con.createStatement();
st.executeUpdate(q.getParsedQuery());
}catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE, " Could not execute query!");
if(this.dbg) {
... |
0418d1dd-5ee3-4f4f-8cd1-04871bb1ed0f | 3 | void setCellForeground () {
if (!instance.startup) {
textNode1.setForeground (1, cellForegroundColor);
imageNode1.setForeground (1, cellForegroundColor);
}
/* Set the foreground color item's image to match the foreground color of the cell. */
Color color = cellForegroundColor;
if (color == null) color =... |
02599a09-419c-4906-814b-4cf9a2e40eb5 | 9 | public CellState[][] grabSaveData(){
Scanner scan = null;
try{
scan = new Scanner(save);
CellState[][] states = new CellState[GridWorldLife.instance.world.getGrid().getNumRows()][GridWorldLife.instance.world.getGrid().getNumCols()];
int row = -1;
int column = 0;
while(scan.hasNextLine() && row < ... |
48bb33d4-858e-4b60-824a-6e2d7d821c3c | 5 | @Override
public void actionPerformed(ActionEvent ae)
{
// EACH BUTTON STORES A COMMAND, WHICH REPRESENTS
// WHICH BUTTON WAS CLICKED
String command = ae.getActionCommand();
// WHICH BUTTON WAS CLICKED?
switch (command)
{
// THE NEW BUTTON?
... |
84861eaa-1afd-4e9e-92cf-e0da76d66170 | 5 | public Pessoa Abrir(int id) throws Exception{
Pessoa pessoa = null;
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM Pessoa WHERE Id_Pessoa = ?");
comando.setInt(1, id);
ResultSet consul... |
b31e36db-918b-4c51-92b1-92d2fbf23215 | 1 | public final Object opt(String key) {
return key == null ? null : this.map.get(key);
} |
676c6d47-dc40-44f6-8ab1-a61ae4c48319 | 7 | public static byte[] dumpAllocation(TypeModel tm) {
ClassWriter cw = new ClassWriter(0);
FieldVisitor fv;
MethodVisitor mv;
Class interfaceClass = tm.type();
String name = interfaceClass.getName().replace('.', '/');
cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, name + "Allocation", null, "java/lang/... |
e519fa6a-75ad-43b8-883a-1ff5c07d99e4 | 8 | private double rationalizeFrequency(double freq) {
double returnFreq = 0.00;
/*
* Generally MELODIA pushes it up the octave
* We will check for 3 octaves up
*/
if (freq > maxVocalFreq) {
double freq1 = freq/8;
if (checkVocalRange(freq1)) {
returnFreq = prevFreqRationalization(freq1);
} else ... |
03a94e82-f94f-4843-be73-d3a837e308a6 | 9 | void renderStereo(float[][] dest, float[][] src, int nsamples) {
float[] tleft = new float[nsamples * 2];
float[] tright = new float[nsamples * 2];
for (int i = 0; i < nsamples; i++) {
tleft[i] = src[i][0];
tright[i] = src[i][1];
}
switch (mode) {
case DECIMATOR:
for (int i = 0; i < nsam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.