method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
23c6f800-31cb-464a-b692-474c0a237328 | 8 | private static String[][] filter(String[][] input, String filter) {
if (filter.equals("") || input.length==0) return input;
else {
ArrayList<Integer> selected = new ArrayList<Integer>();
for (int j = 0; j<input.length; j++) {
for (int i = 0; i < input[0].length; ... |
f4a55104-ad5e-4a77-b6d7-8182f4fc68d2 | 7 | private String useAbondVariables(String s, int frame) {
int n = model.getABondCount();
if (n <= 0)
return s;
int lb = s.indexOf("%abond[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
ABond bond;
while (lb != -1 && rb != -1) {
v = s.substring(lb + 7, rb);
double x = parseMath... |
2d0d7553-47f2-4e81-add4-65b728642829 | 1 | public void setTankVolume(int tankVolume) throws CarriageException {
if (tankVolume < 0) {
throw new CarriageException("Tank volume is under zero");
}
this.tankVolume = tankVolume;
} |
19409242-eb1d-4502-bfea-4a8d65ec7900 | 0 | @Override
public int attack(double agility, double luck) {
System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn...");
return 0;
} |
41089538-5354-467e-bf85-fcbec955e0da | 4 | @Override
public void init( GLAutoDrawable drawable ) {
// Use debug pipeline
boolean glDebug=true;
boolean glTrace=false;
GL gl = drawable.getGL();
if(glDebug) {
try {
// Debug ..
gl = gl.getContext().setGL( GLPipelineFactory.create(... |
2c8acfbf-0b62-4069-bc1e-e5f9ce97d57d | 3 | private static Object read(String s){
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(new FileReader("saves/"+s+".json"));
return obj;
} catch (FileNotFoundException e) {
System.out.println("[SAVING] Save file '" + s + "' not found.");
} catch (IOException e) {
e.printStackTr... |
a392dc5a-18cb-409f-979a-18b30ddbc6ac | 2 | public void updateList(String[] users) {
clearList();
for(String user : users) {
if(!user.equals(mInterface.getUser()))
mListModel.addElement(user);
}
} |
fc03c9cc-7e7e-464e-98fa-8899786b0bd9 | 0 | public void setIsSensitive(boolean isSensitive) {
this.isSensitive = isSensitive;
} |
3b7d8460-d682-466a-b394-6ab75f86c7c9 | 8 | public void execute() {
this.validateConnectionParams();
// validate input folder names
if(this.srcFolder == null){
throw new BuildException("Missing srcFolder param");
}
if(this.destFolder == null){
throw new BuildException("Missing destFolder param");
}
if(this.outFolder ... |
11c78391-6ffd-4b83-843b-88eff1dbbb54 | 2 | private void switchState(State newState) {
if (this.currentState != null) {
this.currentState.exit();
}
this.currentState = newState;
if (this.currentState != null) {
this.currentState.enter();
}
} |
2825a3fe-3706-4111-881a-a1c67ff01e99 | 5 | @Override
public void runCommand(CommandSender sender, List<String> args) {
Player receiver = null;
String title = null;
if (args.size() == 2) {
receiver = Bukkit.getPlayer(args.get(0));
title = args.get(1);
} else if (sender instanceof Player && args.size() !... |
d9537654-fd16-4fb5-8bef-9d9b297088a0 | 1 | public Scanner(Reader reader) {
this.lineNumber = 1;
this.charPosition = -1;
this.nextChar = 0;
this.reader = reader;
try {
read();
} catch (IOException e) {
e.printStackTrace();
}
} |
c096b5bf-c7f2-40c9-ab0b-0664c0de4bf8 | 8 | protected Set<Integer> getQualifiedTypes(MOB ableM)
{
final Set<Integer> set=new TreeSet<Integer>();
final boolean checkUnMet=ableM.charStats().getCurrentClass().showThinQualifyList();
for(final Enumeration<Ability> a=CMClass.abilities();a.hasMoreElements();)
{
final Ability A=a.nextElement();
final int ... |
fb047aee-06d7-4107-872b-c49de6ae1e09 | 8 | public void paint(int x, int y, int w, int h, Graphics2D g,
Component u, String iconType) {
FlamencoIconAdapter fia = null;
if (iconType.equals("add-topic")) {
fia = new AddTopic();
} else if (iconType.equals("remove-topic")) {
fia = new RemoveTopic();
} else if (iconType.equals("change-topic"))... |
b733a36a-cd21-4051-8dae-c6ed39e96ed1 | 1 | public boolean dropTable(String tableName) {
if (!tableHashMap.containsKey(tableName)) {
return false;
}
tableHashMap.remove(tableName);
return true;
} |
2d3a02ec-379a-45ac-8ef9-5070c6e6e13e | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
bf361283-eea1-4d62-b07f-e59352374f3c | 8 | private void setFieldSequenceInTradeFile(String header) {
String token;
String tradeId = "Trade_id";
String sellerAcct = "Seller_acct";
String buyerAcct = "Buyer_acct";
String amount = "Amount";
String tradeDate = "Trade_date";
String settledDate = "Settled_date";... |
85b89f88-ca5b-4b92-b001-2e3f18915540 | 5 | @Override
public void paintComponent (Graphics g) {
if (champion == null) {
if (isSelected) {
if (isEnemy) {
g.drawImage (EPICKING_BG, 0, 0, null);
g.drawImage (EPICKING, 0, 0, null);
} else {
g.drawImage (PICKING_BG, 0, 0, null);
g.drawImage (PICKING, 0, 0, null);
}
} else {
... |
14ce63ef-7075-4d4e-b488-d6186d98efb3 | 5 | static public File getFileHandler(String file)
{
try {
File aFile = new File(file);
if (aFile == null || !aFile.exists()) {
boolean success = aFile.createNewFile();
if (success)
aFile = new File(file);
else
return null;
}
if (!aFile.canWrite()) {
... |
3b065a70-326c-4e97-93a1-051695ad0bb4 | 6 | public Map(int mapSize) {
int fullMapSize = mapSize + 2;
grid = new Room[fullMapSize][fullMapSize];
for (int i = 0; i < fullMapSize; i++) {
for (int j = 0; j < fullMapSize; j++) {
if (i == 0 || i == fullMapSize - 1 || j == 0
|| j == fullMapSiz... |
481cfc3d-0546-4efc-8917-308e06af649c | 0 | public String getQuestName() {
return QuestName;
} |
d9c6e621-1554-4a05-b878-c8c1bec0a2cd | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ObjectEntry other = (ObjectEntry) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
... |
7823cb8c-4fc0-44c4-b0f0-df1d42b5c25f | 0 | public int getWidth() {
return width;
} |
0b904ceb-50a6-4a87-98fc-a1f8777e3ad0 | 9 | private void optimizeMondayTimeTableForIIIAndIVGymnasium() {
// mondayTimeTable = new LinkedHashMap<>();
// tuesdayTimeTable = new LinkedHashMap<>();
// wednesdayTimeTable = new LinkedHashMap<>();
// thursdayTimeTable = new LinkedHashMap<>();
// fridayTimeTable = new LinkedHashMap<>()... |
2b967eaa-50aa-4dec-b6b5-9b8fcb962bec | 0 | private NotInterestedMessage(ByteBuffer buffer) {
super(Type.NOT_INTERESTED, buffer);
} |
117a7d3c-4004-4180-beb0-0722b44a6b7d | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if(cmd.getName().equalsIgnoreCase("Nick")) {
if(sender instanceof Player) {
Player p = (Player) sender;
PlayerUtil pu = new PlayerUtil(p);
if(pu.hasPermission("Nostalgia.Command.nick", PermissionTyp... |
b1e1286c-4b0b-472f-8121-a20bf5e620b3 | 6 | public HashMap<String, Integer> getTopPublishers() throws Exception{
Connection connect = null;
Statement statement = null;
ResultSet resultSet = null;
HashMap<String, Integer> publishersMap = new HashMap<String, Integer>();
try {
// First connect to the database
connect = DriverManager.getCo... |
e42b76bb-50fe-4d52-98cc-03d89a970239 | 6 | private void startGame(int x, int y, ArrayList<String> args) {
if (autoCrapTalk) {
sendMessage(util.CrapTalker.insult(util.CrapTalker.INSULTS_START));
}
try {
game = new Game(x, y, args);
player = game.getPlayer(args.indexOf(clientName));
if (mui instanceof ConnectionWindow) {
((ConnectionWindow) ... |
f9e0f86d-3d75-4bdd-bb26-6480725fc74f | 0 | public void setInternal(T internal) {
this.internal = internal;
} |
347b7f15-3733-4f19-9a84-6c840d5e6a3a | 7 | public final int gen_caps_and_promotions(Move[] moves, int startIndex) {
int moveIndex = gen_caps(moves, startIndex);
int from,to,pieceType;
if(toMove == WHITE_TO_MOVE) {
for (int i = 0; i < w_pawns.count; i++) {
from = w_pawns.pieces[i]; // Index the current pawn is on
to = from + 16; // Up
pieceT... |
0d79c097-2c62-41fe-a2f8-f2fe4291a6a3 | 3 | private long memoryAuditReport() {
long companionOverHeads = 0;
companionOverHeads += sourceVertexIds.length * 4;
companionOverHeads += distrLocks.length * 4;
long bufferMem = 0;
long maxMem = 0;
for(IntegerBuffer buf : buffers) {
long est = buf.memorySizeEs... |
0aaa5714-7106-4278-942c-1e33a47feefc | 3 | public int compare(IdFloat idFloat, IdFloat idFloat1) {
if (idFloat.vertexId == idFloat1.vertexId) return 0;
int comp = -Float.compare(idFloat.value, idFloat1.value); // Descending order
return (comp != 0 ? comp : (idFloat.vertexId < idFloat1.vertexId ? -1 : 1));
} |
8209e8ea-a31a-4173-96e2-c33091afddeb | 6 | public static void run(RobotController myRC)
{
rc = myRC;
RobotType t = rc.getType();
try
{
if (t == RobotType.SOLDIER)
{
// if(rc.senseHQLocation().distanceSquaredTo(rc.senseEnemyHQLocation()) < Constants.theMagicNumber) {
// team235.secretRushStratGG.Soldier.soldierCode(rc);
// }
// e... |
1d03a1e9-a097-46da-9c31-aba10470dea0 | 3 | public static ChessPiece from(PieceColor color, PieceType type) {
for (ChessPiece chessPiece : values()) {
if (chessPiece.type == type && chessPiece.color == color) {
return chessPiece;
}
}
throw new IllegalArgumentException(String.format("There is no ches... |
a033272c-05fa-463d-bc3c-7f0270abee30 | 4 | public static String defineGroup(HashMap<String,List<String>> pDictionary) {
// groupref
String isPartOf = "http://purl.org/dc/terms/isPartOf";
if (pDictionary.containsKey(isPartOf)) {
List<String> check_groupref = pDictionary.get(isPartOf);
if (check_groupref.size() > 1) {
for (int i=0; i < check_gr... |
471655ea-d3e8-4981-908b-a0723d43ce62 | 4 | public Direction getOpposingDirection() {
switch(this) {
case NORTH: return SOUTH;
case WEST: return EAST;
case SOUTH: return NORTH;
case EAST: return WEST;
}
return null;
} |
27b14b6e-b3d1-4f91-866c-e48a743dbb1e | 8 | public static void main(String[] args) throws IOException {
//String fileName = "/Users/Dany/Documents/FALL-2013-COURSES/Imp_Data_structures/workspace/MaximumClique/src/com/maximumclique/input/C125.9.clq.txt";
//readDIMACS(fileName);
readDIMACS(args[1]);
MC mc = null;
if (args[0].equals("MC")) mc =... |
87334800-8dcd-4fb0-9c9c-4d8e602ea210 | 7 | private static void execSQL(String query) throws SPARULException {
Connection conn = null;
Statement stmt = null;
ResultSet result = null;
try {
conn = JDBCPoolConnection.getPoolConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(q... |
65dae1b9-f6c2-48a8-ba29-60273cf66ef1 | 7 | @SuppressWarnings("deprecation")
public void removePlayer(Player player, String pourJoueur, String pourJoueursArene){
if(ArenaManager.getArenaManager().isInArena(player)){
PlayerArena pa = PlayerArena.getPlayerArenaByPlayer(player);
pa.clear(this.objective);
pa.getPlayer().updateInventory();
pa.restore(... |
4abf6db5-11cd-43b1-a237-6315a911690e | 5 | @Override
public void mouseMoved(MouseEvent e) {
Component source = e.getComponent();
Point location = e.getPoint();
direction = 0;
if (location.x < dragInsets.left) {
direction += WEST;
}
if (location.x > source.getWidth() - dragInsets.right - 1) {
... |
b0a7a2db-1827-43c9-b174-e9a5b09f1ab0 | 7 | @EventHandler
public void GhastWaterBreathing(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Ghast.Wa... |
8b76c85a-329e-45e1-a4e4-70ed18031758 | 8 | @EventHandler( priority = EventPriority.HIGHEST )
public void onPlayerToggleSprintEvent( PlayerToggleSprintEvent event )
{
Player player = event.getPlayer();
if ( event.isSprinting() )
{
String className = getPlayerClass( player );
int speed = getConfig().getInt( "classes." + className + ".speed", -1 )... |
f6778ea2-5cd6-4971-ac38-5751f6f4d67f | 5 | public String removeBlocks(String completeCode) {
int depth = 0;
String blockContents = "";
char[] charList = completeCode.toCharArray();
completeCode = "";
for(char c : charList) {
if(c == '{') {
depth++;
} else if(c == '}') {
... |
c08c4796-d24e-4000-9f51-aefcb54f3249 | 3 | public static Block getAttachedChest(Block block) {
if (block.getType() == Material.CHEST)
for (BlockFace face : new BlockFace[]{BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST}) {
Block b = block.getRelative(face);
if (b.getType() == Material.CHEST) ... |
ca2649c6-b865-4c8f-9eaf-4e3ac0b4ad00 | 4 | final static String intNormal(double number)
{
String res = normal(number);
StringBuffer buf = new StringBuffer(res);
int pos = res.indexOf('.');
if (pos > -1)
{
pos = buf.length() - 1;
char ch;
boolean con;
do
{
ch = buf.charAt(pos);
if ((ch == '0') || (ch == '.'))
{
buf.deleteCharAt(po... |
c35a9553-7868-4612-88f9-c310be124a05 | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.GOLD + "[" + ChatColor.AQUA + "WGTP" + ChatColor.GOLD + "] " + ChatColor.RED + "Only Players can use this command!");
... |
4107a923-66e5-41ff-8a77-2a4d6903df14 | 5 | public static PortRange getInstance(String value) {
int lowerBound = UNBOUND;
int upperBound = UNBOUND;
// first off, make sure there's actually content here
if ((value.length() == 0) || (value.equals("-")))
return new PortRange();
// there's content, so figure wher... |
af4e4123-2aa3-491a-b0ab-0bfe155677db | 4 | @Override
public ArrayList<Movie> getAllMovies(ResultSet rsetMovie)
throws SQLException {
ArrayList<Movie> movies = new ArrayList<Movie>();
try {
// for every album do...
while (rsetMovie.next()) {
ResultSet rsetGenre;
ResultSet rsetDirector;
ResultSet rsetRating;
ResultSet rsetReview;
... |
b4bbbb2e-a456-449b-8d23-38b7f189ec80 | 7 | public void CreateDefaults()
{
try
{
PrintStream fout = new PrintStream(new File("defaults.txt"));
String DefaultNameInput = nameTextFieldDefault.getText();
fout.println(DefaultNameInput);
String DefaultRankInput = (String) rankComboBoxDefault.getSelectedItem();
fout.println(DefaultR... |
c68233c6-424b-4a81-8d2f-e7558530e98f | 9 | private static String fixNumberedParagraphs(String document) {
boolean hasDot = contains(document, "<p[^>]*>7\\. ") && contains(document, "<p[^>]*>8\\. ") && contains(document, "<p[^>]*>9\\. ");
boolean hasDash = contains(document, "<p[^>]*>7 - ") && contains(document, "<p[^>]*>8 - ") && contains(docume... |
bf50f4d4-e1db-4f73-b4f7-dbcbce1baf24 | 7 | public void mostrarRespuesta(List<String> respuesta) {
if (respuesta == null)
mostrar("Respuesta nula, hubo un error en el procesamiento de la consulta");
else if (respuesta.get(0).equals("0"))
mostrar("No se ha obtenido ninguna tupla");
else if (respuesta.get(0).equals(QueryManager.ERROR)) {
System.out.... |
8100144d-1499-4b92-b2ac-e7d868aa9e5a | 6 | private boolean parseHandshake(JSONObject o) throws ProtocolException {
try {
if(!(o.get("message").equals("connect"))){
throw new ProtocolException("Expected 'connect' handshake, but got '"
+ o.get("message") + "' key");
}
if(!(o.getInt("revision") == 1)){
throw new ProtocolException("Wron... |
c67a7250-aedc-43cc-9108-ea0edd4bb602 | 1 | private AssociationList associationListPost(int aiNumOfRecs)
{
AssociationList laAssocList = genAssocData(aiNumOfRecs);
// Call the API to post the Association
AssociationResponseList laAssocResponseList = laClient
.postAssociations(laAssocList);
Assert.assertNotNull(laAssocResponseList);
System.out.pri... |
a75e7d2e-5156-4df3-bd21-a36f9de4de23 | 0 | public InternalDragAndDropListener() {} |
334a4dc0-a476-4a32-aca1-f351f631d60e | 9 | protected void onMessage(String channel, String sender, String login, String hostname,
String message)
{
//guaranteed to not be my message
DbCmds.seeOrErrorClose(sender);
if (go)
{
int p;
if ((p = message.toLowerCase().indexOf("whitespace")) != -1)
sendMessage(channel,"s/" + message.substring(p... |
49c33303-44f8-49d8-b6b5-9a8e91ffaf7e | 5 | public static double[] doLinearRegressionFromTo(int start,int end,double[][] args) //input int start, int end
{ //input double[1]=array of prices
double[] answer = new double[3];
int ... |
7bd2bfb4-072f-4ff4-bb21-bc57331b2aff | 0 | public void setJ(byte[] value) {
this.j = value;
} |
1ecfbbe1-8955-45c7-b909-d0159beca71a | 9 | private void getBucketNameErrors(ArrayList<String> errors)
{
/**
From http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Client.html#createBucket(java.lang.String, com.amazonaws.services.s3.model.Region)
Bucket names should not contain underscores
Bucket names should be bet... |
e05f3408-8669-4b37-9f35-48981ecc20ab | 2 | private int determineRowSwap(Double[][] mat, int row, int col)
{
for (int i = row + 1; i < mat.length; i++)
{
if (mat[i][col] != 0)
return i;
}
return -1;
} |
7e5a599d-a993-41b2-b4bf-8c412157dc32 | 2 | boolean isGeometric(int[] arr) {
int d = arr[1]/arr[0];
for (int i = 2; i < arr.length; i++) {
if (arr[i]/arr[i - 1] != d) {
return false;
}
}
return true;
} |
3edce6de-0599-4e5d-bfbc-0d4f40faa8d8 | 0 | public Participant createNewParticipant(String id, String name, InetAddress addr) {
String color = textColors.get(participants.size() % textColors.size());
return new Participant(id, name, addr, color);
} |
fac35c9f-d08b-4dfd-8676-a63236381402 | 6 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Message other = (Message) obj;
if (!Objects.equals(this.header, other.header)) {
return false... |
ea88cda7-7b4d-46b4-875f-5c8127759635 | 2 | public void loadGroups() {
groupListModel.clear();
List<ImgGroup> groups = imageBrowser.getGroups();
if (groups == null) {
return;
}
for (ImgGroup g : groups) {
groupListModel.addElement(g);
}
groupListModel.addElement(newGroupLabel);
} |
4652225d-20c1-4287-91b9-ba750a9360e8 | 9 | public static void main(String[] args) {
//other variables
String valueStr="";int n=0;
PrintWriter pw = null;FileWriter fichero = null;File in=null;Scanner s = new Scanner(System.in);
//CREATE A PRIORITY QUEUE
PriorityQueue pq = new PriorityQueue();
//Start program
System.out.println("number of i... |
063a4e3d-e5e8-414a-ae20-cd3270ae851a | 2 | public JSONObject append(String key, Object value) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key, new JSONArray().put(value));
} else if (object instanceof JSONArray) {
this.put(key, ((JSONArray) obje... |
18f70ca0-69fe-4f7d-b41a-4eea22ea5e83 | 1 | @Test
public void dotProductTest() {
for (int i = 0; i < TESTS; i++) {
double x1 = rand.nextInt();
double y1 = rand.nextInt();
double x2 = rand.nextInt();
double y2 = rand.nextInt();
double dot = x1 * x2 + y1 * y2;
assertEquals(dot, new Vector(x1, y1).dot(new Vector(x2, y2)), PRECISION);
}
} |
86f65762-2de1-4e39-a402-73d54856a2d5 | 6 | public Item getSelectedItem() {
if (!opened()) {
return nil();
}
if (indexSelectedItem > -1) {
Component component = ctx.widgets.component(WIDGET_MAIN, indexSelectedItem);
return component.valid() ? new Item(ctx, component) : nil();
}
for (Component component : ctx.widgets.widget(WIDGET_MAIN).compo... |
819a1a8b-a030-493d-8803-4b1a069694bf | 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... |
c19caf89-4860-4b70-a271-098be0804106 | 3 | public static void addLibrary(File file) throws IOException {
URL fileURL=file.toURI().toURL();
List<String> string = new ArrayList<String>();
JarFile jarFile=new JarFile(file);
Enumeration<JarEntry> entries=jarFile.entries();
while (entries.hasMoreElements()) {
JarE... |
866f5b47-a90d-433d-be62-12bbf8a446ad | 7 | public void testConstructor_int_int_int_int_int_int_int_Chronology() throws Throwable {
DateTime test = new DateTime(2002, 6, 9, 1, 0, 0, 0, GregorianChronology.getInstance()); // +01:00
assertEquals(GregorianChronology.getInstance(), test.getChronology());
assertEquals(TEST_TIME_NOW, test.getM... |
96ce1307-d9f2-4488-8900-a18e3f3f9c37 | 3 | public Object unify(Object o, int hash, Comparator comparator) {
// /#ifdef JDK12
cleanUp();
// /#endif
int slot = Math.abs(hash % buckets.length);
for (Bucket b = buckets[slot]; b != null; b = b.next) {
Object old = b.get();
if (old != null && comparator.compare(o, old) == 0)
return old;
}
put... |
5ff365d6-e81a-4325-9247-a4bfd307409d | 6 | public boolean canAttack(Unit defender) {
if (!isOffensiveUnit()
|| defender == null
|| defender.getTile() == null) return false;
Tile tile = defender.getTile();
return (isNaval())
? (tile.getSettlement() == null && defender.isNaval())
: (!defende... |
e11b6e8b-b2ec-4352-b2c5-6eddbb07a448 | 4 | private String readPassword(boolean askTwice) {
sysOut.println(bundle.getString("password_in_plaintext"));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
while (true) {
sysOut.print(bundle.getString("password") + ": ");
... |
69f3f1e9-3328-4292-acb9-e739a1c2d665 | 8 | void output(int code, OutputStream outs) throws IOException {
cur_accum &= masks[cur_bits];
if (cur_bits > 0)
cur_accum |= (code << cur_bits);
else
cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((byte) (cur_accum & 0x... |
f4697f64-3fcd-4805-9384-b91ba6225d09 | 3 | public String mapMethodName(String cls, String name, String descriptor) {
// Check the class itself first.
String key = cls + "/" + name + ";" + descriptor;
if (methods.containsKey(key)) {
return methods.get(key);
}
// Then all of its ancestors
for (String an... |
4ad7927f-9316-480c-87dc-d82e9e59fb31 | 2 | public Quaternion nlerp( Quaternion dest, float lerpFactor, boolean shortest )
{
Quaternion correctedDest = dest;
if ( shortest && this.dot( dest ) < 0 )
correctedDest = new Quaternion( -dest.getX(), -dest.getY(), -dest.getZ(), -dest.getW() );
return correctedDest.sub( this ).mul( lerpFactor ).add( this ).n... |
16b5867e-45f1-43f8-ae92-19ae6d1023f8 | 2 | public static String[] RemoveEmptyStrings(String[] strings)
{
ArrayList<String> result = new ArrayList<String>();
for (int i = 0; i < strings.length; i++)
if (!strings[i].equals(""))
result.add(strings[i]);
String[] resultArray = new String[result.size()];
result.toArray(resultArray);
return ... |
7d01dc88-1b34-498c-a870-ed57013516b4 | 9 | public Object remove(Object key)
{
Object result;
if (RESERVED_KEYS.containsKey(key)) {
if (key.equals(OgnlContext.THIS_CONTEXT_KEY)) {
result = getCurrentObject();
setCurrentObject(null);
} else {
if (key.equals(OgnlContext.RO... |
9970a4f6-b7c1-40be-909b-c3ad0ff1ee9e | 0 | public AppTest( String testName )
{
super( testName );
} |
c760caaa-6d55-4257-833f-cf386004b1bd | 1 | public boolean hasPlayer(Player p){
if(players.contains(p.getName())){
return true;
}else{
return false;
}
} |
44f42509-28a9-4ea0-af48-f88c0a39f825 | 8 | public boolean isDefined()
{
if(!isPlain()){
// Über Kindelemente iterieren
for(final Data data : this) {
if(!data.isDefined()) {
return false;
}
}
return true;
}
final AttributeType attributeType = getAttributeType();
// Alle Attribute, die einen "undefiniert Wert" zu Verfügung stell... |
868729f5-c6fa-4dda-8342-270e9c5f6189 | 6 | public FormatVersion formatVersion() {
// Already set?
if (formatVersion != null) return formatVersion;
// OK, guess format version
if (effectStrings == null) effectStrings = split(effectString);
int len = effectStrings.length;
// Error or Warning string is not added under normal situations
String lastF... |
84f087e3-b61b-456c-b183-3a51a830ab70 | 1 | public void clearBoard(){
int[] field = getGameField();
for (int i=0; i<9; i++){field[i] = 0;}
this.turn = 1;
return;
} |
b9a4a310-8349-40d9-8a81-5b245a66b9e5 | 1 | public String getExtensionFrequency() {
Map<String, Integer> map = analytic.getExtensionFrequency();
StringBuilder sb = new StringBuilder();
List<Entry<String, Integer>> entries = new ArrayList<Entry<String, Integer>>(map.entrySet());
Collections.sort(entries, new Comparator<Entry<String, Integer>>() {
... |
cf8ff115-098e-437e-9661-b1714686ab0a | 3 | public ObservableIssue getSelectedIssue() {
if (model != null && table != null) {
List<ObservableIssue> selectedIssues = table.getSelectionModel().getSelectedItems();
if (selectedIssues.size() == 1) {
final ObservableIssue selectedIssue = selectedIssues.get(0);
... |
027d7006-8efd-46db-94bf-d57a6e758c20 | 1 | public static void main(String [] args)
{
Employee e = new Employee();
e.name = "Reyan Ali";
e.address = "Phokka Kuan, Ambehta Peer";
e.SSN = 11122333;
e.number = 101;
try
{
FileOutputStream fileOut =
new FileOutputStream("C:/t... |
0f98b86c-41aa-488b-8455-effbfb90bb01 | 8 | public void testValidEdge4() {
try {
TreeNode tree = new TreeNode("tree", 3);
TreeNode subtree1 = new TreeNode("spare-subtree1");
TreeNode subtree2 = new TreeNode("spare-subtree2");
tree.setBranch(new TreeNode[]{ new TreeNode("subtree"), subtree1, subtree2});
... |
dc13ae78-3f89-4931-ab88-387c4f680671 | 6 | public void init(){
mobTextures[0] = Loader.getTexture(ResourceLoader.getResource("res/char/Sci4.png"), 0);
mobTextures[1] = Loader.getTexture(ResourceLoader.getResource("res/char/Sci3.png"), 0);
mobTextures[2] = Loader.getTexture(ResourceLoader.getResource("res/char/Sci2.png"), 0);
mobTextures[3] = Loader.getT... |
4d7e1393-6fbf-403b-8615-52f11bbecaed | 5 | protected boolean findEntry() {
keywordOffsetArray = new Vector<Integer>();
boolean matchCase = Search.getMatchCase();
searchKeyword = Search.getSearchString();
styledText.redraw();
String str;
Pattern p;
... |
429e9d80-570e-4130-976b-4492547a3663 | 5 | private void button5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button5MouseClicked
if(numberofpins < 4)
{
if(numberofpins == 0)
{
Login_form.setString1("4");
}
if(numberofpins == 1)
{
Login_form.setString2("4");
}
if(numberofpins == 2)
{
Login_... |
692d63f8-00cc-4a66-8fff-cdde393c713f | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just threw a brandish spear!");
return random.nextInt((int) agility) * 2;
}
return 0;
} |
49e3b46e-1649-4dbc-9eed-d30f1d9001a5 | 3 | @Override
public Seat getResearvedSeat(Passenger passenger) throws UnsupportedOperationException {
for (int i = 0; i < passengerList.size(); i++) {
List<Passenger> _rowIteretor = passengerList.get(i);
for (int j = 0; j < _rowIteretor.size(); j++) {
Passenger _passenge... |
2448f458-6b40-40b1-804a-49c70d5597c3 | 4 | private void AddBorder(Node child) {
Node bChild = child.getFirstChild();
String direction = "";
String bRoomName = "";
while (bChild != null) {
String bNodeName = bChild.getNodeName();
if (bNodeName == "direction") {
direction = bChild.getFirstChild().getNodeValue();
try {
direction = Shorte... |
83e52e14-c347-4625-b00b-20bf8f8b6960 | 4 | public SimpleUrlShortener(final String apiUrl,
final Map<String, String> apiCredentials) {
String apiUrlFormatted = apiUrl;
if (apiCredentials != null) {
for (String credentialName : apiCredentials.keySet()) {
String credential = apiCredentials.get(credentialName);
if (credential == null) {
c... |
85313704-cb6e-4163-b412-d7e19ff1c02b | 8 | private boolean validateUserInput(String reminderDesc, String reminderDate,
String reminderTime) {
if (null != reminderDesc && reminderDesc.equals("")) {
JOptionPane.showMessageDialog(addReminderViewObj,
"Description Required");
return false;
}
if (null != reminderTime && reminderTime.equals("")) {... |
5598b234-00d3-4559-85ee-a4b355b574a8 | 9 | public LambdaMeansPredictor(List<Instance> instances) {
if (CommandLineUtilities.hasArg("cluster_lambda")) {
cluster_lambda = CommandLineUtilities.getOptionValueAsFloat("cluster_lambda");
}
clustering_training_iterations = 10;
if (CommandLineUtilities.hasArg("clustering_training_iterations")) {
clus... |
6527ecac-9812-4479-98c0-7773347dea60 | 8 | public static String toContentType(File file) {
String fName = file.getName();
String[] parts = fName.split("\\.");
String ext = parts[parts.length - 1].toLowerCase();
if (ext.equals("png") || ext.equals("jpg") || ext.equals("jpeg") || ext.equals("gif"))
return "image/" + ex... |
f8eb4880-4b48-4bd1-bcdc-2c0ed5e93f94 | 7 | public double[] getVotesForInstanceOrig(Instance inst) {
DoubleVector combinedVote = new DoubleVector();
double[] ensembleVotes = new double[inst.numClasses()];
double qbcEntropy = 0.0;
int success = 0;
for (int i = 0; i < this.ensemble.length; i++) {
DoubleVector vo... |
2bb7441b-152d-46ee-b614-1c749afa4c41 | 9 | public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
throws IllegalArgumentException {
synchronized (entries) {
// Optimization to coalesce attribute na... |
01f0df3b-6936-429e-ad34-0822d43bc64e | 9 | private void BtPesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtPesquisaActionPerformed
int[] parametro = new int[4];
parametro[0] = 70;
parametro[1] = 300;
parametro[2] = 200;
parametro[3] = 70;
preenche.FormataJtable(TbPesquisa, parametro);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.