method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2cc351e0-eb1f-4a04-8a01-d8fdbb4013c3 | 2 | public static AbstractModel getRandomRotatingGrid(int min, int max, int distance,AbstractModel result) {
// AbstractModel result = new ModelParallel();
Random r = new Random(1);
for (int i = min; i < max; i += distance) {
for (int j = min; j < max; j += distance) {
result.p.add(new Particle(0.5, Math.signum... |
83bec81a-77de-4c58-96bc-bf54e8a05114 | 6 | protected void fillMap() {
State[] states = automaton.getStates();
for (int i = 0; i < states.length; i++) {
Production[] prods = getProductions(states[i]);
if (prods.length == 0)
continue;
objectToProduction.put(states[i], prods);
for (int j = 0; j < prods.length; j++)
productionToObject.put(pr... |
2807bd71-f3ed-4984-824c-275038e0e069 | 5 | public static void main(String[] args) {
// create the object
DB db = new DB();
// open the database
if (!db.open("casket.kch", DB.OREADER)) {
System.err.println("open error: " + db.error());
}
// define the visitor
class VisitorImpl implements Visitor {
public byte[] visit_fu... |
428c8d1e-3384-4062-9056-edf461a1596d | 2 | @Override
public boolean add(int prenodeid,Object item) {
conn = new SQLconnect().getConnection();
String sqlcommand = "INSERT INTO `eventnodes` (`owner`, `description`, `display`) VALUES ('%s', '%s', '%s');";
if(item instanceof Eventnode)
{
Eventnode newitem = new Eventnode();
newitem = (Eventnode)item;... |
92b8ed2c-99f4-472b-813e-ce6677586b56 | 7 | public ClassModifierMask(int mask) {
super(mask);
final int enabledFlags =
((isInterface())? 1 : 0) +
((isAnnotation())? 1 : 0) +
((isEnum())? 1 : 0);
if (enabledFlags == 0) {
classType = ClassTypeModifier.CLASS;
}
else if (enable... |
01e5fae2-fed0-4c84-a27c-0b7b18b80b32 | 0 | public GroupJoinIterable(Iterable<T> outer, Iterable<TInner> inner, Selector<T, TKey> outerKeySelector, Selector<TInner, TKey> innerKeySelector, Joint<T, TInner, TResult> joint, Comparator<TKey> comparator)
{
this._outer = outer;
this._inner = inner;
this._innerKeySelector = innerKeySelector;
this._outerK... |
da0251df-2d8e-46d7-b13c-7045914c8b7d | 9 | @SuppressWarnings("static-access")
public void Update() {
newMouseX = mouse.mouseX;
newMouseY = mouse.mouseY;
double rotationSpeed = 0.025;
double walkSpeed = 1;
double xMove = 0;
double zMove = 0;
if(oldMouseX < newMouseX) {
turnRight = true;
}
if(oldMouseX > newMouseX) {
turnLeft = true;
... |
457761ad-0bac-430a-b9ae-3badf04c6dac | 2 | public float nextPolar() {
// If there's a saved value, return it.
if (haveNextPolar) {
haveNextPolar = false;
return nextPolar;
}
float u1, u2, r; // point coordinates and their radius
do {
// u1 and u2 will be uniformly-d... |
c80e0389-b0b6-4ab4-8d7d-d20437d1c0b5 | 7 | private byte getNextVal(int y, int x) throws TriedAllNumbersException
{
int i = 0;
for (; i < triedBoardVals[y][x].length; i++)
{
if (triedBoardVals[y][x][i] == NULL_VAL)
break;
}
if (i >= boardWidth)
throw new TriedAllNumbersException();
byte c = 0, triedVals[] = new byte[... |
a189c650-0966-48e5-9bf7-ceab58b7d2cd | 0 | public JTextField getjTextFieldCoefNot() {
return jTextFieldCoefNot;
} |
2bd26109-b9f5-47be-8d14-465af3f13299 | 9 | public Tile getTile(int x, int y) {
if (x < 0 || y < 0 || x >= width || y >= height) return Tile.voidTile;
if (tiles[x+y*width] == Tile.col_spawn_floor) return Tile.spawn_floor;
if (tiles[x+y*width] == Tile.col_spawn_grass) return Tile.spawn_grass;
if (tiles[x+y*width] == Tile.col_spawn_wall1) return Tile.spawn... |
12992060-5a9b-4e62-8351-05770385882b | 1 | public static void main(String argv[]) throws Exception
{
String sentence;
System.out.print("Connecting to port "+PORT+"... ");
Socket clientSocket = new Socket("localhost", PORT);
System.out.println("Connected");
ObjectOutputStream out = new ObjectOutputStream(clientSocket.getOutputStream());
Buff... |
af8a41d4-a768-4bc8-bffb-9e5bc4b187fc | 6 | private String offset (VarLocation v){
if (v.getDesc() instanceof DescriptorSimple){
DescriptorSimple d = (DescriptorSimple)v.getDesc();
if (isGlobal(d)){
return d.getNombre();
}
else{
return d.getOffset()+"(%ebp)";
... |
d2ab36c8-08ea-41c9-baab-f924d9af60d9 | 6 | public static boolean modifyEmployee(ManageEmployeePage empPage, Employee bean){
//check if phone number has changed
if(!empPage.getPhoneText().getText().equals(bean.getPhone())){
//check if the field formatted correctly
if(InputChecker.phone(empPage.getPhoneText().getText())){
bean.setPhone(empPage.getPh... |
129c5e7c-b11c-4a8b-a31d-2e1d26df7c21 | 8 | @Override
protected void Poll()
{
//if the robot re-oriented itself, cached sine and cosine values need to be re-calculated
double rotation = m_robot.GetTransformedData().GetRotation() + m_rotation;
if (Math.abs(rotation - m_cacheNetRotation) > PhysicsModel.EPSILON)
{
m_cacheNetRotation = rotation;
m_ca... |
09921c61-0884-45f2-a8d4-05cfefebb3f0 | 0 | public String getNews() {
return news;
} |
d099cac4-25b9-47fd-b091-0f46ea7ee04e | 7 | @Override
public ListNode RemoveNode(int data) {
ListNode previousNode = headNode;
Boolean found = false;
if ((headNode!=null) && (data == headNode.getData())) {
headNode = headNode.getNext();
found = true;
previousNode = null;
} else {
while ((previousNode !=null) && (previousNode.getNext()... |
b88f26b3-5f0b-41fb-b33d-b076da7dbf5e | 1 | public void generatePDF() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
document = new Document();
String inputFile = "RAPORT.html";
String outputFile = "RAPORT.pdf";
String url = new File(inputFile).toURI().toURL().toString();
OutputStream os = new ... |
113236d8-db5b-42e0-9843-990ecdb4d1e6 | 5 | private List<Class<?>> getClassesFromDir(String packageName)
throws ClassNotFoundException, IOException
{
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
assert classLoader != null;
String path = packageName.replace('.', '/');
Enumeration<URL> r... |
c8278b8f-4b3a-4af1-a4bc-919c87a75af9 | 3 | @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerChat(PlayerChatEvent evt) {
evt.setCancelled(true);
String message = evt.getMessage();
String msg = "";
int distance = say_distance;
if (message.toLowerCase().startsWith("yell ")) {
msg = ChatColor.RED
+ message.substring(5, messag... |
4ad2b24e-6bdc-49bf-afa5-6a6e32a0a7ce | 2 | public void log(String file, String data) {
File f = new File(logs, file + ".log");
try {
if (!f.exists())
f.createNewFile();
BufferedWriter out = new BufferedWriter(new FileWriter(f, true));
out.write(data + "\r\n");
out.flush();
out.close();
} catch (Exception ex) {
ex.printStackTrace();
... |
8ed00a5f-2842-4d8a-b063-05b6db2c6b22 | 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... |
c8c0c18a-ef59-4995-b519-2367c270db3d | 0 | @Override
public boolean isInfrastructure() { return false; } |
38fd9c7e-00be-4a02-98b9-d84b15241e37 | 0 | public static String createIAmOnlineMessage(String myName) {
JSONObject jsonMsg = new JSONObject()
.element( "code", "2" )
.element( "name", myName )
;
return jsonMsg.toString();
} |
3fd071cf-727f-4aaa-8232-9e1d6570a940 | 9 | private void generateCubeFaces() {
faces.clear();
for(int x = 0; x < length; x++) {
for(int y = 0; y < width; y++) {
for(int z = 0; z < height; z++) {
addCubeFace(new IntPoint(x, y, z), IntPoint.UP);
addCubeFace(new IntPoint(x, y, z), IntPoint.FRONT);
addCubeFace(new IntPoint(x, y, z), IntPoin... |
bc2af884-638a-4374-9e97-a54ea0c18b06 | 9 | int insertKeyRehash(char val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
923c3418-ad06-4e41-8d3c-c732c823de80 | 3 | public static String getWorld() {
try {
URL url = new URL("http://oldschool.runescape.com/slu");
String source = getPageSource(url);
return source.split("<a href=\\\"http://oldschool|.runescape.com/j1")[1];
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (InterruptedException e) {
... |
9837605d-4678-40c8-bf98-cbc042d8ceab | 7 | public static void heapsort(int n, int ra[]) {
int l, j, ir, i;
int rra;
l = (n >> 1) + 1;
ir = n;
for (;;) {
if (l > 1) {
rra = ra[--l];
} else {
rra = ra[ir];
ra[ir] = ra[1];
if (--ir == 1) {
ra[1] = rra;
return;
}
... |
52784037-ae0e-43f7-95a1-84ea720f2511 | 1 | public void visitNewMultiArrayExpr(final NewMultiArrayExpr expr) {
// new t[i][j][k]
// array-dim-of-t <= [new t[i][j][k]]
if (!expr.elementType().equals(TypeInference.UNDEF)) {
start(expr, expr.elementType().arrayType(expr.dimensions().length));
}
} |
f61a2536-e3d7-4486-8e71-f7ea48b4541d | 5 | public void initializeMonth(int monthID){
this.monthID = monthID;
if(monthID == 0){
for(int x = 0; x <= 30; x++ ){
dates.add(new Date(x));
}
} else if(monthID == 1){
for(int x = 0; x <= 31; x++ ){
dates.add(new Date(x));
}
}
else {
for(int x = 0; x <= 30; x++ ){
dates.add(new Date(x... |
e3146e84-88a6-42ed-8dc5-9d857238cf71 | 0 | public static void reset() {
Calculate.scenarios[0].clearGrid();
setGrid();
Calculate.scenarios[0].setLastLargest();
} |
f219a45e-a607-4365-9fe7-926962b49dcb | 6 | public void start() {
console.println("Welcome");
while(true) {
String author, title, libraryCaseCode;
int floor, shelf;
console.print("> ");
String cmd = console.readLine();
switch(cmd) {
case "add":
console.println("BOOK INFORMATION");
console.print("Author: ");
author = cons... |
264e8387-3061-41c5-adde-38c999c043c9 | 1 | public void testIsAfter_LocalDateTime() {
LocalDateTime test1 = new LocalDateTime(2005, 6, 2, 10, 20, 30, 40);
LocalDateTime test1a = new LocalDateTime(2005, 6, 2, 10, 20, 30, 40);
assertEquals(false, test1.isAfter(test1a));
assertEquals(false, test1a.isAfter(test1));
assertEqual... |
823a117c-4c6c-414c-867f-032078129729 | 7 | public List<String> stub(List<String> storyLines)
{
Set<String> usedStoryTags = new TreeSet<String>();
List<String> methods = new ArrayList<String>();
String lastTag = null;
for (String line : storyLines)
{
String lowerCaseLine = line.toLowerCase();
Stri... |
3e0a021b-dc79-4f5c-b7ee-58417e895bb1 | 0 | public void addPieceOnField(char file, char rank, Piece piece) {
this.getField(file, rank).addPiece(piece);
} |
5235d33c-d440-4213-807e-93ca9e0a41e6 | 8 | public void testValidEdge6() {
try {
TreeNode tree = new TreeNode("tree", 3);
TreeNode subtree1 = new TreeNode("spare-subtree1");
TreeNode subtree2 = new TreeNode("spare-subtree2");
tree.setBranch(new TreeNode[]{ subtree1, subtree2, new TreeNode("subtree")});
... |
2bc13a74-ce2f-4370-97aa-a83b6ecd762a | 9 | public Settings(final MainWindow mainWindow, final ExecutorService exec,
final JTabbedPane jTabbedPane) {
validation = new Validation();
GridBagLayout gbl_panel = new GridBagLayout();
gbl_panel.columnWidths = new int[] {30, 30, 30, 30, 30, 30, 30, 30, 0, 30, 30, 46, 0, 30, 30, 30, 30, 30, 230};
gbl_panel.row... |
70e4eedc-c1ce-469a-a8a9-ccfc9d892bc7 | 3 | public synchronized void actualiza(long tiempoTranscurrido){
if (cuadros.size() > 1){
tiempoDeAnimacion += tiempoTranscurrido;
if (tiempoDeAnimacion >= duracionTotal){
tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal;
indiceCuadroActual = 0;
}
while (tiempoDeAnimacion > getCuadro(ind... |
b37cb961-15f5-437a-be53-509add68767d | 2 | public Runtime(){
if(Configuration.useMap){
try {
map = new Map("src/"+Configuration.userProjectDir+"/"+Global.projectName+"/"+Configuration.map);
} catch (FileNotFoundException e) {
Main.fatalError(e);
}
}
} |
7b48756e-aa1e-4fc5-bc94-bda71d7898dd | 4 | @Override
public void run() {
long interval = 50;
while(true){
long now = System.currentTimeMillis();
// System.out.println(now);
if(editor.needsHighlight){
if(now - editor.lastEdited >= interval){
editor.highlightSyntax();
}
}
try {
sleep(interval);
} catch (InterruptedException ... |
3d2e10db-664c-4498-ab48-a55d311defe4 | 4 | public Double getColTotal(int position) {
Double total = 0d;
if (position < Cols()) {
DMemeList tmp = copyColumn(position);
if (tmp.size() > 0) {
for (DataMeme dm : tmp) {
Double i = dm.asDouble();
if (i != null) { ... |
d1b8bba6-1da1-45fe-af5c-fc8059e75503 | 9 | public JoinMenuPanel(final MainFrame frame) {
final JLabel error = new JLabel();
this.addLabel(frame, "HostnameLabel");
final JTextArea hostName = new JTextArea(1, 30);
this.addComponent(hostName);
this.addLabel(frame, "PortLabel");
final JTextArea port = new JTextArea(1, 30);
this.addComponent(port)... |
3b71431b-0599-4558-b6a9-54229667784a | 6 | @Test
public void testDrawSoul() {
SoulTomb deck = new SoulTomb();
Soul card;
for (int i=0; i<5; i++){
card = deck.drawSoul();
assertTrue(card.getIndex()==0 || card.getIndex()==1 || card.getIndex()==2);
switch(card.getIndex()){
case 0:
assertTrue(card.getName().equals("Lesser Soul"));
break;
... |
95538fa0-2514-4e77-9580-da194d51855f | 6 | public static Object[] toObjectArray(Object source) {
if (source instanceof Object[]) {
return (Object[]) source;
}
if (source == null) {
return new Object[0];
}
if (!source.getClass().isArray()) {
throw new IllegalArgumentException("Source is not an array: " + s... |
9d46c5e8-5d41-460c-9388-e4a1f30a00e6 | 5 | private final boolean message_ready ()
{
// Read new message. If there is none, return false.
// Note that new state is set only if write is successful. That way
// unsuccessful write will cause retry on the next state machine
// invocation.
if (msg_source == nul... |
2ee2d908-1335-43ae-9cec-df67deead33a | 8 | public static boolean fileprocess(String downloadpath, String filepath, String []paras, String sn){
int errorcode=0;// print error code in the final output file;
int errornum=5;
String result="";
File downloadfile = new File(downloadpath+"\\ddr_test.txt");
File outputfile = new File(filepath);
... |
43323d64-2c4d-4e68-8dc2-f39ba24797f8 | 1 | public Rectangle2D getBounds() {
if (needsRefresh)
refreshCurve();
Rectangle2D b = curve.getBounds();
Area area = new Area(bounds);
area.transform(affineToText);
b.add(area.getBounds());
return b;
} |
bdd54a95-5779-4d2f-be3c-6819962268c4 | 5 | public int[] solvingLinearComparisons(int a, int b, int n) {
if (a < 0) a = a + n;
if (b < 0) b = b + n;
int d = gcd(a, n);
int[] result = new int[d];
if (d == 1) {
result[0] = (getInverseElement(a, n) * b) % n;
return result;
} else {
... |
24a63f76-3722-4e27-af68-24bf74ca451e | 8 | public void move(){
x += xd;
y += yd;
if(destinationX > xStart){
if(x >= destinationX){
xd = 0;
xStart = x;
}
}else if(destinationX < xStart){
if(x <= destinationX){
xd = 0;
xStart = x;
}
}
if(destinationY > yStart){
if(y >= destinationY){
yd = 0;
yStart = y;
}
}e... |
669f6e41-a34e-4944-b4ec-079530026a41 | 4 | public static boolean validIP(String ip) {
if (ip == null || ip.isEmpty()) return false;
ip = ip.trim();
if ((ip.length() < 6) & (ip.length() > 15)) return false;
try {
Pattern pattern = Pattern.compile("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-... |
bd4cd3ec-368d-4f16-9e1d-56b9883c1a6a | 4 | @Override
public void keyReleased(KeyEvent event) {
if(event.getKeyCode()== KeyEvent.VK_UP){
GameManager.getPlayer().get(0).setState(StateActor.NONE);
}
if(event.getKeyCode()== KeyEvent.VK_DOWN){
GameManager.getPlayer().get(0).setState(StateActor.NONE);
}
if(event.getKeyCode()== KeyEvent.VK_RIGHT){... |
095ad544-0aaa-499c-bc74-18104d6cf6ad | 9 | public List<ClassSymbol> compile(List<String> filenames,
Map<String, String> origOptions,
ClassLoader aptCL,
AnnotationProcessorFactory providedFactory,
java.util.Set<Class... |
74ed6384-3c5f-47af-a8a3-3da1b2a00bc0 | 5 | @Override
public void run() {
Document doc;
Skill skill;
try {
doc = tidy.parseDOM(url.openStream(), null);
XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression expr = xpath.compile("//div[@id = 'bodyContent']/table/tr/td/div/div/a/@href");
NodeList nodes = (NodeLi... |
d23b5bb9-ee4d-4d84-872d-9cf132dc9686 | 0 | @Override
public Hashtable<Short, Integer> getDistribution() {
// TODO Auto-generated method stub
return null;
} |
0604fd4d-9ff9-480a-81c7-a5c9cf26af3e | 0 | public String getName() {
return name;
} |
f67e192b-1509-4d3a-bf2f-c510aa46f278 | 7 | public RangedWeapon constructRangedWeapons(int i, LivingThing l) {
if (i == 0) {
String name = "Basic Bow";
RangedWeapon baseBow = new RangedWeapon(true, Color.YELLOW, l, 15, 1, name);
Damage baseBowDamage = new Damage(3, 0, 0, 0, 0, 0, 0, 0, false, false, false);
baseBow.setDamage(baseBowDamage);
retu... |
5dd01373-1f10-456f-9feb-79e6234b4ff3 | 7 | public Iterator getTasksItems(String parent)
{
// child tasks iterator
ArrayList<String> taskItems = new ArrayList<String>();
if ( (parent == null) || (parent.equals("")) )
{
// no parent specified.. return parents at highest level
Iterator taskIterat... |
e8a68b20-5c23-456d-9fa8-d7c6c949b102 | 0 | public int outdegree(int v) {
validateVertex(v);
return adj[v].size();
} |
d0eda51e-c3f8-4d1b-b753-44345cfa686f | 1 | @Override
public void mouseClicked(int button, int x, int y, int clickCount) {
// TODO Auto-generated method stub
if(button==1)
{
//if the location is over the button to start the game
}
} |
b26151c9-5862-4659-9e94-5eb3bae2a633 | 3 | public InputFile(String fname) throws Exception {
try {
in = new BufferedReader(new FileReader(fname));
// Other code that might throw exceptions
} catch (FileNotFoundException e) {
System.out.println("Could not open " + fname);
// Wasn't open, so don't close it
throw e;
} catch (Exception e) {
... |
d4e78e9c-a4da-47c9-8284-51c4b1afa183 | 5 | protected void recursiveBalance(TreeNode currentNode) {
setBalance(currentNode);
int balance = currentNode.balance;
if (balance == -2) {
if (height(currentNode.left.left) >= height(currentNode.left.right)) {
currentNode = rotateRight(currentNode);
} else {
currentNode = doubleRotateLeftRight(curre... |
144bec98-357b-4ccd-ad9c-2b4b41749783 | 9 | public void run() {
int timesFailed = 0;
try {
while (shouldRun()) {
try {
listen();
timesFailed = 0;
} catch (XMLStreamException e) {
timesFailed++;
if (shouldRun && timesFailed ... |
47ddc543-f077-46b9-a63f-40b976864633 | 3 | public PropertySheet(Class[] types, Object[] values)
{
this.values = values;
editors = new PropertyEditor[types.length];
setLayout(new FormLayout());
for (int i = 0; i < values.length; i++)
{
JLabel label = new JLabel(types[i].getName());
add(label);
... |
6b037e1e-d87a-4395-90a9-74b30e225c16 | 1 | private boolean jj_3_63() {
if (jj_scan_token(DIVIDE)) return true;
return false;
} |
6da87971-baa5-40fa-a5ba-2c6d2bae97ed | 2 | public GameComponent getComponent(String key){
for (GameComponent component:components){
if (component.getName().equals(key)){
return component;
}
}
new RugieError(this, "Could not find gameComponent: " + key).show();
return new GameComponent("MENO... |
b878faa0-7842-4699-b4f3-0c1489dbe0be | 4 | public void extractConfig(final String resource, final boolean replace) {
final File config = new File(this.getDataFolder(), resource);
if (config.exists() && !replace) return;
this.getLogger().log(Level.FINE, "Extracting configuration file {1} {0} as {2}", new Object[] { resource, CustomPlugin... |
e2f325ef-6c92-4d55-919f-c3cd1e35b583 | 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... |
ceb74d26-8f73-42ae-b8bb-551c6ff2df11 | 8 | public void endTurn() {
if (!requireOurTurn()) return;
// Show the end turn dialog, or not.
if (freeColClient.getClientOptions()
.getBoolean(ClientOptions.SHOW_END_TURN_DIALOG)) {
List<Unit> units = new ArrayList<Unit>();
for (Unit unit : freeColClient.getMyP... |
39306c14-55ea-45ac-b8a2-838b3640bdcb | 1 | private void calculateGravity(BlackHole bh) {
double dx = x - bh.getX();
double dy = y - bh.getY();
double distance = Math.sqrt(dx * dx + dy * dy);
if (distance != 0) {
gravity = (FRAME_WIDTH * 1.0 / 20) / distance;
}
//System.out.println("dist: " + distance +... |
43ddf264-67ec-46f3-9f60-fe6cad1d1af7 | 9 | public static Image readImgFromFile(String sFile, Component drawTarget) {
if (sFile == null || !new File(sFile).exists()) return null;
File img = new File(sFile);
Image awtImg = null;
try {
if (sFile.substring(sFile.length() - 4).equalsIgnoreCase(".gif")) {
// fix for bug when delaytime is 0
Image... |
d8a1dd3e-6262-4a37-ab87-c27731376a99 | 3 | @DBCommand
public boolean stop(CommandSender sender, Iterator<String> args) {
if(!sender.hasPermission("db.stop")) {
sender.sendMessage(RED + "You don't have permission to use this command!");
return true;
}
if(!args.hasNext()) {
sender.sendMessage("Not en... |
2ae4924c-ad60-422f-ae70-2e34b1828712 | 5 | public void removeUserFromChannel(Client client, String channel){
int index = -1;
for (int i=0;i<channelList.size();i++){
if (channelList.get(i).getChannelName().equals(channel)){
index = i;
}
}
if (index == -1){
log.writeErr("... |
eb9d6b7a-6258-4ae1-b366-4dab64e05ab6 | 6 | private void copyRGBtoABGR(ByteBuffer buffer, byte[] curLine) {
if(transPixel != null) {
byte tr = transPixel[1];
byte tg = transPixel[3];
byte tb = transPixel[5];
for(int i=1,n=curLine.length ; i<n ; i+=3) {
byte r = curLine[i];
by... |
9d34547a-f9ce-4aab-b995-5117b0a4c58a | 4 | public void move() {
//angle=Math.random()*Math.toRadians(360);
double speed = .3;
boolean canmove=false;
double vx = Math.cos(angle) * speed*10;
double vy = Math.sin(angle) * speed*10;
for (int q=0;q<objects.size();q++){
if(!(objects.get(q) instanceof BASE))
... |
04e85ec5-7685-49c2-89c5-aeaae4f1a972 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Item item = (Item) o;
if (Double.compare(item.cost, cost) != 0) return false;
if (id != item.id) return false;
if (Double.compare(item.... |
0281397f-fb7a-4179-b987-fa7278f9b35f | 7 | static public void main(String args[]) throws Exception {
if (args.length != 1) {
System.err.println("Usage: java UseScatterGather port");
System.exit(1);
}
int port = Integer.parseInt(args[0]);
ServerSocketChannel ssc = ServerSocketChannel.open();
InetS... |
a2af4d7e-3ef9-4b27-b2b8-6c9fb6f033ed | 3 | private boolean jj_3R_46() {
if (jj_scan_token(PRINT)) return true;
if (jj_3R_49()) return true;
if (jj_scan_token(SEMICOLON)) return true;
return false;
} |
25e4ffd2-cd69-4b1a-bc99-7193b368d835 | 7 | public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "motd", false)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
Player player = (Player) sender;
String[] motd = plugin... |
081d7d66-e712-4df0-9976-f6fde10fadeb | 5 | LoginFrame()
{
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screen = kit.getScreenSize();
scr_w = screen.width;
scr_h = screen.height;
this.setLocation(scr_w/2 - 150, scr_h/2 - 100);
setTitle("Login...");
setSize(300, 200);
loggin = new JLabel("Loggin:");
loginTextField = new JTextField(13)... |
48353e7e-4e42-4b1b-bba1-ba78a5b5eddc | 4 | public String assembleTex(AssemblerType at) {
// auto-prepend headers
// assembler only handles the individual stories
String header = FiclyAssembler.texheader;
if (title != null) {
// set title field, if present
header = header.replace("===TITLE===", title);
... |
1c1253ed-59d8-4aae-90cc-54fad9efbe15 | 8 | public IndexedModel toIndexedModel()
{
IndexedModel result = new IndexedModel();
IndexedModel normalModel = new IndexedModel();
HashMap<OBJIndex, Integer> resultIndexMap = new HashMap<OBJIndex, Integer>();
HashMap<Integer, Integer> normalIndexMap = new HashMap<Integer, Integer>();
HashMap<Integer, Integer> i... |
294729b8-c17c-4ef9-8627-f566f0c93168 | 2 | public boolean login(String username, String password) {
try {
Authentication authenticate = authenticationManager
.authenticate(new UsernamePasswordAuthenticationToken(
username, password));
if (authenticate.isAuthenticated()) {
SecurityContextHolder.getContext().setAuthentication(
authen... |
4e08bf6b-0c6e-41b5-8e48-177f1cb12bcb | 2 | private List<DateParser> obtainDateParsers(Monitor m) throws CannotProduceDateParser {
List<DateParser> parsers = new ArrayList<DateParser>();
try {
for (String p: m.getDateParsers().getParser()) {
parsers.add(ClassEx.createInstance(DateParser.class, p));
}
... |
37b58037-ef30-4aa9-8276-0357b27e8285 | 9 | protected void scanHexNumber() throws EOFException {
nextChar();
Type type = Type.INT_LITERAL;
while (isHexDigit(ch) || ch == '_') {
if (ch == '_') {
nextChar();
continue;
}
addChar(ch);
if (index >= stream.length) {... |
d6879690-ede0-4bed-92dd-7deb2f4bf180 | 0 | public void updateGrid(World w, Gameplay g) {
world = w;
panel.updatePanel();
//content = frame.getContentPane();
//content.add(panel);
matchLabel.setText("Match " + match + " of " + totalMatches);
worldLabel.setText("World " + world.worldName);
redBrainLabel.setT... |
dd2c199f-0582-47b0-9c72-d271ac0d812c | 8 | final void method3707(Rectangle[] rectangles, int i, int i_631_,
int i_632_) throws ToolkitException {
if (canvas == null
|| ((SoftwareToolkit) this).abstractImageFetcher == null)
throw new IllegalStateException("off");
try {
Graphics graphics = canvas.getGraphics();
for (int i_633_ = 0; i_63... |
cc8931d8-f462-48d0-af84-dd82ff8830de | 3 | private void getBlocks(String line, BufferedReader br)
/*
* b <blockName> <x1>-<y1> (x2>-<y2> ..... .... #
*
* Each <blockName> will be stored with a unique name (<blockName> +
* blocksCounter) along with the image stored in Images/<blockName>.gif
*/
{
boolean reachedEnd = false;
StringTokenizer tokens... |
d9268665-661d-4716-87cb-d75b9df7c4d7 | 6 | public void stateChanged(ChangeEvent e) {
SpinnerNumberModel model = (SpinnerNumberModel) ((JSpinner) e
.getSource()).getModel();
int value = model.getNumber().intValue();
boolean increase = (value > oldSpinnerValue) ? true : false;
oldSpinnerValue = value;
int m... |
7acb4a41-6fbd-45aa-a9a7-4382ac1fb4a8 | 0 | @Basic
@Column(name = "FUN_AAAA")
public int getFunAaaa() {
return funAaaa;
} |
0e9abe73-1a05-4956-90f4-f0437fbe6bda | 4 | public static void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) {
throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative");
}
if (semiMinorAxis < 0) {
throw new IllegalArgumentException("ell... |
001795f7-d5df-4dcd-999f-d59449af1bb1 | 6 | void getScore(ArrayList<Frame> frameList) {
for (int i = 0; i < 8; i++) {
firstScore = frameList.get(i).countPins(0);
secondScore = frameList.get(i).countPins(1);
firstBonusScore = frameList.get(i + 1).countPins(0);
secondBonusScore = frameList.get(i + 1).countPin... |
5e881f39-014a-4b85-9988-d4d5df68c94a | 7 | public void InstrLoad() throws ParseException {
switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
case LDI:
InstrLDI();
break;
case LD:
InstrLD_variant();
break;
case LDD:
InstrLDD();
br... |
3172c3ba-1ada-4bf0-81be-559be1d9848c | 0 | public int getBookedSeats() {
return bookedSeats;
} |
f75f6478-cbc5-4270-a089-033b49984e65 | 7 | public void updateEffects()
{
for (int var1 = 0; var1 < 4; ++var1)
{
for (int var2 = 0; var2 < this.fxLayers[var1].size(); ++var2)
{
EntityFX var3 = (EntityFX)this.fxLayers[var1].get(var2);
var3.onUpdate();
if (var3.isDead)
... |
2b952f8e-d01a-4bd7-8c92-4fb6d374028a | 9 | protected boolean checkYObstacle(CommonObject so, double time, int halfOfWidth) {
if ((this.currentCoord.getY() + this.currentHeight + currentVerticalSpeed * time >= so.getCurrentCoordinates().getY())
&& (this.currentCoord.getY() + this.currentHeight <= so.getCurrentCoordinates().getY())
... |
716d47bd-02ef-4370-b71c-9ee8193325b0 | 3 | public GatewayDevice getValidGateway() {
for (GatewayDevice device : devices.values()) {
try {
if (device.isConnected()) {
return device;
}
} catch (Exception e) {
}
}
return null;
} |
707bab21-d9a9-470b-ac6f-cd0f66b6f7cd | 8 | public static double distance(TreeBiPartitionInfo t1, TreeBiPartitionInfo t2, DistanceNorm norm) {
double d = 0.0;
for( BiPartiotionInfo k : t2.all.values() ) {
k.has = false;
}
double din = 0;
double dout = 0;
for( Map.Entry<FixedBitSet, BiPartiotionInfo> k ... |
667e1fa6-81c0-4d18-b445-74a1f5ad29bf | 0 | protected Transition initTransition(State from, State to) {
return new PDATransition(from, to, "", "", "");
} |
5ea80b55-01a1-4245-b32c-0eb3a25df005 | 6 | public double weightedHarmonicMean_as_double() {
if (!weightsSupplied) {
System.out.println("weightedHarmonicMean_as_double: no weights supplied - unweighted mean returned");
return this.harmonicMean_as_double();
} else {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weightingOpti... |
8b1349d3-2317-45e3-ab25-690553794acb | 6 | public void listenerInterromprePartie()
{
vuePartie.getPaneldroitrevoir().getX_white().addMouseListener(new MouseListener(){
@Override
public void mouseClicked(MouseEvent arg0) {}
@Override
public void mouseEntered(MouseEvent arg0) {}
@Override
public void mouseExited(MouseEvent arg0) {}
@Overr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.