text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Topic getTopic(int Id) {
Connection connection = ConnectionManager.getConnection();
if (connection == null) {
logger.log(Level.SEVERE, "Couln't establish a connection to database");
return null;
}
try {
PreparedStatement ps = connection.... | 3 |
public void update(long elapsedTime) {
Creature player = (Creature)map.getPlayer();
// player is dead! start map over
if (player.getState() == Creature.STATE_DEAD) {
if(player.getVida()<0) {
map = resourceManager.reloadMap();
player=(Creature)map.get... | 5 |
public final CecilParser.unaryinstruction_return unaryinstruction() throws RecognitionException {
CecilParser.unaryinstruction_return retval = new CecilParser.unaryinstruction_return();
retval.start = input.LT(1);
try {
// C:\\Users\\Shreeprabha\\Documents\\GitHub\\CecilRPi\\src\\org\\raspberrypi\\cecil\\mode... | 9 |
public void printGlyphs(){
for (Map.Entry<Integer,Glyph> entry: glyphs.entrySet()){
System.out.println(entry.getKey() + ": " + entry.getValue().toString());
}
} | 1 |
public void result() {
System.out.println("---------------------------------------------------------------------------");
System.out.println("Nombre de changements de contexte : " + this.nombreChangementsContexte);
System.out.println("---------------------------------------------------------------------------"... | 4 |
public static void reverseLevelOrderPrint(TreeNode<Integer> root) {
if(root == null) {
return;
}
Queue<TreeNode<Integer>> queue = new LinkedList<>();
queue.offer(root);
Stack<ValueAndLevel> stack = new Stack<>();
int currentLevel = 0;
int currentLev... | 8 |
public void output() {
Iterator<TreeValue> step = new TreeIterator<>(root);
while (step.hasNext()) {
System.out.println(" " + step.next());
}
} | 1 |
public static void main(String[] args) {
// TODO Auto-generated method stub
if(args.length != 2){
System.err.println("Usage: java IMClient <host ip/name> <port>");
System.exit(1);
}
String hostName = args[0];
int portNumber = Integer.parseInt(args[1]);
try (
Socket imSocket = new Socket(hostName,po... | 4 |
public OrcHero(int room) {
super(new ThunderStorm(), new SpiralPierce(), 91.0*room, 105.0*room, 70.00*room, 2.0*room, 1.0*room, 30.0*room, "Orc Hero");
} // End DVC | 0 |
public void open(float time, float delay)
{
if(opening || open)
return;
startTime = (double)Time.getTime()/(double)Time.SECOND;
openTime = startTime + (double)time;
startCloseTime = openTime + (double)delay;
closeTime = startCloseTime + (double)time;
opening = true;
closing = false;
AudioUtil.... | 2 |
@SuppressWarnings("unchecked")
protected T createObject(String line) {
String vals[] = line.split(separator);
// Create a new instance
T tObj;
try {
tObj = (T) clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
// Populate values
int maxFieldNum = Math.min(vals.length... | 9 |
private String prepareConfigString(String configString) {
int lastLine = 0;
int headerLine = 0;
String[] lines = configString.split("\n");
StringBuilder config = new StringBuilder("");
for(String line : lines) {
if(line.startsWith(this.getPluginName() + "_COMM... | 8 |
public Location GeoCodeAddressByPpostcode(String postcode) {
//System.out.println("looking for " + postcode );
for(Location loc : this.locations) {
//System.out.println(loc.straatnaam+" == "+straatnaam);
if ( loc.postcode.equals(postcode) ) {
// System.out.println("Found " + loc.lat +","+ loc.lng );
... | 2 |
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... | 1 |
public void openBrace() {
if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) {
print(currentLine.length() > 0 ? " {" : "{");
println();
} else {
if (currentLine.length() > 0)
println();
if ((Options.outputStyle & Options.BRACE_FLUSH_LEFT) == 0
&& currentIndent > 0)
tab();
println("{"... | 5 |
private float performCalculations(List<String> parsed, String element, float result, int i) {
float n1 = Float.valueOf(parsed.get(i - 2));
float n2 = Float.valueOf(parsed.get(i - 1));
if (OPERATION_PLUS.equals(element)) {
result = n1 + n2;
}
if (OPERATION_MINUS.equal... | 4 |
public Object process(Object value, ValueProcessInvocation invocation) throws BeanMappingException {
BeanMappingField field = invocation.getContext().getCurrentField();
BeanMappingBehavior behavior = field.getBehavior(); // 每个属性mapping都会有一个behavior,允许覆盖上层
// 判断一下value的null 情况
if (value ... | 8 |
private static Word removeDoubleLetter(Word word)
{
int currentsize;
int previoussize;
Word initialword = word.clone();
word = replaceCensoredWord(word);
do
{
previoussize = word.Text.length();
for(int i = 0; i < 26; i++)
{
char a = 'a';
a += i;
word.Text = word.Text.replace("" + a +... | 6 |
public static boolean isTypeNumber(Class<?> type) {
return (type != null && isAssignable(type, Number.class));
} | 2 |
public void queueBytes(int len, byte buf[]) throws IOException {
if (closed) {
return;
}
if (hasIOError) {
hasIOError = false;
throw new IOException("Error in writer thread");
}
if (buffer == null) {
buffer = new byte[5000];
}
synchronized (this) {
for (int l = 0; l < len; l++) {
buffer... | 6 |
public EncryptedDeck encryptDeck(Deck deck)
throws InvalidKeyException, IllegalBlockSizeException,
BadPaddingException {
if (e == null) {
System.err
.println("Cannot encrypt when using decrypting constructor RSAService(gp, gq, gd)");
return null;
}
EncryptedDeck encDeck = new EncryptedDeck();
... | 3 |
private void longStart() {
// long init in background
Task<Void> task = new Task<Void>() {
@Override
protected Void call() throws Exception {
sfLd.start();
imgLd.start();
do {
try {
Threa... | 3 |
public void decide(int decision) {
if (index<(network.numProposers+network.numAcceptors))
throw new Error("Non-learner should not be deciding a value");
if (decision>=network.numProposers)
throw new Error("The decided value was not an initial value...");
synchronized(network) {
if (netwo... | 4 |
public static String guessFileExtensionFromFormat(String format){
switch(format.toUpperCase()){
case "TURTLE":
return "ttl";
case "RDF/XML":
return "rdf";
case "N-TRIPLE":
return "nt";
case "N3":
return "n3";
default:
return "txt";
}
} | 4 |
public boolean saveSpecificPalette(Component parentComponent, NESPaletteListener listener, int palType, int start, int dur){
if(palType != PPUConstants.IMAGE_PALETTE_TYPE && palType != PPUConstants.SPRITE_PALETTE_TYPE){
System.err.println("Invalid palType:" + palType);
return false;
}
if(start < 0 || start ... | 8 |
public boolean rookCheckVertical(int[][]board, int sx, int sy, int x, int y) {
if (sy < y) {
for (int i = sy + 1; i < y; i++) {
if (board[i][sx] != 0) {
return false;
}
}
return true;
} else {
... | 5 |
public int doHit(String counterID, boolean increment) {
Connection conn = ConnectionManager.getConnection();
if (counterID == null || "".equals(counterID)) {
return -1;
}
if (conn == null) {
return -1;
}
try {
if (increment) {
PreparedStatement hitStatement = conn
.prepareStatement("IN... | 8 |
public static int calculateNumberOfTrailingZerosInFactorial(int N){
int countTwo = 0, countFive=0;
for(int i = 1; i<=N; i++){
if(i%2==0){
countTwo++;
int temp = i;
while((temp/2)%2 == 0){
countTwo++;
temp/=2;
}
}
if(i%5==0){
countFive++;
int temp = i;
while((temp/5)%5... | 5 |
@Override
public void run() {
InetAddress group = null;
MulticastSocket s = null;
try {
group = InetAddress.getByName(Main.MULTICAST_ADDR);
s = new MulticastSocket(Main.MULTICAST_PORT);
s.joinGroup(group);
s.setSoTimeout(500);
byte[] buf = new byte[1000];
DatagramPacket recv = new... | 8 |
public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... | 8 |
@Override
PreparedStatement prepare(String query) {
try {
connection = open();
PreparedStatement ps = connection.prepareStatement(query);
return ps;
} catch (SQLException e) {
if (!e.toString().contains("not return ResultSet"))
this.writeError("Error in SQL prepare() query: " + e.getMessage(), fals... | 2 |
public PaneGraph(String titleGraph, List<Coordinates[]> listCoordinates){
this.titleGraph = titleGraph;
this.listCoordinates =(ArrayList)listCoordinates;
} | 0 |
public static List<Integer> getRandomBitonicList() {
List<Integer> bitonicList = new ArrayList<>();
List<Integer> list = new ArrayList<>();
Set<Integer> set = new HashSet<>();
int n = 5000, r = 10000;
while (list.size() < n) {
final int uniform = StdRandom.uniform(r);... | 7 |
public boolean hasPit(int x, int y)
{
if (!isValidPosition(x,y)) return false;
if (isUnknown(x,y)) return false;
if (w[x][y].contains(PIT))
return true;
else
return false;
} | 3 |
public static void main(String[] args) throws Exception {
String inFile = args[0];
String outFile = args[1];
boolean append = "append".equals(args[2]);
// load file and instantiate class. File may use any valid
// BOM marker bytes at the start. System default charset is
// used if ... | 2 |
public static String display(Object object)
{
if (object == null)
{
return null;
}
try
{
// Invoke toString if declared in the class. If not found, the NoSuchMethodException is caught and handled
object.getClass().getDeclaredMethod("toString");
retu... | 9 |
private void setInfo(InfoLevel infoLevel, String infoMessage, Object... parameters) {
Logger.getLogger(InfoInterface.class.getName()).entering(InfoInterface.class.getName(), "InfoInterface", new Object[] {infoLevel, infoMessage, parameters});
switch (infoLevel.stringValue()) {
case "INFO":
... | 5 |
public static Stack<Integer> sortStack(Stack<Integer> stack) {
Stack<Integer> buffer = new Stack<Integer>();
while (!stack.isEmpty()) {
int temp = stack.pop();
while (!buffer.isEmpty() && buffer.peek() >= temp) {
stack.push(buffer.pop());
}
buffer.push(temp);
}
return buffer;
} | 3 |
private void reload(IFile file) {
setPartName(basePartName);
this.providerDefinition = null;
this.selectedFile = null;
if (file == null || !file.exists())
return;
if (viewer.getContentProvider() != null)
// to avoid one provider trying to interpret an
... | 8 |
protected boolean isValidSpot(int xStart, int yStart, int xMoved, int yMoved) {
//iterated through all possible x and y positions for diagonal movement, returns true if
for(int i = 0; i < 9; i++) {
if(((xMoved == xStart + i) || (xMoved == xStart - i)) &&
((yMoved == yStart + i) |... | 6 |
public boolean isExpired(PlayerAccount acct, Session session, MOB mob)
{
if(!CMProps.getBoolVar(CMProps.Bool.ACCOUNTEXPIRATION))
return false;
if((acct!=null)&&(acct.isSet(PlayerAccount.AccountFlag.NOEXPIRE)))
return false;
long expiration;
if(mob!=null)
{
if((CMSecurity.isASysOp(mob)||CMSecurity.is... | 8 |
public SimpleStringProperty zipCodeProperty() {
return zipCode;
} | 0 |
private void regulateFPS(final long timeStart) {
long timePassed = System.nanoTime() - timeStart;
if (timePassed < DELTA_TARGET_NANOS) {
long sleepTime = DELTA_TARGET_NANOS - timePassed;
long millis = sleepTime / (1000 * 1000);
int nano = (int) (sleepTime % (1000 * 1000));
try {
Thread.sleep(milli... | 2 |
protected Scorpion scorpionMove(short[][][] maze, Human man) {//Horizontal then vertical
// This method was written using a different logic than the current one
Scorpion tam = new Scorpion(this.getX(), this.getY());
if (tam.samePlace(man)) {
return tam;
} else {
... | 9 |
public OpenURLAction(){
super("Open URL", null);
} | 0 |
public static boolean Disparo(Cancha cancha, int equipoA, int jugadorA,int equipoD,int jugadorD, Pelota pelota) {
float di=cancha.getEquipoX(equipoA).getJugadorX(jugadorA).getDisparo();
di=di*Factorf.factorF();
//centro arco, hay que usar el mas cercano al jugador pero da paja
int ... | 4 |
public Boolean invalido(String lexema) {
String estado = "q0";
char caracter = ' ';
int t = lexema.length();
int p = 0;
if (!token.equals("") && !token.equals("erro")) {
return false;
}
while (p < t) {
caracter = lexema.charAt(p);
... | 8 |
@Override
public void doAction (String o)
{
if ("Input".equals(o))
{
Out.println(Input.getText());
Input.remember(Input.getText());
Output.append(Input.getText() + "\n", Color.green.darker());
Input.setText("");
}
else if (Global.resourceString("Game").equals(o))
{
new GameQuestion(this);
}... | 6 |
@Override
public int hashCode() {
int result = saleId;
result = 31 * result + itemId;
return result;
} | 0 |
public void changeNumLayers(int newLayerNum){
// if(newWidth > 0 && newHeight > 0){
int tileSize = parent.tilePanel.getTileSize();
int[][][] temp = new int[tileID.length][tileID[0].length][tileID[0][0].length];
//do this for every layer
for(int k = 0; k < tileID.length; k++){
//copy old array
... | 5 |
private int countEdges(Graph g) {
int edges = 0;
while (g.getEdges().get(edges) != null) {
edges++;
}
return edges;
} | 1 |
@Override
public void deleteReadyFood(ReadyFood rf) throws FoodDaoException {
Element rfsElement = (Element) rfDoc.getElementsByTagName("ReadyFoods")
.item(0);
NodeList rfNodeList = rfsElement.getElementsByTagName("ReadyFood");
boolean deleted = false;
if (rfNodeList.getLength() > 0) {
for (int i = 0; i... | 7 |
public static void printMenu() throws IOException {
Key option;
do {
Terminal term = new Terminal();
term.clear();
term.title("Opciones chorras");
term.out("1.- HelloWord");
term.out("2.- 2+2?");
term.out("3.- Answer to most important question");
term.out("4.- Submenu");
term.out("Q+ Quit");
I... | 8 |
public CycList<Object> queryVariableLow(final CycVariable queryVariable,
final InferenceResultSet rs)
throws UnknownHostException, IOException, CycApiException, TimeOutException {
CycList result = new CycList();
try {
if (rs.getCurrentRowCount() == 0) {
return result;
}
... | 4 |
public static List<Integer> getMSTXAdsID() {
List<Integer> result = new ArrayList<Integer>();
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = con.prepareStatement("select gid from mstx_ads;");
rs = pstmt.executeQuery();
while (rs.next()) {
... | 8 |
private void loadScripts() throws IOException {
BufferedReader cfg = new BufferedReader(new FileReader(world.getWorkingDirectory() + "data/script_list.txt"));
try {
int lineNumber = 0;
String line;
while ((line = cfg.readLine()) != null) {
if (line.startsWith("#") || line.trim().length() == 0) {
c... | 6 |
private int paintStr()
{
//nothing to draw
if (words.size() == 0 || words.get(0).getStart() > currentTime)
{
System.out.println("nothing to do at " + currentTime);
return 0;
}
//already expires
if (!words.get(0).exists(currentTime))
{
// System.out.println(words.get(0).getLabel().getStr() + ... | 9 |
public void moveY(int dy)
{
if( (dy == -1 && this.dy != -1) ||
(dy == 1 && this.dy != 1)){
this.dy += dy;
}
} | 4 |
public int size() {
int result = super.size();
if (!isProperList()) {
result++;
}
return result;
} | 1 |
public int get(int at) throws JSONException {
if (at < 0 || at > this.length) {
throw new JSONException("Bad character at " + at);
}
return ((int) this.bytes[at]) & 0xFF;
} | 2 |
public int get(int row, int clums) {
int i = 0;
File f = new File("C:/config/config.xlsx");
try {
InputStream input = new FileInputStream(f);
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(input);
XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0);
XSSFRow xssfRow = xssfSheet.getRow(row - 1);
XSSFCell ... | 1 |
protected double[] makeDistribution() throws Exception {
double total = 0;
double[] distribution = new double[m_TrainBags.numClasses()];
boolean debug = false;
total = (double)m_TrainBags.numClasses() / Math.max(1, m_TrainBags.numInstances());
for(int i = 0; i < m_TrainBags.numClasses(); i++)... | 8 |
public boolean equals(Object obj) {
if ( obj instanceof OperationResourceInfo ) {
OperationResourceInfo that = (OperationResourceInfo)obj;
return this.url.equals(that.url) && this.method.equals(that.method);
}
return false;
} | 2 |
private final void setMinimumButtonBounds()
{
for (int i = 0; i < tButtons.size(); i++)
{
TButton b = tButtons.get(i);
if (resizeButtonArray.get(i))
if (orientation == HORIZONTAL)
{
if (b.width > minButtonWidth)
minButtonWidth = b.width;
b.height = he... | 6 |
public static final boolean isCSharp(String fileName) {
for (String file : C_SHARP) {
if (file.equals(fileName)) {
return true;
}
}
return false;
} | 2 |
public boolean pickAndExecuteAnAction() {
//let customer know if restaurant is full
if (isRestaurantFull()){
for (SmilehamCustomer iCustomer : mWaitingCustomers){
iCustomer.msgRestaurantFull();
}
}
for (Table iTable : mTables) {
if ((!iTable.isOccupied() && !mWaitingCustomers.isEmpty()) && (m... | 6 |
public static double deltaHours(int calUnit, int increments) {
if (calUnit == Calendar.DATE) {
return 24 * increments;
} else if (calUnit == Calendar.HOUR) {
return increments;
} else if (calUnit == Calendar.MINUTE) {
return increments / 60;
} else if ... | 4 |
private Coordinate getCoordinate(Point point) {
int xCoordinate = (int)(point.getX() - STARTING_X_INDEX)/SIZE_OF_SQUARE;
int yCoordinate = (int)(Board.NUMBER_OF_ROWS - ((point.getY() - STARTING_Y_INDEX)/SIZE_OF_SQUARE));
System.out.println("getCoordinate: x:" + xCoordinate + " y: " + yCoordinate);
if (xCoordina... | 4 |
public void mouseReleased(MouseEvent event) {
// Did we even start at a state?
if (first == null)
return;
State state = getDrawer().stateAtPoint(event.getPoint());
controller.expandState(first, event.getPoint(), state);
first = null;
getView().repaint();
} | 1 |
public Location GeoCodeAddress(String straatnaam, String plaats) {
for(Location loc : this.locations) {
//System.out.println(loc.straatnaam+" == "+straatnaam);
if (loc.straatnaam.equals(straatnaam) && loc.plaats.equals(plaats)) {
return loc;
}
}
return new Location();
} | 3 |
public void testFactory_fromDateFields_null() throws Exception {
try {
LocalDate.fromDateFields((Date) null);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
private void onSelect(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onSelect
if (jList1.getSelectedValue() != null) {
onSelectionMade(jList1.getSelectedValue());
dispose();
}
}//GEN-LAST:event_onSelect | 1 |
private void kaverilleMahdollisetAvecitPisteytetyista(Sitsaaja sitsaaja, boolean onkoSukupuoliVaihdettu) {
List<Sitsaaja> tmp = sitsaajatPisteytettyna;
for (int i = 0; i < tmp.size(); i++) {
if (tmp.get(i) == null || onkoSitsaajaJoPlassattu(tmp.get(i)) || ovatkoSitsaajatSamaaSukupuolta(sitsa... | 8 |
private List<String> getJMXasList(String url) {
List<String> jmx = new ArrayList<String>(2);
String jmxScript = null;
String jmxScriptName = null;
try {
HttpResponse response = getJMX(url);
if (response != null) {
HeaderIterator headerIterator = re... | 4 |
@Override
public void run() {
try {
Socket receiveSocket = serverSocket.accept();
JFileChooser fileChooser = new JFileChooser();
fileChooser.setSelectedFile(new File(fileName));
if (fileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
pat... | 5 |
@Override
public List<Object> call() {
List<Object> output = new LinkedList<>();
for (SequenceEntry watsonEntry : watsonEntries) {
if (watsonEntry != null) {
Read watsonRead = map(createRead(watsonEntry, false));
Read watsonRevRead = map(createRead(watsonE... | 7 |
public AbilityPanel(int controlPanelHeight, ControlPanel controlPanel) {
super();
this.owner = controlPanel;
this.setPreferredSize(new Dimension(200, controlPanelHeight));
this.setBackground(Color.RED);
this.layout = new GridLayout(size, size);
this.layout.setHgap(10);
this.layout.setVgap(10);
this.setL... | 1 |
private void sortInputQueue() {
for (int out = inputQueue.size() - 1; out >= 1; out--) {
for (int in = 0; in < out; in++) {
// Only sort MulticastMessage
if (inputQueue.get(in) instanceof MulticastMessage) {
for (int j = in + 1; j <= out; j++) {
if (inputQueue.get(j) instanceof Multic... | 7 |
public static Model getNewInstance(ModelType type) {
if (type == ModelType.leaderElection)
return new LeaderElectionModel();
else if (type == ModelType.broadcast)
return new BroadcastModel();
else if (type == ModelType.traversal)
return new TraversalModel();
... | 3 |
public byte[] getData(){
if(blocks == null)
return null;
ByteBuffer ret = ByteBuffer.allocate(pieceSize);
for(Block b : blocks){
if(b == null){
return null;
}
ret.put(b.getData());
}
return null;
} | 3 |
@Override
public void run() {
serverState.notifyAllListener(BTServerStateObservable.SERVER_LISTENING);
try {
String uri = "btspp://localhost:" + new UUID(btservice.getServiceUUID(),false).toString()
+ ";name=" + btservice.getServiceName()+";authenticate=false;encrypt=false;master=false";
... | 3 |
public ArrayList<Problem> getNextProblems(Student student,
ArrayList<Problem> problems) {
HashMap<Integer, ArrayList<Problem>> priorityProblemMap = new HashMap<Integer, ArrayList<Problem>>();
HashMap<Skill, Integer> curStuSkillMap = student.getSkillMap();
int maxPriority = 0;
for (Problem curPro : problems) ... | 5 |
@Basic
@Column(name = "SOL_POS_ID")
public int getSolPosId() {
return solPosId;
} | 0 |
public VueMenu(CtrlAbstrait ctrl) {
super(ctrl);
initComponents();
} | 0 |
public HashMap<String,Double> readHomologyScores(String homologyFile)
{
int i=0;
HashMap<String,Double> mapHomology=new HashMap<String,Double>();
try
{
BufferedReader br=new BufferedReader(new FileReader(homologyFile));
String str="";
while((str=br.readLine())!=null)
{
String[] split=str.split(... | 3 |
public double apply(double x){
double value = 0;
ListIterator lIt = polynomial.listIterator();
while(lIt.hasNext()){
Term t = (Term)lIt.next();
value += t.factor * Math.pow(x, t.power);
}
return value;
} | 1 |
public boolean getBoolean(String key) {
Object value = get(key);
if (Boolean.TRUE.equals(value) || value instanceof String && "true".equalsIgnoreCase((String) value)) { //$NON-NLS-1$
return true;
}
return false;
} | 3 |
public static boolean isInteger(String javaType) {
if (javaType.endsWith("Long") || javaType.endsWith("Integer") || javaType.endsWith("Short")
|| javaType.endsWith("Byte")) {
return true;
}
if (javaType.endsWith("long") || javaType.endsWith("int") || javaType.endsWith("sh... | 8 |
public void update() { //Update the seperate classes
for (int i = 0; i < nlakes; i++) {
lakes[i].Update();
} for (int j = 0; j < ncraters; j++) {
craters[j].Update();
} for (int k = 0; k < narchers; k++) {
archers[k].Update(gtargets);
for (int i = 0; i < archers[k].arrows.size(); i++) {
if (!... | 7 |
private String parseValue(String val) throws Exception
{
BlankVar var;
Matcher strMatcher = strIdentifier.matcher(val);
Matcher paramMatcher = paramIdentifier.matcher(val);
Matcher numberMatcher = numberIdentifier.matcher(val);
if (strMatcher.find()) {
// Se for uma string remove as aspas duplas
... | 4 |
public String exportOutputs(Engine engine) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < engine.numberOfOutputVariables(); ++i) {
OutputVariable outputVariable = engine.getOutputVariable(i);
result.append(String.format("[Output%d]\n", (i + 1)));
i... | 9 |
public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
if(node == null)
return null;
UndirectedGraphNode newNode;
if(!map.containsKey(node.label)){
newNode = new UndirectedGraphNode(node.label);
map.put(node.label,newNode );
}else
... | 5 |
private void CopyFromJarToFolder( String _FileInsideJar, String _FileOutsideJar )
{
InputStream stream = Fjord.class.getResourceAsStream(_FileInsideJar);
if (stream == null)
{
//send your exception or warning
this.getLogger().log(Level.SEVERE, "Failed to open resource stream to file in .jar... | 6 |
public static boolean isValid(char l) {
int num = (int)l;
if(num >= 65 && num <= 90) {
return true;
} else if(num >= 97 && num <= 122) {
return true;
}else if(num >= 48 && num <= 57) {
return true;
}else{
return false;
}
} | 6 |
@Test
public void resolve() {
long x=1;
print(x);
} | 0 |
@Override
public boolean getOutput() {
for (int j = 0; j < getNumInputs(); j++)
if (!getInput(j)) return false;
return true;
} | 2 |
public Drag dinTur()
{
loading--;
spelare.dinTur();
if(spelare.getDrag().getRedskap() == Consts.HJUL)
{
if(loading == 0)
{
loading = Consts.HJULLOADING;
}
return spelare.getDrag();
}
if(loading != 0)
... | 7 |
public StopWatch() {
this.state = EnumStopWatchState.STOP;
} | 0 |
public ExecutorThread(TaskRunner<T> taskRunner, String s) {
super(taskRunner, s);
this.taskRunner = taskRunner;
} | 0 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
String forwardTo = "";
if (action != null) {
if (action.equals("updateUtilisateur")) {
... | 5 |
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.