text stringlengths 14 410k | label int32 0 9 |
|---|---|
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; ... | 8 |
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... | 7 |
public void setTankVolume(int tankVolume) throws CarriageException {
if (tankVolume < 0) {
throw new CarriageException("Tank volume is under zero");
}
this.tankVolume = tankVolume;
} | 1 |
@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;
} | 0 |
@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(... | 4 |
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... | 3 |
public void updateList(String[] users) {
clearList();
for(String user : users) {
if(!user.equals(mInterface.getUser()))
mListModel.addElement(user);
}
} | 2 |
public void setIsSensitive(boolean isSensitive) {
this.isSensitive = isSensitive;
} | 0 |
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 ... | 8 |
private void switchState(State newState) {
if (this.currentState != null) {
this.currentState.exit();
}
this.currentState = newState;
if (this.currentState != null) {
this.currentState.enter();
}
} | 2 |
@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() !... | 5 |
public Scanner(Reader reader) {
this.lineNumber = 1;
this.charPosition = -1;
this.nextChar = 0;
this.reader = reader;
try {
read();
} catch (IOException e) {
e.printStackTrace();
}
} | 1 |
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 ... | 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"))... | 8 |
public boolean dropTable(String tableName) {
if (!tableHashMap.containsKey(tableName)) {
return false;
}
tableHashMap.remove(tableName);
return true;
} | 1 |
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 '\\':
... | 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";... | 8 |
@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 {
... | 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()) {
... | 5 |
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... | 6 |
public String getQuestName() {
return QuestName;
} | 0 |
@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))
... | 9 |
public int getWidth() {
return width;
} | 0 |
private void optimizeMondayTimeTableForIIIAndIVGymnasium() {
// mondayTimeTable = new LinkedHashMap<>();
// tuesdayTimeTable = new LinkedHashMap<>();
// wednesdayTimeTable = new LinkedHashMap<>();
// thursdayTimeTable = new LinkedHashMap<>();
// fridayTimeTable = new LinkedHashMap<>()... | 9 |
private NotInterestedMessage(ByteBuffer buffer) {
super(Type.NOT_INTERESTED, buffer);
} | 0 |
@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... | 9 |
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... | 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) ... | 6 |
public void setInternal(T internal) {
this.internal = internal;
} | 0 |
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... | 7 |
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... | 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));
} | 3 |
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... | 6 |
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... | 3 |
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... | 4 |
public Direction getOpposingDirection() {
switch(this) {
case NORTH: return SOUTH;
case WEST: return EAST;
case SOUTH: return NORTH;
case EAST: return WEST;
}
return null;
} | 4 |
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 =... | 8 |
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... | 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(... | 7 |
@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) {
... | 5 |
@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... | 7 |
@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 )... | 8 |
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 == '}') {
... | 5 |
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) ... | 3 |
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... | 4 |
@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!");
... | 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... | 5 |
@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;
... | 4 |
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... | 7 |
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... | 9 |
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.... | 7 |
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... | 6 |
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... | 1 |
public InternalDragAndDropListener() {} | 0 |
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... | 9 |
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 ... | 5 |
public void setJ(byte[] value) {
this.j = value;
} | 0 |
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... | 9 |
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;
} | 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;
} | 2 |
public Participant createNewParticipant(String id, String name, InetAddress addr) {
String color = textColors.get(participants.size() % textColors.size());
return new Participant(id, name, addr, color);
} | 0 |
@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... | 6 |
public void loadGroups() {
groupListModel.clear();
List<ImgGroup> groups = imageBrowser.getGroups();
if (groups == null) {
return;
}
for (ImgGroup g : groups) {
groupListModel.addElement(g);
}
groupListModel.addElement(newGroupLabel);
} | 2 |
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... | 9 |
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... | 2 |
@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);
}
} | 1 |
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... | 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... | 6 |
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... | 3 |
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... | 7 |
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... | 3 |
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... | 6 |
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") + ": ");
... | 4 |
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... | 8 |
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... | 3 |
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... | 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 ... | 2 |
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... | 9 |
public AppTest( String testName )
{
super( testName );
} | 0 |
public boolean hasPlayer(Player p){
if(players.contains(p.getName())){
return true;
}else{
return false;
}
} | 1 |
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... | 8 |
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... | 6 |
public void clearBoard(){
int[] field = getGameField();
for (int i=0; i<9; i++){field[i] = 0;}
this.turn = 1;
return;
} | 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>>() {
... | 1 |
public ObservableIssue getSelectedIssue() {
if (model != null && table != null) {
List<ObservableIssue> selectedIssues = table.getSelectionModel().getSelectedItems();
if (selectedIssues.size() == 1) {
final ObservableIssue selectedIssue = selectedIssues.get(0);
... | 3 |
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... | 1 |
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});
... | 8 |
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... | 6 |
protected boolean findEntry() {
keywordOffsetArray = new Vector<Integer>();
boolean matchCase = Search.getMatchCase();
searchKeyword = Search.getSearchString();
styledText.redraw();
String str;
Pattern p;
... | 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_... | 5 |
@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;
} | 1 |
@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... | 3 |
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... | 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... | 4 |
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("")) {... | 8 |
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... | 9 |
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... | 8 |
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... | 7 |
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
throws IllegalArgumentException {
synchronized (entries) {
// Optimization to coalesce attribute na... | 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);
... | 9 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.