text stringlengths 14 410k | label int32 0 9 |
|---|---|
private int locateSubToken( int mainTokenIndex,
String tokenB,
boolean caseSensitive ) {
List<List<String>> sublist = this.params.get( mainTokenIndex );
for( int i = 0; i < sublist.size(); i++ ) {
List<String> subsublist = sublist.get(i);
//System.out.println( "subsublist["+mainTokenIndex+"]["+i+... | 6 |
public static boolean isInBorder(Location center, Location l, int range) {
int x = center.getBlockX(), z = center.getBlockZ();
int x1 = l.getBlockX(), z1 = l.getBlockZ();
if (x1 >= (x + range) || z1 >= (z + range) || x1 <= (x - range) || z1 <= (z - range)) {
return false;
}
... | 4 |
void readFrequencies() throws Exception {
int totalFrequencyCount = 0;
while (true) {
discardLinesUntilNonBlank();
int lineBaseFreqCount = totalFrequencyCount;
ichNextParse = 16;
int lineFreqCount;
for (lineFreqCount = 0; lineFreqCount < 3; ++lineFreqCount) {
float frequen... | 7 |
void showdetail() {
int max =0;
ArrayList<Integer[]> scorelist0 = new ArrayList<Integer[]>();
ArrayList<Integer[]> scorelist1 = new ArrayList<Integer[]>();
for (int i=0; i<size*size-1; i++) {
if (grid[i].value>max) {
max = grid[i].value;
... | 9 |
public boolean hasError() { return error; } // Used to check if there were errors parsing the file | 0 |
public _5_Turtle(String name, Formatter f) {
this.name = name;
this.f = f;
} | 0 |
protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
{
super.renderEquippedItems(par1EntityLiving, par2);
ItemStack var3 = par1EntityLiving.getHeldItem();
if (var3 != null)
{
GL11.glPushMatrix();
this.modelBipedMain.bipedRightArm.post... | 9 |
public static void insertAboveText(Node node, JoeTree tree, OutlineLayoutManager layout) {
// Abort if node is not editable
if (!node.isEditable()) {
return;
}
Node newNode = new NodeImpl(tree,"");
int newNodeIndex = node.currentIndex();
Node newNodeParent = node.getParent();
newNode.setDepth(nod... | 1 |
public void addPoliceAtCanvasLocation(int canvasX, int canvasY)
{
// FIRST MAKE SURE THE ENTIRE INTERSECTION IS INSIDE THE LEVEL
if ((canvasX - 17.5) < 0) return;
if ((canvasY - 17.5) < 0) return;
if ((canvasX + 17.5) > viewport.levelWidth) return;
if ((canvasY + 17.5) > view... | 6 |
public final static boolean isWebAddress(String str)
{
for (String prefix : Arrays.asList(WEB_PREFIX))
{
if (str != null && str.length() >= prefix.length()
&& str.toLowerCase().startsWith(prefix))
{
return true;
}
}
return false;
} | 4 |
@Test
public void testZipUnzipFolderContent(){
try {
File testFolder = new File(this.getClass().getResource("/ziptest").toURI());
String testZipFilePath = testFolder.getParent()+ "/okapi.zip";
//Zip the content folder
assertTrue(ZipUtils.zipFolder(testFolder, testZipFilePath));
File zippedFile = new F... | 3 |
private final void method3712(Class318_Sub9_Sub2 class318_sub9_sub2, int i,
int i_91_, int i_92_, int i_93_) {
int i_94_ = ((Class318_Sub9_Sub2) class318_sub9_sub2).anInt8792;
int i_95_ = i_93_;
i_93_ <<= 1;
if (i_94_ == -1)
method3723(i, i_91_, i_92_, i_95_,
((Class318_Sub9_Sub2) class318_sub9_... | 5 |
public <T2> Query<T2> ofType(final Class<T2> clazz) throws Exception
{
return this.where(new Predicate<T>(){
@Override
public boolean evaluate(T obj) throws Exception {
return clazz.isInstance(obj);
}}).cast(clazz);
} | 0 |
double rate(Board board)
{
//count the holes and sum up the heights
int mostHolesInAnyColumn = 0;
for(int x=0; x<board.getWidth(); x++)
{
final int colHeight = board.getColumnHeight(x);
int y = colHeight -2;
int holes = 0;
... | 4 |
public void protokol(ServerClient activeclient) throws IOException
{
boolean shutdown = false;
/** Determinates if the Client wants to disconnect */
while (!shutdown)
{
Msg nextCMD = activeclient.getSt().readMsg(activeclient.getClientsocket(), activeclient.getIn());
if (nextCMD.getId() == 'b') //// Bro... | 9 |
public void save(File target) throws IOException, Exception {
try {
connection.close();
} catch(Exception e) {
throw new Exception(Localization.getInstance().get("databaseReleaseExceptionMessage") + " " + e);
}
if (Files.exists(target.toPath())) {
try {
Files.delete(target.toPath());
} catch (IO... | 5 |
@Basic
@Column(name = "PRP_CANTIDAD")
public Integer getPrpCantidad() {
return prpCantidad;
} | 0 |
@Override
public boolean riseLotPrice(Lot lot, User user, int newPrice) {
long requestId = this.findFreeKey(this.riseLotPriceStatuses);
MsgRiseLotPrice msg = new MsgRiseLotPrice(this.address, this.ms.getAddressService().getAccountService(),requestId,lot,user,newPrice);
this.riseLotPriceStatu... | 3 |
public static int getPlayersCountInRadius(int range, L2Character npc, boolean invisible)
{
int count = 0;
for (L2PcInstance player : npc.getKnownList().getKnownType(L2PcInstance.class))
{
if (player.isDead())
continue;
if (!invisible && player.getAppearance().getInvisible())
continue;
if... | 5 |
private void addc(boolean left, String c)
{
int l = value.length();
int n = fsize-l;
if(n>0)
{
String s = new String(new char[n]).replace("\0", c);
value = (left ? s+value : value+s);
}
else if(n<0) value=value.substring(-n);
} | 3 |
public int fightAgainst(SunburnShip enemy) {
int roundCount = 1;
Logger logger = Logger.getLogger(SunburnShip.class.getName());
while(!isDestroyed() && !enemy.isDestroyed() && drivesLeft() && enemy.drivesLeft()) {
if(roundCount > 100) {
logger.info("... | 8 |
@Override
public Champion getElementAt (int i) {
if (getSize() == 0) return null;
return (filter != null) ?
source.getElementAt (displayedElements.get (i))
: source.getElementAt (i);
} | 2 |
private boolean loop(){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(socket.isConnected()){
return true;
}else{
return false;
}
} | 6 |
@Override
public void connecter() throws ClassNotFoundException, SQLException {
Class.forName(this.getPiloteJdbc());
setConnexion(DriverManager.getConnection(this.getProtocoleJdbc() + this.getServeurBd() + this.getNomBd(), this.getLoginSgbd(), this.getMdpSgbd()));
getConnexion().setAutoCommi... | 0 |
public void setJointAnimation(
String jointName, String animName, float progress
) {
final int jID = model.jointID(jointName) ;
if (jID == -1) return ;// I.complain("No Such Joint: "+jointName) ;
final Model.AnimRange range = rangeFor(animName) ;
if (range == null) return ;// I.complain("No such a... | 4 |
private JTable buildTable() {
String[] columnNames = { "Count #", "min [s]", "max [s]", "total [s]",
"avg [s]", "funktion" };
List<Object[]> dataList = new ArrayList<Object[]>();
int columnWitdh = 0;
for (String key : profileLogParser.getMap().keySet()) {
ProfileStatistic profileStatistic = profileLogP... | 3 |
public void setOutputNeuron(Neuron n) {
outputNeuron = n;
} | 0 |
public void setActions(Action add, Action remove, Action update) {
if (addAction != null)
addButton.removeActionListener(addAction);
if (removeAction != null)
removeButton.removeActionListener(removeAction);
if (updateAction != null) {
addButton.removeAction... | 6 |
private void mergeAsTable( FragList fl, ArrayList<Version> sigla,
ArrayList<Group> groups, BitSet constraint ) throws Exception
{
BitSet bs1 = getShared();
bs1.and( constraint );
BitSet bs2 = fl.getShared();
bs2.and( constraint );
Utils.ensureExclusivity( bs1, bs2 );... | 6 |
public int jump(int[] A) {
if (A.length <= 1)
return 0;
int[] f = new int[A.length];
f[0] = 0;
f[1] = A[0];
int t = 1;
int j = 0;
while (f[t] < A.length - 1) {
t++;
f[t] = f[t - 1] + A[f[t - 1]];
int i = j + 1;
while (i <= f[t - 1] && f[t] < A.length - 1) {
if (A[i] + i > f[t])
... | 5 |
private void updatePersonalBest(int row){
for(int k = 0; k < position[row].length; k++){
personalBest[row][k] = position[row][k];
}
} | 1 |
public Matrix timesbyelement(Matrix B) {
Matrix A = this;
if (A.M != B.M && A.N != B.N) {
throw new RuntimeException("Unable to do element matrix multiplication.");
}
Matrix C = new Matrix(A.M, A.N);
for (int i = 0; i < C.M; i++) {
for (int j = 0; j < C.N;... | 4 |
public void render(Graphics2D g) {
if (!alive) {
return;
}
Image sprite = ResourceResolver.getResourceResolver().resolveResource("/player.png");
AffineTransform af = new AffineTransform();
af.rotate(getDirection(), getWidth() / 2, getHeight() / 2);
af.transla... | 2 |
public static void rename(String oldname, String newname) {
try {
File file = new File(oldname);
if (!file.exists()) {
throw new FileNotFoundException("the old file is not exist!");
}
File newFile = new File(newname);
if (newFile.exists()) {
throw new IllegalStateException("the new file is ex... | 3 |
public BinaryNode getSuccessor()
{
if(hasChildren()){
if(getLeft() == null && getRight() != null)
return getRight();
else if(getLeft() != null && getRight() == null)
return getLeft();
else // the two children case
return getRight().getLeftmostNode();
}
return null;
} | 5 |
protected void mainTimer() {
if (hasSomebodyWon()) {
somebodyWon();
}
updatePowerUps();
updateBall();
updatePaddles();
if (isBlackHole) {
ball.useGravity(blackHole);
for (PowerUp p : powerUpList) {
p.useGravity(blackHo... | 4 |
@Override
public ArrayList<Object> show(int id) {
conn = new SQLconnect().getConnection();
ArrayList<Object> tns = new ArrayList<Object>();
try {
String sql = "select * from timenodes where display = 'true' and time_owner = "
+ id;
Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的St... | 2 |
public FileAttribute(String fileName, int fileSize)
throws ParameterException {
// check for errors in the input
if (fileName == null || fileName.length() == 0) {
throw new ParameterException(
"FileAttribute(): Error - invalid file name.");
... | 4 |
public static float dot(float[] a, float[] b){
float val = 0;
for (int i = 0 ; i < a.length; i++){
val += a[i] * b[i];
}
return val;
} | 1 |
@Override
/*
* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
while (true) {
try {
Order deliverOrder= this._deliverBlockingQueue.take();
if (deliverOrder == Management.cyanide)
break;
logAsBeingDelivered(deliverOrder.getID());
long timeToDeliverOneWay= calculateD... | 5 |
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
double[] x = new double[func.length];
//Начальное приближение
System.out.println("Введите x0:");
for (int i = 0; i < x.length; i++) {
... | 6 |
public int countClasses(int depth, String packageName) {
if (depth++ >= MAX_PACKAGE_LEVEL)
return 0;
int number = 0;
String prefix = packageName.length() == 0 ? "" : packageName + ".";
Enumeration enum__ = ClassInfo.getClassesAndPackages(packageName);
while (enum__.hasMoreElements()) {
// insert sorted ... | 4 |
private void connectToServer(final ChannelHandler sendRequest) throws Exception {
// 这个代码是从Netty官网抄来的,暂时还不知道为什么要这么做!
ChannelFactory factory = new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
ClientBootstrap bootstrap = new ClientBootstrap(fac... | 0 |
private Element recursiveParse(Layer l, Element currentParent) throws Exception
{
// parent of current layer
Element e = parseLayer(l);
LinkedList<Element> children = new LinkedList<Element>();
document.addCSSLine(e.getSelector());
for(int x = 0; x < l.getLayersCount(); x++)
{
// traverse children
... | 7 |
public void draw() {
Zen.drawText(name, x-10, y-15);
Zen.setColor(0, 0, 155);
if (direction == 0 || direction == 2)
Zen.fillRect(x-10, y-15, 20, 30);
else
Zen.fillRect(x-15, y-10, 30, 20);
Zen.setColor(0,0,0);
if(direction ==0 || direction ==2)
Zen.fillRect(x-2, y-(2-direction)*10, 4, 20);
if(direction ==1... | 6 |
public static Announcement getAnnouncementByXMLElem(XMLElement root) {
String title = new String("Untitled");
String content = new String("This announcement has no content.");
for (int i = 0; i < root.childList.size(); i++) {
XMLElement elem = root.childList.get(i);
if (elem.name.equals("title")) {
titl... | 3 |
public int Minimum(TreeNode root){
if(root == null) return -1;
TreeNode current = root;
while(current.left != null){
current = current.left;
}
return current.val;
} | 2 |
private void calculateLowerTotal() {
int lowerTotal = 0;
for (ScoreCardCategories d: ScoreCardCategories.values()) {
if (d==ScoreCardCategories.THREEOFAKIND || d==ScoreCardCategories.FOUROFAKIND ||d == ScoreCardCategories.FULLHOUSE || d==ScoreCardCategories.SMALLSTRAIGHT || d==ScoreCardCategories.LARGESTRAIGHT |... | 9 |
public void handleInput() {
if (Keys.isPressed(Keys.ESCAPE))
gsm.setPaused(true);
if (player.getHealth() == 0)
return;
player.setUp(Keys.keyState[Keys.UP]);
player.setDown(Keys.keyState[Keys.DOWN]);
player.setLeft(Keys.keyState[Keys.LEFT] || Keys.keyState[Keys.A]);
player.setRight(Keys.keyState[Keys.R... | 6 |
private void setDataBasedOnTag(String part, SimFile accumulator) {
switch (getTag(part)) {
case "#TITLE":
accumulator.setTitle(stripTag(part));
break;
case "#SUBTITLE":
accumulator.setSubtitle(stripTag(part));
break;
case "#ARTIST":
accumulator.setArtist(stripTag(part));
break;
case "#CREDIT... | 7 |
public void setUsersOnTask() {
for (int i = 0; i < tasks.size(); i++) {
for (int j = 0; j < tsotList.size(); j++) {
if (tasks.get(i).getTaskID() == tsotList.get(j).getTaskID()) {
// Run through userList to find the userObject
for (int k = 0; k ... | 5 |
public void Update(int DELTA , int xOffset , int yOffset) {
for(int i = 0 ; i < this.tileSet.size() ; i++ ) {
this.tileSet.get(i).update(DELTA);
}
this.xOffset = xOffset;
this.yOffset = yOffset;
} | 1 |
public int connectRopes(int[] ropePieces){
List<Integer> unsortedList = new ArrayList<Integer>();
for(int i=0; i<ropePieces.length; i++){
unsortedList.add(ropePieces[i]);
}
//Sort lengths is ascending order
Collections.sort(unsortedList);
int cost = 0;
while(unsortedList.size() > 1){
int combinedRop... | 2 |
@Override
public boolean accept(File f){
if (f.isDirectory()) return true;
if (f.getName().endsWith(".xml") || (f.getName().endsWith(".jff"))) return true;
return false;
} | 3 |
public void onEnable() {
YamlConfiguration config = (YamlConfiguration) this.getConfig();
PluginDescriptionFile pdfFile = this.getDescription();
//Write the default configuration stored
new File(maindir).mkdir();
createDefaultConfiguration("config.yml");
String channelName = config.getString("channel", "... | 7 |
public void initFromXML( Element node, String workDir, String projectDir )
{
clear();
NodeList nList = node.getElementsByTagName("default") ;
TLanguageFile dummy ;
// default entry found
if (nList != null)
{
if (nList.getLength() > 0)
{
dummy = initSingle( (Element) nList... | 6 |
private String diager(int pointer) {
String diag = "";
switch (pointer) {
case 0: {
for (int i = 0; i < EngineField.sizeField; i++) {
diag = diag + EngineField.f1.get(EngineField.sizeField - 1 - i).get(i);
}
break;
... | 4 |
public void Traversal(TreeNode root, Vector<Integer> v){
if(root == null)
return;
else{
Traversal(root.left,v);
v.add(root.val);
Traversal(root.right,v);
}
} | 1 |
protected String[] getViewChoices() {
return new String[] { "Noninverted Tree", "Derivation Table" };
} | 0 |
public PdbSPReaderWriter () {
super() ;
// in case we ever do native interface code to hide some details ....
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbSPReaderWriter:constructor:DLL is loaded? " + bNativeInterfaceCodeLoaded); }
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\t... | 0 |
public static final String getPropertyOrEnvironmentSetting(String key) {
String value = System.getProperty(key);
if (value == null) {
value = System.getenv(key);
}
return value;
} | 1 |
@RequestMapping(method = RequestMethod.GET)
public ModelAndView indexView(HttpServletRequest paramHttpServletRequest,
@RequestParam(value = "success", required=false) Boolean successRedirectAttr) {
ModelAndView modelAndView = new ModelAndView();
if (isAuthenticated(paramHttpServletRequest)) {
modelAndView.a... | 4 |
public double minDataDLIfDeleted(int index, double expFPRate,
boolean checkErr){
//System.out.println("!!!Enter without: ");
double[] rulesetStat = new double[6]; // Stats of ruleset if deleted
int more = m_Ruleset.size() - 1 - index; // How many rules after?
FastVector indexPlus = new FastVector... | 7 |
public void compAi(int battle) {
if (battle == 1) {
ai = r.nextInt(2);
}
if (GameFile.enemy1MoveSet[ai].equals("Tackle")) {
// Changed base atk of tackle from 50 to 40
enemyAtkPower = 40;
enemyAtkType = "Normal";
} else if (GameFile.enemy1MoveSet[ai].equals("Growl")
|| GameFile.enemy1MoveSet[a... | 8 |
public void ClientDisconnected(int clientId)
{
gameController.Print("Server: Client " + clientId + " has been Disconnected.");
for(int i = 0; i < clientFramework.size(); i++)
{
if(clientFramework.get(i).clientId == clientId)
{
clientFramework.remove(clientId);
}
}
} | 2 |
private ArrayList<StringResource> createStringResources(File file) {
try {
FileInputStream fis = new FileInputStream(file);
XSSFWorkbook wb = new XSSFWorkbook(fis);
Sheet sheet = wb.getSheetAt(0);
ArrayList<StringResource> stringResources = new ArrayList<StringResource>();
boolean headersRead = false;... | 9 |
private Object handleData(Object tos) {
if (tos instanceof Generator && ((Generator)tos).getGeneratorData() == null) {
GeneratorData generatorData = new GeneratorData();
((Generator)tos).setGeneratorData(generatorData);
return generatorData;
}
else if (tos instanceof SourceC... | 5 |
private void destroyPlayer(Player pl) {
//destroy players
if (!pl.living) return;
if (x > pl.x - BOX_SIZE * 2 + 5 && x < pl.x + BOX_SIZE * 2 - 5 && pl.y == y) {
pl.die();
return;
}
if (y > pl.y - BOX_SIZE * 2 + 5 && y < pl.y + BOX_SIZE * 2 - 5 && pl.x == ... | 7 |
public static Direction getRandom() {
double d = Math.random();
if (d > 0.75)
return NORTH;
else if (d > 0.5)
return SOUTH;
else if (d > 0.25)
return EAST;
else
return WEST;
} | 3 |
static public OutputChannels fromInt(int code)
{
switch (code)
{
case LEFT_CHANNEL:
return LEFT;
case RIGHT_CHANNEL:
return RIGHT;
case BOTH_CHANNELS:
return BOTH;
case DOWNMIX_CHANNELS:
return DOWNMIX;
default:
throw new IllegalArgumentException("Invalid channel code: "+code);
}
} | 4 |
public void newlotcreatorforl3(int lotno){
boolean val = true;
while(val){
int what=0;
System.out.println("what do you want to do?");
System.out.println("1)Add new car");
System.out.println("2)add new car at some specific position");
System.out.println("3)remove car");
System.out.println("4)get number o... | 8 |
public DefaultListCellRenderer createListCellRenderer(final Class classe, final String metodo) {
DefaultListCellRenderer dlcr = new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSele... | 6 |
@SuppressWarnings("unchecked")
private void writeToAnyColumnField(Field field, T object, Cell cell, String columnName) {
try {
field.setAccessible(true);
Object value = readValueFromCell(cell);
if (value != null) {
AnyColumn annotation = field.getAnnotation(AnyColumn.class);
if (... | 8 |
public void keyPressed(KeyEvent e) {
// stage 5
if (e.getKeyChar() == 'N' || e.getKeyChar() == 'n')
reset();
// stage 10
if (e.getKeyChar() == 's' || e.getKeyChar() == 'S')
writeToFile();
// stage 11
if (e.getKeyChar() == 'l' || e.getKeyChar() == 'L')
loadFromFile();
repaint();
} | 6 |
public void update() {
switch (status) {
case GOING:
changeSpeed();
move(direction);
if (hasArrived()) {
stop();
setPosition(route.getEndRoute().getPosition());
setStatus(TransportStatus.DELIV... | 8 |
public void sortDyes(){
Vector<DyeParent> newDyes=new Vector<DyeParent>();
Vector<DyeParent> newLakks =new Vector<DyeParent>();
Vector<DyeParent> newMetals=new Vector<DyeParent>();
Vector<DyeParent> newFluos=new Vector<DyeParent>();
for(int i=0;i<PPC.calcObj.getAllDyeTypes().siz... | 5 |
public static String doHttpRequest(String uri, Cons options) {
{ PropertyList proplist = Stella_Object.vetOptions(options, Stella.getQuotedTree("((:METHOD :HEADERS :CONTENT) \"/HTTP\")", "/HTTP"));
Keyword method = ((Keyword)(proplist.lookupWithDefault(Http.KWD_METHOD, Http.KWD_GET)));
Dictionary header... | 7 |
public final void createNewPopulation() {
ArrayList<Chromosome> newPopulation = new ArrayList<Chromosome>();
//setupRouletteWheel();
for(int i = 0; i < populationSize / 2; i++) {
Chromosome firstParent = selectParentTournament();
Chromosome secondParent = selectP... | 8 |
public void setInjector( Injector injector )
{
this.injector = injector;
} | 0 |
@Test
public void insertTest(){
long start = System.currentTimeMillis();
for (int i = 0; i < 100000; i++){
heap.insert(i);
}
long end = System.currentTimeMillis();
System.out.println("Time spent inserting 100 000: " + (end-start)*1.0 + "ms.");
lo... | 2 |
public Wave34(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 1500; i++){
if(i % 17 == 0)
add(m.buildMob(MobID.TENTACRUEL));
else if(i % 6 == 0)
add(m.buildMob(MobID.HORSEA));
else if(i % 5 == 0)
add(m.buildMob(MobID.TENTACOOL));
else if(i % 4 == 0)
add(m.buildMob(MobID... | 7 |
public Player getPlayer1() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: getPlayer1() BEGIN");
}
if (test || m_test) {
System.out.println("FileManager :: getPlayer1() END");
}
return m_player1;
} | 4 |
public int findHoleNum(){
int holes = 0;
for(int col = 0; col<board.getWidth(); col++){
int lowestRowFilled = 20;
for(int row = board.getLength()-1; row>=0; row--){
if(board.getValue(row, col)!=0){
if(row<lowestRowFilled){
lowestRowFilled = row;
}
}
}
for(int row = board.getLengt... | 6 |
public void render() {
final boolean isLightingEnabled = glIsEnabled(GL_LIGHTING);
if (isLightingEnabled)
glDisable(GL_LIGHTING);
for (Text t : texts) {
final float alpha = t.isDoFade() ? ((float) t.getLife() - (float) t
.getAge()) / (float) t.getLife() : 1.0f;
glColor4f(1.0f, 1.0f, 1.0f, alpha);
... | 4 |
public void glSetup2D() {
initGL();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0.0, this.window.getOrthoWidth(), this.window.getOrthoHeight(), 0.0, orthoZNear, orthoZFar);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT |... | 0 |
@Override
@SuppressWarnings({ "unchecked", "nls" })
protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder enc) {
// Call the initialization of the super type
super.initialize(type, oldInstance, newInstance, enc);
Map map = (Map) oldInstance;
Set keySet = map.keySet();... | 7 |
static public OutputChannels fromInt(int code)
{
switch (code)
{
case LEFT_CHANNEL:
return LEFT;
case RIGHT_CHANNEL:
return RIGHT;
case BOTH_CHANNELS:
return BOTH;
case DOWNMIX_CHANNELS:
return DOWNMIX;
default:
throw new IllegalArgumentException("Invalid channel code: "+code);
}
} | 4 |
public boolean fireballCollideCheck(Fireball fireball)
{
if (deadTime != 0) return false;
float xD = fireball.x - x;
float yD = fireball.y - y;
if (xD > -16 && xD < 16)
{
if (yD > -height && yD < fireball.height)
{
if (facing!=0) retu... | 7 |
@Override
public int compareTo(Individual o) {
if (o == null) {
throw new NullPointerException("o can't be null");
}
if (this == o) {
return 0;
}
if (this.getEvaluation() > o.getEvaluation()) {
return 1;
} else if (this.getEvaluati... | 4 |
public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch... | 4 |
public void exitFunction() {
environmentStack.pop();
} | 0 |
public ArrayList<LinkedList<BTnode>> printLevel()
{
int level = 0;
int i;
BTnode temp;
ArrayList<LinkedList<BTnode>> result = new ArrayList<LinkedList<BTnode>>();
LinkedList<BTnode> list = new LinkedList<BTnode>();
if(root == null)
{
return result;
}
list.add(root);
result.add(level, l... | 7 |
@Override
public Success<Statement> parse(String s, int p) {
// Parse the type.
Success<Type> resType = TypeParser.singleton.parse(s, p);
if (resType == null)
return null;
p = resType.rem;
p = optWS(s, p);
// Parse each name=expression pair. (Some express... | 7 |
@BeforeClass
public static void setUpClass() {
} | 0 |
@Override
public void executeMsg(Environmental host, CMMsg msg)
{
if(host instanceof MOB)
{
final MOB myChar=(MOB)host;
if(msg.amISource(myChar)
&&(msg.tool() instanceof Ability)
&&(!myChar.isMonster())
&&(msg.sourceMinor()==CMMsg.TYP_PREINVOKE)
&&(myChar.isMine(msg.tool()))
&&(myChar.charSta... | 8 |
private static int count(int[][] A){
if(A.length % 2 != 0) return A.length;
if(A.length == 1) return 1;
for(int i=0;i<A.length/2;i++){
for(int j=0;j<A[0].length;j++){
if(A[i][j] != A[A.length-1-i][j]) return A.length;
}
}
int[][] a = new int[A.length/2][A[0].length];
for(int i=0;i<A.length/2;i+... | 7 |
public static String Salaus(String s) {
int indeksi = 0;
char kirjain = ' ';
String hexString = "";
for (int i = 0; i < s.length(); i++) {
kirjain = s.charAt(i);
indeksi = k.indexOf(kirjain);
if (kirjain == '!' || kirjain == '.' || kirjain == ',' || ... | 7 |
public long theMinCars(int treeHeight) {
long a[] = new long[treeHeight + 2];
a[0] = 1;
a[1] = 1;
if(treeHeight == 0||treeHeight == 1){
return a[treeHeight];
}
for(int i = 2;i <= treeHeight;i++){
a[i] = a[i - 1] + 2 * a[i - 2];
}
return a[treeHeight];
} | 3 |
protected static List<ItemCraftor> getCraftingSkills()
{
if(craftingSkills.size()==0)
{
final Vector<Ability> V=new Vector<Ability>();
for(final Enumeration<Ability> e=CMClass.abilities();e.hasMoreElements();)
{
final Ability A=e.nextElement();
if(A instanceof ItemCraftor)
V.addElement((ItemC... | 8 |
public void saveCurrentScoreBoard() throws IOException{
//Carregando o Score Table do arquivo:
File temp = null;
try{
temp = new File("ScoreBoard.txt");
//Se o arquivo não existe, criando o mesmo:
if(temp.exists()){
//Apagando... | 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.