method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4676fd1f-1d21-4aa0-99ee-adaa85bc763e | 1 | public boolean equals(Object object) {
if (! (object instanceof CycConstant))
return false;
Guid thisGuid = getGuid();
Guid thatGuid = ((CycConstant) object).getGuid();
return thisGuid.equals(thatGuid);
} |
116ec5bf-63f1-4e67-a683-f3d6b6164220 | 5 | @Override
public void execute() {
MahTreez.status = "Chopping";
SceneObject tree = SceneEntities.getNearest(MahTreez.activeTree.getIds());
if (tree == null) {
System.out.println("Chop: cannot find the tree! Camera rotation (for next tree).");
if (Random.nextInt(1, 3) == 1) {
Camera.setAngle(Camera.get... |
cb9b82b8-16a4-41e3-b2c5-3431864c8cc6 | 6 | protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {
out.writeStartElement(getXMLElementTagName());
out.writeAttribute(ID_ATTRIBUTE, getId());
if (destination != null) {
out.writeAttribute("destination", destination.getId());
}
out.writeAttribu... |
a8617bd5-68e1-46db-8db2-41848a1d340c | 1 | public static boolean phone(String phone){
if(phone.matches("(\\d){10}"))
return true;
return false;
} |
1d07e2ba-7506-49f8-a4cc-e711c0c7d13e | 6 | private final void method3914(byte i) {
anInt7922++;
anInterface5_Impl1_8201 = method3889(false, 16711680);
if (i <= -97) {
anInterface5_Impl1_8201.method20(3096, (byte) 126, 12);
for (int i_225_ = 0; i_225_ < 4; i_225_++) {
Buffer buffer = anInterface5_Impl1_8201.method19(true, 26775);
if (buffer != n... |
b667e7d4-25e9-4359-b4ad-b99b3a73ad43 | 1 | public ControllerCrlv(ViewCrlv tela, ModelCRLV c, ViewGerenciarCrlvs g) {
jifCrlv = tela;
daoCrlv = new DAOCrlv();
gcrlv = g;
if(c == null)
crlv = new ModelCRLV();
else{
crlv = c;
jifCrlv.setModelCrlv(crlv);
}
... |
7a92f433-8e81-485c-ad73-f2b857315c0a | 1 | public void updateCellData(String key, String value) {
if (jt_language.getSelectedRow() != -1) {
row = jt_language.getSelectedRow();
}
// System.out.println(row);
cellData[row][0] = key;
cellData[row][1] = value;
prop.put(key, value);
} |
6880e903-22b4-4b6e-9637-c8410ac07b90 | 9 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setHeader("Edge-control", "no-store");
if ("clear".equalsIgnoreCase(request.getParameter("clear"))) {
... |
9667058b-1d6a-4e80-b073-2c4167fc0544 | 3 | public int inserir (Usuario us){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, us.getNome... |
a64a971d-d9c5-485b-8cfa-a975cb825b04 | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int t = 1;
while ((line = in.readLine()) != null && line.length() != 0) {
int times = Integer.parseInt(line);
f... |
4a8d237e-2f4a-4129-aae2-c99643a0eb03 | 9 | public static String valorMonetario(String valor) {
int pontos = -1;
valor = valor.replaceAll(",", ".");
valor = valor.replace("..", ".");
for (int i = 0; i < valor.length(); i++) {
if (valor.charAt(i) == '.') {
pontos++;
}
}
if (!... |
98272d17-4bed-449b-93ba-f86e685a72c6 | 3 | public void start() {
if (!this.socket.isBound()) {
throw new IllegalStateException("Can't start ConnectionHandler " +
"without a bound socket!");
}
this.stop = false;
if (this.thread == null || !this.thread.isAlive()) {
this.thread = new Thread(this);
this.thread.setName("bt-serve");
this.th... |
05254ac0-0314-4ceb-8215-5af974f20452 | 6 | private void trimTexts(Field field, Object prop) {
if(prop instanceof JTextComponent) {
JTextComponent txtComp=(JTextComponent)prop;
Trim trim=field.getAnnotation(Trim.class);
if(trim!=null) {
if(trim.value()==YesNo.YES) {
txtComp.setText(txtComp.getText()==null?null:txtComp.getText().trim());
... |
f7430c27-a002-4e8a-8f0a-ac21dd077efa | 5 | public void loadCardConfigFile(String file) throws FileNotFoundException, BadConfigFormatException {
FileReader cardReader = new FileReader(file);
Scanner cardScanner = new Scanner(cardReader);
Card toAdd;
final int numColumns = 2;
String name;
Card.cardType type = null;
while(cardScanner.hasNextLine()) {... |
3a90cea2-6a40-4980-8476-a62aba8d147c | 1 | public void returnOperation(
final AbstractInsnNode insn,
final Value value,
final Value expected) throws AnalyzerException
{
if (!isSubTypeOf(value, expected)) {
throw new AnalyzerException(insn,
"Incompatible return type",
expecte... |
d3232323-3586-4fad-ae6f-ad65ae00f0da | 5 | public String toString(){
StringBuffer map = new StringBuffer( );
//goes through all the rooms and appends -[ ]-
//if there are any people in the room, it cuts out a space and adds the first letter of their names.
for(int y=0; y<worldHeight; y++){
for(int x=0; x<worldWidth... |
b33aa15c-7dcf-4997-87f1-7b07b769ad5b | 1 | @Override
public void setPystyNopeus(double pystyNopeus){
for (KentallaOlija osa : osat){
osa.setPystyNopeus(pystyNopeus);
}
} |
a1049712-bbfe-4028-bfc9-94699845f08c | 2 | @Test
public void testBothWays() throws IOException, InterruptedException {
for(File org : testdataDirectory.listFiles()) {
if(org.isFile()) {
System.out.println("checking " + org.getName());
byte[] originalData = TestUtil.readFully(org);
ByteArrayOutputStream compressedData = new ByteArrayOutpu... |
f9f41307-a6ab-4847-aff5-fd1885fbccdd | 1 | private void eol() throws XMLStreamException {
mWriter.writeCharacters("\n"); //$NON-NLS-1$
for (int i = 0; i < mDepth; i++) {
mWriter.writeCharacters(mIndent);
}
} |
a4a3a6fa-3b43-4ba3-bfba-c1b7457195a0 | 9 | @Override
public void createPossibleMoves() {
possibleMoves = new ArrayList<Square>();
//direction boolean is set to false if a piece is blocking the direction
boolean nw = true, ne = true, sw = true, se = true;
for(int i = 1; i < ChessEngine.SQUARE_HEIGHT; i++) {
//if no more squares can be valid, bre... |
dd32931c-6e11-4976-85d6-be741d9b9d8d | 9 | protected void scanDirectory(File dir)
{
boolean ok = true;
File[] files = ( fileFilter != null ? dir.listFiles(fileFilter) :
dir.listFiles() );
// Process all the FILES first
for (int i = 0; i < files.length && ok; i++)
{
... |
385901e6-be22-4f16-838c-747972ca2b12 | 2 | public List<String> listIpAddress(String id) throws Exception
{
String response = getServer(id);
if (containsErrorMessage(response))
{
throw new Exception("Error retrieving ip address for instance id:" + id);
}
Document doc = stringToXmlDocument(response);
NodeList list = doc.getElementsByTagName("ip... |
304e3dd1-7bfd-4c45-bdfb-fa950dffaf93 | 0 | void updateTable() {
table.getItems().setAll(select());
} |
a9d61dd4-7321-4746-97c1-ad271c55334b | 0 | public String toLowerThis(String input){
MethodReferenceSAM methodReferenceSAM = this::toLowerCase;
return methodReferenceSAM.process(input);
} |
7e7f2ee9-78e5-4d25-9ecb-adb72bc56998 | 7 | @Override
public void executeMsg(Environmental affecting, CMMsg msg)
{
super.executeMsg(affecting,msg);
final MOB source=msg.source();
if(!canFreelyBehaveNormal(affecting))
return;
final MOB observer=(MOB)affecting;
if((source!=observer)
&&(msg.amITarget(observer))
&&(msg.targetMinor()==CMMsg.TYP_GI... |
c3a7f4d9-ab1f-4014-a4e1-586bcf8ce63e | 6 | public void execute() {
Process pro;
try {
pro = Runtime.getRuntime().exec("javac " + mapperClass + ".java"); // compile
pro.waitFor();
Class<?> myClass = Class.forName(mapperClass);
Class<?>[] paramsClass = new Class<?>[2];
paramsClass[0] = String.class;
paramsClass[1] = Output.class;
... |
ef0a2357-c5b2-4ed3-96e0-30eef0b13851 | 4 | public Node<T> getNode(T value) {
if (value == null) {
return null;
}
Node<T> node = root;
while (node != null) {
int delta = compare(node.getValue(), value);
if (delta < 0) {
node = node.getRight();
} else if (delta > 0) {
node = node.getLeft();
} else {
... |
31c9042c-8610-4055-9542-295420278314 | 4 | public GenKTR(Simulation simulation){
//Récupération de variables nécessaires à l'élaboration du fichier de sortie
int hyperperiode = simulation.getHyperperiode();
//Ouverture d'un flux d'écriture String
StringBuilder result = new StringBuilder();
//Définition de la précision
result.append(KIWI_INSTR... |
d9d9f268-e45f-4d2a-a0a9-655d9840912c | 4 | public void ReadFile() {
JSONParser jsonParser = new JSONParser();
try {
FileReader json = new FileReader("src/config.json");
Object obj = jsonParser.parse(json);
JSONObject jsonObject = (JSONObject) obj;
setHost((String) jsonObject.get("host"));
setPort((String) jsonObject.get("port"));
setUse... |
995eccc3-ba36-449d-85ba-db11a046f9a4 | 2 | public static void main(String[] args) throws IOException, ParseException {
// 0. Specify the analyzer for tokenizing text.
// The same analyzer should be used for indexing and searching
StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
// 1. create the index
Directory index =... |
52b8a3c7-192f-4125-a702-f434d0ded44f | 9 | private String getTextAsEps(String text) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
final char c = text.charAt(i);
if (c == '\\') {
sb.append("\\\\");
} else if (c == '(') {
sb.append("\\(");
} else if (c == ')') {
sb.append("\\)");
} else if... |
795ec9ae-e32b-4977-bada-b2eb635a8881 | 1 | public static SpriteStore get() {
if (instance == null) {
instance = new SpriteStore();
}
return instance;
} |
ce767925-92da-4ba9-b4fa-5fa33541f75b | 7 | @Override
public byte[] runBinaryMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) throws HTTPServerException
{
final MIMEType mimeType = MIMEType.All.getMIMEType(getFilename(httpReq,""));
if(mimeType != null)
httpResp.setHeader("Content-Type", mimeType.getType());
final String last=httpReq.getU... |
ffabf938-562d-4837-98f5-17d756e34aba | 5 | @Override
public void onEnable() {
getServer().getScheduler().scheduleSyncDelayedTask(this,
new Runnable() {
public void run() {
{
// CraftBukkit-specific
Configuration bukkitYML = new Configuration(
new File("bukkit.yml"));
bukkitYML.load();
List<String> worlds = ... |
e17492c9-cc9c-4b8a-8734-245696c4f0c2 | 5 | Tree makeList()
{
Tree myleft, myright;
Tree tleft,tright;
Tree retval = this;
// head of left list
if (left != null)
myleft = left.makeList();
else
myleft = null;
// head of right list
if (right != null)
myright = right.makeList();
else
myright = nu... |
eb26a369-8d54-4724-bd5e-3aa9bb7142f6 | 8 | private ArrayList buildPredicates() throws Exception {
ArrayList predicates = new ArrayList(); /* The result. */
Predicate predicate;
Attribute attr;
Enumeration attributes = m_instances.enumerateAttributes();
boolean individual = (m_parts != null); /* Individual-based learning ? */
/* Attribu... |
50529b9c-3a99-475e-8c07-a0174f78d234 | 1 | @Override
public void notifyObservers() {
for (Observer observer : observers) {
observer.update(temperature, humidity, pressure);
}
} |
691e4fbd-1452-4f8d-a45e-266df5971e53 | 7 | private void updateLinks(){
Link l = null;
for(Node source:nodes){
for(Node dest:nodes){
if(source.getName().equals(dest.getName())){
continue; // same node
}
l = getLink(source,dest);
if(l==null){
continue; //nodes arent neighbours
}
//if link has been ta... |
35ba0064-e44c-47ec-ba44-14de68b05843 | 9 | private static boolean isEmpty(int r, int t) {
if (r < 15 && t < 15 && r >= 0 && t >= 0){
String täht = Mang.MangulaudMassiiv[r][t];
return täht.equalsIgnoreCase(" ") ||
täht.equalsIgnoreCase("") ||
täht.equalsIgnoreCase("3xs") ||
täht.equalsIgnoreCase("2xs") ||
täht.equalsIgnoreCase("3xt") ... |
50ea6cae-7178-4253-a639-4d3f1d3dd665 | 0 | public ITable getTable() {
return _table;
} |
54a53a5d-8086-4f33-9a1b-02236416b6ec | 6 | @Override
public boolean insertAlbum(Album album) {
AlbumXML albumXML = new AlbumXML();
int lastAlbumID = 0;
try {
CDOrganizer cdOrganizer = XmlDAOFactory.unmarschallFile();
for (ArtistXML a : cdOrganizer.getArtistList()) {
if (a.getID() == album.getArtist().getId()) {
if ( a.getAlb... |
dee2cb6d-df9a-41bc-89b3-e987b5ac6ac7 | 8 | @Override
protected void setup()
{
if (createdByJADE)
{
Object[] args = getArguments();
if (args != null && args.length > 0)
{
String first = args[0].toString();
if (first.equals("full"))
{
int numberOfRequests = args.length/3;
if (args.length%3 == 1)
{
for (int i =... |
5fb9493b-f59e-41bf-b58f-46b73b5a85b4 | 4 | private void showHelp(CommandSender sender) {
StringBuilder user = new StringBuilder();
StringBuilder admin = new StringBuilder();
for (Command cmd : commands.values()) {
CommandInfo info = cmd.getClass().getAnnotation(CommandInfo.class);
if(!PermHandler.hasPerm(sender, ... |
69ea1f4b-2624-4672-90e8-c7b548a05d7a | 8 | static void createFiles() {
try {
boolean success = new File("data" + File.separator + "logins-db").mkdirs(); // make directory
if (success) {
Server.display("Created directory: data" + File.separator + "logins-db");
} else {
// File already ex... |
b33ae88a-71b8-4a78-ab68-c6a01fce9dff | 6 | public String decodeText(String _text) {
// Obfuscated code will return by using StringBuilder;
StringBuilder sb = new StringBuilder();
// Change text to Char array.
char ch[] = _text.toCharArray();
// Make String array per 1 character from ch[].
// This String array uses to check key character and etc.
... |
a550d239-b873-4096-83a2-8e4487f44875 | 7 | void add(String value, DefaultListModel valuesLM, JList jList)
{
if ((value == null) || (value.length() == 0))
{
return;
}
int i = 0;
for (Enumeration<?> e = valuesLM.elements(); e.hasMoreElements(); i++)
{
String s = (String)e.nextElement();
... |
4078b345-6556-45cd-bd4f-e4e68203bce4 | 6 | public RuleDefinitionInterface getRuleDefinition(URL defnFile) throws Exception {
RuleDefinitionInterface ruleDefi=(RuleDefinitionInterface)Factory.getFactory().getDataObject(Factory.ObjectTypes.RuleDefinition);
Document doc=getDocument(defnFile.openStream());
NodeList ruleSets=doc.getElementsByTagName("rulesets"... |
d8cbdd86-5868-4160-8b98-e7ea6b110359 | 0 | public void setNext(Items next) {
this.next = next;
} |
378e6ee6-65e6-4027-8880-af206769ea66 | 4 | public void updateEntity() {
this.lastProgress = this.progress;
if(this.lastProgress >= 1.0F) {
this.func_31010_a(1.0F, 0.25F);
this.worldObj.removeBlockTileEntity(this.xCoord, this.yCoord, this.zCoord);
this.invalidate();
if(this.worldObj.getBlockId(this.xCoord, this.yCo... |
6878a505-90b5-4a5f-ae46-5a80d8b03a7d | 0 | @Override
public void endDocument () {} |
1743b851-bac5-4cb5-b1b1-31546bd2f0c0 | 4 | public static boolean intersects(Polygon obj, Polygon gridBoundary)
{
Line2D[] objLines = new Line2D[obj.npoints];
Line2D[] gridLines = new Line2D[gridBoundary.npoints];
objLines[0] = new Line2D.Double(obj.xpoints[0], obj.ypoints[0] + 1,
obj.xpoints[1] + 1, obj.ypoints[1]);
objLines[1] = new Line2D.Double... |
616c8c18-c141-4184-a4c0-f03dc36ef489 | 0 | public static void main(String[] args) {
double d = 3.5;
int i = (int)d;
System.out.println(i);
} |
b1907c55-1225-4dfb-b229-cc38ee6bea14 | 2 | public void dispose() {
if (this.soundtrack != null) {
soundtrack.dispose();
}
for (Sound sound : sounds) {
sound.dispose();
}
// this.manager.unload("music/soundtrack.ogg");
} |
9d181b97-7e75-481d-95e7-b18ffc55b884 | 8 | @Override
public void improveSolution(Board board) {
// handle black cells
outer: while (board.getCount(CellColor.BLACK) < board.getSolutionBlackCount()) {
for (final Set<Cell> group : board.getGroups(CellColor.BLACK)) {
if (tryExpand(board, group, CellColor.BLACK)) {
// we need to sta... |
6ce97bed-2837-4bf8-843c-c44524524a58 | 7 | @Override
public void deserialize(Buffer buf) {
firstNameId = buf.readShort();
if (firstNameId < 0)
throw new RuntimeException("Forbidden value on firstNameId = " + firstNameId + ", it doesn't respect the following condition : firstNameId < 0");
lastNameId = buf.readShort();
... |
328e8607-cf30-4720-a087-e3e1915ba772 | 2 | public void open() {
// Create the dialog window
Shell shell = new Shell(getParent(), getStyle()); //Creates a shell object
shell.setText(getText()); //Sets the shell text to the return of getText
shell.setSize(WIDTH, HEIGHT); //Sets the size
createContents(shell); //Calls create contents
shell.open(); //Op... |
227605b1-b123-41c0-85a1-fa6dce0ec6b9 | 0 | public Enter(String title) {
super(title);
this.setLayout(new BorderLayout());
buttonList = new ButtonList();
tabs = new TabPane();
Container contentPane = getContentPane();
contentPane.add(buttonList,BorderLayout.NORTH);
contentPane.add(tabs,BorderLayout.CENTER);... |
6f5a93bd-61e5-4716-9f5d-4a08aa15adb6 | 8 | public boolean predictFromKBestList(GuideDecision decision) throws MaltChainedException {
if (decision instanceof SingleDecision) {
throw new GuideException("A sequantial decision model expect a sequence of decisions, not a single decision. ");
}
boolean success = false;
final SingleDecision singleDecisio... |
95dd686c-f40d-4dc1-83f7-56c5735be71d | 0 | public Detalle(int idDetalle, Encargo encargo, Producto producto, String otro, double precio, int cantidad, String color) {
this.idDetalle = idDetalle;
this.encargo = encargo;
this.producto = producto;
this.otro = otro;
this.precio = precio;
this.cantidad = cantidad;
... |
567a0527-43ac-4827-aa1c-c75e07d9520e | 4 | public static void main(String[] args) {
Random rand = new Random();
Integer[] states;
double[] distributionTheorique;
AlgorithmMCMC<Integer> algo;
MarkovChain mc;
double[] distributionExperimentale;
final int ITERATION = 100;
double pourcentages = 0;
... |
427aac2b-3286-4129-be5b-e3572e9a9bae | 7 | @Override
public void mouseReleased(MouseEvent e) {
for (Button b : buttons) {
if (e.getPoint().x > b.p.x && e.getPoint().x < b.p.x + b.d.width && e.getPoint().y > b.p.y && e.getPoint().y < b.p.y + b.d.height) {
if(e.getButton() == 1){
b.left.run();
} else if(e.getButton() == 3){
b.right.run();
... |
032ca25b-f724-48cd-8ebe-f85147ad51bf | 2 | public static String computeXpath (Node node) {
String Xpath = localXpath(node);
if ("" == Xpath) {
return Xpath;
}
else {
Node parent = node.getParentNode();
String moreXpath;
while (null != parent.getLocalName()) {
moreXp... |
2a5078c9-24d7-414e-8e5d-4180c2da8cca | 4 | public boolean equals(Phasor a){
boolean test = false;
if(this.isNaN() && a.isNaN()){
test=true;
}
else{
if(this.magnitude == a.magnitude && this.phaseInDeg == a.phaseInDeg)test = true;
}
... |
c14bf0ad-7a7f-4ae6-82a9-ba1bbbabc7eb | 8 | private void set(String d, String in) {
if (d.equals(MovieColumn.LANGUAGE)) {
language = in;
}
else if (d.equals(MovieColumn.MOVIE_ID)) {
movie_id = in;
}
else if (d.equals(MovieColumn.MOVIE_NAME)) {
movie_name = in;
}
else if (... |
cf48ed14-06a1-448e-b6ca-f18ed6d3def0 | 1 | public void printList(){
System.out.println("Name: " + this.name + ", Age: " + this.age + ", Illness: " + this.illness);
if (nextPatient != null){
nextPatient.printList();
}
} |
4e1d45f8-9b20-45ed-a390-ce74a140e7ff | 5 | static private int jjMoveStringLiteralDfa8_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(6, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0);
return 8;
}
switch(curChar)
{
cas... |
84dc7537-a464-452f-82b0-ea986ea39243 | 3 | protected String format(ProtectionDomain pd, Permission... perms) {
final CodeSource cs = pd.getCodeSource();
if (null == cs) {
return null;
}
final URL url = cs.getLocation();
if (null == url) {
return null;
}
final StringBuilder sb = ne... |
3a4d5f0c-07c6-4c03-ad81-f5e6dc750c8d | 5 | public static int findClosingParenIteratively(String s, int startingParenLoc) {
// check for valid parens location
int openParenCounter = 1;
int returnVal = -1;
if (errorCheck(s, startingParenLoc))
return -1;
for (int i = startingParenLoc + 1; i < s.length(); i++) {
if (s.charAt(i) == '(') {
open... |
c1898db6-2321-4572-8f01-7107f2b779cd | 2 | public int firstIndexOf(int datum) {
for (int i = 0; i < size; i++) {
if (data[i] == datum) {
return i;
}
}
return -1;
} |
c7b9d608-a896-4048-a9b6-55e3319d0f28 | 8 | public static SqlMod updateSql(Model model) {
List<Object> params = new ArrayList<Object>();
String tableName = tableName(model);
List<Field> fields = fields(model);
List<String> _fields = new ArrayList<String>();
Serializable idVal = 0;
String idName = null;
for (Field f : fields) {
Id id = f.getAnnot... |
e4ff39bd-2e0b-4d14-abaa-ec77977f7cc3 | 7 | public int solution(final int[] sizes, final int[] directions) {
final Deque<Fish> stack = new LinkedList<Fish>();
final int N = sizes.length;
for (int i = 0; i < N; i++) {
final Fish downstreamFish = new Fish(sizes[i], directions[i]);
while (!stack.... |
e1f88493-521b-4271-b4ad-0c5b39d89e73 | 2 | @Override
public boolean equals(Object other)
{
boolean result = false;
if (other instanceof RouteLeg)
{
RouteLeg that = (RouteLeg) other;
result = this.startNode == that.startNode && this.endNode == that.endNode;
}
return result;
} |
2ef0c3a0-2c4a-4f44-8839-922134c848ce | 9 | @Override
public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
String cmd = splitted[0];
MapleCharacter pl = c.getPlayer();
if (cmd.equalsIgnoreCase("donated")) {
if (splitted.length != 4) {
pl.dropMessage("syntax : !donated... |
72ec5a6d-c1f8-43de-8d4d-266ca47188cb | 2 | @Override
public void evaluate(final Population a_chromosomes) {
double curFitness;
final Iterator itChromosomes = a_chromosomes.iterator();
IChromosome chromosome;
while (itChromosomes.hasNext()) {
chromosome = (IChromosome) itChromosomes.next();
curFitness... |
3ccab742-e58d-4c66-92ca-9ac8bbde8295 | 2 | public static void play(Resource res, boolean loop) {
synchronized(Music.class) {
if(player != null)
player.interrupt();
if(res != null) {
player = new Player(res, player);
player.loop = loop;
player.start();
}
}
} |
0555a123-5e22-4553-908a-6bfeb5edc363 | 3 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
config = plugin.getConfig();
if (args.length == 0){
if (sender instanceof Player) {
if (commandLabel.equalsIgnoreCase("winner")) {
Player player = Bukkit.getServer().getPlayer(args[0]);
Bukkit.getServe... |
9abda8e7-2fc2-4274-87a7-155be9100893 | 6 | public void removeListener (Listener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
synchronized (listenerLock) {
Listener[] listeners = this.listeners;
int n = listeners.length;
if (n == 0) return;
Listener[] newListeners = new Listener[n - 1];
for ... |
63867347-b3e6-4ce0-b517-a25800f99441 | 3 | public void saveCape(SpoutPlayer player) {
File saveFile = new File(getDataFolder(), "saved.yml");
if (!saveFile.exists()) {
try {
saveFile.createNewFile();
} catch (IOException ex) {
Logger.getLogger(PlayerPlus.class.getName()).log(Level.SEVERE, null, ex);
}
}
YamlConfiguration yFile = YamlCo... |
f8e00d7c-6bc9-492f-9154-c1d900efb13f | 3 | @Override
public boolean confirmOrder(ArrayList<Product> order) {
//Verify
for (Product p : order) {
if (!dbHandler.verifyInventory(p.getId(), -p.getInCurrentCart())) {
return false;
}
}
//Change inventory
for (Product p : order) {
dbHandler.addInventory(p.getId(), -p.getInCurrentCart());
}... |
4e5723b4-ceac-4e0b-b99f-1124ca961f54 | 1 | public void visit_invokeinterface(final Instruction inst) {
final MemberRef method = (MemberRef) inst.operand();
final Type type = method.nameAndType().type();
stackHeight -= type.stackHeight() + 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += type.returnType().st... |
8b979553-bc0b-474b-b6b0-cd29e438e983 | 0 | public static World createWorld(int width, int height) {
stoneBoundary = height - 2*(height/3);
dirtBoundary = height - 2*(height/3) - height/12;
blockSheet = new int[width][height];
createStone(width, height);
createDirt(width, height);
createTrees(width, height);
FacilityGenerator.createFacility(b... |
7421b3f0-0483-4fde-b32c-260e90d0de82 | 4 | public int MovePacket(int inputBufferNumber, int outputBufferNumber, int TIME)
{
//ONLY ONE BUS PRESENT IN THIS FABRIC
//if Active status was successful and the flag is true for having
//control of the bus
//set packet moved default
packetMoved = false;
... |
032a451a-578a-4ba7-977f-513729ddb26f | 9 | @Override
public void generateChunk(InitialBlocks chunk, int chunkX, int chunkZ) {
//EC: use the one passed in instead
//int chunkX = chunk.getX();
//int chunkZ = chunk.getZ();
for(int x=0; x<16; x++) {
for(int z=0; z<16; z++) {
int trueX = chunkX*16+x;
int trueZ = chunkZ*16+z;
chunk.setBloc... |
f83befe2-32ff-404b-a3c9-48159ed342b7 | 8 | private static CtClass findCommonSuperClass(CtClass one, CtClass two) throws NotFoundException {
CtClass deep = one;
CtClass shallow = two;
CtClass backupShallow = shallow;
CtClass backupDeep = deep;
// Phase 1 - Find the deepest hierarchy, set deep and shallow correctly
... |
cdc94e4f-5adc-4995-ab6a-83700c01da9e | 1 | public boolean hasLocationpath(String xpathExpression){
if (xpathExpression.contains("/")){
return true;
}else{
return false;
}
} |
77b55dc2-3cf3-45f3-bdcc-959ef2b3ab64 | 2 | public void open(Player player) {
Inventory inventory = Bukkit.createInventory(player, size, name);
for (int i = 0; i < optionIcons.length; i++) {
if (optionIcons[i] != null) {
inventory.setItem(i, optionIcons[i]);
}
}
player.openInventory(inventor... |
6e61f6c5-bd37-4c35-bd99-2315a4599e0b | 2 | public boolean canScroll(Direction scrollDirection) {
Point robot = model.getRobotLocation();
int topBorder = Math.abs(panel.getScroll());
int bottomBorder = Math.abs(panel.getScroll()) + panel.getHeight();
switch(scrollDirection) {
case DOWN:
return robot.y <= (topBorder + 50);
case UP:
return robot.... |
0715374a-2006-4f1f-80da-89fe29d3dda9 | 9 | public Coordinate setAIMove() throws IndexOutOfBoundsException,
InterruptedException {
boolean test = false;
if (test || m_test) {
System.out.println("OthelloAI :: setAIMove() BEGIN");
}
ArrayList<Coordinate> listTwo = new ArrayList<Coordinate>();
listTwo = getAvailableMoves();
in... |
802cc032-6e0d-4c95-a871-f2f192607ebf | 6 | public void deleteFile() {
String dirPath = "resources/files/RecipeData/" + recipeID + ".json";
File currFile = new File(dirPath + recipeID + ".json");
if (!currFile.exists()) {
return; //there is nothing to delete
}
String jsonString = ""; //the json String representation of the last File
RecipeData ... |
b90031e6-6396-4778-9db2-240a03108405 | 2 | public double rawStandardDeviationCorrelationCoefficients(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.rawStandardDeviationRhoWithoutTotals;
} |
3729c705-423a-405f-beaf-ef186d189036 | 9 | public ArrayList<Geometry> calculate(ArrayList<Residue> residueList) {
ArrayList<Geometry> geoArray = new ArrayList<Geometry>();
for (int i = 0; i < residueList.size() - 5; i += 2) {
if (!residueList.get(i).getSS().equals("T") && !residueList.get(i+4).getSS().equals("T")
&& !residueList.get(i+1).getSS().e... |
8e930719-ec91-4bd6-b962-816969c55f6a | 6 | public static void createOpponentCardInfo(ItemStack item, Card c) {
if(MonsterCard.class.isInstance(c)) {
MonsterCard mc = MonsterCard.class.cast(c);
if(mc.faceup)
Duelist.createCardInfo(item, c);
else {
Main.setItemName(item, "?");
Main.giveLore(item, 4);
Main.setItemData(item, 0, "[Monster]... |
b7bd2350-afb3-4683-8016-edc40ebf1db4 | 0 | void setObjectAlreadyInDB(boolean objectAlreadyInDB) {
this.objectAlreadyInDB = objectAlreadyInDB;
}//setObjectAlreadyInDB |
afc53a0a-73d3-47fe-b26d-c4de25aaf8d0 | 4 | public void testBinaryCycAccess10() {
System.out.println("\n**** testBinaryCycAccess 10 ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_... |
b004d819-526f-4d14-afef-13d59210efb0 | 9 | @Test
public void selectLocationTest() {
System.out.println(board.getPlayers().size());
ComputerPlayer player = (ComputerPlayer)board.getPlayers().get(0);
// Pick a location with no rooms in target, just three targets
board.calcTargets(board.calcIndex(3, 3),2);
int loc1 = 0;
int loc2 = 0;
int loc3 = 0;
... |
7a489660-46a0-4a1b-8e84-ead67b326b59 | 2 | public static GoHomeAndSleepTillRested getSingleton(){
// needed because once there is singleton available no need to acquire
// monitor again & again as it is costly
if(singleton==null) {
synchronized(GoHomeAndSleepTillRested.class){
// this is needed if two threads are waiting at ... |
a93575b8-132c-44eb-9ea5-b8001977b117 | 7 | **/
private void exciteVerticalSameShapeRecognizers(int shape) {
int shapeOffset = 2500 * shape;
double weight = 0.3;
for (int neuron = 0; neuron < 2500; neuron++) {
if (neuron % 5 != 0) {// not the inhibitory ones
int toNeuron;
int fromNeuron = neuron + shapeOffset;
int from... |
4bb6c89d-e114-4198-9794-17e28b4ae16a | 0 | public DisplayMode[] getCompatibleDisplayModes() {
return device.getDisplayModes();
} |
4fb22332-0160-4cbd-9ed5-3266413c5b57 | 9 | public void renderElementalCircle(int xp, int yp, Element e, int phase) {
int col = 0;
Sprite sprite = Sprite.elementalCircle[phase];
switch (e) {
case FIRE: { col = 0xffE5554C; break; }
case WATER: { col = 0xff4C70E5; break; }
case EARTH: { col = 0xff82E54C; break; }
case WIND: { col = 0xffE5E5E5; bre... |
ced01371-7690-40f9-a8f5-0b3b460c4802 | 2 | private void checkForRotation(){
double tangent = (this.highYaxisXpixel - this.lowYaxisXpixel)/(this.highYaxisYpixel - this.lowYaxisYpixel);
this.angleYaxis = Math.toDegrees(Math.atan(tangent));
tangent = (this.lowXaxisYpixel - this.highXaxisYpixel)/(this.highXaxisXpixel - this.lowXaxisXpixel);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.