method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
aca1d479-6e96-49f6-8aba-1210357b5230 | 5 | private JSONObject getBookInfo(String bookId)
{
JSONObject ourBook = new JSONObject();
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost;user=sa;password=nopw");
... |
60f95cfe-268b-4316-8883-f8192a05ddcd | 9 | public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("comehome.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("comehome.out")));
// set default graph distances
for(int i=0; i<52; i++) {
for(int j=0; j<52; j++) {
gr... |
5fa02b25-a7d7-47ab-8457-48251150f514 | 3 | public void put(CacheableNode cacheableNode, long key) {
try {
if (capacity == 0) {
CacheableNode node = recent.popFront();
node.unlink();
node.unlinkSub();
if (node == emptyNode) {
CacheableNode empty = recent.popFront();
empty.unlink();
empty.unlinkSub();
}
} else {
capa... |
075dcf52-4167-42c4-a410-be221d4b00de | 1 | protected void incrementAge()
{
setAge(getAge() + 1);
if(getAge() > getMaxAge()) {
setDead();
}
} |
a6d8bdab-63c7-4518-82f2-910050051b5a | 8 | private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... |
d796213a-f4d4-450e-85af-320dcb51d30b | 1 | public boolean _setSpriteImage(URL spriteSourceImageURL)
{
if(spriteSourceImageURL != null)
{
sprite._setSpriteImage(spriteSourceImageURL);
return true;
}
else
{
return false; // Couldn't update sprite. Probably invalid sprite given.
}
} |
390146bb-c4b3-4808-9450-bcc583efc056 | 7 | public String selectSupplyGood(){
int numRnd = rndSupplyNum;
if (GamePanel.numFuel <= 0){
numRnd = (int)(3 * Math.random());
}
if (numRnd == 0){
supplyName = " fuel";
selectNumSupply(GamePanel.numFuel);
}
else if (numRnd == 1){
supplyName = " food";
select... |
6d50c396-78ab-4aa3-a592-9f081d3f8be7 | 6 | private boolean powerUpAndReset(boolean isRepeat)
{
//Service.WriteLog("Зашла в powerUpAndReset");
if (this.poll(true))
{
this.ack();
if (this.reset())
{
//Service.WriteLog("крути верти 200 раз");
for (int i=0; i<200; i++)
... |
5605c41c-ecb5-4216-bf1d-3578e5fa79b5 | 2 | private String readLine(BufferedReader commandReader) {
String commandLine = null;
do
try {
commandLine = commandReader.readLine();
this.log.info("Read one command line" + commandLine);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
this.log.info("Read on... |
665106b3-a848-45f7-b6a7-a4fa2910e4d6 | 2 | @Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception
{
Channel ch = e.getChannel();
Throwable cause = e.getCause();
if(cause instanceof TooLongFrameException)
{
sendErrorResponse(ctx, BAD_REQUEST);
... |
d3dc92b4-5f8f-477d-8936-2ab75506fa75 | 5 | * @param itemoid The ObjectID of the dropped item.
* @param dropperoid The OID of the dropper.
* @param ownerid The ID of the drop owner.
* @param dropfrom Where to drop from.
* @param dropto Where the drop lands.
* @param mod ?
* @param mesos Is the drop mesos?
* @return The item dro... |
ef2ca578-9139-4dd5-a0f5-a80e659ceaf9 | 6 | public static void cycle() {
indexCrossedPageBoundary = false;
checkInterrupts();
// Save bank/pc values for display later
int bank = pbr.getValue();
int addr = pc.getValue();
// Get the current opcode
int opcode = Core.mem.read(Size.BYTE, pbr.getValue(), pc.getValue());
pc.add(1);
// Get ... |
3db2d31d-afb5-45ea-95af-aa6b6c230181 | 4 | public Tile getTile(int x, int y) {
if (x < 0 || x >= getWidth())
return Tile.VOID;
if (y < 0 || y >= getHeight())
return Tile.VOID;
return map[x][y];
} |
0c2422f6-53e4-48df-bc1e-21fcf6ebc132 | 2 | public Object getBindingForVar(final CycVariable var) {
for (final Binding binding : getBindings()) {
if (binding.getVariable().equals(var)) {
return binding.getValue();
}
}
return null;
} |
53ccfd5f-92f8-4309-95cf-1a479aeece5a | 6 | public void writePresentAbsenceDataForR( File file) throws Exception
{
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
for( int x=0; x < getSampleNames().size(); x++)
writer.write( getSampleNames().get(x) + (x < getSampleNames().size()-1 ? "\t" : "\n") );
for( int y=0; y < getOtuNames(... |
b09c903b-af5b-4638-a537-a2e23cfed8ba | 9 | public FloatElement[] getSortedSimilarWordsByDelta(String word) throws Exception{
int index = model1.index(word);
FloatElement[] similarWords = new FloatElement[model1.sizeOfVocabulary];
//float invalid = -10;
for (int i=0; i<model1.sizeOfVocabulary; i++){
float pmi1 = 0;
float pmi2 = 0;
floa... |
27480c39-5e91-439c-b766-291e526195e2 | 1 | @Override
public double observe() {
double observed = 0;
for (int i = 0; i < n; i++) {
observed += bern.observe();
}
return observed;
} |
939f2b35-5e51-4392-b609-2d0277523e3b | 5 | InjectorClassLoader(final InjectorPluginLoader loader, final ClassLoader parent, File file) throws InvalidPluginException, MalformedURLException {
super(new URL[] { file.toURI().toURL() }, parent);
Validate.notNull(loader, "Loader cannot be null");
this.loader = loader;... |
af79a7c0-372f-4141-bc55-df75444bb0b2 | 8 | @Override
public List<ParsedColumn<?>> parse(RecordProvider recordProvider, ColumnSplitter columnSplitter, List<ColumnParser<?>> columnParserList) {
String record;
while ((record = recordProvider.next()) != null) {
List<String> columns = columnSplitter.split(record);
for (Col... |
dc2c8aa5-4d57-464f-a07d-23a1848ece41 | 8 | public GuiElButtonDropdown(Gui gui, GuiElPanel panel, Vector2f pos, Vector2f size, String text) {
super(gui,panel,pos,size,text);
final GuiElButtonDropdown me = this;
dropdown = new GuiElButton(gui,panel,new Vector2f(pos.x+size.x-size.y,pos.y),new Vector2f(size.y,size.y),null){
protected GuiElButtonDropdown... |
53990af5-cae3-4518-80d2-068eaf325a50 | 6 | public void letsGo() throws UnlandedRobotException, UndefinedRoadbookException, InsufficientChargeException, LandSensorDefaillance, InaccessibleCoordinate {
if (roadBook == null) throw new UndefinedRoadbookException();
while (roadBook.hasInstruction()) {
Instruction nextInstruction = roadBoo... |
daaf5c4c-fa05-4ca9-b118-cbfe8f5ee85e | 1 | private void clearSpace() throws IOException {
int c = in.peek();
while (Character.isWhitespace(c)) {
in.read();
c = in.peek();
}
} |
1740bb92-bfc8-4dac-ad8e-07afbda3f686 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Reply reply = (Reply) o;
if (id != reply.id) return false;
if (text != null ? !text.equals(reply.text) : reply.text != null) return false;
... |
5a87cf6c-a031-4061-be4b-fd3f7919a390 | 5 | public boolean equals( Object obj )
{
if ( obj instanceof Row )
{
Row r = (Row)obj;
if ( r.versions.equals(versions) && r.cells.size()==cells.size() )
{
for ( int i=0;i<cells.size();i++ )
{
FragList fl1 = cells.g... |
d67f1fbe-9102-4d11-9669-83994d5426fb | 1 | public void setTray(Tray tray) {
this.tray = tray;
if (tray != null) {
tray.addState(this);
}
} |
11965089-73a9-4236-afe2-910fa7744e9d | 1 | public QuickUnion(int N) {
this.id = new int[N];
for(int i = 0; i < N; i++) {
this.id[i] = i;
}
} |
4cd3125e-f6be-4041-bbe9-e262c90e947a | 0 | public Member getMember() {
return member;
} |
65dd7c6b-cd9f-44ae-b047-6569984fe430 | 3 | public XMLParser(String fileName){
super();
File schemaFile;
Schema schema;
Source xmlFile = new StreamSource(new File(fileName));
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFile = new File("bin/schema.xsd");
try {
//load the sc... |
e2bd1aba-d0a6-4ba6-82a8-1c0c2b9fb611 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
02cacff9-c3c4-489b-8507-b84ccfa32623 | 3 | public void bootstrap() {
this.pool = Executors.newCachedThreadPool();
try {
this.server = new ServerSocket(port);
log.info("server start listening : "+port);
mainThread = new Thread(new Runnable() {
@Override
public void run() {
... |
0d8a7d77-1458-4dcc-afed-536718763a73 | 0 | public String getType()
{
return type;
} |
faf3a3d6-e667-49d8-a2d9-8222a8925a83 | 4 | @Test
public void testCannonStatus() {
for(int i = 0; i < Tower.CannonStatus.values().length; ++i) {
if(tower.getStatus() == CannonStatus.READYING) {
assertTrue(tower.isCannonReadyToFire());
} else if(tower.getStatus() == CannonStatus.WAITING) {
assertTrue(tower.isCannonReadyToSearch());
} else if(t... |
da918525-8fa9-4809-9cf3-ba6d4b539950 | 2 | private static boolean validateAdditionalOptions() {
if (timeout > 0 && sysTimeout > 0) {
return false;
}
return true;
} |
55e4108b-f187-4aea-96ac-8bfe595bc3f9 | 3 | private void createToolBars() {
final IActionBars bars = getViewSite().getActionBars();
final IToolBarManager toolBarManager = bars.getToolBarManager();
if (this.startGruntTaskAction != null) {
toolBarManager.add(startGruntTaskAction);
}
if (this.stopGruntTaskAction != null) {
toolBarManager.add(this.s... |
969e19fd-d7b4-43fe-96d3-536845ed8036 | 9 | public int compare(Atom atoma, Atom atomb){
if (atoma.getType().equals(SUFFIX_TYPE_VAL) && !atomb.getType().equals(SUFFIX_TYPE_VAL)){//suffix atoms go to the back
return 1;
}
if (atomb.getType().equals(SUFFIX_TYPE_VAL) && !atoma.getType().equals(SUFFIX_TYPE_VAL)){
return -1;
}
... |
c538a814-1f26-4e70-af7b-18dfbbb67e58 | 1 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] A = new int[n];
for(int i=0;i<n;i++){
A[i]=in.nextInt();
}
A = heapSort(A);
print(A);
} |
f185d58a-023e-4c68-9681-182898cdc336 | 0 | @Column(name = "PEP_MOA_TIPO")
@Id
public BigInteger getPepMoaTipo() {
return pepMoaTipo;
} |
d057d3c0-8d62-4534-857e-b8a5a87aab57 | 4 | public int[] iterativ(int anz){
int[] ergebnis = new int[anz];
if(anz>=0){
ergebnis[0]=0;
}
if(anz>=1){
ergebnis[1]=1;
}
if(anz>1){
for(int i = anz-2;i>0;i--){
ergebnis[anz-(i)]=ergebnis[anz-i-1]+ergebnis[anz-i-2];
}
}
return ergebnis;
} |
66d5bdc3-750c-48bd-84df-88fc4af5c506 | 5 | public static void draw(Percolation perc, int N) {
StdDraw.clear();
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.setXscale(0, N);
StdDraw.setYscale(0, N);
StdDraw.filledSquare(N/2.0, N/2.0, N/2.0);
// draw N-by-N grid
int opened = 0;
for (int row = 1; row ... |
27831d5c-3541-413d-b014-c23e367acc43 | 5 | protected int getSmallestFlowDecay(World var1, int var2, int var3, int var4, int var5) {
int var6 = this.getFlowDecay(var1, var2, var3, var4);
if (var6 < 0) {
return var5;
} else {
if (var6 == 0) {
++this.numAdjacentSources;
}
if (... |
5a07ebb3-799f-45ad-aac7-6c07c5bf7be0 | 4 | @Override
public ReceivedData receive() {
newBuffer();
ReceivedData out = new ReceivedData();
// TODO Auto-generated method stub
if(socket != null && is != null){
try {
int len = is.read(buffer);
if(len != -1){
out.data = Arrays.copyOf(buffer,buffer.length);
out.length = len;
ou... |
a42da26e-33af-4082-bf87-c7a1eb1384f2 | 1 | public Location getSpawn() {
if(spawn == null) {
return null;
}
return spawn.getLocation();
} |
79df2668-2b97-4e46-b9a2-61212153f31f | 9 | public void moverPacman(int Direccion) {
if (!gano && !perdio) {
Coords ini = new Coords(pacman.getI(), pacman.getJ(), '.');
mVillPos[ini.getI()][ini.getJ()].set('.');
pacman = Simulador.moverPacman(Direccion, X);
int dismLife = 100/numLifes;
char nextItem = mVillPos[pacman.g... |
6c32fb57-7f41-40ef-9d72-051d8de3aa7f | 4 | private void setPlayerScoreCompatibliblity() {
for (Player player : plugin.getServer().getOnlinePlayers()) {
Scoreboard playerScoreboard = player.getScoreboard();
if (playerScoreboard != null && playerScoreboard != plugin.pingScoreboard) {
plugin.pingScoreboard = player.getScoreboard();
if (plugin.pingSc... |
95b2358a-2bdd-4bd1-a8d0-dde93af2abc2 | 1 | public double computeNetAssetValue() throws InterruptedException, ExecutionException {
final int numberOfCores = Runtime.getRuntime().availableProcessors();
final double blockingCoefficient = 0.9;
final int poolSize = (int) (numberOfCores / (1 - blockingCoefficient));
final List<Callable<Double>> partio... |
13e9ded9-f140-4d23-b646-bc8adc72cea7 | 7 | protected void unsingAllByThis(MOB mob, MOB invoker)
{
if(mob!=null)
for(int a=mob.numEffects()-1;a>=0;a--)
{
final Ability A=mob.fetchEffect(a);
if((A instanceof Song)
&&(!A.ID().equals(ID()))
&&((invoker==null)||(A.invoker()==null)||(A.invoker()==invoker)))
((Song)A).unsingMe(mob,invoker... |
beb3cde7-deaa-405f-8f37-6ef4390fd522 | 5 | @SuppressWarnings("rawtypes")
public static SingleColumnComparator createIntegerComparator(NumberName numberName, boolean ascending, String defaultString) throws Exception
{
final String type="integer";
if (ascending)
{
if (defaultString.equals(""))
{
return new SingleColumnComparato... |
cf444813-a174-49e2-8fc1-722f837cf5f1 | 2 | public void updateCoordinates() {
if (curDirec != nxtDirec) {
turn = true;
}
if (!turn) {
handleCoordinates();
} else {
turn = false;
}
curDirec = nxtDirec;
} |
7194084b-6029-4ea4-a650-83a0c543083d | 9 | public static void FillSubGraph (LinkedList<Node> nodeList, ArrayList<Node> subGraph) {
for (int i = 0; i < subGraph.size (); i++) {
Node current = subGraph.get (i);
Node[] pred = current.GetPred ();
Node[] succ = current.GetSucc ();
current.SetVisited (true);
for (int j = 0; j < pred.length; j++) {
... |
0421b4bf-cbfe-4642-ae55-1b762ac3773f | 0 | public String getType() {
return type;
} |
e3e8ba21-a358-400c-b06f-5ae1be45b226 | 2 | private List<Track> crearTrackList(List<String> inGdbList) {
List<Track> innerTrackList = new LinkedList();
for (String archivoGdb : inGdbList) {
Track pista = fillTrack(archivoGdb);
if (pista.isFilled()) {
innerTrackList.add(pista);
... |
028b621b-8679-4222-abc3-55221e720e00 | 0 | public int GetCurrentInputBufferUsingTheBus(int busNumber)
{
return currentInputBufferUsingTheBus[busNumber];
} |
62191e5d-b59e-4528-b2de-bcbc47b4f726 | 1 | private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
return new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory c... |
5d0d9fa4-6263-4639-94b7-4a39110989b6 | 1 | public static void roveImgPrint(){
rover = head;
while(rover!=null){
System.out.println(rover.img);
rover = rover.next;
}
} |
ffc0d18f-8268-47cb-8913-8f773ac33f15 | 5 | private static void beInteractive() throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line;
do {
line = in.readLine();
if (line.startsWith("pub"))
publish(line.substring(4));
if (line.startsWith("sub"))
subscribe(line.substring(4));
if (line.... |
4609ff3e-9255-4ffe-9e12-d159ebbccd4d | 2 | private static void createAndFillHuffmanTree(int[] header) throws IOException
{
huffmanTree = new GradProjectDataStruct();
for(int i = 0; i < header.length; i++)
if(header[i] != 0)
huffmanTree.insert(new Node(header[i], i));
huffmanTree.createHuffTree();
huffmanTree.fillHuffTab... |
99036af3-5894-457e-8a4b-c24742795a48 | 5 | public boolean find(String keyword){
boolean ok = false;
String toLowerCase = keyword.toLowerCase();
try {
BufferedReader bufferedReader = new BufferedReader (new FileReader (id + ".txt"));
//Buscar si existe una palabra
String line;
... |
ae9e5991-c4d3-4546-8b0b-b1c05f3aef02 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Estado other = (Estado) obj;
if (this.idEstado != other.idEstado && (this.idEstado == null || !this.idEst... |
c100f71e-bbee-45d9-8799-69b9390f23f0 | 6 | public void keyPressed(KeyEvent event) {
Object s = event.getSource();
if (s instanceof JTextField && (JTextField)s == userEntry) {
if (event.getKeyCode() == KeyEvent.VK_ENTER) {
endDialog();
}
} else if (s instanceof JPasswordField &&
(JPasswordField)s == passwdEntry) {
... |
63454083-1bd3-490e-9b35-e77401045dc4 | 9 | private void requestNewPwd() {
boolean result = false;
String username = forgotPwdPanel.getUsername();
String email = forgotPwdPanel.getEmail();
if (email.equals("") && username.equals(""))
forgotPwdPanel.setStatusText("Användarnamn eller epost-adress måste anges!");
else if (!email.equals("") && !username... |
7368c3a6-9035-44d5-90e8-0f3fe56bad9a | 1 | @Override
public IautosSellerInfo getModel() {
if (null == newSeller) {
newSeller = new IautosSellerInfo();
}
return newSeller;
} |
accb9bbe-d2aa-42e2-9c4d-8958e4b90887 | 9 | public java.io.Reader getReader() throws java.io.IOException
{
if (inBuf == 0 && nextCharInd >= maxNextCharInd)
return inputStream;
char[] tmp = null, toPush;
int cnt = 0;
if (inBuf != 0)
{
tmp = new char[2 * inBuf];
for (int i = 0; i < inBuf; i++)
if (b... |
17a03c6c-9da2-4a90-bf54-eb01cf9b9f98 | 5 | @Override
public void execute(double t) {
double[] v = new double[output.getDim()];
Arrays.fill(v, 1);
Matrix y = new ColumnMatrix(v);
for (InputConnector ic : inputs) {
if (ic != null && ic.isConnected() && ic.getSource() != null) {
y = y.arrayTimes(ic.getInput());
}
}
try {
output.setOutput(... |
10919654-27d1-420b-978a-f03e54ed34e4 | 0 | public static void addPlayer(Player p){
warnLevel.put(p, 0.0);
} |
e322483c-827a-4325-ae66-ef43b8225d6e | 2 | @Override
public
void startSocket() {
try {
socket = new Socket(address, port);
socket.setSoTimeout(300); // Set Timeout 300ms
} catch (UnknownHostException e) {
System.err.println("Don't know about host: "
+ address);
System.err.println("DataSocket Server answer: " + e.getMessage());
} cat... |
98b4a783-7ce3-4e8c-83c7-4232a08fb15d | 3 | public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignore) {
}
// Load favourites
try {
favouriteList.load();
} catch (FileNotFoundException ignore) {
... |
aacbdc7c-bd59-479d-a8f5-593a18646388 | 5 | private JSONObject getExtendedFeed(JSONArray discoFeed, HttpServletRequest request) {
JSONObject json = new JSONObject();
String lastIdp = "";
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
String name = cookie.... |
3ab0b369-55e8-404c-ba10-9d48436daaf0 | 4 | public Node getKthNode(Node headNode, int k){
if(headNode==null)
return null;
int posFromStart = 0;
Node node = headNode;
while(node!=null){
if(posFromStart==k)
break;
posFromStart++;
node = node.getNextNode();
}
Node currNode = headNode;
Node kNode = node;
while(kNode... |
2aa53eb7-a7a7-4c8a-86d7-bc44810e088a | 1 | private void drawList(Graphics2D g2d, TreeMap<Integer, String> list){
for(Map.Entry<Integer, String> mp : list.entrySet()){
drawnString(g2d, mp.getKey(), mp.getValue());
}
} |
93805cdc-8c1d-4dc4-9ff8-53e02cd3b24e | 3 | protected void sendRaw(String message) {
if (bot == null || bot.getWriter() == null) return;
try {
bot.getWriter().append(message + "\r\n");
bot.getWriter().flush();
}
catch (IOException e) {
}
} |
2c54c633-1628-4b93-beaa-29b8f14eda83 | 3 | private void init(){
// 根据配置信息创建连接池
String countStr = Config.getStr(POP_COUNT);
if(MyStringUtil.isBlank(countStr)){
this.count = 0;
}else{
this.count = Integer.valueOf(countStr);
}
this.drivers = new ArrayList<Driver>(this.count);
// 读取数据库连接池配置信息
if(this.count <= 0){// 单个数据库链接池配置
DbPool... |
f08e7d35-b2e5-449b-9fdd-91a9b1c51a82 | 2 | public byte[] preHash(String username, String password) {
try {
// Hash the password with the user id (a constant salt)
MessageDigest md = MessageDigest.getInstance("SHA-256");
String seed = username.toLowerCase() + password;
byte[] bytes = seed.getBytes("UTF-8");
// Do some key stretching to slow ... |
f9dd1db3-b2e7-434b-a67d-b1b07a87945e | 9 | public static byte[] encrypt(String message, String keyText) {
final byte[] initialKeyBytes = keyText.getBytes();
final byte[] keyBytes=new byte[24];
for(int i=0; i<24; i++){
if (i<initialKeyBytes.length){
keyBytes[i]=initialKeyBytes[i];
}
el... |
c6549ce3-1bc7-4072-b766-89c9f737bf56 | 7 | private int number(StringBuilder token, int i) throws BadNumberException, BadCharacterException
{
if(i < expr.length )
{
if(isDigit(expr[i]))
{
token.append(expr[i]);
return number(token, ++i);
}
else if (expr[i] == '.')
{
if(((i+1) < expr.length && isDigit(expr[i+1])))
{
token.... |
c6f1c924-ded2-4114-a703-905acdc87940 | 1 | public static void main(String[] args) {
CycSOAPService cycSOAPService = new CycSOAPService();
try {
CycList query = new CycList();
query.add(CycObjectFactory.makeCycSymbol("+"));
query.add(new Integer(1));
query.add(new Integer(1));
Log.current.println("binary query=" + query... |
41e56787-1000-4b20-97e7-3ba757cad454 | 6 | public static void main(String args[])
{
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://... |
d804eaa0-d151-4b9e-a5c1-909a6a9a3b54 | 3 | @Override
public List<Integer> getRandomNumbers(int amount, int maxRange) {
if (amount < 1 || maxRange < 1) {
throw new IllegalArgumentException("Amount or maxRange can't be less then 1!");
}
Random random = new Random();
List<Integer> targetList = new ArrayList<Intege... |
e6f1cbf2-cc12-40f9-8c17-d4ac7ded4851 | 9 | public void setInstances(Instances newins) {
m_attribIndex = 0;
m_as = null;
m_data = newins;
if(m_colorAttrib!=null) {
m_colorAttrib.removeAllItems();
m_colorAttrib.addItem("No class");
for(int i=0; i<m_data.numAttributes(); i++) {
String type = "";
switch (m_data.attribute(i).type(... |
ba729840-a93d-4d2b-ba47-fb3a1bfc8198 | 3 | private void drawReadyGo( Graphics g, ImageObserver imgObserver ) {
List< Integer > pos = _model.getReadyGoPos();
int x = ( _model.isGo() ) ? pos.get( 2 ) : pos.get( 0 );
int y = ( _model.isGo() ) ? pos.get( 3 ) : pos.get( 1 );
Image img = ( _model.isGo() ) ? _model.getGo() : _model.getReady();
g.dra... |
7b2b4767-b495-4315-a323-3314906889d4 | 0 | public VueMenu getVue() {
return vue;
} |
e773e1f5-209e-47bd-bcef-0d570bfe4483 | 1 | public void fire(int targetX, int targetY) {
if(weapon.isFireReady()) weapon.shoot(targetX, targetY);
} |
66129e6d-4e72-458e-ad2c-f19e1c17f385 | 6 | public List<String> getDistinctProducers(){
Connection conn = null;
PreparedStatement st = null;
List<String> producers = new ArrayList<String>();
try {
conn = OracleDAOFactory.createConnection();
st = conn.prepareStatement(GET_DISTINCT_PRODUCERS);
ResultSet row = st.executeQuery();
while(row.next()... |
78711411-6368-41f1-84e1-1fa80bde717b | 8 | public static void main(String[] args) {
Scanner words;
HashSet<String> dict = new HashSet<String>();
Scanner userFile;
try {
words = new Scanner(new File("words.txt"));
while (words.hasNext()) {
String word = words.... |
b98583dc-7464-4947-833b-57d6b8bb7c0a | 6 | public static HashSet<String> getKvFiles(String dir) throws IOException {
HashSet<String> returnSet = new HashSet<>();
Matcher fileMatch = KvPattern.matcher(dir);
Path init = Paths.get(dir);
if (Files.exists(init)){
if (Files.isDirectory(init)){
Itera... |
b7ce4c3f-a32f-4a6e-906e-d8c493da96ae | 3 | static boolean check(int a, int b, int l) {
if ((b - a + 1) % l != 0)
return false;
int pos = 0;
for (int i = a + l; i <= b; i++) {
if (w[a + pos] != w[i])
return false;
pos = (pos + 1) % l;
}
return true;
} |
e345be4e-8d38-499b-b7e4-6e01f8071f65 | 0 | public boolean isPause() {
return type == PAUSE;
} |
9e03ac5a-698e-4557-821d-e1d26d72ca08 | 4 | public static State[] getClosure(State state, Automaton automaton) {
List list = new ArrayList();
list.add(state);
for (int i = 0; i < list.size(); i++) {
state = (State) list.get(i);
Transition transitions[] = automaton.getTransitionsFromState(state);
for (int k = 0; k < transitions.length; k++) {
T... |
7d1101d1-1782-4023-86fe-4844cee7dea2 | 9 | public java.awt.Component getTableCellEditorComponent(
javax.swing.JTable table, Object value, boolean isSelected,
int row, int column) {
if (table.getName() != null && table.getName().equals("MashTable")) {
// Check to see if we have a row and column for the sparge type
if (column == 1) {
if (row ... |
cdc7aed3-1e60-4038-887e-7d1780099236 | 4 | private Street createStreet() throws StorageReaderException {
String name = null;
try {
name = nextString();
int[] color = new int[3];
for(int i = 0; i < color.length; i++) {
color[i] = nextInt();
}
int price = nextInt();
int[] income = new int[7];
for(int i = 0; i < income.length; i++) {
... |
d86fc93d-c689-4d85-804c-5d440a43c200 | 1 | @Test
public void subtractTest() {
for (int i = 0; i < TESTS; i++) {
double x1 = rand.nextInt();
double y1 = rand.nextInt();
double x2 = rand.nextInt();
double y2 = rand.nextInt();
Vector v1 = new Vector(x1, y1);
Vector v2 = new Vector(x2, y2);
Vector res = new Vector(x1 - x2, y1 - y2);
asser... |
3ce8d083-9323-4bef-a258-e2392986fac5 | 9 | 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 = maxN... |
a5e3faaa-8578-461e-94da-d53f8cb85408 | 3 | public static String strToXMLKeySafe(String str) {
if (str == null) return "";
if (Functions.is_numeric(str) == true) {
str = 'a' + str;
} else if (Functions.is_numeric(Functions.substr(str,0,1)) == true) { // End of if (is_numeric(str))
str = str.replaceAll("/^(\\d*)/","");
} // End of elseif (is_numeric... |
dcd1b772-1461-4ed8-9da0-b63a65517c95 | 2 | public void hit() {
deck.hit(player);
info.update(deck);
if (player.getHand().size() >= 5) {
hitButton.setEnabled(false);
}
if (player.checkBust()) {
hitButton.setEnabled(false);
JOptionPane.showMessageDialog(this, "Bust!! No money collected.");
stand();
}
doubleButton.setEnabled(false);
} |
74d7715e-c73d-468b-8553-b3a7f826a830 | 0 | @Override
public void modifiedStateChanged(DocumentEvent e) {} |
de042ea4-e9c0-4a8b-9513-8625e7a60bd8 | 7 | public HashMap<Text, Double> calculateCosineSimilarity(ArrayList<Text> textCollection, String Query){
CosineSimilarity cosim = new CosineSimilarity();
Text QueryText = new Text(Query);
ArrayList<String> QueryTokens = tokenize(QueryText);
HashMap<String, Double> TfIdfQuery = new HashMap<String, Double>();
Ma... |
127faa6e-9e17-480e-8ec0-5c67918ba097 | 5 | public final static boolean fightAvailable(int retry) {
for (int i = retry; i > 0; i--) {
if (i != retry) {
Control.sleep(600);
Output.println(" - versuche erneut", 1);
}
try {
// HTTP parameters stores header etc.
HttpParams params = new BasicHttpParams();
params.setParameter("http.pro... |
df07e257-efad-4cbb-ba61-69e5e21c50ac | 8 | public void reduce(Text key, Iterator<Text> values,
OutputCollector<Text, Text> output, Reporter reporter)
throws IOException {
try {
TreeMap<String, Integer> keywords = new TreeMap<String, Integer>();
TreeMap<String, Integer> urls = new TreeMap<String, Integer>(... |
189452f4-e41b-4383-b4a1-4ada47ae69c0 | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
CourseRec rec = courseModel.getFilteredCourses().get(rowIndex);
switch (columnIndex) {
// This is used to get the whole object
case -1:
return rec;
case 0:
return rec.getStatus();
case 1:
return (rec.hasDateless() ? "?" ... |
7a3c9942-6479-4733-9577-521bdfe82609 | 4 | public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // FIRST_NAME
return FIRST_NAME;
case 2: // LAST_NAME
return LAST_NAME;
case 3: // STATUS
return STATUS;
case 4: // ID
return ID;
default:
return ... |
504e2ba8-0f03-487f-bccf-d8dbead4560b | 6 | @Override
public Boolean[] segment(Utterance utterance, boolean training, boolean trace) {
// Get info about the utterance. Since the segmentation is a copy,
// don't worry about modifying it
Boolean[] segmentation = utterance.getBoundariesCopy();
String[] units = utterance.getUnits();
Boolean[] stresses = u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.