method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b71c342e-055a-448b-b60e-85ba5ad376cb | 5 | public static void recommend(String key, String tableName){
Connection conn = null;
Statement stmt = null;
try {
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL + tableName, user, pswd);
stmt = conn.createStatement();
String search = "SELECT title, menu, recipe FROM " + tableName... |
938eba7d-9958-4649-bb35-093244a4415f | 9 | public void inputManager(Input input) {
if (!player.isFreezed) {
if(Universal.egg_keyboardControl){
if (input.isKeyDown(Input.KEY_UP)) {
player.climbUp();
} else if (input.isKeyDown(Input.KEY_DOWN)) {
player.climbDown();
... |
5ca0e5f4-8db0-418b-af8c-178602e1d414 | 9 | public void input()
{
if(Input.isKeyPressed(Input.KEY_R))
load();
if(Input.isKeyPressed(Input.KEY_PERIOD))
load(data.largestFeature+20, data.persistence);
if(Input.isKeyPressed(Input.KEY_COMMA))
load(data.largestFeature-20, data.persistence);
if(Input.isKeyPressed(Input.KEY_SEMICOLON))
load(data... |
233defa3-1147-4cb8-9aa0-1ac3be7cb6dd | 2 | public List<Planet> EnemyPlanets() {
List<Planet> r = new ArrayList<Planet>();
for (Planet p : planets) {
if (p.Owner() >= 2) {
r.add(p);
}
}
return r;
} |
a4fcd28b-7c9e-421d-a487-88978cc99fd4 | 2 | public static Document connect(String url){
logger.info("开启连接");
// 建立连接
Connection conn = Jsoup.connect(url);
Document document = null;
conn.header("Referer", "http://scholar.google.com/");
// 设置代理
conn.userAgent("Mozilla/17.0 (compatible; MSIE 6.0; Windows NT 5.0)");
conn.timeout(3*1000);
conn.metho... |
e5d8bcd3-73c0-48eb-a506-cb38a7e8b6da | 7 | private static void performParentChecks(
final Store store,
final BiMap<String, String> nameMaps,
final BiMap<Signature, Signature> inverseSignatureMaps,
fi... |
96b1d22c-3b25-4f64-b478-b206986b780e | 6 | public String buscarProspectoPorCorreo(String mail){
//##########################CARGA_BASE DE DATOS#############
tablaDeProspectos();
//##########################INGRESO_VACIO###################
if(mail.equals("") || !mail.contains("@")){
mail = "No busque ... |
5c20c02a-bf54-445a-9272-629238e30ff5 | 1 | public static void main(String[] args) {
SoundFactory sf = new SoundFactory();
ISound sound = sf.createSound("/sounds/sound_ambience_nature.wav");
sound.playAsynchronous();
System.out.println("hola");
JFrame f = new JFrame("Load Image Sample");
f.addWindowListener(new WindowAdapter(){
... |
1d4a8358-b9ac-423b-983f-df0f10fe69aa | 6 | public List<Show> build() {
List<Show> shows = new ArrayList<Show>();
try {
String rootHtml = reader.read(url);
Document doc = Jsoup.parse(rootHtml);
Element seriesDiv = doc.getElementById(divId);
Elements showAnchors = seriesDiv.getElementsByTag(showTagNa... |
f56be8b3-d7db-410d-9863-22743001862e | 2 | public boolean foundFront(Coord3d coord) {
for (int j = 0; j < frontView3DCoordinates.size(); j++) {
if (coord.equals(frontView3DCoordinates.get(j))) {
return true;
}
}
return false;
} |
70b175a7-6cd3-40e0-91bd-9d46e68c949d | 2 | public static void save() {
Configuration config = Configuration.loadConfiguration();
// Find the directory to save to.
File saveDirectory = new File(config.getProperty("savePath"));
// If the directory doesn't exist, leave it.
if (!saveDirectory.exists()) {
String di... |
d6ddb598-2cc5-44f2-9201-c729b2909464 | 9 | ArrayList<ArrayList<Integer>> permuteUnit(int[] num, int[] pre, int[] post,
ArrayList<ArrayList<Integer>> permutation) {
// base case
if (pre.length == num.length) {
ArrayList<Integer> unit = new ArrayList<Integer>();
for (int i = 0; i < pre.length; i++) {
unit.add(pre[i]);
}
permutation.add(uni... |
8a84a864-2166-4ab9-9ba5-af6b3d87ab47 | 4 | @RequestMapping("excluirProdutoListaDeDesejos")
public ModelAndView excluirProdutoListaDeDesejos(String idProduto) {
ModelAndView mav = new ModelAndView("loginAdmin");
if (loginController.isLogado() || adminController.isLogado()) {
Usuario usuario = loginController.usuario;
if (usuario == null) {
us... |
27f7f7fb-3123-4af5-a626-571f9977bd4c | 2 | private static void renameBlobDir(String oldName, String newName) {
oldName = FileFunctions.getRelativePath(oldName);
System.out.println("The oldname is " + oldName);
newName = FileFunctions.getRelativePath(newName);
System.out.println("The new name is " + newName);
try {
CloudStorageAccount storageAccount... |
ad266383-c5a9-4111-b1d0-223945284045 | 8 | public byte variance(String fileName) throws IOException {
initialize(fileName);
FileOutputStream fos = null;
DataOutputStream dos = null;
try{
// create file output stream
fos = new FileOutputStream("variance_bin");
// create data output stream
dos = new DataOutputStream(fos);
... |
cc413ca0-a415-42e2-a6f3-63519018f8bc | 3 | public static Annotation buildAnnotation(Library library, Hashtable hashTable) {
Annotation annot = null;
Name subtype = (Name) hashTable.get(SUBTYPE_KEY);
if (subtype != null) {
if (subtype.equals(SUBTYPE_LINK))
annot = new LinkAnnotation(library, hashTable);
... |
c5b00c0a-1866-4f42-aaa2-bb658390520c | 5 | @RequestMapping(value = "editList", method = RequestMethod.POST)
public @ResponseBody
TodoList editList(@RequestParam Integer id, @RequestParam String title,
@RequestParam int pubStatus, WebRequest webRequest) {
Authentication authentication = SecurityContextHolder.getContext().get... |
6175fd27-752c-4a74-a7d8-48f56b296c9f | 8 | * @return Konfigurationsbereich, passend zur Versorgungsdatei.
*
* @throws ConfigurationChangeException Falls kein neuer Konfigurationsbereich angelegt werden konnte.
*/
private ConfigurationArea assignConfigurationArea(ConfigurationAreaProperties property, ConfigurationControl configurationControl)
throws Co... |
d03cdbae-053b-4955-941f-ef204c0b2497 | 3 | public void update(GameContainer gc, StateBasedGame sbg, int delta) {
Input input = gc.getInput();
if(input.isKeyPressed(MoveKey.QUEST.get())) {
sbg.enterState(Defines.ID_EXPLORE);
input.clearKeyPressedRecord();
} else if (input.isKeyPressed(MoveKey.MOVE_DOWN.get())) {
selectPanel.shiftSelected(1);
} e... |
5526d75a-a16e-44fa-9583-394ba5fe415f | 3 | private void initTree() {
root.removeAllChildren();
nodeCache.clear();
for (CourseFilter f : courseModel.getFilters()) {
DefaultMutableTreeNode n = new DefaultMutableTreeNode(f);
if (f instanceof SourceCourseFilter)
((SourceCourseFilter) f).setParentFrame(this);
root.add(n);
for (Object el : f.get... |
68d17c22-84eb-44b2-b904-44b8e07987d0 | 8 | public void process152events()
{
String code;
// FileUtils.logFile.printf("%s enter process152events%n", TAG);
// let's record the fact that we had a 152 file for the votes cast
// if in fact we have events for this terminal
if(this.events.size() > 0) this.votesCast152 = 0;
for(String eventS... |
89f84710-c4bd-4e69-a41b-2271eee31642 | 4 | @Override
public boolean equals( Object that ) {
if ( !( that instanceof AbstractOptionSpec<?> ) )
return false;
AbstractOptionSpec<?> other = (AbstractOptionSpec<?>) that;
return options.equals( other.options );
} |
3fda17f2-ae56-453d-af49-30e701245124 | 0 | public void setOtro(String otro) {
this.otro = otro;
} |
8a502f21-6430-47f1-aeaa-649598fa70da | 1 | private void openPatronsDatabase() throws SQLException {
try {
Context initialContext = new InitialContext();
Context envContext =
(Context) initialContext.lookup("java:comp/env");
DataSource dataSource =
(DataSource) envContext.lookup("library/patrons");
patronsConnection = dataSource.getConnec... |
ad117d60-f7ec-4b4a-9e9d-08daf5ebb189 | 6 | public Player(String name, int money) {
playerId = classId++;
randomGenerator = random;
NAME = name;
this.money = money;
neededMoney = 0;
inJail = false;
dices = new int[2];
dices[0] = 4;
dices[1] = 2;
turnEnd = true;
giveUp = false;
threwDice = 0;
timeInJail = 0;
trading = -1;
//sets the... |
767e23a8-7543-4c07-992b-3decb42a7b59 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
JsonBoolean other = (JsonBoolean) obj;
if (other.hasComments() ^ hasComments())
return false;
if (value != other.value)
return fals... |
5cf600f9-fd65-4774-bbf5-ff6f42f77468 | 4 | public static void writeString(String path, String content) {
//Open file
Path jPath = Paths.get(path);
//Create file if necessary
if (!Files.exists(jPath, LinkOption.NOFOLLOW_LINKS)) {
try {
Files.createFile(jPath);
} catch (IOException ex) {
System.out.print(ex);
System.exit(1);
}
}
... |
51baa3cc-8cc3-4893-829b-3b65e2fcc589 | 6 | public boolean hasEnteredText()
{
boolean returnBool = false;
if (eventNameField.getText() != null
&& eventNameField.getText().length() > 0)
{
returnBool = true;
}
if (startDateChooser.getDate() != null)
{
returnBool = true;
}
if (endDateChooser.getDate() != null)
{
returnBool = true;... |
9ddfe558-b493-475f-b13d-d2c53619fb13 | 1 | public static synchronized Singleton createInstance() {
if (mSingleton == null) {
mSingleton = new Singleton();
}
return mSingleton;
} |
1e233edd-e4d6-4fe1-9e18-09121aece3eb | 7 | public void Update()
{
for (int j = 1; j < endPoints.size(); ++j)
{
Endpoint key = new Endpoint(endPoints.get(j));
int i = j - 1;
while (i >= 0 && key.compareTo(endPoints.get(i)) == -1)
{
Endpoint end0 = new Endpoint(endPoints.get(i));
Endpoint end1 = new Endpoint(endPoints.get(i+1));
... |
efb43754-6239-4eb2-96f3-0bcec165973c | 7 | protected int[] refineOwners(KDTreeNode node, Instances centers,
int[] candidates) throws Exception {
int[] owners = new int[candidates.length];
double minDistance = Double.POSITIVE_INFINITY;
int ownerIndex = -1;
Instance owner;
int numCand = candidates.length;
double[] distance = new dou... |
0c4d82f0-06d2-41c8-8d50-2428b6488080 | 2 | public boolean equals(final Object obj) {
return (obj instanceof MemberRef)
&& ((MemberRef) obj).declaringClass.equals(declaringClass)
&& ((MemberRef) obj).nameAndType.equals(nameAndType);
} |
b750a8e1-e769-4008-8089-b7459855afdf | 6 | public void body() {
LinkedList resList;
// waiting to get list of resources. Since GridSim package uses
// multi-threaded environment, your request might arrive earlier
// before one or more grid resource entities manage to register
// themselves to GridInformationService (GIS)... |
fe00cd38-ebee-4428-9514-fb0ff75ba96f | 0 | @Override
public Board getBoard() {
return field;
} |
aeeb46cb-5097-4fe7-8131-43ca397440f2 | 9 | static public void boxIfNessesary(CodeAttribute ca, String desc) {
if (desc.length() == 1) {
char type = desc.charAt(0);
switch (type) {
case 'I':
boxInt(ca);
break;
case 'J':
boxLong(ca);
... |
8ac0bc0d-22ed-4a8d-b5ed-464dafe3fa70 | 6 | public void edit(int index, String subject, String text, int priority) {
if(index<0 || index==this.size()) { // Reveals if the number exists
return;
}
boolean a;
for(int i = 0; i<this.size(); ++i) { // Makes the subject unique
a = true;
for(int j = 0; j<this.size(); ++j) {
if(subject.equals(get(j).... |
7c20da2d-115c-4c58-8e53-5f5a5be99f32 | 7 | final int method3213(int i, int i_5_, boolean bool) {
anInt9576++;
if (bool != true)
method3213(41, 104, true);
if (anIntArray9574 == null || i_5_ < 0
|| (anIntArray9574.length ^ 0xffffffff) > (i_5_ ^ 0xffffffff))
return -1;
if (anIntArrayArray9565[i_5_] == null || (i ^ 0xffffffff) > -1
|| ((anI... |
03559483-9bfd-46e5-8e79-c6edd237ed2a | 3 | public static String removeEnd(String str, String remove)
{
if (isEmpty(str) || isEmpty(remove))
{
return str;
}
if (str.endsWith(remove))
{
return str.substring(0, str.length() - remove.length());
}
return str;
} |
4839db7c-72f8-4c21-b388-da2f0b9ccf6f | 6 | public static String getOS() {
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) { os = "win"; };
if (os.contains("linux")) {os = "linux";}
if (os.contains("unix") || os.contains("sunos") || os.contains("solaris")) { os = "solaris"; }
if (os.contains("macos")) { os = "maco... |
3f66855a-e434-448a-80c2-9849edbda932 | 0 | public int getDepartment() {
return department;
} |
91f2457a-1260-4968-a343-5ac775b87d6f | 8 | private String GetDoubleDigitWord(int number) {
switch (number) {
case 20:
return "twenty";
case 30:
return "thirty";
case 40:
return "forty";
case 50:
return "fifty";
case 60:
... |
f81e6ad9-233f-4eb4-ab15-f51ea41b18ad | 8 | @Override
public void keyPressed(KeyEvent e) {
int c = e.getKeyCode();
if (c == KeyEvent.VK_RIGHT) {
Gun.aimRight();
// repaint();
} else if (c == KeyEvent.VK_BACK_SPACE ){
//select guntype
//cycle through a gunList
if(Gun.gunRoll == 4)Gun.gunRoll = 1;
else Gun.gunRoll++;
} else if (c == Ke... |
7cbef7f2-bb04-404c-8995-4660d8c5846e | 2 | public StateOfMatter getState()
{
for(int i = 0; i < gases.length; i++)
if(new MiniCompound(gases[i]).equals(this))
return StateOfMatter.GAS;
return StateOfMatter.UNKNOWN;
} |
85810533-6d21-4f1d-8361-6243939ab1ef | 5 | private void hierarchicalStrategy(Agent a) {
if (a.getCarrying() > -1) {
a.calcPath(calcXFromCoor(a.getCampLocation()), calcYFromCoor(a.getCampLocation())); // if carrying a Tilia, go to camp
}
else { // go pick up a tilia closest to position
int coin = 0;
if (a.isRed()) {
if (coins_red.size() >=... |
f7af7dd7-874a-4d7f-b432-0d63cf3f207e | 4 | private int getLetterCount(int i) {
int count = 0;
int h = i / 100;
if (h > 0) {
count += l1[h].length() + hundred.length();
}
i = i % 100;
if (i > 0) {
if (h > 0) {
count += 3;//and
}
if (i <= (l1.length - 1)) {
count += l1[i].length();
} else {
count += l2[i / 10].length() + l... |
2e058e4d-9e3c-4c16-82a4-43ac1c28518e | 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 fe... |
62c4e88d-ebbb-449a-8851-d43b209af036 | 1 | public WeekPanel(StartFrame aContainer) {
super();
addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
container.ds.setDefaultWeek(updateWeekTable());
}
});
this.container = aContainer;
this.setBorder(new EmptyBorder(23, 23, 23, 23));
tabl... |
569e013c-57ea-4bb1-b9d7-d63fdadc83c2 | 9 | public static void main(String[] args) {
SimplePermClass s2134 = new SimplePermClass(new Permutation("2134"));
SimplePermClass s1234 = new SimplePermClass(new Permutation("1234"));
HereditaryProperty a213 = AvoidanceTest.getTest("213");
HereditaryProperty a123 = AvoidanceTest.getTest("12... |
7add2ea9-66f9-4597-bb82-404861b0735a | 8 | public void setCurrentAction(CharacterAction action) {
switch (action) {
case MOVERIGHT:
case MOVELEFT:
currentAction = move;
currentAnimation = actionAnimations.get(currentAction);
break;
case JUMP:
case JUMPLEFT:
... |
94353d60-6ee9-4e43-abfd-9bba3e2f0a41 | 5 | private ValueWithTimestamp getLocalValue(Column col,long start_ts,long end_ts,boolean hasEnd){
ValueWithTimestamp data=localData.get(col);
if(data==null)
return null;
if(hasEnd){
if(data.timestamp>=start_ts && data.timestamp<=end_ts)
return data;
return null;
}else{
if(data.timestamp>=start_ts)
... |
20338ddc-953e-4bc7-bc3d-cf058c409e78 | 6 | public void reserve() {
if (this.capacity - this.length < JSONzip.substringLimit) {
int from = 0;
int to = 0;
this.root = new Node();
while (from < this.capacity) {
if (this.uses[from] > 1) {
Kim kim = this.kims[from];
... |
9f67c104-3e5d-4428-833e-bc92b59ad1f5 | 0 | public String getComment() {
return comment;
} |
716c8aec-b4fc-436a-9a25-3b95e73afccd | 3 | public void bfs(DirectedNode root) {
Queue<DirectedNode> queue = new LinkedList<DirectedNode>();
queue.add(root);
root.visited = true;
while (!queue.isEmpty()) {
DirectedNode curNode = queue.poll();
System.out.println(curNode.data + " ");
for (Directed... |
81812a8a-ae3d-4b50-bb38-7427ff9fafa9 | 3 | public static Comparator<?> getCompareType(String name){
for (HistorySortType status : values()) {
if (name.equals(status.methodname)) {
return status.compartype;
}
}
return new ComparatorTime();
} |
aa6eeb73-a417-4166-82a5-ec3ff3ccaceb | 2 | @Override
public void Handle(byte[] message, Server server, IOClient player) {
//SMP Handshake
final String KICKMESSAGE = "This is not an SMP Server!";
try {
byte[] kickbyte = KICKMESSAGE.getBytes("US-ASCII");
ByteBuffer bb = ByteBuffer.allocate(3 + kickbyte.length);
bb.put((byte)255);
bb.putShort((s... |
ae347f4b-7815-4878-96b9-fc6bb0fc1114 | 7 | Chromosome breed(Chromosome partner) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException{
int min = genes.size();
int max = genes.size();
if( partner.getGenes().size() > min ){
max = partner.getGen... |
c324b087-6c8c-442c-8160-f58b0deda649 | 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... |
4ab32352-080a-4c6d-be2e-fb78b1568b48 | 3 | @Override public void init() {
control = LcdClockBuilder.create()
.prefWidth(760)
.prefHeight(400)
.title("Münster")
.styleClass(LcdClock.STYLE_CLASS_YOCTOPUCE)
... |
eed50140-a81f-4ed2-a5cc-aaf8dd9d7846 | 9 | public void returnFromAnimation()
{
setLayout(new GridBagLayout());
getContentPane().removeAll();
setVisible(false);
if(isSingle)
{
if(fromAnimation.equals("ready"))
{
newHumanTurn(allPlayers.elementAt(currentPlayerIndex));
}
else if(fromAnimation.equal... |
228ba2e5-4c90-4aa4-acc2-6e6a93ff888a | 6 | public void write(int begin, byte[] block) throws IOException {
int filePieceIndex = findFilePieceIndex(begin);
FilePieceMapper filePiece = files.get(filePieceIndex);
int writtenBytes = 0;
while (writtenBytes < block.length) {
RandomAccessFile raf = filePiece.getFile();
... |
25d61aa2-24a5-4fab-81c2-096d0809d281 | 2 | private void updateCharacterClasses(char oldChar, char newChar){
// before modifying the character map, make sure it isn't static.
ensureCharacterMapIsInstance();
// make the newChar behave like the oldChar
zzcmap_instance[newChar] = zzcmap_instance[oldChar];
// make the oldChar behave like it isn't special.
... |
207efbca-8ffb-4ec5-9119-504b2f07264f | 4 | public void testIsWinner() {
beginTest("countFields method");
// Test variable used for assertEquals and readability
boolean result;
for (int i = 0; i < 31; i++) {
board.setField(i, Mark.RED);
}
for (int i = 32; i < 63; i++) {
board.setField(i, Mark.GREEN);
}
result = board.isWinner(Mark.RED);
... |
3dabe469-c054-4317-bb89-892487362f3f | 8 | private void setClanWebSiteMappings(Clan clan, String allMappingsStr)
{
for(final Iterator<String> keyIter = this.webPathClanMappings.keySet().iterator();keyIter.hasNext();)
{
final String key=keyIter.next();
final Clan foundClan = this.webPathClanMappings.get(key);
if(foundClan == clan)
{
keyIter.... |
ce38d31a-6158-4fcb-8b20-93915fb60840 | 2 | public boolean isInSameChunk(WorldCoordinate otherCoord) {
return dimension == otherCoord.dimension && x >> 4 == otherCoord.x >> 4 && z >> 4 == otherCoord.z >> 4;
} |
a325bee5-117c-4f5c-a8a0-1ac18c923a15 | 4 | public void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
double hs = ... |
6b17287e-5e2c-46ca-ae2c-d1728f2fc37f | 0 | public int getCheckEnd()
{
return _checkEnd;
} |
1e2c598e-6acd-47a7-909b-5fe9ebc39d96 | 7 | @Override
public boolean equals(Object obj) {
Interval other = (Interval) obj;
if (this.m_isBottom && other.isBottom()) { return true; }
if ((this.m_isBottom && !other.isBottom())
|| (!this.m_isBottom && other.isBottom())) { return false; }
return (this.m_lowerBound == other.getLowerBound() && this.m_upper... |
92ba9337-8a18-4009-9576-caa1c516013b | 8 | public void left()
{
switch(aniCount)
{
case 1:
sprtPlyr = imgPlyrL1.getImage();
if(Game.tickCount2 == Game.DELAY){
aniCount = 2;
}
break;
case 2:
sprtPlyr = imgPlyrL2.getImage();
if(Game.tickCount2 == Game.DELAY){
aniCount = 3;
}
break;
case 3:
sprtPlyr = img... |
a701330b-bebf-4bd6-8ddb-aa670f4f2139 | 1 | private void execSalvarXml() throws IOException{
boolean status = salvarXml();
if(status){
JOptionPane.showMessageDialog(null, "Arquivo salvo com sucesso!");
jifXmlViewer.dispose();
}
else {
JOptionPane.showMessageDialog(null, "Erro ao salvar arquivo!"... |
806b5c38-9b53-4f4a-b291-a3202271c115 | 6 | @Override
public String export(List<Artist> artists, List<Album> albums, String exportPath) {
Gson gson = new GsonBuilder().setDateFormat("yyyy").setPrettyPrinting().create();
JsonElement artistTree = gson.toJsonTree(artists);
String artistJsonString = gson.toJson(artistTree);
JsonEl... |
1d618247-cd69-40b8-b0d9-f739f20f8d5e | 3 | public static void Envia (OrdenCliente objeto, String hostdestino, int puerto){
try {
DatagramSocket socket;
DatagramPacket paquete;
//El protocolo IP subyacente permite longitudes de paquetes de más de 2^16 bytes,
//que incluye tanto las cabeceras como los mensajes
... |
df03dad0-7d85-4c5b-9d8e-e2d9e916d3f1 | 9 | public void freeze()
{
if (frozen) return;
// train the TFIDF distance on all strings seen
trainDistances();
// now, compute the maxScore of each token, and create an inverted index
if (DEBUG) System.out.println("computing maxScore of "+tokenizer.maxTokenIndex()+" tokens");... |
4a8fe451-dfa9-4d01-9b56-a80b8c9af145 | 4 | public static void deleteHome( String player, String home ) {
BSPlayer p = PlayerManager.getPlayer( player );
Home h = getSimilarHome( p, home );
if ( h == null ) {
p.sendMessage( Messages.HOME_DOES_NOT_EXIST );
return;
}
for ( ArrayList<Home> list : p.get... |
9216959b-ce43-4a0e-9a03-367dadba13a7 | 2 | public int postOrderIndex(final GraphNode node) {
if ((postOrder == null) || (edgeModCount != postOrder.edgeModCount)) {
buildLists();
}
return node.postOrderIndex();
} |
962fdd6e-c182-4bac-8ead-0dbc5db7e659 | 9 | private static void queryAction(Query query, Storage storage) {
switch (query.type) {
case ADD : {
if (storage.addRecord(query.rec)) {
System.out.println("This person is already exists. Record was updated");
} else {
System.out.... |
a08be708-9482-4b23-add3-d643820a88cb | 7 | @Override
public void run() {
ThreadPoolExecutor pe = IautosResource.threadPool;
Fetcher fetcher = null;
int fetcher_idle_sleep = ConfigManager.getInstance().getConfigItem(
IautosConstant.FETCHER_IDLE_SLEEP, 30);
while (!isInterrupted()) {
try {
fetcher = IautosResource.fetchQueue.poll(fetcher_... |
a3f56f5f-843c-4201-9455-8694f142d1d5 | 6 | public double computeDynamicCutoff() {
{ NnPartialMatch self = this;
if (((NnPartialMatch)(self.parent)) != null) {
{ Keyword testValue000 = self.kind;
if (testValue000 == Logic.KWD_ATOMIC_GOAL) {
return (((NnPartialMatch)(self.parent)).dynamicCutoff);
}
els... |
9d9cb433-7aca-4408-93cc-42ea024fcd62 | 0 | public void matchesInSubPackage()
{
Filter inMeiyoPackage = inSubpackage( "org.nnsoft.commons.meiyo.classpath" );
assert inMeiyoPackage.matches( Filters.class );
assert !inMeiyoPackage.matches( List.class );
} |
ba13f869-19d6-4ca8-b549-598e062b0846 | 9 | private boolean inBoundingBox(int mouseX, int mouseY) {
int x = this.x + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0);
int y = this.y + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0);
int width = this.width - (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0) + (depth > ... |
481c5c57-33c3-4801-b1a8-7c724a78a60d | 0 | public void testIsPrimitiveNumberType() {
assertTrue(NumberUtils.isNumberType(int.class));
assertFalse(NumberUtils.isNumberType(Integer.class));
assertFalse(NumberUtils.isNumberType(String.class));
assertFalse(NumberUtils.isNumberType(boolean.class));
assertFalse(NumberUtils.isNumberType(char.class));
asser... |
a2f57c81-ec95-439f-a40f-4358263f0faa | 3 | public Double columnMean(int col) {
if (!isContinuous(col)) {
throw new MLException("Cannot calculate the mean of a non-continuous column");
}
double sum = 0.0;
int count = 0;
for (List<Double> row : data) {
double val = row.get(col);
if (val !... |
907d1bac-9ec0-4873-a559-2dc4fc360763 | 3 | public synchronized void update(long elapsedTime) {
if (frames.size() > 1) {
animTime += elapsedTime;
if (animTime >= totalDuration) {
animTime = animTime % totalDuration;
currFrameIndex = 0;
}
while (animTime > getFrame(currFrame... |
04a5313d-d407-4952-ace9-34899cc0ed16 | 6 | int fetch_next_packet(Packet p) {
int result;
byte[] buffer;
int index;
int bytes;
result = os.packetout(p);
if (result > 0) {
return 1;
}
while (oy.pageout(og) <= 0) {
index = oy.buffer(CHUNKSIZE);
buffer = oy.data;
... |
5f473836-c9e0-4d2c-8951-41acac35600c | 6 | public void changeStatus(){
//Change status via plugin.statusBlocks
if (plugin.statusBlocks.size() > 0){
worlds = Bukkit.getServer().getWorlds();
if (worlds.size() < plugin.maxWorlds){
if (plugin.statusPortals != true){
//GREEN
plugin.statusPortals = true;
for (Location block : plugin.statu... |
b6dfc4f7-0524-4742-9753-4065ace837c6 | 1 | public void drawHighlight(Graphics2D g) {
if (needsRefresh)
refreshCurve();
Graphics2D g2 = (Graphics2D) g.create();
g2.setStroke(new java.awt.BasicStroke(6.0f));
g2.setColor(HIGHLIGHT_COLOR);
g2.transform(affineToText);
g2.fill(bounds);
g2.dispose();
} |
0230d0f7-088f-48a9-932f-cceffac49793 | 2 | public void buildLink(String name1, String name2) {
if (!actors.containsKey(name1) || !actors.containsKey(name2))
throw new Error("linking actor doesn't exist!");
actors.get(name1).linkCoStar(actors.get(name2));
} |
6a7aee7e-c305-4a96-baf6-a01418ac1790 | 4 | public void PantallaTabla(VFTable tabla){
JFrame TablaFrame = new JFrame();
JPanel TablaPanel = new JPanel();
JLabel TablaLabel=new JLabel();
Dimension dimension=new Dimension(310,220);
TablaFrame.setMinimumSize(dimension);
TablaPanel.setLayout(null);
TablaPanel.s... |
a539d7f2-f0dd-429e-93c6-ec61f6437d44 | 8 | public int romanToInt(String s) {
int decimal = 0;
int lastNumber = 0;
//String romanNumeral = romanNumber.toUpperCase();
/* operation to be performed on upper cases even if user enters roman values in lower case chars */
for (int x = s.length() - 1; x >= 0 ; ... |
c34177fb-56ca-4248-b2b8-433beaf0c57c | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Pessoa other = (Pessoa) obj;
if (!Objects.equals(this.idPessoa, other.idPessoa)) {
return fal... |
096d882b-dab5-44e2-b6ae-07b261005807 | 9 | private void step(){
for(int i = 0; i < sprites.size(); i++){
sprites.get(i).stepFoward();
for(int j = i + 1; j < sprites.size(); j++){
if( sprites.get(j) instanceof Predator
|| sprites.get(j) instanceof AirShot){
//Insure tha... |
dfc89632-9a39-4286-aaca-71b3df66f176 | 8 | @Override
public Rectangle getBoundingBox() {
int smallestx = Integer.MAX_VALUE;
int smallesty = Integer.MAX_VALUE;
int biggesty = Integer.MIN_VALUE;
int biggestx = Integer.MIN_VALUE;
for (int i = 0; i <= px.length - 1; i++) {
if (px[i] < smallestx) {
smallestx = px[i];
}
}
for (int i = 0; i <... |
96527730-7a46-4e67-83f9-70e49a4b8a87 | 0 | @Override
public void destroy() {
// Nothing here
} |
9d8a32cb-0a44-46fb-9a7d-6a41ebc59939 | 8 | public void run() {
int lastArrival = 0;
Statistics.console.log("Simulation Starts ....");
while (true) {
int nextArrival = arrivalRand.nextInt();
while (EventsQueue.peekTime() < lastArrival + nextArrival) {
EventsQueue.executeEvent();
}
... |
fc446b3f-1897-4dc6-910b-08c4270cdadb | 5 | private Type[] getGenericTypeArguments(Type type) {
Type[] typeArgs = null;
if (type instanceof ParameterizedType) {
typeArgs = ((ParameterizedType) type).getActualTypeArguments();
}
if (typeArgs != null) {
for (Type t : typeArgs) {
if (!(t instanceof Class<?>))
return null;
}
}
return type... |
5aae8ea0-5dec-42e4-8fee-8102bae8de04 | 3 | private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
plugin.getLogger().log(Level.SEVERE, null, e);
}
}
} |
7f2fd34b-0258-44ae-b065-f8f3b067142c | 1 | public BigDecimal calcProductTotal (int productQuantity) {
BigDecimal res = BigDecimal.valueOf(0);
int i = productQuantity;
int currentProductPackCapacity;
while (i > 0) {
currentProductPackCapacity = this.calcBiggestFeasible(
i,
prices.keySet());
//increment product-total
res = res.add(p... |
4f627c92-4476-4486-b2a3-545bda31fcbb | 2 | public BufferedImage getImage(String name){
for(ImageTicket ticket : this.getImageTickets()){
if(ticket.getName().equals(name)){
return ticket.getImage();
}
}
return null;
} |
d12e9cd8-d0de-440c-a20c-9a0f7956919e | 6 | @Override
public void move(Entity e) {
if (cullable) {
culltick++;
return;
}
x += xv;
y += yv;
range -= Math.sqrt(xv * xv + yv * yv);
if (range < 0) {
cullable = true;
}
shape.setCenterX(x);
shape.setCenterY(y);
// Wrap Screen
if (x > FORM_WIDTH) {
x = 0;
} else if (x < 0) {
x ... |
2d72e733-b3a8-47e4-bbc8-b07f529f4ca0 | 0 | public void setPage(int page) {
this.page = page;
} |
580cc8c3-2646-434e-9ec5-0cd37daff46d | 6 | public static void main(String[] args) throws InterruptedException{
bufor = new Bufor();
producenci = new Thread[iloscProducentow];
konsumenci = new Thread[iloscKonsumetow];
for(int i=0; i<iloscProducentow; ++i){
producenci[i] = new Producent(bufor, i);
}
for(int i=0; i<iloscKonsumetow; ++i){... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.