method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6c6fc7b9-d9bf-414a-9e24-dbf42a991ba1 | 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 Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.usuarioId == null && other.usuarioId !=... |
d4a412d3-baaf-4180-8e80-74708ff0eae4 | 8 | private void update(CovingtonConfig covingtonConfig, int trans) throws MaltChainedException {
if (trans == SHIFT || trans == RIGHTARC) {
covingtonConfig.setRight(covingtonConfig.getRight() + 1);
covingtonConfig.setLeft(covingtonConfig.getRight() - 1);
} else {
int leftstop = covingtonConfig.getLeftstop();
... |
053693b5-9fcb-474f-991d-f64b52b0f9c7 | 8 | public void serialise(PrintWriter pDestination){
if(mManifestBuilder.getManifestEntryMap().size() == 0){
throw new ExFatalError("Manifest must have at least one entry to be serialised");
}
//Establish the maximum column width for manifest positions
int lNumberLength = mManifestBuilder.ge... |
1364eecc-9715-43a8-b582-31896b84464c | 0 | public Employee(String n, double s, int year, int month, int day)
{
name = n;
salary = s;
GregorianCalendar calendar = new GregorianCalendar(year, month - 1, day);
hireDay = calendar.getTime();
} |
fe1c3550-973f-44ae-bbc1-c9f884cb63c7 | 0 | public void setCtrl(CtrlComptesRendus ctrlCR) {
this.ctrlCR = ctrlCR;
} |
a1328e10-b2ab-418e-84f3-73bd77e9e3c5 | 5 | public void draw(Graphics g, ImageObserver io){
if(waittime > 0){
waittime = waittime - 1;
return;
}
g.drawImage(bimage1, char_x, char_y, io);
char_x = char_x - 4;
if(char_x < -48){
syutsugen();
}
if(spkey == true){
speed = speed - 0.15;
}else{
speed = speed + 0.15;
}
if(speed >... |
720a0c08-e81b-4976-9a97-3aceba838cef | 3 | public static SpeexPacket create(OggPacket packet) {
// Special header types detection
if(isSpeexSpecial(packet)) {
return new SpeexInfo(packet);
}
if (packet.getSequenceNumber() == 1 && packet.getGranulePosition() == 0) {
return new SpeexTags(packet);
}
... |
fb1f965c-880e-4221-b70e-80065558cf90 | 2 | public void reset() {
loggerMainClass.entry();
if (detailPanels.size() > 1) {
for (int i = 1; i < detailPanels.size(); ++i) {
detailBasePanel.remove(detailPanels.get(i));
}
}
DetailPanel detailPanel = detailPanels.get(0);
detailPanels.removeAll(detailPanels);
detailPanels.add(detailPanel);
logge... |
0ecf8c37-3c6f-4244-897d-af9ef607eb23 | 6 | @Override
public boolean halt(Event lastEvent, OurSim ourSim) {
msgs++;
if (msgs % 100000 == 0) {
System.out.println(msgs);
}
if (!lastEvent.getType().equals(BrokerEvents.HERE_IS_EXECUTION_RESULT)) {
return false;
}
boolean halt = true;
List<Job> finishedJobsList = new... |
3ca8db3b-5fe1-4002-b05b-1e7ddb0677a3 | 8 | public Vector getObjects(String prefix,int cidmask,boolean suspended_obj,
JGRectangle bbox) {
Vector objects_v = new Vector(50,100);
int nr_obj=0;
JGRectangle obj_bbox = tmprect1;
int firstidx=getFirstObjectIndex(prefix);
int lastidx=getLastObjectIndex(prefix);
for (int i=firstidx; i<lastidx; i++) {
JGO... |
cc3cf38d-925c-4812-bf55-876db99adb1c | 2 | public TokenManager(int cantidadDeTokensDeLookahead, FileReader archivo) throws FileNotFoundException, InvalidCantidadDeTokensDeLookaheadException {
//Aquí seteamos el archivo a ser leído
setScanner(new LexerCoffeeScript(archivo));
//Contendra los tokens en un buffer
set... |
436d2b75-4898-44e2-b1bc-1732ab079017 | 9 | public void renderTopFace(Block par1Block, double par2, double par4, double par6, int par8)
{
Tessellator var9 = Tessellator.instance;
if (this.overrideBlockTexture >= 0)
{
par8 = this.overrideBlockTexture;
}
int var10 = (par8 & 15) << 4;
int var11 = par... |
16122938-e071-4f27-b5ab-5f0a60dc2065 | 3 | @Override
public void init() throws IOException
{
try
{
onInit();
initialized = true;
}
catch (IOException e)
{
throw e;
}
catch (RuntimeException e)
{
throw e;
}
if (initialized)
{
outbound = new PriorityQueue<RemoteMethodCall>();
inbound = new ArrayDeque<RemoteMethodCa... |
330b603e-d087-4e7f-9cc0-51e455e428c5 | 3 | public ArrayList<Byte> getStringAsByteList(String name)
{
List<String> value_list = strings_map.get(name);
ArrayList<Byte> result = new ArrayList<Byte>();
if(value_list == null)
{
return result;
}
for(String val:value_list)
{
try
{
result.add(Byte.valueOf(val... |
b83fced5-0a28-4388-8b59-53e50d4a0b37 | 9 | public Ast.AstPredicate parse_Predicate1(SpecObject specObject, String property)
{
int at = m_current;
if (!ok())
{
return null;
}
int tat;
// Predicate1 : Expression Relation...Relation Expression
Ast.AstExpression enode = parse_Expressi... |
a1aa79af-7e5d-4089-ad4a-2398646e33ed | 3 | public static void lap(String name) {
long end = System.nanoTime();
if (!initialized)
return;
int index = names.indexOf(name);
if (index < 0) {
index = names.size();
names.add(name);
sums.add(0L);
counts.add(0L);
}
long before = sums.get(index);
sums.set(index,sums.get(index) + end - timer... |
60617558-db60-44ca-b65a-b6460b074656 | 5 | protected HantoGame setupGame(boolean doIMoveFirst, HantoGameID version){
HantoGame aGame = null;
if (doIMoveFirst){
aGame = HantoGameFactory.makeHantoGame(version, myColor);
} else {
switch(myColor){
case RED:
aGame = HantoGameFactory.makeHantoGame(version, HantoPlayerColor.BLUE);
break;
case... |
6e779ed5-5c50-46ed-826b-4a86c3feb3cf | 9 | public void twist()
{
if(twistCount == 0)
{
card3 = newDeck.getCard(0);
newDeck.removeCard(0);
if("Ace".equals(card3.cardFace)
&&totalVal>=11){card3.cardValue=1;}
totalVal+=card3.cardValue;
twistCount++;
maxCa... |
146709f1-378f-40b0-9663-a1e47a0ec833 | 2 | private int readValue
(Res_Value val,
byte[] remainingData,
int offset) throws IOException {
int initialOffset = offset;
val.size = readUInt16(remainingData, offset);
offset += 2;
if (val.size > 8) // This should always be 8. Check to not fail on broken resources in apps
return 0;
val.res0 =... |
1bc8456b-677f-49dd-a479-040147a8e6b3 | 9 | private Arme armeRandom()
{
double rand = Math.random() * 10;
/*** Renvoie les armes de puissance 2 et 3 car de base, les personnages ont des armes de puissance 1 **/
if(rand>9) return new Arme(epe2);
else if(rand>8) return new Arme(epe3);
else if(rand>7) return new Arme(arc... |
a2b1a6a0-1afd-42d5-a5d6-d72d1264819d | 7 | private void addTerm(Term nextTerm) {
//this takes care of reorganizing each term in the polynomial in the correct descending order.
//This will not add terms with coefficient equal to zero and will add zero if the polynomial is empty
if(nextTerm.getCoefficient()!=0){
if(this.terms.isEmpty()){
this.terms.... |
95c42e70-99bb-46bd-baaa-07ea023b2c84 | 9 | private double calcX(final double LEFT, final double TOTAL_WIDTH) {
switch (popupLocation) {
case TOP_LEFT : case CENTER_LEFT : case BOTTOM_LEFT : return LEFT + offsetX;
case TOP_CENTER: case CENTER : case BOTTOM_CENTER: return LEFT + (TOTAL_WIDTH - width) * 0.5 - offs... |
eb305cc7-70fc-418b-9334-3252873f7ad6 | 4 | private void initHomePanel(){
panelHome = new JPanel();
panelHome.setLayout(new GridLayout(2, 1));
ArticleDao ad = ArticleDao.getInstance();
List<Article> storedAr = ad.findAll();
if(storedAr.size() == 0)
{
RssFeadReader rf = new RssFeadReader("http://www.psg.... |
610de17a-789c-489f-bfc4-d80eab55e29b | 1 | public void printByDepth() {
if (root == null)
System.out.println("Tree is empty");
else
byDepth(root);
System.out.println();
} |
d9d850cc-8b24-4da9-97ea-3ffde3333c31 | 5 | @RequestMapping(value = "del", method = RequestMethod.POST)
@ResponseBody
public Map del(@RequestParam int[] id) {
Map<String, Object> map = new HashMap<>();
List<String> l1 = new ArrayList<>();
List<String> l2 = new ArrayList<>();
List<String> l3 = new ArrayList<>();
f... |
3da19fa0-a522-46de-908a-0d94f4bec5fa | 4 | private void doStart() {
if (!PortKit.isAvailable(port)) {
throw new IllegalArgumentException("the port is already used :"+port);
}
deletSessionData();
/*
* |Server|连接 |Connector|与|Handler|
* |---------------------------------------------------------------------|
* | --------------- -... |
65d2690a-1045-4cfc-b38c-9fd9ad63fa9a | 7 | public static ChunkCoordinates getNearestEmptyChunkCoordinates(World par0World, int par1, int par2, int par3, int par4)
{
int var5 = par0World.getBlockMetadata(par1, par2, par3);
int var6 = BlockDirectional.getDirection(var5);
for (int var7 = 0; var7 <= 1; ++var7)
{
int ... |
44ea31bc-d715-4cff-be48-cdb770dad3c4 | 1 | public void Log(String message) {
synchronized(queue) {
if (!Running)
return;
queue.add(message);
}
} |
e479ac07-2d5a-4c80-917a-5af682dc2f94 | 8 | private void fixDoubleRed(Node child){
Node parent = child.parent;
Node grandParent = parent.parent;
if (grandParent == null) { parent.color = black; return; }
Node n1, n2, n3, t1, t2, t3, t4;
if (parent == grandParent.left){
n3 = grandParent; t4 = grandParent.right;
... |
b992ef96-39cd-486a-9a78-9a70b10dbdd7 | 9 | public int uniquePathsWithObstacles(int[][] obstacleGrid) {
if(obstacleGrid == null || obstacleGrid.length == 0){
return 0;
}
int nr = obstacleGrid.length;
int nc = obstacleGrid[0].length;
int [][] DP = new int[nr][nc];
for(int i = 0; i < nc; ++i){
... |
6beafc0a-f620-433f-bdf9-9dc4a2236a63 | 1 | public void print(String temp) {
System.out.println("sms: " + temp);
try {
Connection = ConnectionFactory.createConnection();
session = Connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
System.out.println("reach here");
produc... |
bd348dea-c850-4d0a-a49a-e978108b4600 | 7 | private void test(TreeNode<K, D> nd) {
if (nd == getRoot()) {
satisfied = satisfied && nd.getColor() == BLACK;
return;
}
if (isNil(nd)) {
satisfied = satisfied && nd.getColor() == BLACK;
return;
}
... |
1b41bf55-cbe9-44ca-8f30-0282b3305037 | 6 | public static int hex2int( char hex )
throws NumberFormatException {
// '0' to '9' in ASCII: 48 to 57 (dec)
// 'A' to 'F' in ASCII: 65 to 70 (dec)
// 'a' to 'f' in ASCII: 97 to 102 (dec)
if( hex >= 48 && hex <= 57 ) {
// '0' to '9'
return (hex-48);
} else if( hex >= 97 && hex <= 102 ) {
// '... |
281625a3-dbe8-4c82-8126-a771faab4249 | 8 | public static boolean classImplements(Class<?> clss, Class<?> excls) {
Class<?> sprcls = clss;
while (sprcls != null) {
Class<?>[] interfaces = sprcls.getInterfaces();
for (Class<?> interface1 : interfaces) {
if (interface1.equals(excls)) {
r... |
86318f1b-6300-4f8e-8254-8f2c91a4f9b5 | 6 | private char scanDiagonal(Diagonal diagDirection) {
final boolean isLeftDiagonal = diagDirection == Diagonal.Left;
final char startToken = _board[0][isLeftDiagonal ? 0 : _board.length - 1];
int row = 1;
int col = isLeftDiagonal ? 1 : _board.length - 2;
while (row < _board.length && col >= 0) {
if (_boar... |
4ac9c9a4-d831-4fd1-b1a7-20f7ec1e223a | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
4c3a7d20-2638-47dd-b65b-c704f5a1f649 | 7 | private void mergeWithoutSentinelNode(int[] a, int p, int q, int r) {
int[] L = new int[q - p + 1];
int[] R = new int[r - q];
for (int i = 0; i < L.length; i++) {
L[i] = a[p + i];
}
for (int i = 0; i < R.length; i++) {
R[i] = a[q + i + 1];
}
int i = 0;
int j = 0;
int k = p;
while (i < L.length... |
0465afc5-2fa6-4530-bd21-333286b33d62 | 6 | private int checkPoint(String axis,int value){
if(axis == "X"){if (value >= xmax){return -1;}
if (value < 0){ return -1;}
return value;}
if(axis == "Y"){if (value >= ymax){return -1;}
if (value < 0){ return -1;}
return value;}
return -1;
} |
961fe345-cd28-44d1-8f1d-4ccc1c423fac | 5 | public void navigate(final boolean next) {
final int pos = model.getParseTreePos();
final ParseTree[] trees = model.getParseTrees();
if(!next && pos <= 0 || next && pos >= trees.length - 1) return;
showTree(pos + (next ? 1 : -1));
} |
0ba0e6bd-63c0-48e0-b7bc-07ffc5860c55 | 1 | public static boolean getMouseUp( int mouseButton )
{
return !getMouse( mouseButton ) && lastMouse[mouseButton];
} |
ca02b79d-bf97-4b08-9cb6-2c1b986eabb6 | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
03171100-3448-4bc9-b94a-aedd750cd5c5 | 6 | final Interface18_Impl3 method3830(int i, int[] is, boolean bool,
byte i_60_, int i_61_, int i_62_,
int i_63_) {
try {
int i_64_ = 101 / ((i_60_ - -21) / 46);
anInt9830++;
if (aBoolean9926
|| Class192.method1436(103, i) && Class192.method1436(-53,
i_63_))
return n... |
2c2bb309-c9ac-47b4-ad51-1194ed9bb7ae | 4 | @Override
public boolean create(Reservation x)
{
String req = "INSERT INTO `reservation`("
+ "`datedebut`, "
+ "`datefin`, "
+ "`particulierid`, "
+ "`chambreid`"
+ ") "
... |
183b03c4-e5d5-42be-9cfd-5ffab1e7bd80 | 1 | private void open(String request) {
Request req = new Request(request, callback);
if(request.indexOf("/wiki/")>=0) {
request = request.replaceAll("/wiki/", "");
req.initPage(request);
}
synchronized (busy) {
busy = true;
}
reader.search(req);
} |
54509bfe-a404-4d60-b481-4a91e3bad55f | 1 | private void setupSocket() {
try {
socket = new DatagramSocket(port);
} catch (SocketException e) {
e.printStackTrace();
System.exit(1);
}
} |
67c960e1-04aa-4791-8a33-608f107ef35c | 4 | public static byte[] integer2Bytes(int src, int bytesLen, boolean littleEndian) {
byte[] bytes = new byte[bytesLen];
if (littleEndian) {
for (int i = 0; i < bytes.length; i++) {
bytes[i] = ((byte) (src >> 8 * i & 0xFF));
}
} else {
int j = 0;
for (int i = bytes.length - 1; (i >= 0) && (j < bytes.l... |
88022208-ea19-46f9-a0b8-2c85de2b147d | 3 | @Override
public final void mouseReleased(final MouseEvent e) {
final JPanel globalMenuPanel = new JPanel();
this.abcMapPlugin.panelCenter.remove(this.globalParamsButton);
GUI.Button.OK.getButton().setVisible(false);
this.splitButton.setVisible(false);
GUI.Button.ABORT.getButton().setVisible(false);
this.t... |
93924b02-ac6e-4344-8dfc-2ff9bd780ea2 | 1 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (Exception ex) {
System.out.println("Error at removeUser.java servlet : " + ex);
... |
0379fe3d-697c-4b14-b016-57987bb102a9 | 5 | public static Polynomial getPrimitive(final int degree, final int start) {
final int requiredOrder = (1 << degree) - 1;
int test = start;
Polynomial polynomial = new Polynomial(test);
while(polynomial.getWeight() % 2 == 0 || !polynomial.isMonomial() || polynomial.getDegree() < degree || ... |
364a1c86-8df4-4f9f-bfa2-89968f0a76b4 | 1 | public final void showLayer(GameLayer layer) {
if (!gameLayers.containsValue(layer)) {
logger.error(new NullPointerException(),
"Tried to unhide a game layer that isn't registered to the GameScreen :: ", this);
} else {
layer.unhide();
}
} |
db4d8b2a-fd7a-4df6-8b33-7f41d0efa151 | 5 | public boolean hasChanged()
{
if(parent != null && parent.hasChanged())
return true;
if(!pos.equals(oldPos))
return true;
if(!rot.equals(oldRot))
return true;
if(!scale.equals(oldScale))
return true;
return false;
} |
98aebc46-531c-4d78-b387-01f5da20b5a4 | 3 | @Override
boolean transcriptChange() {
//a star followed by distance to cds end
if (downstream.intersects(seqChange)) {
//distance to cds end
//this may be much farther than the distance to the polyA reported by SnpEff
//especially for alternate 3' end isoforms
... |
c8fb5306-14eb-42e3-aeec-b5a7739150dc | 7 | public void next() {
if (!hasNext()) { return; }
synchronized(model) {
// generate a new round:
if (cursor == history.size()) {
//long startTime = System.currentTimeMillis();
List<Action> round = nextRound();
for(Action action : model.cleanup()) {
action.apply();
round.add(action);
... |
12484497-6eea-44c8-af48-40de2d9daf07 | 0 | private void createDialog(String answ) {
final JDialog dialog = new JDialog();
dialog.setSize(500, 250);
dialog.getContentPane().setLayout(null);
dialog.setLocationRelativeTo(this);
dialog.setLayout(null);
JLabel lblAnswerLabel = new JLabel("Wprowadź odpowiedź");
lblAnswerLabel.setBounds(25, 25, 134, 14... |
dfb9562f-7f52-4e1b-9ff0-6dc2e4763faf | 0 | public TasonLuonti(ArrayList<String> rivit) {
this.rivit = rivit;
this.taso = new Taso();
teeTaso();
} |
f9acb867-c4fd-46ab-b53c-7ef4f156c337 | 0 | public String getAuther() {
return this.auther;
} |
bda6c9cc-70da-4459-b05a-1f2af61f252d | 0 | protected boolean canBreed()
{
return getAge() >= getBreedingAge();
} |
a1550b83-139c-46e0-8467-6b4390f67c4b | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final BufferReady other = (BufferReady) obj;
if (notificationThreshold == null) {
... |
2aeb5250-cb62-4fec-8c66-91b6f7fb9e46 | 9 | private boolean downloadPiece(int len)
{
piece_to_download = peer.getPeerResponseInt();
offset = peer.getPeerResponseInt() / block_length;
logger.debug("i = " + piece_to_download + ", o = " + offset);
byte[] received_bytes = peer.getPeerResponse(len - 9);
onDownload(received_bytes.length);
byte[] tmp... |
12b4ed6d-c1ee-4902-b647-13f67da53981 | 5 | private void addNeighboorIfExistsYo(Array newNeighboor, Ways way) {
Array nextNeighboor = null;
switch (way) {
case EAST:
nextNeighboor = this.findArrayByXYYo(newNeighboor.posX + 1,
newNeighboor.posY);
break;
case NORTH:
nextNeighboor = this.findArrayByXYYo(newNeighboor.posX,
newNeighboor.pos... |
16fa4e85-07d4-45b8-9406-a094b7444d0d | 9 | protected static int extractInt(int[] data, int startBit, int length) {
if (data == null) {
throw new IllegalArgumentException("data == null");
}
if (startBit < 0) {
throw new IllegalArgumentException("startBit < 0");
}
if (length <= 0) {
throw... |
70fcee44-0140-4edd-b95b-53ae6767d18f | 3 | public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (this.opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
this.put(key, value);
}
return this;
} |
f1ca945f-137b-46c0-811f-629d76b68b1a | 1 | private void drawTableCards(Graphics g) {
// the order in which rows are drawn
// i.e., row 0, then row 4, then row 1,
// etc.,
int[] orderToBeDrawn = { 0, 4, 1, 3, 2 };
/*
* Stage 4 (6 Marks)
*/
for (int i : orderToBeDrawn) {
drawRowOfCards(g, i);
}
} |
6cfca6f8-d839-4028-9fca-d4c8b01c43ca | 0 | protected double returnPIDInput() {
return Robot.driveTrain.getGyroAngle();
} |
9820bc7d-5a3a-4a92-b4a0-643fac8ff834 | 7 | public String GetJobResult(String jobId) {
GetJobOutputRequest getJobOutputRequest = new GetJobOutputRequest()
.withVaultName(this.vaultName)
.withJobId(jobId);
GetJobOutputResult jobOutputResult = AppCache.getClient().getJobOutput(getJobOutputRequest);
... |
416e8af1-06c7-4f6d-94e1-3950c3273d7d | 0 | @Override
public IEmailKontakt create() {
EmailKontakt ek = new EmailKontakt();
return ek;
} |
f45f25cf-2f54-45bc-8fe0-10cbb84bfe63 | 6 | public String scrapeNutrition(Document document){
Elements elements = document.select("ul.nutrDetList > li > span.center");
String output = "";
for (Element element : elements){
String attribute = element.attr("itemprop");
String amount = element.text();
if (a... |
7d7c8347-8d3e-49f9-94b4-b6b58004496c | 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:/... |
17b142b5-0902-4fe0-958c-5366dab6e78b | 2 | public static byte[] getBytesFromInputStream(InputStream is) {
try (ByteArrayOutputStream os = new ByteArrayOutputStream();) {
byte[] buffer = new byte[0xFFFF];
for (int len; (len = is.read(buffer)) != -1;)
os.write(buffer, 0, len);
os.flush();
return os.toByteArray();
} catch (IOException e) {
... |
18dfec5b-9710-483b-be48-23c8596e6a89 | 0 | public MessagePanel(String startText) {
// textArea.setRows(rows);
// textArea.setColumns(columns);
//
// textArea.setWrapStyleWord(true);
// textArea.setLineWrap(true);
// textArea.setText(startText);
// textArea.setPreferredSize(new Dimension(650, 350));
// textArea.setMaximumSize(new Dimension(800... |
1620acd5-ad26-40d8-a512-97f1fd939dd9 | 0 | public static void main(String[] args){
System.out.println("hello..");
} |
d8472cc6-85cb-4795-946f-f50ca26a0fe5 | 2 | public void drawAlien(Node to, Node from, Graphics g) {
if (from != null) {
Coordinates alienCoords = from.getCoordinates();
int alienPicX = alienCoords.col * wallSize + padding + finalFormatX
- (wallSize / 2) + 2;
int alienPicY = alienCoords.row * wallSize + padding + finalFormatY
- (wallSize / 2)... |
a1c4f921-4878-4c8a-aa04-99fd1bb24212 | 2 | private int indexOfMax(int[] values) {
int max = 0;
for (int i=0; i<values.length; i++) {
if (values[i] > max) {
max = i;
}
}
return max;
} |
fd00a189-6d62-4ae2-a6a6-0643d6fd6b91 | 8 | protected boolean sting()
{
if (CMLib.flags().isAliveAwakeMobileUnbound(this,true)&&
(CMLib.flags().canHear(this)||CMLib.flags().canSee(this)||CMLib.flags().canSmell(this)))
{
final MOB target = getVictim();
// ===== if it is less than three so roll for it
final int roll = (int)Math.round(Math.random()... |
c0b880b4-effb-458c-9ced-8372629771f3 | 1 | public void analyse(PGM img){
for(int i : img.getNiveauxGris()){
valeurs[i]++;
}
} |
f8d799cd-88f9-4344-96f3-b3e7ac289603 | 4 | private void setEffectTextureRotation(){
if(effectTexture.contains("Ice03")) effectTextureRotation = 45;
if(effectTexture.contains("Fire05")) effectTextureRotation = 135;
if(effectTexture.contains("Fire01")) effectTextureRotation = 120;
if(effectTexture.contains("Earth04")) effectTextureRotation = 90;
} |
3c9222e6-ff27-4440-a6f5-db625e9c7fc0 | 8 | private String getPrecedingLine(String text, int commentStart)
{
int endingIndex = commentStart - 1;
// move just before end of previous line
while (endingIndex >= 0)
{
char c = text.charAt(endingIndex);
if (c == '\n')
{
if (endingIndex >= 0 && text.charAt(endingIndex) == '\r')
{
e... |
f7295e43-6515-4d6c-b2b2-fd2ddb7adcfe | 1 | public void addParents(ArrayList<Point> points) {
points.add(location);
if (parent == null) {
return;
}
parent.addParents(points);
} |
771fd876-b3a5-481b-9f14-a99b0c2e2bf8 | 5 | @Override
public boolean tableExists(String table) {
ResultSet res = null;
table = table.replace("#__", prefix);
try {
DatabaseMetaData data = this.con.getMetaData();
res = data.getTables(null, null, table.toUpperCase(), null);
return res.next();
}catch (SQLException e) {
plugin.getLogger().log... |
305dc156-3e77-4b44-b88f-59f1473da12f | 3 | @Override
public void actionPerformed(ActionEvent e) {
Account f=null;
for( Account a : list )
{
if( a.num.compareTo( e.getActionCommand().substring(1, 3)) == 0 )
{
f=a;
break;
}
}
if(f!=null)
{
trig(f, e.getActionCommand().charAt(0), null);
}
} |
0185bdf2-539d-4815-bf17-a1ed1a30f22b | 3 | @Override
public void fireEvent(UIEvent e) {
super.fireEvent(e);
if(e instanceof ActionEvent) {
processActionEvent((ActionEvent) e);
} else if(e instanceof KeyEvent) {
processKeyEvent((KeyEvent) e);
} else if(e instanceof ValueChangeEvent) {
processValueChangeEvent((ValueChangeEvent) e);
}
} |
8efc8d73-2b33-45e5-9116-bca93e856192 | 5 | public Loot(int n, LootManager lootManager)
{
this.lootManager = lootManager;
ConfigurationSection data = lootManager.getMain().loot.getConfigurationSection("items." + n);
if (data != null)
{
ItemStack itemStack = new ItemStack(Material.matchMaterial(data.getString("id")));
itemStack.setAmount(data.get... |
87189dd0-d32c-46e4-a98a-204df47b1f99 | 7 | private static <T extends Comparable<? super T>> void mergeSort(T[] source, T[] tmpArray, int left, int middle, int right) {
int leftEnd = middle - 1;// 左子数组最后一个变量的下标
int tmpIndex = 0;// 临时数组保存变量的起始位置
int n = right - left + 1;// 临时数组保存的变量个数
int leftLow = left;// 本次排序最左下标在源数组中的位置
// while(left <= leftEnd && m... |
f464eb86-4091-49a1-987a-ce0057accd36 | 8 | @Override
/**
* Lets player choose from options and returns successor upon success
*
* @return
* successor of action if available otherwise null
*/
public IAction chooseOptions() {
if (getSuccessors() == null || getSuccessors().size() == 0) {
return null;
... |
4b4b539e-15d1-433c-a321-62eb72bc6d66 | 3 | @Override
public List<Manutencao> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Manutencao> manutencoes = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepare... |
8122793c-fc8d-46cf-8c08-51d80c248ac1 | 4 | public String actualizarPrograma(String nombre, String nivel, String creditos) {
//<editor-fold defaultstate="collapsed" desc="actualizarPrograma()">
if (!nombre.isEmpty() && !nivel.isEmpty() && !creditos.isEmpty()) {
programaSeleccionado.setNombre(nombre);
programaS... |
fac4c4b6-6bda-43d5-a07a-d110068b2147 | 6 | public static void loadDatabase() {
try {
Path dbPath = Paths.get(DaemonMainController.getDatabasePath());
System.out.println("[INFO] Loading database from file at " + dbPath.toString());
File d = new File(DaemonMainController.getDatabasePath());
if(!d.exists... |
2081c6e8-66b6-461a-bd4d-ba7a8476dc41 | 5 | public void traiter(LigneDeCaisses ligneDeCaisses, Echeancier echeancier) {
Client client = new Client(date);
if (caisse.estOuverteEtaccepte(client) && caisse.fileVide()) {
caisse.ajouter(client);
Evenement e = new EvenementFinServiceClient(date+client.getNbA... |
584fcf82-d6e3-4fba-821f-ef4a7b7e3afb | 0 | public void invalidate() {
valid = false;
this.invalidateBounds();
} |
a230bb72-7d30-4b14-a521-7f7d80b85ecf | 4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.content == null) ? 0 : this.content.hashCode());
result = prime * result + ((this.mime == null) ? 0 : this.mime.hashCode());
result = prime * result + ((this.reference == null) ? 0 : this.reference.hashCo... |
9f4b6231-bba8-4c82-8b1a-23b0302d721a | 4 | public static void main(String[] args) {
if(args.length < 1){
System.out.println("Please provide action:\n\t- init\n\t- reset\n\t- delete\n");
return;
}
if(args[0].equals("init")){
initDatabase();
return;
}
if(args[0].equals("rese... |
ac150867-a366-4d4d-a113-c162d92b1f5b | 5 | public boolean equals(GodMouseInfo comp)
{
if(comp==null) return false;
boolean coordinates = this.x==comp.x && this.y==comp.y;
boolean mouseAndWheel = this.mouseOnScreen==comp.mouseOnScreen && this.mouseWheelPosition==comp.mouseWheelPosition;
boolean buttons = this.getButtonsPressed().equals(comp.getButtonsPr... |
c57f86b1-9bf9-4951-bb35-8957474fad20 | 7 | public void setDim(int dim) throws ConnectException {
int maxDim = dim;
for (InputConnector ic : input) {
if (ic.isConnected()) {
if (dim != 0 && ic.getSource().getDim() != dim)
throw new ConnectException(ic.getSource(), dim);
if (maxDim < ic.getDim())
maxDim = ic.getDim();
}
}
if (outpu... |
8a436296-7b55-4615-ace1-af5b1e46f803 | 0 | public void setTaskName(String taskName) {
this.taskName = taskName;
} |
bedd10c3-24a4-4c97-ac14-52dbf6028460 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
c89164dd-96c5-4ebd-94f4-12d7956a7ba0 | 6 | public Clip loadAudioClip(URL clipName) {
Clip loadedClip = null;
try {
AudioInputStream inputStream = AudioSystem.getAudioInputStream(clipName);
AudioFormat format = inputStream.getFormat();
// Convert ULAW/ALAW compressed clip formats to (uncompressed)
... |
7171674e-d8eb-41e3-a5ad-091e7bf93eae | 3 | public int search(String value) {
if (reversed) {
reverse();
}
int i = 1;
Element tmp = firstElement;
while (tmp != null) {
if (tmp.getValue().toString().equals(value)) {
return i;
}
tmp = tmp.getNextElement();
i++;
}
return -1;
} |
50fa3c6d-0bdf-4977-a8b9-768a7e77720c | 8 | public final static long s_parseBitLongExpression(final String[] bits, String val)
{
if((val==null)||(val.trim().length()==0)||(isMathExpression(val)))
return s_parseLongExpression(val);
final StringTokenizer tokens=new StringTokenizer(val,",");
long l=0;
while(tokens.hasMoreElements())
{
val=tokens.ne... |
39369d58-7971-4c45-b15c-37de7e966aff | 2 | public void swapCards(Card card1, Card card2) {
if (card1.getComponent() == null || card2.getComponent() == null) {
return;
}
handComponent.swapCards(card1.getComponent(), card2.getComponent());
} |
eb587e77-1f46-457c-826c-0d77cc356c1d | 6 | public Move playerAI( int player ){
ArrayList<Move> moves;
ArrayList<Move> enemyMoves;
CheckersBoard temp = new CheckersBoard( board );
//gets current players possible jumps
moves = temp.getJumps( player );
//gets current players possible moves if there are no jumps
if( moves.isEmpty() ){
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.