method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4e8d16ff-da9b-457e-bcd1-4aed1a2c6289 | 4 | protected ServerSocket bindConnection(final InetAddress inetAddress,
final int suggestedPort) throws IOException {
for (final InetAddress localInetAddress : this.configurationFacade
.getOutgoingSourceAddresses()) {
if (localInetAddress.equals(inetAddress)) {
final ServerSocket serverSocket = new Server... |
013f007a-e709-4794-a010-c1b2bb12f904 | 3 | public void generateNodes(boolean allowDiagonals) {
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[0].length; j++) {
grid[i][j] = new Node(new Vertex(new Vector3f(i * TILE_SIZE, 0, j * TILE_SIZE)), heuristic, true);
}
}
addManhattanNeig... |
92f8254e-0cc7-4db8-94e7-2a6e1339eb35 | 3 | public String getTypeSignature() {
switch (typecode) {
case TC_LONG:
return "J";
case TC_FLOAT:
return "F";
case TC_DOUBLE:
return "D";
default:
return "?";
}
} |
3576d475-bd86-44ec-823e-aae91bc69e85 | 2 | public double[] standardizedPersonMinima(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedPersonMinima;
} |
73c3e936-cada-411c-aeb6-d6b826b483de | 2 | public double getDouble(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).doubleValue()
: Double.parseDouble((String) object);
} catch (Exception e) {
throw new JSONException("J... |
f84d8661-44e3-47ad-9855-4c97f7dfbb9a | 0 | public String getDescription() {
return description;
} |
4fdffba7-d346-4852-8de2-f01506aeb199 | 9 | public void update(long timePassed){
if(weapon.roundDenom == 0){
empty();
}else{
if(reloadTimePassed >= 0){
reloadTimePassed += timePassed;
}
if((int)nextFullIcon.X == icons.length - 1 && (int)nextFullIcon.Y == icons[0].length &&reloadTimeP... |
d8b65e6c-fcf0-42e6-86c2-79e5ab752eb4 | 0 | public DwarvenWarAxe() {
this.name = Constants.DAWNGUARD_WAR_AXE;
this.attackScore = 11;
this.attackSpeed = 14;
this.money = 1600;
} |
35771f3f-c01b-4066-bef7-a6b17b55ea23 | 9 | private static boolean addNeighbors(Cluster cluster,Cluster cluster2){
boolean merge=false;
if(cluster==null || cluster2==null){
return false;
}
try{
for(int index=0;index<cluster2.getNumInstances();++index){
Instance p=cluster2.getInstance(index);
if(p.isKey() && cluster.contains(p)){
merge=... |
3d781439-7197-4cac-a42e-b7d226ca85ef | 2 | public void postMessage(String userEmail, String messageContent)
{
initConnection();
String preparedString = null;
PreparedStatement preparedQuery = null;
try
{
//Prepare Statement
preparedString = "INSERT INTO messages (`timestamp`, user, content) VALUES (?, ?, ?);";
preparedQuery = (... |
5519cc00-0589-47c0-8fbe-ac44748e1c25 | 4 | public ArrayList<Conditional> getAnswer()
{
ArrayList<Conditional> Answers = new ArrayList();
for(Conditional c: wm)
{
if(c.getFact().isAnswer() && !c.getNotFlag()) {
if (!Answers.contains(c)) {
Answers.add(c);
}
... |
f04ff8b2-f5cc-47e5-9fe5-ebfe8c04fbe4 | 4 | @Override
public void mouseClicked(MouseEvent e) {
int x = e.getX();
int y = e.getY();
//TODO -- real coords
if( (x >= 845 && x <= 1100) && (y >= 845 && y <= 1000) ){
layout.cl.show(panelContainer, "2");
}
} |
f46dbca6-26b4-4f5d-8f2b-13614560df38 | 4 | public String toString()
{
StringBuffer s = new StringBuffer();
for (int i = 0; i < 8; i++)
{
s.append("[B" + (i + 1) + "]");
for (Carte c : this.bases.get(i))
{
s.append(" " + c.toString());
}
s.append("\n");
}
s.append(super.toString());
s.append("[Pot] ");
if (this.pot.size() == 0)
... |
4232dc06-ea23-453e-8dfd-f12f96ae10d4 | 9 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT) { //Presiono flecha izquierda
direccion = 3;
} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { //Presiono flecha derecha
direccion = 4;
}
if (e.getKeyCode() == KeyEvent.VK_P) {
... |
75c37b32-c048-422b-bc0e-f0783adaf82e | 1 | public int maxLocals() {
if (code != null) {
return code.maxLocals();
}
return 0;
} |
20647a65-baff-4522-ac99-883c1457b726 | 7 | public void render(GameContainer container, Graphics g) throws SlickException
{
if (player1.absolutex - viewW/2 > 0 && player1.absolutex + viewW/2 < mapw) {
camerax = player1.absolutex - viewW/2;
}
if (player1.absolutey - viewH/2 > 0 && player1.absolutey + viewH/2 < maph... |
d20f20b1-8cc0-4da4-b20a-72e8cf6e2320 | 4 | public static List<Prop> parsePropList(String value){
String[] props = value.substring(0,value.length()-1).substring(1).split(",");
List valuesList = new ArrayList();
for(String propStr : props){
String[] vs = propStr.split(":");
Prop prop = new Prop();
if(vs.... |
bba9947c-e072-4634-9425-a794fd4a322b | 4 | private void rotate() {
if (startingArrowStrand[0] != null) setStartingArrowPosition(startingArrowStrand[0], 0);
if (startingArrowStrand[1] != null) setStartingArrowPosition(startingArrowStrand[1], 2);
if (startingArrowStrand[2] != null) setStartingArrowPosition(startingArrowStrand[2], 4);
if (startingArrowStra... |
95a61c46-0862-4938-b53c-406ea40ef0e2 | 4 | protected void paintComponent(Graphics g) {
if (thumbnail == null) {
loadImage();
}
if (thumbnail != null) {
int x = getWidth()/2 - thumbnail.getIconWidth()/2;
int y = getHeight()/2 - thumbnail.getIconHeight()/2;
if (y < 0) {
y = 0... |
8e2c54ef-e867-4e96-aeb4-c5e089d03094 | 9 | public void run()
{
try
{
StringBuffer colClause = new StringBuffer();
for (String col:t.prdFKCols)
{
System.out.format("FK %s.%s.%s\n",t.schema,t.name,col);
if (colClause.length() != 0)
colClause.append(",");
... |
bd36879b-be46-4a01-ad07-fa1f5b160a8e | 1 | @Override
public void keyPressed(KeyEvent e) {
switch(e.getKeyCode()){
case KeyEvent.VK_ESCAPE ://escape key ends the script
running = false;
break;
default :
break;
}
} |
9847a4a6-bdbe-43b2-915f-3f26703ff4cb | 2 | public void setNextGlied(SchlangenGlied glied) {
if (nextGlied != null) {
nextGlied.removePreviousGlied();
}
nextGlied = glied;
if (glied.getPreviousGlied() != this) {
glied.setPreviousGlied(this);
}
} |
e5e9db4b-aae8-4899-a27f-296841696bcf | 0 | @ConstructorAnnotation
public AnnotatedBean()
{
} |
0b0c03c1-9df0-4982-8882-0b89836f7174 | 7 | public static ChessTimer createTimer(TimerTypes timerType, RunnableOfT<Boolean> timeElapsedCallback, long incrementAmount,
long startTime, boolean isBlackTeamTimer)
{
switch (timerType)
{
case NO_TIMER:
return new NoTimer();
case BRONSTEIN_DELAY:
return new BronsteinDelayTimer(timeElapsedCallback, inc... |
a43cb6da-ded3-4a04-89ab-78ab4901e10b | 0 | public String getName() {return "Vanilla";} |
8b46dbb4-a742-45e9-9ad9-4650a6d874c3 | 6 | public boolean equals(Object obj){
// We first check if we have a correct object to compare
if (obj == null || ! (obj instanceof Environment))
return false;
Environment env = (Environment) obj;
// When do we consider that two different environments are equal?
// When both environments have the same n... |
b9b4a286-3449-4123-baf9-8190dbc5bd69 | 3 | public void addMember(Actor member, Stage stage) {
if(members.size() < maxPartySize && !members.contains(member)) {
members.add(member);
member.setInParty(1);
} else if(members.size() >= maxPartySize) {
Textbox text = new PlainText(false, 3f, false);
text.setSource(members.get(0));
text.buildText("Pa... |
4243b937-8b6a-4470-accb-f52efa1e0a16 | 2 | public static void setPartitionPaddingMode(int i) {
if (i >= 0 && i <= 2) {
partition_padding_mode = i;
}
} |
fd8f3419-5d09-48a7-a7dc-8774e9a23ca0 | 0 | private CarListJsonConverter() {
} |
3bfd8b7a-66b8-4ad4-a836-9a24a6c67fd7 | 6 | public void handleNonGeometricAttributes(String resType, String featureAttribute, String featureName, String featureClass) throws UnsupportedEncodingException, FileNotFoundException
{
try
{
if (!featureAttribute.equals(ignoreStr))
{
String encodingType =
UR... |
d9af5d83-ff34-4777-9929-aa9b415eb76e | 5 | private void computeListCommand(String message) {
// Aktualisiere liste der Mails
checkMailFiles();
// Auf Argumente ueberpruefen
String[] cmd = message.split(" ");
if (cmd.length > 1) {
int n = Integer.parseInt(cmd[1]);
long size = getMailSize(n);
String response = "+OK " + n + " " + size;
try {
... |
c00089c3-1598-4122-87ae-7c388f65f2e6 | 4 | public static boolean updateEventUserStatus(int eventId, int userId,
int statusCode) throws HibernateException {
boolean isUpdateEventUserStatusSuccessful = false;
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
try {
// Begin unit of work
session.beginTransaction();
// updat... |
ad55a997-da25-470f-abba-9a2c2f0c5426 | 8 | public static String filterStr(String str) {
StringBuilder sb = new StringBuilder();
int len = str.length();
char pre_char = '`';//不等于split_char的字符
for (int i = 0; i < len; i++) {
boolean find = false;
char cur_char = str.charAt(i);
for (char t : token... |
c3c77319-d361-4507-ab41-087b5a315b85 | 7 | public KeyPair generate() {
if (p == null) {
BigInteger[] params = new RFC2631(m, l, rnd).generateParameters();
seed = params[RFC2631.DH_PARAMS_SEED];
counter = params[RFC2631.DH_PARAMS_COUNTER];
q = params[RFC2631.DH_PARAMS_Q];
p = params[RFC2631.DH_PARAMS_P];
... |
b721541d-1f36-432e-8a2a-58f5de2f50ed | 7 | public void renderSheet(int xp, int yp, SpriteSheet sheet, boolean fixed) { // gonna render a sprite
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < sheet.SPRITE_HEIGHT; y++) {
int ya = y + yp;
for (int x = 0; x < sheet.SPRITE_WIDTH; x++) {
int xa = x + xp;
if (xa < 0 || xa ... |
cfbea8a3-7b5c-4744-b39f-917c8e8a68e8 | 0 | public void display() {
SwingUtilities.invokeLater(() -> setVisible(true));
} |
9a0ea547-e135-41b7-a7df-ac9c057df0b1 | 7 | protected void addToken(int length, byte id)
{
if(id >= Token.INTERNAL_FIRST && id <= Token.INTERNAL_LAST)
throw new InternalError("Invalid id: " + id);
if(length == 0 && id != Token.END)
return;
if(firstToken == null)
{
firstToken = new Token(length,id);
lastToken = firstToken;
}
else if(las... |
255c7444-1819-4acf-8e42-beaadebe109d | 5 | public static String[][] sort(String[][] clientArray, int column, boolean ascending) {
String[] min, merke;
int pos, posMin;
// Sortieren und Vertauschen
for (int i = 0; i < clientArray.length; i++)
{
// Kleinste Position ab i suchen
posMin = i;
min = clientArray[i];
for (pos = i + 1; pos < client... |
7809d5e4-70e9-4952-8c57-feed7d732545 | 8 | public void printValues(int direction, int rowmin, int rowmax, int colmin, int colmax)
{
if (direction == 0)
// Going north, we stick to the column and decrease the row
for (int i = rowmax-1; i >= rowmin; i--)
System.out.print(m[i][colmin] + " ");
else
if (direction == 2)
// Going south, we sti... |
fcbae33b-ac13-4fc3-b9b1-34ca6ee076c9 | 6 | public static int extendedSimpleAdd(int a, int b) {
if (a > 0 && b > 0) {
return simpleAdd(a, b);
}
if (a > 0 && b < 0) {
return simpleSubtract(a, -b);
}
if (a < 0 && b > 0) {
return simpleSubtract(b, -a);
}
return -simpleAdd(-a, -b);
} |
c1a5ce55-2a19-4522-95bc-d899bebcc37d | 3 | private void init (int ops) {
zinterest = ops;
int interest_ = 0;
if ((ops & ZMQ.ZMQ_POLLIN) > 0) {
interest_ |= SelectionKey.OP_READ ;
}
if ((ops & ZMQ.ZMQ_POLLOUT) > 0) {
if (s != null) // ZMQ Socket get readiness from the mailbox
inter... |
b93f8020-6a4c-4405-9e4b-662886798495 | 6 | public static void insertCsvFileData(String location, Set<Flight> flightData)
throws NewCustomException {
if (location != null && flightData.size() != 0) {
Location arrLoc = getLocation(location.substring(0, 3));
Location depLoc = getLocation(location.substring(3));
if (arrLoc == null) {
arrLoc = set... |
680a8604-52f7-4ce4-9aff-673e4e9b98ae | 6 | private static LogLevel stringToLevel(final String levelStr) {
if ("trace".equalsIgnoreCase(levelStr)) {
return LogLevel.TRACE;
}
if ("verbose".equalsIgnoreCase(levelStr)) {
return LogLevel.TRACE;
}
if ("debug".equalsIgnoreCase(levelStr)) {
ret... |
2505d1d5-1baf-473f-bc0d-1372f7d47ec2 | 8 | @Test
public void testConcurrencyExperiment2() {
final int clientThreadCount = 5;
int count = 0;
for (int i = 0; i < mServerCount; i++) {
try {
mDhtClientArray[i].purge();
} catch (RemoteException e) {
e.printStackTrace();
... |
ee6f1ba9-1990-4a87-ba80-bdc384fcb7bf | 7 | private void saveChanges() {
// Iterate over nodes in LinkedList
for (NodeDisplayGroup node : nodes) {
MacAddressDisplay macs[] = node.getMacs();
// Process each mac address for the node
for (int i = 0; i < macs.length; i++) {
if (macs[i] != null) {
String macAddress = new String("");
JTe... |
ea3926f5-3036-4efd-beeb-a0cef818f1c4 | 0 | public Point(int x, int y, int value) {
this.x = x;
this.y = y;
this.value = value;
} |
de0368ab-16f6-4fe9-9919-537128ebe978 | 4 | private Comic prepareModel() {
File[] comicFileName = selectedDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.getName().equals("comic.xml");
}
});
if (comicFileName.length == 1) {
try {
final Comic from = (Comic) (XmlUnmarshaller.startUnmarshal... |
63c8d779-8bb8-4bc9-8ad2-b42872cc5044 | 8 | public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo info)
throws ResourceException {
if (log.isDebugEnabled()) {
log.debug("matchManagedConnections, connectionSet=" + connectionSet + ", subject=" + subject + ", fsInfo=" + info);
... |
0ad6b406-3a18-4d02-9d34-2dfa62e53710 | 9 | static public int longLength (long value, boolean optimizePositive) {
if (!optimizePositive) value = (value << 1) ^ (value >> 63);
if (value >>> 7 == 0) return 1;
if (value >>> 14 == 0) return 2;
if (value >>> 21 == 0) return 3;
if (value >>> 28 == 0) return 4;
if (value >>> 35 == 0) return 5;
if (value >... |
87415e85-fecf-44c9-bbfd-89c147f3c98e | 8 | public static NamiCredentials getCredentialsFromClassname(String className,
String username) throws CredentialsInitiationException {
String fullClassname = "nami.connector.credentials." + className;
try {
Class<? extends NamiCredentials> credClass;
credClass = Class.f... |
f8ef3395-2313-47db-b372-17f8f61836e0 | 9 | public static List<DiffPair> convert(String gitDiffOutput) {
if (gitDiffOutput == null || "".equals(gitDiffOutput)) {
return emptyList();
}
ArrayList<DiffPair> dps = new ArrayList<DiffPair>();
String gitDiffOutputChangeable = gitDiffOutput;
boolean stop = false;
while (true) {
Matcher matchNewDi... |
5df0d628-3536-4c87-a54f-e9a6c5f128ab | 4 | public int maxPathNotRoot(treeNode curRoot) {
this.running_time_NotRoot++;
if (curRoot == null)
return 0;
if (curRoot.leftLeaf == null && curRoot.rightLeaf == null)
return curRoot.value;
int leftMax = maxPathNotRoot(curRoot.leftLeaf);
int rightMax = maxPathNotRoot(curRoot.rightLeaf);
return (leftM... |
5c9ce1f6-9b3f-4f48-9901-5eebf0435a7e | 8 | protected XVar getNonLocal(XTree tree, String name, XVarAccess access) {
XScope scope = this;
XVar var;
while (scope != null) {
if (access == XVarAccess.NONE || !(scope instanceof XClassScope)) {
var = scope.locals.get(name);
if (var != null) {
return var;
}
}
if (scope == base)
brea... |
b780f9da-9ffa-484b-9cdc-4e9444794020 | 6 | public int compare(File f1,File f2){
String s1="";
String s2="";
if((f1.toString().lastIndexOf("\\") >=0))
s1 = f1.toString().substring(f1.toString().lastIndexOf("\\")+1);
if((f1.toString().lastIndexOf("/") >=0))
s1 = f1.toString().substring(f1.toString().lastIndexOf("/")+1);
if(f2.toString().lastIndexO... |
684a2bf4-e782-4bd0-a333-7f99459a56f2 | 0 | public ArrayList<Metadonnee> getListeMetadonnees() {
return listeMetadonnees;
} |
99178415-12f3-4342-9436-f93497113171 | 1 | public static TestRunInfo getTestRunInfo(HierarchicalConfiguration testRunData)
{
TestRunInfo testRunInfo = null;
if (testRunData != null) {
testRunInfo = new TestRunInfo();
testRunInfo.setId(testRunData.getLong(ID_TAG));
testRunInfo.setName(testRunData.getString(NAME_TAG));
... |
4ceb9964-925e-4b41-a25b-83bdd2d3f0b2 | 9 | private TrieEntry<K, V> addEntry(TrieEntry<K, V> toAdd, int keyLength) {
TrieEntry<K, V> current = root.left;
TrieEntry<K, V> path = root;
while(true) {
if(current.bitIndex >= toAdd.bitIndex || current.bitIndex <= path.bitIndex) {
toAdd.predecessor = toAdd;
... |
f89ee412-81b6-43d9-b82a-5703a6fa0bc6 | 9 | private static void readEdgeMega(String filename, boolean directed, boolean symmetric)
throws IOException
{
InputStream in = new BufferedInputStream(new FileInputStream(filename));
byte[] buffer = new byte[8];
boolean end =false;
int edges = 0;
int olde1 = -1;
IntArray list = new IntArray(1024);
while (!end) {... |
ae06447d-7867-4d96-930e-19d12bdd23a1 | 8 | protected Object computeNumber(Integer left, String op, Integer right) {
int a = left.intValue();
int b = right.intValue();
if ("+".equals(op)) {
return a + b;
} else if ("-".equals(op)) {
return a - b;
} else if ("*".equals(op)) {
return a * b;
} else if ("/".equals(op)) {
return a / b;
} els... |
c3b58140-1863-472c-9f74-9f2310df165a | 9 | public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Produto produto;
try {
produto = em.getReference(Produto.class,... |
9fe40535-ef8c-4160-9b61-cfe5625f7df6 | 7 | private Charge2D calcPoint(double x, double y)
{
Vector2D ep=new Vector2D(0,0);
Vector2D currentPos=new Vector2D(x, y);
double charge;
double potentialSum=0;;
for (int i=0;i<_charges.length;i++)
{
Vector2D v=new Vector2D(_charges[i].getVector().getX(),_charges[i].getVector().getY());
Vector2D trans=v... |
e80e7f2f-0efc-4985-8038-0832fce811be | 3 | public void createMap(String file)
{
BufferedReader fin, in;
file = "Tilemaps/" + file;
try
{
fin=new BufferedReader(new FileReader(file));
for(int i=0; i<currentArea.length; i++)
for(int j=0; j<currentArea[0].length; j++)
currentArea[i][j]=Integer.parseInt(fin.readLine());
}
catch(Except... |
a4eeb141-45b5-450f-8c0b-7156cabf1754 | 1 | @Test
public void test_loadArrayFromFile() {
String filePath = "test.txt";
// creating list with specified amount of random numbers
List<Integer> list = appUtil.getRandomNumbers(10, 10);
appUtil.saveArrayToFile(filePath, list);
// testing content of file
List<Integ... |
629f8349-d18a-4292-8267-c3bc1129c952 | 4 | public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
final String path = request.getPathInfo();
String ssid = request.getSession().getId();
response.setContentType("text/html;charset=utf-8");
response... |
f8f4b0c0-732f-479b-ae00-2207882a96a6 | 1 | @Override
public String toString() {
String string = " connected to ";
for (AssociationEnhanced as : associations)
string += as.getStakeholder().getName() + " p=" + as.getProbability() + " - ";
return getName() + " coeff.=" + coefficient + string.substring(0, string.length() - 3);
} |
5e29f2b8-b311-4835-91f8-55be4875ac50 | 9 | public ReplaceIns(SootMethod method,
Map<Type, Set<Unit>> map,
Map<Local, Set<Unit>> saveToBuf) {
// TODO Auto-generated method stub
m= method;
b = m.getActiveBody();
c = m.getDeclaringClass();
getUtilClasses();
Unit unit = getAppCntxtInsPt();
getBufferObj(unit);
// addAppContext(unit);
Set<... |
7187fb53-b7da-4301-b200-5e532f6d9251 | 5 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Client client = clients.get(rowIndex);
switch (columnIndex){
case 0:return client.getIdClient();
case 1:return client.getNom();
case 2:return client.getPrenom();
case 3:return client.g... |
0c194194-0b05-468a-8cd9-6d081494d347 | 4 | public boolean setTurnCount(int count) {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: setTurnCount() BEGIN");
}
m_turnCount = count;
if (test || m_test) {
System.out.println("Game :: setTurnCount() END");
}
... |
822172d3-bfec-4cec-9370-033cacd76a01 | 7 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Piece other = (Piece) obj;
if (color == null) {
if (other.color != null) {
return false;
}
} else if (!... |
c2691ca4-c3bd-42d0-9d3e-da458dcbaaaa | 5 | @Test
public void superDuperTest() throws Exception {
System.out.println("\nTESTISUJEMO TEST PRIMJER: " + fileName);
String output = null;
try {
output = getAnalyzerOutputFromFile("res/examples/seman-in-extra/" + fileName + ".in");
} catch (Exception e) {
System.out.println("------------");
System.out... |
c27c8a01-6208-4bf8-82d8-11ca3579d74f | 5 | public boolean peutSupprimer(Utilisateur utilisateur) {
return (
utilisateur != null
&& (
utilisateur.getRole().getValeur() >= Role.Administrateur.getValeur()
|| (
utilisateur.getRole().getValeur() >= Role.Moderateur.getValeur()
... |
bf9f4eb8-62c5-44ed-b3a3-a6842bb4ca4a | 9 | public void render(float posX, float posY, int x, int y, World w, boolean selected)
{
if(volume > fluid.getMaxVolume())
volume = fluid.getMaxVolume();
if(getBlockName().equals(fluid.getName()+"_All") || volume == Integer.MAX_VALUE)
{
w.setBlock(x, y, fluidName+"_"+flu... |
df32d01e-7f4b-4e50-a7db-2d217eff08ac | 0 | public void setClientID(String clientID) {
this.clientID = clientID;
} |
c5fdebe5-d5fc-4bb3-a527-9ca42a515871 | 2 | private String getCommandBySuperAlias(ChunkyCommand command, String commandString) {
for (Map.Entry<String, ChunkyCommand> superAlias : superAliases.entrySet()) {
if (commandString.toLowerCase().startsWith(superAlias.getKey())) {
command = superAlias.getValue();
retur... |
b2550a9c-29a2-4041-9061-0ca043625f37 | 4 | public static void checkArgs(String[] args) {
if (args.length != 3) {
System.err.print("Illegal number of arguments! ");
System.err.println("usage: <integer: maze height> <integer: maze width>" +
" <output file name>");
System.exit(1);
} else {
Scanner checker = new Scanner(args[0] + " " + a... |
33e16f63-5490-4424-ad6b-9f609f979232 | 7 | protected void doVoice(boolean on) {
String nicks = "", modes = "";
int count = 0;
if (on)
modes = "+";
else
modes = "-";
for (int i = 0; i < players2.numPlayers(); i++) {
try {
if (!players2.isDead(i)) {
nicks += players2.get(i) + " ";
modes += "v";
count++;
if (count % 4 =... |
85ed6a75-bf4a-47ae-9809-47daab2c9d15 | 7 | private void supportChildren(Bundle resources) {
int survivingChildren = 0;
for (Person child:family.children) if (child.alive) survivingChildren++;
Bundle portion = resources.over(survivingChildren);
for (Person child:family.children){
if (child.alive){
child.income.insert(portion);
if(child.r... |
80f842f7-ff48-48bf-a896-a37338bd84ad | 5 | private void truncateEntity(T bean) {
// deletes every key in the MDR at the moment
// can't iterate and delete in one go for concurrency reasons
Set<TKey<?, ?>> keysToDelete = new LinkedHashSet<>();
keysToDelete.addAll(bean.getAvailableKeys());
while (!(keysToDelete.isEmpty())) ... |
306847a8-e110-4f27-86e9-89d93c0dd0e0 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
5e7976a2-4044-4963-b8ed-4d93278acefe | 9 | @Override
public boolean doAction(String choice) {
switch (choice) {
case "P": // Move Player Plane Crash Site
MapControl.movePlayer(MapControl.PLANE_CRASH_LOCATION);
break;
case "T": //Move Player to the Tree line
MapControl.movePlayer... |
7e99599b-91a9-4cd1-a206-6d1d61267ed6 | 8 | private void fillOptionList(Map<String, Object[]> optionMap) {
optionsList = new ConcurrentHashMap<>();
for (String key : optionMap.keySet()) {
Object[] value = optionMap.get(key);
if (value[0].equals(false)) {
continue;
}
switch (key = key.replace("force", "")) {
case "onetop":
optionsLi... |
8b24b03f-ed2a-41c2-9308-f59914e1b9c8 | 0 | public static void setBreedingAge(int newBREEDING_AGE)
{
BREEDING_AGE = newBREEDING_AGE;
} |
89a83378-d46c-408f-b2f1-858854cd4554 | 9 | private void openFilePane()
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.addChoosableFileFilter( new javax.swing.filechooser.FileFilter() {
public boolean accept(File f)
{
if( f.isDirectory() )
return true;
String ext = getExtension(f );
if( ext != null )
{
if(... |
4504bf5a-e3fe-49fb-9c3b-f56992b338ab | 7 | @Override
public void paint(Graphics g) {
int w = getWidth();
int h = getHeight();
g.setColor(BG_COLOR);
g.fillRect(0, 0, w, h);
{
int l_x = w-3*LOGO_SIZE/2;
int l_y = h-LOGO_SIZE;
int l_w = LOGO_SIZE * 2;
int l_h = l_w;
g.drawImage(logo, l_x, l_y, l_w, l_h, null);
}
int startY = TO... |
a0a667ab-295b-4e25-84d2-4755cff01cd1 | 2 | private String fileToString(File file) {
// Stores the contents of the file
String fullFile = "";
// Creates fullFile String
try {
Scanner in = new Scanner(file);
while (in.hasNextLine()) {
fullFile += in.nextLine() + "\n";
}
... |
953fe805-0b1c-4a92-ace8-a0c689c358c4 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
ac28c5d7-ac59-46fa-8793-6a8463ea4ef7 | 3 | public void chainMethodIdentifier(Identifier chainIdent) {
String name = chainIdent.getName();
String typeSig = chainIdent.getType();
for (Iterator i = methodIdents.iterator(); i.hasNext();) {
Identifier ident = (Identifier) i.next();
if (ident.getName().equals(name) && ident.getType().equals(typeSig))
... |
4d0803bb-5d3d-4a0b-92a9-dab448ca2c1b | 7 | private boolean projectiveInterval(DependencyStructure parse, DependencyNode left, DependencyNode right) throws MaltChainedException {
final int l = swapArray.get(left.getIndex());
final int r = swapArray.get(right.getIndex());
DependencyNode node = null;
if (l > r) {
return false;
} else {
for (int i =... |
b605e044-82f3-4232-9d9c-f6b4a44330cc | 2 | public boolean needCacheOperation() {
return (cacheDefinition != null || cacheDeleteDefinitions != null || versionUpdateDefinitions != null);
} |
661c052c-55a8-4f73-85a8-6b4312d3fbe9 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
a86c6745-fe08-4c5c-b313-220c54552890 | 9 | public static UserDB checkIfLegit(String username, String password){
Statement stmt=null;
String searchQuery="SELECT * FROM users WHERE username='"+username+"' AND password='"+password+"'";
try{
dbManager=DBManager.checkInstance();
con=dbManager.getFreeConnection();
stmt=con.createStatement();
rs=s... |
9a1206f3-b79e-48ad-9b19-80309b8e0b35 | 2 | private OperatingSystem(Manufacturer manufacturer, OperatingSystem parent, int versionId, String name, String[] aliases,
String[] exclude, DeviceType deviceType, String versionRegexString) {
this.manufacturer = manufacturer;
this.parent = parent;
this.children = new ArrayList<OperatingSystem>();
// combine m... |
fd2bf509-da39-4a4f-a527-f8ad324d87fb | 9 | private Node insert(Node h, Key key, Value value, int ht) {
int j;
Entry t = new Entry(key, value, null);
// external node
if (ht == 0) {
for (j = 0; j < h.m; j++) {
if (less(key, h.children[j].key))
break;
}
}
// internal node
else {
for (j = 0; j < h.m; j++) {
if ((j + 1 == h.m) ... |
3d36fd2c-633d-4e01-8c9f-256a8e2a8bd2 | 4 | private void setupVault() {
//Check for vault first
if(getServer().getPluginManager().getPlugin("Vault") == null) {
logger.info(String.format("[ButtonsPlus] - No Vault found!, switching to xp mode...", getDescription().getName()));
if(Settings.econmode.equalsIgnoreCase("money")) {
Settings.econmode = "xp"... |
3f5d3d9a-b110-4056-82ed-7d9262216f12 | 2 | private static final int rank (long[][] mat) {
int r = 0;
for (int i = 0; i < mat.length; i++) if (mat[i][i] != 0) r++;
return r;
} |
37c97e5c-fb6e-4403-8f70-fa53f7940cf5 | 5 | public void resetBoard(){
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
m_Pieces[i][j] = NONE_PIECE;
}
}
m_Pieces[3][3]= WHITE_PIECE;
m_Pieces[4][4]= WHITE_PIECE;
m_Pieces[3][4]= BLACK_PIE... |
172d118f-e25c-4c2d-85df-df57491dd55a | 4 | @EventHandler
public void OnBlockBreak(BlockBreakEvent e){
Player p = e.getPlayer();
PlayerDat pd = DBmanager.PlayerData.get(p.getName());
Block b = e.getBlock();
// p.sendMessage(String.valueOf(b.getType().equals(Material.LOG)));
if(pd.pclass.equalsIgnoreCase("lumberjack")&&b... |
67ee591d-2c53-49a9-907d-326b7e834be7 | 8 | public final int[] randomCARule(int maxLength, int actualLength, Random randNum){
int[] itemArray = new int[maxLength];
for(int k =0;k < itemArray.length;k++)
itemArray[k] = -1;
if(actualLength == 1)
return itemArray;
int help =actualLength-1;
if(hel... |
2b0731d1-fb27-43ec-bf7f-8a443e1d6a38 | 8 | @Override
public int calculateThrow(int humanResponse) {
currentHumanThrow = humanResponse;
if (previousHumanThrow != -1) {
String threeDigitKey = Integer.toString(previousHumanThrow) + Integer.toString(previousComputerThrow) + Integer.toString(currentHumanThrow);
in... |
5b678bb2-eee9-4274-9cd5-ea79137a6d07 | 2 | public Collection<T> saveOrUpdateAll(Collection<T> entities) {
if (entities != null)
for (T entity : entities) {
session().saveOrUpdate(entity);
}
return entities;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.