method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8208f674-b5ab-464e-8ff5-a3e748b8171e | 7 | public Object invoke(Object proxy, Method method, Object[] args) {
String methodName = method.getName();
ActionEvent event = new ActionEvent(this, 0, methodName);
if (methodName.equals("handleQuit")) {
// fire the action
if(quitListener != null) {
... |
7f97d16f-33b5-4052-93d0-21c7e42008e1 | 4 | public void deadWithThreeLivingNeighboursSpawn(CellStructure cell) {
if (!cell.isStateAlive()) {
int aliveNeighbours = 0;
for (int i = 0; i < cell.getCellNeighbours().size(); i++) {
if (cell.getCellNeighbours().get(i).isStateAlive()) {
aliveNeighbours++;
}
}
if (aliveNeighbours == 3) {
... |
89d68bd6-3f97-4a30-949d-a328f0033215 | 0 | public void setjLabelLogin(JLabel jLabelLogin) {
this.jLabelLogin = jLabelLogin;
} |
6eb026ed-e5ae-48f9-9a3e-cf2296c31a21 | 5 | @Override
protected void randomizeData(Random rng, Battle battle, int position) {
for (int i = 0; i < battle.objectCount(); i++) {
BattleObject obj = battle.getObject(i);
int objValue = obj.getValue();
// If object is an enemy, randomize it.
if (obj.getType() == BattleObject.Type.ENEMY && obj.getSide() ... |
b0b61902-9884-43ef-a371-909f4690368d | 8 | public PlayerNumber winner() {
if (someoneQuit) {
return onePlayerLeft;
}
if (checkHorizontal(movesOfPlayerOne)
|| checkVertical(movesOfPlayerOne)
|| checkDiagonal(movesOfPlayerOne))
return Game.FIRST_PLAYER;
if (checkHorizontal(movesOfPlayerTwo)
|| checkVertical(movesOfPlayerTwo)
|| chec... |
c457d954-e73f-4ad4-a61e-f2ff02567291 | 6 | @Override
public void caseAProgram(AProgram node)
{
inAProgram(node);
if(node.getFim() != null)
{
node.getFim().apply(this);
}
if(node.getComando() != null)
{
node.getComando().apply(this);
}
if(node.getDeclaracao() != null)... |
7df08727-947d-489a-b02b-ff036fa7a7ac | 4 | public boolean removeChannel(Player p, String channelName) {
if (ChannelsConfig.getChannels().contains("channels." + channelName)) {
// Have everyone inside of the channel leave the channel.
for (Player player : Bukkit.getOnlinePlayers()) {
// Avoid any Null-Pointers by checking if the player is in a ch... |
952b8f2b-b9de-4e89-ba55-a6034f75353c | 7 | public static VaryNode makeVaryNode(int iNode, FastVector nRecords, Instances instances) {
VaryNode _VaryNode = new VaryNode(iNode);
int nValues = instances.attribute(iNode).numValues();
// reserve memory and initialize
FastVector [] nChildRecords = new FastVector[nValues];
for (int iChild =... |
0d145e42-b3ea-4a4c-8368-de2375f3fe5a | 4 | public void setIsOver(boolean over, Set<Coordinate> win) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setIsOver() BEGIN");
}
m_isOver = over;
m_win = new HashSet<Coordinate>(win);
if (test || m_test) {
System.out.println("GameBoardGraphics :: setIsOver() END")... |
c732a606-e2af-4383-a719-2fe61160c9f3 | 9 | private void engineUpdate(byte[] b, int ofs, int len) {
if (len == 0) {
return;
}
if ((ofs < 0) || (len < 0) || (ofs > b.length - len)) {
throw new ArrayIndexOutOfBoundsException();
}
if (bytesProcessed < 0) {
implReset();
}
byt... |
d12f49f8-b4c4-4379-9f0b-9d625b1b7d82 | 9 | void parseConfig(String directory, String fileName) {
if (!setupParsing(directory, fileName)) {
data.logerror("Error opening " + fileName);
return;
}
String sephiadir = "", logdir = "", dataFileName = "", usersFileName = "";
NodeList groupNodes = document.getDocumentElement().getChildNodes();
for (... |
bd6e8a34-c76d-4664-b134-172e5dc69d33 | 5 | public void test_11() throws IOException {
String vcfFileName = "tests/test.chr1.vcf";
Random random = new Random(20130217);
// Index file
System.out.println("Indexing file '" + vcfFileName + "'");
FileIndexChrPos idx = new FileIndexChrPos(vcfFileName);
idx.setVerbose(verbose);
idx.setDebug(debug);
id... |
4731884c-5c23-4e35-be59-cbe740be4203 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (null == obj) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
LinkDirectionCountry eq = (LinkDirectionCountry)obj;
... |
0ede4469-6c58-48bb-94fc-f9e09389ffdf | 9 | public void eliminarCliente(String name) throws Exception{
if(!cjtClientes.containsKey(name)){
throw new Exception("Este cliente no existe!");
}
//ACTUALIZAR LOS COCHES QUE TENIA EL CLIENTE Y DEJARLOS SIN PROPIETARIO
ArrayList<String> coch = cjtClientes.get(name).get... |
82cea9d1-a583-433b-8534-8f0c7c5fbe0a | 3 | public String getJson() {
try {
/* Create a URL obj from strings */
fullUrl = (QUERY_URL.concat("?name=").concat(s_name)).replace(" ", "%20").concat("&orderby=" + s_switch).concat("&limit=") + MAX_RESULTS;
url = new URL(fullUrl);
/* Debug */
System.ou... |
dd470dfe-ac10-4618-b9ae-7c3408377d17 | 4 | public boolean load() {
if (!outconfig.exists()) {
Messenger.info(outconfig.getName() + " does not exist, disabling that function for now.");
return false;
}else{
try {
outsideConfig.load(outconfig);
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOExcepti... |
e92cffdb-e8b9-4f5d-865c-da51c7fb258f | 0 | public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
} |
772f045c-3093-4bc4-97e8-8429d14cb955 | 1 | private void onGameEnd(int result, Object arg) {
for (GameEventListener l : this.gameEventListeners) {
l.onGameEnd(result, arg);
}
this.board.clear();
} |
903e1010-307b-4257-b441-48b032e9abf8 | 6 | private boolean add2(int num) {
ArrayList<int[]> zeros = new ArrayList<int[]>();
for (int c = 0; c < col; c++) {
for (int r = 0; r < row; r++) {
if (board[c][r] == 0) {
int[] temp = { c, r };
zeros.add(temp);
... |
fdf0aa5f-5839-4cdc-a966-5a5a36d63fa7 | 2 | public static boolean existsName(Atributos attr){
String sql = " SELECT * FROM atributos WHERE atributo = '"+attr.getAttr()+"' ";
if(!BD.getInstance().sqlSelect(sql)){
return false;
}
if(!BD.getInstance().sqlFetch()){
return false;
}
return... |
0524e988-8f19-4fa7-ad29-c2e45352fd5b | 4 | public void changeState(int newState) {
this.state = newState;
if (splash != null) {
splash.stop();
}
if (level != null) {
level.stop();
}
if (state < 1 || state > LevelData.getLevelsCount()) {
root.g... |
ab1de285-f0a2-41e6-9182-f8a67dbe7fc1 | 6 | public static boolean around(int r, int c) {
for (int i = 0; i < dir.length; i++)
if (r + dir[i][0] >= 0 && r + dir[i][0] < n + 2
&& c + dir[i][1] >= 0 && c + dir[i][1] < m + 2
&& map[r + dir[i][0]][c + dir[i][1]] == 'X')
return true;
return false;
} |
ef865745-037b-4922-ac71-69085a180331 | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
6cd5c29a-ab24-452b-a705-7b6077538062 | 2 | private void setText() {
String text = "";
List list = inputManager.getMaps(action);
if (list.size() > 0) {
for (int i=0; i<list.size(); i++) {
text+=(String)list.get(i) + ", ";
}
// remove the last comma
text = text.substri... |
6da723f2-2067-474c-b061-f99c0086f9be | 2 | public static double acoth(double a){
double sgn = 1.0D;
if(a<0.0D){
sgn = -1.0D;
a = -a;
}
if(a<1.0D) throw new IllegalArgumentException("acoth real number argument (" + sgn*a + ") must be <= -1 or >= 1");
return 0.5D*sgn*(Math... |
f28683fe-3501-4ccb-a379-14353521d940 | 8 | public void hessian(double x[], double h[][]) {
double f,sq1,sq2,sq3,f1,f2,f3,f4,fac,c1,c2,s1,s2;
double theta,x1,x2,x3,x4;
double f1d1,f1d2,f1d3,f1d11,f1d12,f1d13,f1d22,f1d23,f1d33;
double f2d1,f2d2,f2d3,f2d11,f2d12,f2d13,f2d22,f2d23,f2d33;
double f3d1,f3d2,f3d3,f3d11,f3d12,f3d13,f3d22,f... |
c93096a9-890c-4a5b-946e-337f31333850 | 9 | @Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (!roundEnv.processingOver()) {
// System.out.println("Processing Annotations: " + annotations);
// System.out.println();
for (TypeElement typeElement : annotations) {
// System.out.println("Proc... |
3506e647-ed02-430d-a494-00c6d492d3ff | 7 | public void actionPerformed(ActionEvent event) {
// Expecting menu items
if (event.getSource() == fileNew) {
newGame();
}
else if (event.getSource() == fileSave) {
save();
}
else if (event.getSource() == fileExit) {
exit();
}
else if (event.getSource() == settingsPlayBa... |
addb23bd-fc50-4b44-99a6-b5fb7abeee93 | 2 | public static String currencyName1(String ccCode){
Connection conn = DBase.dbConnection();
PreparedStatement dbpst;
String curName ="";
try{
String query = "Select CurrencyName FROM "+ccCode+ " where CountryCode = ?";
dbpst=conn.prepareStatement(query);
d... |
23377757-dc11-467c-b22d-eea0313b62cd | 5 | public Piece getPiece() {
if (revealed) {
if (isMine) return Piece.mine;
else return Piece.getPiece(numMines);
} else {
switch(state){
case unmarked: return Piece.blank;
case flagged: return Piece.flag;
case questioned: return Piece.question;
default: return null;
}
}
} |
3363faf9-8702-44b2-ae05-6e2b59181e09 | 8 | public static Expression simplifyBooleanExpression(Expression expr, boolean negate) {
if (expr instanceof PrefixExpression) {
PrefixExpression pe = (PrefixExpression) expr;
if (pe.getOperator() != PrefixExpression.NOT) return expr;
return simplifyBooleanExpression((Expression... |
1996b78c-b6cf-4c74-85fa-a99007bc9244 | 4 | public boolean giveUp() {
boolean getLetter = true;
String letter = "n";
while (getLetter) {
letter = getString("Would you like to keep playing? Enter y or n.");
if (!( letter.equals("n") || letter.equals("y") )) {
System.out.println("Oops, enter y or n.");
}
else {
... |
277ed2d7-c673-4ca6-b548-62d47f0c3abb | 0 | public static ValidatorProperties getInstance() {
return instance;
} |
f0ad0205-8535-4926-a485-0b4a492e6370 | 3 | @Override
public V compute(
final K key,
final BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
throw new UnsupportedOperationException();
} |
d57af154-88c0-49b7-9b76-15425b0780ed | 9 | public void giveSchedule(LinkedList<Semester> semesters, int i) {
if (i < 1 || i > 5) { //if i is not within acceptable range
System.out.println("Error! Passing invalid value for integer. [1-5] inclusive.");
System.exit(1);
}
if (semesters == null) {
System.out.println("Null semester list. No schedule ... |
3d376464-f9cc-473b-a852-43dff8c21776 | 3 | public void sendMessage(Message msg, int receiverID) throws java.rmi.RemoteException{
try {
IMessageReceivedHandler receiver = (IMessageReceivedHandler) java.rmi.Naming.lookup(createURL(receiverID));
receiver.onMessageReceived(msg);
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
} catch (jav... |
70ce3c9f-2e59-4017-8d36-3049eb4c8922 | 3 | public static String getUserHome()
{
String home = System.getProperty("user.home");
if (home == null || home.length() <= 0)
{
try
{
Process exec = Runtime.getRuntime().exec(new String[]
{
"bash", "-c", "echo ... |
b02059aa-eb8f-4662-8852-f9e87dc816ea | 1 | public boolean containsKey(Object key) {
if (map.containsKey(key)) {
touch(key);
return true;
}//if
return false;
}//containsKey |
ac2b0956-0e4f-4e04-ba69-458a5ba126f5 | 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 Person)) {
return false;
}
Person other = (Person) object;
if ((this.id == null && other.id != null) || (this.i... |
7a4b7098-b5f6-4ec4-a415-432102e07b59 | 1 | private void ccbPolyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ccbPolyActionPerformed
System.out.println(evt.toString());
Color c = ccbPoly.getSelectedColor();
if (c != null) {
System.out.println("non null color");
this.gmlLayer.setColorPoly(c);
... |
e333806e-5563-4ea2-9129-ebc8e052563d | 1 | public Properties getTileInstancePropertiesAt(int x, int y) {
if (!bounds.contains(x, y)) {
return null;
}
Object key = new Point(x, y);
return tileInstanceProperties.get(key);
} |
00422bdb-bb67-4b2c-9f6c-16f38fe4a4fd | 3 | public java.lang.Object get(int field$) {
switch (field$) {
case 0:
return intField;
case 1:
return floatField;
case 2:
return stringField;
default:
throw new org.apache.avro.AvroRuntimeException("Bad index");
}
} |
15517a2b-3baf-4605-97d1-e269c3bd7e52 | 2 | public static synchronized String getVersion() {
if (oms_version == null) {
try {
BufferedReader r = new BufferedReader(new InputStreamReader(Utils.class.getResourceAsStream("version.txt")));
oms_version = r.readLine();
r.close();
} catch (... |
cc9f9927-7da7-4363-8304-77553a0ea972 | 0 | public int getHeight() {
return height;
} |
88665220-c565-4771-9fd2-e5bae09227c9 | 2 | public MultipleLayerLruCache(int maxMemSize, String path, long maxDiskSize){
mMemLruCache = new CMemLruCache(maxMemSize);
if(null != path && path.length() > 0){
mDiskLruCache = new DiskLruCache(path, maxDiskSize);
}
} |
334cf881-4922-4bd5-a1ca-433ee643b3b0 | 1 | public List<FieldVisitResult> getFieldVisitResult() {
if (fieldVisitResult == null) {
fieldVisitResult = new ArrayList<FieldVisitResult>();
}
return this.fieldVisitResult;
} |
07e98da6-dda0-404d-966e-048ee4f3b11e | 2 | private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
// TODO add your handling code here:
String str2;
DefaultListModel md = new DefaultListModel();
str2 = this.jTextField16.getText().toUpperCase();
if(Biblio.containsK... |
21c9c476-d2cd-4b37-9739-393e704f249b | 3 | public static void main(String[] args) throws Exception {
if(args.length == 0) {
printHelp();
}
String filename = args[0];
if(args.length > 1 && args[0].equals("-d")) {
filename = args[1];
debugging = true;
}
SkeletonInfoTool info = n... |
19c7b8c9-1957-4aed-936e-54c216d6437a | 8 | public void buildClassifier(Instances data) throws Exception {
if(m_Classifier == null) {
throw new Exception("A base classifier has not been specified!");
}
// can classifier handle the data?
getCapabilities().testWithFail(data);
// remove instances with missing clas... |
879194e2-56d5-4fda-af62-b75f38bdc9b0 | 8 | private int setUpForEval(BitSet subset) throws Exception {
int fc = 0;
for (int jj = 0;jj < m_numAttributes; jj++) {
if (subset.get(jj)) {
fc++;
}
}
//int [] nbFs = new int [fc];
//int count = 0;
for (int j = 0; j < m_numAttributes; j++) {
m_theInstances.attribute(j).setWeigh... |
6e67540d-7ee0-42c6-b90f-b659bc1dc554 | 0 | public static void main(String... args)
{
MethodReferenceSAM methodReferenceSAM = MethodReference::toUpperCase;
System.out.println(methodReferenceSAM.process("Static"));
MethodReference methodReference = new MethodReference();
methodReferenceSAM = methodReference::... |
c65662a2-25ae-42ab-94ad-792c862a7d6e | 9 | private void readHeader() throws IOException {
CheckedInputStream in = new CheckedInputStream(this.in, crc);
crc.reset();
// Check header magic
if (readUShort(in) != GZIP_MAGIC) {
throw new IOException("Not in GZIP format");
}
// Check compression method
... |
8356b426-0b22-4f2f-b8d9-eac7cfb36f21 | 2 | private void loadYamls() {
try {
config.load(configfile);
if(config.getBoolean("metrics")){
Metrics metrics = new Metrics(this);
metrics.start();
getLogger().info("Metrics enabled!");
}
} catch (Exception e) {
e.printStackTrace();
}
} |
d2453b51-5feb-47af-a8b3-a5bc7a0b1ae0 | 6 | protected void OnDataRangeChanged() {
if (selectedIndex != null) {
try {
lastData = NetworkManager.showMore(selectedIndex.getSymbol(), selectedRange);
lineChart.getData().clear();
if (pointerType!=null && !pointerType.equals("hide")) {
... |
014b9e76-7910-4280-97cf-180a08074b8b | 5 | public static Map<Pattern,Processor> mapUrlToProcessor(Map<String,Object> beans){
if(beans == null)
return null;
Map<Pattern,Processor> urlProcessorMapping = new HashMap<Pattern,Processor>();
for(String beanName : beans.keySet()){
Object bean = beans.get(beanName);
for(Method m : bean.getClass().getMe... |
eb9b09e6-d142-46db-939a-ef58ce6b8876 | 8 | private boolean r_instrum() {
int among_var;
// (, line 76
// [, line 77
ket = cursor;
// substring, line 77
among_var = find_among_b(a_3, 2);
if (among_var == 0)
{
... |
ad747b3d-dcf1-4176-aba4-31d86e749431 | 9 | public static ArrayList<Rectangle2D> getMapSectors(Rectangle2D r) {
ArrayList<Rectangle2D> platforms = new ArrayList<Rectangle2D>();
Point p = new Point((int) (r.getX() / tileSize), (int) (r.getY() / tileSize));
if(rectMap.containsKey(p)) {
platforms.addAll(rectMap.get(p));
}
Point p2 = new Point((in... |
b9e481fb-3200-4a47-a17b-05d54583f33d | 5 | public void openFile()
{
if(_isOSX || ostype == ostype.Linux || ostype == ostype.Other)
{
openFile_OSX_Nix();
}
else
{
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Open a Text File");
fc.setFileFilter(new FileNameExt... |
e3465f47-fe11-441d-a6ff-289512baa34b | 9 | final public NodeList BitValueList(Recovery next) throws ParseException {
next.push(VALUE_IDENTIFIER_T);
NodeList list = new NodeList();
LBraceSymbol(next);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case CURRENT_T:
case DEPRECATED_T:
case OBSOLETE_T:
case MANDATORY_T:
case NOT_IMPLEMEN... |
da8aacdb-1e96-4b04-8eb6-1b59beb96368 | 1 | private boolean chatbotNameChecker(String currentInput)
{
boolean hasNameInString = false;
if(currentInput.indexOf(this.getName()) > -1)
{
hasNameInString = true;
}
return hasNameInString;
} |
b67ab972-7c95-437c-937b-b13bb94b5515 | 5 | public String httpPostWithFile(String url, String queryString,
List<QParameter> files) throws Exception {
String responseData = null;
url += '?' + queryString;
HttpClient httpClient = new HttpClient();
PostMethod httpPost = new PostMethod(url);
try {
List<QParameter> listParams = QHttpUtil
.getQue... |
58547fe1-2f67-4111-9dd7-11586de926cf | 6 | public boolean isPalindrome(String s) {
if (s == null || s.length() == 0) return true;
int i =0;
int j = s.length()-1;
while (i < j)
{
if (!isChar(s.charAt(i))){ i++; continue;};
if (!isChar(s.charAt(j))){ j--; continue;};
if (toLowCase(s.charAt(i)) == toLowCase(s.charAt(j)))... |
b3b70526-5eb5-47e0-ba4d-38090dc47d15 | 7 | public static boolean subtypeOfWrapperP(Surrogate type) {
if (Stella.$CLASS_HIERARCHY_BOOTEDp$) {
return (Stella_Class.subclassOfP(((Stella_Class)(type.surrogateValue)), ((Stella_Class)(Stella.SGT_STELLA_WRAPPER.surrogateValue))));
}
else {
return (Surrogate.subtypeOfBooleanP(type) ||
... |
a34192db-080b-4060-bc32-9cefeb858eb6 | 3 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
while (in.hasNext()) {
int size = in.nextInt();
if (size == 0)
break;
blocks = new Point[size];
for (int i = 0; i < size; i++)
blocks[i] = new Point(in.next... |
d608784d-3db2-42b5-9668-dd0be91cdb19 | 5 | @Override
public Object parseClass(Class<?> c, Object o, MainView view) {
Method methods[] = c.getMethods();
for(int i = 0; i < methods.length; i++){
try{
if(methods[i].isAnnotationPresent(GetVisibleFiles.class)){
if(o == null){
o = c.newInstance();
Log.getLogger().log(Level.INFO, "Initiali... |
163788ec-013d-49ba-903a-4230bffdbe94 | 8 | @Override
public void execute() throws ParseException
{
for(String keyName : primaryKeys)
{
if (!isKeyInAttr(keyName)) {
throw new ParseException("No key for primary key "+keyName);
}
}
for (ForeignKey foreignKey : this.foreignKeys) {
if (!isKeyInAttr(foreignKey.localAttrName)) {
throw new Pa... |
9c773416-4020-40b1-88fc-66d09e47b9a2 | 8 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if ( sender instanceof Player ) {
/*
* If for some reason the player data file is removed, attempt
* to re-create it.
*/
Player p = (Player) sender;
... |
b00e27e2-b4fc-48e8-a831-19b39bf6abd4 | 8 | private void fargeleggOgSjekkNaboer(char[][] tegn, int i, int j) {
tegn[i][j] = farge;
antallAvHver[farge - '0']++;
if(i > 0 && tegn[i-1][j] == 'S') { //sjekk over
fargeleggOgSjekkNaboer(tegn, i-1, j);
}
if(j > 0 && tegn[i][j-1] == 'S') { //sjekk venstre
fargeleggOgSjekkNaboer(tegn, i, j-1);
}
if... |
3b000ce2-0115-45c9-8264-bb2c7f6a82a2 | 9 | public static void Calc(String pHands, String board, String dead, int times) {
Hand[] hands;
Deck deck = new Deck();
String[] sHands = pHands.split("\\|");
int handCount = sHands.length;
hands = new Hand[handCount];
for(int i = 0; i < handCount; i++) {
hands[... |
72787207-ad38-4bd2-afa0-8ba33ee1471b | 1 | public void run(){
try{
processing();
}catch (IOException e){
LOG.error(this.getClass().getSimpleName() + "[" + id + "]", e);
}finally {
ProcessManager.getInstance().finishProcess(this);
suspending = false;
}
} |
4b6c4c58-1f48-49dd-ab1f-21459ffd1b89 | 2 | @EventHandler
public void Entra(PlayerJoinEvent event)
{
String name = event.getPlayer().getName();
if(!Main.jl.leggi(name))
{
if(event.getPlayer().getWorld() == Main.server.getWorld(Main.conf.mondo))
{
Location lc = Main.sp.coordinate();
lc.setWorld( Main.server.getWorld(Main.conf.mondo));
Mai... |
d0e3a15c-1194-4795-b833-dadb44bf9281 | 8 | public boolean isScramble(String s1, String s2) {
if(s1.equals(s2)) return true;
int len = s1.length();
int v1=0,v2=0;
for(int i=0;i<len;i++)
{
v1 = v1+(int)s1.charAt(i);
v2 = v2+(int)s2.charAt(i);
}
if(v1!=v2)
return false;
... |
b289cf85-7bec-4f65-9018-9cf19a10f4be | 2 | @Override
protected void checkAfterParse(Method method) throws DaoGenerateException {
if (collectionIndex == -1 && StringUtils.isEmpty(globalCollectionName)) {
throw new DaoGenerateException("方法[" + method + "]配置错误:没有配置@MongoCollection注解");
}
} |
db132c3d-8c88-4463-8d16-926b5728aecc | 2 | public void LoadImage() { //Should not be loaded until the pin is going to be displayed, in order to save space.
if (image == null) {
try { //Try to load the image from file
image = ImageIO.read(this.getClass().getClassLoader().getResource(filePath));
}
catch ... |
50428fe8-ebec-443a-aaed-22bab1f211e7 | 5 | private void realput(URL loc, byte[] data) {
FileContents file;
try {
try {
file = back.get(loc);
} catch (FileNotFoundException e) {
back.create(loc, data.length);
file = back.get(loc);
}
if (file.getMaxLeng... |
8d59f87f-82a9-4663-a841-d65bdfb69187 | 0 | public AbstractPlay getRelatedPlay(){
return relatedPlay;
} |
a4aa7718-e287-4e0f-b14f-9cb6fe0ab1a1 | 4 | @Override
public void onBlockIgnite(BlockIgniteEvent event) {
if (event.isCancelled()) {
return;
}
PlanArea area = BuildingPlanner.plugin.areaManager.getAffectedArea(event.getBlock());
if (area == null) {
return;
}
if (!area.isCommitted() && area.isPlannedBlock(event.getBlock())) {
event.se... |
9ee1ded5-dfa3-401a-8edf-dab6c5d7718c | 2 | public void outputConfiguration(){
for(INISection section : config.getSections()){
OutputUtility.outputLine("[" + section.getName() + "]");
OutputUtility.increment();
for(INIParameter parameter : section.getParams()){
OutputUtility.outputLine(parameter.get... |
9b886e88-2d84-41e4-89d0-97fa406967f8 | 3 | @Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (name.equals("<init>")) {
return new MethodVisitor(Opcodes.ASM4, cv.visitMethod(access, name, desc, signature, exceptions)) {
@Override
public void visitMethodInsn(int opcode, St... |
5a57ab5a-1b45-4d9a-b27f-b536968d0f74 | 7 | public void visitLdcInsn(final Object cst){
if(mv != null)
{
mv.visitLdcInsn(cst);
}
if(cst instanceof Integer)
{
push(Opcodes.INTEGER);
}
else if(cst instanceof Long)
{
push(Opcodes.LONG);
push(Opcodes.TOP);
}
else if(cst instanceof Float)
{
push(Opcodes.FLOAT);
}
else if(cst instanceof ... |
b63f5d36-6180-4f10-8b96-c53356b5da39 | 3 | public synchronized void run(){
try{ //Try to buffer song and load into Player
FileInputStream fileStream = new FileInputStream(song.getFilePath());
BufferedInputStream bufferStream = new BufferedInputStream(fileStream);
mp3Player = new Player(bufferStream);
... |
bb574065-4c87-4dde-b3bc-6a8daabcee04 | 7 | @EventHandler
public void SkeletonJump(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Skeleton.Jump.D... |
a6025048-5b85-4ae7-b6f1-0ba2a9088692 | 6 | public void handleInput() {
if (Keys.isPressed(Keys.ESCAPE))
gsm.setPaused(true);
if (player.getHealth() == 0)
return;
player.setUp(Keys.keyState[Keys.UP]);
player.setDown(Keys.keyState[Keys.DOWN]);
player.setLeft(Keys.keyState[Keys.LEFT] || Keys.keyState[Keys.A]);
player.setRight(Keys.keyState[Keys.R... |
b8250fab-7953-468d-9ad7-d69f507370ff | 2 | private List<String> readDir() {
File dir = new File(basePath);
File[] files = dir.listFiles(jsonFilenameFilter);
ArrayList<String> filenames = new ArrayList<>();
for (File f : files) {
if (f.isFile()) {
filenames.add(f.getName());
}
}
... |
781eca47-930a-47e9-88d2-ae076070d7d4 | 2 | @Override
public void run() {
Socket connection = null;
while (server.Running) {
try {
connection = serverSocket.accept();
server.Log("Connection made from " + connection.getInetAddress().toString());
Accept(connection);
} catch (IOException e) {
// TODO Auto-generated catch block
... |
ea55bb8b-fdac-4d0c-a6f9-b1a155c1bd32 | 6 | private void fillCheck(int layer, int x, int y, int id, int idToFill){
if(tileID[layer][x][y] != id){
if(idToFill == -1) idToFill = tileID[layer][x][y];
setTile(layer,x,y,id);
if(tileCheck(layer, x - 1, y, idToFill)) fillCheck(layer, x - 1,y,id, idToFill);
if(tileCheck(layer, x + 1, y, idToFill)) ... |
527e138f-a184-464c-84a7-48b2d0268ce4 | 7 | private void mapTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mapTypeActionPerformed
/*////////////////////////////////////////////////
Relative Address Changes where made here. The folder
depth denoted by relative addressing "../", in the
genaration of a "new UR... |
e23d1914-cccc-4c1c-b38b-1d0f746d1a68 | 8 | public void tick() {
up = keys[KeyEvent.VK_W] || keys[KeyEvent.VK_UP];
left = keys[KeyEvent.VK_A] || keys[KeyEvent.VK_LEFT];
down = keys[KeyEvent.VK_S] || keys[KeyEvent.VK_DOWN];
right = keys[KeyEvent.VK_D] || keys[KeyEvent.VK_RIGHT];
music = keys[KeyEvent.VK_M];
if (mu... |
08e84e1b-f84e-4e7b-aa76-38b92c5ca1e8 | 2 | @Override
public void packetReceived(PacketReceivedEvent e) {
//KeepAlive
if(e.getPacket() instanceof ServerKeepAlivePacket){
send(new ServerKeepAlivePacket(((ClientKeepAlivePacket)e.getPacket()).getPingId()));
return;
}
if(e.getPacket() instanceof ServerJoinGameP... |
777b6578-de15-463c-a276-95d81f811af0 | 1 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
currentRound++;
jLabel7.setText(g.makeThrow(1));
jLabel3.setText(g.getScore());
jLabel6.setText(g.getPredictedThrow());
if(currentRound == numberOfThrows) {
JOptionPane.showMessageDialog(this, "Final Score: " + g... |
ac1e6e2f-20ed-4a64-98d6-6ff09b24b7de | 1 | public String getAllBest()
{
StringBuilder sb = new StringBuilder();
for(int i = 0 ; i<allBest.size() ; i++)
{
sb.append(allBest.get(i).toString()+"\n\n");
}
return sb.toString();
} |
f08e3546-c9fc-44d9-9456-0a872fd96950 | 8 | public void update_pf_moving() {
if (path == null)
return;
if (JSBotUtils.isMoving()) return;
if (path_step < path.size()) {
if (myLastCoord.equals(path.get(path_step))) {
path_moving = false;
path_step++;
}
}
if (path_moving) return;
if (path_step < path.size()) {
if (path.size() - p... |
0a507152-a695-4530-b656-7e21c07e0d47 | 1 | private void addBranches(final Label dflt, final Label[] labels) {
addBranch(dflt);
for (int i = 0; i < labels.length; i++) {
addBranch(labels[i]);
}
} |
1bb19410-bcd1-415b-98a3-de8ae7d675af | 0 | private BeerResponse(Beer delegate) {
this.delegate = delegate;
} |
b91f701e-f5c0-4d0f-99fd-cd145e290175 | 2 | public void append(String text) {
if (textArea.getText().length() == 0){
int numLines = textArea.getHeight() / textArea.getFontMetrics(textArea.getFont()).getHeight();
for (int i = 1; i < numLines; i++)
textArea.append(System.lineSeparator());
}
int tl = t... |
1a20a344-1a57-4c47-aa0f-8875b3e1a96e | 2 | public void finalize ()
{
if (in != null)
try { close (); } catch (IOException e) { }
} |
b7d14bea-9c44-4f16-866a-977ee81efd3a | 9 | public void fixBinWidths(double sensitivity) {
double maxSlope = Math.abs(histogramData[1] - histogramData[0]);
for (int i = 1; i < histogramData.length - 1; i++) {
double slope = Math.abs(histogramData[i+1] - histogramData[i]);
if (slope > maxSlope) {
maxSlope = slope;
}
}
... |
0fc68272-0feb-44c4-ac36-4ef47d232a23 | 6 | @Override
public void run() {
try {
out = new PrintWriter(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (IOException e) {
logger.error("Failed to bind input or output stream to user client");
}
// communicate
String inputLine, outputLine... |
c35e46ab-2283-49dd-85dd-e93dd23d3cf1 | 2 | public void testPrinterParserMethods() {
DateTimeFormatter f2 = new DateTimeFormatter(f.getPrinter(), f.getParser());
assertEquals(f.getPrinter(), f2.getPrinter());
assertEquals(f.getParser(), f2.getParser());
assertEquals(true, f2.isPrinter());
assertEquals(true, f2.isParser());... |
697ecf2f-d4d7-493e-8d6e-5eef993c640a | 2 | @Override
public void handleEmptyEventQueue() {
// TODO Auto-generated method stub
super.handleEmptyEventQueue();
if (exec1xTraffic) {
TrafficExportImport.changeReabilityModel();
TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt");
//Tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.