method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
797780fc-81ba-4eae-a0cd-00a2c687dcac | 0 | public int getMalesCount() {
return getGenderCount(Gender.MALE);
} |
fdf6ece0-d167-4e24-91da-7a4b748e5ee3 | 8 | private static void fillArray( final String s1,
final String s2,
final SubstitutionMatrix sm,
final float gapPenalty,
final int affinePenalty,
final boolean noPenaltyForBeginningOrEndingGaps,
final AlignmentCell[][] cels )
throws Exception
{
cels[0][0] = n... |
a1b8ef11-c005-463c-ad69-f9fdba58830b | 5 | private static int calculate(final Collection<Rotation4D> group,
final Collection<Rotation4D> arg1, final Collection<Rotation4D> arg2,
final Collection<Rotation4D> dist) {
int newElems = 0;
Rotation4D z;
for (Rotation4D x : arg1) {
for (Rotation4D y : arg2) {
z = x.nextRotation(y);... |
b78a2eb7-3885-4c3f-bc5e-03a67e480076 | 1 | public void visitTableSwitchInsn(final int min, final int max,
final Label dflt, final Label[] labels) {
if (mv != null) {
mv.visitTableSwitchInsn(min, max, dflt, labels);
}
execute(Opcodes.TABLESWITCH, 0, null);
this.locals = null;
this.stack = null;
} |
beaacf04-ac01-4c80-8b9b-4c9e2ffef5e8 | 3 | @SafeVarargs
public CommandHandler(P plugin, String defaultLabel, int pageCommands, AbstractCommand<P>... commands) throws IllegalArgumentException {
this.plugin = plugin;
this.defaultLabel = defaultLabel;
this.commands = new LinkedHashMap<String, AbstractCommand<P>>();
for (AbstractCommand<P> command : comman... |
1f78f170-296b-4a6b-a3f8-5de0699dc65a | 0 | @After
public void tearDown() {
} |
1ee9007b-642c-4632-9e3e-7f65f0058d94 | 2 | @Override
public void onTestUserKeyChanged(String userKey) {
BmTestManager bmTestManager = BmTestManager.getInstance();
boolean isUserKeyValid = bmTestManager.isUserKeyValid();
if (signUpButton.isVisible()) {
signUpButton.setEnabled(!(userKey.matches(Constants.USERKEY_REGEX) & is... |
ff016f2d-bd32-46dc-9887-9fed826da143 | 2 | @Override
public String getDescription() {
if (descriptionValue == null || isEmpty(descriptionValue.getText())) {
return "";
}
return descriptionValue.getText();
} |
a629fa93-bad3-41b4-a465-fa65b12b0a47 | 3 | void integer_operation(int[][] A, int[][] B, int[][] C)
{
for(int i=0;i<cnt;i++)
{
for(int j=0;j<cnt;j++)
{
C[i][j] = 0;
for(int k=0;k<cnt;++k)
{
C[i][j]+=A[i][k]+B[k][j];
}
}
}
} |
d11ab46e-4823-4fb5-869b-4463454b5256 | 9 | @Override
protected boolean isValidNonDropMove(GameState state, int x, int y) {
/* Begins by verifying if a move is within the range of the board.
* Then verifies if a move is on one of the diagonals (the change in x equals the change in y).
* Then it checks to see if all tile on the way t... |
0f2e285e-5575-4612-bcac-7683e6788686 | 6 | public Node reverseAlter2KNodes(Node head, int k){
//process 2K nodes at a time
//reverse till k nodes and set the the pointer to k+1
int x = k;
Node moving = head;
Node head_prev = null;
Node head_next = null;
while(x>0 && moving!=null){
head_next = moving.next;
moving.next = head_prev;
head_p... |
bc61db7d-2bf5-4948-b6c8-a17465fe9c40 | 2 | public void computeSuplementalFactors() {
for (Entry<Float, float[][]> week : DB_ARRAY.entrySet()) {
float[][] weekNumber = week.getValue();
float[][][] techs = DB_PRICES.get(week.getKey());
float[][] sups = new float[weekNumber.length][];
for (int i = 0; i < weekNumber.length; i++) {
float[] supleme... |
f2a48218-2f94-4f2e-a98e-19206b4e28e5 | 6 | public static int getArrayOrListLength(Object arrayOrList) {
if (arrayOrList == null) {
return 0;
}
Class<?> clazz = arrayOrList.getClass();
boolean isArray = ClassHelper.isTypeArray(clazz);
boolean isList = ClassHelper.isTypeList(clazz);
if (!isArray && !isList) {
throw new IllegalArgumentExce... |
79e319df-da04-42cd-b9ec-00ea3b06640d | 7 | public void addHistory(String date, String name1, String name2, String score, String duration) throws IOException {
// Add a new record to the top of the log
String savedGame = date + "," + name1 + "," + name2 + "," + score + "," + duration;
String temp = "temp-history.csv";
String p = n... |
d5a71666-bf49-44fe-9779-5bac89146ed3 | 6 | private void threadroot() {
// this should be running the current thread
Lib.assertTrue(javaThread == Thread.currentThread());
if (!isFirstTCB) {
/* start() is waiting for us to wake it up, signalling that it's OK
* to context switch to us. We leave the running flag false so that
* we'll still run ... |
a5f0fb0a-ad66-4f78-bb3a-54e92e988e08 | 7 | private void playGame() {
// if second player then becomes backup server
if (gameState.getBackupServerID() == this.id) {
becomeBackupServer();
}
// play
while (!gameState.isGameOver()) {
curClock++;
int randSleep = rand.nextInt(PLAYER_MOVE_MAX_DELAY) + 1;
sleep(randSleep);
... |
c7a4790f-493f-4baf-b5fd-1cdbacff57b1 | 6 | public void learn(double[] expectedOutputs) {
this.learningCycles++;
double sum = 0;
double error = 0;
double weight = 0;
//Last layer
int lastLayer = layers.length - 1;
for(int j = 0; j < layers[lastLayer].getSize(); j++) {
for(int k = 0; k < layers[lastLayer].getNeuron(j).getInputSize(); k++){... |
f11a47e5-bc70-4661-9c62-a2bdd1f4da62 | 2 | private static Connection getConnection(){
String dbtime=null;
String dbUrl = "jdbc:mysql://your.database.domain/yourDBname";
String dbClass = "com.mysql.jdbc.Driver";
Connection con=null;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection (dbUrl);
} catch (ClassNotFoundEx... |
ed11714c-d807-406c-9883-393eecdd6cff | 3 | @Override
public int hashCode() {
int result;
long temp;
result = consignmentId;
result = 31 * result + (logTime != null ? logTime.hashCode() : 0);
temp = amount != +0.0d ? Double.doubleToLongBits(amount) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
... |
6cdcd988-459d-44ee-85eb-6b2730ba0748 | 9 | private void checkDirectoryListing(Path path, String[] expected_children,
boolean[] expected_kinds) {
// List the given directory.
String[] listing = null;
try {
listing = serviceStub.list(path);
} catch(Throwable t) {
t.... |
5afbe7f6-f6e9-4694-a3c9-0a4df1031402 | 0 | public DecisionQuest() {
super(QuestType.DECISIONQUEST);
} |
f33f5f19-da04-42fe-b954-befb06bdf815 | 5 | public final Node state() {
synchronized (lock) {
final Node stateNode = this.current_node.get();
if (stateNode != null && stateNode.isAlive()) {
return null;
} else {
for (final Node state : nodes) {
if (state != null && state.activate()) {
return state;
}
}
}
return null;
... |
585335ff-d66c-4723-865f-aa34c6c0ac49 | 9 | private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
Funcionario f = new Funcionario();
if (!(txCodigo.getText().equals("") || ((txCodigo.getText().equals(null))))) {
f.setId(Integer.parseInt(txCodigo.getText()));
}
... |
bcaa1135-08ec-49ab-bb44-9e0b7d20762f | 2 | public Matrix transpose() {
Matrix n = new Matrix();
for (int c = 0; c != 4; c++) {
for (int r = 0; r != 4; r++) {
n.set(c, r, get(r, c));
}
}
return n;
} |
5eba3908-684f-4bdf-8881-6f6be94ba1d7 | 4 | private static void downloadClient(){
try{
LauncherFrame.notificationLabel.setText("Download del client in corso ... 0%");
URL url = new URL(Settings.updateFile);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
int filesize = connection.getContentLength();
float totalDataRe... |
9c526a01-0758-4d98-9780-c35587ba832b | 7 | public void start() throws IOException {
myServerSocket = new ServerSocket();
myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort));
myThread = new Thread(new Runnable() {
@Override
public void run() {
... |
f667f96d-0f87-4ead-804d-35c7ce12ee19 | 0 | public void addTreatmentMeta(TreatmentMeta treatmentMeta){
this.treatmentMeta.add(treatmentMeta);
} |
ef8f53fa-834c-4bbd-bb71-df929c859095 | 0 | public WorldCommand(TotalPermissions p) {
plugin = p;
} |
967aa708-2cb6-4a36-808e-342587ca84dc | 2 | public int valueofCadEquals(String cad) {
for (int i = 0; i < this.getLista().size() - 1; i++) {
if (cad.equals(this.getLista().get(i).getMatch())) {
return this.getLista().get(i).getValor();
}
}
return 0; // si no coincide retorn ]a valor de otros
} |
c6768180-89ae-4cc6-94f8-97ebb6a5a501 | 5 | protected ActorMind initAI() {
final Fauna actor = this ;
return new ActorMind(actor) {
protected Behaviour createBehaviour() {
final Choice choice = new Choice(actor) ;
addChoices(choice) ;
return choice.weightedPick() ;
}
protected void updateAI(int numUpd... |
b459116b-aca5-4f44-bf66-dd695fb89ade | 1 | private static void populate(String s){
if(Cards.containsKey(s))
return;
else
CardsInfo.Cards.put(s, new Card(s));
} |
dca592b2-da48-4cdc-b959-16be6f456a50 | 9 | public void drawHill(Grid g) {
Random r = new Random();
int height;
int width;
int seed;
height = r.nextInt(20) + 1;
seed = r.nextInt(50) + 2;
HashMap<Point, GridSpace> grid = g.getGrid();
ArrayList<Integer> a = new ArrayList<Integer>();
for (int p = 0; p <= height; p = p + r.nextInt(3) + 1) {
a... |
841c3e03-4821-4e7b-aff3-595659b8f665 | 9 | @Override
public void mouseClicked(MouseEvent e) {
// Check if ok to send card.
if (chooseCard) {
boolean lastCard = nbrOfPlayedCards == nbrOfPlayers;
if (lastCard || card.getSuit() == firstCardsSuit) {
removeCardFromHand();
} else {
boolean hasTrumf = false;
boolean hasSuit = false;
... |
60ee5f1e-5075-499a-b03e-b78226a5c156 | 1 | public Map getConfiguration() {
Map config = (HashMap) servletContext.getAttribute(Constants.CONFIG);
// so unit tests don't puke when nothing's been set
if (config == null) {
return new HashMap();
}
return config;
} |
db01bb5d-8353-474d-a5fa-9fec1d0adc05 | 2 | public float setBand(int band, float neweq)
{
float eq = 0.0f;
if ((band>=0) && (band<BANDS))
{
eq = settings[band];
settings[band] = limit(neweq);
}
return eq;
} |
caa9584c-af8f-4978-b4a6-fd2186f05f7e | 3 | public static Vector min(Vector a, Vector b){
return new Vector((a.getX() < b.getX() ? a.getX() : b.getX()), (a.getY() < b.getY() ? a.getY() : b.getY()), (a.getZ() < b.getZ() ? a.getZ() : b.getZ()));
} |
07d9682f-8904-40c2-b986-ba3ccf2b69e1 | 9 | private void writeValue(Object value) throws JSONException {
if (value instanceof Number) {
String string = JSONObject.numberToString((Number) value);
int integer = this.valuekeep.find(string);
if (integer != none) {
write(2, 2);
write(integer,... |
8fb0905f-cb2a-4bd1-acf0-b30bba5000c2 | 8 | public void waddleForImprovement()
{
if (queueTiles.size() == 0)
{
City nearestCity = location.grid.nearestCivCity(owner, location.row, location.col);
Tile t = location.grid.bestToImprove(nearestCity);
if (t != null)
waddleTo(t.row, t.col);
else
waddleInTerritory();
}
if (queueTiles.size() ... |
f80b4930-b7f4-4522-8cd7-472d5fc17501 | 7 | public static String[] getArgs(String arg) throws AccessException{
int index = 0;
String args[] = new String[2];
if(!arg.isEmpty() && arg.charAt(0) == ' '){
while(index < arg.length() && arg.charAt(index) == ' ') index++;
}
int split = arg.indexOf(' ',index);
if(split == -1) split = arg.length();
a... |
ff04088a-4aa1-4b78-97f1-8f8ad39d0eb9 | 7 | public static Class<?> getCallingClass(Class<?>... ignore) {
List<Class<?>> list = Arrays.asList(ignore);
StackTraceElement[] stes = new Throwable().getStackTrace();
for (int i = 1; i < stes.length; i++) {
try {
Class<?> cls = Class.forName(stes[i].getClassName());
if (!list.contains(cls)) return cls;
... |
52327756-a54c-4398-8bf2-195ed67195b7 | 6 | public void updateUser(User user, int port){
if(port == LOGIN_PORT || port == CASH_PORT){
try {
String serverAddress = (port == LOGIN_PORT ? SERVER_ADDRESS_LOGIN : SERVER_ADDRESS_CASH);
Socket socket = new Socket(serverAddress, port);
socket.setSoTimeout(TIMEOUT);
OutputStream outputStrea... |
bb48d60c-1cb1-4afc-8429-57a4bfa0401f | 5 | private void fixNegativeRed(Node negRed){
Node n1, n2, n3, n4, t1, t2, t3, child;
Node parent = negRed.parent;
if (parent.left == negRed){
n1 = negRed.left;
n2 = negRed;
n3 = negRed.right;
n4 = parent;
t1 = n3.left;
t2 = n3.right;
t3 =... |
ecab8cd3-f203-4482-8f72-dcec73422f4f | 0 | public int GetMaximumPassenger()
{
return maximumPassenger;
} |
a78c4508-668d-4f20-bcdb-0d5a9386f0f3 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
T2Impl<?, ?> other = (T2Impl<?, ?>) obj;
return Tuples.equals(_first, other._first)
&& Tuples.equals(_second, other._... |
f6ed49f0-991d-4fe9-ad22-239ace6b9dbc | 9 | protected void drawRadarPoly(Graphics2D g2,
Rectangle2D plotArea,
Point2D centre,
PlotRenderingInfo info,
int series, int catCount,
double headH, double he... |
679737e2-0cb7-4469-a48f-67be9334ae64 | 1 | public void downsample() {
//read the image
Mat image = Highgui.imread(path);
//mat out
Mat out = new Mat();
if(image.empty()) {
System.out.println("Image not found !!");
return;
}
//Show the Image before down sampling
ImageUtils.displayImage(ImageUtils.toBufferedImage(image), "Before Downsa... |
8997d73c-d3e4-436b-8a56-09d27a7ba2e7 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
740af90c-ae76-4fe4-aa1e-5843d34f5ec4 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Manager other = (Manager) obj;
if (code == null) {
if (other.code != null)
return false;
} else if (!code.equals(other.code))
return ... |
1ed2ab25-9064-48c8-abee-0b9bc83ede61 | 7 | public static void correctRuleIndices(Node<?> node, int n) {
if (n == 0)
return;
for (;;) {
if (node instanceof CallNode) {
((CallNode) node).ruleIndex += n;
} else if (node instanceof RuleNode) {
((RuleNode) node).index += n;
... |
112817ac-3370-45d8-9bc9-7f0a39b7ca7d | 5 | public void cancel()
{
int counter = 0;
int prevSize = 0;
while (getNotifyQueue().size() != 0)
{
if (prevSize != getNotifyQueue().size())
{
prevSize = getNotifyQueue().size();
counter = 0;
}
else if ((prevSize == getNotifyQueue().size()) && (counter == 25)) break;
try
{
Thread.sle... |
67b4a9a2-d845-468f-93a3-c5c1ee6411f5 | 3 | public static boolean position(String position){
position=position.toLowerCase();
if(!position.equals("tech")||!position.equals("manager")||!position.equals("pharmacist")){
return false;}
else return true;
} |
42dee837-9703-43fc-8860-276d39805eae | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + ((local == null) ? 0 : local.hashCode());
return result;
} |
bb8977b2-f8f2-45ce-bb9c-7c6feb37160b | 0 | public void persist() {
System.out.println(typeEntity.getName());
roomEntity.setType(typeEntity);
em.persist(roomEntity);
typeEntity.setRooms(rooms);
em.persist(typeEntity);
} |
4316eedd-de1b-49b2-a1a6-0af8573e4358 | 7 | @Override
public void configure(ResourceInfo resourceInfo, FeatureContext context) {
Collection<String> requiredPermissions = new ArrayList<>();
Class<?> resourceClass = resourceInfo.getResourceClass();
Method method = resourceInfo.getResourceMethod();
if(resourceClass.isAnnotationPresent(RequiresPer... |
e8368e04-476e-4563-98e9-b7a4e2791978 | 3 | public HashMap getTableValue(int table, int row, int field) throws Exception
{
HashMap<String, Integer> result = new HashMap<String, Integer>();
byte[] bytes = java.nio.ByteBuffer.allocate(4).putInt(row).array();
char[] params = new char[]{(char)table, (char)bytes[2], (char)bytes[3], (char)f... |
8b1a306e-4be7-4d07-b800-b23ff71dd44e | 6 | private Tree elementPro(){
Symbol identifier = null;
Tree parameterList = null,
compoundStatement = null;
if(accept(Symbol.Id.KEYWORD, "function")!=null){
if((identifier = accept(Symbol.Id.IDENTIFIER_NAME))!=null){
if(accept(Symbol.Id.PUNCTUATORS, "\\(")!=null){
parameterList = parameterListPro();... |
53d574aa-3f36-47c7-9698-643423c8297a | 3 | @Override
public void addEntry(Entry entry) throws IOException {
if (exampleWord == null) {
exampleWord = entry.getWord();
}
if (r.nextInt(100) == 1) {
exampleWord = entry.getWord();
}
wordBuilder.append("'" + escape(entry.getWord()) + "',");
definitionBuilder.append("'" + escape(entry.getDefiniti... |
6ebd88b6-e155-46a4-b640-13566466e17e | 3 | @Test
public void testStronglyConnectedComponentsMin() {
DirectedGraph<String> graphM = new DirectedGraph<String>();
DirectedGraph<String> reversedGraphM = new DirectedGraph<String>();
List<String> input = new ArrayList<String>();
input.add("A B");
input.add("B D");
... |
eb598129-9b0f-4f67-bef4-d2634b4c60ae | 8 | @Override
public void unInvoke()
{
if(!(affected instanceof MOB))
return;
// undo the affects of this spell
final MOB mob=(MOB)affected;
super.unInvoke();
if((canBeUninvoked()&&(!mob.amDead())))
{
mob.tell(L("Your piety curse has been lifted"));
if(mob.isMonster() && (!mob.amDead()))
{
CML... |
4283eacb-b2aa-4bf6-91c8-f8a6c564fd99 | 8 | @Override
public void runCommand(CommandSender sender, String label, String[] args) {
tntControlHelper = tntControlConfig.getTNTControlHelper();
Player player = null;
String pname = "(Console)";
if ((sender instanceof Player)) {
player = (Player) sender;
pname... |
4c166295-44b2-43b8-9cb9-8059b6d5f182 | 6 | public String toString() {
return "Extension(use): " + (useExtension ? "true" : "false") + "\n" +
"Hash(use/name): " + (useHash ? "true" : "false") + "/" + nameHash + "\n" +
"Name(use/percentage/algo-ordinal): " + (useName ? "true" : "false") +
"/" + String.valueOf(percentageMatchName) + "/" + ... |
ea812957-5b40-47c9-bf6a-c1828bf4449d | 2 | private void fixAfterAdd(Node newNode){
if (newNode.parent == null){newNode.color = black;}
else{
newNode.color = red;
if (newNode.parent.color == red) { fixDoubleRed(newNode); }
}
} |
ffcf4c1a-2898-4653-9c26-58851f627d0c | 7 | public void tick() {
if (shouldTake != null) {
if (shouldTake.activeItem instanceof PowerGloveItem) {
remove();
shouldTake.inventory.add(0, shouldTake.activeItem);
shouldTake.activeItem = new FurnitureItem(this);
}
shouldTake = null;
}
if (pushDir == 0) move(0, +1);
if (pushDir == 1) move(0... |
e55ef05b-b6ce-4e39-8d25-a7222fa48d48 | 5 | public void updateObjDetails(JObjective obj, String name){
//if there is a change in objective name
if(!obj.getName().equals(name))
for (int i=0; i<alts.size(); i++){
HashMap temp = (HashMap)alts.get(i);
temp.put(obj.getName(), temp.get(name));
temp.remove(name);
}
//changes in objective... |
f58e8337-57ec-45cc-8c41-ce0eec4eec16 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idapplicant != null ? idapplicant.hashCode() : 0);
return hash;
} |
c7241a27-ab7d-491b-87f9-ce442bc34066 | 9 | private void notifySelectionListeners(Event event) {
if (!(event.widget instanceof Control)) {
return;
}
if (getDecorationRectangle((Control) event.widget).contains(event.x,
event.y)) {
SelectionEvent clientEvent = new SelectionEvent(event);
clientEvent.data = this;
if (getImage() != null) {
c... |
8582e6ae-ec49-43f5-b5f4-48e6bc8e77e7 | 3 | public Object copyColorData() {
// Note: This is a fudge. The data about defaultColor,
// groutingColor, and alwaysDrawGrouting is added to the
// last row of the grid. If alwaysDrawGrouting is true,
// this is recorded by adding an extra empty space to
// that row.
Color[][] copy... |
4a70416b-b0bf-4a3a-b24d-9e66d449b2a6 | 4 | public void optionSelect()
{
System.out.println("WELCOME TO WORD LADDER MADNESS ");
System.out.println();
System.out.println("Enter option 1 for Discovery mode: ");
System.out.println("Enter option 2 for Generation mode: ");
System.out.println("Enter option 3 for information on modes: ");
System.out.printl... |
2d748311-9739-45d8-971c-eafc4ca432ec | 5 | private boolean recombinationInitialization(HaploStruct hs, double recombPos)
throws Exception {
if (hs==null || !this.getChrom().equals(hs.chrom)) {
throw new Exception("recombine: parameter hs invalid");
}
if (recombPos<chrom.getHeadPos() || recombPos>chrom.getTailPos()... |
5c241327-fed1-40dd-bb12-27a6c16996c8 | 7 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender.hasPermission("NE.freeze") || sender.isOp() || sender instanceof ConsoleCommandSender || sender instanceof BlockCommandSender) {
if(command.getName().equalsIgnoreCase("Freeze")) {
if(args.length ... |
fde7388d-fd4e-4d1b-8acd-93275aad0c51 | 9 | static public ParseException generateParseException() {
jj_expentries.removeAllElements();
boolean[] la1tokens = new boolean[9];
for (int i = 0; i < 9; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 2; i++) ... |
146c0b4c-ac45-4a99-b1b5-844cdf5713b6 | 9 | public SNMPSequence processGetNextRequest(SNMPPDU requestPDU, String communityName) throws SNMPGetException
{
SNMPSequence varBindList = requestPDU.getVarBindList();
SNMPSequence responseList = new SNMPSequence();
byte pduType = requestPDU.getPDUType();
for (int i = 0; i < varBindLi... |
dfa9bafe-0e40-4f45-bafa-21d4018b347c | 4 | public String authentic(String userID, String pwd) {
Connection connection = DBconnection.getInstance();
Statement stmt;
try {
stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("");
while (rs.next()) {
String userID1 = rs.getString("userID");
String pwd1 = rs.getString("pwd")... |
c798a333-4d00-4157-883a-d5013b2e22e5 | 6 | private void llenarLista(JTable tabla, int numColumnas, LinkedList listaDeDatos) {
Object[] renglonDeDatos = new Object[numColumnas];
DefaultTableModel modeloLista = (DefaultTableModel) tabla.getModel();
limpiarLista(tabla);
boolean seAgregaranProveedores = false;
for (Objec... |
320182f5-7f62-4c4e-92ea-89a7fac9c8e1 | 9 | static double prim(double[][] mAdy){
int n,p[]=new int[n=mAdy.length],v=0;double d[]=new double[n];boolean[] vis=new boolean[n];
PriorityQueue<double[]> cola=new PriorityQueue<double[]>(n,new Comparator<double[]>() {
public int compare(double[] o1,double[] o2){
return o1[1]!=o2[1]?(o1[1]<o2[1]?-1:1):(int)o1[... |
649548a7-fb7b-4907-930f-532c75cd50e1 | 4 | public void run() throws Exception {
System.out.println("Running " + algorithm.FLAG + " algorithm:");
for (Dataset dataset : datasets_to_run) {
System.out.println("\nRunning " + dataset.NAME + " dataset.");
System.out.println("Training...");
train(dataset);
for (Filetype ... |
656922ff-c70d-4d0d-935a-ceef2ef78063 | 8 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = new File(plugin.getDataFolder().getParent(), plugin.getServer().getU... |
33344cf6-45f1-42aa-8b1f-ada381a526c7 | 3 | public void tallenna() {
ObjectOutputStream output = null;
try
{
output = new ObjectOutputStream(new FileOutputStream(new File(henkilonTiedot)));
output.writeObject(henkilot);
}
catch (IOException ex)
{
System.out.prin... |
4cd40df8-1104-45e5-8e88-5a49e61d0e29 | 7 | public void turnOnePlayer() {
GameEngine gEngine = new GameEngine();
if (activeP >= GameEngine.playerCount) {
int[] results = new int[GameEngine.playerCount];
int winSum = 0;
for (int i = 0; i < winners.size(); i++) {
winSum = winSum + GameEngine.Playe... |
3eb05ca8-562d-478e-86ce-05167b1df882 | 2 | @Override
public List<Tourist> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException {
int pageSize = 50;
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(WHERE);
String queryStr = new QueryMapper() {
@Ove... |
e341294d-31e1-484d-a315-b3edad36c18a | 3 | private Element parseLoop() throws ParserException, XMLStreamException {
String type = getAttribute("type", "test-first");
switch (type) {
case "test-first":
return parseTestLoop(true);
case "test-last":
return parseTestLoop(false);
case "infinite":
return parseInfiniteLoop();
default:
t... |
07056265-add0-4411-b4dd-8e3d5a4564c9 | 4 | public static boolean libraryCompatible(Class<?> libraryClass) {
if (libraryClass == null) {
errorMessage("Parameter 'libraryClass' null in method"
+ "'librayCompatible'");
return false;
}
if (!Library.class.isAssignableFrom(libraryClass)) {
errorMessage("The specified class does not extend class "
... |
07e45232-63ea-49c9-95e4-7dfaa47c5285 | 4 | public void refreshPanel() {
vakLijst.clear();
if (Sessie.getIngelogdeGebruiker().heeftPermissie(
PermissieHelper.permissies.get("BEHEERALLEKLASSEN"))) {
List<Vak> vakken = Dao.getInstance().getVakken();
for (Vak vak : vakken) {
vakLijst.addElement(vak);
}
} else if (Sessie.getIngelogdeGebruiker(... |
3adbb688-39dc-49d8-a963-b187486b3139 | 2 | public Map<Object, Object> toMap() {
final Map<Object, Object> map = new HashMap<Object, Object>(this.size());
try {
for (E elt : this) {
CycList<Object> eltAsList = (CycList<Object>)elt;
map.put(eltAsList.first(), eltAsList.rest());
}
} catch (Exception e) {
throw new Unsu... |
4a9f3ea6-ac69-4dfa-925d-7de5bd5fd97d | 1 | public void order() {
if (b > a) {
Integer temp = a;
a = b;
b = temp;
}
} |
dfca90c2-3231-44b2-a1ac-18c0187ce976 | 9 | @Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
if(obj == null) {
return false;
}
if(getClass() != obj.getClass()) {
return false;
}
CamLocalUser other = (CamLocalUser) obj;
if(this.nam... |
cf6e2d83-eb74-4f31-9f15-78eadf38bd80 | 8 | public void updatePosition() {
if (position.mX < destination.mX) position.mX++;
else if (position.mX > destination.mX) position.mX--;
if (position.mY < destination.mY) position.mY++;
else if (position.mY > destination.mY) position.mY--;
if (position.mX == destination.mX && po... |
99fc155f-0b0e-484f-a804-f292958068d3 | 0 | int g(final int i) {
return i + 1;
} |
58aa8441-0a28-4788-9cb2-425f2ad38845 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person person = (Person) o;
if (age != person.age) return false;
if (firstName != null ? !firstName.equals(person.firstName) : person.firstName... |
8e36baa5-ece1-4fbc-8697-e6432d259ffa | 1 | @Override
public void action() {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "action()");
// dfd = new DFAgentDescription();
// description = new ServiceDescription();
// description.setName("Wumpus' Wumpus-Game");
// description.setType("wumpus-game");
// dfd.addServices(description);
// ... |
4ceeb8af-2bb3-4932-a32b-bafad68fbd9d | 0 | public void request()
{
System.out.println("From Real Subject !");
} |
a412986e-52ca-4f7e-84c6-d7ccca2ed05c | 0 | public void setFunUnidad(String funUnidad) {
this.funUnidad = funUnidad;
} |
7e9e8535-84eb-4c68-8e5a-f1d0df35255b | 0 | public String getOrderCount() {
return orderCount;
} |
1cc36c5b-0f34-41ed-ba56-dc9d181a89a4 | 7 | public void testAddDocument() throws Exception {
Document testDoc = new Document();
DocHelper.setupDoc(testDoc);
Analyzer analyzer = new WhitespaceAnalyzer();
IndexWriter writer = new IndexWriter(dir, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
writer.addDocument(testDoc);
writer.commit... |
5108c001-0f28-49c2-b6d8-5684539ab0c4 | 8 | private Collection<Boolean> shift(Collection<Boolean> data, int difference) {
if (difference > 0 && difference < data.size()) {
/* Ištrinama pradžia */
int size = data.size() - difference;
ArrayList<Boolean> result = new ArrayList<Boolean>(size);
int i = 0;
... |
9b92c208-52db-47c9-b29b-de0310238a04 | 4 | public Host replace(String failedPath, Host... failedHosts) {
for (Host failedHost : failedHosts) {
if (routingTable_.contains(failedHost)) {
routingTable_.removeReference(failedHost);
}
}
replace_.execute(routingTable_, new PGridPath(failedPath));
... |
f1d9398c-3641-46aa-9e99-9600a78de4cd | 9 | protected boolean[] datasetIntegrity(
boolean nominalPredictor,
boolean numericPredictor,
boolean stringPredictor,
boolean datePredictor,
boolean relationalPredictor,
boolean multiInstance,
int classType,
boolean predictorMissing,
boolean classMissing) {
... |
93dcf223-5a71-4da4-8e55-8d4fa1dada2e | 4 | private void createHiveGroups(int groupDimension, int groupCount, int groupSize, int x, int y, int dimensionX,
int dimensionY, int pixelX, int pixelY, int groupFixed, int fullLineSwitch) {
for (int yg = 0; yg < groupDimension; yg++) {
for (int xg = 0; xg < groupDimension; xg++) {
if (groupCount < groupSize)... |
1b1af11a-acc4-46f7-b4e6-2aeb1adf6e74 | 1 | public void addOperand(final LocalExpr operand) {
for (int i = 0; i < operands.size(); i++) {
final LocalExpr expr = (LocalExpr) operands.get(i);
Assert.isTrue(expr.def() != operand.def());
}
operands.add(operand);
operand.setParent(this);
} |
18269b2e-89d6-4919-ab5f-6cd6d995bb0d | 7 | private MoveValue negaMax(Board b, int remainingDepth, double alpha, double beta)
throws ExitThreadException {
if ( ((IterativeDeepeningThread)Thread.currentThread()).isStopped() ) {
throw new ExitThreadException();
}
if (remainingDepth <= 0 || b.isGameOver()) { //At bottom of tree, return node with its ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.