method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
235ea6eb-0f5c-4e08-ba8f-5ceb8c4c007f | 8 | public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
int type;
if (commandLabel.equalsIgnoreCase("unban")) {
if (sender.hasPermission(SeruBans.UNBANPERM) || sender.isOp()
|| (!(sender instanceof Player))) {
... |
23885ccb-ad0e-4c11-be76-de4e0dd415cc | 4 | @Override
public boolean activate() {
return (Inventory.isFull() && !Widgets.get(13, 0).isOnScreen()
&& !Constants.ESCAPE_AREA.contains(Players.getLocal())
&& (Constants.VARROCK_WEST_BANK_AREA.contains(Players.getLocal())
|| Constants.VARROCK_EAST_BANK_AREA.contains(Players.getLocal())));
} |
0e1c56a4-8f11-4c9e-929e-cb1f3889af03 | 9 | private IRubyObject log(Level level, ThreadContext ctx, IRubyObject[] args, Block block) {
IRubyObject nil = ctx.getRuntime().getNil();
IRubyObject message = args.length == 1 ? args[0] : null;
if (block.isGiven()) {
if (isSufficientLevel(level)) {
message = block.yield(ctx, nil);
}
}... |
621cf5e4-2c6a-4ae3-8e90-79831f72479d | 3 | public LibraryBean[] searchInBooleanMode(String query){
LinkedList<LibraryBean> list = new LinkedList<>();
try {
PreparedStatement statement = connection.prepareStatement(SEARCH_IN_BOOLEAN_MODE);
statement.setString(1, query);
statement.setString(2, query);
ResultSet resultSet = statement.executeQuery()... |
709cdef5-0176-4e4f-86f7-d5746bfa7794 | 4 | @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
leftPressed = true;
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
rightPressed = true;
}
if (e.getKeyCode() == KeyEvent.VK_N) {
nPressed = true;
}
if (e.getKeyCode() == K... |
ea9d865e-7a27-4111-b684-ab6470c1cd37 | 0 | public static String GetTimeString() {
SimpleDateFormat sdf = new SimpleDateFormat("MMddHHmmss");
return sdf.format(new Date());
} |
cfa7bcf0-9f69-42cf-850e-4cba6e80ac0c | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final RequisicaoModel other = (RequisicaoModel) obj;
if (!Objects.equals(this.pmProjeto, other.pmProjeto)) {
... |
28e07889-2d08-4594-b4aa-bb7e00aad1fc | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
f7804276-6656-4cd1-9e4a-2e3b06a7b6d5 | 8 | protected Field[] getFields(Object obj) {
ArrayList<Field> allFields = new ArrayList<Field>();
ArrayList<Class<?>> classTower = this.getClasses(obj);
// Printout to observe the shown packages
//if(logger.isDebugEnabled())
// logger.debug("Object " + obj.toString() + "has " +
// classTower.size() + " clas... |
4f0884b1-8c0f-4204-a203-eeb455d86429 | 9 | private int maxMove(Board prev, int depth, int alpha, int beta)
{
moves++;
if(depth >= maxDepth) return prev.getScore(); // exceeded maximum depth
int maxScore = MIN_SCORE;
Board b = new Board(prev);
for(int j = 0; j < size; j++)
{
for(int i = 0; i < size; i++)
{
if(b.move(i, j)... |
4f944389-b4ee-4a3c-a37e-66726fe3a587 | 7 | public void mouseClicked(MouseEvent e)
{
if (isDrawing && e.getButton() == MouseEvent.BUTTON3){
Polygon p = generatePolygon();
polygons.add(p);
polygonsWithColors.put(p, color);
polygonLineCreate();
}
Set<Map.Entry<String, Boolean>> visibleSet =... |
f41837e0-745a-4fb3-8184-48d2abb3533d | 5 | @Override
public void exec(String channel, String sender, String commandName, String[] args, String login, String hostname, String message) {
String fmlMessage = "";
try {
URL url = new URL("http://rscript.org/lookup.php?type=fml");
BufferedReader bReader = new BufferedReader... |
affd78d1-b452-4bfe-91d8-75a34fe31aab | 2 | public Properties getProperties() {
if (properties == null) {
InputStream stream = TestSettings.class.getResourceAsStream("/usecases.properties");
try {
properties = new Properties();
properties.load(stream);
} catch (IOException e) {
... |
7a7721cc-8aa9-4b31-b3a2-f18620527174 | 0 | public String getFullName() {
return fullNameText.getText();
} |
6f4dadd0-8c24-47a5-8213-3e8c42e4e598 | 4 | public void filter(final String search)
{
RowFilter<TableModel, Object> rf = new RowFilter<TableModel, Object>()
{
@Override
public boolean include(RowFilter.Entry<? extends TableModel, ? extends Object> entry)
{
final MediaElement elt = (MediaElement) entry.getModel().getValueAt((In... |
fd1faaca-441b-4bfe-a011-d977a99bba0b | 8 | public String toString()
{
PrintfFormat fmt = new PrintfFormat(cellFormat);
StringBuffer buf = new StringBuffer();
// line 1 - a ruler
buf.append(" "); buf.append(" ");
for (int i=1; i<=s.length(); i++) buf.append(fmt.sprintf((double)i));
buf.append("\n");
... |
2d11a52d-3a6d-411f-bdc5-617acd54bce1 | 5 | private String getEditorHtml(WikiContext context, String name) throws IOException {
String template = null;
try {
// NOTE: There is CSS in this template. Keep it in sync with the add_header.css file.
//
// IMPORTANT: Only multipart/form-data encoding works in plugins.... |
aebc2ea9-66a0-4007-9586-08f3472b4ade | 0 | public Item SwapHeadArmor(Item willBeSwappedItem) {
return headArmorSlot.swap(willBeSwappedItem);
//return false;// swap failed
} |
f2e22754-00ae-4300-aeb0-a9bc0407e945 | 3 | private boolean isHeader(Element el) {
if(el == null) return false;
return el.tagName().equals("h2") || el.tagName().equals("h3") || el.tagName().equals("h4");
} |
e488fd72-1963-4fe1-a15c-9b4776a4a406 | 1 | public void listarPesqGerente() {
UsuarioBO Gerente = new UsuarioBO();
try {
tbResultadoBusca.setModel(DbUtils.resultSetToTableModel(Gerente.pesquisaGerente(txtCampoBuscaGerente.getText())));
} catch (SQLException ex) {
}
} |
6e49e062-62f1-4721-a61d-a81cd89af168 | 5 | private static int stringSize(long num, int radix) {
int exp;
if (radix < 4)
{
exp = 1;
}
else if (radix < 8)
{
exp = 2;
}
else if (radix < 16)
{
exp = 3;
}
else if (radix < 32)
{
exp = 4;
}
else
{
exp ... |
1a724fc6-3c54-4d48-b0db-75f4287fa877 | 7 | public int compareMove(Move otherMove) {
if(this.equals(otherMove)) {
return 0;
} else {
switch (this) {
case ROCK:
return (otherMove == SCISSORS ? 1 : -1);
case PAPER:
return (otherMove == ROCK ? 1 : -1);
case SCISSORS:
return (otherMove... |
3b9ce753-7537-4b00-9c9d-a661b0767b27 | 1 | public static int[] fillRandomInt(int length, int min, int max, int count) {
int[] array = new int[length];
for (int i = 0; i < array.length; i++) {
array[i] = (int) random(min, max, count);
}
return array;
} |
bfd0f13f-ff36-410f-b242-ecc2923e0a34 | 3 | public boolean editEvidence(Evidence e) {
Element evidenceE;
Evidence evidence;
boolean flag = false;
for (Iterator i = root.elementIterator("evidence"); i.hasNext();) {
evidenceE = (Element)i.next();
if (evidenceE.element("id").getText().equals(e.getId())) {
evidenceE.element("title").setText(e.getTi... |
7bdfcf3e-764b-4656-8cbc-d3be71d91753 | 6 | public static void main(String[] args){
while(!Plateau.boucleJeu){ // Tant que le jeu n'est pas fini
Mot m=new Mot();
Fenetre f=new Fenetre();
Chrono c=f.getChrono();
Plateau p=f.getPlateau();
int essais=0;
m.init(f);
while(!Plateau.boucleMots){ // Tant que le mot n'est pas trouve
int iCh... |
9c4dd9b1-d161-49ec-8fd5-e832c0e5b857 | 8 | private boolean add(ADD request){
if(request.username.matches("^.*[^a-zA-Z0-9 ].*$"))
return false;
byte[] salt = new byte[AuthServer.saltLength];
new SecureRandom().nextBytes(salt);
String query_create = "INSERT INTO User values('" + request.username + "','" + request.name +
"', 0x" + Misc.getHexBytes(H... |
6f0b8439-7e8f-4671-81d1-95779a20e01c | 8 | private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
String userName = txtFieldUserName.getText();
char[] pw = txtFieldPassword.getPassword();
String password = new String(pw);
String errorMessage = "";
if(userName... |
47a85fc8-c76d-46ee-a87d-619a75d42191 | 0 | @Override
public Point getDirection() {
return direction;
} |
03f7d0b0-f8bd-4cd4-8c5d-06d2a4c243a7 | 7 | private void removeHelper(RedBlackNode<T> toRemove) {
if (toRemove.isLeaf()) {
if (toRemove.getColor() == Color.RED) { //removing a red leaf is never a problem
delete(toRemove);
} else { //it is a black leaf
if (toRemove == root) { //there is only one node... |
b6a46885-6141-4d5c-9a2b-e11f1360cd98 | 7 | public void createGoodsMenu(final GoodsLabel goodsLabel) {
final Goods goods = goodsLabel.getGoods();
final InGameController inGameController = freeColClient.getInGameController();
ImageLibrary imageLibrary = parentPanel.getLibrary();
this.setLabel("Cargo");
JMenuItem name = new ... |
ab42e3db-da14-4078-b848-a6907f1bd6fe | 5 | public ArrayList<Entity> getSolidProps(Entity entity) {
if(noChildren()) {
ArrayList<Entity> tempProps = new ArrayList<Entity>();
for(int x = 0; x<props.size(); x++) {
if(props.get(x).isSolid()) {
tempProps.add(props.get(x));
}
}
return tempProps;
//return props;
} else {
ArrayList<En... |
8ea8b0d4-6445-429a-a018-e388c04a3546 | 3 | public static <E extends Enum<?>> E caseInsensitiveValueOf(E[] enumValues, String constant) {
for (E candidate : enumValues) {
if(candidate.toString().equalsIgnoreCase(constant)) {
return candidate;
}
}
throw new IllegalArgumentException(
String.format("consta... |
0521f6fe-c50d-4914-bddc-21a4396ebbab | 7 | public static Rule_LF parse(ParserContext context)
{
context.push("LF");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
int s1 = c... |
41bba3ab-0fee-4b61-9459-0ac9fc0fbb4f | 4 | @Override
public void mouseReleased(MouseEvent mouse) {
Tool tool = controls.getTool();
if (selectedMessage != null) {
selectedMessage.selected = 0;
selectedMessage = null;
noClick = true;
}
if (tool.compatible(ToolType.create) && tool.compatible(T... |
2e9f8b61-5df6-4e7f-8e3f-6ed19fbb1d79 | 5 | private boolean checkIfTargetNearby() {
try {
if (getRatSurrounding().get(Direction.NORTH).isTarget()) {
dir = Direction.NORTH;
goForward();
return true;
} else if (getRatSurrounding().get(Direction.EAST).isTarget()) {
dir = Direction.EAST;
goForward();
return true;
} else if (getRatS... |
e6051d43-7512-4291-8e21-f1854453211d | 4 | private void reply_if_isACK(Packet packet)
{
TransportLayer tl = packet.getTransport();
if (tl instanceof TCP)
{
TCP transport = (TCP) tl;
if (transport.isACK())
{
Packet ack_packet = new Packet("TCP");
ack_packet.setIP_source(this.computer_ip);
ack_packet.setIP_destination(packet.getIP... |
3cce4b52-2ed5-442d-8c05-1b4450f89711 | 0 | public GUICanvas() {
super();
addMouseListener(this);
} |
b2113d34-81dc-4b37-a373-ce0c134e627a | 9 | private Map<String, String> loadChecksums(File file, int algorithm) {
Map<String, String> checksums = new HashMap<String,String>();
if ( file.exists() ) {
try {
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
// Get the object of DataInp... |
dc662403-2230-46c9-bc23-d1a76f84c400 | 8 | private void advance() {
next = null;
if(rs!=null) {
try {
int n = colNames.length;
final Map<String,Object> mp = new LinkedHashMap<String,Object>();
for(int i=0;i<n;++i) {
Object field = null;
try {
field = colInfos[i].extracter.getField(rs,i);
} catch (Exception ex) {... |
d117c340-5fbe-41dd-8d30-cd0e2c6491d0 | 5 | static final void method1919(int i, float f, byte[] is, float f_0_,
int i_1_, float f_2_, Class186 class186,
float f_3_, int i_4_, byte i_5_, int i_6_,
float f_7_, int i_8_) {
try {
int i_9_ = 0;
if (i_5_ < 11)
method1919(97, -1.4756906F, null, 0.7518226F, 93, -0.33127537F,
null, -0.66... |
90bd6d1d-693a-4c9a-8560-c68116c86791 | 0 | public void close() {
socket.close();
} |
5b988c4a-0379-406d-bd78-966fc9fe4247 | 9 | public static boolean esCorrecta(int d, int m, int a){
int diasDelMes[]={31,29,31,30,31,30,31,31,30,31,30,31};
if(a<=0) {
return false;
}
if(d<=0 || d>31) {
return false;
}
if(m<=0 || m>12) {
return false;
}
if(... |
e2cc41a4-f2d3-4cbc-b78f-d254c6b476b6 | 4 | public void copyToPencilMode () {
int i = 0, j = 0;
for (i = 0; i < 16; i++){
for (j = 0; j < 16; j++) {
if ((pencilEntries[i][j].isEditable()) && (pencilEntries[i][j].getText().equals(""))) {
pencilEntries[i][j].setText(entries[i][j].getText());
}
}
}
} |
c16fd09a-b180-44c8-ad68-57269861ec95 | 9 | public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args){
final ChatColor yellow = ChatColor.YELLOW;
final ChatColor red = ChatColor.RED;
final ArrayList<Player> cFire = CrazyFeet.CrazyFire;
if(args.length < 1) {
if(sender instanceof Player) {
Player player = ... |
4b2230da-7f25-4055-9792-23ed3b264e47 | 2 | public boolean Login(String email, String password, String loginUrl) {
try {
print("User : " + email + " log-in to the system..");
driver.get(loginUrl);
waitTillElementLoad(By.id("email"));
driver.findElement(By.id("email")).clear();
driver.findElement... |
e30a1bac-46e4-4236-b9c9-15ba92abdb5b | 8 | @Override
public HashMap<String, Float> getDocWeightsForDoc(long idDoc) {
try {
HashMap<String, Integer> doc = index.getTfsForDoc(idDoc);
int total = 0;
for (int v : doc.values()) {
total += v;
}
HashMap<String, Float> weights = new... |
fc647eb4-d7aa-4aa1-9096-1addfec901a6 | 0 | @Override
public void undo() {
this.to.removePiece(this.piece);
this.from.addPiece(this.piece);
this.to.addPiece(this.capturedPiece);
this.piece.decreaseMoveCount();
} |
bbf46bc6-f769-4d34-84d4-78853dddfe59 | 7 | public static String toString(Map<String, List<Boolean>> _truth_table) {
if (_truth_table == null)
return "";
else {
StringBuilder res = new StringBuilder();
List<String> col_head = new ArrayList<>(_truth_table.keySet());
if (col_head.size() == 0)
return "";
Collections.sort(col_head);
... |
1f304a34-4eea-436a-9d9e-9ca032a1d96a | 1 | public void removeApplicant(Applicant selectedApplicant) {
em.remove(em.contains(selectedApplicant) ? selectedApplicant : em.merge(selectedApplicant));
} |
bb51cd13-607f-4861-ab6c-84e253902643 | 9 | public int count(String[] field,int dist){
this.field = field;
this.dist = dist;
if (field == null || field.length == 0||dist<0) return 0;
height = field.length;
width = field[0].length();
for (int[] row:grid){
Arrays.fill(row,0);
}
int count ... |
bed8cc1e-72c5-4db6-83ef-b4267af9b02f | 0 | private void addWwwRootDir(File wwwroot) {
rootDirs.add(wwwroot);
} |
81e72c99-f269-457c-a189-a96f5acb33d1 | 4 | public void doStringBuffer() {
final int repeat = ConsoleMenu.getInt("How many times?", 100000);
final int characters = ConsoleMenu.getInt("How many char?", 20);
long start = System.currentTimeMillis();
for (int i = 0; i < repeat; i++) {
final StringBuffer sb = new StringBuf... |
edb71433-dc8d-4dcd-a44a-36a553c1e66f | 8 | @Override
protected void runInternal() throws IOException {
//Get inputStream from context
BitInputStream inputStream = _context.getInputBitStream();
//Init params
int[] chunk = _context.getChunkArray();
int wordSize = _context.getWordSize();
int subChunkCounter = 1;... |
2605f675-2dfc-47d6-a1d8-37fd04543baf | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PeerInfo other = (PeerInfo) obj;
if (ip == null) {
if (other.ip != null)
return false;
} else if (!ip.equals(other.ip))
return false;... |
fbe54c9d-399f-441f-8fed-5b5a582800be | 1 | public int multiplication() {
if (stack.stackLength() > 1) {
int firstNum = stack.top();
stack.pop();
int secondNum = stack.top();
stack.pop();
return firstNum * secondNum;
} else {
return error;
}
} |
cde765ed-7f1f-43e4-88ca-370c2b2a632b | 8 | private Expression plus( List<Expression> args, String caller ) {
boolean ints = true;
boolean intsOrDecimals = true;
for ( int i = 0; i < args.size(); ++i ) {
// if it's not an int
if ( ! args.get(i).show(defSubst, caller).matches("\\d+") ) {
ints... |
51344b04-c39f-4438-a352-728a87f08075 | 2 | public static JSONObject getJSONObject(SampleEvent evt) {
SampleResult res = evt.getResult();
long t = res.getTime();
long lt = res.getLatency();
long ts = res.getTimeStamp();
boolean s = res.isSuccessful();
String lb = escape(res.getSampleLabel());
String rc = es... |
0734c66b-b549-4d4a-a97e-00f247707114 | 2 | public boolean banUser(String name){ //ban a user by name
if (name.equalsIgnoreCase("admin")) return false; //can't ban the admin
UserAccount user = users.get(name.toLowerCase()); if (user==null) return false;
user.setIsBanned(true);
disconnectUser(user);
return true;
} |
09b5579f-89e2-4ac2-a346-235085f2d459 | 5 | public Contact(byte[] record) {
name = name.concat(Converter.getNameFromADNEntry(record));
int telefoneLength = record[14];
if (record[15] == (byte) 0x91) {
phoneNumber = phoneNumber.concat("00");
}
for (int j = 16; j < (15 + telefoneLength); j++) {
Str... |
6bb064e4-9614-4269-8bc3-04aa4bb93a94 | 5 | public int getActionIndex( String action ){
if( action.equals(NOP) ){
return (getActionsNumber() - 1);
}else{
int[] values = new int[3];
int k = 0;
try {
StreamTokenizer tokenizer = new StreamTokenizer(new
StringRead... |
d388f485-3539-474f-855e-0939d249be55 | 4 | private static int method515(char arg0[], int arg1) {
for (int k = arg1; k < arg0.length && k >= 0; k++) {
if (arg0[k] >= '0' && arg0[k] <= '9') {
return k;
}
}
return -1;
} |
bf3dea90-7cca-4ef7-89e4-2719f7a0db6e | 6 | public static boolean adjacent(char x, char y) {
initPositionSingleton();
KeyPosition pos = (KeyPosition) qwertyposSingleton.get(new Character(Character.toLowerCase(x)));
if(pos == null) {
return false;
}
int col = pos.getCol();
int row = pos.getRow();
String keyRow = QWERTY[row];
if(col == 0) {
... |
4dfdfcbf-e299-47ae-87ae-a9af2024d50b | 1 | public StructuredBlock[] getSubBlocks() {
return (subBlock != null) ? new StructuredBlock[] { subBlock }
: new StructuredBlock[0];
} |
52f4df4b-c30d-42e4-9365-55f160c9c79b | 9 | public void newPdf(List<String> fighterNames, Object fightersSorted[], int poolNumber, String filePathAndName, String tournamentName, String wightBox, String genderBox) {
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream... |
f49fd38f-e870-425a-9c1d-f8bdf44f7ae5 | 8 | public boolean canPlayAt(int x, int y) {
if (x >= 0 && x < boardSize && y >= 0 && y < boardSize && intersections[x][y] != UNPLAYED) {
return false;
}
Intersection koIntersection = getKoIntersection();
if (koIntersection != null && koIntersection.x == x && koIntersection.y == y) {
return false;
}
ret... |
411f6d30-ee24-425b-8d9b-c2498c5176b7 | 1 | private static BufferedReader createInputMessageReceiver(Socket clientSocket) {
BufferedReader messageReceiver = null;
try {
messageReceiver = new BufferedReader(new InputStreamReader(
clientSocket.getInputStream()));
log.info("Create BufferedReader from clientSocket");
} catch (IOException e) {
// ... |
21d3034d-f750-4bfa-b4fa-11277abb9c17 | 2 | protected static String flattenIndent(final String wikiText) {
String[] linesArr = wikiText.split("\\n");
for (int i = 0; i < linesArr.length; i++) {
if (isStringTooIndent(linesArr[i])) {
linesArr[i] = linesArr[i].replaceFirst(":{1,}", "");
}
}
ret... |
f1bfaa59-6e38-482b-9480-ae8643afb872 | 2 | @Override
public ICacheable get(Object key) {
if (key == null) {
throw new NullPointerException("key == null");
}
ICacheable mapValue;
synchronized (this) {
mapValue = mCacheMap.get(key);
if (mapValue != null) {
mHitCount++;
return mapValue;
}
mMissCount++;
}
return null;
} |
0b5b75a0-ca79-4a8f-bc82-7b28e215b75c | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Categoria)) {
return false;
}
Categoria other = (Categoria) object;
if ((this.idCategoria == null && other.idCa... |
b7570939-27c8-46ad-9bc8-2de1ecf333cc | 5 | public boolean register(String user, String pass, String email) {
if (!plugin.getConfig().getBoolean("registration.enabled")) {
response = "register.error.disabled";
return false;
} else if (player.isRegistered()) {
response = "register.error.registered";
return false;
} else if (!isWithinAccLimit(pla... |
10524d57-da19-4efc-9d2d-60460052135c | 1 | public String toString()
{
if (nome != null)
return nome.toString();
return id + "";
} |
90401e45-5159-4844-8876-907bcc5b3975 | 0 | public String getInputString()
{
return myInputString;
} |
169dfe43-d541-41c5-a3eb-6bc1370fcbfb | 6 | public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if(cmd.getName().equalsIgnoreCase("Nostalgia")) {
if(sender instanceof Player) {
Player p = (Player) sender;
PlayerUtil pu = new PlayerUtil(p);
if(pu.hasPermission("Nostalgia.Command.nostalgia", PermissionType... |
5e1a8e59-50e2-4293-a294-5fad4389ee78 | 2 | @Override
protected void onPostExecute(Boolean result) {
if (super.getSignatureListener() == null) {
return;
}
if (result != null) {
file.setTestResult(result);
file.setLastCheckedDate(new Date());
StringBuilder str = new StringBuilder();
... |
0759f963-50ba-49c0-8bb2-3b07d1a4ce25 | 1 | public void run() {
while (running) {
show();
}
} |
70ee1792-7989-4c59-9ecc-13ff2cd7caa1 | 4 | @Override
public CommandResponse executeCommand(RequestType requestType, List<Pair<String,String>> headers, String commandName, Object commandParameters, Class<?> responseCastClass){
System.out.println();
System.out.println(commandName);
CommandResponse serverResponse = null;
String translatedJson = jsonTra... |
235b8434-4556-462d-813c-f2a4c570a319 | 2 | public int index(XMLNodeWrapper child)
{
int count = childCount();
for (int i = 0; i < count; i++)
{
if (child.getE() == this.child(i).getE())
{
return i;
}
}
return -1; // Should never get here.
} |
8df73428-b03e-42ab-a68e-36e5b02e168a | 4 | public void refreshProfilesList() {
Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "refreshProfilesList");
Logger.getLogger(MainInterface.class.getName()).log(Level.INFO, "Refresh the profiles list items and combo box");
try {
refreshProfileCo... |
c9cd197c-f84c-4aec-8462-fcb352af86ed | 6 | public void writeControl (byte type, byte request,
short value, short index, byte buf [])
throws IOException
{
if (fd < 0) {
throw new USBException("Dev.writeControl aborted",-USBException.IO_NotOpen);
}
if (buf == null) {
//assume we... |
943e2ff4-6518-4c15-8f97-5ad52d4e17d7 | 2 | public static int chebyshevDist(int color1, int color2)
{
int rd = Math.abs( ((color1 & RED_MASK) >> 16) - ((color2 & RED_MASK) >> 16) );
int gd = Math.abs( ((color1 & GREEN_MASK) >> 8) - ((color2 & GREEN_MASK) >> 8) );
int bd = Math.abs( (color1 & BLUE_MASK) - (color2 & BLUE_MASK) );
... |
22bb2ac9-d32b-4df8-ba4b-265468322483 | 2 | private void writeListTagPayload(ListTag tag) throws IOException {
Class<? extends Tag> clazz = tag.getType();
List<Tag> tags = tag.getValue();
int size = tags.size();
os.writeByte(NBTUtils.getTypeCode(clazz));
os.writeInt(size);
for(int i = 0; i < size; i++) {
writeTagPayload(tags.get(i));
}
} |
bf2684f7-34ec-4cfb-bf36-d6ad2d143271 | 4 | public void keyReleased(KeyEvent e)
{
System.out.println("Key event initialized");
int key = e.getKeyCode();
//moveDirection = 0;
if (key == KeyEvent.VK_LEFT)
{
Magnus.dx = 0;
}
if (key == KeyEvent.VK_RIGHT)
{
Magnu... |
44828f54-be0d-4f0e-a572-9cf6e21b5b46 | 7 | private void readDataFileHeader(MappedByteBuffer buffer) {
int magic = buffer.getInt();
if (magic != TRACE_MAGIC) {
System.err.printf(
"Error: magic number mismatch; got 0x%x, expected 0x%x\n",
magic, TRACE_MAGIC);
throw new RuntimeExceptio... |
9823e77c-8594-4d23-bdbb-e2fd074f52db | 1 | public void shiftPressed() {
HUD hud = null;
for (int i = (huds.size() - 1); i >= 0; i--) {
hud = huds.get(i);
hud.shiftPressed();
}
} |
3419108a-860e-4d9f-9234-4f4f7cc7e8d6 | 8 | private boolean sendMessage(String message) {
String currMessageMD5;
boolean isStatus=false;
try
{
//check if output got shutdown, this probably will never evaluate but worth a shot
if (siriSocket.isOutputShutdown())
{
throw new Exception("Output Shutdown");
}
if (!siriSocket.isConnected())
... |
358c7303-666d-4670-93bb-c1dc1f42fece | 4 | public void updatePosition(Mower mower, Lawn lawn) {
final Direction direction = mower.getCurrentPosition().getDirection();
//mower changing direction
if (direction == Direction.NORTH) {
mower.getCurrentPosition().setDirection(Direction.EAST);
} else if (direction == Direction.EAST) {
mower.getCurrentP... |
e350dfd7-db16-4564-993a-80408bba0fd9 | 1 | static public void run(String name) {
if (states.containsKey(name)) {
states.get(name).action();
}
} |
e37110ac-a1bd-4c21-922e-6230a12194fb | 8 | static int letterDistance(char c1, char c2){
int x1;
int x2;
int y1;
int y2;
if (KEYBOARD_MATRIX.get(0).contains(c1))
x1=0;
else if (KEYBOARD_MATRIX.get(1).contains(c1))
x1=1;
else if (KEYBOARD_MATRIX.get(2).contains(c1))
x1=2;
else
x1=3;
if (KEYBOARD_MATRIX.get(0).contains(c2))
x2... |
29709353-de0c-4783-b07c-e0d414cb6f7d | 1 | public void visit_f2i(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
a6f85de2-0b91-4905-a357-a9e8fba24974 | 5 | SelectorNode selector() {
IdentNode subject = constIdent();
SelectorNode node = null;
if (test(DOT)) {
read(DOT, ".");
node = new RecordSelectorNode(subject, constIdent());
} else if (test(LBRAC)) {
read(LBRAC, "[");
node = new ArraySelectorNode(subject, expr());
read(RBRA... |
6364be42-b507-416e-a3d1-192076f8c346 | 1 | public void log(String line) {
if (_verbose) {
System.out.println(System.currentTimeMillis() + " " + line);
}
} |
f8ded118-6e49-490d-90d5-edf9ba4ccf78 | 2 | private static int getSubTypes(int types) {
int result = 0;
for (int i = 0; i < NUM_TYPES; i++) {
if (((1 << i) & types) != 0)
result |= subTypes[i];
}
return result;
} |
0527078e-a1be-45df-bdba-78a36bcc4ecd | 3 | public synchronized void mouseMoved(MouseEvent me) {
if(isRelative) {
Point p = me.getPoint();
dx += p.x - center.x;
dy += p.y - center.y;
if(!((dx == 0) && (dy == 0))) {
centerMouse();
}
}
} |
cb8c0411-2dad-4486-aa38-dbfb5e99f979 | 0 | public void setHeight(int height) {
this.height = height;
} |
8f4053b8-5e8e-4795-a2e8-ed0b23fccf2a | 4 | public static int getEnvironmentalPressureUnit() throws ClassNotFoundException {
int weightUnit = 0;
try{
//Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar");
Class.forName(driverName);
Class.forName(clientDriverName);
}catch(java.lang.ClassNotF... |
94462aae-37df-4ce2-bb2a-d7c6b6a9f724 | 5 | public static void main(String[] args) throws Exception{
txtPath = args[0];
label = args[1];
ArrayList<File> files = FileFinder.GetAllFiles(txtPath, ".txt", true);
int count = 0;
for(File f : files){
@SuppressWarnings("resource")
BufferedReader br = new BufferedReader(new FileReader(f));
String li... |
f29e8454-f7f9-4509-9dcc-c2506d80940c | 4 | public void visitEnd() {
if (!subroutineHeads.isEmpty()) {
markSubroutines();
if (LOGGING) {
log(mainSubroutine.toString());
Iterator it = subroutineHeads.values().iterator();
while (it.hasNext()) {
Subroutine sub = (Sub... |
1898c72d-7205-4f2a-8b1d-fcbab6568be8 | 8 | public void migrateAgentToGroup(Agent a, Group toGroup) {
//int numExternal = a.getNumExternalNeighbors();
numMigrations++;
if(a.getNumExternalNeighbors() > 20) System.out.println("whaaaa");
//long[] profile = new long[10];
Group fromGroup = a.getGroup();
//remove neighbors from a's original set of ag... |
cf48c218-429c-47c8-93bf-1ab4f7b07674 | 4 | @Override
public void run() {
InetAddress serverAddr= null;
try {
serverAddr= InetAddress.getByName(GlobalV.serverIP);
} catch (UnknownHostException e1) {
e1.printStackTrace();
}
Socket socket = null;
try {
System.out.println("send Alert to server");
socket = new Socket(serverAddr,8... |
49aa1c0c-9ce1-4898-81f1-95086b62b9ba | 4 | public List<String> readHTMLWithOutWriteToFile(URL url, String site){
String str = "";
String tmp;
try {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
while((tmp = in.readLine()) != null){
str = str + tmp;
}
str = str.replace("\t", "");
str = str.replace("> <"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.