text
stringlengths
14
410k
label
int32
0
9
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSeq...
9
private void handleInvocation( RemoteMethodEntry entry, Object[] arguments ) throws Exception { RemoteMethod remoteMethod = entry.remoteMethod; Match readMatch = remoteMethod.readMatch(); int readStates = remoteMethod.readStates(); if (readMatch.isMatch( readStates, getStates() ) || ...
3
public void renderMap(EntityPlayer par1EntityPlayer, RenderEngine par2RenderEngine, MapData par3MapData) { for (int var4 = 0; var4 < 16384; ++var4) { byte var5 = par3MapData.colors[var4]; if (var5 / 4 == 0) { this.intArray[var4] = (var4 + var4 / 1...
6
protected void onUpdateGameOver() { long time = System.currentTimeMillis(); int lap = ( int ) ( time - _gameOverStart ); if ( lap > GAME_OVER_DRAW_TIME ) { if ( !_isGameOverRev ) { if ( _gameOverPos.size() == GRID_Y ) { _isGameOverRev = true; _grid = new short[ GRID_Y ][ GRID_X ]; ...
5
private void workloadClassify() { createRequestList(); Random rd=new Random(seed); double reservedMean=0.75; double ondemandMean=0.5; double spotMean=0.25; double std=0.3; int n=this.requestList.size(); int reservedCnt=17000; int spotCnt=120000; SortedMap<Double, RequestType> sm=new TreeMap<Double,...
8
public CompositeGateClass(String gateName, HDLTokenizer input, PinInfo[] inputPinsInfo, PinInfo[] outputPinsInfo) throws HDLException { super(gateName, inputPinsInfo, outputPinsInfo); partsList = new Vector(); internalPinsInfo = new Vector(); connections = new ConnectionSet(); ...
5
@Override public Auctioneer getAuctionHouse(String chain, String areaNameOrBranch) { for (final Auctioneer C : auctionHouseList) { if((C.auctionHouse().equalsIgnoreCase(chain)) &&(C.auctionHouse().equalsIgnoreCase(areaNameOrBranch))) return C; } final Area A=findArea(areaNameOrBranch); if(A==null...
7
public ArrayList<Bank> withBanks() { if (!Constants.Banking) { return null; } Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; ArrayList<Bank> banks = new ArrayList<Bank>(); try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepa...
7
@Override public ArrayList<seed> move(ArrayList<Pair> treelist, double width, double length, double s) { // TODO Auto-generated method stub ArrayList<seed> seedlist = new ArrayList<seed>(); for (double i = distowall; i < width - distowall; i = i + distoseed) { for (double j = distowall; j < length - distowal...
6
public JPanel Menu() { JPanel buttons = new JPanel(); buttons.setLayout(new GridBagLayout()); buttons.setBackground(new Color(255, 231, 186)); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5,5,5,5); ImageIcon titleImg = new ImageIcon("ui/title.pn...
6
private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed int linhaSelecionada = -1; linhaSelecionada = tabela.getSelectedRow(); if (linhaSelecionada >= 0) { int idUsuario = (int) tabela.getValueAt(linhaSelecionada, 0); ...
2
@Override public void setImages() { if (waitImage == null) { File imageFile = new File(Structure.baseDir + "topdownturret40.png"); try { waitImage = ImageIO.read(imageFile); } catch (IOException e) { e.printStackTrace(); } } if (attackImage == null) { File imageFile = new File(Structure....
8
public void run() { while(!isClosed) { final String currentSpin = spinLabel.getText(); final String nextSpin; if(currentSpin.equals("-")) nextSpin = "\\"; else if(currentSpin.equals("\\")) nextSpi...
6
private static void printLines(String name, InputStream ins) throws Exception { String line = null; BufferedReader in = new BufferedReader(new InputStreamReader(ins)); while ((line = in.readLine()) != null) { System.out.println(name + " " + line); } }
1
protected SoundPlayer() { this.buffers = new ArrayList<SoundPlay>(); AudioFormat format = new AudioFormat(44100.0f, 16, 2, true, false); try { this.line = AudioSystem.getSourceDataLine(format); this.line.open(format, 4410); this.line.start(); this.thread = new Thread(new Runnable() { @Override ...
5
private void runTestsWithApexQuery() throws ConnectionException { List<String> declaredClassNames = this.getClassNames(); List<String> classList = new ArrayList<String>(); System.out.println("Declared classes to test: "); for (String f : declaredClassNames) { System.out.println("\t" + f); } List<String>...
8
@SuppressWarnings("unchecked") private Item[] resize(int newCapacity) { Item[] t = (Item[]) new Object[newCapacity]; for (int i = 0, j = front; i < size(); i++, j = (j + 1) % N) t[i] = q[j]; N = newCapacity; front = 0; return t; }
1
public T get(int index) { if (index < 0 || index >= this.size) throw new IndexOutOfBoundsException(); // handle ask for head if (index == 0) return this.head.data; // handle ask for tail else if (index == this.size - 1) return this.tail.data; // handle ask for anything else else { MyNod...
5
@Override public Connection open() { if (initialize()) { try { this.connection = DriverManager.getConnection("jdbc:sqlite:" + sqlFile.getAbsolutePath()); return this.connection; } catch (SQLException e) { this.wr...
2
public void update() throws ModelException { TradeKingForeman foreman = new TradeKingForeman(); XMLHandler handler = new XMLHandler(); try { response = foreman.makeAPICall(OrdersBuilder.preview(a.getId(), b.build().toString(), ResponseFormat.XML)); } catch (ForemanException | UtilityException e) { ...
2
@Override public int getGrade(Node<T> n) { if (!(n instanceof BinaryNodePS)) { throw new DifferentNodeTypesException(); } else if (isSafe() && !contains(n)) { throw new NodeNotFoundException(); } int grade = 0; BinaryNodePS<T> bn = (BinaryNodePS<T>) n; if (bn.getLeft() != null) { grade++; } if...
5
public void register(PeerActivityListener listener) { this.listeners.add(listener); }
0
public Vector<Affix> getAffixList(String _type){ StringBuffer sb= new StringBuffer(""); String str = null; String[] affixlist; FileReader reader = null; try { if(_type.equals("p")){ reader = new FileReader("g:\\prefixlist.txt"); }else if(_type.equals("s")){ reader = new Fi...
8
private void predictClassLabel(Instance instance){ int size = model.getNumOfClassLabel(); double[] likelihoods = new double[size]; for(int i=0;i<size;i++){ likelihoods[i] = (double)1; } for(int i=0;i<size;i++){ double[][][] attributes_likelihoods = model.getAttributes_likelihoods(); for(int j=0;j<att...
9
public static int uniquePaths3(int m, int n) { m--; n--; double numerator = 1; double denominator1 = 1; double denominator2 = 1; int i = 1; while (true) { if (i <= m + n) numerator *= i; else break; i++; } i = 1; while (true) { if (i <= m) denominator1 *= i; else break...
6
@Override public Boolean modificarCliente(TCliente cliente) throws Exception { Statement query = null; Connection connection = null; String contenido_query = "UPDATE Clientes SET DNI='" + cliente.getDNI() + "', Nombre='" + cliente.getNombre() + "', Apellidos='" ...
8
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
7
@Override public PropertyFilter getFilter(int index) throws IndexOutOfBoundsException { return (PropertyFilter) filters.get(index); }
0
@Override public int hashCode() { int hash = 3; hash = 61 * hash + (this.id != null ? this.id.hashCode() : 0); hash = 61 * hash + (this.login != null ? this.login.hashCode() : 0); hash = 61 * hash + (this.password != null ? this.password.hashCode() : 0); hash = 61 * hash + (t...
7
public boolean addTrainerToBooking(Connection conn) throws SQLException { boolean success = false; int trainerID = 0; String sportsType = sb.getSportsType(); String SQLString1 = "select trainerID from trainer where sportstype = ?"; String SQLString2 = "insert into trainerBooking ...
3
@Test public void resolve() { int N=20; long [][] grid=new long[N+1][N+1]; for(int i=N;i>=0;i--){ for(int j=N;j>=0;j--){ if(i==N||j==N){ grid[i][j]=1; }else{ grid[i][j]=grid[i][j+1]+grid[i+1][j]; } } } print(grid[0][0]); }
4
private void playString(String playString) { //@TODO code to play string in morse :) //@TODO NEEDS ByteArrayOutpuStream to work! ByteArrayOutputStream bbout = new ByteArrayOutputStream(); char charToPlay; int sLength = playString.length(); byte[] playWave = new byte[32]; ...
9
@Override public boolean equals(Object obj) { Boolean totuus = false; if (obj instanceof OstosLista) { OstosLista toinen = (OstosLista)obj; if (this.size() <= toinen.size()) { OstosLista tmp = new OstosLista(this);...
6
void initGame() { HexOperations.setXYasVertex(false); HexOperations.setHeight(HEXSIZE); HexOperations.setBorders(BORDERS); for (int i = 0; i < BSIZE; i++) { for (int j = 0; j < BSIZE; j++) { board[i][j] = EMPTY; } } //set up boa...
6
public String getJson() { try { /* Create a URL obj from strings */ url = new URL((QUERY_URL.concat(word)).replace(" ", "%20")); System.out.println(fullUrl); conn = url.openConnection(); // Get the response rd = new BufferedReader(new InputStreamReader(conn.getInputStream()))...
3
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
6
public WumpusPerception eventTurnLeft(AID hunterAID) { if(log.isLoggable(Logger.INFO)) log.log(Logger.INFO, "eventTurnLeft()"); Hunter hunter = getHunter(hunterAID); hunter = hunter.turnLeft(); int xCoord = hunter.getxCoord(); int yCoord = hunter.getyCoord(); WumpusPerception perception = getP...
1
public PisteTest() { }
0
public void startGUI() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { Logger.getLogger(LoginScreen.class.getName()) .log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { ...
4
private void processFiles( List<String> files ) { Parser parser = new Parser(); Table table = null; List<String> classNames = new ArrayList<String>(); for ( String file : files ) { table = parser.parse( file ); table.setPackage( basePkg ); if ( classN...
2
public Subject(SubjectID primary, Node memberNode) throws XPathExpressionException { // Get the restrictions. this.restrictions = null; String restrictions = Utilities.getAttributeValue(memberNode, "restrictions"); if(!Utilities.isNullOrWhitespace(restrictions)) { this.restrictions = Restrictions.valueOf(re...
4
public Token next() throws IOException { String lexeme = ""; int value = 0; int count = 0; do { value = read(); if (value == EOF) { return Token.generate(Token.Kind.EOF, lineNumber, charPosition); } if (value == WS || value == TAB) { continue; } lexeme += (char) value; if ((le...
9
public void sendOrder() { //query the orders table by order number // ArrayList<Item> order = new ArrayList<Item>(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String commandArg = null; System.out.println("Please enter the name of the manufacturer."); String manu = ""; ...
9
final public void setConfidence(int new_confidence) { throw new UnsupportedOperationException("setConfidence not implemented"); }
0
public static void log() { boolean full = larvikGaming.getConfig().getBoolean("Full-Logger", true); boolean info = larvikGaming.getConfig().getBoolean("Info-Logger", false); boolean warning = larvikGaming.getConfig().getBoolean("Warning-Logger", true); boolean severe = larvikGaming.getConfig().getBoolean("Sever...
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Vak other = (Vak) obj; if (id != other.id) return false; return true; }
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; WordAttributes other = (WordAttributes) obj; if (color == null) { if (other.color != null) return false; } else if (!color.equals(other....
8
private void restoreBlogStatus() { try { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(new FileInputStream(statusFilename))); String line = null; while ((line = reader.readLine()) != null) { if (!line.contains("<article")) { continue; } Ha...
7
private void addState(SearchState state, int dist, int edgeDist) { int estimatedDist = dist + h.estimateCostToGoal(state); if (estimatedDist >= OO) return; SearchState oldState = stateSet.get(state); if (oldState == null) { stateSet.put(state, state); oldState = state; } if (s...
5
private void loadFile() throws IOException { InputStream inp = new FileInputStream(inputFile); //InputStream inp = new FileInputStream("workbook.xlsx"); Workbook wb = new XSSFWorkbook(inp); Sheet sheet = wb.getSheetAt(0); int lastRowNum = sheet.getLastRowNum(); for (int ...
4
public double reduceDamage(double damage){ double temp = damage - armorItem.getDefenseScore(); if(temp <0) temp = 0; return temp; }
1
* @return the id of the new version */ public int newVersion( String shortName, String longName, String group, short backup, boolean partial ) { short gId = findGroup( group ); if ( gId == 0 && group != null && group.length()> 0 ) { Group g = new Group( (short)0, group ); groups.add( g ); gId = (...
7
protected Hashtable<String, Object> communicateWithNeo4jServer(String json) throws SystemFailure { Hashtable<String, Object> responseData = null; HttpPost createNodePost = new HttpPost(_serverUrl); createNodePost.setHeader("Accept", "application/json; charset=UTF-8"); createNodePost.setHeader("Content-Typ...
9
protected void buildDesc(Room room, int dir, String designDescription) { synchronized(("SYNC"+room.roomID()).intern()) { room=CMLib.map().getRoom(room); if(dir>=0) { Exit E=room.getExitInDir(dir); if((!E.isGeneric())&&(room.getRawExit(dir)==E)) { E=generify(E); room.setRawExit(dir,E)...
7
public void startupScan(Path directory) { String status = db.getConfig("startupScan"); // Check if user disabled the scan if(status != null && !status.equals("true")) { logger.info("Startup scan is disabled."); return; } for(File file : directory.toFile().listFiles()) { if(file.isDirectory()) ...
6
public static int[] solution(int N, int[] A) { int[] result = new int[N]; int maxCounter = 0; int inc = 0; for(int i = 0 ; i < A.length ; i++){ if(A[i] <= N){ if(result[A[i] - 1] < inc) { result[A[i] - 1] = inc; } ...
7
public JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); }
3
public static void main(String[] args) throws IOException { CovertChannel cc = new CovertChannel(); boolean verbose = false; //used to determine whether we will create a log file // LOW and HIGH are constants defined in the SecurityLevel // class, such that HIGH dominates LOW. SecurityLevel low = Sec...
9
public static String analyzeMessage(UserNChatThread user, String chat){ String outputText = "null test"; if( !chat.equals("") ){ if( chat.charAt(0) == '/' ){ outputText = executeCommand(user, chat); }else{ outputText = chat; } } return outputText; }
2
public QuestionPanel() { setFocusable(false); questionTextArea = new SingleQuestionTextArea(); answerTextArea = new SingleQuestionTextArea(); BoxLayout boxLayout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(boxLayout); add(questionTextArea); add(Box.c...
0
private static Point[][] get16PlayersPositions() { int maxPlayers = 16; Point[][] pos = new Point[8][128]; for(int i = 0; i < maxPlayers;i++ ){ pos [0][i] = new Point(0,2*i); } for(int i = 0; i < maxPlayers/2;i++ ){ pos [1][i] = new Point(2 ,1+4*i); } for(int i = 0; i < maxPlayers/4;i++ ){ pos [...
5
*/ private void getSpectrumForQuery(String searchName) { List<String> result = new ArrayList<String>(); try { DbAccessor.createConnection(); CompoundLogic compoundLogic = new CompoundLogic(); LOGGER.info("search records by keyword || " + searchName); List<Compound> compoundList = compoundLogic.getCo...
5
public int longestIncreasingSub(int[] arr) { int longestSSCount = 0; int currIndex = 0; int n = arr.length; int[] lis = new int[n]; int[] path = new int[n]; for (int i = 0; i < n; i++) { lis[i] = 1; path[i] = -1; } for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { if(arr[i] > ar...
7
public static void moveElementToHead(Vector someVector, int index) { // size is useful int size = someVector.size(); // validate parameters // also leave if element is already at the head if ((someVector == null) || (index <= 0) || (index >= size)) { return ; } // end if // grab the element to...
4
public String encrypt(String inputFileName, String key) throws Exception { SecretKeySpec tempKey = null; System.out.println("Encrypted File: " + inputFileName); FileInputStream inputStream = new FileInputStream(inputFileName); // create the output file after encryption add an extension .cheng File tmpFile = n...
2
public static void main(String args[]) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (int N,t=1;(N=parseInt(in.readLine().trim()))!=0;t++) { String num=""; int cant=0; sb.append("Case ").append(t).append(":\n"); ...
8
public boolean AddUser(IrcUser user){ return Users.add(user);}
0
@PUT @Path("/modifyEvent") @Consumes(MediaType.APPLICATION_JSON) public Response modifyEvent(String jsonObject) { Gson gson = new GsonBuilder().setDateFormat(WS_DATE_PATTERN).create(); Event event = null; try { event = gson.fromJson(jsonObject, Event.class); } catch (JsonSyntaxException e1) { try { ...
5
public static Mask buildSobelMask(Direction d) { switch (d) { case VERTICAL: double[][] dValues = { { 1, 0, -1 }, { 2, 0, -2 }, { 1, 0, -1 } }; return new Mask(dValues); case HORIZONTAL: double[][] aValues = { { 1, 2, 1 }, { 0, 0, 0 }, { -1, -2, -1 } }; return new Mask(aValues); case DIAGONAL: do...
4
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_A) { dx = 0; } if (key == KeyEvent.VK_D) { dx = 0; } if (key == KeyEvent.VK_W) { dy = 0; } if (ke...
4
protected boolean checkAreas() { boolean result = false; synchronized (planAreas) { for (PlanArea area : planAreas) { if (!area.isCommitted()) { continue; } if (area.buildFromSupply(1)) { result = true; } } } return result; }
3
public void addTriangles( ArrayList<Triangle> triangles ) { int size = triangles.size(); this.triangles.addAll( triangles ); if ( resource.getVbo().capacity() > resource.getVbo().limit() + ( size * 3 * 9 ) ) { FloatBuffer tmpVbo = Utils.createFlippedBuffer( triangles ); resource.getVbo().limit( tmpVbo....
1
@Override public Class<?> getColumnClass(int sarakeIndeksi) { return tyypit[sarakeIndeksi]; }
1
public void updateLeft(){ if(left > 0){ for(int i=0; i<height+top; i++){ for(int j=0; j<left; j++){ drawDiamond(j, i); } } } else if(left < 0){ for(int i=top; i<height+top; i++){ for(int j=-1;...
6
private int search(TreeNode root, String query, int d, int length){ if(root == null) return length; if(root.value != null) length = d; if(d == query.length()) return length; char c = query.charAt(d); if(root.children.containsKey(c)){ return search(root.children.get(c), query, d + 1, length); ...
4
public static void main(String[] args) { if (args.length != 3) { System.out.println(USAGE); System.exit(0); } String name = args[0]; InetAddress addr = null; int port = 0; Socket sock = null; // check args[1] - the IP-adress try { addr = InetAddress.getByName(args[1]); } catch (UnknownHostE...
5
public static Packet parse(DatagramPacket packet) throws IllegalArgumentException, AssertionError { Packet rad; try { ByteBuffer bb = ByteBuffer.wrap(packet.getData()); int packetCode = bb.get(); int packetIdentifier = bb.get(); int packetLength = bb.getSh...
3
private List<Class<?>> getTypeHierarchy(Class<?> type) { if (type.isPrimitive()) { type = primitiveTypeToWrapperMap.get(type); } Set<Class<?>> typeHierarchy = new LinkedHashSet<Class<?>>(); collectTypeHierarchy(typeHierarchy, type); if (type.isArray()) { typeHierarchy.add(Object[].class); } ...
7
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked JTextPane jtp = new JTextPane(); jtp.setBackground(Color.white); jtp.setText(text); boolean show = true; try { jtp.print(null, null, show, null, null, show); } catch (java.awt.print.PrinterException ex...
1
public Object clone() throws CloneNotSupportedException { CompassPlot clone = (CompassPlot) super.clone(); if (this.circle1 != null) { clone.circle1 = (Ellipse2D) this.circle1.clone(); } if (this.circle2 != null) { clone.circle2 = (Ellipse2D) this.circle2.clone()...
7
public synchronized WorkerThread borrowThread() { // TODO Auto-generated constructor stub if (idleThreads.isEmpty()) { return null; } return idleThreads.remove(0); }
1
public Elevator CallDown(int fromFloor){ //check for error cases if ((fromFloor>super.numFloors) || (fromFloor<0)){ System.out.println("This floor does not exist"); } //first we will send the first idle elevator for (Elevator e: elevators){ synchronized(e){ //if the elevator is idle //or if the ...
9
public final EsperParser.forloop_return forloop() throws RecognitionException { EsperParser.forloop_return retval = new EsperParser.forloop_return(); retval.start = input.LT(1); Object root_0 = null; Token ENDFOR46=null; EsperParser.for__return for_45 =null; Object E...
1
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tag tag = (Tag) o; return type == tag.type && value.equals(tag.value); }
4
public void bet (String[][] playerName,int[][] price,boolean cpu){ for(int i=0;i < menberNum;i++){ if(i==0){ if(cpu==true){ /////cpuの賭け金の設定 if(price[0][0]>cpuPrice*0.4){ //4割を切るまでは price[0][1] =(int)(price[0][0]*0.2);//10分の1を賭ける }else{ price[0][1] =price[0][0]; //4割を切ると全賭け ...
6
public UpgradeType getType() { return type; }
0
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
6
public String obfuscateText(String _text) { // Obfuscated code will return by using StringBuilder; StringBuilder sb = new StringBuilder(); // Change text to Char array. char ch[] = _text.toCharArray(); // Make String array per 1 character from ch[]. // This String array uses to check key character and etc....
7
public static void main( String[ ] args ) throws IOException { BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); String line = in.readLine( ); int t = Integer.parseInt( line ); int arr[][] = new int[ t + 1 ][ t + 1 ]; int dp[][] = new int[ t + 1 ][ t + 1 ]; for ( int i = 0; i < ...
8
private void getData(ProtobufDecodeMeta consumerMeta, boolean copyStepname) { if (copyStepname) { wStepname.setText(stepname); } wInputField.setText(Const.NVL(consumerMeta.getInputField(), "")); StringBuilder cpBuf = new StringBuilder(); String[] classpath = consumerMeta.getClasspath(); if (classpath !=...
6
public static Tag<Map<String, Tag>> newCompound(Map<String, ?> data) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException, NBTLibDisabledException, UnknownTagException { Map<String, Tag> map; try { for(O...
5
public void accapt(Visitor visitor) { // 关键实现 visitor.visit(this); }
0
public void toggleVisible() { if(frame == null) buildGUI(); frame.setVisible(!frame.isVisible()); }
1
private void creerActions(){ actions = new HashMap<String, Action>(); for(int i = 0 ; i < 9 ; i++ ){ for(int j = 0 ; j < 9 ; j++ ){ for(int k = 1 ; k <= 9 ; k++){ actions.put(i+""+j+""+k, new DynamicAction(i+""+j+""+k)); } } } }
3
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); session.removeAttribute("error...
9
public static MultiAnswerQuestion getMultiAnswerQuestionByXMLElem(XMLElement root, Quiz quiz, int pos) { int quizID = quiz.quizID; int position = pos; Object question = null; Object answer = null; double score = 10; int answerNumber = 0; boolean isOrdered = false; if (root.attributeMap.containsKey("isor...
7
IRCDDBExtApp.UpdateResult processUpdate ( int tableID, Scanner s, String ircUser, String msg ) { if (s.hasNext(datePattern)) { String d = s.next(datePattern); if (s.hasNext(timePattern)) { String t = s.next(timePattern); Date dbDate = null; try { dbDate = parseDateForma...
7
public JSONArray optJSONArray(String key) { Object o = opt(key); return o instanceof JSONArray ? (JSONArray)o : null; }
1
String[] countWords(String sentence, int returnWordCount) { // check input parameter if (sentence == null || sentence.isEmpty()) { System.out.println("Sentence not defined"); return null; } // check input parameter if (returnWordCount <= 0) { System.out.println("Return Words must be greater tha...
8
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Pair)) return false; final Pair pair = (Pair) o; if (first != null ? !first.equals(pair.first) : pair.first != null) return false; if (second != null ? !second.equals(pair.second) : pair.second != null) return false; ...
6