method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e0d97553-3321-4330-8c08-505dd00c0268 | 2 | private void setBufferStrategy() {
try {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
myWindow.createBufferStrategy(2); //NUM_BUFFERS);
}
});
} catch(Exception e) {
System.out.println("Error while... |
1a5c0587-d622-4380-9033-e85c977c68d4 | 7 | private void initLayerChoice()
{
layerChoice = new JComboBox(layerNames);
layerChoice.setMaximumRowCount(2);
layerChoice.addItemListener(
new ItemListener()
{
public void itemStateChanged(ItemEvent event)
{
if(event.getStateChange() == ItemEvent.SELECTED)
{
layerChoice.setSe... |
d4fa117c-55e3-47d1-82ea-fa4bd3f612dc | 5 | final int method1714(int i, int i_3_) {
anInt6092++;
if (((Class239) this).aClass348_Sub51_3136.method3422(674)
== Class10.aClass230_186) {
if (((Class239) this).aClass348_Sub51_3136.method3425(i + -70))
return 3;
if ((i_3_ ^ 0xffffffff) == -1
|| ((Class348_Sub51) ((Class239) this).aClass348_Sub51_... |
1bcb9d7e-bd16-4129-bd8f-acfdcdde9777 | 7 | @Test
public void test() {
StickyWeb sw = new StickyWeb();
StickyWebResponse result;
try {
result = sw
.get("http://www.sluggy.com", null).setOnline(true)
.execute();
TagNode test = result.asHTML();
Object[] comicObj;
comicObj = result.asHTML().evaluateXPath(
"//*[@id='contain... |
fd8acc07-9a5c-4a2e-a718-16953772b539 | 3 | public Element removeElement(Rectangle bounds) {
Element deleted = null;
for(Element element:elements) {
if(new Rectangle(element.getLocation(), GameModel.getSquareUnit()).intersects(bounds)) {
deleted = element;
break;
}
}
if(deleted != null) {
model.getBankAccount().deposit(deleted.getType().... |
5e4edda7-2548-45f4-8317-799e879f01a7 | 1 | @Override
public int hashCode() {
return playerName != null ? Arrays.hashCode(playerName) : 0;
} |
25ead2d0-06d5-48a2-a734-a8303a4d13b9 | 7 | public void payRent(Player p)
{
int toll = 0;
if (!checkMonopoly()) toll = rent;
else
{
switch (houses)
{
case 0: toll = (rent * 2);
break;
case 1: toll = oneHs;
break;
case 2: toll = twoHs;
... |
81db480e-ee77-458e-844c-e3a25ad4723e | 2 | public boolean haveOpt(String name) {
for (int i = 0; i < menuOptions.length; i++) {
if (menuOptions[i].name.equals(name))
return true;
}
return false;
} |
02415cd7-86bf-4461-b3f2-6aeaf31854d1 | 1 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane3 = new javax.swing.JScrollPane();
jEditorPane1 = new javax.swing.JEditorPane();
jPanel1 = new javax.swing.JPanel();
... |
18d1d85d-2a4f-4f37-860e-18cac8d3f736 | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
cd79cdf0-09eb-4ecb-9aeb-bd66b405c1de | 7 | @Override
public int getxattr(String path, String name, ByteBuffer dst, int position)
throws FuseException, BufferOverflowException {
try {
ExtendedAttribute attribute = fileSystem.getExtendedAttribute(path, name);
position = 0;
dst.put(attribute.getContent(), position, attribute.getContent().length - po... |
0e43d684-dec9-4231-a3dc-e9a56880b45b | 7 | public AbstractCollection remove(Stella_Object value) {
{ VectorSequence self = this;
{ edu.isi.stella.Stella_Object[] array = self.theArray;
int firstshiftoffset = -1;
int lastshiftoffset = self.sequenceLength - 1;
{ int i = Stella.NULL_INTEGER;
int iter000 = 0;
... |
913e39f0-6146-4c6f-95b4-79e725f015d9 | 9 | public TeamInfoPanel (final boolean isEnemy) {
super (new GridBagLayout());
setPreferredSize (new Dimension (210, strategies.length * 24));
setMaximumSize (new Dimension (210, strategies.length * 24));
setBorder (new EmptyBorder (5, 5, 5, 5));
UIManager.getLookAndFeelDefaults().put("progressBarTrackInterio... |
d0fb9b4c-22e3-42ae-b77d-58807d2c83da | 8 | public static Object executeIfSupported( Object ob, Object[] args, String methname )
{
try
{
Object retob = null;
Method[] mt = ob.getClass().getMethods();
int t = 0;
for(; t < mt.length; t++ )
{
// Make JDK-specific call to method
//Logger.logInfo(mt[t].getName());
int numparms = 0;
... |
68c4bbe2-84d3-4b00-be98-886ccbad1968 | 4 | public static void main(String[] args) {
try {
fw=new FileWriter("MyTextFile.txt");
pw =new PrintWriter(fw);
pw.println("ok this is fine");
System.out.println("great");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
if(fw != null){
try {
... |
71ffd520-d33b-4232-8009-ffdd466dc2c5 | 1 | public static int factorial(int n) {
if(n <= 1)
return 1;
else
return n * factorial(n - 1);
} |
5e3fe8a3-c7f2-40d2-b0fb-ee694b5a7986 | 1 | private static void displayFrame(final JFrame frame) {
try {
synchronized (ImageUtils.class) {
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent event) {
sy... |
516cb950-bfb6-4a71-a345-f0d8158955cf | 1 | @Test
public void sub_test() {
try{
double []mat1= {1.0,2.0,3.0,1.0};
double []mat2= {2.0,1.0,5.0,0.0};
double result[] = Vector.sub(mat2, mat1);
double exp[]= {1.0,-1.0,2.0,-1.0};
Assert.assertArrayEquals(exp, result, 0);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not ... |
f430d855-b4dd-4315-b759-c10e49c0bec2 | 5 | private void processCatalogueDeleteReplicaResult(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] pack = (Object[]) ev.get_data();
if (pack == null) {
return;
}
String filename = (String) pack[0]; // get file name
int msg ... |
660b839a-f868-4e06-897a-65e681348e3c | 8 | public int linearConflict(Object[] x) {
int lin_distance = 0;
boolean plustwo = false;
Map<Integer, Integer> tmp = null;
Integer coor_x, coor_y, o_cor_x, o_cor_y;
int row;
for (int i = 0; i < x.length; ++i) {
Object value = x[i];
if (!value.toString().equals(" ")) {
// coordinates of the current ... |
c9c83cbf-71bc-4243-a341-6d8a317d572f | 1 | @Test
public void testForEach() throws AlreadyExistException {
Tree<String> tree1 = new Tree<>();
tree1.addElement("a", 2);
tree1.addElement("b", 1);
tree1.addElement("c", 4);
Iterator<String> treeIterator = new TreeIterator<>(tree1.getRoot());
for (String current : t... |
66bb0517-5e61-4d5f-b864-c411016881f7 | 2 | public void draw() {
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
glEnableVertexAttribArray(3);
glBindBuffer(GL_ARRAY_BUFFER, resource.getVbo());
glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex.SIZE * 4, 0);
glVert... |
cbed3eb8-aee2-40d3-bf49-79e350a83b70 | 0 | @After
public void tearDown() {
} |
b91fc6d1-baaf-4ae3-a9d3-3e7441069b5a | 6 | private RenderableObject generateLatex(Scanner inFile) {
Point loc = null;
String t = "";
String current = inFile.next();
while (inFile.hasNext()
&& !(isCloseTag(current) && parseTag(current) == LegalTag.Object)) {
if (isOpenTag(current)) {
switch (parseTag(current)) {
case Location:
loc = n... |
21a7110b-5a16-46f3-b805-c77f8a2687fb | 7 | private Problem readProblem(InputStreamReader isr) throws MaltChainedException {
Problem problem = new Problem();
final FeatureList featureList = new FeatureList();
if (configLogger.isInfoEnabled()) {
owner.getGuide().getConfiguration().getConfigLogger().info("- Read all training instances.\n");
}
try {
... |
681d4778-a971-48d1-b3be-2140054d558f | 5 | 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 ... |
ab3d1948-df5c-497d-b75c-2b07ea66bba7 | 0 | public List tools(AutomatonPane view, AutomatonDrawer drawer)
{
List list = new java.util.ArrayList();
list.add(new MealyArrowTool(view, drawer));
list.add(new StateTool(view, drawer));
list.add(new TransitionTool(view, drawer));
list.add(new DeleteTool(view, drawer));
... |
2d5dda6e-0894-4a29-8068-893f0834b451 | 2 | @Override
protected long onFill()
{
long memory = 0;
// While available memory decreases...
while (getAvailable() >= maxSize)
{
ByteBuffer buffer = ByteBuffer.allocateDirect(maxSize);
// Ensure the buffer has actually been allocated.
if (buffer != null) {
stack.push(buffer);
memory += maxSi... |
4056c65d-8cd9-453b-8463-30dda70a9754 | 8 | @Override
protected void renderBehavior(int glMode, RenderStyle drawType, Propulsing behavior) {
// Signifying it is still active
setActive(behavior, true);
// get the trail
Queue<Vect3D> trail = trails.get(behavior.getOwner().getId());
if (trail == null) {
trail = new LinkedList<Vect3D>();
trails.put... |
e34fc26a-925a-495e-a896-40a81a776589 | 7 | public int historicalNumPops (int type ){
switch (type) {
case HE_POP_SIZE:
return 1;
case HE_POP_SIZE_EXP:
return 1;
case HE_BOTTLENECK:
return 1;
case HE_ADMIX:
return 2;
case HE_MIGRATION:
return 2;
case HE_SPLIT:
return 2;
case HE_SWEEP:
return 1;
}
return 0;
} |
1a67bbf2-67b2-48a3-843c-96b0a7dcc81b | 9 | public static void main(String[] arg)
{
Billetautomat automat = new Billetautomat();
int antalFejl = 0;
int retur;
retur = automat.getBilletpris();
if (retur != 10) {
System.out.println("FEJL, getBilletpris() != 10");
antalFejl = antalFejl + 1;
}
System.out.println("*** Tjek af salg af en bill... |
f1c9e34f-965a-4a11-91c2-ff21ef027d3e | 2 | public static int updateWebpageData(final String content, String encoding) {
HttpClient httpclient = new DefaultHttpClient();
HttpPut httpput = new HttpPut(CLOUDMINE_ACCOUNT_TEXT_POST);
httpput.addHeader("Content-Type", CONTENT_TYPE_JSON);
httpput.addHeader("X-CloudMine-ApiKey", CLOUDMINE_SECRET_API_KEY);
htt... |
7e239d7c-bca7-411a-be48-405351c585e9 | 4 | public String getQueryRequiredFields(){
boolean containsInfo = false;
QueryString qs = new QueryString();
if (this.trackingAccountNumber!=null) {
containsInfo=true;
qs.add("tracking_account_number", this.trackingAccountNumber);
}
if (this.trackingPostalCod... |
d78332c6-a7fd-473c-ad0c-348e10cfa55e | 1 | public Record merge(Record detachedInstance) {
log.debug("merging Record instance");
try {
Record result = (Record) getSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
} |
032dc557-7b20-42e3-9ef2-340700960dbe | 7 | @Override
public List<Node> neighbors(Node node) throws IOException {
List<Node> nodes = new LinkedList<Node>();
List<String> wayList = new ArrayList<String>();
node.streets = new HashMap<Node,Node.Way>();
double[] latlong = new double[2];
bacon.reader.lock();
boolean success = bacon.reader.nodeSearch(node... |
03d6d320-929f-4bb1-a9ba-9a77bebafc53 | 8 | private void CommandNewLibrary( Class libraryClass )
{
initialized( SET, false );
String headerMessage = "Initializing ";
if( soundLibrary != null )
{
currentLibrary( SET, null );
// we are switching libraries
headerMessage = "Switching to... |
f78ea248-011d-4e7d-88a9-c6ace96a9865 | 8 | public static String wordForNumber(int n) {
if (n == 1000)
return wordForNumber(n / 1000) + " " + numbersToWords.get(1000);
if (n / 100 > 0)
return wordForNumber(n / 100) + " " + numbersToWords.get(100) + ((n % 100 == 0) ? "" : AND + wordForNumber(n % 100));
if (n > 20 &&... |
cfe683a2-1b64-4498-9e3e-2492503a113b | 9 | public void write (File dest, File destroot)
throws PackageBuilderException, IOException
{
if (dest == null) throw new IllegalArgumentException("The destination cannot be null.");
if (destroot == null) throw new IllegalArgumentException("The destroot cannot be null.");
PackageTarFil... |
6bcfee10-e64a-4ff9-9c23-fe9015a376bf | 6 | protected void setFrontTileType(){
switch (currentAngle) {
case 90:
case -270:
frontTile = rightTileType;
isFacingRight = true;
break;
case 180:
case -180:
frontTile = bottomTileType;
... |
0bc834ba-1517-471f-944f-c3aa2a7efdef | 8 | final Interface18_Impl2 method2266(boolean bool) {
if (bool != true)
return null;
anInt8720++;
if (anInterface18_Impl2_8719 == null) {
Class270.anIntArray3464[3] = anInt8711;
Class270.anIntArray3464[1] = anInt8717;
Class270.anIntArray3464[4] = anInt8708;
d var_d = ((AbstractToolkit) aHa_Sub3... |
7520c7dd-a268-4143-bf05-cfc5e951098f | 8 | public <T> T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions) throws SQLException {
Integer dbColumnPos = columnPositions.get(columnName);
if (dbColumnPos == null) {
dbColumnPos = results.findColumn(columnName);
columnPositions.put(columnName, dbColumnPos);
}
@SuppressWarnings("... |
4bb0fded-9334-4584-be15-698a8e693382 | 9 | private static void fixCOModule ( String path ){
//Go into designs
String designPath = path + "/designs" ;
File designsFolder = new File( designPath );
//Fixes xml files
if( designsFolder.exists() ){
for( String s : designsFolder.list() ){
String add = s.replace("Design_", "Design_$");
renameFile( ... |
63aed459-3acd-4fb2-a481-429515ad35c6 | 2 | @Override
protected void paintComponent(Graphics g) {
//System.out.println("Line Paint");
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(getColor());
Stroke temp = g2d.getStroke();
g2d.setStroke(new BasicStroke(this.getSelect()... |
56029ffa-2b39-49a9-b6f5-79a34aa1ebce | 7 | public Shape getParcela(HashMap <String, List<Shape>> shapesTotales, List<Coordinate> coors){
// Creamos la factoria para crear objetos de GeoTools (hay otra factoria pero falla)
com.vividsolutions.jts.geom.GeometryFactory gf = JTSFactoryFinder.getGeometryFactory(null);
List<Shape> matches = new ArrayList<Shape>... |
47409e70-9d2e-451d-8a52-559e4d0281e4 | 7 | public static void startupPli() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/PLI", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module)(St... |
743f8169-a4b9-4a8f-83af-065393185e7b | 5 | public Devil(TileMap tm, ArrayList<Enemy> enemies) {
super(tm);
this.tm = tm;
this.enemies = enemies;
enemies = new ArrayList<Enemy>();
moveSpeed = .2;
maxSpeed = 1;
fallSpeed = .2;
maxFallSpeed = 10.0;
width = 30;
height = 60;
cwidth = 30;
cheight = 60;
health = maxHealth = 6;
damage =... |
aecad3b8-63f6-491d-bfb7-22c7475eb342 | 0 | public void setSolFechaHasta(Date solFechaHasta) {
this.solFechaHasta = solFechaHasta;
} |
cede0b93-6647-46c0-9033-9124c4144f33 | 1 | public double calcBonusDefense(Territoire t, Peuple attaquant) {
double bonus = this.bonusDefense(t, attaquant);
if (hasPower()) {
bonus += this.pouvoir.bonusDefense(t, attaquant);
}
return bonus;
} |
9cd49568-9d0b-47f3-a048-5ff03e808195 | 9 | private void readSubframe(int channel, int bps) throws IOException, FrameDecodeException {
int x;
x = bitStream.readRawUInt(8); /* MAGIC NUMBER */
boolean haveWastedBits = ((x & 1) != 0);
x &= 0xfe;
int wastedBits = 0;
if (haveWastedBits) {
... |
8b03fdf0-b1c7-47dc-b3cd-b54f39753398 | 1 | public void onEnable()
{
ProxyServer.getInstance().getPluginManager().registerCommand(this, new Watch(this));
ProxyServer.getInstance().getPluginManager().registerCommand(this, new WatchReload(this));
ProxyServer.getInstance().getPluginManager().registerListener(this, new Listeners(this));
try {
dbC... |
f04d2fe0-d591-4f66-a754-bf240dc1859a | 3 | public boolean horsLimite (Coord c){
return c.x < 0 || c.y < 0 || c.x >= this.longueur || c.y >= this.largeur;
} |
07dcb7ac-7095-4e2c-a70b-e10754f6bb54 | 6 | @EventHandler(priority = EventPriority.HIGHEST)
public void blockInteract(BlockBreakEvent event)
{
Player player = event.getPlayer();
if (player.hasPermission(Permissions.PERM_ADMIN))
return;
String username = player.getName();
Chunk chunk = event.getBlock().getChunk();
if (!CP.getWGInstance().canBui... |
a7f38a6a-74d0-4d4a-ac8e-1f018a5e4417 | 6 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try{
boolean isPurse = true;
if(jTextArea1.getText().length()<1){
JOptionPane.showMessageDialog(this, "Error in cash purse import. Empty purse","Error",JOptionP... |
96be1d8e-9701-4310-972e-0c8a6276a9b2 | 9 | public int getConfig(int uid, int x, int y, int z) {
Ground tile = groundArray[z][x][y];
if (tile == null)
return -1;
if (tile.wallObject != null && tile.wallObject.uid == uid)
return tile.wallObject.objConf & 0xff;
if (tile.wallDecoration != null && tile.wallDecoration.uid == uid)
return tile.wallDeco... |
595e27aa-cf26-436b-b705-83e29bc7ec3b | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
c8456001-957f-4c34-ba22-2a386a315715 | 2 | public AnnotationVisitor visitParameterAnnotation(final int parameter,
final String desc, final boolean visible) {
buf.setLength(0);
buf.append(tab2).append('@');
appendDescriptor(FIELD_DESCRIPTOR, desc);
buf.append('(');
text.add(buf.toString());
TraceAnnotationVisitor tav = createTraceAnnotationVisitor... |
7bda6c72-09b9-4ce9-951e-de1cd0484bd2 | 0 | public void setEntrega(double entrega) {
this.entrega = entrega;
} |
d1c2763e-1389-423c-bf36-f56512bd0ed5 | 4 | public void render() {
int index = 0;
Object projectileArray[] = projectiles.toArray();
while(index < projectileArray.length) {
if(projectileArray[index] instanceof Projectile) {
Projectile projectile = (Projectile) projectileArray[index];
try... |
4f1e4a58-5a2f-4e5f-ac46-d4110d8ee86b | 4 | public static boolean isHexInt(String str)
{
if (str == null || "".equalsIgnoreCase(str))
{
return false;
}
for (String n : HEX)
{
if (str.equalsIgnoreCase(n))
{
return true;
}
}
return false;
} |
9776410f-d853-49ef-a28b-b967d8b50453 | 4 | public static int base2index(char base) {
switch (Character.toUpperCase(base)) {
case 'A':
return 0;
case 'C':
return 1;
case 'G':
return 2;
case 'T':
return 3;
}
throw new RuntimeException("Unknown base '" + base + "'");
} |
6ca55582-e420-49de-bf90-e4c1dcba9633 | 8 | public Set<Map.Entry<Double,Long>> entrySet() {
return new AbstractSet<Map.Entry<Double,Long>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TDoubleLongMapDecorator.this.isEmpty();
}
p... |
2c87e0f5-c76f-4d4f-9e9d-238e909e3947 | 2 | @Override
public void processOneGameTick(long lastFrameTime) {
entityManager = LLP.entityManager;
for (UUID u : entityManager.getAllEntitiesPossessingComponent(Oscillator.class)) {
Velocity v = entityManager.getComponent(u, Velocity.class);
Oscillator o = entityManager.getCom... |
631e731a-0cd5-48e6-8a12-2cf8b5ad2f94 | 2 | public LinkedList<User> getUsers(String username) throws SQLException {
LinkedList<String> select = new LinkedList<String>();
select.add("Username");
select.add("Name");
select.add("CreditCard");
select.add("Address");
select.add("Phone");
select.add("IsManager");... |
78a10643-f99a-4cb9-a565-10d4f1c98990 | 5 | public final JSONObject toJSON() {
try {
JSONObject json = new JSONObject();
json.put("version", JSON_VERSION);
JSONArray jsonGroups = new JSONArray();
for(PrivilegeGroup group: groups) {
try {
jsonGroups.put(group.toJSON());
}
catch(Exception e) {
onError(ERROR_JSON_INVALID_... |
0a11b2c1-e2f3-4f5b-a6db-de2dec3d37be | 1 | public void createConnection()
{
try
{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
//Get a connection
conn = DriverManager.getConnection(dbURL);
}
catch (Exception except)
{
except.printStackTrace();
... |
1ab50307-e012-4e40-b877-09ba13acecdc | 7 | private void deplacementAutre(int n,Tour depart, Tour arrivee, Tour intermediaire) {
// TODO Auto-generated method stub
boolean b= false;
System.out.println(n);
switch(n%6){
case 0 :
deplacer(depart,arrivee);
break;
case 1 :
... |
13cd6083-a820-42e7-b3b0-920985c6b999 | 0 | public void setGraph(City_Graph graph){
city_graph = graph;
} |
874d1b7b-f7ad-4a07-9314-7aebda654094 | 2 | public void changeCityOwner(int cityID, Owner newOwner){
City c = cityList.changeCityOwner(cityID, newOwner);
Iterator<Path> it = pathList.iterator();
while(it.hasNext()){
Path p = it.next();
if(p.containsID(cityID)){
p.updateCity(c);
}
}
} |
d958e488-b9b7-47d5-9661-b3099f8897e1 | 5 | public void onArrowShoot(EntityShootBowEvent e) {
if (Settings.world
|| WorldSettings.worlds.contains(e.getEntity().getWorld()
.getName())) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity();
if (Settings.arrowz
&& !PermissionHandler.has(p,
PermissionNo... |
6f9c9920-b8f2-4185-a949-e715db51f1c6 | 6 | public void paint(Graphics gr) {
Graphics2D g = (Graphics2D) gr;
g.setColor(Color.WHITE);
g.fillRect(0, 0, getWidth(), getHeight());
for (int i = 0; i < vp.size(); i++)
{
Packet pc=vp.get(i);
if(pc.shape==diffrentShapes.LINE)
... |
be5e1751-bb72-49ad-a2a0-3a76a5c9af9c | 6 | public String[] getAllowedParameters() {
String[] allowed;
switch (type) {
case GENERAL: allowed = new String[]{"locationsFile","linksFile"};
break;
case RANDOM: allowed = new String[]{"N","p"};
break;
case LINE: a... |
fac0a06a-11ce-46b1-9207-bcf3c25ff52b | 4 | public static void main(String[] args) {
System.out.println("It will not fail");
final ItWillFail itWillFail = new ItWillFail();
ExecutorService executorService =
Executors.newCachedThreadPool(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
t... |
ae2a0879-5629-421f-ae8d-25e871acabbf | 3 | @Override
public void validate(FacesContext arg0, UIComponent arg1, Object arg2)
throws ValidatorException {
// TODO Auto-generated method stub
try {
Float price = Float.parseFloat(arg2.toString());
if (price <= 0 || price >= 5000) {
throw new NumberFormatException();
}
} catch (NumberFormatExce... |
463cb54f-6240-4da1-9cb0-321dce7a2bef | 9 | public void menu() {
System.out.println(" ############################################### \n"
+ "#\t--------Welcome to Sokoban!-------\t#\n"
+ "#\t\t\t\t\t\t#\n"
+ "#\t\t1) Play game\t\t\t#\n"
+ "#\t\t2) Choose level\t\t\t#\n"
+ "#\t\t3) Help\t\t\t\t#\n"
+ "#\t\t\t\t\t\t#\n"
+ " ##########... |
ac593a07-bd04-4afa-b822-c417e785fc38 | 8 | static float lpc_from_data(float[] data, float[] lpc, int n, int m){
float[] aut=new float[m+1];
float error;
int i, j;
// autocorrelation, p+1 lag coefficients
j=m+1;
while(j--!=0){
float d=0;
for(i=j; i<n; i++)
d+=data[i]*data[i-j];
aut[j]=d;
}
// Generate ... |
54ff8d31-d956-4ca7-9c9a-2f1ab2ed58da | 8 | private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
... |
fa6bbfd7-41e7-42f2-ac27-eb3deb001a4a | 5 | String getHelpText() {
boolean letters = ((characters & LETTERS) == LETTERS);
boolean digits = ((characters & DIGITS) == DIGITS);
boolean ascii = ((characters & SYMBOL) == SYMBOL);
return "Allowed characters:"
+ (letters ? " letters" : " ")
+ (digits ? " digits" : " ")
+ (ascii ? " ascii" : " ")
... |
bffafad9-e31f-4ee6-a36a-a1ec00bc5f64 | 2 | public VuePirate(final int tailleCase, final int xGrille, final int yGrille, final int x, final int y, final String avatar)
{
super(tailleCase, xGrille, yGrille, x, y);
final String avatarPirate = (avatar == null) ? AVATAR_PIRATE : avatar;
try {
final File input = new File(avatarPirate);
this.imageElemen... |
b78a5dcb-d010-4915-85a6-f36e456ddec9 | 6 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() instanceof JButton)
{
// Controlla se il pulsante si trova nel pannello degli anni
String[] lista = {"1", "2"};
for(int i=0; i<lista.length; i++)
{
if (e.getSource().equals(... |
48cac5ed-5814-403b-8788-a73c2c2fe62b | 9 | private void validateRangeValues(Set<Byte> values, int range1, int range2, boolean inverted) {
if (inverted) {
if (range1 > range2) {
for (int value = 0; value < range2; value++) {
Byte b = Byte.valueOf((byte) value);
assertTrue("Byte is in range " + range1 + ":" + range2, values.contains(b));
v... |
68ade9e2-1762-4936-b1b5-fd3b8b5f4797 | 1 | Class getType(ClassLoader cl) throws ClassNotFoundException {
if (value == null)
throw new ClassNotFoundException("no type specified");
else
return loadClass(cl, value.getTypeName());
} |
183941b2-8b71-45bb-be8b-b8abf21dd9ca | 5 | @Override
public Graphics getGraphics() {
Graphics g = botBuffer.getGraphics();
/*
* Only draw if this canvas it the active one
*/
if (bot != null && bot.getWindow().getActiveBot() != null && bot.getWindow().getActiveBot() == bot) {
g.drawImage(gameBuffer, 0, 0, nu... |
7b311236-281a-4421-84d7-247240e5e0cd | 9 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int activeGroupId = 0;
int currentPage = 1;
int recordsOnPage = 10;
if (request.getParameter("group") != null) {
activeGroupId = Integer.parseInt(request.getPar... |
a7db6fdb-e3ec-4620-b113-15cc8acd2906 | 6 | private void makeDropTarget( final java.io.PrintStream out, final java.awt.Component c, boolean recursive )
{
// Make drop target
final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget();
try
{ dt.addDropTargetListener( dropListener );
} // end try
catch( ... |
50575c91-a1c5-4470-9be6-593ca3eeebc4 | 7 | @Override
public boolean availableToTheme(String abilityID, int theme, boolean publicly)
{
for(final String key : completeAbleMap.keySet())
{
if(completeAbleMap.get(key).containsKey(abilityID))
{
if(key.equalsIgnoreCase("All"))
return true;
final CharClass C=CMClass.getCharClass(key);
if((C... |
0be74a2b-c976-4d15-ae2c-ce6e292a0f14 | 8 | protected void drawAxis(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Stroke s = g2.getStroke();
g2.setColor(cline);
//g2.fillRect(0, 0, getWidth(), jLabelTitle.getHeight());
g2.setStroke(new BasicStroke(2));
// draw the 0 axis:
if (ymin <= 0 && ymax >= 0) {
... |
b137b019-9834-4039-becd-3066c99ad846 | 8 | public Object calculate(GraphModel g) {
double power = 1;
try {
Matrix A = g.getWeightedAdjacencyMatrix();
EigenvalueDecomposition ed = A.eig();
double rv[] = ed.getRealEigenvalues();
double iv[] = ed.getImagEigenvalues();
double maxrv=0;
... |
986d8221-93ce-45cf-97a6-28b4fcb26730 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof AbstractCarriage))
return false;
AbstractCarriage other = (AbstractCarriage) obj;
if (carriageNumber == null) {
if (other.carriageNumber != null)
return false;
} e... |
11b82b53-683d-49bd-9163-1fa0ac2b8d03 | 9 | private static void zeroize_matrix(int[][] matrix) {
int[] rows = new int[matrix.length];
int[] colums = new int[matrix[0].length];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[0].length; j++) {
if (matrix[i][j] == 0) {
row... |
603648e6-d452-409b-a978-3335f2e99053 | 6 | @Override
public void run()
{
//We start the game with main menu
mainMenuPanel.start();
this.add(mainMenuPanel);
while (true)
{
//while in menu
if(mainMenuPanel.getPlayClicked())
{
//Remove main menu from the applet
mainMenuPanel.setPlayClicked(false);
mainMenuPanel.en... |
ac7005c1-91b2-40aa-89cd-4cd88b260378 | 8 | void afterNextPacket() {
__s.get8();
/*
* if (first) { GWT.log("position:" + __s.getPosition() + " end:" +
* __s.getEnd()); byte[] b = new byte[__s.getEnd()];
* __s.copyToByteArray(b, 0, 0, b.length); GWT.log("first done: " +
* Base64.encodeBase64String(b)); }
*/
__type[0] = __s.get8();
/*
* ... |
ed3c2682-78eb-42bd-88f4-edc950f72129 | 1 | public void setPassengerMaxCount(int passengerMaxCount)
throws CarriageException {
if (passengerMaxCount >= 0) {
this.passengerMaxCount = passengerMaxCount;
} else {
throw new CarriageException("Maximum passenger count is under zero");
}
} |
bbe62ed5-49dc-4c07-96a6-6329cb0bc6bb | 0 | public JComboBox getCbLabo() {
return jComboBoxLabo;
} |
c2641fa2-480d-4c7b-9a99-c446a4f0c146 | 9 | private static List<AttackTransferMove> scheduleTransferMoves(BotState state, List<AttackTransferMove> transferMoves) {
List<AttackTransferMove> out = new ArrayList<>();
while (!transferMoves.isEmpty()) {
// search for the highest priority of all transfer moves
int highestPriority = 0;
for (AttackTransferM... |
ea16171d-9874-4a53-b282-2d989a98d58e | 8 | public synchronized void input(JSONObject o) throws ProtocolException, IOException {
if(!gotHandshake){
if(parseHandshake(o)){
try {
JSONObject successMessage = new JSONObject()
.put("message", "connect").put("status", true);
sendMessage(successMessage);
}
catch (JSONException e) {}
}
... |
b67edde0-3bd9-4492-b3f8-b4efcae697a1 | 9 | public static void addResponseHeaderContentType(
HashMap<String, String> responseCabs, String recurso) {
String extension = recurso.substring(recurso.lastIndexOf('.') + 1,
recurso.length());
// Some MIME types (this is just a sample)
if (extension.equals("html"))
responseCabs.put("Content-Type", "text/... |
11122d49-5b6d-4456-b4d4-b5881852c8b7 | 1 | public void firstThread() throws InterruptedException {
Random random = new Random();
for (int i = 0; i < 10000; i++) {
acquireLocks(lock1, lock2);
try {
Account.transfer(acc1, acc2, random.nextInt(100));
} finally {
lock1.unlock();
... |
6ae75aa4-eecd-487d-adef-97ed9625b50f | 3 | public Tile searchRow(int x){
int counter = 0;
while(Tiles.size() >= counter){
int tX = Tiles.get(counter).position.x;
if(x <= tX && (x + (2 * sideLength)) <= tX ){
return Tiles.get(counter);
}
counter++;
}
return new Tile... |
d234169b-86a0-4946-8547-b8cb931b62dd | 6 | static public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextCol... |
d998b263-0cdc-4ef5-b0a6-680d4146260d | 7 | protected int[] determineIndices(int numAttributes) throws Exception {
int[] result;
Vector<Integer> list;
int i;
StringTokenizer tok;
String token;
String[] range;
int from;
int to;
list = new Vector<Integer>();
// parse range
tok = new StringTokenizer(m_N... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.