text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void sendPublicKey(short crt, APDU apdu) {
RSAPublicKey key = null;
short len, l;
switch(crt) {
case (short)0xb600:
key = (RSAPublicKey)keySign.getPublic();
break;
case (short)0xb800:
key = (RSAPublicKey)keyDecrypt.... | 3 |
public void updateViewRegisters() {
if(memory[XREG_ADDRESS] != xReg.get(xReg.size() - 1))
xReg.add(memory[XREG_ADDRESS]);
if(memory[YREG_ADDRESS] != yReg.get(yReg.size() - 1))
yReg.add(memory[YREG_ADDRESS]);
if(memory[ACCUMULATOR_ADDRESS]!= acc.get(acc.size() - 1))
acc.add(memory[ACCUMULATOR_ADDRESS])... | 3 |
private void getFlipInstruction() {
currentState = new BrainState(BrainState.INSTRUCTION_FLIP);
char read = (char) readAhead;
readNext();
if(checkCharacter(read, 'l')) {
read = (char) readAhead;
readNext();
if(checkCharacter(read, 'i')) {
read = (char) readAhead;
readNext();
if(checkCharact... | 6 |
private ArrayList<ArrayList<E>> getPossibleCombos(List<Node> nodes) {
ArrayList<ArrayList<E>> toReturn = new ArrayList<ArrayList<E>>();
for (Node n : nodes.get(nodes.size() - 1)) {
ArrayList<Node> newFoundTiles = new ArrayList<Node>();
for (int i = 0; i < nodes.size(); i++)
newFoundTiles.add(nodes.get(i))... | 5 |
public double getX(){
return x;
} | 0 |
public static void run(RobotController myRC)
{
rc = myRC;
RobotType t = rc.getType();
try
{
if (t == RobotType.SOLDIER)
{
Soldier.soldierCode(rc);
}
else if(t == RobotType.HQ)
{
HQ.hqCode(rc);
}
else if(t == RobotType.GENERATOR || t == RobotType.SUPPLIER)
{
Supplier.supplie... | 6 |
public void sort1(List<Integer> list) {
if (list.size() < 2)
return;
int count = 0;
// double for-loop and both are related with variable "end"
// O(n^2)
int end = list.size();
boolean swapped;
do {
swapped = false;
for (int id... | 4 |
public static void startupGuiServerApi() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/POWERLOOM-SERVER/GUI-SERVER", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpeci... | 7 |
public static String getJdbcString() {
return "jdbc:postgresql://" + host + ":" + port + "/" + database;
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... | 7 |
public void calculate_pcm_samples(Obuffer buffer)
{
compute_new_v();
compute_pcm_samples(buffer);
actual_write_pos = (actual_write_pos + 1) & 0xf;
actual_v = (actual_v == v1) ? v2 : v1;
// initialize samples[]:
//for (register float *floatp = samples + 32; floatp > samples; )
// *--floatp = 0.0f;
... | 2 |
private void processMoveFromAcePile(MouseEvent e) {
int index = (int) (e.getY() / (CARD_Y_GAP + CARD_HEIGHT));
if (index < 4) {
activeMove = new CardMoveImpl(index, CardMoveImpl.MOVE_TYPE_FROM.FROM_ACE_PILES);
}
} | 1 |
public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
} catch (IOException e) {
e.printStackTrace... | 3 |
public static void debug(int level, String format, Object... args) {
if (level > 0 && level <= _messageLevel) {
System.err.printf(format, args);
System.err.println();
}
} | 2 |
private void createViewPanel() {
viewContent.removeAll();
JPanel viewPanel = new JPanel();
viewPanel.setBorder(BorderFactory.createTitledBorder("View"));
viewPanel.setLayout(new BoxLayout(viewPanel, BoxLayout.Y_AXIS));
viewContent.add(viewPanel, JLayeredPane.DEFAULT_LAYER);
JButton viewPanelMinimizeB... | 4 |
public void paint(Component component,
Graphics g,
int x,
int y,
int width,
int height,
Direction direction,
boolean horizontalFlip,
boolean verticalFlip) {
... | 7 |
public void infoFile(){
try{
if( file.exists() ){
System.out.println("Ver Nombre: " + file.getName());
System.out.println("Ver Path: " + file.getPath());
System.out.println("Ver Absoluta: " + file.getAbsolutePath());
if... | 6 |
public int recurSearch(int[] A, int target, int start, int end){
if(start == end && A[start] == target) return start;
if(start > end) return -1;
int center = (start + end)/2;
if(A[center] >= A[start]){
if(A[start] <= target && target <= A[center]){
re... | 8 |
@SuppressWarnings("unchecked")
public Book combineBooks(String newBookName, Book... books) {
List<Contact> contacts = Lists.newArrayList();
for (Book book : books) {
contacts = ListUtils.sum(contacts, book.getListOfAllContacts());
}
return new Book(newBookName, contacts);
} | 1 |
public Menu(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "label":
label = Label.parse(this, v);
break;
case "type":
type = Type.parse(this, v);
break;
... | 3 |
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
try { parameter.setName(txfName.getText()); } catch (CantSetException e) {}
try { parameter.setDescription(txfDescription.getText()); } catch (CantSetException e) {}
try { parameter.setYear(... | 9 |
@Override
public boolean mutate(Mutation.Type type) {
switch (type) {
case SWAP:
case REPLICATE:
return false;
case REMOVE:
Mutation.replaceExpr(this, expr);
return true;
case COPY_TREE:
return Mutation.copyExprTree(this);
case COPY:
return unaryCopy();
case CREATE_PARENT:
Mutation.crea... | 6 |
public void paintLineHighlights(Graphics g) {
int count = lineHighlights==null ? 0 : lineHighlights.size();
if (count>0) {
int docLen = textArea.getDocument().getLength();
Rectangle vr = textArea.getVisibleRect();
int lineHeight = textArea.getLineHeight();
try {
for (int i=0; i<count; i++) {
... | 8 |
private static <T> Map<String, Object> serializeArray(Class<?> type, T[] arr) {
Map<String, Object> data = new HashMap<String, Object>();
data.put("T", type.getComponentType().isPrimitive() ? type.getName() : ("[L"));
data.put("class", arr.getClass().getComponentType().getName());
data.p... | 3 |
private static ArrayList<Monster> initiative(ArrayList<Monster> monsters, Player p, boolean atRange, boolean faster) {
int target = 0;
if(atRange) {
target = p.getSpeed() + utils.random(0, 7);
}
else {
target = p.getSpeed() + utils.random(-3, 4);
}
ArrayList<Integer> speeds = new Arr... | 7 |
public static void showReportsTable(ResultSet rs, String reportsQuery,
String subject) {
int numCols;
ResultSetMetaData rsmd;
JTextArea tableTitle = null;
JTable table = null;
try {
rsmd = rs.getMetaData();
numCols = rsmd.getColumnCount() + 1;
String columnNames[] = new String[numCols];
for (... | 8 |
public String execute() throws Exception {
if(addListStore != 0 && addListItem != 0)
if(!add())
return "inputError" ;
return SUCCESS;
} | 3 |
@Override
public FileSequenceWriter createWriter(OutputStream out,
OutputStream... out2) {
if (out == null || out2 == null || out2.length == 0)
throw new IllegalArgumentException(
"You must declare two valid input streams");
return new FastaQualitySequenceWriter(out, out2[0]);
} | 3 |
public static NumericDocValues wrap(SortedNumericDocValues sortedNumeric, Type selector, SortField.Type numericType) {
if (numericType != SortField.Type.INT &&
numericType != SortField.Type.LONG &&
numericType != SortField.Type.FLOAT &&
numericType != SortField.Type.DOUBLE) {
throw ne... | 9 |
private void loginAndSaveCookie(){
HttpPost loginpost = new HttpPost(loginUrl);
List<NameValuePair> params = null;
try {
String html = this.GetPageContent(loginUrl);
params = getFormParams(html,"htsdeploy@gmail.com","hsbc123456");
} catch (UnsupportedEncodingException e2) {
e2.printStackTrace();... | 5 |
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
// TODO add your handling code here:
String textoCorreo = tfIdCorreo.getText().trim();
if (!textoCorreo.equals("")) {
try {
if (rbtnCorreo.isSelected())... | 6 |
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java MyScanner <inputfile>");
} else {
for (int i = 0; i < argv.length; i++) {
String fileName = null;
try {
fileName = argv[i];
Parser parser = new Parser(new Scanner(new java.io.FileReader(fileNam... | 5 |
public int _offsetToX(int line, int offset)
{
TokenMarker tokenMarker = getTokenMarker();
/* Use painter's cached info for speed */
FontMetrics fm = painter.getFontMetrics();
getLineText(line,lineSegment);
int segmentOffset = lineSegment.offset;
int x = horizontalOffset;
/* If syntax coloring is disa... | 7 |
@Override
public int writeString(String encoding, String val, int length) throws IOException
{
Charset charset = Charset.forName(encoding);
CharsetEncoder enc = charset.newEncoder();
CharBuffer bin = CharBuffer.allocate(1);
ByteBuffer bout = ByteBuffer.allocate(8);
int le... | 8 |
public static Animation bulletAnimationLeft(){
Animation anim = new Animation();
anim.addFrame(loadImage("bullet1.png"), 50);
anim.addFrame(loadImage("bullet2.png"), 50);
anim.addFrame(loadImage("bullet3.png"), 50);
return anim;
} | 0 |
public String readLine() throws IOException {
if (_acceptable) {
throw new IOException("You must call the accept() method of the DccChat request before you can use it.");
}
return _reader.readLine();
} | 1 |
private String getSessionId(URLConnection con){
for(String data:con.getHeaderFields().get("Set-Cookie")){
if(data.indexOf("JSESSIONID")!=-1){
return data.substring(0,data.indexOf(";"));
}
}
return null;
} | 2 |
public static boolean areTerminalsOnRHS(Production production) {
String rhs = production.getRHS();
for (int k = 0; k < rhs.length(); k++) {
char ch = rhs.charAt(k);
if (isTerminal(ch))
return true;
}
return false;
} | 2 |
public void DrawGameOver(Graphics2D g2d, Point mousePosition, long gameTime) {
Draw(g2d, mousePosition);
//draws the text to restart
//g2d.drawString("Press space or enter to restart.", Framework.frameWidth / 2 - 100, Framework.frameHeight / 3 + 70);
//draw text to say whether you won ... | 1 |
public String toString() {
if (id != null) {
if (dataId > 0) {
return id.toString() + ":" + dataId;
}
return id.toString();
}
return name;
} | 2 |
public synchronized ZePlayoutElement<E> get() {
/* sample current absolute time. */
now = playoutToSystem();
leftInterval = now-playoutHalfPer;
rightInterval = now+playoutHalfPer;
/* sample it once from the master and use
* the same value for the whole playout request
* to avoid inconsistencies (mpo... | 9 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
if (cmd.getName().equalsIgnoreCase("getmute")){
if (args.length <= 0) {
sender.sendMessage(Msg.$("getmute-usage"));
return true;
}
... | 8 |
public TheDocument(String htmlFile) {
file = new File(htmlFile);
isWrapped = false;
isIndented = true;
isSaved = true;
setFilepath(htmlFile);
reader = new DocumentReader();
care = new DocCaretaker();
if(!file.exists()){
try {
... | 8 |
public void chooseOption() {
switch (cursorLoc) {
case 1:
game.startSetup();
break;
case 2:
break;
case 3:
try {
java.awt.Desktop.getDesktop().browse(
new URI("http://www.signalytical.com/"));
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.... | 5 |
@Override
public List<Map<String, ?>> List_Plazo(String tipo) {
List<Map<String, ?>> lista = new ArrayList<Map<String, ?>>();
try {
this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE);
String sql = "";
sql +="select id_plazo,no_plazo,det_alerta ,to_c... | 9 |
public NoAddReason getNoAddReason(Locatable locatable) {
Unit unit = (locatable instanceof Unit) ? (Unit)locatable : null;
return (unit == null)
? NoAddReason.WRONG_TYPE
: (units == null)
? NoAddReason.CAPACITY_EXCEEDED
: (!isEmpty() && units.get(0).getOwn... | 7 |
public String[][][] getLog(String mode, String sv) throws IOException {
String storeAccess = null;
String storeAccessUpdate = null;
if (mode.equals("past")) {
storeAccess = "text";
storeAccessUpdate = "past_update";
} else if (mode.equals("ranking")) {
storeAccess = "rank";
storeAccessUpdate = "rank... | 8 |
public void onMouseEvent() {
if (Mouse.hasWheel() && Mouse.isButtonDown(0)) {
int angleZ = -Mouse.getDX();
double teta = Math.toRadians(angleZ);
double xprime = (this.position.getPositionX() * Math.cos(teta)) + (this.position.getPositionY() * Math.sin(teta));
doub... | 2 |
@Override
public void writeValue(NBTOutputStream output) throws IOException
{
int len = this.size();
for (int i = 0; i < len; i++)
{
NamedBinaryTag value = this.getTag(i);
if (value != null)
{
output.writeNBT(value);
}
}
output.writeEnd();
} | 2 |
public String getMimeType() {
if (format >= 0 && format < MIME_TYPE_STRINGS.length) {
if (format == FORMAT_JPEG && progressive)
{
return "image/pjpeg";
}
return MIME_TYPE_STRINGS[format];
} else {
return null;
}
} | 4 |
private boolean decode5(ByteArrayOutputStream baos)
throws PDFParseException {
// stream ends in ~>
int[] five = new int[5];
int i;
for (i = 0; i < 5; i++) {
five[i] = nextChar();
if (five[i] == '~') {
if (nextChar() == '>') {
... | 9 |
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... | 6 |
private float limit(float eq)
{
if (eq==BAND_NOT_PRESENT)
return eq;
if (eq > 1.0f)
return 1.0f;
if (eq < -1.0f)
return -1.0f;
return eq;
} | 3 |
List<Position> getPositions() {
final List<Position> parts = new ArrayList<Position>();
for (LightTrailPart part : lightTrail)
parts.add(player.getGrid().getElementPosition(part));
return parts;
} | 1 |
private boolean isLowPriorityOperator(String o) {
return o.equals(OPERATION_MINUS) || o.equals(OPERATION_PLUS);
} | 1 |
private void saveCheck(final String address) {
int opt = -1;
if (saveReminder != null && saveReminder.isChanged()) {
opt = isRemote() ? JOptionPane.NO_OPTION : saveReminder.showConfirmDialog(this, FileUtilities.getFileName(pageAddress));
}
boolean readAction = true;
switch (opt) {
case JOptionPane.YES_OP... | 8 |
public Merchant(int reg_num) {
SQLiteJDBC db = new SQLiteJDBC();
String sql = String.format("SELECT * FROM merchants WHERE reg_num ='%d'", reg_num);
ResultSet resultSet = db.query(sql);
try {
if(resultSet.next()) {
this.reg_num = resultSet.ge... | 2 |
static final void method2947(boolean bool, int i, int i_4_, int i_5_,
int i_6_, int i_7_) {
anInt6837++;
if (bool != true)
method2950(121);
if ((((Class348_Sub51) BitmapTable.aClass348_Sub51_3959)
.aClass239_Sub26_7272.method1838(-32350)
^ 0xffffffff) != -1
&& i_5_ != 0 && Message.anInt2021 <... | 5 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Sales)) {
return false;
}
Sales other = (Sales) object;
if ((this.id == null && other.id != null) || (this.id !... | 5 |
private static Path getOutputModuleFile(CommandLine line) throws IOException {
if (!line.hasOption(OUTPUT_MODEL)) {
return null;
}
String outputPathName = line.getOptionValue(OUTPUT_MODEL);
Path outputPath = Paths.get(outputPathName);
if (!Files.exists(outputPath)) {
Files.createDire... | 4 |
public boolean isManagesConnection(TVC con) {
return managedConnections.contains(con);
} | 0 |
private void updateUploadInfo(String status)
{
long delta = (System.currentTimeMillis() - startTime) / 1000;
request.getSession().setAttribute("uploadInfo", new UploadInfo(totalFiles, totalToRead, totalBytesRead,delta,status));
} | 0 |
public static void putReverseSortedInput(Comparable[] a)
{
for (int i = a.length; i > 0; i--)
a[i] = i;
} | 1 |
public static boolean pointInside(Positioned other, double x, double y, boolean notOnTheEdge)
{
if (notOnTheEdge)
return x > other.leftBorder() && x < other.rightBorder() &&
y > other.topBorder() && y < other.bottomBorder();
else
return x >= other.leftBorder... | 7 |
public void set(int index, String datum) {
RangeCheck(index);
data[index] = datum;
} | 0 |
private void AddVertices(Vertex[] vertices, int[] indices, boolean calcNormals)
{
if(calcNormals)
{
CalcNormals(vertices, indices);
}
m_resource = new MeshResource(indices.length);
glBindBuffer(GL_ARRAY_BUFFER, m_resource.GetVbo());
glBufferData(GL_ARRAY_BUFFER, Util.CreateFlippedBuffer(vertices), G... | 1 |
public String getRemoteIP() {
return remoteIP;
} | 0 |
public void setProjectStateEnabled(boolean enabled){
//Enabled tool bar, except new and open project
for(int i=2; i<mainToolBar.getComponentCount(); i++){
if(!(mainToolBar.getComponent(i) instanceof JToolBar.Separator)){
mainToolBar.getComponent(i).setEnabled(enabled);
... | 7 |
@Override
public ArrayList<Node> getListOfNodes()
{
if (isParsed)
{
return nodes;
} else
{
initiateParsing();
return nodes;
}
} | 1 |
public static void main(String[] args) throws IOException
{
int option;
Scanner input = new Scanner(System.in);
System.out.println("What would you like to do?");
System.out.println();
System.out.println("<1> Add or delete a student");
System.out.println("<2> Change student grades or schedule");
System.... | 8 |
private boolean flushTable(JobConf conf) {
initializeAccumuloConnector();
TableOperations ops = accumuloConnector.tableOperations();
String rowKeyRangeStart = conf.get("rowKeyRangeStart");
String rowKeyRangeEnd = conf.get("rowKeyRangeEnd");
boolean flushRangeAvailable = (rowKe... | 6 |
private boolean inMergeSource(MultiType source) {
while (source != null) {
if (source == this)
return true;
source = source.mergeSource;
}
return false;
} | 2 |
@Override
public void tickTock(int howManyHours)
{
final TimeOfDay todCode=getTODCode();
if(howManyHours!=0)
{
setHourOfDay(getHourOfDay()+howManyHours);
lastTicked=System.currentTimeMillis();
while(getHourOfDay()>=getHoursInDay())
{
setHourOfDay(getHourOfDay()-getHoursInDay());
setDayOfMont... | 8 |
public static boolean dumpItem(int itemId) {
String pageName = ItemDefinitions.getItemDefinitions(itemId).getName();
if (pageName == null || pageName.equals("null"))
return false;
pageName = pageName.replace("(p)", "");
pageName = pageName.replace("(p+)", "");
pageName = pageName.replace("(p++)", "");
pa... | 9 |
public String GenerateIndividu() {
int jum1 = 0;
int jum2 = 0;
int jum3 = 0;
int i = 0;
String ind;
while (i < 8) {
ind = getRandom(bahan);
if ((ind.equals(bahan[0])) && (jum1 < 3)) {
jum1++;
individuRandom[i] = i... | 9 |
public List<Session> getTeamMembers(ChatColor color) {
List<Session> sessions = new ArrayList<Session>();
for (Session session : HyperPVP.getGameSessions().values()) {
if (session.getTeam() != null && session.getTeam().getColor() == color) {
sessions.add(session);
}
}
return sessions;
} | 3 |
public static void textPack(byte packedData[], java.lang.String text) {
if (text.length() > 80)
text = text.substring(0, 80);
text = text.toLowerCase();
int carryOverNibble = -1;
int ofs = 0;
for (int idx = 0; idx < text.length(); idx++) {
char c = text.charAt(idx);
int tableIdx = 0;
for (int i =... | 9 |
public int getContentLength(){
SipcHeader header = this.getHeader(SipcHeader.LENGTH);
if (header != null && header.getValue() != null) {
String value = header.getValue();
if (value.length() < 1) {
return -1;
}else if (value.indexOf(';') != -1) {
return Integer.parseInt(value.substring(0,value.i... | 4 |
public void writeToUser(String user, String text){
try{
bw.write("PRIVMSG "+ user +" :"+text+"\n");
bw.flush();
}catch(IOException e){
System.out.println("IRC: Failure when trying to write to server: "+e.getMessage());
}
} | 1 |
@SuppressWarnings("unchecked")
public boolean delete( Comparable key ) {
ListNode<T> before = null;
ListNode<T> after = front;
// Traverse the list to find the ListNode before and after our deletion point.
while ((after != null) && (key.compareTo(after.getData()) != 0)) {... | 5 |
public String[][] getDifferences(LLParseTable table) {
if (!Arrays.equals(variables, table.variables)
|| !Arrays.equals(terminals, table.terminals))
throw new IllegalArgumentException(
"Tables differ in variables or terminals.");
ArrayList differences = new ArrayList();
for (int v = 0; v < entries.len... | 6 |
@SuppressWarnings("unchecked")
void readGaussianBasis() throws Exception {
/*
* standard Gaussian format:
*
* [GTO] 1 S 3 172.2560000 2.0931324849764 25.9109000 2.93675143488078 5.5333500 1.80173711536432
*
* 1 SP 2 3.6649800 -0.747384339731355 1.70917757609178 0.7705450 0.712661025209793 0.88562206... | 8 |
private static void pickSatisfyMinLeaves(BswabePolicy p, BswabePrv prv) {
int i, k, l, c_i;
int len;
ArrayList<Integer> c = new ArrayList<Integer>();
if (p.children == null || p.children.length == 0)
p.min_leaves = 1;
else {
len = p.children.length;
for (i = 0; i < len; i++)
if (p.children[i].sa... | 8 |
public ArrayList<MainMenuHeroSlot> reloadHero(){
ArrayList<MainMenuHeroSlot> temp = new ArrayList<MainMenuHeroSlot>();
while( heroTurn.peek() != null ){
BattleHeroSlots slot = heroTurn.remove();
slot.setExp();
temp.add(new MainMenuHeroSlot(slot));
}
int count = temp.size();
if(count <Con... | 3 |
@Override
public void onAttack() {
Alteration buff;
MathTools math = new MathTools();
CombatLog log = CombatLog.getInstance();
int dmg;
// Proc surging charge
buff = engine.getPlayer().getAlterations().get("surgingCharge");
if (buff != null && (engine.getTime() - this.lastCharge) >= 0){
if (math.ch... | 6 |
public String getFacebookRsvpUrl() {
return facebookRsvpUrl;
} | 0 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
@Override
protected void controlRender(RenderManager rm, ViewPort vp) {
float newDistance;
int level;
BoundingVolume bv = spatial.getWorldBound();
Camera cam = vp.getCamera();
float atanNH = FastMath.atan(cam.getFrustumNear() * cam.getFrustumTop());
float ratio = (Fas... | 8 |
public static void readMessage(String input, Core output) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
Document xmlFile = null;
try {
builder = factory.newDocumentBuilder();
xmlFile = builder.parse(new InputSour... | 5 |
private float[] kernel(float[] x, float[] w,
int n, int n2, int n4, int n8){
// step 2
int xA=n4;
int xB=0;
int w2=n4;
int A=n2;
for(int i=0;i<n4;){
float x0=x[xA] - x[xB];
float x1;
w[w2+i]=x[xA++]+x[xB++];
x1=x[xA]-x[xB... | 5 |
protected void processClients(Map<Integer, ClientInfo> connectedClients) {
// Don't process if previous map is null, i.e. not yet initialized
if(map == null) return;
// Loop through all of the clients in the previous mapping
for(ClientInfo client : map.values()) {
// Send a... | 6 |
public String getBillForCustomer(String[] orders) {
for (String personOrder : orders) {
item = personOrder.split(SPLIT);
foodName = item[0];
foodPrice = item[1];
bill = bill + Double.valueOf(foodPrice);
order = order + foodName + SPACE + Double.parseDo... | 1 |
@Override
public void run() {
while (true) {
// This loop goes forever, since we don't want our game
// logic to stop.
// TODO: Add game mechanics here.
// Update all game objects.
for (RenderObject object : objectsToRender) {
object.update(inputHandler, objectsToRender);
}
//... | 3 |
public Tree additiveExpressionDashPro(Tree firstConditionalExpression){
Tree secondConditionalExpression = null;
Symbol operator = null;
if((operator = accept(Symbol.Id.PUNCTUATORS,"(\\+|-)")) != null){
if((secondConditionalExpression = multiplicativeExpressionPro()) != null){
firstConditionalExpression =... | 3 |
private static void trip(String mapFileName) {
Reader mapParser = null;
try {
mapParser = new FileReader(mapFileName);
} catch (FileNotFoundException e) {
throw new RuntimeException("No file found");
}
makeMap(mapParser);
Scanner reqParser = new S... | 6 |
public static void expandAllSubheads(Node currentNode) {
currentNode.ExpandAllSubheads();
currentNode.getTree().getDocument().panel.layout.redraw();
return;
} | 0 |
public float priorityFor(Actor actor) {
final Item[] available = available(this.actor) ;
if (available.length == 0) return 0 ;
final float rangePenalty = (
Plan.rangePenalty(actor, origin) +
Plan.rangePenalty(actor, destination) +
Plan.rangePenalty(origin, destination)
) / (driven... | 8 |
private Location rechercherLocation(int numero){
System.out.println("ModeleLocations::rechercherLocation()") ;
Location location = null ;
int i = 0 ;
while(i < this.locations.size() && location == null){
if(this.locations.get(i).getNumero() == numero){
location = this.locations.get(i) ;
}
else {
... | 3 |
static long amod(long dividend, long divisor) {
long mod = mod(dividend, divisor);
return (mod == 0) ? divisor : mod;
} | 1 |
public static synchronized void removeUser(int id) {
for(int i = 0; i < usersOnline.size(); i++) {
if(usersOnline.get(i).getId() == id) {
usersOnline.remove(i);
return;
}
}
} | 2 |
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.