text stringlengths 14 410k | label int32 0 9 |
|---|---|
public long asLong()
{
try {
if (isNull()) {
return 0;
} else if (isLong()) {
return ((Long) value).longValue();
} else if (isString()) {
String s = (String) value;
s=s.replaceAll(",","");
return Long.valueOf(s).longValue();
} else if (isShort()) {
return (... | 9 |
public void setThreadState(int id, boolean state) {
threadStates[id] = state;
} | 0 |
@Test
public final void testIterator() {
Iterator<SpatialTree<Sphere>> it;
SpatialTree<Sphere> tree = new SpatialTree<Sphere>(objects);
int count = 0;
it = tree.leafInterator();
while (it.hasNext()) {
for (Sphere s : it.next()) {
assertTrue(s ins... | 2 |
private void selectUnit(int x, int y) throws GameFieldException {
if (model.isAvailableUnit(x, y)) {
selectSquare(x, y);
selectedSquares = model.getAccessibleSquares(x, y);
}
} | 1 |
public Sound(String soundFile) {
try {
File file = new File("Sounds\\" + soundFile + ".mid");
soundClip = AudioSystem.getClip();
soundClip.open(AudioSystem.getAudioInputStream(file));
}
catch (LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOExcep... | 3 |
public void extractConfig(final String resource, final boolean replace) {
final File config = new File(this.getDataFolder(), resource);
if (config.exists() && !replace) return;
this.getLogger().log(Level.FINE, "Extracting configuration file {1} {0} as {2}", new Object[] { resource, CustomPlugin... | 4 |
public ActiveTestThread(Server serversim){
this.server = serversim;
} | 0 |
private void processScreenBlt(RdpPacket_Localised data,
ScreenBltOrder screenblt, int present, boolean delta) {
if ((present & 0x01) != 0)
screenblt.setX(setCoordinate(data, screenblt.getX(), delta));
if ((present & 0x02) != 0)
screenblt.setY(setCoordinate(data, screenblt.getY(), delta));
if ((present & ... | 7 |
private String formatHistory(String history) {
String[] lines = history.split("\\r?\\n");
String[] fields;
String result = "<table class=\"history\"><thead>";
for (Integer i=0; i<lines.length; i++) {
String line = lines[i].trim();
if (line.matches("(\\-+[\\s\\t]*\\|?[\\s\\t]*)+")) {
... | 8 |
@Override
public void run() {
try
{
pushStatusToTaskTracker();
//called once
reducer.setup();
// Shuffle
int count = 0;
if(lookUpJobTracker()){
MapJobsStatus status;
status = getJobTrackerServiceProvider().reportMapStatus(taskID);
while(!status.equals(... | 7 |
@Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
sendEntityDialogue(SEND_2_TEXT_CHAT,
new String[] { player.getDisplayName(), "Hey! ",
"Can you help me out?" }, IS_PLAYER,
player.getIndex(), 9827);
stage = 1;
} else if (stage == 1) {
sendEntityDialogue(SEND... | 9 |
public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... | 8 |
private static void writeCleanFile(){
try{
writer = new FileWriter("MegaDictionary.txt");
}
catch(IOException e){
System.err.println("New File Could Not Be Initialised For Writing");
}
for(int i = 0; i<words.size(); i++){
String toWrite = (words.get(i));
char[] write = toWrite.toCharArray();
... | 3 |
public static float clampFloat(float value, float min, float max)
{
return (value < min) ? min : (value > max) ? max : value;
} | 2 |
public boolean hasNextInt()
{
if(hasNext())
try
{
Integer.parseInt(token);
return true;
}
catch(Exception e)
{
return false;
}
else
return false;
} | 2 |
private boolean crossingInternal(Point2D.Double direction1, Point2D.Double direction2) {
if (angles.size() < 2) {
return false;
}
final double angle1 = convertAngle(getAngle(new Line2D.Double(center, direction1)));
final double angle2 = convertAngle(getAngle(new Line2D.Double(center, direction2)));
Double... | 9 |
public SplashScreen(int d) {
duration = d;
} | 0 |
public void checkFields(LYNXsys system) { // method to check textfields before adding book
if (!(getBookTitle().getTextField().getText().equals("")) && //check if ALL fields are provided
!(getAuthorFirstName().getTextField().getText().equals("")) &&
!(getAuthorLastName().getTextField().getText().equals("")) &&... | 7 |
public static void keyPressed(String key)
{
switch(key)
{
case "escape":
escape();
break;
case "enter":
enter();
break;
case "space":
space();
break;
}
switch(Main.Screen)
{
case "inGame":
Main.inGameManager.keyPressed(key);
break;
}
} | 4 |
public String getPackageName() {
return this.packageName;
} | 0 |
protected boolean validateHeader(byte[] header){
if(header.length != 16){
System.err.println("Invalid header. Not 16 bytes???");
return false;
}
// Now we validate the Header based on this document: http://nesdev.parodius.com/neshdr20.txt
// Bytes:
// 0 = 0x4E (charcter... | 9 |
public com.babyduncan.thrift.model.Book recv_getBook() throws org.apache.thrift.TException
{
getBook_result result = new getBook_result();
receiveBase(result, "getBook");
if (result.isSetSuccess()) {
return result.success;
}
throw new org.apache.thrift.TApplicationException(org... | 1 |
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String uri = req.getRequestURI();
if (uri.contains("/resources/")) {
super.doGet(req, res);
} else {
processRequest(req, res);
... | 1 |
private boolean processArguments(final String[] args)
throws CommandException
{
log.debug("processing arguments: " + Strings.join(args, ","));
if (args.length == 0)
{
throw new CommandException("Command requires arguments");
}
String sopts = "-:";
LongOpt[] lopts ... | 7 |
public static int[] createHashes(byte[] data, int hashes) {
int[] result = new int[hashes];
int k = 0;
byte salt = 0;
while (k < hashes) {
byte[] digest;
synchronized (digestFunction) {
digestFunction.update(salt);
salt++;
... | 4 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Delivery delivery = deliveries.get(rowIndex);
Item item = delivery.getItem();
if (columnIndex == NUMBER) {
return item.getNumber();
} else if (columnIndex == TYPE) {
return item.getModel().get... | 5 |
@Override
public void tick(ControlleurObjets controlleur) {
if(++timer >= 3){
frame++;
timer = 0;
}
if(frame >= 4 && exploding == false) {
frame = 0;
}
else if (exploding && frame == 3) {
try {
jeu.gameOver();
... | 8 |
public boolean loadSingleImage(String fnm, String name, float transperancy, short red, short green, short blue) {
if (name.equals("")) {
name = getPrefix(fnm);
}
if (imagesMap.containsKey(name)) {
EIError.debugMsg("Error: " + name + "already used", EIError.ErrorLevel.Err... | 6 |
@EventHandler
public void EnderDragonInvisibility(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEnderDragonConfig().getDouble(... | 6 |
public Vertex[] pathDFS(Vertex source, Vertex target) {
if (graph.containsKey(source) && graph.containsKey(target)) {
Graph tree = new Graph();
Stack<Vertex> S = new Stack<Vertex>();
S.push(source);
source.setVisited(true);
boolean pathFound = false;
... | 8 |
public static ArrayList<bConsulta> getListaProdData(String dt1, String arg_gmp) throws SQLException, ClassNotFoundException {
ArrayList<bConsulta> sts = new ArrayList<bConsulta>();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Ma... | 4 |
public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbSecAppByUJEEMountIdxKey ) {
GenKbSecAppByUJEEMountIdxKey rhs = (GenKbSecAppByUJEEMountIdxKey)obj;
if( getRequiredClusterId() < rhs.getRequiredClusterId() ) {
return( -1 );
}
else if( getRequired... | 9 |
public void cutSelection() {
if (selected) {
copySelection();
if (wave.length() - (selectEnd - selectStart + 1) <= 0) {
wave = null;
selectNone();
observer.waveCanvasEvent (this, NULL);
} else {
double[] s = wave.getWave();
double[] d = new double [wave.length() - (select... | 7 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (this.averageGroundLevel < 0... | 8 |
private int pickGene() {
double selector = Math.abs(random.nextDouble())%fitnessSum;//random number between 0 and fitnessSum
int j = 0;
double count = fitnesses[j];
while(count < selector && j<fitnesses.length-1){
count += fitnesses[++j];
}
return j;
} | 2 |
@Override
public Combinaison obtenirCombinaison()
{
Pion[] pions = new Pion[Mastermind.NOMBRE_DE_PIONS_A_DECOUVRIR_PAR_DEFAUT] ;
while(!(this.combinaisonValidee))
{
System.out.println("Veuillez validé la combinaison");
}
for(int numeroPion = 0 ; numeroPion < Mastermind.NOMBRE_DE_PIONS_A_DECOUVRIR_P... | 2 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CToJavaMessage other = (CToJavaMessage) obj;
if (this.Z != other.Z) {
return false;
}... | 9 |
public Record parseDiscogRelease(int id) throws IOException
{
URL url = new URL(base.replace("ID", "" + id));
try
{
// System.err.println(url);
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
uc.addRequestProperty("Accept-Encoding", "gzip");
uc.a... | 5 |
public boolean isLambdaTransition(Transition transition)
{
MealyTransition t = (MealyTransition) transition;
if(t.getLabel().equals(LAMBDA))
return true;
else
return false;
} | 1 |
public void activateDialogs() {
if(currentDialogBox == null && dialogQueue.size() > 0)
checkDialogs();
} | 2 |
public void start() {
Timer timer = new Timer(10, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
long duration = System.currentTimeMillis() - startTime;
progress = (double) duration / (double) runTime;
if (progress > 1f) {
progress = 1f;
((Timer) e.getSource(... | 1 |
@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
if (!(msg instanceof Frame)) {
return msg;
} else if (msg instanceof HeartBeatFrame) {
return ChannelBuffers.wrappedBuffer(new byte[] { '\n' });
}
Frame frame = (Frame) msg;
// COMMAND
Strin... | 9 |
public static String removeNonLiteralSpaces(String toRemove) {
char[] chars = toRemove.toCharArray();
toRemove = "";
boolean inQuotes = false;
for(char c : chars) {
if(c == '"') {
inQuotes = !inQuotes;
}
if(!inQuotes) {
... | 4 |
public void liblinear_predict_with_kbestlist(Model model, FeatureNode[] x, KBestList kBestList) throws MaltChainedException {
int i;
final int nr_class = model.getNrClass();
final double[] dec_values = new double[nr_class];
Linear.predictValues(model, x, dec_values);
final int[] labels = model.getLabels();
... | 8 |
public static boolean fileprocess(String downloadpath, String filepath, String sn){
int errorcode=0;// print error code in the final output file;
int errornum = 3;
String result="PASS";
File downloadfile = new File(downloadpath+"\\factory_image_version.txt");
File outputfile = new File(filepath);
... | 7 |
public void dump()
{
log.debug( "Dumping out PackageManager structure" );
Enumeration pts = this.getPackageTypes();
while ( pts.hasMoreElements() )
{
//get the current package and print it.
PackageType current = (PackageType) pts.nextElement();
... | 2 |
public void inicializar(int i,final Player enemy) {
this.enemy=enemy;
this.posicionesMapa = new JLabel[mNumeroDeFilas][mNumeroDeColumnas];
for( int columna = 0 ; columna < this.mNumeroDeFilas ; columna ++ ) {
for( int fila = 0 ; fila < this.mNumeroDeColumnas ; fila ++ ) {
... | 8 |
public ArrayList<Test>parse(String testFile){
try{
String path = getClass().getResource ("/" + testFile).getFile();
InputStream is = getClass().getResourceAsStream("/" + testFile);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
... | 3 |
public void createWeapon(Node node) {
Node n = node.getFirstChild();
while(n != null) {
if(n.getNodeType() == Node.ELEMENT_NODE) {
selectWeapon(n.getNodeName());
weapon.createFromXML(n.getChildNodes());
}
n = n.getNextSibling()... | 2 |
private static void sobelFile(String filename, int numIterations,
boolean rle) {
System.out.println("Reading image file " + filename);
PixImage image = ImageUtils.readTIFFPix(filename);
PixImage blurred = image;
if (numIterations > 0) {
System.out.println("Blurring image file.");
blurred = image.boxBl... | 3 |
@Override
public void startTrade() {
if(presenter.isPlayersTurn()) {
getTradeOverlay().setStateMessage("set the trade you want to make");
getTradeOverlay().setResourceSelectionEnabled(true);
getTradeOverlay().setPlayerSelectionEnabled(false);
getTradeOverlay().setTradeEnabled(false);
Player player =... | 3 |
public void initFromXML( Element node )
{
NodeList nList = node.getElementsByTagName("replacespace") ;
Element elem = null ;
// a settings entry was found
if (nList != null)
{
if (nList.getLength() > 0)
{
elem = (Element) nList.item(0) ;
Boolean bool = new Boolean( ele... | 6 |
public static <T> Collection<T> shuffleCopyOfCollection(Collection<T> original)
{
ArrayList<T> shuffled = new ArrayList<> ();
ArrayList<T> originalCopy = new ArrayList<> (original);
while ( !originalCopy.isEmpty ()) {
int next = Randomiser.randIntBetween (0, originalCopy.size ());
shuffled.add (original... | 1 |
public void muestraVariable(String archivo) throws FileNotFoundException, IOException
{
File var = new File(archivo);
RandomAccessFile raf = new RandomAccessFile(archivo, "rw");
String temp = "";
while(raf.length() > raf.getFilePointer())
{
... | 3 |
public synchronized boolean shot(Position position){
if ((position.getX() <= this.getXLength()) || (position.getY() <= this.getYLength())) return false;
if (field[position.getX()][position.getY()] != null) {
return field[position.getX()][position.getY()].fired();
}
return fal... | 3 |
public void changePosition(Player player, ArrayList <Monster> monsters)
{
Rectangle newPosition = new Rectangle(
position.x + direction.x,
position.y + direction.y,
WIDTH, HEIGHT);
// If I'm hitting a player, tell him and then get set to die
if (newPosition.intersects(player.getBox()))
{
pla... | 6 |
public final MapleCharacter killBy(final MapleCharacter killer) {
int totalBaseExp = (int) (Math.min(Integer.MAX_VALUE, (getMobExp() * (killer.getLevel() <= 10 ? 1 : killer.getClient().getChannelServer().getExpRate()))));
AttackerEntry highest = null;
int highdamage = 0;
for (final AttackerEntry attackEntry : attac... | 7 |
private void initMovementAndBackground() {
maxXMovement = level.getWidth() * level.getTileSize() - GamePanel.WIDTH;
maxYMovement = level.getHeight() * level.getTileSize() - GamePanel.HEIGHT;
xMovement = player.getxPos() - (GamePanel.WIDTH / 2);
yMovement = player.getxPos() - (GamePanel.HEIGHT / 2);
if (xMovem... | 5 |
public void count(Pet pet){
for(java.util.Map.Entry<Class<? extends Pet>, Integer> pair: this.entrySet())
if(pair.getKey().isInstance(pet))
put(pair.getKey(),pair.getValue() + 1);
} | 3 |
@Override
public ResultSet query(String query) {
Statement statement = null;
ResultSet result = null;
try {
connection = this.open();
statement = connection.createStatement();
switch (this.getStatement(query)) {
case SELECT:
result = statement.executeQuery(query);
return result;
... | 5 |
public String RGBtoHEX(int r, int g, int b) {
final int MIN_LENGTH = 2;
String red = Integer.toHexString(r);
//String.format("%02", red);
if (red.length() < MIN_LENGTH) {
red = "0" + red;
}
String green = Integer.toHexString(g);
//String.format("%02", green);
if (green.length() < MIN_LENGTH) {
gre... | 3 |
public void conecta() throws SerialPortTimeoutException{
String mac = red.obtenerDireccionMac();
String fecha = f.obtenerFecha();
SerialPort serialPort = new SerialPort("/dev/ttyACM0");
int temp = 1;
try {
System.out.println("Port opened: " + serialPort.openPort());
... | 6 |
public static void makeRandomDouble(Matrix matrix) throws MatrixIndexOutOfBoundsException {
int rows = matrix.getRowsCount();
int cols = matrix.getColsCount();
double temp = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
// fill with ran... | 2 |
public TreeElement fillTree(String expression) throws WrongStructure, IncorrectSymbol, ImpossibleAction{
if (isComponent(expression.charAt(counter))) {
counterUp();
TreeElement currentOperation = new Operation(expression.charAt(counter));
counterUp();
if (isCompon... | 7 |
public static String deviceIdToMac(String deviceId) {
if (deviceId.length() != 20) {
return "";
}
String macStr = deviceId.substring(8, 20);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 12; i++) {
sb.append(macStr.charAt(i));
if (i % 2 == 1) {
sb.append(":");
}
}
sb.deleteCh... | 3 |
public static int sample(double[] probs, int T) {
// roulette sampling
double []pt = new double[T];
//System.out.print(p[0]);
pt[0] = probs[0];
for (int i = 1; i < T; i++) {
pt[i] = probs[i] + pt[i-1];
// System.out.print(" " + pt[i]);
}
// System.out.println();
// scaled sample because of unnor... | 4 |
private void anchorNode(Node node) {
if (this.anchors.containsKey(node)) {
String anchor = this.anchors.get(node);
if (null == anchor) {
anchor = generateAnchor();
this.anchors.put(node, anchor);
}
} else {
this.anchors.put(... | 6 |
public void command(CommandSender sender, Player player, String[] cmd){
//
// GETS THE STRING TO REFER TO TO GET THE COMMAND
//
if(cmd[0].equalsIgnoreCase("add")){
// CHECKS IF THE PLAYER IS ALREADY IN THE PROCESS OF ADDING A COMMAND
i... | 8 |
protected final int shiftKeys(int pos) {
// Shift entries with the same hash.
int last, slot;
for (;;) {
pos = ((last = pos) + 1) & mask;
while (used[pos]) {
slot = (it.unimi.dsi.fastutil.HashCommon
.murmurHash3((key[pos]))) & mask;
if (last <= pos ? last >= slot || slot > pos : last >= slot
... | 7 |
private String cipher_digraph(String pl,HashMap<Character,Pair<Integer> > h1, HashMap<Character,Pair<Integer>> h2, HashMap<Character,Pair<Integer>> h3)
{
assert(pl.length()==2);
StringBuilder sb=new StringBuilder();
char c1=pl.charAt(0);
char c2=pl.charAt(1);
if(c1=='J')
{
c1='I';
}
if... | 4 |
protected synchronized void processEvent(Sim_event ev)
{
switch ( ev.get_tag() )
{
case GridSimTags.PKT_FORWARD:
case GridSimTags.JUNK_PKT:
processNetPacket(ev, ev.get_tag());
break;
case GridSimTags.ROUTER_AD:
rece... | 4 |
protected boolean isIOLogic(PrimitiveType type) {
return ((type == PrimitiveType.ILOGIC)
|| (type == PrimitiveType.ILOGIC2)
|| (type == PrimitiveType.ILOGICE1)
|| (type == PrimitiveType.ILOGICE2)
|| (type == PrimitiveType.ILOGICE3)
|| (type == PrimitiveType.OLOGIC)
|| (type == PrimitiveType.OL... | 9 |
@Override
protected EntityManager getEntityManager() {
return em;
} | 0 |
public void incrementInvalidRxCount() {
invalidRxPackets++;
setChanged();
notifyObservers();
} | 0 |
private void sarsa(int reward, Weights weights, double x_i[], double[] x_ip1)
{
// Set some local variables.
double[] w = weights.getWeights();
double wx = 0.0f;
double sig = 0.0f;
// Compute y_i.
double wxp1 = 0.0f;
for (int j = 0; j < FeatureExplorer.getNumFeatures(); j++) wxp1 += w[j] * x_ip1[j];
d... | 7 |
public P2PManager() {
addListener(new ActionListener() {
@Override
protected TaskAction getListenAction() {
return TaskAction.FETCHUSER_PROCESS;
}
@Override
protected void onAction(HashMap<String, String> params) {
if(p... | 9 |
private void evalCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_evalCancelButtonActionPerformed
if (isRunning == true) {
try {
interactor.cancelLastCommand();
} catch (Exception e) {
}
setGUIToIdleMode();
} else {
setGUIToRunningMode();
new Thread() {
... | 3 |
public String getValue(int place) {
ListElement current = head;
if (place <= count) {
for (int i = 1; i < place; i++) {
current = current.next();
}
return current.getValue();
} else {
return "error";
}
} | 2 |
@Test
public void executeScenario() throws UnknownHostException {
logger_.info("[Repair Scenario 5 Start] Peer on \"1\" repairs subtree on \"0\"");
Injector injector = ScenarioSharedState.getInjector();
localPeerContextInit(injector);
LocalPeerContext context = injector.getInstance(... | 2 |
private void goalieBehaviour(){
final int REACTION_DISTANCE = 20;
final int HOME_DISTANCE = 5;
//the first state has the goalie wait in goal but constantly look for the ball
if(playerState == 0){
turnTowardBall();
//the goalie state changes when the ball moves to... | 8 |
public static void initconfigration()
{
if(driver == null){
if(Constants.browser.equals("firefox")){
driver = new FirefoxDriver();
}
else if(Constants.browser.equals("ie")){
System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
driver = new Inter... | 4 |
public void run() {
if (player.getLocation().getBlockX() != pX || player.getLocation().getBlockY() != pY || player.getLocation().getBlockZ() != pZ) {
plugin.sendMessage(player,GRAY+F("recallingToLifestone", GREEN + Config.recallDelay + GRAY));
//plugin.sendMessage(player, GRAY+L("movedTooFarAttunementFailed"... | 3 |
public static void skip10Lines(){
int count=0;
if(count<10)
skip10Lines();
} | 1 |
private Set<Card> threeFoursWithFlush() {
return convertToCardSet("3D,6D,2D,4S,4D,4C,9D");
} | 0 |
public static LookManager getInstance(){
if(instance == null){
instance = new LookManager();
}
return instance;
} | 1 |
public Set<Map.Entry<Float,Double>> entrySet() {
return new AbstractSet<Map.Entry<Float,Double>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TFloatDoubleMapDecorator.this.isEmpty();
}
... | 8 |
public String build(Request request, HttpClient client) throws Exception {
String query = DDG_API_URL + "q=" + this.escape(request.getQuery());
if (request.isStandard()) {
query += ARG_STD;
} else {
query +=(request.isNoHtml()) ? AMP + ARG_NO_HTML : "";
//query += AMP + ((request.isNoRedirect()) ? ... | 6 |
@Override
public void validate() {
if (platform == null) {
addActionError("Please Select Platorm");
}
if (location == null) {
addActionError("Please Select Location");
}
if (iphone.equals("Please select")) {
addActionError("Please Sele... | 5 |
public static MapLoader getInstance(){
if(instance == null){
instance = new MapLoader();
}
return instance;
} | 1 |
public static void main(String[] args)
{
int[] dims = new int[]{4,40,20};
Object array = Array.newInstance(Integer.TYPE, dims);
Class<?> classType = array.getClass().getComponentType();
System.out.println(classType);
Object arrayObj = Array.get(array, 2);
Class<?> cla... | 2 |
public Document braceMatch(String pennTree)
throws ParserConfigurationException {
ArrayList<Integer> contentTree = new ArrayList<Integer>();
ArrayList<Element> nodes = new ArrayList<Element>();
DocumentBuilderFactory domFactory = DocumentBuilderFactory
.newInstance();
domFactory.setNamespaceAware(true); ... | 9 |
public static Double transmittance(Double transmittance, Double molarAbsorbtivity, Double cuvetteWidth, Double concentration)
{
boolean[] nulls = new boolean[4];
nulls[0] = (transmittance == null);
nulls[1] = (molarAbsorbtivity == null);
nulls[2] = (cuvetteWidth == null);
nulls[3] = (concentration == null);
... | 7 |
public static UUID mint(int ver, String node, String ns)
throws UUIDException, Exception {
/* Create a new UUID based on provided data. */
switch (ver) {
case 0:
case 1:
throw new UUIDException("Unimplemented");
// return new UUID(mintTime(node));
case 2:
// Version 2 is not supported
throw new... | 6 |
public static boolean addStation(ObjectOutputStream toServer, ObjectInputStream fromServer, Scanner scanner) throws IOException, ClassNotFoundException {
log.debug("Start \"addStation\" method");
List<String> listAllStation = PassengerHomePageHelper.listStations(toServer, fromServer);
String sta... | 5 |
protected void parseEndTag() {
// 1. read name (skipping the </ part)
int i;
for (i = position + 2; i < text.length(); i++) {
char c = text.charAt(i);
if (Character.isSpaceChar(c) || c == '>') {
break;
}
}
String tagName = text.substring(position + 2, i).toLowerCase();
... | 8 |
void creatingGui() {
m_window = new JFrame("Othello");
m_window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
m_window.setLayout(new GridBagLayout());
m_window.getContentPane().setBackground(Color.GREEN);
GridBagConstraints c = new GridBagConstraints();
m_window.setIconImage(new ImageIcon(this.getCl... | 6 |
public SmashServer(SmashGame gamer, Map map){
this.game=gamer;
game.init(map, this);
instance = this;
try {
setServer(new ServerSocket(328));
} catch (IOException e) {
e.printStackTrace();
}
new Thread(new Runnable(){
@Override
public void run() {
while(getMAX_PLAYERS()==10)
try {
... | 7 |
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperty")
public JAXBElement<SignaturePropertyType> createSignatureProperty(SignaturePropertyType value) {
return new JAXBElement<SignaturePropertyType>(_SignatureProperty_QNAME, SignaturePropertyType.class, null, value);
... | 0 |
private static String DataToStiring(classifiedData Data){
String out = "";
//Add Cedd data
int i = 0;
for(i = 0; i < Data.getCEDDData().length; i++){
out = out + Data.getCEDDData()[i] + ",";
}
// System.out.println("CEDD data added for image " + Data.getImgName() + " is: " + i);
//Add FCTH dat... | 2 |
private String showToUser(ArrayList<TaskData> taskToShow) {
String text = "";
SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
SimpleDateFormat f = new SimpleDateFormat("EEE, d MMM yyyy HH:mm");
int i = 1;
for (TaskData t : taskToShow) {
text += i + ": ";
text += t.getContent();
... | 7 |
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.