method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cd8b9a26-6317-4b72-9b7a-02f5a4b85cea | 4 | static int countSwaths(BitSet arg) {
int len = arg.length();
int i = 0;
int result = 0;
while (i < len) {
boolean current = arg.get(i);
int j;
if (current) {
j = arg.nextClearBit(i + 1);
} else {
j = arg.next... |
649e41c9-2e84-4868-910a-29e4917fde0a | 1 | public void updateFPS() {
if (getTime() - lastFPS > 1000) {
Display.setTitle(title + " | " + "FPS: " + fps);
fps = 0;
lastFPS += 1000;
}
fps++;
} |
be34848e-be69-45ed-8b8b-03f9a0454ba2 | 7 | public void loadAlphabets(String filename) {
try {
File f = new File(filename);
Scanner s = new Scanner(f);
String line = null;
List<String> dot_mat_alpha = new ArrayList<String>();
if(s.hasNext())
characters = s.nextLine();
int i = 0;... |
3039e7e3-9a96-4d19-aaf1-2ebc90744bcf | 2 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
String allname = in.next();
String[] prenames = allname.split(",");
String[] names = new String[prenames.length];
for(int i=0;i<prenames.length;i++){
names[i] = prenames[i].substring(1, prenames[i].length()-1);
System.out.print... |
6b999855-dfce-4b57-b475-a8a9e14617eb | 7 | @Override
public boolean checkLegal(String prev_pos, String new_pos) {
String convert_old_pos = CUtil.pos_Finder(prev_pos);
String convert_new_pos = CUtil.pos_Finder(new_pos);
int pfile = Integer.parseInt(convert_old_pos.substring(0,1));
int prank = Integer.parseInt(convert_old_pos.substring(1));
int nfile =... |
44d5464e-03e4-4a60-9903-33cac6a27dd6 | 0 | public static void main(String[] args) {
// MailUtil.sendMailSynchron("test", "this is test", "289048093@qq.com", true);
} |
6d57f63f-6131-4505-bf99-c3ab16740253 | 6 | public static void main(String[] args) {
DecimalFormat df = new DecimalFormat("#0.000");
Scanner keyb = new Scanner(System.in);
int anneeInitiale = 2011; // annee initiale
double tauxCroissance = 1.2; // taux de croissance, en %
double populationInitiale = 7.0; // po... |
8e4ea551-016c-4912-82ed-6db911c29cda | 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... |
e4d2b341-f668-4b80-b689-d93274d863df | 2 | public void exibirCepZipCode(String numero){
String res = null;
for(int n = 0; n< ceps.size(); n++){
if(ceps.get(n)== numero){
res = ceps.get(n);
}
}
System.out.println(res.substring(0, 5)+"-"+res.substring(6));
} |
d15765c4-07e3-48af-8fe8-b53ad5d7e1e8 | 6 | private void getTurnAndTime() {
turnLeftJlbl.setText("Turns left: " + debateSelected.getTurnDuration());
if (debateSelected.getCurentTurnTeam().equals(teamType)
|| (debateSelected.getCurentTurnTeam().equals(teamType)
&& debateSelected.getCurentTurnTeam().equals(counterTeamType))) {
DateFormat df = new ... |
d51939ae-6ddb-4621-81b5-74126675eb62 | 0 | @Override
public String describeNode() {
return "[VorbisComment]";
} |
9ea57656-ead6-48ae-ad93-46be9943ee2c | 6 | @Override
public void run() {
System.out.println("server listening at at:" + Server.server.getInetAddress().getHostAddress()
+ ":" + Server.server.getLocalPort());
//listen for connections until game is started
while(Server.startGame == 0 && stopThread == false) {
try {
if(Server.clientThreads.size(... |
88d5847b-9dca-4639-8090-cc49a969a8e8 | 5 | public void add(Reaction R, Main m){
int IDCheck;
int index = checkReactionID(R.getIntID()); // index = index of R in Graph. checks if R is in Graph, if it is, returns index.
if(index==-1){ // ie. if R isnt in Graph
index=graphNodes.size();
graphNodes.add(... |
4aec4084-2644-467d-9c90-f38486e261e0 | 2 | public JSONObject putOpt(String key, Object value) throws JSONException {
if (key != null && value != null) {
put(key, value);
}
return this;
} |
3173e2ff-5035-434b-adf9-4d02b9d92cbe | 7 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
Player player = (Player) sender;
if (commandLabel.equalsIgnoreCase("Archer") && sender instanceof Player){
if (player.hasPermission("EasyPvpKits.Archer")){
if (!plugin.kits.contains(player.getName())){
... |
6a32fefc-2abb-47ec-8cc1-6f55cf7d6fc8 | 3 | private boolean userInputChecker(String input)
{
boolean matchesInput = false;
if(userInputList.size() > 0)
{
for(int loopCount = 0; loopCount < userInputList.size(); loopCount++)
{
if(input.equalsIgnoreCase(userInputList.get(loopCount)))
{
matchesInput = true;
userInputList.remove(loo... |
5939962e-2fbe-443c-926d-cabfaf93c768 | 3 | private void setzeBefehlsverfuegbarkeit(
Map<String, Boolean> verfuegbareBefehle)
{
for(Entry<String, Boolean> entry : verfuegbareBefehle.entrySet())
{
String befehl = entry.getKey();
boolean enabled = entry.getValue();
JButton button = _befehlButtonMap.get(befehl);
if(button != null && button != _... |
2bd6b098-89ad-41d4-ac42-0f1c46e18374 | 3 | public static void start() {
while (true) {
x = new Peg("A", diskCount, diskCount);
y = new Peg("C", diskCount, 0);
z = new Peg("B", diskCount, 0);
moveCount = 0;
//actions.removeAllElements();
doStep = false;
doContinue = false... |
42ec9878-c658-4357-8a4d-7df11188283f | 3 | @Override
public SocialProfileType getTypeByName(final String name) throws WrongTypeNameException {
if (name == null) {
throw new WrongTypeNameException("Type name is empty");
}
switch (name) {
case VKONTAKTE_TYPE_NAME:
case TWITTER_TYPE_NAME:
... |
bb2c79c4-9781-4b2a-af77-8bbe734529a7 | 8 | protected void setupCheck()
{
if((text()!=null)
&&(text().length() > 0)
&&(text().indexOf('<') >= 0)
&&(affected instanceof MOB))
{
final List<XMLLibrary.XMLTag> set = CMLib.xml().parseAllXML(text());
final String say = CMLib.xml().getValFromPieces(set, "SAY");
final String wear = CMLib.xml().getVal... |
73044c9d-cb1c-49dd-8c73-d2edd9cf7588 | 4 | public static void delete(File file) throws IOException{
if(file.isDirectory()){
//directory is empty, then delete it
if(file.list().length==0){
file.delete();
}else{
String files[] = file.list();
for (String temp : files) {
File fileDelete = new File(file, temp);
delete(fileDelete);
... |
f324bb8e-fcbd-4cfc-98fa-50b4bb985a53 | 6 | @Override
public void freeClusters(int headCluster, boolean freeHead) throws IOException {
if (headCluster < 0 )
return;
if (!freeHead) {
int fatEntry = fs.getFatEntry(headCluster);
// CLUSTER_ALLOCATED only
if ((fatEntry & CLUSTER_STATUS) == CLUSTER_A... |
3e115d6d-c8fa-421b-b3c4-7bf5eea1925e | 6 | public void loadDict() {
InputStream is = this.getClass().getResourceAsStream(MAIN_DICT);
try {
BufferedReader br = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
long s = System.currentTimeMillis();
while (br.ready()) {
Stri... |
7a79df1a-11e9-408a-8a71-773c90c97ed2 | 2 | @Override
public Iterable<Integer> pathTo(int v)
{
if (!hasPathTo(v))
return null;
LinkedList<Integer> path = new LinkedList<Integer>();
for (int x = v; x != s; x = edgeTo[x])
path.addFirst(x);
path.addFirst(s);
return path;
} |
924cb9f5-c307-4950-a3dd-f37fe6d611ff | 2 | private void respond(Request rq, Response re) {
// If no new session token has been provided, generate one
if (re.getSessionToken() == null) {
SessionHandler sh = new SessionHandler(storage);
re.setSessionToken(sh.generateToken(rq.getSenderId()));
}
String info = re.getClass().getSimpleName() + " to " ... |
ede44a04-3689-4fc5-b2d3-3b3659d65f03 | 5 | public Anvandare hamtaAnvandare(String personnummer){
Anvandare anvandare = new Anvandare();
try{
// H�mta data ifr�n Person-tabellen
connection = getConnection();
preparedStatement = connection.prepareStatement("SELECT * from person WHERE Personnummer = ?");
preparedStatement.setString(1, p... |
526503ba-6f42-42ac-a4b8-303dde0755f9 | 5 | public static void setValue(Object target, String attributeName, Object value) {
// if(value != null) {
// System.out.println("<- " + value.getClass() + " = " + value);
// }
// else {
// System.out.println("<- ??? = null");
// }
for (Method method : target.getCl... |
df78441f-7a6b-44e0-90a2-97d99005d437 | 8 | public static Tokens2 [] allTokens(String name){
int tam;
Tokens2 allTokens [] = null;
String text = "";
JTextArea Texto = new JTextArea();
String str;
tam = 0;
try{
File abrir = new File("..\\CompiladorToTo\\"+name+"Tokens.txt");
... |
54572c04-4070-46c7-8c74-b1e7954e853f | 7 | @Override
public void unInvoke()
{
// undo the affects of this spell
if((affected==null)||(!(affected instanceof Item)))
return;
if(invoker==null)
return;
final MOB mob=invoker;
final Item item=(Item)affected;
super.unInvoke();
if(canBeUninvoked())
{
if(item.amWearingAt(Wearable.WORN_FLOAT... |
f2a35962-1d9a-4872-89a1-c160200ef855 | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(DELIMETER).length == 2) {
// Get the newest file's version number
final Stri... |
bde626c2-7bc2-4bcf-bc77-96151d6efe25 | 2 | public void unhighlightTargets() {
int index;
for (BoardCell target : targets) {
index = calcIndex(target.getRow(), target.getCol());
if (cells.get(index).isRoom())
cells.get(index).setColor(Color.GRAY);
else
cells.get(index).setColor(Color.CYAN);
}
repaint();
} |
9e837d4c-c988-45be-afb1-15907a7f2d53 | 1 | public boolean addAll(final Collection<? extends Runnable> c) {
return queue.addAll(c);
} |
112682c0-f00a-4068-94a9-dcb0f8af395a | 7 | private void checkNames(final String[] dirs, final String secondName) {
for (int i = 0; i < dirs.length; ++i) {
if (dirs[i].equals("signature.tsv")) {
continue;
}
String[] name = dirs[i].split("\\.");
if (name.length != 2 || !name[1].equals(secondN... |
13e369bb-a0d3-4d07-a82d-65068ef53b4b | 4 | public Tile(final FullScreen screen, Piece piece, int x, int y) {
this.x = x;
this.y = y;
if(piece == null)
{
drawTile("/resources/images/blank.png");
}
else
{
switch(piece)
{
case En_Passant_B:
drawTile("/resources/images/pawn_B.png"... |
140e1d0b-4d82-4170-8cae-702adcf5c08c | 6 | @Override
public void step(Graphics2D graphics) {
if (wait) {
wait = false;
return;
}
if (name == null) {
name = JOptionPane.showInputDialog(screen, "What is your name?",
"Name", JOptionPane.QUESTION_MESSAGE);
if (name == null) ... |
1ce71b55-d4ca-4b1d-9d7a-c5ca08793877 | 4 | @Override
public boolean equals(Object obj) {
return ((this.name.compareTo(((Student) obj).getName()) == 0))
&& ((this.lastname.compareTo(((Student) obj).getLastname()) == 0))
&& ((this.getDateBorn().get(Calendar.DAY_OF_MONTH) == (((Student) obj)
.getDateBorn().get(Calendar.DAY_OF_MONTH))))
&& ((th... |
a1de3ea0-a914-4f5e-a6bd-ab4e5b6df6c2 | 5 | public static void load(Archive archive) {
Buffer stream = new Buffer(archive.decompressFile("varp.dat"));
anInt702 = 0;
int cacheSize = stream.getUnsignedLEShort();
if (cache == null)
cache = new Varp[cacheSize];
if (anIntArray703 == null)
anIntArray703 = new int[cacheSize];
for (int j = 0; j < cache... |
5b231594-fad1-4093-a89b-f5dfe91f02f7 | 3 | public void updateTitle(int index) {
int count = getComponentCount();
if (index >= 0 && index < count) {
Component child = getComponent(index);
if (child instanceof DockTab) {
((DockTab) child).updateTitle();
}
}
} |
a2e2a6b1-059f-442e-9eba-6bd85ef68292 | 4 | @Override
public Value evaluate(Value... arguments) throws Exception {
// Check the number of argument
if (arguments.length == 1) {
// get Value
Value value = arguments[0];
// If numerical
if (value.getType().isNumeric()) {
return new Value(new Double(Math.asin(value.getDouble())));
}
if (va... |
a444039e-3292-4e65-994c-15f5afe04a46 | 5 | private long removeRefMarketData(long lIndex) {
//
// loop through the elements in the actual container, in order to find the one
// at lIndex. Once it is found, then loop through the reference list and remove
// the corresponding reference for that element.
//
MarketData refActualElement = GetMarketData(lIndex)... |
cb5ce14c-b84b-4766-a7c5-f25392fe1f9b | 1 | public static boolean isPressed(int i) {
return keyState[i] && !prevKeyState[i];
} |
7c575c7a-ce1a-45b9-afdd-780b7f1001e8 | 2 | public String getBookContent() throws ParseException, IOException {
StringBuilder sb = new StringBuilder();
int book;
int counter = 0;
String filename;
// for (int k = 1; k <= 66; k++) {
for (int k = 1; k <= 66; k++) {
book = k - 1;
sb.append("\n\n ... |
dded08fd-b5ee-4068-b254-8ee21f027c40 | 9 | public static boolean atomicGoalPropositionP(Proposition proposition) {
{ Keyword testValue000 = proposition.kind;
if ((testValue000 == Logic.KWD_ISA) ||
((testValue000 == Logic.KWD_PREDICATE) ||
((testValue000 == Logic.KWD_FUNCTION) ||
(testValue000 == Logic.KWD_IMPLIES)))) ... |
7900a927-1161-4c94-becf-39c2f894a314 | 1 | @Override
public int rowsY() {
return isNotPlayerInventory() ? 1 : 2;
} |
aac87e27-66ce-4311-ac45-740c14b5595f | 7 | public int sumNumbers(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return 0;
Queue<TreeNode> q = new LinkedList<TreeNode>();
q.offer(root);
int res = 0;
while (!q.isEmpty()) {
int n = q.size();
while ((n--) > 0) {
TreeNode tmpNode... |
e5083f1c-713d-4624-9f14-72ee875efa15 | 7 | public static Packet readPacket(DataInputStream par0DataInputStream, boolean par1) throws IOException
{
boolean var2 = false;
Packet var3 = null;
int var6;
try
{
var6 = par0DataInputStream.read();
if (var6 == -1)
{
return ... |
eb0599a0-613e-4d6f-9ffe-ffa25f4b53f2 | 9 | public void imprimeRelatorio(String setor, String dataIni, String dataFim){
String diaInicial = dataIni.substring(0,2).trim();
String mesInicial = dataIni.substring(3,5).trim();
String anoInicial = dataIni.substring(6,10).trim();
String dataInicial = anoInicial+"-"+mesInicia... |
5e2197c8-c010-4835-8b81-a49fee2a96b6 | 1 | public static boolean isApplicable(Serializable object) {
return object instanceof FiniteStateAutomaton
|| object instanceof PushdownAutomaton;
} |
5b2af414-4236-4130-9ad1-4c8b446449ce | 9 | public Component getListCellRendererComponent(JList<?> list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, in... |
99d226d5-ac04-43fb-bf52-127267ed8b97 | 6 | public SET<Key> intersects(SET<Key> that) {
if (that == null) throw new NullPointerException("called intersects() with a null argument");
SET<Key> c = new SET<Key>();
if (this.size() < that.size()) {
for (Key x : this) {
if (that.contains(x)) c.add(x);
}
... |
0a307876-7d2c-4775-97e7-1c80994edb19 | 8 | @Override
public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
{
// Offensive physical skill casted on npc.
if (skill != null && !skill.isMagic() && skill.isOffensive() && targets[0] == npc)
{
int spawnId = LOST_BUFFALO;
if (npc.getNpcId() == PRONGHORN... |
494c0349-9c86-4b0d-8365-03c32719b643 | 1 | public String jugar(String letra){
if(letra == null){
return "Esperando a que ingrese una letra";
}
else{
String mensaje = ingresarLetra(letra);
return mensaje+"\n";
}
} |
5a9fca8d-0dde-4a0a-ba1f-ce0cb1a373f6 | 0 | @Id
@Column(name = "key")
public String getKey() {
return key;
} |
762a6070-89ed-4711-ba77-a263de3e0f3d | 4 | public static void main(String[] args) {
System.out.println("Opening connection...\n");
try {
serverSocket = new ServerSocket(PORT);
} catch (IOException ioEx) {
System.out.println("Unable to attach to port!");
System.exit(1);
}
do {
try {
runService();
} catch (InvalidClientException icExc... |
76de29c9-502b-4a3b-bfa3-c5e309f546bd | 9 | private void testJceAvailability(int keyBitLength)
throws
EncryptionUnsupportedByPlatformException, PDFParseException {
// we need to supply a little buffer for AES, which will look
// for an initialisation vector of 16 bytes
final byte[] junkBuffer = new byte[16];
... |
6bbc41de-2cb8-4697-8b6c-5c1f96c8a741 | 2 | private void checkDuplicates(List<Word> list1, List<Word> list2) {
for (Word word1 : list1) {
if (list2.contains(word1)) {
throw new RuntimeException("Duplicate word: " + word1);
}
}
} |
be9a6fd2-3eb3-4bd1-9609-127156896a1c | 1 | private ContactListVO addActionMessageToVO(ContactListVO contactListVO, Locale locale, String actionMessageKey, Object[] args) {
if (StringUtils.isEmpty(actionMessageKey)) {
return contactListVO;
}
contactListVO.setActionMessage(messageSource.getMessage(actionMessageKey, args, null,... |
62fa1637-3e31-465a-9ef1-dfd9d560a8b6 | 7 | public MagneticLine getLocationMagneticLine(int x, int y){
int offset = 15;
MagneticLine magneticLine = null;
for (MagneticLine magnet : this.graph.getMagneticLines()) {
if(magnet instanceof HorizontalMagneticLine){
if(magnet.y1 >= (y-offset) && magnet.y1 <= (y+offset... |
b670ed35-f285-45d5-be99-5fb977edb6bb | 3 | private void initConnection() throws IOException {
objectOutputStream = new ObjectOutputStream(echoSocket.getOutputStream());
objectInputStream = new ObjectInputStream(echoSocket.getInputStream());
ChatEvent chatEvent;
setRunning(true);
try {
getObjectOutputStream().reset();
getObjectOutputStream().wr... |
4b9644f7-647c-477b-86cd-19451fc8e79e | 4 | public boolean isCollided(Pinball pinball)
{
if(pinball.getX() < this.maxXY.getX() && pinball.getX() > this.minXY.getX() && pinball.getY() < this.maxXY.getY()
&& pinball.getY() > this.minXY.getY())
return true;
else
return false;
} |
c9c1bb50-f8f3-4e16-ae98-176b38fca539 | 0 | public static void main(String[] args) throws IOException {
File file = new File("D:" + File.separator + "abc.txt" );
boolean ret = file.createNewFile();
System.out.println(ret);
File file1 = new File("D:" + File.separator + "aa","bb" + File.separator + "test.tst");
ret = file1.createNewFi... |
dd06af49-8644-403b-80f0-4b2a8ebfcf99 | 0 | public void sendMessage(String message) {
writer.println(message);
writer.flush();
} |
e16800a4-c13b-4e2d-a25b-0ac46c7f3100 | 4 | public Manacher(String s) {
this.s = s.toCharArray();
t = preprocess();
p = new int[t.length];
int center = 0, right = 0;
for (int i = 1; i < t.length - 1; i++) {
// equals to i' = center - (i-center)
int mirror = 2 * center - i;
//Optimization of pre-calculated palindrome in @center
if (right >... |
1305109b-60ce-4a5d-a965-acbbbe5a3742 | 7 | public static Map<Integer, Double> getSimResourcesForUser(int userID, Map<Integer, Double> allResources, List<Map<Integer, Double>> userMaps, List<Map<Integer, Double>> resMaps,
List<Bookmark> trainList, List<Integer> userResources, Similarity sim) {
Map<Integer, Double> resources = new LinkedHashMap<Integer, Dou... |
c3437e5b-de95-4b5b-bdc9-213bc2975a03 | 2 | private boolean contensCliente(String nome) {
for (Cliente c : clientes) {
if (c.getNome().equalsIgnoreCase(nome)) {
return true;
}
}
return false;
} |
376ba6e8-13f3-455e-982f-46885030e25d | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
d71fe712-760f-43af-9866-fc3bcd339664 | 8 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (!super.equals(obj))
{
return false;
}
if (!(obj instanceof SemanticVersion))
{
return false;
}
... |
3f573a50-69f3-4708-ab7b-e14466ab4dfe | 8 | private Permissions assemblePermissions (Attributes attrs, Directory parent) {
// parse permissions
String uid = attrs.getValue ("uid");
String gid = attrs.getValue ("gid");
String modeStr = attrs.getValue ("mode");
int mode = (modeStr != null ? Integer.parseInt (modeStr, 8) : 0);
// missing values?
... |
45b25c20-0212-4f25-b367-b6cf2d9ea7cf | 2 | protected synchronized void setSensorData(int[] values) {
if (values.length != sensorData.length) {
return;
}
System.arraycopy(values, 0, sensorData, 0, values.length);
sensorDataIsValid.set(true);
if (sensorPacketListenerAdded) {
sensorPacketListener.sens... |
791a76a8-977e-437a-ae1e-870283f8e3f8 | 4 | public Point projectOnto(Point loc)
{
Point closestPt = getClosestPoint(loc);
double closestDist = closestPt.distance(loc);
int closestPtInd = points.indexOf(closestPt);
if (closestPtInd - 1 >= 0)
{
Point pt = projectOntoLineSegment(getPoint(closestPtInd - 1), closestPt, loc);
double dist = pt.dista... |
0b96cb8c-2db0-43bf-a7c8-449a2745fb1b | 2 | public void add_asset(int id,String Name,Double coeff)
{
Statement s = null;
try
{
s = connection.createStatement();
s.execute("INSERT INTO t_статьи(t_статьиID,t_статьиName,t_статьиКоэффициент) VALUES (" + String.valueOf(id) + ",'" + Name + "'," + String.valueOf(coeff... |
59c078fd-ef68-49da-a273-8b1707150f4c | 7 | int kmpMatch(String a, String b) {
if (a == null || a == null || b.equals(""))
return -1;
int[] next = getNext(b);
int i = 0, j = 0;
while (i < a.length()) {
while (j >= 0 && a.charAt(i) != b.charAt(j))
j = next[j]; // 递减,因此递减次数不会超过i的递增次数(m),因此总代价也是2*m = O(m)
i++;
j++; // 与i一起递增,O(m)
if (j ==... |
b273a8ae-1f96-4393-a3e2-8ea2d9ab2074 | 0 | public void setEventbean(EventsBean eventbean) {
this.eventbean = eventbean;
} |
4dfe3c0a-966c-48cd-98a0-96e643d278fc | 8 | public static String generateID(Person activeP, List<Person> a) {
if (activeP.getLastName() == null || activeP.getFirstName() == null) {
System.out.println("generateContestantID: first or last name null");
return new String();
}
ArrayList<String> ids = new ArrayList<String>(a.size());
for (Person p : a)
... |
218b622e-dbb5-4fb3-ac50-91fae5202f08 | 9 | private int parseBlogStatus(BufferedReader reader) throws IOException {
int pageCount = 0;
boolean titleFollowing = false;
String line = null;
HashMap<String, String> status = new HashMap<String, String>();
while ((line = reader.readLine()) != null) {
if (titleFollowing) {
status.put(STATUS_NAME[Status... |
45a94779-ecc9-4432-adde-eba35db496bc | 1 | public double getError4Organism() {
double error = 0.0;
for (int i = 0; i < outNodes.size(); i++) {
error += outNodes.get(i).error();
}
return error/2;
} |
0a5f8391-d35e-4d46-ac60-ec4a60f9f015 | 9 | public boolean equalsXMLElement(IXMLElement elt) {
if (! this.name.equals(elt.getName())) {
return false;
}
if (this.attributes.size() != elt.getAttributeCount()) {
return false;
}
Iterator enm = this.attributes.iterator();
while (enm.hasNext()) {
... |
fb94068c-fcd3-4ad8-8d63-a81fff80b210 | 4 | private boolean newVersion(String v1, String v2) {
String[] v1tot = v1.split(".");
String[] v2tot = v2.split(".");
for (int i = 0; i < v1tot.length && i < v2tot.length; i++ ) {
if (this.getInt(v1tot[i]) < this.getInt(v2tot[i])) {
return true;
}
}
... |
8e2b5432-20ed-4606-b43b-f52f5de36802 | 2 | public static URL getAllianceLogoURL(int allianceID, short size) throws ApiException {
if(Arrays.binarySearch(allianceLogoSizes, size) < 0)
throw new ApiException("Invallid image size: "+Short.toString(size)+". Allowed sizes are: "+Arrays.toString(characterPortraitSizes));
try {
return new URL(IMAGE_SERVICE_U... |
ef405f3b-93b5-4446-b512-d22c089948ed | 2 | private void loadLifts(){
File folder = new File(liftPath);
for(int i=0;i<folder.listFiles().length;i++){
Lift lift = new Lift(folder.listFiles()[i]);
if(lift.getWorld()!=null){
lifts.add(lift);
// System.out.println("load " + lifts.get(lifts.size()-1).getLiftID());
}
// System.out.println("load "... |
f1403952-7c90-4277-884b-7a03dfcf055f | 4 | */
private ArrayList<Name> getBuiltInNames()
{
ArrayList<Name> retlist = new ArrayList<Name>();
Name[] ns = getWorkBook().getNames();
for( Name n : ns )
{
if( n.isBuiltIn() && ((n.getIxals() == (getSheetNum() + 1)) || (n.getItab() == (getSheetNum() + 1))) )
{
retlist.add( n );
}
}
return retl... |
45253d07-83f4-471d-9cfa-ef99ed1691ee | 4 | private Position calculatePosition(int number) {
switch (number) {
case 0:
return new Position(position.getX() + 1, position.getY());
case 1:
return new Position(position.getX(), position.getY() + 1);
case 2:
return new Position... |
e7b311f6-d1b1-4246-81f5-9dcce52965f9 | 2 | public static OperatingSystem valueOf(short id)
{
for (OperatingSystem operatingSystem : OperatingSystem.values())
{
if (operatingSystem.getId() == id)
return operatingSystem;
}
// same behavior as standard valueOf(string) method
throw new IllegalArgumentException(
"No enum const for i... |
b2c41ede-837b-47e1-9cbf-49216147ea81 | 8 | public ListNode deleteDuplicates(ListNode head) {
if(head==null||head.next==null) return head;
ListNode fakehead = new ListNode(head.val-1000);
fakehead.next = head;
ListNode p1,p2,p3;
p1=fakehead;
p2=p1.next;
p3=p2.next;
while(p3!=null)
{
... |
67181ba9-d457-42dc-9f34-e624cdbd106c | 7 | public static Cons extractRequiredArgumentValues(StandardObject classtype, PropertyList slotsandvalues) {
{ boolean arraytypeP = StandardObject.arrayTypeSpecifierP(classtype);
List requiredvalues = List.newList();
boolean foundP = false;
if (arraytypeP) {
ParametricTypeSpecifier.preproces... |
55b31f4a-ae66-4cba-854a-8f5d8acc09d5 | 2 | public static boolean city(String city){
if(city.matches("[A-Z][a-z]+(\\s[A-Z][a-z]+(\\.)?)*")&&city.length()<30)
return true;
return false;
} |
e3ed4487-02f3-45b6-9df3-eee8c58267da | 4 | public static Map<String,String> splitCommandParams(String originalString)
{
HashMap<String,String> toRet = new HashMap<String, String>();
String[] commParts = originalString.split(Command.paramSplit);
if(commParts != null)
{
for(String comm:commParts)
{
String[] paramParts = comm.split(Command.value... |
196f2465-2141-4ed2-bda6-843d9a59dc3c | 0 | private static int min_3(int a, int b, int c) {
return Math.min(Math.min(a, b), c);
} |
a8f51925-472c-46c2-aace-6bac0118a9ce | 2 | private Matrix4f getParentMatrix()
{
if ( parent != null && parent.hasChanged() )
parentMatrix = parent.getTransformation();
return parentMatrix;
} |
68e27b21-58ce-4362-b7c3-eb393ab03b15 | 3 | private static void printItems(PrintStream out, Collection<Item> items)
{
if (items != null && items.size() > 0)
for (Item item : items)
library.printItem(out, item);
else
out.printf("none%n%n");
} |
a4d97960-6e4d-44be-b2de-74fe38c72187 | 1 | public boolean isWhite() {
if (myColor.equals(WHITE))
return true;
return false;
} |
657735c0-20ad-4da1-860e-8bace929c779 | 2 | public Result execute(Command command) {
User user1 = userDAO.getUser(((UserDTO) command.getCommandSource()).getLogin());
if (user1 != null && Arrays.equals(user1.getPassword().toCharArray(), ((UserDTO) command.getCommandSource()).getPassword())) {
result.setResult(user1.toUserDTO());
... |
12786f34-e6eb-4d0b-9307-c12273662813 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
USNInfo other = (USNInfo) obj;
if (urn == null) {
if (other.urn != null)
return false;
} else if (!urn.equals(other.urn))
return fals... |
2fdf7ee1-2683-4419-bf73-12630704be88 | 2 | @Override
public void Parse(Session Session, EventRequest Request) throws Exception
{
Session.GrabResponse().Initialize(ComposerLibrary.LoadFriends);
Session.GrabResponse().AppendInt32(1100);
Session.GrabResponse().AppendInt32(300);
Session.GrabResponse().AppendInt32(800);
Session.GrabResponse().AppendInt3... |
a536e5cb-8bc8-4ed2-b791-21a83a0b6ef8 | 4 | public void makeDetails()
{
if (isHasDetails())
return;
int iNumExits = (int)(Math.random() * (MAX_EXITS)) + 1;
Room newRoom;
for (int i = 0; i < iNumExits; i++)
{
newRoom = World.getGame().newRoom();
addRoomWithReturn(newRoom);
}
int iNumMonsters = (int) (Math.random() * MAX_MONSTERS);
Mon... |
f3dfae9d-6246-4bc1-a242-c8f8e8e3ad99 | 3 | public double getRelativeDensity(PixelMap targetDensity) {
double count = 0;
for(int x = 0; x < pixels.length; x++) {
for(int y = 0; y < pixels[0].length; y++) {
if(pixels[x][y]) {
++count;
}
}
}
double density = count / (pixels.length * pixels[0].length);
return density / targetDensi... |
068ccba4-c9b3-4e7a-80c4-5d6c24439156 | 0 | public final void setFilter(final int i, final T v) { filter[i] = v; } |
aa0f3418-0739-40c0-badc-2ad83daf1eef | 2 | private static int[] inputMove(int[][] board, int playerNumber){
GuiMaster.println("Player #" + playerNumber);
printGangupBoard(board);
GuiMaster.println("Where do you want to go?" + "\n" + "X:");
String tempString = GuiMaster.getEnteredText().trim();
int inputX;
int inputY;
if(tempString.matches("... |
da624c4f-0a3d-4b10-82fa-419510ac301e | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!(affected instanceof MOB))
return super.tick(ticking,tickID);
final MOB mob=(MOB)affected;
if(tickID!=Tickable.TICKID_MOB)
return true;
if(!proficiencyCheck(null,0,false))
return true;
if((!mob.isInCombat())
&&(CMLib.flags().isS... |
def305a8-47f5-4bdf-b623-14addfaf0cb2 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(target instanceof Coins)
{
mob.tell(L("You can not bless that."));
return false;
}
if(!super... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.