text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void paintComponent (Graphics g) {
if (isActive)
if (isHovered)
AHOVER.paintIcon (this, g, 0, 0);
else ACTIVE.paintIcon (this, g, 0, 0);
else if (isHovered)
IHOVER.paintIcon (this, g, 0, 0);
else INACTIVE.paintIcon (this, g, 0, 0);
} | 3 |
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 |
private List<Long> pickNextEdgeFrom_Using_(Long currHeadVertice,
Set<Long> usableEdges) {
Set<Long> incident = graph.getIncident(currHeadVertice);
countAccess(1);
// build the set of usable edges connected witht the head
Set<Long> intersect = new HashSet<>(usableEdges);
intersect.retainAll(incident);
... | 6 |
@Override
protected void createRadioGroups() {
Map<String, ButtonGroup> tempRadioGroupMap = new HashMap<String, ButtonGroup>();
for ( SwingWidget<?> widget : swingWidgetMap.values() )
{
if ( widget.getControl() instanceof RadioButtonT && ( (RadioButtonT) widget.getControl() ).getRadioGroup() != null
&... | 7 |
protected boolean step() {
controller.step();
return true;
} | 0 |
public static int BitsInByte(byte b) {
int ret = 8;
for (int i = 7; i >= 0; i++)
if (b << i == 0)
ret--;
else
break;
return ret;
} | 2 |
private void createSashFormContent() {
sash = new Sash (mainComposite, SWT.VERTICAL);
final FormLayout formLayout = new FormLayout();
mainComposite.setLayout(formLayout);
FormData treeLayoutFormData = new FormData ();
treeLayoutFormData.left = new FormAttachment (0, 0);
treeLayoutFormData.right = new ... | 1 |
public static void pause(){
//Allow players to pause their game, thanks for the help - got it working
if(EZInteraction.wasKeyPressed('y') || pause){
if(EZInteraction.wasKeyPressed('y')) pause = !pause;
if(EZInteraction.wasKeyPressed('b')) pongRun = !pongRun;
if(EZInteraction.wasKeyPressed('v')){
/... | 5 |
private boolean anyMovement() {
if (backward || forward || right || left) {
return true;
}
return false;
} | 4 |
protected void updateButtonState() {
Component newTabComponent = displayPanes.getSelectedComponent();
run.setEnabled(false);
if (newTabComponent instanceof JScrollPane) {
newTabComponent = ((JScrollPane) newTabComponent).getViewport().getView();
}
if (newTabComponent instanceof CodeTextPane) {
CodeTextP... | 8 |
private static int[] merge(int[] left, int[] right){
int l=0, r=0;
int[] ret = new int[left.length+right.length];
int index = 0;
while(l<left.length && r<right.length){
if(left[l]<right[r]){
ret[index++]=left[l++];
} else {
ret[index++]=right[r++];
}
}
while(l<left.length){
ret[index++]=... | 5 |
RLOGDatatypeProperties() {
this.uri = "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#" + name();
} | 0 |
public Boolean checkBuiltIn(Location loc, Player play, Boolean isBreak){
if(!this.getBuiltIn().containsKey(play.getWorld()))
this.getBuiltIn().put(play.getWorld(), true);
if(isBreak){
if(this.hPlayerBreakBlock.containsKey(loc))
if(this.hPlayerBreakBlock.get(loc).contains(play)){
return true;
}
... | 6 |
@EventHandler
public void GhastHarm(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.Harm.DodgeCh... | 7 |
public void setFace() {
if (_value < 11) {
_face = ((Integer)_value).toString();
}
else if (_value == 11) {
_face = "jack";
}
else if (_value == 12) {
_face = "queen";
}
else if (_value == 13) {
_face = "king";
}
... | 4 |
public double getCategoryJava2DCoordinate(CategoryAnchor anchor,
int category,
int categoryCount,
Rectangle2D area,
RectangleEdge edg... | 8 |
@Test
public void testGetPixel() {
try {
// Boundary test
// Top left corner
assertEquals(i.getPixel(0, 0, Colour.RED), 136);
assertEquals(i.getPixel(0, 0, Colour.GREEN), 146);
assertEquals(i.getPixel(0, 0, Colour.BLUE), 149);
// Top right corner
assertEquals(i.getPixel(0, 3871, Colour.RED), 116... | 9 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((dataOrcamento == null) ? 0 : dataOrcamento.hashCode());
result = prime * result + id;
result = prime * result + pagamento;
result = prime * result + ((pessoa == null) ? 0 : pessoa.hashCode());
result =... | 4 |
public static void xmlToBTX(File fin, File fout) throws XMLStreamException, IOException {
XMLInputFactory fact = XMLInputFactory.newFactory();
try (FileReader fr = new FileReader(fin); BTXPusher out = new BTXPusher(fout)) {
XMLEventReader in = fact.createXMLEventReader(fr);
XMLEvent s;
while (!(s = in.... | 7 |
public void playCity() throws InterruptedException{
try
{
in = new FileInputStream(city);
as = new AudioStream(in);
ap.player.start(as);
}
catch(Exception e)
{
System.out.println("Got an IOException: " + e.getMessage());
e.printStackTrace();
... | 1 |
public static void textPack(byte packedData[], String text) {
if (text.length() > 80) {
text = text.substring(0, 80);
}
int length = text.length();
int key = 0;
int bitPosition = 1 << 3;
int srcOffset = 0;
packedData[0] = (byte) length;
for (; length > srcOffset; srcOffset++) {
int textByte = 0xff... | 6 |
static void init(){
appPath = (System.getProperty("user.home"));
if(isWindows()){
//appPath = appPath + "\\Application Data\\StudyBuddy\\";//Windows uses backslash. Two needed as escape sequence
appPath = System.getenv("APPDATA") + "\\StudyBuddy\\"; //Above invalid on non default... | 6 |
@Override
public void mouseExited(MouseEvent e) {
if (isDragging) {
// Update the UI
if (targetNode.isSelected() && !targetNode.isFirstChild() && (componentType == TEXT)) {
OutlineLayoutManager layout = targetNode.getTree().getDocument().panel.layout;
OutlinerCellRendererImpl renderer = layout.getUICom... | 5 |
public boolean displayModesMatch(DisplayMode m1, DisplayMode m2){
if(m1.getWidth() != m2.getWidth() || m1.getHeight() != m2.getHeight()){
return false;
}
if(m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI &&
m2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI &&
m1.getBitDepth() != m2.getBitDepth()){
retu... | 8 |
public void run () {
// se realiza el ciclo del juego en este caso nunca termina
while (true) {
/* mientras dure el juego, se actualizan posiciones de jugadores
se checa si hubo colisiones para desaparecer jugadores o corregir
movimientos y se vuelve a pintar to... | 4 |
public static String convertFloat(float amount, boolean speech) {
int num = (int) amount;
String start = Integer.toString(num);
int remainder = (int) ((amount - num) * 1000);
if (start.equals("0")) {
start = "";
} else if (remainder > 0) {
if (speech) {
start += " and ";
} else {
start += " "... | 9 |
public static void writeForALevel(int level) throws Exception
{
System.out.println(level);
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getGoranOct2015Dir() + File.separator +
"PC_0016 Metagenomics Study Report" + File.separator + "PC_0016 Data"
+ File.separat... | 6 |
public CommandEditConfig(CreeperWarningMain plugin) {
this.plugin = plugin;
} | 0 |
public Chance not() {
return new Chance(1 - probability);
} | 0 |
public boolean loadParameterFromFile(String path)
{
BufferedReader br;
boolean done = false;
int counter = 0;
String currLine = null;
try{
br = new BufferedReader(new FileReader(path));
while((currLine = br.readLine()) != null) {
if(cou... | 8 |
public void renderSides(){
for(int i = 0; i < worldHeight - 2; i++){
renderTileSize(sideTextures[0], 0, i + 1);
}
for(int i = 0; i < worldWidth - 2; i++){
renderTileSize(sideTextures[1], i + 1, 0);
}
for(int i = 0; i < worldHeight - 2; i++){
renderTileSize(sideTextures[2], worldWidth -1, i + 1)... | 4 |
private void processLoadState() { // loadingStages
if (Client.lowMem && loadingStage == 2 && Region.anInt131 != plane) {
gameScreenCanvas.initDrawingArea();
aFont_1271.drawANCText(0, "Loading - please wait.", 151, 257);
aFont_1271.drawANCText(0xffffff, "Loading - please wait.... | 8 |
@Override
public void run() {
try {
while(connection.isConnected()) {
String requestS = "";
BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream()));
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(connection.getOutputStre... | 7 |
@Override
public void setDetailedHops(List<Integer> hopPath, AggregatePositioner source)
{
DefaultListModel model = ((DefaultListModel) getReportHopList().getModel());
model.clear();
if (hopPath == null)
((DefaultListModel) reportHopList.getModel()).addElement("No selection");
else
{
... | 2 |
public static int[] getMatchesBetween(Integer team1, Integer team2, String temporada, Connection conexion) throws SQLException{
StringBuilder query = new StringBuilder();
query.append("SELECT Empate, VictoriaLocal, VictoriaVisitante FROM Partidos ");
query.append("WHERE Local... | 8 |
public static String[] splitMoveText(StringBuffer movetext) {
while (Character.isWhitespace(movetext.charAt(0))) {
movetext.deleteCharAt(0);
}
List tokens = new LinkedList();
String lastToken = "";
while (movetext.length() > 0) {
while (Character.isDigit(movetext.charAt(0))) {
mo... | 7 |
public void cpuTurn() {
AbstractPlay play=black.nextPlay();
play.execute();
log.setMessage(play.toString());
if(play instanceof Capture){
turnChanger.eatIncrement();
FactoryOfPlays factory = new FactoryOfCapturingsForPiece(play.getDestination(), board);
while (!factory.isEmpty()){
play = b... | 2 |
@Override
public List<Course> getCourses(int userId) throws SQLException {
List<Course> courseList = new ArrayList<>();
Connection connect = null;
PreparedStatement statement = null;
try {
Class.forName(Params.bundle.getString("urlDriver"));
connect = DriverM... | 5 |
private SplayTreeNode zagZag(SplayTreeNode node) {
SplayTreeNode k1 = new SplayTreeNode(node.parent.parent);
SplayTreeNode k1Parent = k1.parent;
SplayTreeNode a = new SplayTreeNode(node.parent.parent.left);
if (a.isNull())
a.parent = k1;
SplayTreeNode k2 = new SplayT... | 5 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Austritt)) {
return false;
}
Austritt other = (Austritt) object;
if ((this.id == null && other.id != null) || (... | 5 |
public final Collection getCollection(Identifier ident) {
if (ident instanceof PackageIdentifier)
return packs;
else if (ident instanceof ClassIdentifier)
return clazzes;
else if (ident instanceof MethodIdentifier)
return methods;
else if (ident instanceof FieldIdentifier)
return fields;
else if (... | 5 |
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 |
@Override
public Ship clone() {
// Create new hashmap for the new nodes
Map<Coordinates, Node> nodes = new HashMap<Coordinates, Node>();
// Put transfer each node to the new hashmap
for (Node n : nodeMap.values()) {
Coordi... | 2 |
public static void modifierReponse(Reponse reponse, String nouveauMessage, Utilisateur utilisateur)
throws ChampInvalideException, ChampVideException {
if (utilisateur == null || (!utilisateur.equals(reponse.getAuteur()) && utilisateur.getRole().getValeur() < reponse.getSujet().getReponseRoleMinimum... | 5 |
public int search(int[] A, int target) {
int left = 0;
int right = A.length - 1;
while (left <= right) {
int mid = (left + right) / 2;
if (A[mid] == target) {
return mid;
}
if (A[mid] >= A[left]) {
if (A[left] <= t... | 7 |
static int process(String line) {
if(line == null || line.trim().length() == 0)
return 0;
int n = Integer.parseInt(line.trim());
String[] p = readLine().trim().split(" ");
Map<String, Long> mp = new HashMap<>();
for(String str : p) {
mp.put(str, (long) 0);
}
for(int i = 0; i < n; i++) {
Str... | 8 |
private void loadAnalyzers() {
// Lista cu analizatoarele disponibile
aList = new ArrayList<Analyzer>();
// Deschide directorul xml_schema.
File directory = new File(Config.exec_schemas);
// Ia fisierele din directorul xml_schema.
File[] files = directory.listFiles();
// Parseaza fiecare fisier.
for ... | 4 |
public void setName(String name) {
this.name = name;
setDirty();
} | 0 |
public static boolean CheckGetCommandList(String path){
boolean result = false;
ArrayList<Commands> inputCommands;
inputCommands = FileReader.getCommandList(path);
for (Commands print : inputCommands) {
if(print == null){
result = true;
break;
... | 4 |
public void onKeyEvent() {
if (Keyboard.getEventKeyState()) {
if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) {
this.position.setPositionX(this.position.getPositionX() - 1);
}
if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) {
this.position.s... | 5 |
public Conexion(){
try{
System.out.println("Cargando conexion...");
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("Cargando driver...");
cnx = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=dbRestaurante2012442", "BP", "123");
// cnx = Dr... | 2 |
public String[] obtenerRespuestasCorrectas(int tamaño){
String csvFile = "dataset/diabetes_prueba_resultados.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
String respuestas [] = new String [tamaño];
int contador = 0;
try {
br = new BufferedReader(new FileReader(csvFile))... | 6 |
public static ServiceManager getServices()
{
return _services;
} | 0 |
public <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event, final BeanManager beanManager) {
final AnnotatedType<X> type = event.getAnnotatedType();
for (AnnotatedMethod<?> method : type.getMethods()) {
for (final AnnotatedParameter<?> param : method.getParameters()) {
... | 6 |
public static void main(String[] args) { // метод мэйн должен описывать общий сценарий и быть максимально коротким
Game game;
try {
if (args.length == 0) {
game = new Game();
} else {
game = new Game(args);
}
// game = a... | 4 |
@Override
public String getDescription(Hero hero) {
int bDmg = SkillConfigManager.getUseSetting(
hero, this,"BaseTickDamage", 0, false);
float bMulti = SkillConfigManager.getUseSetting(
hero, this,"LevelMultiplier", 0, false);
long duration = SkillConfigManager.getUseSett... | 8 |
@Override
public void doAction(Player player, Grid grid) throws InvalidActionException {
if (player.getRemainingTurns() <= 0)
throw new InvalidActionException("The player has no turns left!");
Position currentPos = player.getPosition();
Position newPos = new Position(currentPos.getxCoordinate() + 1, curren... | 2 |
@Override
public void actionPerformed(ActionEvent arg0) {
if((JButton)arg0.getSource() == btnEditThisPage)
{
if(editMode)
editOff();
else
editOn();
}
else if((JButton)arg0.getSource() == btnBack)
{
overlord.cl.show(overlord.getContentPane(), "resultsPage");
}
else if((JButton)ar... | 8 |
private void incDec16bit(int rTo, boolean inc) {
rLoadedFromAddress[rTo] = rLoadedFromAddress[rTo+1] = -1;
if(rMask[rTo] == 0xFF && rMask[rTo+1] == 0xFF) {
if(inc)
r[rTo+1]++;
else
r[rTo+1]--;
if(r[rTo+1] >= 0x100) {
r[rTo+1] -= 0x100;
r[rTo] = (r[rTo]+1) & 0xFF;
}
if(r[rTo+1] < 0x0) ... | 5 |
public void deletContact(String first, String last){
for(Contacts aContact:contacts){
if (first.equals(aContact.firstName) && last.equals(aContact.lastName)){
System.out.print(last+","+first+" has been removed!\n");
}
else{
System.out.println("No record found.");
}
}
} | 3 |
@Override
public String getName() {
return "user";
} | 0 |
@Override
public void handle(Message<?> event) {
Object body = event.body();
javax.jms.Message jmsMessage = null;
String contentType = null;
if (body instanceof JsonObject ) {
try {
jmsMessage = session.createTextMessage(body.toString());
c... | 9 |
static final int method3405(int i, boolean bool) {
anInt9765++;
if (Class348_Sub1.anIntArray6547 == null)
return 0;
if (!bool && Class199.aClass352Array2636 != null)
return Class348_Sub1.anIntArray6547.length * 2;
int i_1_ = 0;
if (i != 2012104999)
method3405(118, false);
for (int i_2_ = 0; Class34... | 7 |
public CreatureTemplateDialog() {
setTitle("Creature Template Editor - MSB");
setBounds(100, 100, 294, 110);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
GridBagLayout gbl_contentPanel = new Grid... | 5 |
public void start() {
cbTimer.start(new Callback() {
double startTime;
int tick=0;
@Override
public void cb() {
if (tick==0) startTime=System.nanoTime();
tick++;
animationFrame.setAnimationTime((System.nanoTime()-sta... | 1 |
private Message queryFromString(String query_line)
throws TextParseException, NameTooLongException {
String[] tokens = query_line.split("[ \t]+");
Name qname = null;
int qtype = -1;
int qclass = -1;
if (tokens.length < 1)
return null;
qname = Na... | 8 |
public static void findPotentials(String data_file, int iterations) {
LoopMRFPotentials p = new LoopMRFPotentials(data_file);
LoopyBP lbp = new LoopyBP(p, iterations);
for(int i=1; i<=p.loopLength(); i++) {
double[] marginal = lbp.marginalProbability(i);
if(marginal.length-1 != p.numXValues()) // take off ... | 7 |
private static boolean hasExactly9Digits(int i, int j){
List<Character> results = new ArrayList<Character>();
for(char c : Integer.toString(i).toCharArray()){
if (results.contains(c) || c == '0')
return false;
results.add(c);
}
for(char c : Integer.toString(j).toCharArray()){
if (results.contain... | 9 |
@Override
public int attack(NPC npc, Entity target) {
final NPCCombatDefinitions defs = npc.getCombatDefinitions();
int distanceX = target.getX() - npc.getX();
int distanceY = target.getY() - npc.getY();
boolean distant = false;
int size = npc.getSize();
Familiar familiar = (Familiar) npc;
boolean usingS... | 9 |
public WorldTest() {
} | 0 |
public void next(int width, int height) {
x += incX;
y += incY;
float random = (float)Math.random();
// collision with right side of screen
if (x + textWidth > width) {
x = width - textWidth;
incX = random * -width / 16 - 1;
fontFace = 0;
fontSize = 125;
fillColor =... | 4 |
public boolean intersectsAbove(RPChromosomeRegion testRegion) {
// Only need to test if some part of this region is above and some within test region.
if (endChromID > testRegion.endChromID ||
(endChromID == testRegion.endChromID && endBase > testRegion.endBase)) {
if (start... | 6 |
public Location getLocation()
{
return location;
} | 0 |
public Coordinate fromCartesian(Vector2D point) {
int n = refPolygon.count();
Coordinate coordinate = new Coordinate(n);
Vector2D[] si = new Vector2D[n];
double[] Ai = new double[n];
double[] Di = new double[n];
double[] ri = new double[n];
for (int i = 0; i <... | 9 |
public static void main(String[] args) {
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.INFO);
try {
listAllClasses();
start();
} catch (BindException e) {
try {
CloseableHttpClient httpclient = HttpClients.createDefault();
URI uri = new URIBuilder().setScheme("http").setH... | 6 |
public static void main(String[] args) {
// Nested "if" Statements
String gender = "female";
int age = 43;
if (gender.equalsIgnoreCase("male")) {
if (age > 30) {
System.out.println("You are a male over the age of 30");
} else {
System.out.println("You are a male under the age of 30");
}
... | 3 |
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int sit=0, stand=0;
int n = in.nextInt();
char[] text = in.next().toCharArray();
for(int i=0;i<text.length;i++){
if(text[i]=='x') sit++;
else stand++;
}
if(sit-stand>0){
int diff = (sit-stand)/2;
for(int i=0;i<t... | 9 |
@Override
public void setUnixPermissions(String path, UnixPermissions perms)
throws PathNotFoundException, AccessDeniedException,
UnsupportedFeatureException {
if (hardlinks)
{
//Get hard link paths
String[] hardlinks = getHardLinks(path);
if (hardlinks.length > 0)
path = hardlinks[0];
}
... | 8 |
public Match findId(Match m) {
Match found = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst=this.connect().prepareStatement("select * from Matches where equipea=? and equipeb=? and scorea=? and scoreb=?");
pst.setString(1, m.g... | 6 |
public static void walkDefmacroTree(Cons tree) {
{ Stella_Object name = tree.rest.value;
{ PropertyList self000 = PropertyList.newPropertyList();
self000.thePlist = Cons.extractOptions(tree, null);
{ PropertyList options = self000;
MethodSlot method = null;
if (Stella_Ob... | 7 |
public int execute() {
boolean forceQuit = false;
// Is there a --force param?
if( this.getParamCount() != 0 ) {
if( this.getParamAt(0).getString().equalsIgnoreCase("-f") || this.getParamAt(0).getString().equalsIgnoreCase("--force") )
forceQuit = true;
else
this.getFactory().getServer().getLogger().... | 3 |
public double increaseDamage(double damage){
double temp = damage - weaponItem.getAttackScore();
return temp;
} | 0 |
public void addDebito(String nomeCliente, double acrecimo)throws ExceptionGerentePessoa{
Cliente c = getCliente(nomeCliente);
if(acrecimo >0){
c.addDebito(acrecimo);
}else{
throw new ExceptionPessoa("Tentativa de adocionar d��bito com valor negativo");
}
} | 1 |
public void build() {
Material block = Material.getMaterial(98);
int x = this.x;
int z = this.z;
for (int y = this.y; y < height + this.y; y++) {
x = this.x;
z = this.z;
for (int i = 0; i < width; i++) {
// draw the north edge
for (int j = 0; j < length; j++) {
Location loc = new Location... | 7 |
public static void openImageAction ()
{
String userhome = System.getProperty("user.dir");
JFileChooser openFC = new JFileChooser(userhome); //let the user browse for an image
openFC.setAccessory(new ImagePreview(openFC));
openFC.setAcceptAllFileFilterUsed(false); // not all files are accepted
openFC.addC... | 4 |
public void synchronizeEconomy(boolean accounts, boolean ecoplayers) {
try {
if (accounts) {
for (int i = 1; i <= getGreatestId(Economy.accountTable, "id"); i++)
synchronizeAccount(i);
}
if (ecoplayers) {
for (int i = 1; i <= getGreatestId(Economy.ecoPlayerTable, "uuid"); i++)
for (... | 6 |
public static UserStatusEnum getStatusByName(String name) {
if (StringUtils.isEmpty(name)) {
return null;
}
for (UserStatusEnum status : values()) {
if (StringUtils.equals(status.name(), name)) {
return status;
}
}
return null;
} | 3 |
private static List<String> splitValuesOrEmpty(String[] strings, int index) {
if(index<strings.length) {
String[] values = VALUES.split(strings[index]);
return Arrays.asList(values);
}
return Collections.emptyList();
} | 1 |
public static void main(String[]args)
{
BigInteger n = BigInteger.valueOf(2);
n = n.pow(1000);
BigInteger sum = BigInteger.valueOf(0);
while(n.compareTo(BigInteger.ONE) > -1)
{
sum = sum.add(n.mod(BigInteger.TEN));
n = n.subtract(n.mod(BigInteger.TEN));
n = n.divide(BigInteger.TEN);
}
... | 1 |
public void insert(Node node)
{
if(this.indent < node.indent)
{
if(this.children.size() > 0)
{
if(this.children.get(0).indent != node.indent)
throw new RuntimeException("children indentations must match");
}
this.chi... | 4 |
private JMeterHTablePool(Configuration config, int poolsize,byte[] tableName, final boolean autoFlush,final long writeBufferSize) {
tablePool = new HTablePool(config, poolsize, new HTableFactory() {
@Override
public HTableInterface createHTableInterface(Configuration config,
byte[] tableName) {
try {
... | 1 |
private static String getShortName(final String name) {
int n = name.lastIndexOf('/');
int k = name.length();
if (name.charAt(k - 1) == ';') {
k--;
}
return n == -1 ? name : name.substring(n + 1, k);
} | 2 |
@Override
public int decidePlay(int turn, int drawn, boolean fromDiscard) {
double[] playVotes = new double[6];
for (int i=0; i < cylons.size(); i++)
{
int vote = cylons.get(i).cardPositionForReal(game, rack, drawn);
playVotes[vote] += weights.get(i);
}
double bestVote = 0;
int pos = 0;
for (int... | 4 |
public static boolean enableNagles(SocketDescriptor sock, boolean enable) {
try {
sock.channel.socket().setTcpNoDelay(!enable);
} catch(java.net.SocketException e) {
vlog.error("Could not " + (enable ? "enable" : "disable") +
" Nagle's algorithm: " + e.getMessage());
return fa... | 2 |
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
String text = request.getParameter("textBox");
String target = request.getParameter("target");
String sub = request.getParameter("sub");
if(text != null & target != n... | 1 |
public String adaptadorFomatoHora(String tiempoSolicitado) {
String tiempoSolicitadoAdaptado;
switch (tiempoSolicitado) {
case "15 minutos":
tiempoSolicitadoAdaptado = "00:15:00";
break;
case "30 minutos":
tiempoSolicitadoAdaptado =... | 5 |
double splitInfoDiscrete(int i) {
String[] attributeValues = data.getAttributeValues(i);
String[] array2 = data.getAttributeRange(i);
int p_values = array2.length;
//store number of instances having belonging to a certain class
int[] nk = new int[p_values];
for (int j = 0... | 7 |
@Override
public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
if (splitted[0].equals("npc")) {
int npcId = Integer.parseInt(splitted[1]);
MapleNPC npc = MapleLifeFactory.getNPC(npcId);
if (npc != null && !npc.getName().equals("MISSINGNO")) {
npc.setPosition(c.get... | 7 |
public boolean hasCollided(int Xa, int Ya) {
int xMin = 0;
int xMax = 7;
int yMin = 3;
int yMax = 7;
for (int x = xMin; x < xMax; x++) {
if (isSolidTile(Xa, Ya, x, yMin)) {
return true;
}
}
for (int x = xMin; x < xMax; x++) {
if (isSolidTile(Xa, Ya, x, yMax)) {
return true;
}
}
for... | 8 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... | 7 |
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.