text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void backward(float delta, Level level, int currentRoom) {
float x,y,z,minX,maxX,minY,maxY;
List<Float> obsList = new ArrayList<Float>();
minY = level.getRoomList().get(currentRoom).getPos().getY();
maxY = level.getRoomList().get(currentRoom).getPos().getY() + level.getRoomList().get(currentRoom).getDy(... | 8 |
public static void validateTour(Tour tour) throws TechnicalException {
if (tour == null) {
throw new TechnicalException(MSG_ERR_NULL_ENTITY);
}
if ( ! isValidDiscount(tour.getDiscount())) {
throw new TechnicalException(DISCOUNT_ERROR_MSG);
}
if ( ! isValid... | 5 |
protected String createJSON(List<String> values) {
final OutputStream out = new ByteArrayOutputStream();
final ObjectMapper mapper = new ObjectMapper();
String output = "";
try {
mapper.writeValue(out, values);
final byte[] data = ((ByteArrayOutputStream) out).toByteArray();
output = new String(data)... | 3 |
public String[] getFilteredCourses(boolean undergrad, boolean grad) {
ArrayList<String> filteredList = new ArrayList<String>();
for(Course course : courses.values()) {
String numWithNoX = course.getCatalogNumber().replaceAll("X", "0");
int courseNumber = getStringValue(numWithNoX);
if(undergrad && courseNu... | 5 |
protected String getRtnCode(int codeNum) {
return this.rtnCodes.get(codeNum);
} | 0 |
@Override
protected void logBindInfo(Method method) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功");
}
} | 1 |
public static boolean insertar_nuevo(Producto x){
try{
BufferedWriter escribe=Files.newBufferedWriter(path,
java.nio.charset.StandardCharsets.UTF_8, java.nio.file.StandardOpenOption.APPEND);
escribe.write(x.getCod()+";"+x.getDesc()+";"+x.getStock()+";"+x.getPrecio());
escribe.newLine()... | 2 |
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
String pathInfo = request.getServletPat... | 5 |
public boolean isCompleteSubtree(PGridPath prefix) {
int prefixCount = 0;
int conjCount = 0;
for (String unsolved : unsolvedPaths_.keySet()) {
PGridPath unsolvedPath = new PGridPath(unsolved);
if (unsolvedPath.hasPrefix(prefix)) {
prefixCount++;
... | 9 |
private String useRbondVariables(String s, int frame) {
if (!(model instanceof MolecularModel))
return s;
MolecularModel m = (MolecularModel) model;
int n = m.bonds.size();
if (n <= 0)
return s;
int lb = s.indexOf("%rbond[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
RadialB... | 8 |
public boolean isTrip() {
boolean retBoo = false;
if (_cards.size() >= 3) {
if (!(isPair()))
return retBoo;
else {
for (int i = 0; i < _cards.size()-2; i++) {
for (int x = (i+1); x < _cards.size()-1; x++) {
if (_cards.get(i).compareTo(_cards.get(x)) == 0) {
for (int p = (x+1); p < _card... | 7 |
public LearningEvaluation evalModel(InstanceStream trainStream, InstanceStream testStream, AbstractClassifier model) {
model = new SelfOzaBoostID();
InstanceStream stream = (InstanceStream)trainStream.copy();
ClassificationPerformanceEvaluator evaluator = new BasicClassificationPerformanceEvalu... | 8 |
private boolean askNodesorFinish() throws IOException
{
/* If >= CONCURRENCY nodes are in transit, don't do anything */
if (this.config.maxConcurrentMessagesTransiting() <= this.messagesTransiting.size())
{
return false;
}
/* Get unqueried nodes among the K close... | 5 |
public void setGoTo(String []goTo) {
this.goTo=goTo[0];
} | 0 |
public Actor remove(AdvancedLocation loc) {
switch (loc.getLayer()) {
case ActorLevel:
return super.remove(loc);
case FloorLevel:
return this.mapGrid.remove(loc);
case ObjectLevel:
return this.objectGrid.remove(loc);
... | 3 |
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 |
static boolean agregarColeccion( Coleccion tipo ){
try{
if( tipo == Coleccion.CHAR)
cols[ cont ] = new ColeccionChar();
else if( tipo == Coleccion.DOUBLE )
cols[ cont ] = new ColeccionDouble();
else if( tipo == Coleccion.INTEGER )
... | 5 |
public SaltAlgorithmIdentifierType getOtherSource() {
return otherSource;
} | 0 |
@Override
public void consequent(CounterActionFactory CAF) {
// retrieve master name
String mName = (String) Serializer.deserialize(null, "mastername.dat");
String question = "What can I help you with?";
if (mName != null) {
question = "What can I help you with "+ mName +"?";
}
// show menu
C... | 6 |
public static void main(String[] args){
int bufferSize=20;
Scheduler sched;
for(int iloscWatkow=10; iloscWatkow<51; iloscWatkow+=10)
{
watki++;
for(int czasMetody=0; czasMetody<101; czasMetody+=20)
{
czasy++;
System.out.println("WATKI "+ iloscWatkow + " CZAS " + czasMetody);
int... | 9 |
public double getSalary()
{
return salary;
} | 0 |
public User findUser(String username, String password) {
String query = "SELECT * FROM user WHERE username = '%s' AND password = '%s'";
DBA dba = Helper.getDBA();
try {
ResultSet rs = dba.executeQuery(String.format(query, username, password));
while (rs.next()) {
... | 2 |
protected void fireDocumentRemovedEvent(Document doc) {
removedEvent.setDocument(doc);
for (int i = 0, limit = documentRepositoryListeners.size(); i < limit; i++) {
((DocumentRepositoryListener) documentRepositoryListeners.get(i)).documentRemoved(removedEvent);
}
// Cleanup
removedEvent.setDocument(null... | 1 |
public ItemSet GetUniqueItems() {
ItemSet uniqueItems = new ItemSet();/*uniquely constructed itemSet*/
for (int j = 0; j < transactionSet.size(); j++) {/*loop through the first transactionSet object*/
for (int i = 0; i < transactionSet.get(j).getTransaction().getItemSet().size(); i++) {/*doubly loop through each... | 3 |
@Override
public Watcher addWatcher(String folderPath, int mask, boolean watchSubtree) throws IOException {
int watcherId = JNotify.addWatch(folderPath, mask, watchSubtree, jNotifyListener);
WatchKey watchKey = new JNotifyWatchKey(watcherId, folderPath);
Watcher watcher = new Watcher(watchKey, folderPath, mask, ... | 0 |
private static byte[] deCrypt(byte[] cryptMsg, int Tabid){
PDU encryptedPDU = new PDU(cryptMsg, cryptMsg.length);
byte[] encryptedMsg = null;
try {
int algorithm = encryptedPDU.getByte(0);
int checksum = encryptedPDU.getByte(1);
int cryptLength = encryptedPDU.... | 3 |
private Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... | 6 |
public int convertNumber(List<String> input)
{
if(checkIfZero(input.get(0)) || input.size() < 1)
{
return 0;
}
int number = 0;
boolean negative = false;
while(!input.isEmpty())
{
if(checkIfNegative(input.get(0)))
{
negative = true;
input.remove("negative");
input.remove("minus");
... | 8 |
public Cell attackClosestUnit_(Queue<Cell> queue,
ArrayList<Cell> expandedNodes) {
Queue<Cell> newQueue = new LinkedList<Cell>();
Cell returnCell = null;
// if there are still nodes
while (!queue.isEmpty()) {
Cell currentNode = queue.poll();
Queue<Cel... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PlayerChoice other = (PlayerChoice) obj;
if (getCode() == null) {
if (other.getCode() != null)
return false;
} else if (!getCode().eq... | 9 |
public void addValidationMessage(BeamMeUpMQError errorMessage) {
if (validationErrorMessages == null) {
validationErrorMessages = new ArrayList<BeamMeUpMQError>();
}
validationErrorMessages.add(errorMessage);
} | 1 |
public Entity init(){
setVelocity(new Vector2f(-0.3f,0.2f));
try {
AddComponent( new ImageRenderComponent("BirdRender", new Image("assets/bird.png")) );
} catch (SlickException e) {
// TODO Auto-generated catch block
e.printStackTrace();
... | 2 |
public final boolean onCommand(CommandSender sender, Command cmd,
String alias, String[] args) {
try {
Method method = this.getClass().getDeclaredMethod(cmd.getName(),
CommandSender.class, String[].class);
return (Boolean) method.invoke(this, sender, args);
} catch (InvocationTargetException e) {
p... | 2 |
public static String insertarRegistros( String nombreTabla, String[] camposTabla, String[] valoresTabla ) throws Exception
{
String query = "INSERT INTO " + nombreTabla;
if( camposTabla != null)
{
query += " (";
for( int i = 0; i < camposTabla.length; ++i ){
query += camposTabla[i];
if( i < campos... | 7 |
private void jComboBoxVisiteurActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxVisiteurActionPerformed
((CtrlVisiteur)controleur).visiteurSelectionner();
}//GEN-LAST:event_jComboBoxVisiteurActionPerformed | 0 |
private void init() {
for (int i=0; i< NUMBER_OF_EQUATION_PARAMETERS; i++) {
textFields[i] = new JTextField(TEXT_FIELD_MIN_WIDTH);
}
numberOfPointsTextField = new JTextField(TEXT_FIELD_MIN_WIDTH);
timeStepTextField = new JTextField(TEXT_FIELD_MIN_WIDTH);
timePeriodT... | 1 |
public static String propositiontoString(Proposition p){
switch(p){
case IS_FRONT_CLEAR: return "Front is Clear";
case IS_LEFT_CLEAR: return "Left is Clear";
case IS_RIGHT_CLEAR: return "Right is Clear";
case IS_FACING_NORTH: return "Facing North";
case IS_FACING_SOUTH: return "Facing South";
... | 8 |
final public int writeVarLong (long value, boolean optimizePositive) throws KryoException {
if (!optimizePositive) value = (value << 1) ^ (value >> 63);
int varInt = 0;
varInt = (int)(value & 0x7F);
value >>>= 7;
if (value == 0) {
write(varInt);
return 1;
}
varInt |= 0x80;
varInt |= ((value & ... | 9 |
private String readAxiom(Document document) {
NodeList list = document.getDocumentElement().getElementsByTagName(
AXIOM_NAME);
if (list.getLength() < 1)
throw new ParseException("No axiom specified in the document!");
String axiom = containedText(list.item(list.getLength() - 1));
if (axiom == null)
ax... | 2 |
private List<Entry<Integer, Object[]>> createQueryParametersList(E value) {
ClassInspect inspector = getClassInspector();
List<Entry<Integer,Object[]>> queryParameterValues = new LinkedList<Entry<Integer,Object[]>>();
List<Field> annotatedFields = inspector.findAllAnnotatedFields(Column.class);
int columnCount... | 3 |
private static String readFile(String filePath) {
Logger.log("Opening file " + filePath);
File file = new File(filePath);
assert file.exists();
assert file.isFile();
assert file.canRead();
Scanner s = null;
try {
s = new Scanner(file);
} catch (FileNotFoundException e) {
Logger.log("Error reading ... | 2 |
public boolean run() {
PrintStream original = System.out;
PrintStream noPrint = new PrintStream(new OutputStream() {
public void write(int b) {}
});
try {
Method m[] = this.getClass().getDeclaredMethods(); // Get all methods
for( Method i : m ) {
if( i.getName().startsWith("test... | 9 |
private boolean isReady(Document doc)
throws Exception {
if (props.getProperty("checkPagePDFExists", "false").equalsIgnoreCase("true")) {
// check if PDF for the page exists
String strPagePDF = "";
NodeList nl = (NodeList) xp.evaluate("//NewsItem[NewsMana... | 3 |
public static ArrayList<Double> firstXPrimeNumbers(double number) throws MathException{
ArrayList<Double> primes = new ArrayList<Double>();
boolean prime = true;
double sqRoot;
//Error detected
if(number < 1){
throw new MathException("Invalid input, minamum is 1");
}
primes.add(2.0);
//Logi... | 8 |
public Equipa(String codigo,String nome,String Escalao, String cod_Escola) {
this.codEquipa = codigo;
this.nome = nome;
this.codEscola = cod_Escola;
this.DAOJogador = new DAOJogador();
switch (Escalao) {
case "Escalao.EscolaA":
escalao = new EscolaA();... | 9 |
public Instances transform(Instances train) throws Exception{
Attribute classAttribute = (Attribute) train.classAttribute().copy();
Attribute bagLabel = (Attribute) train.attribute(0);
double labelValue;
Instances newData = train.attribute(1).relation().stringFreeStructure();
//insert a bag label... | 9 |
public static void spielendeabrechnung() throws IOException {
if(punktespieler1 > punktespieler2 + 20) {
System.out.println("("+ausgabenummer+") "+spielername1+" gewinnt die Partie hochverdient!"); ausgabenummer += 1;
System.out.println("("+ausgabenummer+") "+"Er gewinnt mit "+punktespieler1+" zu "+punktespiele... | 5 |
public Integer getMatchName(String matchvalue) {
if (this.getMatchSring().equals(matchvalue)) {
return string_name;
}
if (this.getMatchNum().equals(matchvalue)) {
return num_name;
}
if (this.getMatchOperacion().equals(matchvalue)) {
return oper... | 3 |
@Test
public void testCalculateTotal() throws Exception {
BigDecimal bdRes;
this.terminal.scan("ABCDABA");
BigDecimal bd1 = BigDecimal.valueOf(13.25);
bd1 = bd1.setScale(2,BigDecimal.ROUND_HALF_DOWN);
bdRes = terminal.calculateTotal();
assertTrue(bd1.equals(bdRes));
this.terminal.scan("CCCCCCC");
... | 0 |
public void setTipoPasajero(String tipoPasajero) {
if (tipoPasajero.length() <= 3) {
this.tipoPasajero = tipoPasajero.trim();
}else{
this.tipoPasajero = "ADT";
}
} | 1 |
public void add_all_features(String[] features_string){
for(int i=0;i<features_string.length;i++){
String[] feature_parsed= features_string[i].replace(":", " ").trim().split("\\s+");
int f_id= Integer.parseInt(feature_parsed[0]);
if(!index){
feat_present.add(f_id); // uncomment if not required
}
... | 7 |
public int getMaxRound()
{
return maxRound;
} | 0 |
@Override
public void run() {
boolean error = false;
_shouldStop = false;
System.err.println("Sugar interpreter started");
if (null != _listener) {
_listener.interpreterStarted(this);
}
try {
Environment e = _rootEnvironment;
e.pushReader("bootstrap");
e.pushOp("read");
e.evaluateSt... | 8 |
public static Attribute getSetting(PrintService service, PrintRequestAttributeSet set, Class<? extends Attribute> type, boolean tryDefaultIfNull) {
Attribute attribute = set.get(type);
if (tryDefaultIfNull && attribute == null && service != null) {
attribute = (Attribute) service.getDefaultAttributeValue(type);
... | 4 |
private final boolean tryReadPacket(final SelectionKey key, final T client, final ByteBuffer buf, final MMOConnection<T> con)
{
switch (buf.remaining())
{
case 0:
// buffer is full
// nothing to read
return false;
case 1:
// we don`t have enough data for header so we need to read
key.inte... | 8 |
private void copyPALtoRGBA(ByteBuffer buffer, byte[] curLine) {
if(paletteA != null) {
for(int i=1,n=curLine.length ; i<n ; i+=1) {
int idx = curLine[i] & 255;
byte r = palette[idx*3 + 0];
byte g = palette[idx*3 + 1];
byte b = palette[i... | 3 |
@Override
public void draw(Graphics2D g2d) {
for (int i = 0; i < fireBalls.size(); i++)
fireBalls.get(i).render(g2d);
if (flinching) {
long elapsed = (System.nanoTime() - flinchTimer) / 1000000;
if (elapsed / 100 % 2 == 0) return;
}
} | 3 |
static void tune(Instrument i) {
// ...
i.play(Note.MIDDLE_C);
} | 0 |
@Override
public AbstractComponent parse(String string) throws BookParseException {
if (string == null) {
throw new BookParseException("String is null");
}
try {
TextComponent component = (TextComponent) factory
.newComponent(EComponentType.LISTING);
for (String s : string.split(LINE_REGEX)) {
... | 3 |
public void insertSupplierAmount(supplier tempSupplier) throws SQLException{
try {
databaseConnector = myConnector.getConnection();
SQLQuery = "INSERT INTO familydoctor.supplier "+"VALUES(?,?,?,?)";
PreparedStatement preparedStatem... | 3 |
public static boolean isNullOrEmpty(String input) {
return (input == null ? true : (input.length() <= 0 ? true : false));
} | 2 |
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
JTree tree = MainFrame.dataTree;
DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode) tree
.getLastSelectedPathComponent();
int nodeLevel = selectNode.getLevel();
if (nodeLevel == 1) {
// 删除数据库
if (e.get... | 8 |
public static int hellingerDist(int color1, int color2) {
double dRed = Math.pow( Math.sqrt((color1 & RED_MASK) >> 16) - Math.sqrt((color2 & RED_MASK) >> 16),2);
double dGreen = Math.pow( Math.sqrt((color1 & GREEN_MASK) >> 8) - Math.sqrt((color2 & GREEN_MASK) >> 8),2);
double dBlue = Math.pow( ... | 0 |
public void visitIfCmpStmt(final IfCmpStmt stmt) {
if (stmt.right() == previous) {
check(stmt.left());
} else if (stmt.left() == previous) {
previous = stmt;
stmt.parent().visit(this);
}
} | 2 |
@Override
void insert() {
int ccid = -1; //1
int cphone = -1; //5
PreparedStatement ps;
BufferedReader in = new BufferedReader((new InputStreamReader(System.in)));
try {
Statement stmt = con.createStatement();
ResultSet rs;
System.out.println("Enter the C... | 8 |
public String getSex() {
return sex;
} | 0 |
private void collectiveInstinctiveMovement() {
double[] m = new double[dimensions];
double totalFitness = 0;
// calculating m, the weighted average of individual movements
for (int i = 0; i < school.size(); i++) {
Fish _fish = school.get(i);
for (int j = 0; j < dimensions; j++) {
m[j] += _fish... | 9 |
public void test() throws IOException {
FieldCache cache = FieldCache.DEFAULT;
double [] doubles = cache.getDoubles(reader, "theDouble");
assertSame("Second request to cache return same array", doubles, cache.getDoubles(reader, "theDouble"));
assertSame("Second request with explicit parser return same a... | 6 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
{
return false;
}
byte byte0 = 11;
if (!isLargeRoom)
{
... | 9 |
public void updateAsScheduled(int numUpdates) {
super.updateAsScheduled(numUpdates) ;
//
// TODO: Restore once building/salvage of vehicles is complete-
///if (! structure.intact()) return ;
base().intelMap.liftFogAround(this, 3.0f) ;
final FormerPlant plant = (FormerPlant) hangar() ... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TextReader other = (TextReader) obj;
if (content == null) {
if (other.content != null)
return false;
} else if (!content.equals(other.co... | 6 |
public boolean needsCrypt() {
return ((this.sslMode == FTPConnection.AUTH_SSL_FTP_CONNECTION || this.sslMode == FTPConnection.AUTH_TLS_FTP_CONNECTION || this.sslMode == FTPConnection.IMPLICIT_SSL_WITH_CRYPTED_DATA_FTP_CONNECTION || this.sslMode == FTPConnection.IMPLICIT_TLS_WITH_CRYPTED_DATA_FTP_CONNECTION) && ... | 6 |
public static void main(String[] args) {
String key = "ARVINBEHSHAD";
LinkedList<Character> word = new LinkedList<Character>();
for (int i = 0; i < key.length(); i++) {
word.append(key.charAt(i));
}
word.reverseList();
System.out.println("Reverse: " + word.toString());
word.reverseList();
System.o... | 1 |
private Object convertRvalue(Object rvalue)
throws CannotCompileException
{
if (rvalue == null)
return null; // the return type is void.
String classname = rvalue.getClass().getName();
if (stubGen.isProxyClass(classname))
return new RemoteRef(exportObj... | 2 |
public synchronized void receive(Message m) {
String type = m.getType();
if (type.equals("heartbeat")) {
detector.receive(m);
} else if(type.equals("VAL")){
detector.addConsensusMessage(m);
} else if(type.equals("OUTCOME")){
detector.addOutcomeMessage(m);
}
} | 3 |
public static void main(String[] args) {
int num1=0,num2=0;
// TODO Auto-generated method stub
try {
Scanner sc=new Scanner(System.in);
num1=sc.nextInt();
num2=sc.nextInt();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Sum1toN s=new Sum1toN();
System.o... | 1 |
public List<Double> getRPRowList(int index) {
List<Double> result= new ArrayList<Double>();
double[] values= this.getRPRowArray(index);
for (int i= 0; i< values.length; ++i) {
result.add(Double.valueOf(values[i]));
}
return result;
} | 1 |
public void setDisplayImage (Image dispImage) {
displayImage = dispImage;
} | 0 |
public static void main(String[] args) throws IOException,
ClassNotFoundException
{
Driver d = new Driver();
Main.init();
TrigramProbGen t = new TrigramProbGen();
LevenshteinDistance LD = new LevenshteinDistance();
// What we essentially need to do is to take a particular phrase/
// sentence, and first... | 9 |
public AnnotationVisitor visitParameterAnnotation(
final int parameter,
final String desc,
final boolean visible)
{
AnnotationNode an = new AnnotationNode(desc);
if (visible) {
if (visibleParameterAnnotations == null) {
int params = Type.getArgumen... | 5 |
static public Object deserializeArrayResource(String name, Class elemType, int length)
throws IOException
{
InputStream str = getResourceAsStream(name);
if (str==null)
throw new IOException("unable to load resource '"+name+"'");
Object obj = deserializeArray(str, elemType, length);
return obj;
} | 1 |
private AFParser recursiveInvertedAFNEGenerate(RegularExpresionNode node) {
AFParser result = null;
if(node instanceof ConcatNode){
RegularExpresionNode left = ((ConcatNode)node).leftOperandNode;
RegularExpresionNode right = ((ConcatNode)node).rightOperandNode;
result... | 4 |
@Basic
@Column(name = "name")
public String getName() {
return name;
} | 0 |
@Override
public boolean isOpaque() {
return super.isOpaque() && !mDrawingDragImage;
} | 1 |
@EventHandler
public void RightClick(PlayerInteractEvent event) {
final Player p = event.getPlayer();
boolean mode = getConfig().getBoolean(p.getName().toLowerCase() + ".mode");
if(event.getAction().toString() == "RIGHT_CLICK_BLOCK") {
if(p.getItemInHand().getType().equals(Material.EMERALD)) {
p.openInven... | 4 |
@Override
public String buscarDocumentoPorConcepto(String concepto) {
ArrayList<Venta> geResult= new ArrayList<Venta>();
ArrayList<Venta> dbVentas = tablaVentas();
String result="";
try{
for (int i = 0; i < dbVentas.size() ; i++){
if(dbVentas.get(i).getConcepto().... | 4 |
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
System.out.println("This is my new Filter");
if (debug) {
log("testFilter:doFilter()");
}
doBefo... | 5 |
@Override
protected ArrayList<PossibleTile> getLazyTiles(Board b) {
ArrayList<PossibleTile> lazyTiles = new ArrayList<PossibleTile>();
PossibleTile step1;
if (isWhite) {
Pawn clone = this.clone();
clone.setMoved();
step1 = new PossibleTile(clone.getX(), clone.getY() - 1, clone);
} else {
Pawn clone... | 5 |
private void onAdd() {
try{
Double averageConsumption = Double.parseDouble(tfAverageConsumption.getText().replace(",", "."));
String fuelType = (String) cbFuelType.getSelectedItem();
int cargo = (int) Double.parseDouble(tfCargo.getText().replace(",", "."));
Linked... | 9 |
private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
//Создаем новую кредитную программу по заполненным полям
CreditProgram crProg = new CreditProgram();
try {
crProg.setName(textFieldName.getText());
crProg.s... | 2 |
public static void cleanMemory(){
byte[] trash = new byte[10240000];
File f = new File(Params.testFolder + java.io.File.separator + "trash.txt");
FileOutputStream fout = null;
try{
fout = new FileOutputStream(f);
for(int i = 0 ; i < 1000 ; i++) fout.write(trash);
fout.close();
... | 2 |
@EventHandler
public void onPlayerDamagedByPlayer(EntityDamageByEntityEvent event) {
if (event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
switch (HeroesHandler.inGamePlayers.get(event.getDamager())) {
case EARTH_SHAKER: {
break;
}
case ICE: {
((Player) event.getEnti... | 6 |
public void checkConsistent() {
if (!(outer instanceof SwitchBlock))
throw new jode.AssertError("Inconsistency");
super.checkConsistent();
} | 1 |
@Override
public String toString(){
return "Units " + name;
} | 0 |
public static double evaluateNDCG(int k, HashMap<String, HashMap<Integer,Double>> relevance_judgments_2,
String path){
double NDCG = 0.0, IDCG=0.0;
List<Double> relevance = new ArrayList<Double>();
try {
BufferedReader reader = new BufferedReade... | 9 |
public Player getDamager(Entity damager, boolean allowPets)
{
// Check if the damager is a player
if (damager instanceof Player)
{
return (Player) damager;
}
// Check if the damager is a projectile from a player
else if (damager instanceof Projectile)
{
Projectile projectile = (Projectile) damager;... | 8 |
public void readItems() {
while (custDataIn.hasNextLine()) {
String temp = custDataIn.nextLine();
if (checkDate(temp))
date = temp;
else {
throw new IllegalArgumentException();
}
System.out.println("DATE: " + date);
while (custDataIn.hasNextLine()) {
String line = custDataIn.next();
... | 9 |
private float min(ArrayList<Float> data) {
float min = Float.POSITIVE_INFINITY;
for (float f : data) {
if (f != f)
continue;
if (f < min)
min = f;
}
if (min == Float.POSITIVE_INFINITY)
min = -1e-7f;
return min;
} | 4 |
public static void main(String[] args) {
EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 10, "(0|101|11(01)*(1|00)1|(100|11(01)*(1|00)0)(1|0(01)*(1|00)0)*0(01)*(1|00)1)*");
int solutionFoundCounter = 0;
int noSolutionF... | 8 |
private void getServersList(PrintWriter out) {
out.println("matchlist" + Utils.SEPARATOR + "beginning");
out.println(liste.size());
Iterator<Match> it = liste.iterator();
while ( it.hasNext() ){
Match m = ((Match) it.next());
String display = ( m.getType() == Utils.Types.ONEVSONE ? "1vs1" : ( m.getType() ... | 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.