text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public byte[] save(JoeTree tree, DocumentInfo docInfo) {
StringBuffer buf = prepareFile(tree, docInfo);
try {
return buf.toString().getBytes(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_ENCODING_TYPE));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
... | 1 |
private String randomColorGenerator(){
int random = (int) (Math.random() * 8);
String selectedColor;
switch (random) {
case 1:
selectedColor = SELECT_RED;
break;
case 2:
selectedColor = SELECT_GREEN;
break;
case 3:
selectedColor = SELECT_BLUE;
break;
case 4:
selectedColor = SELECT_Y... | 8 |
public int searchType(String type){
for (int i = 0; i<treatmentMeta.size(); i++){
if (type.equals(treatmentMeta.get(i).getType()))
return i;
}
return -1;
} | 2 |
private synchronized void log_line(String user, String line) {
if (ms.logusrs == null && logfd != null) return;
for (int i = 0; i < ms.logusrs.length; i++) {
if (ms.logusrs[i].equals(user)) {
try {
logfd.write((VT100.strip_all(line) + "\n").getBytes());
} catch (IOException e) {
e.printStackTra... | 7 |
public static Object setField(Object o, Field f, String v) throws IllegalArgumentException, IllegalAccessException {
if(f.getType().equals(boolean.class)) {
f.setBoolean(o, Boolean.parseBoolean(v));
} else if (f.getType().equals(byte.class)) {
f.setByte(o, Byte.parseByte(v));
} else if (f.getType().equals(c... | 8 |
public DigestMethodType createDigestMethodType() {
return new DigestMethodType();
} | 0 |
public void upToNext(){
try {
if(allowedValue == null){
int n = this.getValue();
if(specialValue != null){
for(int i=0; i<specialValue.length; i++){
if(n < specialValue[i] && specialValue[i] % increment == 0){
setNormal();
setText(Integer.toString(specialValue[i]));
return;
}
... | 7 |
protected void readImage() {
ix = readShort(); // (sub)image position & size
iy = readShort();
iw = readShort();
ih = readShort();
int packed = read();
lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
interlace = (packed & 0x40) != 0; // 2 - inte... | 7 |
private static final void method1546(int[] is, int[] is_1_, int[] is_2_,
byte[] is_3_, int i, int i_4_,
int i_5_) {
int i_6_ = 0;
for (int i_7_ = i; i_7_ <= i_4_; i_7_++) {
for (int i_8_ = 0; i_8_ < i_5_; i_8_++) {
if (is_3_[i_8_] == i_7_) {
is_2_[i_6_] = i_8_;
i_6_++;
}
}
}
fo... | 9 |
protected void checkEntry(Entry<K, V> e) throws InvalidEntryException {
if (e == null || !(e instanceof BSTEntry)) {
throw new InvalidEntryException("Invalid entry");
}
} | 2 |
private void showNetworkMenu(Graphics2D g2, Rectangle d, Font font) {
// Draw subtitle
Font fontC = new Font(FONT_NAME, Font.BOLD, (int) (0.08 * height)); // scale 40/500
Rectangle ds = fontC.getStringBounds("Juego en Red", g2.getFontRenderContext()).getBounds();
g2.setFont(fontC);
... | 4 |
public static void main(String[] args) {
int i = 0;
int sum = 0;
while( i<=100 ) {
sum = sum + i;
i++;
}
System.out.println("sum = " + sum);
////////////////////////////////////////
i = 0;
sum = 0;
while( i<=100 ) {
if( i%2 == 0)
sum = sum + i;
i++;
}
System... | 5 |
public static int spawn_in_out_err(String command, String infile, String outfile, String errfile) {
Process p;
try {
p = Runtime.getRuntime().exec(command);
} catch (IOException e) {
return -1;
}
try {
if (infile != null) {
(new Xfer(new FileInputStream(infile), p.getOutputStream())).start();
... | 6 |
public void draw(Graphics g, PositionTransformation pt, boolean highlight){
super.draw(g, pt, highlight);
for(Timer t : this.getTimers()) {
if(t instanceof SmsTimer) {
SmsTimer st = (SmsTimer) t;
if(st.enabled) {
pt.translateToGUIPosition(this.getPosition());
int fromX = pt.guiX, fromY = pt.gui... | 3 |
private static boolean isBigger(Context cx, Scriptable scope,
Object x, Object y,
Object cmp, Object[] cmpBuf)
{
if (cmp == null) {
if (cmpBuf != null) Kit.codeBug();
} else {
if (cmpBuf == null || cmpBuf... | 7 |
public void guiActionPerformed(int elementId, int action) {
if (elementId == list.getId()) {
switch (action) {
case 0:
System.out.println("Reload");
last();
break;
case 1:
System.out.println("Main Menu");
last();
game.showGui(new GuiMainMenu(game, Game.WIDTH, Game.HEIGHT));
break;... | 4 |
@Test
public void testSetQueueTimeoutErrorIndividual() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSetQueueTimeoutErrorIndividual -----");
String client_hash = "";
String client_hash2 = "";
try {
server2.setUseMessageQueues(true);
} catch (TimeoutException e... | 4 |
private void transfer(Entry<V>[] newTable) {
Entry[] src = this.table;
int newCapacity = newTable.length;
for (int j = 0; j < src.length; j++) {
Entry e = src[j];
if (e != null) {
src[j] = null;
do {
Entry next = e.next;
int i = indexFor(e.hash, newCapacity);
... | 3 |
@Override
protected void reactPressed(MouseEvent event) {
ProgramState curr = StateMachine.getState();
if (curr == ProgramState.EDITING || curr == ProgramState.SONG_PLAYING)
saveSong();
else if (curr == ProgramState.ARR_EDITING
|| curr == ProgramState.ARR_PLAYING)... | 4 |
public static Cons javaTranslateCodeSignature(Cons signature) {
{ Cons translatedreturntypes = Stella.NIL;
Cons translatedparametertypes = Stella.NIL;
{ Stella_Object returntype = null;
Cons iter000 = ((Cons)(signature.value));
Cons collect000 = null;
for (;!(iter000 == Stella.... | 6 |
void parseEntityDecl() throws java.lang.Exception
{
char c;
boolean peFlag = false;
String name, value, notationName, ids[];
// Check for a parameter entity.
requireWhitespace();
if (tryRead('%')) {
peFlag = true;
requireWhitespace();
... | 6 |
public void injectMembers(T t) {
try {
field.set(t, logger);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | 1 |
public static void main(String[] args) throws Exception {
final VirtualSocketAddress serverAddr;
final VirtualSocketAddress clientAddr;
serverAddr = new VirtualSocketAddress("localhost", 50200);
clientAddr = new VirtualSocketAddress("localhost", 50201);
if(virtual) {
host = new VirtualHost("localhost"... | 9 |
public static Console create() {
if(c == null) {
c = new Console();
c.addScreenItem(new TextFieldInput());
}
return c;
} | 1 |
public void shiftMainHor(String face) {
main_grid.setColor(color_bg);
if(face.equals("R")) {
shiftLeft(1);
if(user_move) {addMove(26);} //Cancel out moves as just a view rotation
shiftLeft(2);
if(user_move) {addMove(36);} //Cancel out moves as just a view rotation
shiftLeft(3);
i... | 7 |
public void setImgPath_SliderMidBtn(Path img, Imagetype type) {
switch (type) {
case DEFAULT:
this.imgSliderMidBtn_Def = handleImage(img, UIResNumbers.SLIDER_MID_DEF.getNum());
if (this.imgSliderMidBtn_Def == null) {
this.imgSliderMidBtn_Def = UIDe... | 6 |
public static List<CustomerGroup> formatOutputs(JSONArray results) {
final List<CustomerGroup> ret = new ArrayList<CustomerGroup>();
for (int i = 0; i < results.length(); i++) {
JSONObject r = null;
if (results.get(i) instanceof JSONObject)
r = (JSONObject) results.get(i);
if (r != null) {
final C... | 4 |
public void setElectionColumns3() {
if( chckbxSubstituteColumns.isSelected()) {
chckbxSubstituteColumns.doClick();
}
for( VTD b : featureCollection.vtds) {
b.resetOutcomes();
b.has_election_results = true;
}
for( VTD f : featureCollection.features) {
f.resetOutcomes();
double[] dd = new d... | 9 |
@RequestMapping(value = {"/CuentaBancaria/{idCuentaBancaria}"}, method = RequestMethod.DELETE)
public void delete(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idCuentaBancaria") int idCuentaBancaria) {
try {
noCache(httpServletResponse);
cue... | 2 |
public static double getDice(String input1, String input2) {
// Verifying the input:
if (input1 == null || input2 == null)
return 0;
// Quick check to catch identical objects:
if (input1 == input2)
return 1;
// avoid exception for single character searche... | 8 |
public void destroy()
{
int size = fleet.size();
for(int i = 0; i < size; i++)
fleet.remove(0);
} | 1 |
private boolean isKiosk(final Block block) {
if (!Kiosk.SIGN_BLOCKS.contains(block.getTypeId())) return false;
final Sign state = (Sign) block.getState();
for (final Kiosk kiosk : this.attendant.getKiosks())
if (kiosk.hasTitle(state)) return true;
return false;
} | 3 |
public void keyPressed(KeyEvent e)
{
int keycode = e.getKeyCode();
System.out.println("key pressed: ");
switch(keycode)
{
case KeyEvent.VK_UP:
System.out.println("up");
Sounds.move.play();
ShipShopEnginesMenu.moveSelectionOvalUp();
break;
case KeyEvent.VK_DOWN:
System.out.println("down... | 6 |
public static int getTwoWordFreq(Term from , Term to) {
if(from.getMaxPath().getTermNature().frequency==1||
to.getMaxPath().getTermNature().frequency==1){
return 0 ;
}
WoodInterface branch = FOREST ;
String content = from.getName() ;
for (int i = 0; i < content.length(); i++) {
branch = branch.get(c... | 8 |
public Komputer wydajKomputer(String model){
Komputer komputer = zlozKomputer(model);
komputer.instalowanieOprogramowania();
komputer.pakowanie();
komputer.sprzedawanie();
return komputer;
} | 0 |
public CompareToIntOperator(Type type, boolean greaterOnNaN) {
super(Type.tInt, 0);
compareType = type;
this.allowsNaN = (type == Type.tFloat || type == Type.tDouble);
this.greaterOnNaN = greaterOnNaN;
initOperands(2);
} | 1 |
public char read () throws IOException
{
while (true)
{
int c = In.read();
if (c == -1 || c == 255 && lastcommand == 255)
{
Dump.println("Received character " + c);
throw new IOException();
}
lastcommand = c;
if (c == 10)
{
if (lastcr == 13)
{
lastcr = 0;
continue;
... | 8 |
protected mxPoint getOriginForCell(Object cell)
{
mxPoint result = origins.get(cell);
if (result == null)
{
mxGraph graph = graphComponent.getGraph();
if (cell != null)
{
result = new mxPoint(getOriginForCell(graph.getModel()
.getParent(cell)));
mxGeometry geo = graph.getCellGeometry(cel... | 4 |
@Override
public void run() {
String responseStr = null;
String strInputMesg = null;
POP3CommandHandler ch = null;
// 初始化pop3 session
initSession();
// pop3服务线程正常启动
sendResponse("+OK pop3 server is ready");
getLogger().info("pop3:建立一个连接" + "(" + pop3ID + "/" + remoteHost + "/" + remoteIP + ")");
//... | 8 |
static void handleTCP(Socket clientSocket) throws IOException {
//get socket
Socket connectionSocket = clientSocket;
//input stream from client
BufferedReader inFromClient = new BufferedReader(
new InputStreamReader(connectionSocket.getInputStream()));
//output st... | 0 |
private void FFT_meth(int dir, double x[], double y[], int n)
{
int nn = 1 << n;
int i2 = nn >> 1;
for (int i = 0, j = 0; i < nn - 1; i += 1)
{
if (i < j)
{
double tx = x[i];
double ty = y[i];
x[i] = x[j];
y[i] = y[j];
x[j] = tx;
y[j] = ty;
}
int k = i2;
while (k <= j)
... | 9 |
private boolean roleAssignedInProduction(Production production, Person person) {
for (Role role : production.getPlay().getRoles()) {
if (role.getCast() != null) {
if (role.getCast().contains(person)) {
return true;
}
}
}
for (Role role : production.getNonActorRoles()) {
if (role.getCast() !=... | 6 |
public void setLogLevel(final String name) {
Level level;
try { level = Level.parse(name); } catch (final Exception e) {
level = CustomPlugin.DEFAULT_LOG;
this.getLogger().warning("Log level defaulted to " + level.getName() + "; Unrecognized java.util.logging.Level: " + name + ";... | 3 |
private StringParameter buildOption(Object object, Container location, IXMLElement node, final Runnable onUpdate) throws GUIBuilderException {
// TODO Auto-generated method stub
String name=null;
LinkedList options = new LinkedList();
Enumeration children = node.enumerateChildren();
while(children.hasMoreElem... | 7 |
@Override
public void enterInput(Board board) {
input = scanner.nextLine();
boardArray = getBoardState(board);
int x = 0, y = 0;
while (true) {
if(input.length()!=3) {
System.out.println("The board Position is already occupied or it is invalid . Please e... | 7 |
public void doAction(){
if (isUserResponded){
String[] oldShopList = GasDecisionProcess.getShopListCopy();
GasDecisionProcess.resetShopList();
ArrayList<String> ans = new ArrayList<String>(4);
if (isChevron) {
GasDecisionProcess.addToShopList(gasS... | 6 |
public static Level getNextLevel(Global global){
int index=0;
for (index=0; index<global.getLevels().size(); index++){
Level level = global.getLevels().get(index);
if (level.equals(global.getCurrent().getCurrentLevel())){
break;
}
}
Level level = null;
if (index==0) level = InitLevel1.loadLeve... | 6 |
@Override
public void configure(Binder binder) {
loadProperties();
Names.bindProperties(binder, properties);
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> already <S... | 8 |
public static int doc2pdf(String srcPath, String destPath) {
File file = new File(srcPath);
if (file.exists()) {
ComThread.InitMTA();
ActiveXComponent word = null;
try {
word = new ActiveXComponent("Word.Application");
word.setProperty("Visible", false);
word.setProperty("DisplayAlerts", DISPLA... | 4 |
private void learningFromDBAction() throws SocketException, IOException, ClassNotFoundException {
int k = 0;
String tableName = "";
String result = "";
tableName = this.panelDB.tableText.getText();
if(tableName.equals("")){
JOptionPane.showMessageDialog(this, "Errore! - Inserire il nome della tabe... | 5 |
public TetrisPanel()
{
setFocusable(false);
addKeyListener(new KeyListener()
{
public void keyReleased(KeyEvent e) {}
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_LEFT)
move(-1);
else if (e.getKeyCode() == KeyEvent.VK_RIGHT)
move(1);
else if (e.getKeyCode(... | 6 |
public void init(int[] s, int[] o)
{
int len = start.length;
this.rstart = new int[len];
this.roff = new int[len];
for(int i = 0 ; i < len; i++)
{
this.rstart[i] = Math.max(s[i],start[i]);
this.roff[i] = Math.min(s[i]+o[i], start[i]+shape[i]);
this.roff[i] -= this.rstart[i];
}
this.fjump = ne... | 3 |
public static void addSchool() {
System.out.print("Connection add school ... ");
//Connexion à la base
BaseSetting bs = new BaseSetting();
if (bs.testerConnexion()) {
System.out.println("success");
try (Scanner sc = new Scanner(System.in)) {
... | 6 |
public void buildAndAddMeal(String name, double calories, double protein) {
SimpleMealDaoImpl dao = getSimpleMealDaoImpl();
Session session = null;
Transaction tx = null;
SimpleMeal newMeal = new SimpleMeal();
newMeal.setName(name);
newMeal.setCalories(calories);
... | 4 |
int compareto(int[] a, int[] b) {
if (a.length > b.length)
return 1;
if (b.length > a.length)
return -1;
for (int i = 0; i < a.length; i++) {
if (a[i] > b[i])
return 1;
if (b[i] > a[i])
return -1;
}
... | 5 |
protected final JobSchedulerBuilder scheduleJob( Class<? extends Job> jobClass )
{
checkNotNull( jobClass, "Argument 'jobClass' must be not null." );
JobSchedulerBuilder builder = new JobSchedulerBuilder( jobClass );
if ( jobClass.isAnnotationPresent( Scheduled.class ) )
{
... | 4 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
JSONObject jb = new JSONObject();
String userId = request.getParameter("userId");
String dateTimeInMillis = request.getParameter("dateTimeInMillis");
dateToC... | 3 |
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
try {
/*
* Validity check
*/
if (!valid()) {
return;
}
DateFormatter df = new DateFormatter(new SimpleDateFormat... | 6 |
public static void testSshConsole()
{
SshConsole ssh = new SshConsole();
ssh.init( "10.124.115.213", SshConsole.DEFAULT_PORT, "root", "cscenter" );
ArrayList< String > commands = new ArrayList< String >();
ArrayList< String > returns = null;
commands.add( "echo 'command 1'" );
commands.add( "echo 'command ... | 4 |
private void handleJoin() throws IOException{
String WarIDMsg,ArmyNameMsg,SizeMsg;
List<UnitAndPlace> units = new ArrayList<UnitAndPlace>();
WarIDMsg = br.readLine();
ArmyNameMsg = br.readLine();
SizeMsg = br.readLine();
StringTokenizer warIDTokenizer = new StringTokenizer(WarIDMsg);
StringTokenizer armyN... | 8 |
public static int getIntProperty(String key) {
String val = getProperty(key);
if (val == null && PROP_PORT.equals(key)) {
return 80;
}
if (val == null) {
throw new IllegalArgumentException(
"getIntProperty: " + key + " does not exist");
}
return Integer.parseInt(val);
} | 3 |
public void paint(Graphics g)
{
super.paint(g);
Graphics2D g2 = (Graphics2D) g;
Dimension d = getSize();
g2.setPaint(Color.red);
int maxDepth = 0;
for(int i = 0; i < nodes.size();i++)
{
if( nodes.get(i).getLevel() > maxDepth)
{
maxDepth = nodes.get(i).getLevel();
}
}... | 7 |
private int nextNBits(int bitsToGet) {
byte b;
byte next;
byte next2next;
int l = data.length - 1;
int bp = this.bytePointer;
if (fillOrder == 1) {
b = data[bp];
if (bp == l) {
next = 0x00;
next2next = 0x00;
} else if ((bp + 1) == l) {
next = data[bp + 1];
next2next = 0x00;
} e... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final DateRange other = (DateRange) obj;
if (endDate == null) {
if (other... | 9 |
public String getItemcode() {
return this.itemcode;
} | 0 |
public void addLinha(int numLinha) {
int temIgual = 0;
for (Integer numeroDasLinha : numeroDasLinhas) {
if (numeroDasLinha == numLinha) {
temIgual++;
}
}
if (temIgual == 0) {
this.numeroDasLinhas.add(numLinha);
}
} | 3 |
protected void initializeCommandTypeInfo()
{
commandTypes = new Integer[] {
new Integer(EVENT_COMMAND__None), // 0;
new Integer(EVENT_COMMAND__EndEvent), // 1 - EVENT_COMMAND__STOP_PROCESSING
new Integer(EVENT_COMMAND__TownEvent), // 2 - EVENT_COMMAND__IDENTIT... | 7 |
public void method283(int uid, int y, int orientation2, int off, int arg4, int z, Entity entity, int x, byte objectConfig, int arg9, int orientation1) {
if (entity == null) {
return;
}
WallDecoration wallDecoration = new WallDecoration();
wallDecoration.uid = uid;
wallDecoration.objectConfig = objectConfig... | 3 |
@Override
public void add(String word) {
Integer entryCount = storage.get(word) == null ? 0 : storage.get(word);
storage.put(word, ++entryCount);
} | 1 |
public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
switch (opcode) {
case Opcodes.GETSTATIC:
getstatic(owner, name, desc);
break;
case Opcodes.PUTSTATIC:
putstatic(owner, name, desc);
break;
case Opcodes.GETFIELD:
getfield(owner, name, desc... | 4 |
@Override
public void paintComponent(Graphics graphic) {
super.paintComponent(graphic);
Graphics g = backBuffer.getGraphics();
g.setColor(Color.GREEN);
g.fillRect(0, 0, GameData.MINIMAP_WIDTH, GameData.MINIMAP_HEIGTH);
//System.out.println("currentWindowX "+currentWindowX+" c... | 5 |
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
int targetLayer;
String propFunc;
String actFunc;
double[] actParam = new double[5];
try{
//throws NumberFormatException if not a Number.
targetLayer = Integer.parseI... | 7 |
public void build() {
try {
//create package info
PackageInfo pInfo;
PackageName pName = new PackageName(id);
PackageVersion pVer = new PackageVersion(version);
PackageDescription pDesc = new PackageDescription(name);
PackageMaintainer pMai... | 9 |
public Object decodeToObject( String encodedObject )
{
byte[] objBytes = decode( encodedObject );
java.io.ByteArrayInputStream bais = null;
java.io.ObjectInputStream ois = null;
try
{
bais = new java.io.ByteArrayInputStream( objBytes );
... | 4 |
public void stopFadeIn() {
if(fadeIn != null) {
fadeIn.fadeStop();
fadeIn.interrupt();
fadeIn = null;
}
} | 1 |
private void setExamListPanel() {
getExams();
isPublicButtons = new JButton[exams.size()];
examSelected = new JCheckBox[exams.size()];
examLabels = new JLabel[exams.size()];
for (int i = 1; i < exams.size() + 1; i++) {
sols.Model.Exam exam = exams.get(i - 1);
... | 7 |
public Map<K,V> createMap() {
Class<? extends Map> mapClass = this.model.getClass();
try {
return mapClass.newInstance();
} catch( InstantiationException e ) {
throw new RuntimeException( "Cannot create a new instance from class "+mapClass.getName()+": " + e.getMessage(),
e
);
} catch( Ill... | 3 |
void checkURI(URI uri) {
if (!uri.isAbsolute()) {
throw new IllegalArgumentException(uri.toString());
} else if (!uri.getRawSchemeSpecificPart().startsWith("/")) {
throw new IllegalArgumentException(uri.toString());
}
String temp = uri.getScheme();
if (temp == null || !temp.equals("file")) {
throw n... | 9 |
@Override
protected void process_activate_read ()
{
if (!in_active && (state == State.active || state == State.pending)) {
in_active = true;
sink.read_activated (this);
}
} | 3 |
final String parseConfig(final StringBuilder line, final String section) {
int idx = 0;
if (line.length() == 0) {
return section;
}
while (line.charAt(idx) == ' ') {
++idx;
if (idx == line.length()) {
return section;
}
}
if (line.charAt(idx) == '#') {
// comment -> ignore
line.setLengt... | 9 |
private void btnInsertarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsertarActionPerformed
try{
int numero = Integer.parseInt(txt1.getText());
if(numero>0){
Insertar insertar = new Insertar();
Statement consulta = conexion();
... | 4 |
@Override
public ObjectArray<E> subArray(final long pos, final long len) {
if(pos < 0 || len < 0 || len > size() - pos) throw new IndexOutOfBoundsException();
if(len == 0) return empty();
if(len == size()) return this;
return new ObjectArray<E>(root.slice(pos, len).getTree());
} | 5 |
@Override
public void executeMsg(Environmental myHost, CMMsg msg)
{
super.executeMsg(myHost, msg);
if(canBeUninvoked() && (invoker()!=null) && (!msg.source().isMonster()) && (msg.source()!=invoker()) && (msg.sourceMinor()==CMMsg.TYP_ENTER))
{
final Physical affected=super.affected;
if(affected != null)
... | 8 |
@Override
public int eval(Critter c) {
// TODO implement me!
// returns the boolean value of this expression for Critter c
int value;
if (op.toString().equals("+"))
value = left.eval(c) + right.eval(c);
else if (op.toString().equals("-"))
value = left.eval(c) - right.eval(... | 7 |
public void draw(Graphics2D g) {
g.drawImage(image, (int)x, (int)y, null);
if(x < 0) {
g.drawImage(image, (int)x + GamePanel.WIDTH, (int)y, null);
}
if(x > 0) {
g.drawImage(image, (int)x - GamePanel.WIDTH, (int)y, null);
}
if(y < 0) {
g.drawImage(image, (int)x, (int)y + GamePanel.HEIGHT, null... | 4 |
public void resizeSplit(){
//super.setSize(width, height);
if(myObjects != null && this.tabbed != null){
if(myObjects.size() > 0 && this.tabbed.getTabCount() == 1){
Component cur = this.getActive();
if(cur instanceof MultiplePane){
MultiplePane mult = (MultiplePane)cur;
mult.mySplit.setDividerL... | 5 |
public boolean isOptOut() {
synchronized (this.optOutLock) {
try {
// Reload the metrics file
this.configuration.load(this.getConfigFile());
}
catch (IOException ex) {
if (this.debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
}
catch (... | 4 |
int readVInt() throws IOException {
int i, o = 0, vint = 0;
do {
i = super.read();
if (i < 0) {
throw new EOFException();
}
i &= 0xff;
vint += (i & 0x7f) << (o++ * 7);
} while ((i & 0x80) == 0x80);
return vint;
} | 2 |
private void startSchemaElement(String name, Attributes attrs) {
// if isNewSchemaElement is true tag is new element definition
boolean isNewSchemaDefault = false;
// find out if tag is new element definition
if (name == "xs:element") {
defStack.push(attrs.getValue(0));
if (1 == attrs.getLength()) {
i... | 8 |
public static void startupWebtoolsSunSystem() {
synchronized (Stella.$BOOTSTRAP_LOCK$) {
if (Stella.currentStartupTimePhaseP(0)) {
if (!(Stella.systemStartedUpP("webtools", "/HTTP/WEBTOOLS"))) {
edu.isi.webtools.StartupWebtoolsSystem.startupWebtoolsSystem();
}
}
if (Stell... | 9 |
private void saveSpritesheet() {
File file;
int i = 0;
while(true) {
file = new File(App.modelDir, "out/spritesheet"+(i==0?"":"-"+i)+".png");
if(!file.exists()) break;
i++;
}
// save to disk
try {
ImageIO.write(image, "PNG", file);
} catch (IOException e) {
Log.e("Failed to s... | 4 |
private void EscolaSelecionada_LabelPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_EscolaSelecionada_LabelPropertyChange
if(EscolaSelecionada_Label.getText().equals("nenhuma")) {
for(Component component: DadosCampo_Panel.getComponents())
component.setEnabled(fa... | 5 |
public static void upgradePowers(){
String input = readLine("Would you like to upgrade your powers?(y/n)");
while(!input.equals("n")){
System.out.println("You have " + playerGems + " gems\nChoose one of the following things to upgrade(Or \"n\" to exit)");
int startingHealthCost... | 8 |
public static void generateFile(File outputDir, Version version, int rev, String buildDate)
{
String path = PACKAGE_NAME.replaceAll("\\.", "/");
File pkgdir = new File(outputDir, path);
if (!pkgdir.exists()) {
// create the pkg directory
boolean ret = pkgdir.mkdirs();... | 8 |
public void setValue(double pInputValue)
{
inputValue = pInputValue;
if (inputValue < minValue) {
inputValue = minValue;
}
if (inputValue > maxValue) {
inputValue = maxValue;
}
highestLitLedIndex = (int)((inputValue - minValue) / stepValue) - 1;
if (h... | 4 |
public <T> Integer save(T obj) throws DaoException {
try {
return (Integer) sessionFactory.getCurrentSession().save(obj);
} catch (HibernateException e) {
throw new DaoException();
}
} | 1 |
protected Boolean navalTransport(Territory territory, List<Territory> alredyCheck){
alredyCheck.add(this);
if(neighbors.contains(territory)){
return true;
}else{
for(Territory terr : neighbors){
if(terr instanceof Water && terr.owner==this.owner && !alredyCheck.contains(terr)){
if(terr.navalTranspo... | 6 |
public String suggestions(String s, int caretPos) {
String toReturn = "";
SuperString str = findWordAndPos(s, caretPos);
if (str != null) {
s = str.string;
toReturn = "Sugestions for " + s + ": ";
ArrayList<String> posibilities = trie.getMutations(s);
if (posibilities.size() == 0) {
toReturn += "N... | 6 |
@EventHandler
public void handleFrameInteraction(PlayerInteractEntityEvent event) {
Entity entity = event.getRightClicked();
if (entity instanceof ItemFrame) {
User user = EdgeCoreAPI.userAPI().getUser(event.getPlayer().getName());
if (user != null) {
if (!WorldManager.getInstance().is... | 4 |
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.