text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void init() {
if (initializeConnection && !outputStreamSet) {
if (serverAddress == null || port < 0 || protocol == null) {
throw new IllegalStateException("Invalid connection parameters. The port, server address and protocol must be set.");
}
initializ... | 9 |
public void decreaseLife(int value){
life_delay -= value;
if(life_delay <= 0){
life -= 1;
life_delay += 100;
}
} | 1 |
private int pull(ByteBuffer dst) throws IOException {
inStream.checkNoWait(5);
//if (!inStream.checkNoWait(5)) {
// return 0;
//}
byte[] header = new byte[5];
inStream.readBytes(header, 0, 5);
// Reference: http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ib... | 8 |
@EventHandler(priority = EventPriority.MONITOR) // use MONITOR because we're not changing anything.
public void onDeath(PlayerDeathEvent event) {
Player p = event.getEntity().getKiller();
if (p == null)
return;
if (killCooldown.checkCoolAndRemove(p.getUniqueId(), cooldownTime)) {... | 4 |
public String [] getOptions() {
String [] options = new String [21];
int current = 0;
options[current++] = "-L"; options[current++] = "" + getLearningRate();
options[current++] = "-M"; options[current++] = "" + getMomentum();
options[current++] = "-N"; options[current++] = "" + getTrainingTime(); ... | 8 |
@Override
public int read() throws IOException {
waitForCurrentByteBuffer();
if (reachedEndOfStream()) {
return -1;
}
byte b = currentByteBuffer[currentBufferPosition];
currentBufferPosition++;
overallBytesConsumed++;
return b & 0xFF;
} | 1 |
@Override
public void run() {
// TODO Auto-generated method stub
int i=0;
while(!stop){
System.out.println("Value of i: "+i);
if(suspend){
synchronized (this) {
System.out.println("This thread is going to be suspend...");
try {
wait();
} catch (InterruptedException e) {
// TO... | 3 |
public static void loadWorlds() {
if (containsLoadedWorlds() && ChristmasCrashers.isDebugModeEnabled())
System.out.println("[Warning] LoadWorldsTask is overwriting one or more currently loaded worlds.");
for (int i = 0; i < 5; i++) {
if (worlds[i] == null)
worlds[i] = new World(i);
}
new Thread(new Lo... | 4 |
public void swap(GNode node1,GNode node2){
GNode[] children;
GNode parent;
int size1,size2,dsize;
parent=node1.parent;
if (parent==null){
root=node2;
}else{
children=parent.children;
size1=node1.size;
size2=node2.size;
for (int i=0;i<children.length;i++){
GNode child=children[i];
if (... | 4 |
public boolean isEnabled()
{
return comp.isEnabled()
&& comp.getSelectedText()!=null;
} | 2 |
static private void jj_add_error_token(int kind, int pos) {
if (pos >= 100) return;
if (pos == jj_endpos + 1) {
jj_lasttokens[jj_endpos++] = kind;
} else if (jj_endpos != 0) {
jj_expentry = new int[jj_endpos];
for (int i = 0; i < jj_endpos; i++) {
jj_expentry[i] = jj_lasttokens[i];... | 9 |
public int getPort() {
return (isAValidPortNumber()) ? Integer.parseInt(args[1]) : Constants.DEFAULT_PORT;
} | 1 |
public Object invokeConstructor(Reference ref, Object[] params)
throws InterpreterException, InvocationTargetException {
if (isWhite(ref))
return super.invokeConstructor(ref, params);
throw new InterpreterException("Creating new Object " + ref + ".");
} | 1 |
private boolean topLeftCorner(int particle, int cubeRoot) {
for(int i = 1; i < cubeRoot + 1; i++){
if(particle == i * cubeRoot * cubeRoot - cubeRoot){
return true;
}
}
return false;
} | 2 |
private static Move_Two processInput(String xmlString) {
//goal is to convert XML representation, embedded
//in xmlString, to instance of move object. Ideally
//this could be done auto-magically, but these technologies
//are heavyweight and not particularly robust. A nice
//compr... | 1 |
public static Object conver(String str,Class type){
if(JSTRING.equalsIgnoreCase(type.getName())){
return str;
}else if(JINTEGER.equalsIgnoreCase(type.getName())){
return stoInteger(str);
}else if(JDATE.equalsIgnoreCase(type.getName())){
return stoDate(str);
}else if(JDOUBLE.equalsIgnoreCase(type.getNam... | 7 |
public void setContinuable(boolean b) {
final CycSymbol value = b ? CycObjectFactory.t : CycObjectFactory.nil;
put(CONTINUABLE, value);
} | 1 |
private void onComplete(ActionEvent event){
for (ActionListener listener : completeListeners){
listener.actionPerformed(event);
}
} | 1 |
private boolean cargarDatosProd(Articulo art) {
boolean ret = true;
try {
String codigo = TratamientoString.eliminarTildes(articuloGui.getCodigo().getText());
art.set("codigo", codigo);
} catch (ClassCastException e) {
ret = false;
JOptionPane.show... | 8 |
public int getInt(String key, int def) {
if(fconfig.contains(key)) {
return fconfig.getInt(key);
}
else {
fconfig.set(key, def);
try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); }
return def;
}
} | 2 |
private static void Printgraph() {
// TODO Auto-generated method stub
System.out.print("\n");
for (int i = 0; i < GraphList.size(); i++) {
System.out.print(GraphList.get(i));
System.out.print("\n");
}
} | 1 |
public void exitParkedState(int departureTime) throws VehicleException {
this.departureTime = departureTime;
if (isParked() != true) {
throw new VehicleException("Vehicle isn't parked.");
} else if (isQueued() == true) {
throw new VehicleException("Vehicle is queue.");
} else if (departureTime < getParki... | 4 |
public static Double combinedGasLaw(Double p1, Double v1, Double t1, Double p2, Double v2, Double t2)
{
boolean[] nulls = new boolean[6];
nulls[0] = (p1 == null);
nulls[1] = (v1 == null);
nulls[2] = (t1 == null);
nulls[3] = (p2 == null);
nulls[4] = (v2 == null);
nulls[5] = (t2 == null);
int nullCoun... | 9 |
public void setHeader(File file, String[] header) {
if (!file.exists()) {
return;
}
try {
String currentLine;
StringBuilder config = new StringBuilder("");
BufferedReader reader = new BufferedReader(new FileReader(file));
while ((cur... | 7 |
public static List<Vertex> aStar(Graph graph, Vertex start, Vertex goal, Integer[] h)
{
List<Vertex> vertices = graph.vertices();
List<Vertex> openSet = new Vector<Vertex>();
List<Vertex> closedSet = new Vector<Vertex>();
start.setEstimation(h[(start.getO()-1)]);
start.setCost(0);
openSet.add... | 8 |
private static void reset() {
deck = new Deck();
for (int i = 0; i < 2; i++) {
hands[i] = new HandQueue();
stacks[i] = new WarStack();
}
gameOver = false;
} | 1 |
Function<String, Object> getInjectionContext(String fieldName, Object value) {
return new Function<String, Object>() {
@Override
public Object apply(String key) {
if (fieldName.equalsIgnoreCase(key)) {
return value;
}
r... | 1 |
public void Move(int row, int col){
if ((row >= size)|| (col >= size)) return;
if (sum >= minimalSum) return;
if ((row != size-1)||(col != size-1))
{
for (int i=0;i<=1;i++)
{
sum = sum + matrix[row][col];
Move(row + moveRow[i], col + moveCol[i]);
sum = sum - matrix[row][col];
}
}
else... | 7 |
@EventHandler
public void click(InventoryClickEvent event) {
Player p = (Player) event.getWhoClicked();
Inventory inv = event.getInventory();
String name = inv.getTitle();
if(name.equals(title) && event.getRawSlot()!= -999) {
event.setCancelled(true);
ItemStack item = event.getCurrentItem()!= null ? even... | 7 |
public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.... | 6 |
@Override
public AbstractStochasticLotSizingSolution solve(
AbstractStochasticLotSizingProblem problem) {
//First created the DP wrappers around the periods
AbstractLotSizingPeriod[] originalPeriods = problem.getPeriods();
DPBackwardRecursionPeriod[] periods = new DPBackwardRecursionPeriod[originalPeriods.... | 7 |
@Override
public boolean equals( Object o ) {
if ( this == o ) return true;
if ( o == null || getClass() != o.getClass() ) return false;
Node node = (Node) o;
if ( children != null ? !children.equals( node.children ) : node.children != null ) return false;
if ( valueToken !... | 7 |
private static void writeFile(Statement findDupStmt,String sqlquery, String fileName, boolean printTitles) throws SQLException,
IOException {
ResultSet rs = findDupStmt.executeQuery(sqlquery);
ResultSetMetaData rsmd = rs.getMetaData();
FileWriter fileWriter = new FileWriter(fileName, false);
PrintWriter ou... | 9 |
public double getDouble(int index) {
Object value = get(index);
try {
return value instanceof Number ? ((Number) value).doubleValue() : Double.valueOf((String) value).doubleValue();
} catch (Exception exception) {
return 0;
}
} | 2 |
public Page page() throws IOException {
if (eos)
return (null);
Page page = new Page();
while (true) {
int ret = sync.pageout(page);
if (ret < 0)
throw (new OggException()); /* ? */
if (ret == 1) {
if (page.eos() != ... | 6 |
private static int doCreateFile(byte pathName[]) {
//Check if file name length is > 32.
if (pathName.length > 32) {
doOutput("Kernel: User error: File name too long!\n");
return -1;
}
//A 1 block byte array that will hold the free map
byt... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BaseEntity<?> other = (BaseEntity<?>) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
ret... | 8 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Human human = (Human) o;
if (id != null ? !id.equals(human.id) : human.id != null) return false;
if (name != null ? !name.equals(human.name) : ... | 9 |
private Boolean parseBoolean() throws StreamCorruptedException {
StringBuffer lenStr = new StringBuffer();
while (input.remaining() > 0) {
char ch = input.get();
if (ch == ';') {
//indexPlus(1);
break;
} else {
lenStr.append(ch);
}
}
if (lenStr.toString().equals("1")) {
lenStr = new ... | 6 |
public static void setSample(byte[] buffer, int position,
short sample)
{
buffer[position] = (byte)(sample & 0xff);
buffer[position+1] = (byte)((sample >> 8) & 0xff);
} | 0 |
public void setCurrentValues() {
switch (typeOfA) {
case Element.ID_NT:
rb1A.setSelected(true);
break;
case Element.ID_PL:
rb1B.setSelected(true);
break;
case Element.ID_WS:
rb1C.setSelected(true);
break;
case Element.ID_CK:
rb1D.setSelected(true);
break;
}
switch (typeOfB) {
cas... | 8 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int nSet = Integer.parseInt(line.trim());
for (int... | 4 |
public String getEmployee_id() {
return employee_id;
} | 0 |
public void test_07() {
int nmerSize = 32;
String seqStr[] = { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // Sequence length = 32 (same as Nmer size)
, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // Same sequence
, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac" // Added a 'c' at the end
, "caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // Added a '... | 2 |
public void setReplacement(String replacement) {this.replacement = replacement;} | 0 |
public boolean onKeyReleaseEvent(Container actor, KeyEvent event) {
switch (event.getKeyUnicode())
{
case 'a':
layout.setUseAnimations(!layout.isUseAnimations());
break;
case 'v':
layout.setVertical(!layout.isVertical());
break;
case 'p':
layout.setPac... | 7 |
public int OpenDocument() {
//Se il documento non è stato creato
if (this._MyDocument == null) return -2;
else {
//Se il documento non era aperto
if (!this._MyDocument.isOpen()) {
this._MyDocument.open();
return 1;
//Se il ... | 2 |
public static void checkAllPositives(String customerId) {
// External iteration
boolean allPositives = true;
for (BankAccount account: christmasBank.getAllAccounts())
if ( account.getCustomerId().equals(customerId) && (account.getBalance().signum() < 0) ) {
allPositi... | 3 |
@Override
public int hashCode() {
int result = moduleId != null ? moduleId.hashCode() : 0;
result = 31 * result + personId;
return result;
} | 1 |
private void handleIOException( SelectionKey key, WebSocket conn, IOException ex ) {
//onWebsocketError( conn, ex );// conn may be null here
if( conn != null ) {
conn.closeConnection( CloseFrame.ABNORMAL_CLOSE, ex.getMessage() );
} else if( key != null ) {
SelectableChannel channel = key.channel();
if( c... | 6 |
public void setjComboBoxVisiteur(JComboBox jComboBoxVisiteur) {
this.jComboBoxVisiteur = jComboBoxVisiteur;
} | 0 |
public static String[] textForTag(Element element, String tag) {
if (!element.hasChildNodes())
return new String[0]; // Should never happen if we are passed a
// valid Element node
NodeList tagList = element.getChildNodes();
int tagCount = tagList.getLength();
if (0 == tagCount) // No tags by that ... | 7 |
@Override
public boolean insertHRRecommendations(String text, String positionId) {
String sql = INSERT_HR_RECOMMENDATIONS + text + "' where position_id='"
+ positionId + "'";
Connection connection = new DbConnection().getConnection();
PreparedStatement preparedStatement = null;
boolean flag = false;
try... | 4 |
public void checkLocation(Point location) {
if(humanTurn && !game.getHuman().isMadeAccusation()) {
int width = this.getWidth()/this.getNumColumns();
int height = this.getHeight()/this.getNumRows();
int row = (int) (location.getY()/height);
int column = (int) (location.getX()/width);
boolean validTarget... | 8 |
private StompFrame constructMessage(StringBuffer incomingMessage) {
String fullMessage= incomingMessage.toString();
System.out.println("Server received: ");
System.out.println(fullMessage.toString());
int indexOfNewline= fullMessage.indexOf("" + StompFrame.endlineChar);
if (indexOfNewline == 0){
fullMessag... | 6 |
public String toString()
{
return note;
} | 0 |
public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
AnnotationNode an = new AnnotationNode(desc);
if (visible) {
if (visibleAnnotations == null) {
visibleAnnotations = new ArrayList(1);
}
visibleAnnotations.add(an);
} else {
if (invisibleAnnotations == null) {
... | 3 |
public static void calculateHeightData(Tile tile, Point[] surrPoints) {
Tile[] sTiles = Utils.surroundingPointsToTiles(surrPoints); // Pattern produced by this method matches the encoding.
for (int i = 0; i < sTiles.length; i++) {
Tile sTile = sTiles[i];
// Only interested in surrounding tiles that are lower... | 4 |
@Override
public void processarImagem(ArrayList<int[][]> matrizes) {
origem = matrizes.get(0);
resultado = new int[origem.length][origem[0].length];
int recorde, coordI, coordJ;
for (int i=0; i<resultado.length; i++){
for (int j=0; j<resultado[0].length;... | 9 |
public static MaterialLib loadFromFile(String filename) {
System.out.println("New Material lib : res/models/" + filename);
MaterialLib lib = new MaterialLib();
try {
BufferedReader reader = new BufferedReader(new FileReader(new File("res/models/" + filename)));
String line = "";
String name = "";
Stri... | 6 |
public void insertar(E pData){
Nodo<E> nuevo = new Nodo<>(pData);
if (talla == 0 ){
cola = nuevo;
}
else{
cabeza.previo = nuevo;
}
nuevo.siguiente = cabeza;
nuevo.previo = null;
cabeza = nuevo;
this.talla++;
} | 1 |
@SuppressWarnings("unchecked")
public static <N, T> TKey<N, T> resolve(Class<N> namespace, String name) {
if (namespace == null) {
throw new IllegalArgumentException("Namespace must not be null.");
}
if (name == null) {
throw new IllegalArgumentException("Name must no... | 5 |
public void setType(Type otherType) {
Type newType = otherType.intersection(type);
if (type.equals(newType))
return;
if (newType == Type.tError && otherType != Type.tError) {
GlobalOptions.err.println("setType: Type error in " + this
+ ": merging " + type + " and " + otherType);
if (parent != null)
... | 6 |
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
} catch (InvalidConfigurationExcept... | 4 |
public void addPatient(PatientDL newPatient){
if (this.nextPatient == null){
this.nextPatient = newPatient;
this.nextPatient.lastPatient = this;
} else {
this.nextPatient.addPatient(newPatient);
}
} | 1 |
public int principleTerm(int y, int m) {
if (y < 1901 || y > 2100)
return 0;
int index = 0;
int ry = y - baseYear + 1;
while (ry >= principleTermYear[m - 1][index])
index++;
int term = principleTermMap[m - 1][4 * index + ry % 4];
if ((ry == 171) && (m == 3))
term = 21;
if ((ry == 181) && (m == 5)... | 7 |
public static Boolean stoBoolean(String str){
if(str==null){
return false;
}else{
if(str.equals("1")){
return true;
}else if(str.equals("0")){
return false;
}else{
try{
return Boolean.parseBoolean(str);
}catch(Exception e){
return null;
}
}
}
} | 4 |
void refill() {
System.out.println("new Bag");
pointer = 0;
DynamicArray<Type> left = new DynamicArray<>(index);
for (int n = 6; n >= 0; n--) {
int i = rand.nextInt(n+1);
tetrominos[n] = left.remove(i);
}
} | 1 |
public boolean jumpMayBeChanged() {
return (subBlocks[1].jump != null || subBlocks[1].jumpMayBeChanged());
} | 1 |
public static TreeNode stringToTree(String source) {
String seperator = " ";
if (source.contains(",")) {
seperator = ",";
}
String[] node = source.split(seperator);
if (node.length == 0) {
return null;
}
LinkedList<TreeNode> queue = new Li... | 6 |
public final boolean check_read ()
{
// Was the value prefetched already? If so, return.
int h = queue.front_pos();
if (h != r)
return true;
// There's no prefetched value, so let us prefetch more values.
// Prefetching is to simply retrieve the
// ... | 4 |
public boolean checkMoveEligible(Move move) {
int row = move.getRow();
int col = move.getColumn();
Player p = move.getPlayer();
if (col < this.getWidth() && row < this.getHeight()
&& row >= 0 && col >= 0
&& board[row][col] == null) {
r... | 5 |
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
n = cin.nextInt();
for (int i=0; i < n; ++i) {
post[i] = cin.nextInt();
}
for (int i=0; i < n; ++i) {
in[i] = cin.nextInt();
}
Queue<Pair> queue = new LinkedList<Pair>();
queue.add(new Pair(0, n-1, 0, n-1));
boole... | 8 |
public String constructAMessage(javax.swing.JLabel bpmValueElement, javax.swing.JLabel minValueElement, javax.swing.JLabel maxValueElement,
javax.swing.JScrollPane alarmValueElement) {
String str="";
int bpm = Integer.parseInt(bpmValueElement.getText());
int ... | 2 |
public int getDocFrequency() {
return docFrequency;
} | 0 |
@Override
public boolean isOK() {
return super.isOK() && (coverUrl != null);
} | 1 |
public static Document read() {
InputStream in = null;
try {
in = XmlReader.class.getClassLoader().getResourceAsStream(R.Constants.default_mapping_file);
if(in == null ){
in = new FileInputStream(System.getProperty("user.dir")+ File.separator+R.Constants.default_m... | 3 |
@Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.unbanip + " (IP)");
return;
}
String name =... | 4 |
@Test
public void testFindString_fail() throws Exception
{
Assert.assertNull(_xpath.findString("//div[@id='wrongid']/p/text()"));
} | 0 |
public void display() {
System.out.println();
System.out.println("THE HOUSE:");
theHouse.displayCardValues();
System.out.println();
System.out.println("THE PLAYER:");
player.displayCardValues();
System.out.println();
} | 0 |
private void recursiveMapToString(Map tree, StringBuilder buffer, int deep) {
boolean first = true;
for (Object key : tree.keySet()) {
if (!first) {
buffer.append(",\n");
} else {
first = false;
}
for (int t = 0; t < deep; t++) {
buffer.append('\t');
}
buffer.append('"').append(ke... | 5 |
private MCandidate createRaw(String exp, String source)
{
MCandidate mCandidate = new MCandidate();
StringTokenizer st = new StringTokenizer(source, "[]", false);
// 기분석 결과 저장
String token = null, infos = "";
String[] arr = null;
for( int i = 0; st.hasMoreTokens(); i++ ) {
token = st.nextToken();
if... | 8 |
public void postOrder3(Node Root)
{
if(Root==null) return;
this.recoverVisited(Root);
Stack<Node> s = new Stack<Node>();
Node cur = Root;
while((cur!=null&& cur.visited==0)||!s.isEmpty())
{
//左结点访问结束的标志是 pre为空
while(cur!=null && cur.visited==0)
{
s.push(cur);
cur = cur.left;
}
i... | 9 |
private static void performAnyOverlapmatch(AbstractResultSet goldStandard,
AbstractResultSet results,boolean matchType) {
int comp;
for(Concept gold : goldStandard.concepts)
{
for(Concept res : results.concepts)
{
if(matchType)
if(!res.conceptType.equals(gold.conceptType))
continue;
... | 8 |
@Override
public ApiResponse deleteTable(String tableName) throws IllegalArgumentException{
if(connexion == null && path == null)
return ApiResponse.MYAPI_NOT_INITIALISE;
Statement stat = null;
try {
if (connect == null || connect.isClosed())
return ApiResponse.DATABASE_NOT_CONNECT;
if (tableName ==... | 8 |
public void setProfile( Profile p ) throws IOException {
topScoresPanel.removeAll();
int i = 0;
for ( Score s : p.getStats().getTopScores() ) {
InputStream stream = null;
try {
ShipBlueprint ship = DataManager.get().getShip( s.getShipType() );
stream = DataManager.get().getResourceInputStream("img/... | 3 |
public ConfigManager()
{
availableConfigs = new ArrayList<Map<String,IConfig>>();
Map<String, IConfig> map = null;
for( int i = 1; i <= 6; i++ )
{
map = new HashMap<String, IConfig>();
switch( i ) {
case 1: map.put(SERVLET, JettyConfig.getConfig()); break;
case 2: map.put(SERVLET, TomcatC... | 7 |
public static void main(String[] args) {
List<Pet> pets = Pets.arrayList(8);
ListIterator<Pet> it = pets.listIterator();
while (it.hasNext())
System.out.print(it.next() + ", " + it.nextIndex() + ", " + it.previousIndex() + "; ");
System.out.println();
// Backwards:
while (it.hasPrevious())
Syste... | 3 |
private void attemptSpawn(float dt){
spawnTime-=dt;
if(spawnTime<=0 && spawnedObjs.size()<spawnMax ){
if(main.dayTime>=Main.NIGHT_TIME && spawnType==SpawnType.CIVILIAN)
spawnType = SpawnType.NIGHTER;
else if(main.dayTime<Main.NIGHT_TIME && spawnType==SpawnType.NIGHTER)
spawnType = SpawnType.CIVILIAN;
... | 8 |
@Override
public void processCommand(String... args) throws SystemCommandException {
Role internshipRole = null;
if (args.length > 2)
try {
internshipRole = createNewInternshipRole();
} catch (Exception e) {
// IO or ParseException
e.printStackTrace();
}
else {
Integer advertInde... | 5 |
@EventHandler
public void onInventoryOpen(InventoryOpenEvent event){
//We don't care about players other than the owner
if(!event.getPlayer().equals(owner))
return;
//We don't care about non-chest interactions
if(!event.getInventory().getType().equals(InventoryType.CHEST))
return;
if(event.getInventory... | 7 |
public void handleEvents(GameContainer game, StateBasedGame sbg){
Input events = game.getInput();
if(events.isKeyPressed(Keyboard.KEY_RETURN)){
//Ainda estamos escrevendo o nome?
if(scores.newEntry){
//PArando de escrever e salvando o atual:
... | 6 |
public static Integer[] mergeBintoA(Integer[] A, Integer[] B){
//1 3 7 _ _ _
//2 4 5
//1 2 3 4 5 7
//- - - 1 3 7
//1 - - - 3 7
//1 2
//Let us assume the array is init with min value for missing spaces
int aLength = A.length;
//First we determine where the last element is
int lastElementPos = 0;
... | 7 |
public void run() {
try {
DataInputStream in = new DataInputStream( socket.getInputStream() );
port = in.readInt();
int length = in.readInt();
byte[] message = new byte[length];
in.readFully( message, 0, message.length );
DataInputStream d... | 2 |
public Matrix(int n,int m)
{
columns = n;
rows = m;
matrix = new double[n][m];
} | 0 |
public static void main(String[] args) {
String input;
Scanner scan = new Scanner(System.in);
System.out.println("Input the word to check if it is a palindrome");
input = scan.nextLine();
System.out.println(checkForPalindrome(input.toLowerCase()));
} | 0 |
public static void main(String[] args) {
System.out.print("Enter a binary number: ");
Scanner scanner = new Scanner(System.in);
String binaryNumber = scanner.next();
int decimalNumber = 0;
int positionOfLastValue = binaryNumber.length() - 1;
for (int i = positionOfLastValue, j = 0; i >= 0 && j<= positionOfL... | 5 |
public String getStatusObjectDescr (Integer ID) {
String data = "";
for (int i = 0; i < this.arr_data.size(); i++) {
if (ID == this.arr_data.get(i).getID()) {
data = this.arr_data.get(i).getDescr();
}
}
ret... | 2 |
@Test
public void testServerGetQueueTimeoutErrorIndividualHashEx() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerGetQueueTimeoutErrorIndividualHashEx -----");
boolean exception_other = false;
String client_hash = "";
try {
server2.setUseMessageQueues(true);
... | 5 |
public static List<SchemaError> checkBadChars(URL file){
List<SchemaError> errors=new ArrayList<SchemaError>();
if(file!=null){
try {
BufferedReader br=new BufferedReader(new InputStreamReader(file.openStream()));
String line=br.readLine();
int j=0;
while(line!=null){
j++;
for(int i... | 5 |
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.