text stringlengths 14 410k | label int32 0 9 |
|---|---|
public final void removeGnuFunctions() {
// Parcours de tous les CFG pour extraire les fonctions
for (ICfg cfg : this.cfgs) {
// TODO: Définir les fonctions GNU et autres dans un fichier externe (de configuration ?)
for (IFunction function : cfg.getFunctions()) {
// Suppression des fonctions GNU
if (f... | 9 |
@Override
public void addBuffers(GameAction action) {
if (!action.hasAnAttack()) { // do not add attacking actions to the tower
super.addBuffers(action);
}
} | 1 |
ByteVector put11(final int b1, final int b2) {
int length = this.length;
if (length + 2 > data.length) {
enlarge(2);
}
byte[] data = this.data;
data[length++] = (byte) b1;
data[length++] = (byte) b2;
this.length = length;
return this;
} | 1 |
public static Point3 getRandomIdentityVector2(double seed) {
double angle = seed * Math.random() * 2 * Math.PI;
return new Point3(Math.sin(angle), Math.cos(angle));
} | 0 |
private void procTweets( List<Status> tweets ) {
for ( Status tweet : tweets ) {
if ( tweet.getGeoLocation() != null
&& !statusIdCache.contains( tweet.getId() )) {
Logger.log( TAG, "found tweet from @"
+ tweet.getUser().getScreenName() );
... | 4 |
@Override
public void run()
{
while(true)
{
try
{
Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 100);
if (Agent.getConflictExists())
{
Agent.voteConflict(agentId, agentType);
Thread.sleep(12000);
}
} catch (InterruptedException e) {
System.out.pr... | 3 |
private String readInput() throws IOException {
return this.keyboard.readLine();
} | 0 |
public void render(Graphics2D g) {
if(beginningAnimation){
g.drawImage(beginningImage, x, y, null);
}
else if(combineAnimation){
g.drawImage(combineImage, (int)(x + WIDTH / 2 - scaleCombine * WIDTH / 2),
(int)(y + HEIGHT / 2 - scaleCombine * HEIGHT / 2), null);
}
else{
g.drawImage(tileI... | 2 |
private DataStructures createArray(Object type){
Structure structure;
if(type.getClass() == Integer.class){
structure = new IntegerArray(kitSize, length, chars);
}
else
if(type.getClass() == Float.class){
structure = new FloatArray(kitSize, length, char... | 5 |
public static double getDunnIndex(ArrayList<ArrayList<Integer>> clusters, double[][] distance, int VERBOSE) {
int logFlag = Constants.LOG_DUNNINDEX;
// get the min inter cluster distance
double MINDIST = Double.MAX_VALUE;
for (int i=0; i<clusters.size()-1; i++){
for (int j=i+1; j<clusters.size(); j++) ... | 5 |
public void follow(int followerId, int followeeId) {
if(followeeId==followerId) return;
//update subscribe list
TreeSet<Integer> subscribeList=subscribeMap.get(followerId);
if(subscribeList==null) subscribeList=new TreeSet<>();
subscribeList.add(followeeId);
subscribeMap.... | 3 |
public String getItemName() {
return this.itemName;
} | 0 |
public boolean getLogin() {
final int line = API.i().getLogin(this.username, this.password);
ConsoleLogger.i().info(String.valueOf(line));
Long time = Long.parseLong(String.valueOf(line * 20));
if (line > -1) {
if (Sessions.i().locations.containsKey(this.username))
// Let the player do things
... | 7 |
private void enumerateWorkbenchParts(List<IWorkbenchPartReference> editors, List<IWorkbenchPartReference> views) {
IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
for (IWorkbenchWindow workbenchWindow : workbenchWindows) {
IWorkbenchPage[] pages = workbenchWindow.getPages()... | 4 |
public static void logException(Throwable e, LoggerLevel logLevel) throws CriticalFailure
{
try {
throw e;
} catch (JWorldGenException e1) {
if (level.getValue() >= logLevel.getValue())
{
System.err.println(logLevel+": "+e1.getMessage());
}
} catch (Throwable e1) {
if (logLevel == LoggerLevel.... | 6 |
public static void println(int line, String text) {
if (line < 1 || line > 6) {
return;
}
//truncate the text if it's longer than the maximum length and add a marker to indicate that it was truncated
if (text.length() > MAX_LINE_LENGTH) {
text = text.substring(0, ... | 9 |
public double winkel(Point p1, Point p2) {
double winkel = 0;
if (p1.getY() > p2.getY() && p1.getX() <= p2.getX()) {
winkel = (Math.atan((p1.getY() - p2.getY())
/ (p1.getX() - p2.getX())) * 180 / Math.PI) + 180 + 90;
}// rechts oben
if (p1.getY() <= p2.getY() && p1.getX() > p2.getX()) {
winkel = (Mat... | 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 static void main(String[] args) throws Exception {
if (args.length != 4) {
System.err
.print("Incorrect number of arguments! The correct syntax is:\n"
+ " <inputfile> <outputfile> <ne_feature> ( iob1 | iob2 )\n");
System.exit(1);
}
int arg = 0;
String inFileName = args[arg++];
Strin... | 9 |
public void tick(){
if(input.right) xScroll++;
if(input.left) xScroll--;
if(input.down) yScroll++;
if(input.up) yScroll--;
//screen.render(10, 10, 0, 16, 16);
//for (int i = 0; i < pixels.length; i++){
//pixels[i] = random.nextInt();
//pixels[i] = random.nextInt()<<16; bit-shift: this turns it ... | 4 |
public static void main(String[] args) {
Shape shape = new Triangle();
shape.draw();
// shape.flip(); // Error
Triangle triangle = (Triangle)shape;
triangle.draw();
triangle.flip();
} | 0 |
@Override
public void execute()
{
HashMap<Integer, String> stringGroups = new HashMap<>();
int playersOnLine = 1, playersPerLine = 3, line = 0, displayNumber = 1;
for (Player player : cm.getMain().getQM().getQueue())
{
String currString = stringGroups.get(line);
if (currString == null)
stringGroups.... | 5 |
private static void ForWithBreak() {
int[] numbers = { 10, 20, 30, 40, 50 };
System.out.println("Begin of ForWithBreak");
for (int x : numbers) {
if (x == 30) {
break;
}
System.out.print(x);
System.out.print("\n");
}
System.out.println("End of ForWithBreak");
System.out.println("\n");
} | 2 |
View (Model m, Model m2) {
model = m;
model2 =m2;
model.addObserver(this);
model2.addObserver(this);
sp = new ImageIcon(getClass().getResource("pic/start.png"));
rp = new ImageIcon(getClass().getResource("pic/replay.png"));
quit = new ImageIcon(getClass().getResou... | 9 |
public Tile(int _x, int _y, String _URL, int backID, int _maxX, int _maxY)
{
backgroundTileID=backID;
URL = _URL;
imageIcon = new ImageIcon(this.getClass().getResource("resources/Editor/textures/environment/tiles/"+URL));
//imageIcon = new ImageIcon(this.getClass().getResource("resources/textures/environment/t... | 5 |
private Node parseLiteral(boolean allowQuantifier) {
Node result = null;
char c = input.charAt(offset);
switch (c) {
case '.': {
result = new Wildcard(this);
offset++;
break;
}
case '\\': {
char e = input.charAt(offset + 1);
switch (e) {
case 'w': {
result = new Pre... | 9 |
@Override
public void run() {
while(true){
long startTime = System.currentTimeMillis();
// Check for event triggers
events.update();
// Updates the player
player.update();
// Checks collision
collision.update();
// Check for mapswitch
mapChange.update();
// Updates enemies
I... | 6 |
public void renderSprite(int xp, int yp, Sprite s) {
int w = s.W;
int h = s.H;
xp -= xOffs;
yp -= yOffs;
int[] iso = twoDToIso(xp, yp);
xp = iso[0];
yp = iso[1];
for (int y = 0; y < h; y++) {
int ya = y + yp; // absolute position
... | 8 |
String mapTypeName(int tag) {
switch (tag) {
case StackMapTable_attribute.verification_type_info.ITEM_Top:
return "top";
case StackMapTable_attribute.verification_type_info.ITEM_Integer:
return "int";
case StackMapTable_attribute.verifica... | 9 |
Vector<Double> solveTwoEquationForX(double equationsValue1,double equationsValue2, double leftLimitForT, double rightLimitForT,
boolean includeLeftLimitForT, boolean includeRightLimitForT ){
Vector<Double> roots = new Vector<Double>();
if (equationsValue1 != 1.0 ... | 8 |
public void start(String[] args){
try{
if(args.length == 0){
processDirectoryTree(new File("."));
}
else{
for(String arg:args){
File fileArg = new File(arg);
if(fileArg.isDirectory()){
processDirectoryTree(fileArg);
}
else{
if(!arg.endsWith("."+ext)){
arg += "."... | 5 |
public void testGoalWithModulePrefix5() {
String goal = "f(x):length([],0)";
try {
Query.hasSolution(goal); // should throw exception
fail(goal + " (compound module prefix) wrongly succeeded"); // shouldn't get to here
} catch (org.jpl7.PrologException e) { // correct exception class
if (e.term().hasFunc... | 5 |
protected void UpdateLineColumn(char c) {
column++;
if (prevCharIsLF) {
prevCharIsLF = false;
line += (column = 1);
} else if (prevCharIsCR) {
prevCharIsCR = false;
if (c == '\n') {
prevCharIsLF = true;
} else
line += (column = 1);
}
switch (c) {
case '\r':
prevCharIsCR = true;
... | 6 |
public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
s... | 4 |
public static Object changeSrctypeToTargeType(String srcType, String targetType,
Object val) throws Exception {
if(srcType.equals(targetType)){
return val;
}
Object obj = null;
if (targetType.equals("java.lang.String")) {
if (srcType.equals("java.sql.Timestamp")) {
Timestamp timestamp = (Tim... | 9 |
public PrettyPrintUtility() {
try {
writer = new PrintWriter(new FileWriter(new File("Log.txt"), true));
writer.println(">> opened Log FILE");
writer.println(">> started PrettyPrintUtility");
namesIn = new DataInputStream(new BufferedInputStream(
... | 9 |
public void write(String value) {
try {
dataOut.println(value);
dataOut.flush();
if (loggedin==1){
if (value.equals("\n")){}
else if(value.equals("")){}
else{GosLink2.dw.append(value);}
}
} catch (Exception e) {
e.printStackTrace();
}
} | 4 |
public int size()
{
return myList.size();
} | 0 |
@Override
public void run() // read server messages and act on them.
{
doClient();
if (clientReceiveThread != null) {
clientReceiveThread.setRunning(false);
}
return;
} | 1 |
public void heapIncKey(int indeksi, int arvo) {
if (indeksi >= 0 && indeksi < keko.size()) {
if (arvo > keko.get(indeksi)) {
keko.set(indeksi, arvo);
}
while (indeksi > 0 && keko.get(parent(indeksi)) < arvo) {
int apuluku = keko.get(parent(inde... | 5 |
public void tick()
{
width = sprt.getWidth(null);
height = sprt.getHeight(null);
if(dead) deathAni();
chgDir();
move();
if(dir == 0 || dir == 1){
x -= SPEED;
if(x <= 10){
x += x;
dir = 2;
}
}
if(dir == 2 || dir == 3){
x += SPEED;
if(x >= 250){
dir = 0;
}
}
tic... | 7 |
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... | 8 |
public int[] searchRange(int[] A, int target) {// binary-search bounding version
int lb = 0, ub = 0;
int len = A.length;
int l = 0, r = len - 1, mid = 0;
while(l <= r){
mid = (l+r) >> 1;
if(A[mid] < target) l = mid + 1;
else r = mid - 1;
}
lb = l;
l = 0; r = len - 1;
while(l <= r){
mid = (l+... | 5 |
private void merge(int startIndex, int endIndex, int midPoint) {
// TODO Auto-generated method stub
int leftLength = midPoint - startIndex + 1;
int rightLength = endIndex - midPoint;
int [] leftArray = new int [leftLength];
int [] rightArray = new int [rightLength];
int leftIndex = 0;
int rightIndex = 0;
... | 6 |
public static void voteYes(Player player, String playerName) {
if (player == null) {
StefsAPI.MessageHandler.buildMessage().addSender("$")
.setMessage("error.onlyIngame", AdminEye.messages).build();
return;
}
if (VoteHandler.type == VoteType.NO_VOTE) {
StefsAPI.MessageHandler.buildMessage().addSend... | 5 |
public void update() {
/*for(Map m : maps.values()) {
for(TileLayer layer : m.getBackgroundLayers()) {
for(Entity e : layer.getTiles()) {
e.update();
}
}
}*/
player.update();
/*for(Map m : maps.values()) {
for(TileLayer layer : m.getForegroundLayers()) {
for(Entity e : layer.getTiles()... | 5 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((NAME == null) ? 0 : NAME.hashCode());
result = prime * result + ((PUBLIC == null) ? 0 : PUBLIC.hashCode());
result = prime * result + (QUIRKS ? 1231 : 1237);
result = prime * result + ((SYSTEM == null) ? 0 :... | 4 |
protected TreeNode<K, D> iterativeSearch(TreeNode<K, D> root, K k) {
TreeNode<K, D> pointer = root;
int side = this.comparator.compare(k, pointer.getKey());
while (side != 0) {
if (side < 0) {
pointer = pointer.getLeftChild();
} else {
poin... | 3 |
@Override
public ValueType returnedType(ValueType... types) throws Exception {
// Check the number of argument
if (types.length == 1) {
// if array
if (types[0] == ValueType.NONE) {
return ValueType.NONE;
}
// If numerical
if (types[0].isNumeric()) {
return ValueType.DOUBLE;
}
// if ... | 4 |
protected void createFrame() {
MyInternalFrame frame = new MyInternalFrame();
frame.setVisible(true);
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
} | 1 |
public void draw(Bitmap bitmap, int xOffs, int yOffs) {
for (int y = 0; y < bitmap.height; y++) {
int yPix = y + yOffs;
if (yPix < 0 || yPix >= height)
continue;
for (int x = 0; x < bitmap.width; x++) {
int xPix = x + xOffs;
if... | 6 |
@Override
public void run() {
try (Scanner in = new Scanner(System.in)){
boolean done = false;
while (!done && in.hasNextLine()){
String msg = in.nextLine();
sendMSG(msg.getBytes(), msg.getBytes().length, address, port);
if(msg.trim()... | 3 |
public void buscarPagos() {
if (pago.getRuc() != null) {
String jpql = "select p from Pagos p where p.ruc= :dato ";
Query query = JPAUtil.getEntityManager().createQuery(jpql);
query.setParameter("dato", pago.getRuc().toString());
pagos = query.getResultList();
... | 1 |
@Override
public void run() {
List<Task> tasks;
while ((tasks = getProducerService().generateTasks(batchSize)).size() > 0) {
try {
for (Task task : tasks) {
getQueue().put(task);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println("producer: sending shutd... | 5 |
@EventHandler
public void onJoin(PlayerJoinEvent event) {
final CraftPlayer p = (CraftPlayer) event.getPlayer();
final EntityPlayer ep = p.getHandle();
final String guideAlert = "{\"text\":\"\",\"extra\":[{\"text\":\""+Core.getPrefix()+"§bClick me for help in this game!\",\"clickEvent\":{\"a... | 5 |
@Override
public void addNotify() {
// Record the size of the window prior to calling parents addNotify.
Dimension dimension = getSize();
super.addNotify();
if (componentsAdjusted) {
return;
}
// Adjust components according to the insets
setSize(ge... | 2 |
public void externalSortTextFile(String inputFileName, String outputFileName, boolean is_int)
{
String tfile = "temp-file-";
ArrayList<String> buffer = new ArrayList<String>();
try
{
File inputFile = new File(inputFileName);
FileReader fr = new FileReader(inputFile.getAbsoluteFile());
BufferedRe... | 9 |
private synchronized void deleteNow() {
useable.set(false);
if (png2 != null && png2.isLoaded()) {
try {
Log.info("Deleting temporary file " + png2.getNow());
final boolean ok = png2.getNow().delete();
if (ok == false) {
Log.error("Cannot delete: " + png2.getNow());
}
} catch (IOException... | 8 |
public static void main(String[] args) throws Exception {
Jeu j=new Jeu();
j.nouvellePartie();
j.nouvellePartie();
for (int i=0;i<j.getListeParties().size();i++)
{
for (int n=0;n<j.getListeParties().get(i).getFlechesPartie().getListeFleches().size();n++)
{
System.out.println("La partie "+i+" comport... | 4 |
@Override
public void run() {
Condition.sleep(500);
ctx.inventory.deselect();
if (ctx.game.tab() == Game.Tab.EMOTES || ctx.game.tab(Game.Tab.EMOTES)) {
final Component emote = ctx.widgets.widget(216).component(1).component(Random.nextInt(0, 20));
if (emote.valid() && emote.click()) {
if (Condition.wait... | 6 |
private void calculatePageInfo(int pageSize) {
// if not paging,pageSize should be less than 0
if (pageSize <= 0) {
return;
}
if (totalCount == 0) {
this.totalPageNumber = 0;
} else {
long left = totalCount % pageSize;
this.totalPa... | 9 |
public static ITrackTile getTrackFuzzyAt(World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof ITrackTile)
return (ITrackTile) tile;
tile = world.getTileEntity(x, y + 1, z);
if (tile instanceof ITrackTile)
return (... | 3 |
public static void setAccounting(Accounting accounting) {
accounts=accounting==null?null:accounting.getAccounts();
accountTypes=accounting==null?null:accounting.getAccountTypes();
projects=accounting==null?null:accounting.getProjects();
manage.setEnabled(projects!=null);
project.... | 3 |
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Player player = (Player) event.getPlayer();
double uppercharacters = 0.0D;
double totalcharacters = 0.0D;
double percentage = 0.0D;
String msg = event.getMessage().replaceAll(" ", "");
for(int i = 0; i < msg.length(); i++) {
if(Cha... | 7 |
private static String getMethodTwo(long elapsedMs) {
long elapsedSec = elapsedMs/1000;
long ms = elapsedMs - (elapsedSec * 1000);
long s = elapsedSec % 60;
long elapsedMin = elapsedSec/60;
int m = (int) (elapsedMin % 60);
long elapsedHour = elapsedMin/60;
int h = (int) (elapsedHour % 60);
boolean higher... | 8 |
public int maxPathSum2(treeNode curRoot) {
HashMap<treeNode, Integer> node_notRootMax = new HashMap<treeNode, Integer>();
HashMap<treeNode, Integer> node_asRootMax = new HashMap<treeNode, Integer>();
int maxPathNotRoot;
int maxPathAsRoot;
int curMax;
int maxPathFinal = -10000;
treeNode p = curRoot;
if... | 9 |
public void bfs(Vertex<T> start)
{
//BFS uses Queue data structure
Queue<Vertex<T>> que=new LinkedList<Vertex<T>>();
start.visited=true;
que.add(start);
printNode(start);
while(!que.isEmpty()) {
Vertex<T> n=(Vertex<T>)que.remove();
Vertex<T> child=null;
while((child=getUnvisitedChil... | 2 |
private void MinimumRouteSearch ( boolean[] Visited, int[][] RouteArray, int[] Dist, int[] prev, int pos, int N, int[] nodes ) {
while (true) {
Visited[pos] = true; //̏VisitedtO𗧂Ă
for ( int x = 0; x < N; x++ ) {
if ( Visited[x] ) continue; //łɂXȂ炱̏̓X[
if ( RouteArray[pos][x] > 0) { //oHꍇ̏
int d = ... | 9 |
public void testPropertyAddYear() {
YearMonthDay test = new YearMonthDay(1972, 6, 9);
YearMonthDay copy = test.year().addToCopy(9);
check(test, 1972, 6, 9);
check(copy, 1981, 6, 9);
copy = test.year().addToCopy(0);
check(copy, 1972, 6, 9);
copy =... | 2 |
public Browser getBrowser() {
return browser;
} | 0 |
private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
processMap.put("getBook", new getBook());
processMap.put("saveBook", new ... | 2 |
public List<String> getMountFolders() {
List<String> dirs = new ArrayList<>();
sc: for (ServerCategory cat : this.categories.values()) {
String path = cat.getPath();
Iterator<String> it = dirs.iterator();
String dir;
while(it.hasNext()) {
dir = it.next();
if(path.startsWith(dir + "/")) { // We ... | 5 |
protected void processWindowEvent(WindowEvent e) {
if(windowListener != null) {
windowListener.windowResized(e);
}
} | 1 |
@Override
public void run() {
// get student folder
File studentFolder;
if (main.arguments.length >= 2 && main.arguments[1].length() > 1) {
studentFolder = lib.recognize.find(main.arguments[1]);
} else {
File root = new File(System.getProperty("user.dir"));
... | 8 |
public void teleportElement(Element element, Teleporter destination) {
final Position to = getElementPosition(destination);
updateElementPosition(element, to);
for (Element e : getElementsOnPosition(to))
if (e instanceof Collide && !(e instanceof Teleporter))
((Collide) e).collideWith(element);
} | 3 |
private void closeSesion() {
if (session != null && session.isOpen())
session.close();
} | 2 |
public void connect() {
setConnectionState(ConnectionState.BUSY);
new Thread( new Runnable() {
public void run() {
String comPort = window.getSelectedCOMPort();
try {
Controller.log("Connecting to serial port " + comPort + " (please wait) ...", "message");
int baudRate = usingOldOABaudRate ? 11... | 7 |
public void wavRunner(String s) {
try {
File file = new File(s);
AudioInputStream audiosource = AudioSystem
.getAudioInputStream(file);
DataLine.Info info = new DataLine.Info(Clip.class,
audiosource.getFormat());
clip = (Clip) AudioSystem.getLine(info);
clip.open(audiosource);
} catch (Unsu... | 3 |
public long skip(long count) throws IOException {
if (length < count) {
count = length;
}
count = super.skip(count);
length -= (int) count;
return count;
} | 1 |
public void put(int o, int inc, int postingListToBeAccessed, int accessedPostingLists)
{
intWrapper oo=new intWrapper();
oo.value=o;
double currentScore;
long time=System.currentTimeMillis();
doubleWrapper oi=tempRes.get(oo);
if (oi!=null){... | 3 |
public void exit() {
// For each buffer, the command
for (FileBuffer fb : dm.getOpenBuffers()) {
// checks to see if it's saved
if (fb.isSaved()) {
// if it is, it closes the buffer
try {
dm.close(fb);
} catch (BufferNotOpenException e1) {
e1.printStackTrace();
}
}
// if it is ... | 6 |
private void processFields(CtClass clazz)
throws CannotCompileException, NotFoundException
{
CtField[] fs = clazz.getDeclaredFields();
for (int i = 0; i < fs.length; ++i) {
CtField f = fs[i];
int mod = f.getModifiers();
if ((mod & Modifier.PUBLIC) != 0 && ... | 3 |
private void update_weights(int index){
// update the weight of the currently indexed node
tree.elementAt(index).family_weight = tree.elementAt(index).chance_weight;
// First, update self with children's weights
// daughters are found at 2(x+1)
if( 2*(index+1) < tree.size() )
{ // add ... | 4 |
@SuppressWarnings("deprecation")
public void testFactoryFieldDifference4() throws Throwable {
DateTimeFieldType[] types = new DateTimeFieldType[] {
DateTimeFieldType.year(),
DateTimeFieldType.monthOfYear(),
DateTimeFieldType.dayOfWeek(),
};
YearMonthDay st... | 1 |
private final void updateMapObjectVisibility(final MapleCharacter chr, final MapleMapObject mo) {
if (!chr.isMapObjectVisible(mo)) { // monster entered view range
if (mo.getType() == MapleMapObjectType.SUMMON || mo.getPosition().distanceSq(chr.getPosition()) <= GameConstants.maxViewRangeSq()) {
... | 5 |
public byte[] getByteArray() {
if (!isByteArrayComputed) {
byteArray = computeByteArray();
}
return byteArray;
} | 1 |
private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... | 6 |
private void init() {
frame = new JFrame();
frame.setLayout(new GridLayout(26, 26));
frame.addKeyListener(this); // JLabel cannot get keyboard focus
frame.setResizable(true);
frame.setSize(520, 520);
frame.setBackground(WATER);
frame.setDefaultCloseOperation(JF... | 8 |
public void blob(Message msg) {
while (!msg.eom()) {
switch (msg.uint8()) {
case GMSG_TIME:
Timer.server = msg.int32();
;
Timer.local = System.currentTimeMillis() / 1000;
break;
case GMSG_ASTRO:
double dt = defix(msg.int32());
double mp = defix(msg.int32());
double yt = defix(msg.... | 5 |
private String stripPunctuationFromString(String s) {
StringBuffer buff = new StringBuffer(s);
int index = 0;
while (index < buff.length()) {
if (Character.isLetterOrDigit(buff.charAt(index)) || Character.isWhitespace(buff.charAt(index)) || isEndingPunctuation(buff.charAt(index))) {
index++;
} else {
... | 4 |
public Dijkstra() {
for(int i=0;i<maxnode;i++)node[i]=new Node();
routelen=1;nodelen=1;
for(int i=0;i<maxn;i++)route[i]=new Route();
time1=new double[maxnode][maxnode];
distanceTwoNodes=new double[maxnode][maxnode];
leastTimeTrack=new int[maxnode][maxnode];
for(int i=0;i<maxnode;i++)
for(int j=0;j<maxn... | 5 |
public int inserir(Categoria c){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, PreparedStatement.RETURN_GENERATED_KEYS);
pstm.setString(1, c.... | 3 |
@Test
public void test_mult_matrix() {
int a = 2;
int b = 3;
int c = 4;
Matrix m1 = new MatrixArrayList(a, b);
Matrix m2 = new MatrixArrayList(b, c);
Matrix m3 = new MatrixArrayList(a, c);
for (int i = 1; i <= a; i++) {
for (int j = 1; j <= b; j++)
m1.insert(i, j, (double) (2 * i - j));
}
fo... | 4 |
public void keyTyped(KeyEvent evt)
{
int modifiers = evt.getModifiers();
char c = evt.getKeyChar();
if(c != KeyEvent.CHAR_UNDEFINED &&
(modifiers & KeyEvent.ALT_MASK) == 0)
{
if(c >= 0x20 && c != 0x7f)
{
KeyStroke keyStroke = KeyStroke.getKeyStroke(
Character.toUpperCase(c));
Object o = c... | 9 |
@Override
public int loop() {
if (Game.getClientState() != Game.INDEX_MAP_LOADED
|| Players.getLocal() == null)
return 500;
final Tile player = Players.getLocal().getLocation();
if (follow && (tile == null || !tile.equals(player))) {
updateTile(player);
}
return 50;
} | 5 |
public static CurrencySet getInstance() {
if (instance == null)
instance = new CurrencySet();
return instance;
} | 1 |
public boolean insert(int key)
{
TreeNode pnode = parentHead;
TreeNode node = pnode.left;
while(node!=null) //left or right subtree
{
if(node.key>key)
{
pnode=node;
node=node.left;
}else if(node.key<key)
{
pnode=node;
node=node.right;
}else if(node.key==key)
return false;
}... | 7 |
public void initLevel() throws SlickException{
menu = new Image("resources/images/menu.png");
wowtime=true;
try {
InputStream inputStream = ResourceLoader.getResourceAsStream("game_over.ttf");
Font awtFont = Font.createFont(Font.TRUETYPE_FONT, inputStream);
awtFont = awtFont.deriveFont(84f); // set fo... | 3 |
public static void oldevaluateRecommender(IGraph testDataSet, IRecommender reco)
{
int hitRecommed = 0;
int userNumber = 0;
List<INode> users = testDataSet.getNodesByType(RecommenderPropertiesHandle.getInstance().getUserType());
for (INode user : users)
{
List<IEdge> ranks = user.getOutEdge(... | 7 |
public void draw(Object obj,Component comp,Graphics2D g2,Rectangle rect)
{
Color color = (Color) AbstractDisplay.getProperty(obj, "color");
if (color == null && obj instanceof Color)
color = (Color) obj;
Color textColor = (Color) AbstractDisplay.getProperty(obj, "textColor");
if (textColor == null)
textC... | 9 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.