text stringlengths 14 410k | label int32 0 9 |
|---|---|
public AnnotationVisitor visitAnnotation(
final String name,
final String desc)
{
if (values == null) {
values = new ArrayList(this.desc != null ? 2 : 1);
}
if (this.desc != null) {
values.add(name);
}
AnnotationNode annotation = new An... | 3 |
private void CreateListeners() {
addMouseListener(
new MouseListener(){
public void mouseClicked(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mousePressed(MouseEvent e){
if (seeTrainPoints){
if (displayImage != null){
... | 9 |
public int compareTo(Date date) {
if (this._y == date.getYear()) {
if (this._m == date.getMonth()) {
if (this._d == date.getDay()) {
return 0; // =
}
else if (this._d > date.getDay()) {
return 1; // >
... | 6 |
public String toString(){
int i;
String tmp = "";
tmp += this.clr==ChessBoard.RED?"RED":"BLUE";
switch(this.direction){
case Chessline.LEFT:
for(i=this.chess_num-1;i>=0;i--){
tmp+="("+(this.start_x-i)+","+this.start_y+")";
}
break;
case Chessline.DOWN:
for(i=this.chess_num-1;i>=0;i--)
... | 9 |
@Override
public void onEnable(){
spawn = LocationParser.stringToLoc(PKSQLd.getUnparsedData("MAPSPAWN"));
new Damage(this);
new FireProjectile(this);
new Interaction(this);
new InventoryCancel(this);
new MapElementInteractions(this);
new PlayerSpawn(this);
CommandManager.loadAllCommands();
if(!Config... | 2 |
@SuppressWarnings("rawtypes")
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
AbstractEntity other = ... | 6 |
public String getHtml(WikiContext context) throws ChildContainerException {
try {
if (context.getAction().equals("confirm")) {
mPath = context.getPath();
mContainerPrefix = context.getString("container_prefix", null);
if (mContainerPrefix == null) {
... | 8 |
final Interface8 method3733(int i, int i_14_, int i_15_, byte[] is,
boolean bool) {
try {
anInt7565++;
if (i_14_ >= -2)
method3644();
if (aBoolean7873 && (!bool || aBoolean7869))
return new Class135_Sub2(this, i, is, i_15_, bool);
return new Class119_Sub2(this, i, is, i_15_);
} catch (Runt... | 6 |
public static int[][] lenghtLCS(char[] x, char[] y){
// TODO Auto-generated method stub
int m = x.length;
int n = y.length;
int[][] c = new int[m + 1][n + 1];//保存LCS(Xi,Yj)的长度
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
if(x[i] == y[j]){
c[i + 1][j + 1] = c[i][j] + 1;
}else{
if(c[... | 6 |
protected void assinarGravar() throws IOException, KeyStoreException{
int index = gCrlv.getTableGerenciarCrlvs().getSelectionModel().getLeadSelectionIndex();
if(index > -1){
XStream xstream = new XStream();
ModelCRLV c = gCrlv.getCrlv().get(index);
String xml = xstrea... | 2 |
public void clearAll() {
undoStack.clear();
redoStack.clear();
} | 0 |
static int fseek(InputStream fis, long off, int whence) {
if (fis instanceof SeekableInputStream) {
SeekableInputStream sis = (SeekableInputStream) fis;
try {
if (whence == SEEK_SET) {
sis.seek(off);
} else if (whence == SEEK_END) {
... | 6 |
public void mainMenu() {
System.out.println("Do you want to save a profile or start a test? SaP = Save StT = Start");
String choice = "";
try {
choice = cache.readLine();
} catch (IOException ex) {
System.out.println(ex.getMessage());
System.exit(-1);
... | 3 |
public listByMonth()
{
this.requireLogin = true;
this.info = "list all appointments in a given month";
this.addParamConstraint("timestamp", ParamCons.INTEGER);
} | 0 |
public static void decode(String inputImagePath, String outputFilePath) {
//foto ophalen van disk
BufferedImage selectedImage = getImage(inputImagePath);
//kopie maken van geselecteerde foto zodat de foto aangepast kan worden in Java (userspace)
BufferedImage img = cloneImage(selectedIm... | 1 |
void getDirection(Position dir)
{
dir.x = dir.y = 0;
switch (this)
{
case LEFT:
dir.x = -1;
break;
case RIGHT:
dir.x = 1;
break;
case UP:
dir.y = -1;
break;
case DOWN:
dir.y = ... | 4 |
public void move(Point startMove, Point endMove, int canvasWidth, int canvasHeight)
{
if(((x1 + endMove.getX()-startMove.getX()) >= 0)
&& ((y1 + endMove.getY()-startMove.getY()) >= 0)
&& ((x2 + endMove.getX()-startMove.getX()) < canvasWidth)
&& ((y2 + endMove.getY()-startMove.getY()) < canvasHeight))
... | 6 |
public void restoreAttempts(){ ReconnectAttempts = 3; } | 0 |
public void paint(Graphics g) {
super.paint(g);
//Make the square objects
DrawSquareWithColour redSquare = new DrawSquareWithColour();
DrawSquareWithColour blueSquare = new DrawSquareWithColour();
DrawSquareWithColour greenSquare = new DrawSquareWithColour();
DrawSquareWithColour yellowSquare... | 6 |
@Override
int transition(int absState, int position, int vector) {
// null absState should never be passed in
assert absState != -1;
// decode absState -> state, offset
int state = absState/(w+1);
int offset = absState%(w+1);
assert offset >= 0;
if (position == w) {
if (sta... | 8 |
public String getUrlFormat(String wikiName) {
String url = this.wikis.get(wikiName);
if (url == null) {
return null;
}
else if (!(url.startsWith("http://") || url.startsWith("https://"))) {
return this.getUrlFormat(url);
}
else {
if (url.contains("%%SEARCHTERMS%%")) {
return url;
}
... | 4 |
private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed
String searchNum = txtSearchPartNo.getText();
if (searchNum != null && searchNum.length() > 0) {
for (int i = 0; i < this.partNums.length; i++) {
if (searchNum.eq... | 5 |
@Override
public List<LinkDirectionCity> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException {
int pageSize = 10;
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(WHERE);
String queryStr = new QueryMapper() {
... | 2 |
protected void initDefaultCommand() {} | 0 |
public void plot(int x, int y, int val, boolean isMonochrome, boolean intensifyRed, boolean intensifyGreen, boolean intensifyBlue) {
if (isMonochrome) {
pix[y * SCREEN_WIDTH + x] = PPUConstants.NES_PALETTE[(val & 0x30)].getRGB();
} else if (intensifyRed || intensifyGreen || intensifyBlue) {
... | 7 |
private Object iceMethodCall(String methodName, Object[] args) {
// Figure the Class of each element of args[]:
Class[] parameterTypes = new Class[args.length];
for (int i = 0; i < args.length; i++) {
parameterTypes[i] = args[i].getClass();
}
try {
Method method = iceClass.getMethod(meth... | 4 |
public static void main(String[] args) {
boolean t = true, f = false;
System.out.println(t & f); // false
System.out.println(t | f); // true
System.out.println(t ^ f); // true
System.out.println(!t); // false
} | 0 |
static public void main(String[] argv)
{
try {
Blocker blocker = (Blocker)Class.forName(BLOCKER_PACKAGE+argv[0]).newInstance();
StringDistanceLearner learner = DistanceLearnerFactory.build( argv[1] );
MatchData data = new MatchData(argv[2]);
MatchExpt expt = new MatchExpt(data,learner,b... | 9 |
private void connect() throws ClassNotFoundException, SQLException
{
try
{
_connection = null;
_statement = null;
// Laedt den MySQL Treiber
Class.forName(DBDRIVER);
// Verbindung mit DB herstellen
String strPassword = this.readPassword();
_connection = DriverManager.getConnection(SERVERNAME, ... | 2 |
public void specials(int xSpot, int ySpot, Entity e) {
if (xSpot == 1 && ySpot == 4) {
// level = new LongHall("/maps/longhall.png", screen);
// screen.setScreen(new GameScreen(level));
}
if (xSpot == 1 && ySpot == 4) {
GameScreen.DownStairs.xSpawn = 2;
GameScreen.DownStairs.ySpawn = 4;
Level new... | 6 |
private static int Modification(int choosenMenu) {
switch (choosenMenu) {
case 1:
String oldLeagueName;
for (Iterator<String> it = listLeague.keySet().iterator(); it.hasNext();) {
String keyListLeague = it.next();
System.out.p... | 6 |
@Override
public Product readObject() throws IOException {
if(receivedProducts == null){
try{
// receivedProducts = jdbcCon.getProductsfromDB(10);
receivedProducts = jdbcCon.getProductsFromIdRange(10,14);
} catch (SQLException e){
e.printStackTrace();
}
}
if(!receivedProducts.isEmpty()){
P... | 3 |
public List<String> getSearchedSites() {
return null;
} | 0 |
private void unfilterPaeth(byte[] curLine, byte[] prevLine) {
final int bpp = this.bytesPerPixel;
final int lineSize = width*bpp;
int i;
for(i=1 ; i<=bpp ; ++i) {
curLine[i] += prevLine[i];
}
for(; i<=lineSize ; ++i) {
int a = curLine[i - ... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Attendee other = (Attendee) obj;
if (firstName == null) {
if (other.firstName != null)
return false;
} else if (!firstName.equalsIgnoreC... | 9 |
public void removePlayer(Location loc, Player play, Boolean isBreak){
if(isBreak){
if(this.hPlayerBreakBlock.containsKey(loc))
if(this.hPlayerBreakBlock.get(loc).contains(play))
this.hPlayerBreakBlock.get(loc).remove(play);
}
else{
if(this.hPlayerPlaceBlock.containsKey(loc))
if(this.hPlayerPlac... | 5 |
public void prettyPrintJSON(JSONObject oldJSON){
try {
JSONTokener tokener = new JSONTokener(oldJSON.toString()); //tokenize the ugly JSON string
JSONObject finalResult = new JSONObject(tokener); // convert it to JSON object
System.out.println(finalResult.toString(4)); // To ... | 1 |
@Override
public void mouseEntered(MouseEvent e) {
try {
setImg(ImageIO.read(new File("img/button/button.focus.png")));
} catch (IOException ex) {
ex.printStackTrace();
}
} | 1 |
public String runMain(String className, String[] args, String stdin) {
Class<?> target;
try {
target = ByteClassLoader.publicFindClass(className);
} catch (ClassNotFoundException e) {
return "Internal error: main class "+className+" not found";
}
Method ... | 9 |
private Program applyMutations(Program offspring) throws InvalidProgramException {
int numberOfMutationOps = mutationsOps.size();
for (Mutation m : mutationsOps) {
if (m instanceof KineticRateAlterationForProgram1 || m instanceof InsertionForProgramImpl ||
m instanceof DeletionForProgramImpl ||
random... | 5 |
@Test
public void testBogusFile() throws IOException {
final String filename = "test.wav";
final File file = File.createTempFile("testBogusFile", filename);
FileOutputStream out = new FileOutputStream(file);
final Random random = new Random();
for (int i=0; i<8*1024; i++) {
... | 8 |
private void waitIncomingRequest() throws ShutdownRequestException {
try {
incomingSocket = welcomeServer.accept();
if(shutdownRequested)
throw new ShutdownRequestException();
fromClient = new BufferedReader(
new InputStreamReader(incomingSocket.getInputStream()));
String cmd = ... | 4 |
@Override
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
char[] source = str.toCharArray();
char[] result = new char[source.length];
int j = 0;
String currentText = this.getText(0, this.getLength());
currentText.toCharArray();
for (int i = 0; i < resu... | 9 |
protected void doDestroy() {
writeLocks.clear();
readLocks.clear();
logger.info("Sync.destroy");
} | 0 |
public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.set("opt-out", ... | 2 |
private void initPreview(Component parent, ReportState state) {
//
// Save the report state
//
this.state = state;
//
// Create the report view
//
reportView = new ReportView();
reportView.setOpaque(true);
//
// Create the scroll... | 9 |
void setSortDirection (int value) {
if (value == sort) return;
boolean widthChange = value == SWT.NONE || sort == SWT.NONE;
sort = value;
if (widthChange) {
/*
* adding/removing the sort arrow decreases/increases the width that is
* available for the column's header text, so recompute the display text
*... | 5 |
public void run() {
try {
this.server = new ServerSocket(sconf.getPort());
while (true) {
this.socket = server.accept();
try {
Packet p = Packet.readSocket(socket);
PacketReader pr = p.getByteBufferReader();
PacketType ptype = GamePacketType.valueOf(p.getTypeID());
switch ((GamePa... | 7 |
public void letterGuessedByUser(String letter, int mode) {
switch (mode) {
case NORMAL_MODE:
lettersGuessed.add(letter);
feedbackToUser = feedbackFor(theAnswer);
updatePossibleAnswers();
break;
case HURTFUL_MODE:
lettersGuessed.add(letter);
feedbackToUser = mostCommonFeedback(generateFeedbackMa... | 6 |
private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
if (existeUsuarioSelecionado() && exclusaoConfirmada()) {
try {
excluir();
} catch (ValidacaoException ex) {
_unitOfWork.rollback();
... | 3 |
public void putAll( Map<? extends Integer, ? extends Byte> map ) {
Iterator<? extends Entry<? extends Integer,? extends Byte>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Integer,? extends Byte> e = it.next();
this.put( e.get... | 8 |
public void removeLocallyDeclareable(Set set) {
if (type == FOR && initInstr instanceof StoreInstruction) {
StoreInstruction storeOp = (StoreInstruction) initInstr;
if (storeOp.getLValue() instanceof LocalStoreOperator) {
LocalInfo local = ((LocalStoreOperator) storeOp.getLValue())
.getLocalInfo();
... | 3 |
public void moveEnemies() {
for (Enemy e : getEnemyList()) {
if(e.isAlive()){
e.setPosX(e.getPosX() + e.speed);
}
}
} | 2 |
private void loadImages() {
try {
slate = ImageIO.read(this.getClass().getResource("computer.png"));
java = ImageIO.read(this.getClass().getResource("java.png"));
pane = ImageIO.read(this.getClass().getResource("pane.png"));
} catch (IOException ex) {
Logger.getLogger(Textures.class.getName()).log... | 1 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected!=null)
&&(affected instanceof Room)
&&(msg.amITarget(affected))
&&(newRoom().fetchEffect(ID())==null)
&&((msg.targetMinor()==CMMsg.TYP_LOOK)||(msg.targetMinor()==CMMsg.TYP_EXAMINE)))
{
final CMMsg msg2=CMClas... | 7 |
@Override
public void keyReleased(KeyEvent e) {
if(e.getSource().equals(pfPassword)) {
if(e.getKeyCode() == KeyEvent.VK_ENTER) {
validatePassUser();
}
}
} | 2 |
public void currentBids(){
auctions.removeAll(auctions);
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = n... | 6 |
@Override
public void setValueAt(Object value, int row, int col) {
if (data != null) {
Boolean readOnly = (Boolean) getYProperty().get(YIComponent.READ_ONLY);
if (readOnly == null || !readOnly.booleanValue()) {
Object rowObject = data.get(row);
... | 8 |
@Override
public void salvar(Secao secao) throws LojaDLOException {
if (secao.getId() != null){
Secao secaoFinal = dao.obter(secao.getId());
secaoFinal.setNome(secao.getNome());
secaoFinal.setDescricao(secao.getDescricao());
} else {
if (dao.obter(seca... | 2 |
public XConstPoolImpl(ObjectInput in) throws IOException{
int size = in.readUnsignedShort();
ints = new int[size];
for(int i=0; i<size; i++){
ints[i] = in.readInt();
}
size = in.readUnsignedShort();
longs = new long[size];
for(int i=0; i<size; i++){
longs[i] = in.readLong();
}
size = in.readUnsi... | 8 |
public boolean orMethod(Pair p) {
if (p == null) {
return false;
} else if (p.getCdr().getCar() == null) {// call has no expressions
return false;
}
if (p.getCar() != null && p.getCdr() == null) {// end of expressions
return Boolean.parseBoolean(run(((Pair) p.getCar())).toString());
} else if (Boolea... | 6 |
private void createPlanTickets() throws Exception
{
//Here we are creating plan tickets those can be free sold between any two stations.
int maxStopSeq = this._route.getStops().size() - 1;
StopRangeGroup fullRangeGroup = new StopRangeGroup();
StopRange stopRange = new StopRange();
stopRange.start = 0;... | 1 |
public void SetOnBusTicks(int onBusTicks)
{
//set the tick time person got on the bus
this.onBusTicks = onBusTicks;
} | 0 |
public static void main(String[] args) throws Throwable{
Escaner sc = new Escaner();
for (int c = 0, C = sc.nextInt(); c < C; c++) {
TreeSet<Tablero> noVisitar = new TreeSet<Tablero>();
TreeSet<Tablero> visitados = new TreeSet<Tablero>();
LinkedList<Tablero> cola = new LinkedList<Tablero>();
Tablero tab... | 9 |
public static void setEventDesription(String eventDescription){
EventDescriptionWindow.eventDescription.append(eventDescription);
} | 0 |
public double standardizedAllResponsesMean(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedAllResponsesMean;
} | 2 |
public double get2CoordLat()
{
return markerRect.get2CoordLat();
} | 0 |
public void factory_order() {
draw_.clear();
discard_.clear();
int deck_size = 52;
if (has_jokers_) deck_size = 54;
for (int i = 0; i < size_; ++i) {
Suit temp;
if (i % deck_size < 13) { temp = Suit.SPADES; }
else if (i % deck_size < 26)... | 6 |
public OrderQuestView() {
super();
setLayout(null);
addAnswersTable();
colNum = 0;
rowNum = 0;
// quest = QuestFactory.createQuest(QuestType.ORDERQUEST);
} | 0 |
protected String getDataType()
{
int offset = getOffsetInDataHeaderForDataName();
int maxLength = getDataNameMaxLength();
int nameLength = 0;
// skip first 0
while ( (0 != dataHeader[offset + nameLength]) && (nameLength < maxLength) )
nameLength++;
... | 7 |
public static void main(String[] args) throws InterruptedException, IOException {
String id = args.length == 0 ? "Dummy_"+System.currentTimeMillis() : args[0];
client = new NettyClient(id);
client.setListener(new PrintingListener());
client.connect("localhost", 1883);
beInteractive();
client.disconnect();
... | 1 |
@SuppressWarnings("unchecked")
public T getAdaptiveExtension() {
if (!hasAdaptiveAnnotation()) {
throw new IllegalStateException("Adaptive annotation not found in class : " + iFaceType);
}
Object instance = cachedAdaptiveInstance.get();
if (instance == null) {
synchronized (cachedAdaptiveInstance) {
... | 4 |
public void choix_utilisateur() {
choix = sc.nextLine();
if (choix.equals("")) {
choix = "0";
System.out.println("Choix vide --- QUITTER");
}
System.out.println("------------------------");
int n = Integer.parseInt(choix);
switch(n) {
case 0 :
// QUITTER
System.out.println("Vous ve... | 7 |
public boolean canPlace() {
// This only gets called just before entering the world, so I think I can
// put this here. TODO: Move the location-verification code from the
// TerrainGen class to here? ...Might be neater.
final World world = origin().world ;
for (Tile t : world.tilesIn(area(), f... | 5 |
public static Rule_QUOT parse(ParserContext context)
{
context.push("QUOT");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
int s1... | 7 |
public int fbMethod(int n)
{
if(n ==2 || n == 1)
{
return 1;
}
else
{
return fbMethod(n -2) + fbMethod(n -1);
}
} | 2 |
@Override
public Path shortestPath(Vertex a, Vertex b) {
Hashtable<Vertex,Integer> distance=new Hashtable<Vertex,Integer>();
Hashtable<Vertex,Vertex> path=new Hashtable<Vertex,Vertex>();
Hashtable<Vertex,Integer> heur = new Hashtable<Vertex,Integer>();
Iterator<Vertex> r = new Iterat... | 5 |
public void resizeMovingACorner(int corner, int posX, int posY){
int newWidth, newHeight;
if(corner == Drawable.TOP_LEFT_HAND_CORNER){
newWidth = getWidth() + (getOriginX()-posX);
newHeight = getHeight() + (getOriginY()-posY);
setWidth(newWidth);
setHeigth(newHeight);
this.moveOrigin(posX, posY);
... | 4 |
public void paintComponent(Graphics g){
BufferedImage image = null;
if(data.orientation == 0){
if(focused){
image = topBgImageFocused;
}
else{
image = topBgImage;
}
}
else if(data.orientation == 1){
... | 4 |
public void secondInterval() {
boolean test = false;
if (test || m_test) {
System.out.println("Timer :: secondInterval() BEGIN");
}
try {
Thread.sleep(SECOND);
} catch (Exception e) {
System.out.println("hey");
}
if (test || m_test) {
System.out.println("Timer :: secondInter... | 5 |
@Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if (!Commands.isPlayer(sender)) return false;
Player p = (Player) sender;
if (args.length == 0) {
channel.leaveChannel(p, PlayerChat.plugin.CustomChat.get(p.getName()));
return true;
} else {
ch... | 2 |
public static void main(String ... args) {
File f = new File("src/img/8000bce-600bce/East_Asia");
int length = f.listFiles().length;
for(int i = 0; i < length; ++i) {
System.out.println(f.listFiles()[i].getName());
}
} | 1 |
public List findBySampleCode(Object sampleCode) {
return findByProperty(SAMPLE_CODE, sampleCode);
} | 0 |
public static void main(String[] args) {
/*
Exceptions - Rules to Remember
* A try block may be followed by multiple catch blocks, and the catch blocks may be followed by a single
finally block
* A try block may be followed by either a catch or a finally block... | 1 |
public void receiveFirst() {
System.out.println("-- Bob --");
if (betray) {
System.out.println("ACHTUNG: Betrugsmodus aktiv!!!");
}
// Part 0 ---------------------------------------------------------------
// Hard coded ElGamal
BigInteger El_p_B = new BigInteger("778978896513566371469074... | 8 |
protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... | 9 |
public LinkedList<String> list() {
LinkedList<String> files = new LinkedList<String>();
if(carrierString!=null) {
if(carrierString.length()>0) {
files.add(CARRIER_PATCH.substring(CARRIER_PATCH.lastIndexOf("/")+1));
}
}
if(textColour!=null) {
... | 5 |
public static void writeFile(String fileName) {
if (fileName == null) // Go back to reading standard output
writeStandardOutput();
else {
PrintWriter newout;
try {
newout = new PrintWriter(new FileWriter(fileName));
}
catch (Exception e) {
... | 4 |
private synchronized void receiveAd(Sim_event ev)
{
if (super.reportWriter_ != null) {
super.write("receive router ad from, " +
GridSim.getEntityName(ev.get_src()));
}
// what to do when an ad is received
RIPAdPack ad = (RIPAdPack)ev.get_data();
... | 7 |
private static void writeXDRString(DataOutputStream dos, String s) throws IOException {
dos.writeInt(s.length());
dos.writeBytes(s);
int offset = s.length() % 4;
if (offset != 0) {
for (int i = offset; i < 4; ++i) {
dos.writeByte(0);
}
}
} | 2 |
public boolean equals(final Object o){
if(this == o)
{
return true;
}
if(!(o instanceof Type))
{
return false;
}
Type t = (Type) o;
if(sort != t.sort)
{
return false;
}
if(sort == Type.OBJECT || sort == Type.ARRAY)
{
if(len != t.len)
{
return false;
}
for(int i = off, j = t.off, en... | 8 |
public void abrirExtraccion(int id)
{
ArrayList nom;
String[] enlace;
String[] campos = new String[]{"id_enl_audio","id_proyecto","nombre_enlace"};
nom = extraccion.busquedaBD("enlaces_audio", "indice_enlaces_audioid_proyecto", campos, id);
for(int i=0;i<nom.... | 7 |
public static void main(String[] args)
{
List<Integer> numbers = new ArrayList<Integer>();
for (int i = 1; i <= 49; i++)
numbers.add(i);
Collections.shuffle(numbers);
List<Integer> winningCombination = numbers.subList(0, 6);
Collections.sort(winningCombination);
System.ou... | 1 |
private boolean doubleMillDetection(GameBoard gamestate, GamePiece doubleMillPosition, Team doubleMillTeam){
if (doubleMillPosition.getP() % 2 == 1) { return false;} //double mill detection in this method does not consider the 4 middle square double mills.
Team emptyTeam = new Team();
emptyTeam.setTeamSymb... | 7 |
public static void main(String[] args) {
// TODO code application logic here
boolean validar=true;
int valor1=0;
int valor2=0;
double resultado;
char continuar;
int opcion=0;
Scanner teclado=new Scanner(System.in);
Operaciones oOp... | 9 |
public static void main(String[] args) throws InterruptedException {
Semaphore s = new Semaphore(10);
s.acquire(); // ++
s.release(); // --
List<String> list = Collections.synchronizedList(new ArrayList<String>());
Map<String, String> map1 = Collections.synchronizedMap(new HashMap<String,String>()... | 0 |
public String getResourceTotal()
{
int cpu_count = 0;
long memoryAvailable = 0;
long diskAvailable = 0;
try
{
List<String> regionList = ControllerEngine.gdb.getNodeList(null,null,null);
//Map<String,Map<String,String>> ahm = new HashMap<String,Map<String,String>>();
//System.out.println("Region C... | 7 |
public final Object getSource() {
return source;
} | 0 |
private static Map<String, String> loadSeedProducts(String seedFileName) throws Exception {
int totalRows = 0, badUPCCount = 0, badProductIdCount = 0;
Map<String, String> products = new LinkedHashMap<String, String>();
XSSFWorkbook wb = readFile(seedFileName);
for (int k = 0; k < 1; k++) {
XSSFSheet sheet... | 6 |
public float getX(float percent) {
// No movement
if(pattern[0] == 0) { return (float)(0+offset[0]); }
// left to right
if(pattern[0] == 1) { return (float)(percent*600.0-50.0+offset[0]); }
// Right to left
if(pattern[0] == 2) { return (float)(percent*-600.0+50.0+offset[0]); }
// donno
/... | 3 |
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.