method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
111cfbb6-134c-4e9e-9881-d2c65d96206a | 7 | public static void loadData(Player p, DatabaseResult result) {
ByteBuffer profile = ByteBuffer.wrap(result.getProfile());
p.setLocation(RSTile.locate(profile.getShort(), profile.getShort(), profile.get()));
for(int i = 0; i < p.getLooks().getLooks().length; i++) {
p.getLooks().getLooks()[i] = profile.get();
... |
740c2288-3fc6-4cc4-867a-66d3718f692f | 2 | public int attackSpecial(Character opponent){
int type = (int)(Math.random()*2);
int damage = 0;
if (type == 0){
System.out.println(_name+" pulls out his own laptop to use!");
damage = laptop(opponent);}
else {
System.out.println(_name + " develops the DeHovitz hypothesis!");
damage = d... |
e9dfd8f2-dc3a-45ff-ab58-b5a73b95d73d | 3 | void binarySearch(User user, int begin, int end) {
if (end != begin && flag) {
binarySearch(user, begin, (int) (((long) end + begin) / 2));
binarySearch(user, (int) (((long) end + begin) / 2) + 1, end);
} else if (user.theNumberIs(end)) {
answer = end;
fla... |
2096e40b-36e7-4a49-8510-aea58e4f90c4 | 0 | public boolean isAlive() {
return (state == STATE_NORMAL);
} |
856a5132-f547-4a16-80b5-64d38b3dd0b4 | 9 | @Override
public void executeMsg(Environmental affecting, CMMsg msg)
{
super.executeMsg(affecting, msg);
if (((getClanItemType() == ClanItem.ClanItemType.SPECIALSCALES)
|| (getClanItemType() == ClanItem.ClanItemType.SPECIALTAXER))
&& (owner() instanceof MOB)
&& (clanID().length() > 0)
&& (((MOB) owne... |
04c7e984-c3dc-430e-9ee8-36134c4f9ac1 | 0 | public Item(){
name = "Unknown ITEM name";
this.criticalPoint = 1;
this.criticalPercent = 1;
this.endurance = 1;
this.money = 1;
this.abitiy = 1;
this.strength = 1;
this.intelligent = 1;
this.paybackMoney = 1;
} |
0179d2a6-d694-44d7-8d37-bfaa4bd51c9e | 3 | @Override
public boolean join(String n) {
try {
// Create a connection, for send messages, with the server
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(K.BROKER_URL);
m_connection = (ActiveMQConnection) cf.createConnection();
m_connection.start();
// Setup the connection
m_qSessio... |
9f627bcb-1b46-4331-bdf6-5c5b78852fdf | 9 | private void initialize() {
frmScoreLookUp = new JFrame();
frmScoreLookUp.setTitle("Score Look Up");
frmScoreLookUp.setResizable(false);
frmScoreLookUp.setBounds(100, 100, 463, 311);
frmScoreLookUp.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frmScoreLookUp.getContentPane().setLayout(null);
JLabe... |
941e7f0e-3a0b-4436-bdfa-654a6db77402 | 3 | public void PassengersOffBoarding(BusStop busStop,OutputFile outBusStopActivity,OutputFile screen)
{
//person getting off the bus
Person got;
//linklist iterator
ListIterator iter = passengers.listIterator();
//iterate all passangers on the bus
while(iter.hasNext())
... |
db042155-9585-4dc3-ba1f-8abd741f49af | 4 | public static InputStream getInputStream(Object arg) throws IllegalArgumentException, IOException
{
if(arg instanceof File)
{
return new FileInputStream((File)arg);
}
if(arg instanceof String)
{
return new FileInputStream((String)arg);
}
if(arg instanceof URL)
{
return ((URL)arg).openStream();... |
51243dbd-1e89-4fc5-b8ec-28ef47c088db | 3 | public static Integer getDominantClass(Dataset instances) {
HashMap<Integer, Integer> classMap = getClassmap(instances);
Integer maxClassKey = null;
for (Integer key: classMap.keySet()) {
if (maxClassKey != null) {
if (classMap.get(key) > classMap.get(maxClassKey)) {
... |
f05eb208-1ef5-43d4-a2dd-e60c3926cb4e | 3 | public Node getNode(int x, int y)
{
for(int i = 0; i < nodes.size(); i++)
{
if(x == nodes.get(i).getX() && y == nodes.get(i).getY()) return nodes.get(i);
}
return null;
} |
c8bdabaa-aae8-4dcc-9d76-eaf2939f5da3 | 1 | public void visitLookupSwitchInsn(final Label dflt, final int[] keys,
final Label[] labels) {
// adds the instruction to the bytecode of the method
int source = code.length;
code.putByte(Opcodes.LOOKUPSWITCH);
code.putByteArray(null, 0, (4 - code.length % 4) % 4);
dflt.put(this, code, source, true);
code... |
b1862a62-38a4-4a94-8154-8d8b989291bc | 8 | public void setLabels(String value) {
int i;
String label;
boolean quoted;
boolean add;
m_Labels.clear();
label = "";
quoted = false;
add = false;
for (i = 0; i < value.length(); i++) {
// quotes?
if (value.charAt(i) == '"') {
quoted = !quoted;
if (!... |
b8ed179f-ab82-448f-a4cc-484c43a11b94 | 6 | private void spawnLetters(Vector3 sphereCenter, String choosenWord, Skin skin) {
float x = 0;
float y = 0;
float sphereRadius = 32;
boolean collision = false;
Sphere spawningOuterSphere = new Sphere(sphereCenter, Gdx.graphics.getHeight() / 2 - bucket.radius - 2 * sphereRadius);
System.out.println(2 * bucket... |
c9ac024d-ecd5-4aca-a27c-630ac2833f45 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Categoria other = (Categoria) obj;
if (categoria == null) {
if (other.categoria != null)
return false;
} else if (!categoria.equals(othe... |
f2812d6a-70a9-4f93-ae40-c261bbb346aa | 0 | public void setElectricBrakes(boolean electricBrakes) {
this.electricBrakes = electricBrakes;
} |
a80209a6-48d4-4c7c-a76f-d8a4f80aafa5 | 5 | public void replaceBid(Bid oldBid, Bid bid) {
if (getGameID() < 0) {
throw new IllegalStateException("No game playing");
}
int auction = bid.getAuction();
int oldAuction = oldBid.getAuction();
if (oldBid.isPreliminary()) {
throw new IllegalStateException("Old bid is still preliminary");
... |
20c8db1b-e07f-4c9d-98b3-26c972d79e51 | 8 | @Override
public String getValue() {
switch (cell.getCellType()) {
case CELL_TYPE_BLANK:
return "";
case CELL_TYPE_STRING:
return cell.getStringCellValue().trim();
case CELL_TYPE_NUMERIC:
if (HSSFDateUtil.isCellDateFormatted... |
1e6b4730-bf30-4047-9d0e-2057cb7b642e | 5 | @Test
public void test_mult_matrix_identity() {
int dim = 3;
Matrix a = new MatrixArrayList(dim, dim);
Matrix identity_matrix = new MatrixArrayList(dim, dim);
for (int i = 1; i <= dim; i++) {
for (int j = 1; j <= dim; j++)
a.insert(i, j, (double) (2 * i - j));
}
for (int i = 1; i <= dim; i++) {
... |
f07318ed-785d-4da9-94e4-6371ed7e9198 | 2 | public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar();
if (g == null)
return;
LRParseTableDerivationPane ptdp = new LRParseTableDerivationPane(
environment);
if(ptdp.getAugmentedGrammar() == null) return;
environment.add(ptdp, "Build SLR(1) Parse", new CriticalTag() {
... |
7f5d4bf3-c10f-48dc-93ef-96184b65ee75 | 0 | public static void main(String args[]) {
XMLChecker app = new XMLChecker(args);
} |
f8395090-054e-4d6e-bb89-819eaf6c821c | 9 | void rebuildEventPoints() {
int k;
Vector<EventSymbol> x = new Vector<EventSymbol>();
if (this.eventSymbol != null) {
for (k = 0; k < this.eventSymbol.length; k++) {
remove(this.eventSymbol[k]);
}
}
if (this.eventPos != null && this.drawPoints) {
for (k = 0; k < this.eventPositions.length; k++)... |
8ff5ae50-b99a-45af-91b0-dd2bebd9457e | 4 | public static int getSailplaneWeightUnit() throws ClassNotFoundException {
int weightUnit = 0;
try{
//Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar");
Class.forName(driverName);
Class.forName(clientDriverName);
}catch(java.lang.ClassNotFoundExc... |
3167a064-a811-4da0-9f7f-80fc218a5fed | 8 | protected void propertiesCheck() throws PoolConfigurationException {
if (this.props == null) {
throw new PoolConfigurationException("Properties for the pool needs to be defined using " + PoolConfiguration.class);
}
try {
this.driver = (Driver) Class.forName(
... |
7e2a8406-8bac-4755-9a50-414b543f7086 | 6 | void feedback(Object from, String from_out, Object to, String to_in) {
// add them to the set of commands
if (from == to) {
throw new ComponentException("src == dest.");
}
if (to_in == null || from_out == null) {
throw new ComponentException("Some field arguments are null");
}
ComponentAccess ca_from... |
35e987c6-f85d-4e4f-a0ef-a4837d1fd191 | 4 | void loadTextures(String textureFilename, int width, int height, int nb) {
Image img = controller.loadImage(textureFilename);
// block until image is loaded
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(img, 0);
try {
tracker.waitForAll();
} catch (Exception ignored) {
}
int[] dat... |
72bad051-f559-403f-bc07-366bbcca5ac4 | 7 | public int checkHoleOnSides(int a_x, int a_y)
{
//Check right
boolean onRight = false;
if((m_lastCell > a_x+1) && !checkObstacle(a_x+1, 0, a_x+1, a_y))
{
onRight = true;
}
//Check left
boolean onLeft = false;
if(!checkObstacle(a_x-1, 0, a_... |
2caa733f-b626-4248-ab36-41793126e99b | 2 | public static byte[] compressData(byte[] data) {
Deflater deflater = new Deflater();
deflater.setLevel(Deflater.BEST_COMPRESSION);
deflater.setInput(data);
deflater.finish();
ByteArrayOutputStream stream = new ByteArrayOutputStream(data.length);
// Compress the data
byte[] buffer = new byt... |
fbd968fd-f068-41a9-b080-c77eacf6bb22 | 7 | @Test
/**
* Tests moving pieces on a board.
*/
public void testPieceMovement(){
String testBoard1 = "EEEE22E2111111112222222E";
GameBoard board = null;
try {
board = new GameBoard(testBoard1);
System.out.println("Testing board:");
System.out.println(board.toString());
Team team1 = board.getTeam1... |
e99c0aab-047b-4715-9533-67a35ded7b32 | 7 | public TreePath getPath(String fullName) {
if (fullName == null || fullName.length() == 0)
return new TreePath(root);
int length = 2;
ClassInfo ci = ClassInfo.forName(fullName);
while (ci.getSuperclass() != null) {
length++;
ci = ci.getSuperclass();
}
TreeElement[] path = new TreeElement[length];... |
cce5bdac-b5ec-497e-ac3d-448c136c50d1 | 6 | @Override
public void DoAction()
{
// LogTask("Doing action");
if(control.Finished())
{
return;
}
if(control.curTask == null)
{
// If there is a null task, we've done something wrong
Log.e("Selector", "Current task has a null action");
return;
}
// If we do have a curTask...
if( !cont... |
fdcf0e58-3970-4e2b-bd7b-241164463e71 | 1 | public Defrag(int len) {
this.len = len;
this.blob = new byte[len];
ms1[0] = 0;
ms2[0] = len;
for(int i = 1; i < 20; i++)
ms1[i] = -1;
} |
d279fd00-30f4-44e4-bb43-16505991e0fb | 6 | public Iterator iterator() {
// /#ifdef JDK12
cleanUp();
// /#endif
return new Iterator() {
private int bucket = 0;
private int known = modCount;
private Bucket nextBucket;
private Object nextVal;
{
internalNext();
}
private void internalNext() {
while (true) {
while (nextBu... |
56212961-3cf2-4bec-aaed-4e2a589316af | 5 | private void info(CommandSender sender, String[] args) {
if (!sender.hasPermission("graveyard.command.info")) {
noPermission(sender);
return;
}
Spawn point;
if (args.length > 1) {
point = SpawnPoint.get(GraveyardUtils.makeString(args));
if ... |
07e5534c-5ce0-41e7-ae3c-a889cb0d04cf | 6 | public NetworkGraphDisplay() {
addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent event) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
mouseClickPoint = event.getPoint();
}
@Override... |
b05b9609-9d9b-4ec5-b02b-e58247e8a235 | 6 | private void runRED(ATMCell cell){
boolean cellDropped = false;
double dropProbability = 0.0;
if (outputBuffer.size() > this.startDropAt) {
if (outputBuffer.size() < this.maximumBufferCells) {
dropProbability = (outputBuffer.size() - this.startDropAt)
/ (double)(this.maximumBufferCells - this.sta... |
57a834a0-958b-4b80-b8dd-7d00400fa505 | 4 | public boolean isWiredUp() {
boolean wiredUp = true;
for (Element element : elements) {
if (!element.isConnected()) {
wiredUp = false;
}
}
for (Wire wire : wires) {
if (!wire.isConnected()) {
wiredUp = false;
}
... |
53dd9bfb-8f45-4218-8464-43cd823fda01 | 6 | public void addSubTrees(DefaultMutableTreeNode root) {
DefaultMutableTreeNode parent =
new DefaultMutableTreeNode(new ColopediaTreeItem(this, getId(), getName(), null));
Image buildingImage = ResourceManager.getImage("Colopedia.buildingSection.image");
ImageIcon buildingIcon = new I... |
e79fe9d5-8a60-4b5b-ba3d-c0ebf08e969d | 2 | private double drawValue(Graphics2D g2d, String text0, int startAngle, int angle){
double percent = (double) Math.round((double) angle/360*100*1000)/1000;
if(percent > 5 || text0.equalsIgnoreCase("Other")){
String text = String.valueOf(percent) + "%";
g2d.setColor(Color.BLACK);
g2d.setFont(getFont().derive... |
5df1205c-3b71-48ce-b2c0-55f6486400bd | 6 | protected boolean stopThread(ThreadType type) {
switch (type) {
case REPORT:
if (reportThread == null) {
return true;
} else {
reportThread.setRun(false);
try {
reportThread.join(5000);
reportThread = null;
return true;
} catch (InterruptedException e) {
warn("Could not sto... |
386ba66a-c101-4a3a-b1e0-556a7bab6a3a | 6 | public void enterLane(Lane nextLane, Lane leftLane) {
if (firstFree() == false) {
Car carChoice = firstCar();
int choice = carChoice.destination;
if (choice == 0) {
theLane[0].setForward(nextLane.theLane[nextLane.theLane.length - 1]);
}
else {
theLane[0].setForward(leftLane.theLane[leftLane.theLa... |
42ff62b6-1301-4b5a-aaf0-4156b5df8131 | 4 | public DisconnectFilter(final ConnectionProcessor proc, final Properties props)
{
super(proc, props);
requireConfigKey(min_uptime_key);
requireConfigKey(max_uptime_key);
final long min_uptime = Long.parseLong(props.getProperty(min_uptime_key));
final long max_uptime = Long.parseLong(props.getProperty(max_uptime_k... |
749cbd5a-7296-4125-a6e3-b41430652072 | 0 | public Trd_match getPlugin() {
return plugin;
} |
3e57dc81-e41f-4cc5-ac7d-f3f8f5791312 | 4 | public boolean movePiece(Location init, Location fin)
{
int initCol = init.getColumn();
int initRow = init.getRow();
int finCol = fin.getColumn();
int finRow = fin.getRow();
Tile currentSpace = board[initRow][initCol];
//If there's a piece at the end of the path
if(board[finRow][finCol].getPiece() != ... |
fc5ede45-4518-4e07-97e5-783791a846c5 | 5 | public void clickField(Field clickedField) {
if (this.isActive) { // Game active and game either game not online or game is online and this player's turn
System.out.println(clickedField);
if (this.fieldContainsThisPlayersPiece(clickedField, this.playersTurn)) { // Player activates his own piece
if (this.act... |
c48f1adf-5c7b-4f41-959e-d75190692d28 | 9 | public static void feedC(int level) {
if(level == g || found == true) {
return;
}
int n = list.size();
for(int i=0; i<n; i++) {
int[] oldState = list.get(0);
list.remove(0);
int[] used = feedsUsed.get(0);
feedsUsed.remove(0);
int offset = level;
if(level >= 1) {
offset = used[level-... |
b8df72f8-a305-4a10-b8d0-e4fb072ba1fa | 9 | public void nextGen(){
//розширили площу
boolean [][]tmpArea = expand();
area = new boolean [height+2][width+2];
//зберегли в основни масив розширену площу
for(int i=0; i<=height+1; i++){
for(int j=0; j<=width+1; j++){
area[i][j] = tmpArea[i][j];
}
}
//аналіз сусідів кожної клітинки
for(int i=... |
f206ca12-8185-48c7-a4bf-147a6ab15eb2 | 8 | public static Matrix read (BufferedReader input) throws java.io.IOException {
StreamTokenizer tokenizer= new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to dis... |
a569c037-eb37-4e31-b65c-ceba503927f4 | 2 | public boolean ReadFile()
{
//read status
boolean status = false;
try
{
//open the file input stream
FileInputStream inStream = new FileInputStream(System.getProperty("user.dir")+"\\"+fileName);
//get the data stream for the file
... |
1357c1e4-6cee-44bf-8600-d8078aa46f06 | 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... |
7e3becf0-9b83-44e5-8591-0ef3fd850a05 | 6 | static Table readTable(String name) {
BufferedReader input;
Table table;
input = null;
table = null;
try {
input = new BufferedReader(new FileReader(name + ".db"));
String header = input.readLine();
if (header == null) {
throw e... |
c9e91d8d-5286-4be5-9170-d8158aaf73f9 | 1 | public double reduceDamage(double damage){
double temp = damage - armorItem.getDefenseScore();
if(temp <0)
temp = 0;
return temp;
} |
101f4bc3-1a9a-4788-a09e-ba4e5ef6c487 | 2 | public Object getPattern(String name) {
for (String a : genericPatterList.keySet()) {
if (name.equalsIgnoreCase(a)) {
return genericPatterList.get(a);
}
}
return null;
} |
e845b30c-09e8-419e-b73f-186ff7a3a5c4 | 9 | public void switchActivatedAbility(Pokemon switchIn, Pokemon opponent, Weather weather) {
switch (switchIn.getAbility()) {
case DRIZZLE:
weather.setRain(Weather.PERMANENT);
break;
case DROUGHT:
weather.setSun(Weather.PERMANENT);
break;
case SAND_STREAM:
weather.setSand(Weather.PERMANENT);... |
0564e32f-cac2-4bc7-b9ec-6f2d07684542 | 4 | public void setTile(int x, int y, Tile t, int dataVal) {
if (x < 0 || y < 0 || x >= w || y >= h) return;
tiles[x + y * w] = t.id;
data[x + y * w] = (byte) dataVal;
} |
7d64e3f3-4d70-4873-a714-214d712a727e | 2 | public void showNotifications() {
for (TimedPosts post : notifications) {
long elapsedTimeInSec = (System.nanoTime() - post.getTime()) / 1000000000;
if (elapsedTimeInSec < 60) {
int elapsedTime = (int) elapsedTimeInSec;
System.out.println(post.getPost() +... |
2be3dfd2-087c-47cb-b943-7f08d38993d4 | 4 | @Override
public int altaCliente(TCliente cliente) throws Exception
{
Statement query = null;
Connection connection = null;
int ret = -1;
//insercion cliente generico
String contenido_query = "INSERT INTO Clientes(DNI, Nombre, Apellidos, Fecha_nacimiento, Tipo) VALUES ('"... |
7aa6ce8b-67c2-4180-868c-05132a6ea415 | 3 | public String md5(String str) throws DetectRightException {
if (str == null) {
return "";
}
MessageDigest md = md5.get();
if (md == null) throw new DetectRightException("MD5 digest is null!",null);
byte[] messageDigest = md.digest(str.getBytes());
BigInteger n = new BigInteger(1, messageDigest);
String... |
11c4dea7-ab14-401a-8770-30c9ed23c66c | 2 | public static String[] getParameterTypes(String methodTypeSig) {
int pos = 1;
int count = 0;
while (methodTypeSig.charAt(pos) != ')') {
pos = skipType(methodTypeSig, pos);
count++;
}
String[] params = new String[count];
pos = 1;
for (int i = 0; i < count; i++) {
int start = pos;
pos = skipType... |
ccd54049-2a14-458a-8f09-29f7f1d2e437 | 2 | private static int findGreatestY(Graph g) {
DynamicArray vertices = g.getVertices();
Vertex v = (Vertex) vertices.get(0);
int greatest = v.getY();
for (int i = 0; vertices.get(i) != null; i++) {
v = (Vertex) vertices.get(i);
if (v.getY() > greatest) {
... |
7f1e65f8-d95f-4bd0-ab33-2d9188a827d9 | 8 | private Point[] constructCircle(Spline s, double ignoredAngle, Point p)
{
if (ignoredAngle < -Math.PI) ignoredAngle += Math.PI * 2;
else if (ignoredAngle > Math.PI) ignoredAngle -= Math.PI * 2;
double left = ignoredAngle - Math.PI / 2 - circleStep / 2;
if (left < -Math.PI) lef... |
c9076032-9305-4e1e-8606-7f17389bce3b | 1 | public String getCourseCode(int courseId) throws SQLException {
NoteDatabaseManager dm = new NoteDatabaseManager();
String s_courseId = Integer.toString(courseId);
String sql = "select course_code from course where course_id = "
+ s_courseId + ";";
ResultSet rs = dm.sqlQuery(sql);
String courseCode = null... |
013cd5af-6ee2-4d0f-b3dd-ae777ccb8a78 | 5 | @Override
public void paint(Graphics g) {
g2d = (Graphics2D) g;
List<Point>[] paths = figur.gibPointLists();
List<Point>[] paths2D = ListOf3DPointsTo2DPoints(paths);
for (int i = 0; i < paths2D.length; i++) {
List<Point> path = paths2D[i];
GeneralPath gp = new GeneralPath();
gp.moveTo(this.getWidth() ... |
5a6cd14b-4180-42ab-85de-b5a9f0f5e5a6 | 1 | @Test
public void WhenFailedPath000_ExpectHostWithPrefix001() throws UnknownHostException {
// localhost: "0010"
// failed: "000"
// resulted prefix: "001"
// selected host: "0010" = the localhost must solve it
RoutingTable routingTable = new RoutingTable();
Host loca... |
a9eb22ce-d6a5-4858-a3e4-43490c3ad9dd | 9 | public void getInput() {
String command = null;
Scanner inFile = new Scanner(System.in);
do {
try{
this.display(); // display the menu
// get commaned entered
command = inFile.nextLine();
command = command.trim().toUpperCase();
... |
25cb3b10-74b7-4c4a-b598-06f795ccb020 | 2 | private void animateGameOver() {
gameOver = false;
final Random r = new Random();
Timer t = new Timer(7, new ActionListener() {
int cntr = 0;
@Override
public void actionPerformed(ActionEvent e) {
if(cntr == 199) {
((Timer)e.getSource()).stop();
drawOver = true;
repaint();
}
in... |
8c3e2260-fa05-40b2-bfba-9edb39eecc03 | 6 | @Override
public boolean createBufferConnectionToInputPort(String portName, LockPolicy lockPolicy, Object client, int bufferSize) throws WrongPortTypeException{
OrocosDataPort port = getPort(portName);
if(port.getPortType() == PortType.OUTPUT_PORT){
throw new WrongPortTypeException(port.getPortType());
}
if... |
d36c8f0f-09c5-4245-9dc4-b551e4ee310d | 8 | private boolean ajoutBean(boolean isSingleton) throws EMException, BeanException
{
boolean ajout = true;
List<Object> liste = EJBContainer.getInstance().getMapManageInstances().get(classBean);
if (liste == null)
{
//rechercher les methodes postConstruct et preDestroy
try {
EJBContainer.getInstance(... |
dcf9c62a-749b-4982-83b9-b2545e2ae84e | 6 | public boolean intersectBounds( AABB aabb )
{
return aabb == null ||
getMin().getX() > aabb.getMax().getX() ||
getMax().getX() < aabb.getMin().getX() ||
getMin().getY() > aabb.getMax().getY() ||
getMax().getY() < aabb.getMin().getY() ||
getMin().getZ() > aabb.getMax().getZ() ||
getMax().getZ(... |
055e2365-6325-407b-affa-63554b235560 | 8 | private synchronized boolean trySpawn(Dinosauro tempDinosauro, int maxDistance) {
Coord tempCoord = null;
if (maxDistance == 0) {
if (!isCellaAcqua(tempDinosauro.getCoord()) &&
!isCellaDinosauro(tempDinosauro.getCoord())) {
getMappa().spawnDinosauro(tempDinosauro.getCoord(), tempDinosauro.getIdDinosauro... |
827537d2-9a81-4440-b3d4-50450a1f9c8c | 2 | private String sendMessageToSomeSocket(String message,
String extraParameters, VanillaSocketThread socket) {
extraParameters = extraParameters == null ? "" : extraParameters;
String result = null;
try {
result = socket.sendMessageWaitResponse(message + "@" + "username="
+ state.getStateParameterValue("... |
492319ce-2749-4c3e-b519-fe317b3d4103 | 5 | @Override
public void ParseIn(Connection Main, Server Environment)
{
int PollId = Main.DecodeInt();
if(PollId == 1773)
{
int QuestionId = Main.DecodeInt();
if(QuestionId == 6070)
{
int count = Main.DecodeInt();
for(in... |
f1e12faf-e321-4d9e-ab97-c4320f2e61e9 | 4 | private Spieler auswahl_zufall_spieler(Spieler[] spieler, int[] verteilung){ // ja bei 2 spielern ist es fair wenn einer 30% und der andere 70% bekommt, bei 4 Spieler aufwärts ist die funktion in ordnung
int merk=10000;
int pos=0;
for (int i=0; i<verteilung.length; i++){
if (verteilung[i]==... |
1a1abf9d-77a9-49ac-b5c4-3a27477172ca | 5 | protected void fillSimpleRepeat(int[] pixels, int off, int adjust,
int x, int y, int w, int h) {
final float initConst = (dgdX * x) + gc;
// Limit step to fractional part of
// fastGradientArraySize (the non fractional part has
// no affect anyways, ... |
353754f0-9f13-401e-821d-8c83bf37b05b | 3 | public static void findModifyLessThan (Matrix modifyTarget, Matrix findTarget, double beta) {
double [][] findTar = findTarget.getArray();
double [][] modifyTar = modifyTarget.getArray();
for (int row = 0; row < findTarget.getRowDimension(); row++) {
for (int col = 0; col < findTarge... |
902ea868-92de-4b69-9e64-0401ffa447e7 | 7 | public WebServer(String[] startArguments) {
loadConfiguration(startArguments);
Log.debug(Configuration.getInstance().toString());
Log.debug("Information about the OS: " + System.getProperty("os.name")
+ " - " + System.getProperty("os.version") + " - "
+ System.getProperty("os.arch"));
if (Configurati... |
1d0e4e65-140c-4b58-8382-662637323425 | 0 | public void setPcaTerminal(String pcaTerminal) {
this.pcaTerminal = pcaTerminal;
} |
abb3ffde-98f1-4a9e-abe7-c793ab2a03c3 | 2 | private void handleAdd() {
Integer ip = DNSDB.stringToIP(ipText.getText());
if(ip == null){
JOptionPane.showMessageDialog(GUI.this, "'" + ipText.getText() + "' is not a valid IP address.");
} else{
if (dnsDB.add(nameText.getText(), ip)){
JOptionPane.showMessageDialog(GUI.this, "'" + ipText.getText() + "'... |
87729615-0259-4198-a352-9c20f559963b | 0 | @Override
public void setName(String name) {
this.name = name;
} |
8dd274a7-ece7-468d-abb6-2f0746a27b21 | 8 | public void next(int width, int height) {
for (int i = 0; i < bc.length; i++) {
if (bc[i] == null) return;
if (bc[i].prevx.size() == 0) {
bc[i].prevx.addLast(new Float(bc[i].x));
bc[i].prevy.addLast(new Float(bc[i].y));
} else if (bc[i].prevx.size() == bc[i].capacity) {
bc[i].prevx.removeFirst();... |
0fe2a536-aa7c-49ee-b900-61d8f1b14344 | 5 | public boolean isDialogueModelCached(int gender) {
int dialogueModelId = maleDialogueModelId;
int dialogueHatModelId = maleDialogueHatModelId;
if (gender == 1) {
dialogueModelId = femaleDialogueModelId;
dialogueHatModelId = femaleDialogueHatModelId;
}
if (dialogueModelId == -1)
return true;
boolean... |
fa770f3e-b57a-4c5e-bb6e-ec25b12a0afb | 8 | private static RDFNode getDefaultValueForType(Resource cls, Property predicate, Set<Resource> reached) {
reached.add(cls);
StmtIterator it = cls.listProperties(SPIN.rule);
while(it.hasNext()) {
Statement s = it.nextStatement();
if(s.getObject().isResource()) {
Resource templateCall = s.getResource();
... |
3d02d1a4-1479-4925-a04c-9d661be4c0c6 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if (!(sender instanceof Player))
return false;
Player player = (Player) sender;
if (!player.hasPermission(Permissions.PERM_CLAIM))
return false;
if (args.length < 1)
{
Util.sendMessage("&cInval... |
de511afe-e705-4176-8cdb-8eac0f3ebfab | 3 | public Double getDeterminant() {
Double determinant = null;
Matrix submatrix = null;
if(size == 1) {
determinant = values[0][0];
} else {
determinant = 0.0;
for(int columns = 0;
columns < size;
... |
3d4fbcf3-9387-48b4-a342-4df2a05a7c72 | 1 | @Test
public void addActivityTest() {
Activity activity = new Activity("Baloncesto Primaria", 10,
new BigDecimal(20.0), new BigDecimal(0), new HashSet<Student>());
try {
activityService.create(activity);
} catch (DuplicateInstanceException e) {
fail("Duplicated activity");
}
assertTrue(activityS... |
3ca99a42-bce2-4d87-8ebf-e98648cfa9c8 | 4 | @Override
public void execute(CommandSender sender, String worldName,
List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld unload <worldname>");
} else if (!hasWorld(worldName)) {
reply("Unknown world: " + worldName);
} else {
if ... |
e3ed6cf3-d135-4a36-ac38-04e71929e3ab | 3 | public static ArrayList<bConsultaDef> getConsultaDef(String arg_prod, String arg_data) throws SQLException, ClassNotFoundException {
ResultSet rs;
ArrayList<bConsultaDef> sts = new ArrayList<bConsultaDef>();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
... |
e29b7701-e238-40b9-a4c9-9a00bd8bd34a | 4 | private Object loadMethod(final int classID) throws Exception {
Object loadMethod = loadMethods.get(classID) ;
if (loadMethod == null) {
final String className = LoadService.readString(in) ;
final Class loadClass = Class.forName(className) ;
try { loadMethod = loadClass.getConstructor(S... |
0b84b89e-6704-49cd-bba8-43aeaf54ec83 | 0 | private static ConfModel readConf(String confFilename)
throws JsonParseException, JsonMappingException, IOException {
// ObjectMapperを作成
ObjectMapper mapper = new ObjectMapper();
// mydata.jsonからルートノードを取得
JsonNode rootNode = mapper.readValue(new File(confFilename),
JsonNode.class);
JsonNode yahooJapa... |
b516bd69-48d8-42ef-b3e1-0579ac3077f2 | 6 | public void salvarEndereco() {
switch (opcaoHeader) {
case "cadastrar cidade":
try {
genericDAO.save(cidade);
searchCidade();
} catch (Exception ex) {
Logger.getLogger(UnidadeMB.class.getName()).log(Level.SEV... |
de634a9e-6730-455c-a73d-098b55f104f2 | 9 | public List<List<Integer>> discretization(List<List<Double>> data) {
List<Double[]> minmax = getMinMax(data);
List<List<Integer>> result = new ArrayList<List<Integer>>();
for (int i = 0; i < dimension; i++) {
if (minmax.get(i)[0] > 100 && minmax.get(i)[1] > 1000) { // 如果最小值大于100且最大值大于1000,则所有值除以100
for (in... |
33172c6c-efe5-44d0-af48-f7687ba8aedf | 6 | public Text parse(String pathToFile) {
Text text = null;
try {
FileInputStream fstream = new FileInputStream(pathToFile);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
ResourceBundle bundle;
bundle = ResourceBundle.getBundle(Appl... |
267435af-0a90-4699-9520-ad8f78bd6dd8 | 1 | private static void writeObjectGroup(ObjectGroup o, XMLWriter w, String wp)
throws IOException
{
Iterator<MapObject> itr = o.getObjects();
while (itr.hasNext()) {
writeMapObject(itr.next(), w, wp);
}
} |
e5222a1e-f690-45da-aba8-2b36e4303fb6 | 2 | public void export() {
try {
this.te.export();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
1f1dcd9a-300a-4a92-8400-47706ab39ff2 | 4 | public static void poly( double[] x, double[] y, double s )
{
int[] intx = new int[x.length];
for ( int i = 0; i < x.length; i++ ) intx[i] = (int) x[i];
int[] inty = new int[y.length];
for ( int i = 0; i < y.length; i++ ) inty[i] = (int) y[i];
if ( filling )
{
pane.setColor( fillColor );
pane.fill... |
69f94512-e940-4f04-ab1a-953e43eef719 | 5 | @Test
public void testInfixToPostfix4() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
infix.addLast("+");
infix.addLast("(");
infix.addLast("1");
infix.addLast("+");
infix.addLast("2");
i... |
afc728b3-4210-4acf-b67c-053afd51c111 | 1 | private void resaveParamsRegistrUser(SessionRequestContent request) {
User currUser = (User) request.getSessionAttribute(JSP_CURRENT_USER);
if (currUser == null) {
currUser = new User();
currUser.setRole(new Role());
}
currUser.setLogin(request.getParameter(JSP_US... |
d33990b0-5936-4a37-b5f8-9b04f5dd1bec | 9 | public static void editBook(Messagable ui, String oldIsbn, String isbn, String category, String author, String title, float dailyLateFee, float maxLateFee, int numberOfCopies){
Book book = Book.getBook(oldIsbn);
boolean editItemSuccess = true;
//If the number of copies currently loaned out is greater than then ne... |
b8a7341f-67f5-4675-ba22-17c688a66db8 | 0 | public void unloadRegion(Region region){
regions.remove(region);
region.removeFromParent();
System.gc();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.