text stringlengths 14 410k | label int32 0 9 |
|---|---|
final void _parseName_() {
final int start = this.index();
for (int symbol = this.skip(); symbol >= 0; symbol = this.skip()) {
if (symbol == '>') {
if (this.skip() != '>') {
this._put_('!', start);
return;
}
} else if (symbol == '<') {
if (this.skip() != '<') {
break;
}
}
}... | 5 |
@Override
public void execute(VirtualMachine vm) {
vm.setRunning(false);
} | 0 |
public void moveToLocation (Location newLocation) {
try {
newLocation.add(this);
}
catch(Exception e) {
}
currentLocation = newLocation;
if(newLocation instanceof Hangar) {
this.status = waitingToDepart;
}
else if(newLocation instanceof Workshop) {
this.status = beingRepaired;
}
... | 9 |
public Node lowerNode(T k) {
Node x = root;
while (x != NULL) {
if (k.compareTo(x.key) >0) {
if(x.right != NULL){
x = x.right;
}else{
return x;
}
} else {
if(x.left != NULL){
x = x.left;
}else{
Node current = x;
while(current.parent !=... | 6 |
@Override
public boolean equals(Object o)
{
FlipHash other = (FlipHash)o;
return other.cursorX == cursorX &&
other.cursorY == cursorY &&
other.board.equals( board );
} | 2 |
public void displayTree()
{
if (this.isLeaf()) {
System.out.print("(" + this.caractere + ":" + this.poids + ")");
}
else {
System.out.print("(");
this.fGauche.displayTree();
this.fDroit.displayTree();
System.out.print(")");
... | 1 |
public void UpdateDep(Departamento DEP) throws SQLException, excecaoDepartamento {
DepartamentoDAO depDAO = new DepartamentoDAO();
Departamento DepExistente = null;
DepExistente = depDAO.selectDepartamentoPorNome(DEP.getNome());
if (DepExistente == null || DepExistente.getCodigo().equ... | 2 |
private Player resultSetToPlayer(ResultSet rs) throws SQLException {
Player player = new Player();
player.setId(rs.getLong("id"));
player.setName(rs.getString("name"));
player.setSurname(rs.getString("surname"));
player.setPlayerNumber(rs.getByte("number"));
player.setTea... | 4 |
public boolean rendre(Emprunt emprunt) throws Exception {
boolean retour = false;
if (emprunt.getLivre() == null) {
throw new NullPointerException("Livre null !");
}
if (emprunt.getAdherent() == null) {
throw new NullPointerException("Adhérent null !");
}
... | 6 |
private void updateHistogram(ArrayList<Chord> chords) {
Chord prev, next;
for(int i=0; i<chords.size()-1; i++){
prev = chords.get(i);
next = chords.get(i+1);
String previousChord = prev.toString();
String nextChord = next.toString();
if(!chordList.containsKey(previousChord)){
chordList.put(previ... | 5 |
@Override
public int actionOnBoard(Territory territory, int player){
if(victory){
if(territory.getFamily()==model.getFamily(player) && territory.getTroup()!=null && territory.getTroup().getTroops()[1]>0){
territory.getTroup().addToop(0, 0, 1, 0);
territory.getTroup().rmToop(0, 1, 0, 0);
numberKnight[0... | 9 |
protected Operation [] getOptimalOperations(BayesNet bayesNet, Instances instances, int nrOfLookAheadSteps, int nrOfGoodOperations) throws Exception {
if (nrOfLookAheadSteps == 1) { // Abbruch der Rekursion
Operation [] bestOperation = new Operation [1];
bestOperation [0] = getOptimalOperatio... | 7 |
private void forecastGridlet()
{
// if no Gridlets available in exec list, then exit this method
if (gridletInExecList_.size() == 0) {
return;
}
// checks whether Gridlets have finished or not. If yes, then remove
// them since they will effect the MIShare calcul... | 5 |
public static HSSFWorkbook html2Excel(HSSFWorkbook wb, Html html, int i)
throws Exception {
HSSFSheet sheet = wb.createSheet(html.getHead().getTitle().getElementText());
// sheet.setColumnWidth(5,14*36);
Style htmlStyle = html.getHead().getStyle();
Table htmlTable = html.getBody().getTable();
List<CellRa... | 7 |
public static void main(String[] args) throws FileNotFoundException {
Data d = Reader.getDataFromFile(new File("files/restaurant2.arff"));
int size = d.getAttributes().size();
Random r = new Random();
for (int i = 0; i < 100; i++) {
ArrayList<String> row = new ArrayList<String>();
for (int j = 0... | 2 |
private void resize() {
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (getSkinnable().isKeepAspect()) {
if (aspectRatio * width > height) {
width = 1 / (aspectRatio / height);
} else if (1 / (aspectRatio / height) > width) {
... | 9 |
private static CtMethod delegator0(CtMethod delegate, CtClass declaring)
throws CannotCompileException, NotFoundException
{
MethodInfo deleInfo = delegate.getMethodInfo2();
String methodName = deleInfo.getName();
String desc = deleInfo.getDescriptor();
ConstPool cp = declarin... | 3 |
public void paintComponent(Graphics g) {
super.paintComponent(g);
if(image != null){
g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
}
} | 1 |
public void computeWords2(String spelling) {
String[] segmentedSpelling = segment(spelling).split(" ");
String[] seg = segmentedSpelling;
ArrayList<String> waitingSentence = new ArrayList<String>();
ArrayList<Integer> waitingCount = new ArrayList<Integer>();
char[] firstWords = findWaitingWords(seg[0]).toCha... | 9 |
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
for (FiguraGeometrica d : objetos) {
d.desenhar(g2);
}
} | 1 |
private int evalState(State s) {
int score = evalStateSide(s, "red") - evalStateSide(s, "blue");
return (me == "red")?score:-score;
} | 1 |
public static String getPage(CommandParameter commandParameter) {
String pageName = null;
if (commandParameter.getRequestURI().contains(FrontController.HOME_PAGE.replace("jsp", "ctrl"))) {
return commandParameter.getContextPath() + "/" + FrontController.HOME_PAGE;
}
pageName = commandParameter.get... | 1 |
public static final String convertColorNameToRGB(String name) {
int c = convertNamedColor(name.toLowerCase());
if (c >= 0) {
//int rgb = c.getRGB();
char[] buf = new char[7];
buf[0] = '#';
for (int pos = 1, shift = 20; shift >= 0; ++pos, shift -= 4) {
... | 3 |
static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[24];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 19; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... | 8 |
public FSList getAnnotationsFromChapter(FsNode chapter) {
if (chapter != null) {
if (this.annotations == null) {
System.out.println("getting annotations");
getAnnotations();
}
FSList annotations = new FSList("chapter/"+chapter.getId());
float start = chapter.getStarttime();
float durati... | 6 |
public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Usage: java TextComparer <file name> <file name>");
System.exit(-1);
}
BufferedReader reader1 = null;
BufferedReader reader2 = null;
try {
reader1 = new Buff... | 9 |
public static void main(String[] args) {
try {
QuestionCalculation qcal = new QuestionCalculation();
ArrayList<Integer> opd = new ArrayList<Integer>();
opd.add(12);
opd.add(84);
opd.add(45);
opd.add(90);
ArrayList<Character> opt... | 5 |
int[] getMaxCardOrder(boolean[][] bAdjacencyMatrix) {
int nNodes = bAdjacencyMatrix.length;
int[] order = new int[nNodes];
if (nNodes==0) {return order;}
boolean[] bDone = new boolean[nNodes];
// start with node 0
order[0] = 0;
bDone[0] = true;
// order remaining nodes
for (int iNode = 1; iNode < nNod... | 8 |
private void checkMeltdownAdvance() {
if ((! structure.intact()) && meltdown == 0) return ;
float chance = meltdownChance() / World.STANDARD_DAY_LENGTH ;
chance += meltdown / 10f ;
if (isManned()) chance /= 2 ;
if (Rand.num() < chance) {
final float melt = 0.1f * Rand.num() ;
meltdown +=... | 6 |
public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.next... | 3 |
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Update other = (Update) obj;
if (version == null) {
if (other.version != null) {
return false;
}
} else... | 6 |
static 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... | 9 |
public void visit_aaload(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} | 1 |
@Override
public void setEditPane(Contestant c, boolean newContestant) {
GameData g = GameData.getCurrentGame();
tfContID.setEnabled(!g.isSeasonStarted());
if (newContestant || c == null) {
// set default values
tfContID.setText("");
tfFirstName.setText("First Name");
tfLastName.setText("Last Nam... | 3 |
public synchronized void register(Action action) {
if(action instanceof OrderDependentAction || !action.activate(getRemainingTime()))
actions.add(action);
} | 2 |
private boolean isValidPlayer(Entity entity) {
boolean isValidPlayer = false;
if (entity instanceof Player) {
boolean isNPC = false;
if (plugin.cititzensPlugin != null) {
try {
isNPC = plugin.cititzensPlugin.getDescription... | 5 |
@Override
public FileVisitResult preVisitDirectory(Path pDir, BasicFileAttributes attr) {
if (!pDir.toString().contains(
"dynmap" + System.getProperty("file.separator") + "web")) {// Comment out this if to allow copying of files in a folder called dynmap\web
try {
dirNum++;
if (dirNum > 1) {
Stri... | 3 |
public void setAddressCompany(Address addressCompany) {
this.addressCompany = addressCompany;
} | 0 |
public void setWorkingDay(String workingDay) {
WorkingDay = workingDay;
} | 0 |
public void improveCity() {
if ( selected.getClass() == Worker.class ) {
Tile tile = selected.getTile();
if ( tile.getCity() != null ) {
((Unit)selected).owner.removeUnit( (Unit)selected );
tile.getCity().Production += IMPROVE_CITY_PRODUCTION;
... | 2 |
public void destroy(String id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Telecommunications telecommunications;
try ... | 7 |
protected String toJSONFragment() {
StringBuffer json = new StringBuffer();
boolean first = true;
if (isSetDate()) {
if (!first) json.append(", ");
json.append(quoteJSON("Date"));
json.append(" : ");
json.append(quoteJSON(getDate() + ""));
... | 8 |
char[][] getMap() {
char[][] map = new char[activeBoardSize+2][activeBoardSize+2];
for(int i=0; i<map.length; i++) {
for(int j=0; j<map[0].length; j++) {
map[i][j] = ' ';
}
}
for(Fence f:staticFences) {
map[f.getX()][f.getY()] = 'f';
}
for(Fence f:activeFences) {
map[f.getX()][f.getY()] =... | 5 |
public void updatePosition(Level terrain)
{
boolean collision = false;
while (detectHorizontalCollision(terrain) == true)
{
collision = true;
if (heroxSpeed < 0)
{
heroxSpeed = (int)(heroxSpeed + 1);
}
else if (heroxSpeed > 0)
{
heroxSpeed = (int)(heroxSpeed - 1);
}
}
herox += ... | 8 |
@Override
public String getTileUrl(int x, int y, int zoom)
{
int ty = y;
int tx = x;
// int width_in_tiles = (int)Math.pow(2,pyramid_top-zoom);
int width_in_tiles = getMapWidthInTilesAtZoom(zoom);
// System.out.println("width in tiles = " + width_in_tiles + " x = " + tx + " y = " + ty);
if (ty < 0)
{
... | 4 |
public final Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':... | 8 |
public static void main(String[] args)
{
Scanner eingabeScanner = new Scanner(System.in);
String[] namen = null;
boolean wiederholen = true;
// do ... while Schleife wird mindestens einmal ausgefuehrt
do
{
System.out.println("Bitte eine Nummer wählen: 1.Erstellen, 2.Suchen oder 3.Anzeigen ");
... | 9 |
public void muteToType(EntityType newType) {
if (type != EntityType.ABSTRACT_CLASS && type != EntityType.CLASS && type != EntityType.ENUM
&& type != EntityType.INTERFACE) {
throw new IllegalArgumentException("type=" + type);
}
if (newType != EntityType.ABSTRACT_CLASS && newType != EntityType.CLASS && newTy... | 8 |
public void starteSpiel() {
for (int zeile = 0; zeile < spielfeld.length; zeile++) {
for (int spalte = 0; spalte < spielfeld[zeile].length; spalte++) {
spielfeld[zeile][spalte] = "[ ]";
}
}
platziereSpieler();
Spieler gewinner = null;
int runde = 0;
GamePrinter.printSpielfeld(spielfeld, spielerR... | 8 |
public RequestWrapper getRequestWrapper() {
return requestWrapper;
} | 0 |
private void updateElement() {
try {
SortedMap<String, Object> map = updateElementTableModel.getProperties();
ElementListViewHelper helper = (ElementListViewHelper) updateElementsComboBox.getSelectedItem();
if(helper == null)
return;
NetworkHardware nh = (NetworkHardware) helper.getNetworkHardware... | 3 |
public static void main(String[] args) {
List<Integer> topList = new ArrayList<Integer>();
for(int j= 1;j<100;j++){
System.out.println("team size = " + j);
for(int i = 1 ; i <= j ;i++){
topList.add(i);
}
if(topList.size() % 2 ==0 && topList.size() %4 !=0){
int size = topList.size();
int f1 = to... | 7 |
public void processVideo() throws Exception {
if (converterThread != null && converterThread.isAlive()) {
throw new Exception("Convert is already running");
}
if (videoInputPath == null) {
throw new Exception("Video input is not specified.");
}
if (video... | 4 |
private void menuItemSaveAsActionPerformed(ActionEvent evt)
{
JFileChooser fc = new JFileChooser();
fc.setAcceptAllFileFilterUsed(false);
fc.setFileFilter(new FileFilter()
{
public boolean accept( File f )
{
return f.isDirectory() || f.getName().toLowerCase().endsWith(".ser");
}
public String... | 6 |
public static void main( String[] argv ) {
try {
String filename;
String stopMark;
if( argv.length >= 1 ) filename = argv[0];
else filename = "document_root_alpha/example.POST_DATA.txt";
if( argv.length >= 2 ) stopMark = argv[1];
else stopMark = "--... | 5 |
public void render() {
RoofObject[][] SubArea = getVisibleMap(Screen.getPlayer());
for (int x = 0; x < SubArea.length; x++) {
for (int y = 0; y < SubArea[0].length; y++) {
if (!(SubArea[x][y] == null))
renderObject(x, y, SubArea[x][y]);
}
}
} | 3 |
public static void setPlayerAFK( String player, boolean sendGlobal, boolean hasDisplayPerm ) {
BSPlayer p = getPlayer( player );
if ( !p.isAFK() ) {
p.setAFK( true );
if ( sendGlobal ) {
sendBroadcast( Messages.PLAYER_AFK.replace( "{player}", p.getDisplayingName()... | 5 |
private static int count(String filename) throws IOException {
InputStream is = new BufferedInputStream(new FileInputStream(
filename));
try {
byte[] c = new byte[1024];
int count = 0;
int readChars = 0;
boolean empty = true;
while ((readChars = is.read(c)) != -1) {
empty = false;
for (in... | 5 |
@Override
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
if (str == null) {
return;
}
char[] chars = str.toCharArray();
boolean ok = true;
for (int i = 0; i < chars.length; i++) {
try {
Integer.parseInt(String.valueOf(chars[i]));
} ... | 4 |
public String longestPalindrome_3(String s){// greedy solution
String res = "";
for(int i = 0; i < s.length(); ++i){
String ex = extend(s, i, i);
res = res.length() < ex.length() ? ex : res;
}
for(int i = 0; i < s.length() - 1; ++i){
String ex = extend... | 4 |
public Path BestPath(Path p1, Path p2) {
Path output = p1;
if (p1 == null
|| (p2 != null && playerCount != 3 && p2.getAverageWorth() > p1
.getAverageWorth())) {
output = p2;
} else if (p2 != null
&& p2.getAverageWorthNeutral() > p1.getAverageWorth()) {
output = p2;
}
return output;
} | 6 |
public PokeSelectWin()
{
this.setTitle("????");
this.setSize(300,400);
this.setResizable(false);
this.setLayout(null);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.setVisible(false);
visible = false;
this.setLocationRelativeTo(null);
cp = this.getContent... | 2 |
public static String compress(String s) {
if(s.length() <= 1) {
return s;
}
char c = s.charAt(0);
StringBuilder sb = new StringBuilder();
int count = 0;
for(int i = 0; i < s.length(); i++) {
if(c == s.charAt(i)) {
... | 4 |
public static ArrayList<String> getPlayerOwnList(String playerUUID) {
ArrayList<String> places = new ArrayList<String>();
if (Spectacles.storedPlayerData == null) {
return places;
} else {
places = Spectacles.storedPlayerData.get(playerUUID);
return places;
... | 1 |
AbstractCar(RegistrationNumber registrationNumber, int fuelCapacity, int fuelInCar, boolean carRented){
this.registrationNumber = RegistrationNumber.getInstance(registrationNumber.getLetterIdentifier(), registrationNumber.getNumberIdentifier());
if (RegistrationNumber.getInstance(registrationNumber.getLetterIdenti... | 4 |
private void checkPrintFunction() throws Exception {
if(iterator < tokenList.size() && tokenList.get(iterator++).getType() != TokenType.L_PAR) {
// missing opening parenthesis
throw new Exception("Syntax Error at line " + tokenList.get(iterator-1).getLine() +
": Expected ( and got \"" + tokenList.get(iter... | 6 |
public static RealVector solve(RealMatrix A, RealVector y, int k) {
RealVector xest = new ArrayRealVector(new double[A.getColumnDimension()]);
RealMatrix z = A;
RealVector v = y;
int t = 0;
int[] T2=null;
while (t < 100) {
//System.out.println(String.valueO... | 6 |
@Override
public List<Autor> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Autor> autores = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LIST... | 3 |
private void swap(Object[] array, int i, int change) {
Object helper = array[i];
array[i] = array[change];
array[change] = helper;
} | 0 |
public void putAll( Map<? extends Long, ? extends Long> map ) {
Iterator<? extends Entry<? extends Long,? extends Long>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Long,? extends Long> e = it.next();
this.put( e.getKey(), e.... | 8 |
public void draw(GOut g) {
Coord dc = new Coord();
if (drawbg)
for (dc.y = 0; dc.y < sz.y; dc.y += texpap.sz().y) {
for (dc.x = 0; dc.x < sz.x; dc.x += texpap.sz().x) {
g.image(texpap, dc);
}
}
g.chcolor();
int y... | 8 |
public void update(GameContainer gc, StateBasedGame sb, int delta) {
Input in = gc.getInput();
if(in.isKeyDown(Input.KEY_L))
{
Mob mob = RPG372.gameInstance.getNearestMob();
if(mob != null){
FightState fs = (FightState)sb.getState(RPG372.FIGHT);
fs.setMob(mob);
fs.setCurrentPlayer(RPG372.gameIns... | 3 |
private void read(Reader reader) throws IOException {
ScanfReader scanReader = new ScanfReader(reader);
try {
doread(scanReader);
} catch (Exception e) {
throw new IOException(e.getMessage() + ", line " + scanReader.getLineNumber());
}
//bulding the constru... | 5 |
public void findBestSystemEP() {
for (SoftwareSystem softwareSystem : systemsEP)
softwareSystem.refine();
bestSoftwareSystemEP = systemsEP.get(0);
worstSoftwareSystemEP = systemsEP.get(0);
for (SoftwareSystem softwareSystem : systemsEP) {
if (softwareSystem.getSystemConsumptionEP() < bestSoftwareSystemEP.... | 4 |
public void syncToGlobal() {
lineEnd.cur = Preferences.getPreferenceLineEnding(Preferences.SAVE_LINE_END).cur;
saveEncoding.cur = Preferences.getPreferenceString(Preferences.SAVE_ENCODING).cur;
saveFormat.cur = Preferences.getPreferenceString(Preferences.SAVE_FORMAT).cur;
ownerName.cur = Preferences.getPreferen... | 0 |
public void updateEnemies(long time, Game game) {
// Loop through all the available enemies
for(int i = 0; i < enemies.length; i++) {
// Try block for safety.
try {
// If the enemy is alive, then let's update it.
if(enemies[i].living == true) { enemies[i].update(time,game); }
}... | 3 |
public ArrayList<UserTuple> buildFriends(){
ArrayList<UserTuple> friendList = new ArrayList<UserTuple>();;
try {
ResultSet rslSet = dbMgr.executeQuery("select usrid1 from friend where usrid2='"+userId+"'");
if(rslSet !=null)
{
while(rslSet.next()){
ResultSet rslSet1 = dbMgr.executeQuery("select... | 4 |
private static boolean isType(String argument, ArgumentTypes arg)
{
switch(arg)
{
case NUMBER:
{
return isInteger(argument);
}
case QUEUE:
{
try
{
Queue.valueOf(argument);
return true;
}
catch(IllegalArgumentException e)
{
return false;
}
}
case SEASO... | 9 |
@Override
public void executeMsg(Environmental host, CMMsg msg)
{
if((msg.target()==affected)
&&((msg.targetMinor()==CMMsg.TYP_LOOK)||(msg.targetMinor()==CMMsg.TYP_EXAMINE))
&&(CMLib.flags().canBeSeenBy(affected,msg.source()))
&&(affected instanceof MOB)
&&((daysRemaining>0)&&(monthsRemaining<=3)))
{
m... | 7 |
public boolean optimize(final int numSteps, final double convergenceDelta) throws InvalidConfigurationException {
if (!configured) {
configure();
}
final int deltaNumSteps = numSteps/10;
final Genotype population = Genotype.randomInitialGenotype(configuration);
final ... | 8 |
public Wave28(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 1000; i++){
if(i % 5 == 0)
add(m.buildMob(MobID.DODRIO));
else if(i % 4 == 0)
add(m.buildMob(MobID.FEAROW));
else if(i % 3 == 0)
add(m.buildMob(MobID.RATICATE));
else if(i % 2 == 0)
add(m.buildMob(MobID.DODUO... | 5 |
public static void fillVacancies(Venue venue) {
//
// We automatically fill any positions available when the venue is
// established. This is done for free, but candidates cannot be screened.
if (venue.careers() == null) return ;
for (Background v : venue.careers()) {
final int numOpen = ve... | 5 |
public static List<String> decodificarError(String errorJSON) {
List<String> resultado = new ArrayList<String>();
JSONParser parser = new JSONParser();
try {
Object objeto = parser.parse(errorJSON);
JSONObject objetoJSON = (JSONObject) objeto;
String error = (String) objetoJSON.get(ERROR);
resultado.a... | 1 |
public static String addBinary(String a, String b) {
int len = Math.max(a.length(), b.length());
a = padding(a, len);
b = padding(b, len);
String res = "";
char flag = '0';
for(int i = len -1; i >= 0; i--){
char c = a.charAt(i);
if(flag == '0') {
if(c == '0'){
... | 7 |
public int copyin(int [] a){
if (a.length == st.length)
st = (int[])a.clone();
else return -1;
return 0;
} | 1 |
@Override
public boolean mutate(DeterministicFiniteAutomaton dfa) {
Random rnd = new Random();
Set<State> states = dfa.getStates();
State[] stateArr = states.toArray(new State[0]);
if(states.size() <= 2){
return false;
}else{
//index of the state to be removed
int i;
State oldState = null;
... | 7 |
@Override
public void removeServerEventListener(IServerEventListener listener) {
serverEventListenerList.remove(IServerEventListener.class, listener);
} | 0 |
public final String getTitle() {
Object value = getValue(NAME);
return value != null ? value.toString() : null;
} | 1 |
public People updatePeople(String peopleID, String personName, String projectID, String role) {
People people = manager.find(People.class, peopleID);
if (people != null) {
people.setProjectID(projectID);
people.setPersonID(peopleID);
people.setRole(role);
people.setName(... | 1 |
@Override
public long doRead(Master master, ReadRequest readRequest) {
incrementAccessAndMaybeRecalibrate(master);
long fileId = readRequest.getFileId();
Location accessLoc = readRequest.getLocation();
MasterMeta fm = master.map.get(fileId);
if (fm == null || fm.instances.size() == 0) {
retu... | 9 |
public Normal(double mu, double sigmaSquared) throws ParameterException {
if (sigmaSquared <= 0) {
throw new ParameterException("Normal parameters mu real, sigmaSquared > 0.");
}
rand = new Random();
this.mu = mu;
this.sigmaSquared = sigmaSquared;
sigma = Math.sqrt(sigmaSquared);
} | 1 |
private void getColor() {
color = new int[] { 0xFF111111, 0xFF000000, 0xFFC2FEFF };
switch (random.nextInt(8)) {
case 0: {
// red color
color[1] = 0xFFFF0000;
break;
}
case 1: {
// gold color
color[1] = 0xFFCFB53B;
break;
}
case 2: {
// blue color
color[1] = 0xFF005AFF;
break;
... | 7 |
void checkWorld(){
PVector toBest = new PVector(); //create a temp vector to keep track of the direction of the best condition
float maxV = 0;
//loop through pixels
for (int i = -p5.searchRad; i <= p5.searchRad; i++){
for (int j = -p5.searchRad; j <= p5.searchRad; j++){
if(!(i == 0 && j == 0)){
//c... | 7 |
@Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld setannouncedeath <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + worldNa... | 5 |
public void actionPerformed(ActionEvent e)
{
for(int i = 0; i < Main.list.size(); i++)
{
if(Main.list.get(i).getStatic() == false)
{
if(Main.list.get(i).getX() < 47 || Main.list.get(i).getX() > 1198)
{
Utility.tableCollision(Main.list.get(i), true);
}
if(Main.list.get(i).getY() < 47 || ... | 8 |
private List<Block> getGolemBlocks(EntityType type, Block base) {
ArrayList<Block> blocks = new ArrayList<Block>();
blocks.add(base);
base = base.getRelative(BlockFace.UP);
blocks.add(base);
if (type == EntityType.IRON_GOLEM) {
for (BlockFace face : new BlockFace[]{ B... | 3 |
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
{
method.invoke(obj, args); //利用反射调用需要调用的方法
return null;
} | 0 |
public ConfigurationLoader getConfiguration() {
return this.cloader;
} | 0 |
public void updateDatabase(){
//Temos alguma valor para inserir?
if(toInsert != null){
//Verificando a posição que ele vai entrar:
int temp = checkIfMadeIt(toInsert.getM_maxCoins());
if(temp >= 0){
m_scoreBoard.add(temp, new HighScoreEntry... | 2 |
@Override
public ArrayList<Delta> apply(Color c, int x, int y, Color[][] colorArr) {
if (start == null) {
start = new Point(x, y);
return new ArrayList<>();
} else {
Point p1 = start;
Point p2 = new Point(x,y);
ArrayList<Point> ch = bresenh... | 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.